Browse Source

退货出库 优化编辑按钮操作流程

Qukatie 1 day ago
parent
commit
d4eb247b56

+ 68 - 177
src/views/tirePartsMall/purchaseService/outStorage/detailsPage.vue

@@ -7,11 +7,9 @@
         </el-button>
       </div>
       <div class="add-customer-btn">
-        <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 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" 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"
@@ -19,7 +17,7 @@
           style="margin-left: 6px;"
           v-if="form.statusName == '待出库' || form.statusName == '撤销出库'"
           @click="complete"
-          :disabled="isSave"
+          :disabled="editDisabled"
           >出库完成
         </el-button>
       </div>
@@ -49,7 +47,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)"
                 >
@@ -67,7 +65,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)"
                 >
@@ -76,21 +74,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 || form.statusName == '已出库'"
-                  :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>
@@ -124,12 +115,12 @@
           </el-tab-pane>
         </el-tabs>
       </trade-card>
-      <view-area ref="viewArea" @areaData="areaData" :disabled="disabled || isDisabled"></view-area>
+      <view-area ref="viewArea" @areaData="areaData" :disabled="editDisabled"></view-area>
       <containerTitle title="上传附件"></containerTitle>
       <c-upload
         v-loading="loadingBtn"
         typeUpload="LT"
-        :disabled="isAddDisabled"
+        :disabled="editDisabled"
         deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId"
         :data="filesList"
         display
@@ -165,14 +156,10 @@ export default {
       // 上传附件的需要参数
       loadingBtn: false,
       filesList: [],
-
       switchDialog: false,
       activeName: "sale_detail",
-      editButton: true,
-      isSave: true,
-      disabled: false,
-      isDisabled: false,
-      isAddDisabled: false,
+      editButton: false,
+      editDisabled: false,
       form: {
         shipItemsList: [],
         shipVOList: [],
@@ -186,7 +173,7 @@ export default {
         column: [
           {
             label: "业务对象",
-            disabled: false,
+            disabled: true,
             prop: "customerId",
             type: "select",
             props: {
@@ -242,7 +229,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",
@@ -257,7 +244,7 @@ export default {
           },
           {
             label: "出库单号",
-            disabled: false,
+            disabled: true,
             prop: "billno",
             rules: [
               {
@@ -333,11 +320,10 @@ export default {
       optionContactsBack: {
         align: "center",
         index: true,
-        addBtnText: "录入明细",
         updateBtnText: "保存",
         refreshBtn: false,
         dialogDrag: true,
-        addBtn: true,
+        addBtn: false,
         span: 8,
         height: 300,
         addRowBtn: false,
@@ -552,7 +538,6 @@ export default {
     viewArea
   },
   props: {
-    onLoad: Object,
     detailData: Object
   },
   async created() {
@@ -560,16 +545,11 @@ export default {
     this.optionPaymentDetails = await this.getColumnData(this.getColumnName(358), this.optionPaymentDetailsBack);
     this.optionOutboundRecords = await this.getColumnData(this.getColumnName(359), 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);
-      this.refresh(this.onLoad.id, true);
-    }
     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 => {
@@ -584,12 +564,6 @@ export default {
       this.reservoirArea = res.data.data;
     });
   },
-  activated() {
-    if (this.detailData.id) {
-      this.refresh();
-    }
-    this.$store.commit("DOMIO_IN_DETAIL");
-  },
   methods: {
     rowDelArea(row, index) {
       if (row.historyList.filter(item => item.id).length) {
@@ -650,20 +624,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
                 });
-                loading.close();
-                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();
@@ -727,27 +696,25 @@ export default {
           })
             .then(res => {
               if (res.data.code === 601) {
-                if (this.onLoad.id) {
-                  this.refresh(this.onLoad.id, true);
-                }
+                this.refresh(this.form.id);
                 this.$message({
                   type: "error",
                   message: res.data.msg
                 });
-                return true;
-              }
-              warehousingComplete({
-                ...this.form,
-                bizTypeName: "TKFHGD"
-              })
-                .then(res => {
-                  this.$message.success("出库完成");
-                  this.refresh(res.data.data.id);
-                  loading.close();
+                loading.close();
+              } else {
+                warehousingComplete({
+                  ...this.form,
+                  bizTypeName: "TKFHGD"
                 })
-                .finally(() => {
-                  loading.close();
-                });
+                  .then(res => {
+                    this.$message.success("出库完成");
+                    this.refresh(this.form.id);
+                  })
+                  .finally(() => {
+                    loading.close();
+                  });
+              }
             })
             .catch(() => {
               loading.close();
@@ -789,20 +756,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
                 });
-                loading.close();
-                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();
@@ -813,70 +775,31 @@ export default {
       });
     },
     refresh(id, type) {
-      this.$set(this.optionContactsBack, "addBtn", false);
-      this.$set(this.optionContacts, "addBtn", false);
-      this.isDisabled = true;
       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: 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;
+          this.$nextTick(() => {
+            this.$refs.formContacts.refreshTable();
           });
-      }
+        })
+        .finally(() => {
+          loading.close();
+        });
     },
     rowDelBox(row, index) {
       this.$confirm("确定将选择数据删除?", {
@@ -910,46 +833,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;
       }
     },
     //自定义列保存

+ 1 - 1
src/views/tirePartsMall/purchaseService/outStorage/index.vue

@@ -42,7 +42,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>
 
     <el-dialog
       title="发货"

+ 1 - 5
src/views/tirePartsMall/salesService/inStorage/detailsPage.vue

@@ -174,7 +174,7 @@
       <c-upload
         v-loading="loadingBtn"
         typeUpload="LT"
-        :disabled="isEdit"
+        :disabled="editDisabled"
         deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId"
         :data="filesList"
         display
@@ -483,7 +483,6 @@ export default {
         align: "center",
         index: true,
         addBtn: false, // 新增按钮
-        addBtnText: "录入明细",
         refreshBtn: false,
         editBtn: false, // 修改按钮
         delBtn: false, //删除按钮
@@ -884,9 +883,6 @@ export default {
     dicSelect,
     viewArea
   },
-  activated() {
-    this.$store.commit("DOMIO_IN_DETAIL");
-  },
   methods: {
     rowDelArea(row, index) {
       if (row.historyList.filter(item => item.id).length) {