Browse Source

调拨 补充调入库区字段
出库工单修改编辑按钮流程

Qukatie 1 day ago
parent
commit
58227e55c6

+ 60 - 191
src/views/tirePartsMall/salesManagement/outboundWorkOrder/detailsPage.vue

@@ -15,11 +15,9 @@
           @click="notice"
           >微信发货通知
         </el-button>
-        <el-button class="el-button&#45;&#45;small-yh" type="primary" size="small" v-if="editButton" @click="confirmEditing">编辑 </el-button>
-        <el-button class="el-button--small-yh" type="primary" size="small" :disabled="isSave" @click="editCustomer">保存数据 </el-button>
-        <el-button class="el-button--small-yh" type="warning" size="small" v-if="form.statusName == '已出库'" @click="revoke" :disabled="isSave"
-          >撤销出库
-        </el-button>
+        <el-button v-if="editButton" class="el-button&#45;&#45;small-yh" type="primary" size="small" @click="confirmEditing">编辑 </el-button>
+        <el-button v-else class="el-button--small-yh" type="primary" size="small" :disabled="editDisabled" @click="editCustomer">保存数据 </el-button>
+        <el-button class="el-button--small-yh" type="warning" size="small" v-if="form.statusName == '已出库'" @click="revoke">撤销出库 </el-button>
         <el-button
           class="el-button--small-yh"
           type="success"
@@ -44,7 +42,6 @@
               v-model="formContacts"
               ref="formContacts"
               :data="form.shipItemsList"
-              :key="key"
               @row-save="rowSave"
               @row-update="rowUpdate"
               @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 270.1)"
@@ -54,9 +51,6 @@
                 <el-button type="primary" icon="el-icon-printer" size="small" @click="handlePrint">打印</el-button>
               </template>
               <template slot-scope="{ type, size, row, index, disabled }" slot="menu">
-                <!--<el-button :size="size" :disabled="disabled || isAddDisabled" :type="type"-->
-                <!--  :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="rowEdit(row, index)">编辑-->
-                <!--</el-button>-->
                 <el-popover placement="left" width="500" trigger="hover">
                   <el-table
                     :row-style="{ height: '20px', padding: '0px', fontSize: '12px' }"
@@ -93,7 +87,7 @@
                 <el-button
                   v-if="reservoirArea == 1 && row.historyList.length"
                   :size="size"
-                  :disabled="!row.id || disabled || isDisabled"
+                  :disabled="!row.id || editDisabled"
                   type="text"
                   @click="rowDelArea(row, index)"
                 >
@@ -111,7 +105,7 @@
                 <el-button
                   v-if="reservoirArea == 1 && row.historyList.length == 0"
                   :size="size"
-                  :disabled="!row.id || disabled || isDisabled"
+                  :disabled="!row.id || editDisabled"
                   type="text"
                   @click="rowArea(row, index)"
                 >
@@ -120,16 +114,14 @@
                 <el-button
                   v-if="reservoirArea != 1"
                   :size="size"
-                  :disabled="disabled || isDisabled"
+                  :disabled="editDisabled"
                   :type="type"
                   :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
                   @click="rowEdit(row, index)"
                 >
                   {{ row.$cellEdit ? "保存" : "编辑" }}
                 </el-button>
-                <el-button icon="el-icon-delete" :size="size" :disabled="disabled || isDisabled" :type="type" @click="rowDelBox(row, index)"
-                  >删除
-                </el-button>
+                <el-button icon="el-icon-delete" :size="size" :disabled="editDisabled" :type="type" @click="rowDelBox(row, index)">删除 </el-button>
               </template>
             </avue-crud>
           </el-tab-pane>
@@ -168,7 +160,7 @@
       <c-upload
         v-loading="loadingBtn"
         typeUpload="LT"
-        :disabled="isAddDisabled"
+        :disabled="editDisabled"
         deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId"
         :data="filesList"
         display
@@ -206,11 +198,8 @@ export default {
       itemAreaList: [],
       switchDialog: false,
       activeName: "sale_detail",
-      editButton: true,
-      isSave: true,
-      disabled: false,
-      isDisabled: false,
-      isAddDisabled: false,
+      editButton: false,
+      editDisabled: false,
       form: {
         shipItemsList: [],
         shipVOList: [],
@@ -224,7 +213,7 @@ export default {
         column: [
           {
             label: "业务对象",
-            disabled: false,
+            disabled: true,
             prop: "customerId",
             type: "select",
             props: {
@@ -280,7 +269,7 @@ export default {
             label: "业务日期",
             prop: "businesDate",
             searchProp: "businesDateList",
-            disabled: false,
+            disabled: true,
             type: "datetime",
             value: dateFormat(new Date(), "yyyy-MM-dd hh:mm:ss"),
             format: "yyyy-MM-dd HH:mm",
@@ -295,7 +284,7 @@ export default {
           },
           {
             label: "出库单号",
-            disabled: false,
+            disabled: true,
             prop: "billno",
             rules: [
               {
@@ -623,15 +612,16 @@ export default {
     this.optionPaymentDetails = await this.getColumnData(this.getColumnName(270.2), this.optionPaymentDetailsBack);
     this.optionOutboundRecords = await this.getColumnData(this.getColumnName(270.3), this.optionOutboundRecordsBack);
     this.key++;
-    if (this.onLoad.id && this.detailData.id) {
-      console.log(1);
-      this.refresh(this.onLoad.id, true);
-      this.$set(this.optionForm, "disabled", true);
-    } else if (this.onLoad.id) {
-      console.log(2);
+    if (this.onLoad.id) {
+      this.editButton = true;
+      this.editDisabled = true;
+      this.optionForm.disabled = true;
       this.refresh(this.onLoad.id, true);
     }
     if (this.detailData.id) {
+      this.editButton = true;
+      this.editDisabled = true;
+      this.optionForm.disabled = true;
       this.refresh();
     }
     if (this.$route.query.srcId) {
@@ -741,23 +731,14 @@ export default {
           })
             .then(res => {
               if (res.data.code === 601) {
-                if (this.onLoad.id && this.detailData.id) {
-                  console.log(1);
-                  this.refresh(this.onLoad.id, true);
-                  this.$set(this.optionForm, "disabled", true);
-                } else if (this.onLoad.id) {
-                  console.log(2);
-                  this.refresh(this.onLoad.id, true);
-                }
                 this.$message({
                   type: "error",
                   message: res.data.msg
                 });
-                return true;
+              } else {
+                this.$message.success("撤销成功");
+                this.refresh(this.form.id);
               }
-              this.$message.success("撤销成功");
-              this.refresh(res.data.data.id);
-              loading.close();
             })
             .finally(() => {
               loading.close();
@@ -821,32 +802,23 @@ export default {
           })
             .then(res => {
               if (res.data.code === 601) {
-                if (this.onLoad.id && this.detailData.id) {
-                  console.log(1);
-                  this.refresh(this.onLoad.id, true);
-                  this.$set(this.optionForm, "disabled", true);
-                } else if (this.onLoad.id) {
-                  console.log(2);
-                  this.refresh(this.onLoad.id, true);
-                }
                 this.$message({
                   type: "error",
                   message: res.data.msg
                 });
-                return true;
-              }
-              warehousingComplete({
-                ...this.form,
-                bizTypeName: "FHGD"
-              })
-                .then(res => {
-                  this.$message.success("出库完成");
-                  this.refresh(res.data.data.id);
-                  loading.close();
+              } else {
+                warehousingComplete({
+                  ...this.form,
+                  bizTypeName: "FHGD"
                 })
-                .finally(() => {
-                  loading.close();
-                });
+                  .then(res => {
+                    this.$message.success("出库完成");
+                    this.refresh(res.data.data.id);
+                  })
+                  .finally(() => {
+                    loading.close();
+                  });
+              }
             })
             .catch(() => {
               loading.close();
@@ -883,22 +855,6 @@ export default {
             spinner: "el-icon-loading",
             background: "rgba(255,255,255,0.7)"
           });
-          console.log(this.form);
-          // 判断处理
-          // if (this.form.statusName != '已出库') {
-          //   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,
             bizTypeName: "FHGD",
@@ -906,24 +862,14 @@ export default {
           })
             .then(res => {
               if (res.data.code === 601) {
-                console.info("11111111111----", res);
-                if (this.onLoad.id && this.detailData.id) {
-                  console.log(1);
-                  this.refresh(this.onLoad.id, true);
-                  this.$set(this.optionForm, "disabled", true);
-                } else if (this.onLoad.id) {
-                  console.log(2);
-                  this.refresh(this.onLoad.id, true);
-                }
                 this.$message({
                   type: "error",
                   message: res.data.msg
                 });
-                return true;
+              } else {
+                this.$message.success("保存成功");
+                this.refresh(res.data.data.id);
               }
-              this.$message.success("保存成功");
-              this.refresh(res.data.data.id);
-              loading.close();
             })
             .finally(() => {
               loading.close();
@@ -933,71 +879,26 @@ export default {
         }
       });
     },
-    refresh(id, type) {
-      this.$set(this.optionContactsBack, "addBtn", false);
-      this.$set(this.optionContacts, "addBtn", false);
-      this.isDisabled = true;
+    refresh(id) {
       const loading = this.$loading({
         lock: true,
         text: "加载中",
         spinner: "el-icon-loading",
         background: "rgba(255,255,255,0.7)"
       });
-      if (!this.detailData.id) {
-        getDetails({ id: id })
-          .then(res => {
-            if (res.data.data.statusName == "已出库") {
-              this.$set(this.optionForm, "disabled", true);
-              this.isAddDisabled = true;
-              this.optionContacts.column.forEach(item => {
-                if (item.prop == "sendNum") {
-                  item.disabled = true;
-                }
-              });
-            }
-            this.isAddDisabled = true;
-            if (res.data.data.statusName == "待出库") {
-              this.isAddDisabled = true;
-              this.isDisabled = true;
-            }
-            this.form = res.data.data;
-            this.filesList = res.data.data.filesList;
-            this.$nextTick(() => {
-              this.$refs.formContacts.refreshTable();
-            });
-            loading.close();
-          })
-          .catch(() => {
-            loading.close();
-          });
-      } else {
-        getDetails({ id: this.detailData.id })
-          .then(res => {
-            if (res.data.data.statusName == "已出库") {
-              this.$set(this.optionForm, "disabled", true);
-              this.isAddDisabled = true;
-              this.optionContacts.column.forEach(item => {
-                if (item.prop == "sendNum") {
-                  item.disabled = true;
-                }
-              });
-            }
-            this.isAddDisabled = true;
-            if (res.data.data.statusName == "待出库") {
-              this.isAddDisabled = true;
-              this.isDisabled = true;
-            }
-            this.form = res.data.data;
-            this.filesList = res.data.data.filesList;
-            this.$nextTick(() => {
-              this.$refs.formContacts.refreshTable();
-            });
-            loading.close();
-          })
-          .catch(() => {
-            loading.close();
-          });
-      }
+      getDetails({ id: this.detailData.id })
+        .then(res => {
+          if (res.data.data.statusName == "已出库") {
+            this.editButton = true;
+            this.editDisabled = true;
+            this.optionForm.disabled = true;
+          }
+          this.form = res.data.data;
+          this.filesList = res.data.data.filesList;
+        })
+        .finally(() => {
+          loading.close();
+        });
     },
     rowDelBox(row, index) {
       this.$confirm("确定将选择数据删除?", {
@@ -1031,46 +932,14 @@ export default {
     },
     //编辑
     confirmEditing() {
-      if (this.form.statusName == "待出库" || this.form.statusName == "待入库" || this.form.statusName == "撤销出库") {
-        this.isDisabled = false;
-        this.isSave = false;
-        this.$set(this.optionForm, "disabled", false);
-        this.optionForm.column.forEach(item => {
-          if (
-            item.prop == "storageId" ||
-            item.prop == "remarks" ||
-            item.prop == "createTime" ||
-            item.prop == "stockClerkId" ||
-            item.prop == "shipType" ||
-            item.prop == "logisticsCorpName" ||
-            item.prop == "expressNo"
-          ) {
-            item.disabled = false;
-          } else {
-            item.disabled = true;
-          }
-        });
-        this.isAddDisabled = false;
-        this.optionContactsBack.column.forEach(its => {
-          if (its.prop == "dot") {
-            this.$set(its, "disabled", false);
-          }
-        });
-      } else {
-        this.$set(this.optionForm, "disabled", false);
-        this.isAddDisabled = true;
-        this.isSave = false;
-        // this.optionForm.column.forEach(item => {
-        //   if (item.prop == 'remarks') {
-        //     item.disabled = false
-        //   } else {
-        //     item.disabled = true
-        //   }
-        // })
-        this.optionForm.column.forEach(item => {
-          item.disabled = true;
-        });
-        // this.isAddDisabled = false
+      this.editButton = false;
+      if (this.form.statusName == "待出库" || this.form.statusName == "撤销出库") {
+        this.editDisabled = false;
+        this.optionForm.disabled = false;
+      }
+      if (this.form.statusName == "已出库") {
+        this.editDisabled = true;
+        this.optionForm.disabled = true;
       }
     },
     //自定义列保存

+ 32 - 26
src/views/tirePartsMall/salesManagement/outboundWorkOrderL/components/viewArea.vue

@@ -27,20 +27,19 @@
             <el-tag type="danger" style="margin-left: 10px;">入库数量:{{ qtyMax }}</el-tag>
           </div>
         </template>
-        <template slot="reservoirAreaName" slot-scope="{ row }">
+        <template slot="callInReservoirAreaName" slot-scope="{ row }">
           <dic-select
-            v-model="row.reservoirAreaName"
+            :key="callInStorageId"
+            v-model="row.callInReservoirAreaName"
             placeholder="库区"
             label="cname"
             res="records"
-            :url="'/blade-sales-part/reservoirarea/list?current=1&size=5&storageId=' + form.storageId"
+            :url="'/blade-sales-part/reservoirarea/list?current=1&size=5&storageId=' + callInStorageId"
             :filterable="true"
             :remote="true"
             dataName="cname"
             :disabled="disabled"
-            @selectChange="rowDicChange('reservoirAreaName', $event, row)"
-            :slotRight="true"
-            rightLabel="balanceQuantity"
+            @selectChange="rowDicChange('callInReservoirAreaName', $event, row)"
           ></dic-select>
         </template>
         <template slot="quantityFinancing" slot-scope="{ row }">
@@ -92,6 +91,7 @@ export default {
   },
   data() {
     return {
+      callInStorageId: null,
       data: [],
       dialogVisible: false,
       loading: false,
@@ -121,6 +121,11 @@ export default {
             overHidden: true
           },
           {
+            label: "调入库库区",
+            prop: "callInReservoirAreaName",
+            overHidden: true
+          },
+          {
             label: "本次数量",
             prop: "quantity",
             overHidden: true
@@ -145,6 +150,16 @@ export default {
   },
   async created() {},
   methods: {
+    rowDicChange(name, row, el) {
+      if (name == "callInReservoirAreaName") {
+        if (row) {
+          el.callInReservoirAreaId = row.id;
+        } else {
+          el.callInReservoirAreaId = null;
+          el.callInReservoirAreaName = null;
+        }
+      }
+    },
     rowDel(row, index) {
       this.$confirm("确定删除数据?", {
         confirmButtonText: "确定",
@@ -167,18 +182,6 @@ export default {
         quantity: 0
       });
     },
-    rowDicChange(name, row, el) {
-      if (name == "reservoirAreaName") {
-        if (row) {
-          el.reservoirAreaId = row.id;
-          el.balanceQuantity = row.balanceQuantity;
-        } else {
-          el.reservoirAreaId = null;
-          el.reservoirAreaName = null;
-          el.balanceQuantity = null;
-        }
-      }
-    },
     qtyChange(row) {
       row.quantity = row.quantityFinancing;
       row.quantityHave = 0;
@@ -207,33 +210,36 @@ export default {
       this.index = null;
       this.data = [];
       this.qtyMax = 0;
+      this.callInStorageId = null;
       this.form = form;
       this.query = row;
       this.index = index;
       this.data = this.deepClone(row.historyList);
-      this.qtyMax = row.remainingNum;
+      this.qtyMax = row.inventory;
+      this.callInStorageId = form.callInStorageId;
       this.dialogVisible = true;
     },
     submit() {
       let sum = 0;
-      let sendNumFinancing=0;
-      let sendNumHave=0;
+      let sendNumFinancing = 0;
+      let sendNumHave = 0;
       for (let item of this.data) {
-        if (!item.reservoirAreaId) {
+        if (!item.callInReservoirAreaId) {
           return this.$message.error("请选择库区");
         }
         if (!item.quantity) {
           return this.$message.error("本次数量不能为0");
         }
         sum += Number(item.quantity);
-        sendNumFinancing+= Number(item.sendNumFinancing);
-        sendNumHave+= Number(item.sendNumHave);
+        sendNumFinancing += Number(item.sendNumFinancing);
+        sendNumHave += Number(item.sendNumHave);
       }
       for (let item of this.data.filter(item => item.quantity > 0)) {
         if (this.data.filter(item => item.quantity > 0)[0].dot != item.dot) {
           return this.$message.error("请选择一种批次号");
         }
       }
+      //当子明细只有一种批次号 需要给主明细赋值一下批次号
       if (!this.query.dot) {
         this.query.dot = this.data.filter(item => item.quantity > 0)[0].dot;
       }
@@ -246,8 +252,8 @@ export default {
       let obj = {
         ...this.query,
         sendNum: sum,
-        sendNumFinancing:sendNumFinancing,
-        sendNumHave:sendNumHave,
+        sendNumFinancing: sendNumFinancing,
+        sendNumHave: sendNumHave,
         historyList: this.data
       };
       this.$emit("areaData", obj, this.index);