Преглед изворни кода

Merge branch 'test-new' of https://git.agilestar.cn/spfm-group/spfm-market-front into test-new

molilang пре 3 година
родитељ
комит
76157f1f40
1 измењених фајлова са 41 додато и 8 уклоњено
  1. 41 8
      src/pages/main/demandDevelop/index.vue

+ 41 - 8
src/pages/main/demandDevelop/index.vue

@@ -240,7 +240,11 @@
           <el-upload
             v-if="vision == '信息补填'"
             style="float: right; margin-bottom: 20px"
-          ></el-upload>
+            action=""
+            :http-request="handleMessage"
+            :show-file-list="false"
+            ><el-button size="small" type="primary">导入</el-button></el-upload
+          >
           <div
             style="margin: 20px 0; padding: 0 20px"
             v-if="vision == '信息补填'"
@@ -258,7 +262,7 @@
                 <template slot-scope="scope">
                   <el-input
                     v-model="scope.row.factoryName"
-                    :disabled="titname != '审批'"
+                    :disabled="titname !== '审批'"
                   ></el-input>
                 </template>
               </el-table-column>
@@ -266,7 +270,7 @@
                 <template slot-scope="scope">
                   <el-input
                     v-model="scope.row.workLoad"
-                    :disabled="titname != '审批'"
+                    :disabled="titname !== '审批'"
                   ></el-input>
                 </template>
               </el-table-column>
@@ -442,7 +446,7 @@ import toolList from "../../../components/toolList";
 import myUpload from "../../../components/upload";
 import uploadDown from "../../../components/uploadDown.vue";
 import deptTreeOnly from "../performance/components/deptTreeOnly.vue";
-const Excel = require('exceljs')
+const Excel = require("exceljs");
 export default {
   components: {
     // mySearch,
@@ -622,6 +626,31 @@ export default {
     handleSuccess({ file }) {
       this.file.push(file);
     },
+    handleMessage({ file }) {
+      const workbook = new Excel.Workbook();
+      // workbook.xlsx.readFile(file.path) // use path
+      const Array = [];
+      workbook.xlsx.load(file).then(async () => {
+        const worksheet = await workbook.getWorksheet(1);
+        worksheet.eachRow(({ values }) => {
+          let obj = {
+            factoryName: values[1],
+            workLoad: values[2],
+          };
+          Array.push(obj);
+        });
+        if (
+          this.infodatas.length === 1 &&
+          !this.infodatas[0].factoryName &&
+          !this.infodatas[0].workLoad
+        ) {
+          this.infodatas = Array;
+        } else {
+          console.log('adaadad')
+          this.infodatas.push(...Array);
+        }
+      });
+    },
     handleApprove(type) {
       if (type === "取消") {
         this.dialogStatus = false;
@@ -1070,8 +1099,7 @@ export default {
           this.woNo = mkOnlineChannel.woNo;
           // 步骤
           this.step = mkOnlineChannel.step;
-          // 数组回显
-          this.infodatas = mkOnlineChannel.logList;
+
           this.dialogStatus = true;
           if (this.titname === "添加") {
             // 审批说明
@@ -1081,14 +1109,19 @@ export default {
             if (this.titname === "查看") {
               this.disableStatus = true;
               this.visionsts = "";
+              // 数组回显
+              this.infodatas = mkOnlineChannel.logList;
             } else {
               if(this.step === '0'){
                 this.dialogStatus = false
               }
               if (this.step === "7") {
-                this.vision = '信息补填'
+                this.vision = "信息补填";
                 this.visionsts = "";
+                this.infodatas = [{}];
               } else {
+                // 数组回显
+                this.infodatas = mkOnlineChannel.logList;
                 this.visionsts = "2";
               }
             }
@@ -1639,7 +1672,7 @@ export default {
       this.attList = v;
     },
     uploadBackin(v) {
-      console.log(v,'v')
+      console.log(v, "v");
       let x = [];
       for (let i = 1; i < v.data.body.length; i++) {
         x.push({