Browse Source

出库工单列表状态和库存判断 2023-11-30

caojunjie 1 năm trước cách đây
mục cha
commit
834d160edd

+ 25 - 7
src/views/tirePartsMall/salesManagement/outboundWorkOrder/detailsPage.vue

@@ -325,7 +325,7 @@ export default {
         }, {
           label: '批次号',
           prop: 'dot',
-            cell:true,
+          cell:true,
           type: 'select',
           disabled: true,
           dicData: [],
@@ -334,7 +334,13 @@ export default {
             value: "dot"
           },
           dicUrl: "/api/blade-sales-part/stockDesc/dotList",
-
+            change: (data) => {
+                for (let item of data.column.dicData) {
+                    if (item.dot == data.value) {
+                        this.$set(this.form.shipItemsList[data.index],'inventory',item.balanceQuantity)
+                    }
+                }
+            }
         }, {
           label: '单位',
           prop: 'units',
@@ -346,6 +352,9 @@ export default {
           },
           dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit"
         }, {
+            label: '库存',
+            prop: 'inventory',
+        },{
           label: '出库数量',
           prop: 'goodsNum',
           disabled: false,
@@ -498,7 +507,7 @@ export default {
     },
     rowEdit(row, index) {
       if (this.form.statusName == '待出库') {
-        this.optionContactsBack.column.forEach(its => {
+        this.optionContacts.column.forEach(its => {
           if (its.prop == 'dot') {
             this.$set(its, 'disabled', false)
           }
@@ -509,7 +518,7 @@ export default {
         storageId: this.form.storageId,
         goodsId: row.goodsId
       }).then(res => {
-        this.findObject(this.optionContactsBack.column, "dot").dicData = res.data.data
+        this.findObject(this.optionContacts.column, "dot").dicData = res.data.data
       })
         if (row.$cellEdit) {
             this.$set(row,'$cellEdit',false)
@@ -564,9 +573,18 @@ export default {
             background: 'rgba(255,255,255,0.7)'
           });
           console.log(this.form)
-          this.form.shipItemsList.forEach(item => {
-            item.goodsName = item.$goodsId
-          })
+            // 判断处理
+            for (let index in this.form.shipItemsList) {
+                this.form.shipItemsList[index].goodsName = this.form.shipItemsList[index].$goodsId
+                if (Number(this.form.shipItemsList[index].sendNum) > Number(this.form.shipItemsList[index].inventory)) {
+                    this.$message.warning(`序号${index+1}的实际数量不能大于库存`);
+                    loading.close();
+                    return
+                }
+            }
+          // this.form.shipItemsList.forEach(item => {
+          //   item.goodsName = item.$goodsId
+          // })
           // this.goodsName;
           submit({
             ...this.form,

+ 21 - 1
src/views/tirePartsMall/salesManagement/outboundWorkOrder/index.vue

@@ -32,6 +32,14 @@
           <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.ordNo }}
           </span>
         </template>
+        <template slot-scope="{ row, index }" slot="statusName">
+            <span  v-for="item in statusNameData"
+                   :style="{background: item.colour}"
+                   class="bottomBox"
+                   v-if="item.dictKey == row.statusName">
+              {{ item.dictValue }}
+            </span>
+        </template>
       </avue-crud>
     </basic-container>
     <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
@@ -102,6 +110,7 @@ export default {
   },
   data() {
     return {
+        statusNameData:[], // 状态字典
       dialogVisible: false,
       dialogForm: {},
       courierTypeList: [],
@@ -361,6 +370,10 @@ export default {
     }
   },
   async created() {
+      // 状态字段获取
+      this.getWorkDicts("outbound_work_order_status").then(res => {
+          this.statusNameData = res.data.data
+      });
     this.option = await this.getColumnData(this.getColumnName(270), this.optionList);
     this.key++
     let i = 0;
@@ -546,4 +559,11 @@ export default {
 }
 </script>
 
-<style scoped></style>
+<style scoped>
+.bottomBox {
+    padding: 3px 6px;
+    border-radius: 12px;
+    color: #fff;
+    font-size: 10px;
+}
+</style>