Browse Source

修改退货入库编辑流程

Qukatie 1 day ago
parent
commit
4d03ed9570

+ 1 - 1
src/views/tirePartsMall/purchasingManagement/warehouseEntryOrder/detailsPage.vue

@@ -856,7 +856,7 @@ export default {
       this.editButton = true;
       this.editDisabled = true;
       this.optionForm.disabled = true;
-      this.refresh(this.detailData.id, true);
+      this.refresh(this.detailData.id);
     }
 
     if (this.$route.query.srcId) {

+ 78 - 171
src/views/tirePartsMall/salesService/inStorage/detailsPage.vue

@@ -7,28 +7,18 @@
         </el-button>
       </div>
       <div class="add-customer-btn">
-        <el-button class="el-button&#45;&#45;small-yh" type="primary" size="small" v-if="form.id" @click="confirmEditing">编辑 </el-button>
-        <el-button
-          class="el-button--small-yh"
-          type="primary"
-          :disabled="isButton"
-          size="small"
-          v-if="form.statusName != '已入库'"
-          @click="editCustomer"
-          >保存数据
-        </el-button>
+        <el-button class="el-button&#45;&#45;small-yh" type="primary" size="small" v-if="editButton" @click="confirmEditing">编辑 </el-button>
+        <el-button v-else class="el-button--small-yh" type="primary" :disabled="isButton" size="small" @click="editCustomer">保存数据 </el-button>
         <el-button
           class="el-button--small-yh"
           type="success"
           size="small"
           v-if="form.statusName == '待入库' || form.statusName == '已撤销'"
           @click="complete"
-          :disabled="isButton"
+          :disabled="editDisabled"
           >入库完成
         </el-button>
-        <el-button class="el-button--small-yh" type="success" size="small" v-if="form.statusName == '已入库'" @click="revoke" :disabled="isButton"
-          >撤销入库
-        </el-button>
+        <el-button class="el-button--small-yh" type="success" size="small" v-if="form.statusName == '已入库'" @click="revoke">撤销入库 </el-button>
       </div>
     </div>
     <div style="margin-top: 50px">
@@ -69,7 +59,7 @@
                 <el-button
                   v-if="reservoirArea == 1 && row.historyList.length"
                   :size="size"
-                  :disabled="!row.id || form.statusName == '已入库' || isEdit || isEdits"
+                  :disabled="!row.id || editDisabled"
                   type="text"
                   @click="rowDelArea(row, index)"
                 >
@@ -87,7 +77,7 @@
                 <el-button
                   v-if="reservoirArea == 1 && row.historyList.length == 0"
                   :size="size"
-                  :disabled="!row.id || form.statusName == '已入库' || isEdit || isEdits"
+                  :disabled="!row.id || editDisabled"
                   type="text"
                   @click="rowArea(row, index)"
                 >
@@ -96,21 +86,14 @@
                 <el-button
                   v-if="reservoirArea != 1"
                   :size="size"
-                  :disabled="disabled || isEdit"
+                  :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 || form.statusName == '已入库' || isEdit || isEdits"
-                  :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>
               <template slot-scope="{ scope, row }" slot="menuLeft">
                 <!-- <el-button type="primary" icon="el-icon-plus" size="small" @click="rowAdd(row, score)"
@@ -118,12 +101,7 @@
                               <el-button type="success" size="small" :disabled="isrowAdd" icon="el-icon-bottom" @click="excelBox = true">导入库区
                               </el-button> -->
                 <el-button type="primary" icon="el-icon-printer" size="small" @click="handlePrint">打印</el-button>
-                <el-button
-                  type="danger"
-                  plain
-                  size="small"
-                  :disabled="disabled || form.statusName == '已入库' || isEdit || isEdits"
-                  @click="batchDelete"
+                <el-button type="danger" plain size="small" :disabled="editDisabled" @click="batchDelete || selectionMultilist.length == 0"
                   >一键删除</el-button
                 >
                 <!-- <el-button
@@ -137,7 +115,12 @@
                 <el-button v-if="reservoirArea == 1" type="success" size="small" @click="allClick('导入库区')" :disabled="disabled || isEdit"
                   >导入库区</el-button
                 > -->
-                <el-button v-if="reservoirArea == 1" type="success" size="small" @click="allClick('一键清空库区')" :disabled="disabled || isEdit|| selectionMultilist.length == 0"
+                <el-button
+                  v-if="reservoirArea == 1"
+                  type="success"
+                  size="small"
+                  @click="allClick('一键清空库区')"
+                  :disabled="editDisabled || selectionMultilist.length == 0"
                   >一键清空库区</el-button
                 >
               </template>
@@ -198,7 +181,7 @@
         :enumerationValue="35.1"
       ></c-upload>
     </div>
-    <view-area ref="viewArea" @areaData="areaData" :disabled="disabled || form.statusName == '已入库' || isEdit || isEdits"></view-area>
+    <view-area ref="viewArea" @areaData="areaData" :disabled="editDisabled"></view-area>
     <el-dialog title="导入明细" append-to-body :visible.sync="excelBox" v-if="excelBox" width="555px" :close-on-click-modal="false" v-dialog-drag>
       <avue-form :option="excelOption" v-model="excelForm" table-loading="excelLoading" :upload-before="uploadBefore" :upload-after="uploadAfter">
         <template slot="excelTemplate">
@@ -290,12 +273,10 @@ export default {
       loadingBtn: false,
       filesList: [],
       switchDialog: false,
-      isEdit: false,
       values: "",
-      isEdits: false,
-      isButton: false,
+      editButton: false,
+      editDisabled: false,
       activeName: "sale_detail",
-      disabled: false,
       isrowAdd: true,
       excelBox: false,
       excelOption: {
@@ -369,7 +350,7 @@ export default {
           {
             label: "业务对象",
             prop: "customerId",
-            disabled: false,
+            disabled: true,
             type: "select",
             props: {
               label: "cname",
@@ -887,29 +868,11 @@ export default {
     this.optionPaymentDetails = await this.getColumnData(this.getColumnName(349), this.optionPaymentDetailsBack);
     this.optionOutboundRecords = await this.getColumnData(this.getColumnName(350), this.optionOutboundRecordsBack);
     this.key++;
-    this.isButton = true;
-    if (this.onLoad.id && this.detailData.id) {
-      this.refresh(this.onLoad.id, true);
-      this.$set(this.optionForm, "disabled", true);
-      this.$set(this.optionContactsBack, "disabled", true);
-    } else if (this.onLoad.id) {
-      console.log(2);
-      this.refresh(this.onLoad.id, true);
-    }
-    if (!this.form.id) {
-      this.isEdit = true;
-      // this.$set(this.optionContactsBack, "addBtn", false)
-      this["optionContacts"] = this["optionContactsBack"];
-      this.delColumnData(this.getColumnName("269.1"), this["optionContactsBack"]);
-    }
-    if (!this.onLoad.id) {
-      this.isrowAdd = false;
-      this.isEdit = false;
-      // this.$set(this.optionForm,'disabled',false)
-      // this.$set(this.optionContacts,'disabled',false)
-    }
     if (this.detailData.id) {
-      this.refresh();
+      this.editButton = true;
+      this.editDisabled = true;
+      this.optionForm.disabled = true;
+      this.refresh(this.detailData.id);
     }
     this.$store.commit("DOMIO_IN_DETAIL");
     isProcurement({ param: "number.decimal" }).then(res => {
@@ -1125,19 +1088,16 @@ export default {
           })
             .then(res => {
               if (res.data.code === 601) {
-                if (this.onLoad.id) {
-                  console.log(2);
-                  this.refresh(this.onLoad.id, true);
-                }
+                this.refresh(this.form.id);
                 this.$message({
                   type: "error",
                   message: res.data.msg
                 });
                 return true;
+              } else {
+                this.$message.success("撤销成功");
+                this.refresh(this.form.id, true);
               }
-              this.$message.success("撤销成功");
-              this.refresh(res.data.data.id);
-              loading.close();
             })
             .finally(() => {
               loading.close();
@@ -1147,57 +1107,15 @@ export default {
     },
     //编辑
     confirmEditing() {
-      this.isButton = false;
+      this.editButton = false;
       if (this.form.statusName == "待入库" || this.form.statusName == "已撤销") {
-        this.isEdit = false;
-        this.isrowAdd = false;
-        this.$set(this.optionForm, "disabled", false);
-        this.$set(this.optionContacts, "disabled", false);
-        this.optionForm.column.forEach(item => {
-          if (item.prop == "remarks" || item.prop == "createTime" || item.prop == "stockClerkId" || item.prop == "storageId") {
-            this.$set(item, "disabled", false);
-          } else {
-            this.$set(item, "disabled", true);
-          }
-        });
-        this.optionContacts.column.forEach(item => {
-          if (item.prop == "remarks" || item.prop == "dot" || item.prop == "sendNum") {
-            this.$set(item, "disabled", false);
-          } else {
-            this.$set(item, "disabled", true);
-          }
-        });
-        if (this.form.billno.substring(0, 4) == "TKSH") {
-          // this.isEdit = true
-          this.isEdits = true;
-          this.isrowAdd = true;
-          this.optionContacts.column.forEach(item => {
-            if (item.prop == "remarks" || item.prop == "sendNum" || item.prop == "price" || item.prop == "dot") {
-              this.$set(item, "disabled", false);
-            } else {
-              this.$set(item, "disabled", true);
-            }
-          });
-        }
-      } else if (this.form.statusName == "已入库") {
-        this.$set(this.optionForm, "disabled", false);
-        this.$set(this.optionContactsBack, "disabled", false);
-        this.optionForm.column.forEach(item => {
-          if (item.prop == "remarks") {
-            this.$set(item, "disabled", false);
-          } else {
-            this.$set(item, "disabled", true);
-          }
-        });
-        this.optionContactsBack.column.forEach(item => {
-          if (item.prop == "remarks") {
-            this.$set(item, "disabled", false);
-          } else {
-            this.$set(item, "disabled", true);
-          }
-        });
+        this.editDisabled = false;
+        this.optionForm.disabled = false;
+      }
+      if (this.form.statusName == "已入库") {
+        this.editDisabled = true;
+        this.optionForm.disabled = true;
       }
-      console.log(this.form.shipItemsList[0].goodsId);
       goodsDetail({ id: this.form.shipItemsList[0].goodsId, stock: this.form.storageId ? this.form.storageId : "" }).then(res => {
         if (res.data.data.whether == 0) {
           this.findObject(this.optionContacts.column, "dot").disabled = true;
@@ -1234,34 +1152,32 @@ export default {
           submit({
             ...this.form,
             bizTypeName: "THSHGD"
-          }).then(res => {
-            if (res.data.code === 601) {
-              if (this.onLoad.id) {
-                console.log(2);
-                this.refresh(this.onLoad.id, true);
+          })
+            .then(res => {
+              if (res.data.code === 601) {
+                this.refresh(this.form.id);
+                this.$message({
+                  type: "error",
+                  message: res.data.msg
+                });
+                loading.close();
+              } else {
+                warehousingComplete({
+                  ...this.form,
+                  bizTypeName: "THSHGD"
+                })
+                  .then(res => {
+                    this.refresh(this.form.id);
+                    this.$message.success("入库完成");
+                  })
+                  .finally(() => {
+                    loading.close();
+                  });
               }
-              this.$message({
-                type: "error",
-                message: res.data.msg
-              });
-              return true;
-            }
-            warehousingComplete({
-              ...this.form,
-              bizTypeName: "THSHGD"
             })
-              .then(res => {
-                this.refresh(res.data.data.id);
-                this.$set(this.optionForm, "disabled", true);
-                this.$set(this.optionContactsBack, "disabled", true);
-                this.isEdit = true;
-                this.$message.success("入库完成");
-                loading.close();
-              })
-              .finally(() => {
-                loading.close();
-              });
-          });
+            .catch(() => {
+              loading.close();
+            });
         }
       });
     },
@@ -1290,19 +1206,15 @@ export default {
           })
             .then(res => {
               if (res.data.code === 601) {
-                if (this.onLoad.id) {
-                  console.log(2);
-                  this.refresh(this.onLoad.id, true);
-                }
+                this.refresh(this.form.id);
                 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();
@@ -1319,27 +1231,22 @@ export default {
         spinner: "el-icon-loading",
         background: "rgba(255,255,255,0.7)"
       });
-      if (!this.detailData.id) {
-        getDetails({ id: id })
-          .then(res => {
-            this.form = res.data.data;
-            this.filesList = res.data.data.filesList;
-            loading.close();
-          })
-          .catch(() => {
-            loading.close();
-          });
-      } else {
-        getDetails({ id: this.detailData.id })
-          .then(res => {
-            this.form = res.data.data;
-            this.filesList = res.data.data.filesList;
-            loading.close();
-          })
-          .catch(() => {
-            loading.close();
-          });
-      }
+      getDetails({ id: id })
+        .then(res => {
+          if (res.data.data.statusName == "已入库") {
+            this.editDisabled = true;
+            this.optionForm.disabled = true;
+          }
+          if (type && !this.editButton) {
+            this.editDisabled = false;
+            this.optionForm.disabled = false;
+          }
+          this.form = res.data.data;
+          this.filesList = res.data.data.filesList;
+        })
+        .finally(() => {
+          loading.close();
+        });
     },
     // 获取业务对象
     corpsDescListAllfun(corpType) {

+ 1 - 1
src/views/tirePartsMall/salesService/inStorage/index.vue

@@ -40,7 +40,7 @@
         </template>
       </avue-crud>
     </basic-container>
-    <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
+    <detailsPage v-if="detailsOpen" :detailData="detailData" @backToList="backToList"></detailsPage>
   </div>
 </template>