695593266@qq.com 10 månader sedan
förälder
incheckning
b2f104e9b4

+ 4 - 1
src/views/material/BOMmanage/components/detailedList.vue

@@ -207,7 +207,10 @@
           >
           </el-input>
           <!--  -->
-          <el-button type="primary" @click="factoriesFn(row.code)"
+          <el-button
+            type="primary"
+            @click="factoriesFn(row.code)"
+            v-if="row.approvalStatus != 2 && row.approvalStatus != 1"
             >选择</el-button
           >
           <!-- <el-select v-model="row.factories" size="mini" clearable class="ele-block" filterable placeholder="请选择生产厂家">

+ 5 - 1
src/views/material/BOMmanage/qualityTesting/inspectionTemplate.vue

@@ -2,6 +2,7 @@
   <ele-modal
     title="选择"
     :visible.sync="visible"
+    v-if="visible"
     :before-close="handleClose"
     :close-on-click-modal="false"
     :close-on-press-escape="false"
@@ -238,7 +239,10 @@
         this.visible = false;
       },
       changeSel() {
-        this.$emit('changeSel', this.current);
+        if (this.current) {
+          this.$emit('changeSel', this.current);
+        }
+
         this.handleClose();
       },
       handleCurrentChange(row) {

+ 60 - 2
src/views/material/BOMmanage/qualityTesting/term.vue

@@ -9,6 +9,7 @@
       cache-key="inspectionClassify"
       row-key="qualityLevelId"
       :selection.sync="selection"
+      @selection-change="handleSelectionChange"
     >
       <template v-slot:toolbar>
         <el-button @click="handAdd" size="mini" type="primary" v-if="!isView"
@@ -17,6 +18,13 @@
         <el-button @click="handSelect" size="mini" type="primary" v-if="!isView"
           >选择质检方案</el-button
         >
+        <el-button
+          @click="batchDelete"
+          size="mini"
+          type="primary"
+          v-if="!isView"
+          >批量删除</el-button
+        >
       </template>
 
       <template v-slot:textType="{ row }">
@@ -92,7 +100,7 @@
               dictName="工艺参数单位"
               clearable
               filterable
-              v-model="row.unit"
+              v-model="row.unitName"
             >
             </DictSelection>
             <!-- <el-input v-model="row.unit" :disabled="isView"> </el-input> -->
@@ -171,6 +179,13 @@
           //   align: 'center',
 
           // },
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            fixed: true
+          },
           {
             prop: 'categoryLevelClassName',
             label: '质检类型',
@@ -258,6 +273,50 @@
         });
       },
 
+      handleSelectionChange() {},
+
+      batchDelete() {
+        if (this.selection.length == 0) {
+          this.$message.warning('请选择需要删除的质检项');
+        }
+
+        // console.log(this.list, 'this.List');
+        // console.log(this.selection, 'this.selection');
+
+        let indexList = [];
+
+        if (this.selection.length == this.list.length) {
+          this.list = [];
+        } else {
+          for (let i = 0; i < this.selection.length; i++) {
+            for (let j = 0; j < this.list.length; j++) {
+              if (this.selection[i].id == this.list[j].id) {
+                indexList.push(j);
+              }
+            }
+          }
+        }
+
+        if (indexList.length != 0) {
+          indexList.forEach((it) => {
+            this.list.splice(it, 1);
+          });
+        }
+
+        // this.selection.forEach((item) => {
+        //   const index = this.list.findIndex((it) => (it.id = item.id));
+
+        //   console.log('1111111111111111111');
+        //   if (index) {
+        //     indexList.push(index);
+        //   }
+        // });
+
+        console.log(indexList, 'indexList');
+        // this.selection = [];
+        // this.$forceUpdate();
+      },
+
       getDate() {
         return this.list;
       },
@@ -269,7 +328,6 @@
         this.$refs.inspectionTemplateRef.open();
       },
       async changeSel(list) {
-        console.log(list, 'list');
         // let ids = list.map((item) => item.id).toString();
         // console.log(ids, 'ids')
         await getTemplateById(list.id).then(({ data }) => {