Ver código fonte

商品 客户上传

qinbai 3 anos atrás
pai
commit
0499a990ab

+ 50 - 46
src/views/basicData/commodityType/index.vue

@@ -26,6 +26,22 @@
                    @size-change="sizeChange"
                    @refresh-change="refreshChange"
                    @on-load="onLoad">
+          <template slot="menuLeft">
+            <el-button
+              type="primary"
+              size="small"
+              icon="el-icon-plus"
+              @click="commodityImport()"
+            >导入
+            </el-button>
+            <el-button
+              type="success"
+              icon="el-icon-upload2"
+              size="small"
+              @click="derivation()"
+            >下载模板
+            </el-button>
+          </template>
           <template slot-scope="scope" slot="menu">
             <el-button
                 type="text"
@@ -128,6 +144,12 @@
             </template>
           </avue-crud>
         </el-dialog>
+        <el-dialog title="导入商品"
+                   append-to-body
+                   :visible.sync="excelBox"
+                   width="555px">
+          <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter"/>
+        </el-dialog>
       </basic-container>
     </el-col>
   </el-row>
@@ -313,42 +335,11 @@ export default {
             loadText: '模板上传中,请稍等',
             span: 24,
             propsHttp: {
-              res: 'data'
+              res: 'data',
+              // url:'link'
             },
             tip: '请上传 .xls,.xlsx 标准格式文件',
-            action: "/api/blade-user/import-user"
-          },
-          {
-            label: "数据覆盖",
-            prop: "isCovered",
-            type: "switch",
-            align: "center",
-            width: 80,
-            dicData: [
-              {
-                label: "否",
-                value: 0
-              },
-              {
-                label: "是",
-                value: 1
-              }
-            ],
-            value: 0,
-            slot: true,
-            rules: [
-              {
-                required: true,
-                message: "请选择是否覆盖",
-                trigger: "blur"
-              }
-            ]
-          },
-          {
-            label: '模板下载',
-            prop: 'excelTemplate',
-            formslot: true,
-            span: 24,
+            action: "/api/blade-client/goodsdesc/import-desc?typeId="+this.treeDeptId+"",
           }
         ]
       }
@@ -361,12 +352,6 @@ export default {
         this.initData(0);
       }
     },
-    'excelForm.isCovered'() {
-      if (this.excelForm.isCovered !== '') {
-        const column = this.findObject(this.excelOption.column, "excelFile");
-        column.action = `/api/blade-user/import-user?isCovered=${this.excelForm.isCovered}`;
-      }
-    }
   },
   computed: {
     ...mapGetters(["userInfo", "permission"]),
@@ -401,6 +386,31 @@ export default {
     }
   },
   methods: {
+    //导入
+    commodityImport(){
+      if(this.treeDeptId === ''){
+        this.$message.warning("请选择商品类型")
+      }else{
+        this.excelBox = !this.excelBox
+        const column = this.findObject(this.excelOption.column, "excelFile");
+        column.action = "/api/blade-client/goodsdesc/import-desc?typeId="+this.treeDeptId+"";
+      }
+    },
+    derivation() {
+      this.$confirm("是否下载模板?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        window.open(`/api/blade-client/goodsdesc/export-template?${this.website.tokenHeader}=${getToken()}`);
+      });
+    },
+    uploadAfter(res, done, loading, column) {
+      window.console.log(column);
+      this.excelBox = false;
+      this.refreshChange();
+      done();
+    },
     nodeClick(data) {
       this.treeDeptId = data.id;
       this.page.currentPage = 1;
@@ -556,12 +566,6 @@ export default {
     handleImport() {
       this.excelBox = true;
     },
-    uploadAfter(res, done, loading, column) {
-      window.console.log(column);
-      this.excelBox = false;
-      this.refreshChange();
-      done();
-    },
     handleTemplate() {
       window.open(`/api/blade-user/export-template?${this.website.tokenHeader}=${getToken()}`);
     },

+ 67 - 3
src/views/basicData/customerInformation/index.vue

@@ -37,6 +37,20 @@
         >
           <template slot="menuLeft">
             <el-button
+              type="primary"
+              size="small"
+              icon="el-icon-plus"
+              @click="commodityImport()"
+            >导入
+            </el-button>
+            <el-button
+              type="success"
+              icon="el-icon-upload2"
+              size="small"
+              @click="derivation()"
+            >下载模板
+            </el-button>
+            <el-button
               icon="el-icon-printer"
               size="small"
               type="primary"
@@ -72,6 +86,12 @@
           :switchDialog="switchDialog"
           @onClose="onClose()"
         ></report-dialog>
+        <el-dialog title="导入商品"
+                   append-to-body
+                   :visible.sync="excelBox"
+                   width="555px">
+          <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter"/>
+        </el-dialog>
       </basic-container>
     </el-col>
   </el-row>
@@ -86,6 +106,7 @@ import {
   deleteDetails,
   getDeptLazyTree
 } from "@/api/basicData/customerInformation";
+import {getToken} from '@/util/auth';
 import reportDialog from "@/components/report-dialog/main";
 export default {
   name: "customerInformation",
@@ -128,6 +149,27 @@ export default {
         pageSize: 10,
         pagerCount: 5,
         total: 0
+      },
+      excelBox: false,
+      excelForm: {},
+      excelOption: {
+        submitBtn: false,
+        emptyBtn: false,
+        column: [
+          {
+            label: '模板上传',
+            prop: 'excelFile',
+            type: 'upload',
+            drag: true,
+            loadText: '模板上传中,请稍等',
+            span: 24,
+            propsHttp: {
+              res: 'data',
+            },
+            tip: '请上传 .xls,.xlsx 标准格式文件',
+            action: "",
+          }
+        ]
       }
     };
   },
@@ -139,6 +181,30 @@ export default {
     // this.onLoad()
   },
   methods: {
+    commodityImport(){
+      if(this.treeDeptId === ''){
+        this.$message.warning("请选择客户类型")
+      }else{
+        this.excelBox = !this.excelBox
+        const column = this.findObject(this.excelOption.column, "excelFile");
+        column.action = "/api/blade-client/corpsdesc/import-desc?typeId="+this.treeDeptId+"";
+      }
+    },
+    derivation() {
+      this.$confirm("是否下载模板?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        window.open(`/api/blade-client/corpsdesc/export-template?${this.website.tokenHeader}=${getToken()}`);
+      });
+    },
+    uploadAfter(res, done, loading, column) {
+      window.console.log(column);
+      this.excelBox = false;
+      this.refreshChange();
+      done();
+    },
     nodeClick(data) {
       this.treeDeptId = data.id;
       this.page.currentPage = 1;
@@ -253,7 +319,7 @@ export default {
       console.log("1");
     },
     refreshChange() {
-      console.log("1");
+      this.onLoad(this.page);
     },
     onLoad(page, params = { parentId: 0 }) {
       let queryParams = Object.assign({}, params, {
@@ -263,9 +329,7 @@ export default {
       });
       customerList(queryParams).then(res => {
         this.dataList = res.data.data.records;
-        console.log(res.data.data.total);
         this.page.total = res.data.data.total;
-        console.log(this.page);
       });
     },
     //树桩列点击展开触发