Эх сурвалжийг харах

采购需求单明细行批量删除,加入csFlag,工作台自动切换下条注释,

黄梓星 1 жил өмнө
parent
commit
f5541b3b45

+ 24 - 2
src/views/purchase/PurchaseDemandList/add.vue

@@ -161,6 +161,7 @@
         <span>明细信息</span>
         <div>
         <el-button type="primary" size="mini" @click="addLine" v-if="!sonDisable">增行</el-button>
+        <el-button type="primary" size="mini" @click="delLines" v-if="!sonDisable">删行</el-button>
         <el-button type="primary" size="mini" v-if="!sonDisable" @click.stop="adjustPl">批量调整</el-button>
         <el-button type="primary" size="mini" v-if="sonPageStu == 'check' || sonPageStu == 'edit'" @click="showReserved">货权预留单</el-button>
         </div>
@@ -740,6 +741,7 @@ export default {
         updateByName: null,
         updateTime: null,
         delFlag: 0,
+        csFlag: 'N',
         // 新增字段
         model: null,
         storageCondition: null,
@@ -1150,8 +1152,6 @@ export default {
       }
     },
     delLine(index, row) {
-      console.log('删除行:', index)
-      console.log('改变行:', row)
       row.delFlag = '2'
       let delList = []
       delList = this.basicForm.puDemandItemList.filter(item => {
@@ -1163,6 +1163,26 @@ export default {
       this.delDemandItemList.push(...delList)
       console.log('删除的数组',this.delDemandItemList)
     },
+    // 批量删除行
+    delLines() {
+      let delArr = this.$refs.table.getCheckboxRecords()
+      if (delArr.length !== 0) {
+        delArr.forEach(item => {
+          item.delFlag = '2'
+        })
+        console.log('kk',this.basicForm.puDemandItemList)
+        let delList = []
+        delList = this.basicForm.puDemandItemList.filter(item => {
+          return item.delFlag == '2'
+        })
+        this.basicForm.puDemandItemList = this.basicForm.puDemandItemList.filter(item => {
+          return item.delFlag == '0'
+        })
+        this.delDemandItemList.push(...delList)
+      } else {
+        this.$modal.notifyWarning('请至少选择一条明细!')
+      }
+    },
     back() {
       console.log('打印人员信息看看', this.$store.state)
       this.$emit('jugislist', true)
@@ -1344,6 +1364,7 @@ export default {
       if(this.referCondition.title == '选择收货仓库') {
         this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouse = selection[0].id
         this.basicForm.puDemandItemList[this.tableIndex].deliveryWarehouseName = selection[0].name
+        this.basicForm.puDemandItemList[this.tableIndex].csFlag = selection[0].csFlag
         this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocation = null
         this.basicForm.puDemandItemList[this.tableIndex].deliveryAllocationName = null
       }
@@ -1708,6 +1729,7 @@ export default {
       if (title == '选择收货仓库') {
         this.basicForm.puDemandItemList[index].deliveryWarehouseName = null
         this.basicForm.puDemandItemList[index].deliveryWarehouse = null
+        this.basicForm.puDemandItemList[index].csFlag = null
         this.basicForm.puDemandItemList[index].deliveryAllocationName = null
         this.basicForm.puDemandItemList[index].deliveryAllocation = null
       }

+ 26 - 14
src/views/purchase/workSpace/index.vue

@@ -100,17 +100,6 @@
               :formatter="col.formatter"
             >
             </el-table-column>
-          <!-- <el-table-column show-overflow-tooltip label="物料编码" align="center" prop="materialCode"/>
-          <el-table-column show-overflow-tooltip label="物料名称" align="center" prop="materialName"/>
-          <el-table-column show-overflow-tooltip label="规格" align="center" prop="specification"/>
-          <el-table-column show-overflow-tooltip label="型号" align="center" prop="model"/>
-          <el-table-column show-overflow-tooltip label="单位" align="center" prop="unitName"/>
-          <el-table-column show-overflow-tooltip label="生产厂家/代理人" align="center" prop="manufacturerName"/>
-          <el-table-column show-overflow-tooltip label="调出仓库" align="center" prop="deliveryWarehouseName"/>
-          <el-table-column show-overflow-tooltip label="调出货位" align="center" prop="deliveryAllocationName"/>
-          <el-table-column show-overflow-tooltip label="数量" align="center" prop="qty"/>
-          <el-table-column show-overflow-tooltip label="调入仓库" align="center" prop="storageWarehouseName"/>
-          <el-table-column show-overflow-tooltip label="调入货位" align="center" prop="storageAllocationName"/> -->
         </el-table>
 
         <el-pagination
@@ -168,7 +157,9 @@ export default {
         {label: '数量',  prop: 'qty'},
         {label: '调入仓库',  prop: 'storageWarehouseName'},
         {label: '调入货位',  prop: 'storageAllocationName'},
-      ]
+      ],
+      // 记录点击行的下标
+      recordIndex: '',
     }
   },
   created() {
@@ -208,7 +199,12 @@ export default {
       // this.$refs.tables.toggleRowSelection(row);
       this.rowSelect(row)
     },
-    rowSelect(row) {
+    rowSelect(row, column, event) {
+      // console.log('行信息', row)
+      // this.recordIndex = this.tableList.findIndex((value, index ,arr) => {
+      //   return value.billCode == row.billCode
+      // })
+      // console.log('下标:', this.recordIndex)
       // this.check(row)
       // 选择行存储便于子表分页
       this.checkRow = row
@@ -346,7 +342,23 @@ export default {
           this.searchList()
           this.sonTableList = []
         }
-      }).catch(() => {
+      })
+      // .then(() => {
+      //   this.$refs.tables.setCurrentRow(this.tableList[this.recordIndex])
+      //   let param = {
+      //     billCode: this.tableList[this.recordIndex].billCode,
+      //     type: this.tableList[this.recordIndex].type,
+      //     ...this.sonQuery
+      //   }
+      //   getWorkDetailList(param).then(res => {
+      //     if(res.code === 200) {
+      //       this.sonTableList = res.rows
+      //       this.sonTotal = res.total
+      //     }
+      //   }).catch(err => {
+      //   })
+      // })
+      .catch(() => {
         this.$modal.closeLoading();
         this.searchList()
         this.sonTableList = []