Sfoglia il codice sorgente

批量删除报工信息

longfenglin 1 anno fa
parent
commit
9458548e62

+ 44 - 3
src/views/produce/components/jobBooking/components/semiProductJobBom.vue

@@ -4,11 +4,16 @@
 
       <div class="name">报工信息({{ list.length || 0 }})个 </div>
 
-      <div class="rx-bc"> </div>
+      <div class="rx-bc"><el-button type="text" size="mini" @click="batchDelete()">批量删除</el-button> </div>
     </div>
 
     <el-table ref="oneJobQualityBom" class="table_content" :max-height="600" :data="list" tooltip-effect="dark"
-      style="width: 100%" stripe border>
+      style="width: 100%" stripe border  @selection-change="tableDataSelectChange">
+      <el-table-column
+          type="selection"
+          align="center"
+          width="55">
+      </el-table-column>
       <el-table-column label="序号" type="index" width="55">
         <template slot-scope="{ row, $index }">
           {{ $index + 1 }}
@@ -459,7 +464,8 @@ export default {
         code: 5,
         name: '让步接收'
       }
-      ]
+      ],
+      selectArr:[],
     };
   },
 
@@ -718,6 +724,41 @@ export default {
       );
 
       this.cancel();
+    },
+    // 多选
+    tableDataSelectChange(val) {
+      let arr=[];
+      this.selectArr=[]
+      if(val.length>0){
+        val.map(item=>{
+          arr.push(item.id || item.instanceId)
+        })
+        this.selectArr=arr
+      }
+      console.log(arr);
+
+    },
+    //批量删除
+    batchDelete(){
+      if (!this.selectArr.length) {
+        this.$message.warning('请至少选择一条数据');
+        return;
+      }
+      this.$confirm('确定要删除选中的报工信息吗?', '提示', {
+          type: 'warning'
+        })
+          .then(() => {
+            this.selectArr.forEach((sitem, sindex) => {
+              this.list.forEach((item, index) => {
+                let id=item.id || item.instanceId
+                  if (id==sitem) {
+                    this.list.splice(index, 1);
+                  }
+                })
+            });
+        })
+        .catch(() => {});
+
     }
   },
 

+ 1 - 2
src/views/produce/components/jobBooking/index.vue

@@ -278,9 +278,8 @@ export default {
         const list = JSON.parse(JSON.stringify(this.List));
         console.log(list);
         list.map(item=>{
-          item.executorTime =e;
+          item.workReportInfo.executorTime =e;
         })
-
         this.$set(this, 'List', list);
 
       }