yijing пре 1 година
родитељ
комит
0da5f55ad7

+ 5 - 0
src/views/warehouseManagement/stockLedger/components/item-list.vue

@@ -407,6 +407,11 @@ export default {
           label: '产地',
           showOverflowTooltip: true
         } : '',
+        {
+          prop: 'unitPrice',
+          label: '单价',
+          showOverflowTooltip: true
+        }
       ];
       if (this.selectedDime == 1) {
         return arr.filter((item) => item != '').concat(this.newColumns);

+ 65 - 34
src/views/warehouseManagement/stockManagement/details.vue

@@ -164,7 +164,7 @@
             </el-table-column>
             <el-table-column v-if="infoData.verifyStatus == 2" label="操作" width="200" fixed="right" align="center">
               <template slot-scope="{ row, $index }">
-                <el-button v-if="isUpper(row)" type="text" @click="shelvesWarehouse($index, '产品')">下架</el-button>
+                <el-button v-if="isUpper(row)" type="text" @click="shelvesWarehouse(row, $index, '产品')">下架</el-button>
                 <el-button v-else type="text" @click="handleWareHouse(row, $index, '产品')">上架</el-button>
               </template>
             </el-table-column>
@@ -235,8 +235,10 @@
             </el-table-column>
             <el-table-column v-if="infoData.verifyStatus == 2" label="操作" width="200" fixed="right" align="center">
               <template slot-scope="{ row, $index }">
-                <el-button v-if="row.areaId" type="text" @click="shelvesWarehouse($index, '包装')">下架</el-button>
+                <el-button v-if="row.areaId != null" type="text"
+                  @click="shelvesWarehouse(row, $index, '包装')">下架</el-button>
                 <el-button v-else type="text" @click="handleWareHouse(row, $index, '包装')">上架</el-button>
+                {{ row.areaId }}
               </template>
             </el-table-column>
           </el-table>
@@ -307,7 +309,8 @@ export default {
       stepsTitle: '已完成',
       stepsStatus: 'success',
       active: 0,
-      verifyStatus: ''
+      verifyStatus: '',
+      rowData: {}
     };
   },
   watch: {
@@ -444,15 +447,12 @@ export default {
       });
     },
     isUpper(row) {
-      if (this.productList.length > 0) {
-        let filterPackingList = this.productList.filter((packingItem) => {
-          return packingItem.outInDetailRecordRequestList[0].parentIndex === row.index;
-        });
-        let boolen = filterPackingList.every((item) => {
-          return item.outInDetailRecordRequestList.areaId && item.outInDetailRecordRequestList.goodsShelfId && item.outInDetailRecordRequestList.goodsAllocationId;
-        });
-        return boolen;
+      if (!row.outInDetailRecordRequestList || row.outInDetailRecordRequestList.length === 0) {
+        return false;
       }
+      return row.outInDetailRecordRequestList.some(item =>
+        item.areaId && item.goodsShelfId && item.goodsAllocationId
+      );
     },
     formDataData() {
       // 处理包装数据
@@ -480,7 +480,10 @@ export default {
       switch (type) {
         case '产品':
           this.packingList.forEach((item) => {
-            if (item.parentIndex === this.productList[idx].index) {
+            console.log(item, 'item');
+            console.log(this.productList[idx], 'index')
+
+            if (item.batchNo === this.productList[idx].batchNo && item.categoryId === this.productList[idx].categoryId && item.categoryName === this.productList[idx].categoryName) {
               this.$set(item, 'areaId', argum[0].areaId);
               this.$set(item, 'areaName', argum[0].areaName);
               this.$set(item, 'goodsShelfId', argum[0].shelfId);
@@ -511,7 +514,19 @@ export default {
           );
           break;
       }
+
+      const data2 = this.packingList.filter(item => item.areaId)
+
       this.formDataData();
+      for (let i = 0; i < this.infoData.outInDetailList.length; i++) {
+        const batchNo = this.infoData.outInDetailList[i].batchNo;
+        const categoryId = this.infoData.outInDetailList[i].categoryId;
+        const categoryName = this.infoData.outInDetailList[i].categoryName;
+        if (this.rowData.batchNo == batchNo && this.rowData.categoryId == categoryId && this.rowData.categoryName == categoryName) {
+          this.infoData.outInDetailList[i].outInDetailRecordRequestList = data2
+        }
+
+      }
       storageApi
         .upperLowerShelves(this.infoData)
         .then((data) => {
@@ -524,32 +539,48 @@ export default {
         });
     },
     handleWareHouse(row, idx, type) {
+      console.log(row, 'kkkkk');
+      this.rowData = row;
       this.$refs.wareHouseDailogRef.open(row, idx, type);
     },
-    shelvesWarehouse(idx, type) {
-      switch (type) {
-        case '产品':
-          this.packingList.forEach((item) => {
-            if (item.parentIndex === this.productList[idx].index) {
-              this.$set(item, 'areaId', '');
-              this.$set(item, 'areaName', '');
-              this.$set(item, 'goodsShelfId', '');
-              this.$set(item, 'goodsShelfName', '');
-              this.$set(item, 'goodsAllocationId', '');
-              this.$set(item, 'goodsAllocationName', '');
+    shelvesWarehouse(row, idx, type) {
+      if (type == '产品') {
+
+        for (let i = 0; i < this.infoData.outInDetailList.length; i++) {
+          const batchNo = this.infoData.outInDetailList[i].batchNo;
+          const categoryId = this.infoData.outInDetailList[i].categoryId;
+          const categoryName = this.infoData.outInDetailList[i].categoryName;
+          if (row.batchNo == batchNo && row.categoryId == categoryId && row.categoryName == categoryName) {
+            let data12 = row.outInDetailRecordRequestList.map(item => ({ ...item, areaId: '', areaName: '', goodsShelfId: '', goodsShelfName: '', goodsAllocationId: '', goodsAllocationName: '' }));
+            this.$set(this.infoData.outInDetailList[i], 'outInDetailRecordRequestList', data12)
+          }
+        }
+      } else {
+        for (let i = 0; i < this.infoData.outInDetailList.length; i++) {
+          const batchNo = this.infoData.outInDetailList[i].batchNo;
+          const categoryId = this.infoData.outInDetailList[i].categoryId;
+          const categoryName = this.infoData.outInDetailList[i].categoryName;
+
+          if (this.packingList[idx].batchNo == batchNo && this.packingList[idx].categoryId == categoryId && this.packingList[idx].categoryName == categoryName) {
+            let dataList = this.infoData.outInDetailList[i].outInDetailRecordRequestList.filter(item => item.areaId)
+            for (let j = 0; j < dataList.length; j++) {
+              const idd = dataList[j].id;
+              if (this.packingList[idx].id == idd) {
+                this.$set(dataList[j], 'areaId', '');
+                this.$set(dataList[j], 'areaName', '');
+                this.$set(dataList[j], 'goodsShelfId', '');
+                this.$set(dataList[j], 'goodsShelfName', '');
+                this.$set(dataList[j], 'goodsAllocationId', '');
+                this.$set(dataList[j], 'goodsAllocationName', '');
+              }
             }
-          });
-          break;
-        case '包装':
-          this.$set(this.packingList[idx], 'areaId', '');
-          this.$set(this.packingList[idx], 'areaName', '');
-          this.$set(this.packingList[idx], 'goodsShelfId', '');
-          this.$set(this.packingList[idx], 'goodsShelfName', '');
-          this.$set(this.packingList[idx], 'goodsAllocationId', '');
-          this.$set(this.packingList[idx], 'goodsAllocationName', '');
-          break;
+          }
+          console.log(this.packingList[idx].id, 'this.packingList[idx].id')
+        }
       }
-      this.formDataData();
+      // this.formDataData();
+
+
       storageApi
         .upperLowerShelves(this.infoData)
         .then((data) => {