浏览代码

Excel更新品牌

caojunjie 1 年之前
父节点
当前提交
9c02940532
共有 1 个文件被更改,包括 65 次插入1 次删除
  1. 65 1
      src/views/tirePartsMall/basicData/customerInformation/index.vue

+ 65 - 1
src/views/tirePartsMall/basicData/customerInformation/index.vue

@@ -25,7 +25,8 @@
               </el-button>
               <el-button type="primary" size="mini" icon="el-icon-top" @click="outExport">导出
               </el-button>
-
+                <el-button type="primary" size="mini" icon="el-icon-download" @click="brandBox = true">Excel更新品牌
+                </el-button>
             </template>
             <template slot="enableOrNot" slot-scope="{row,index,disabled}">
               <div v-if="row.enableOrNot === 1">启用</div>
@@ -88,6 +89,21 @@
         温馨提示 第一次导入时请先下载模板
       </p>
     </el-dialog>
+    <!--更新品牌按钮-->
+    <el-dialog title="更新品牌" append-to-body :visible.sync="brandBox" width="555px" :close-on-click-modal="false"
+             v-dialog-drag>
+      <avue-form :option="brandExcel" v-model="brandExcelForm" table-loading="excelLoading" :upload-before="uploadBefore"
+                 :upload-after="brandAfter">
+          <template slot="brandTemplate">
+              <el-button type="primary" @click="brandDerive">
+                  点击下载<i class="el-icon-download el-icon--right"></i>
+              </el-button>
+          </template>
+      </avue-form>
+      <p style="text-align: center;color: #DC0505">
+          温馨提示 第一次导入时请先下载模板
+      </p>
+    </el-dialog>
   </div>
 </template>
 
@@ -113,6 +129,7 @@ export default {
     return {
       corpTypeVisible: false,
       excelForm: {},
+      brandExcelForm: {},
       WarehouseNameList:[],
       excelOption: {
         submitBtn: false,
@@ -140,9 +157,36 @@ export default {
           }
         ]
       },
+      brandExcel: {
+        submitBtn: false,
+        emptyBtn: false,
+        column: [
+          {
+              label: "模版下载",
+              prop: "brandTemplate",
+              formslot: true,
+              span: 24
+          },
+          {
+              label: "导入品牌",
+              prop: "brandFile",
+              type: "upload",
+              drag: true,
+              loadText: "品牌上传中,请稍等",
+              accept: '.xls,.xlsx',
+              span: 24,
+              propsHttp: {
+                  res: "data"
+              },
+              tip: "请上传 .xls,.xlsx 标准格式文件",
+              action: "/api/blade-sales-part/corpsDesc/importBrand"
+          }
+        ]
+      },
       src: '',
       show: true,
       excelBox: false,
+      brandBox: false,
       loading: false,
       search: {},
       detailData: {},
@@ -317,12 +361,20 @@ export default {
       )
     },
   methods: {
+    // 导入客户
     derivation() {
       window.open(
         `/api/blade-sales-part/corpsDesc/corpsExport?${this.website.tokenHeader
         }=${getToken()}`
       );
     },
+    // 导入品牌
+    brandDerive() {
+      window.open(
+          `/api/blade-sales-part/corpsDesc/corpsExportBrand?${this.website.tokenHeader
+          }=${getToken()}`
+      );
+    },
     //导出
     outExport() {
       let config = { params: { ...this.search } }
@@ -353,6 +405,7 @@ export default {
       done();
       loading = true;
     },
+    //   客户导入后回显
     uploadAfter(res, done, loading, column) {
       this.excelBox = false;
       let myError = res.toString();//转字符串
@@ -362,6 +415,17 @@ export default {
       loading = false;
       done();
     },
+    //   品牌更新后回显
+      brandAfter(res,done,loading,column) {
+          this.brandBox = false;
+          console.log(res,'res')
+          let myError = res.toString();//转字符串
+          myError = myError.replace("Error: ", "") // 去掉前面的" Error: "
+          this.$message.success(myError);
+          this.refreshChange();
+          loading = false;
+          done();
+      },
     filterNode(value, data) {
       console.log(value, data)
       if (!value) return true;