Browse Source

优化盘点的编辑操作流程
盘点bug

Qukatie 3 days ago
parent
commit
3047711489

+ 38 - 58
src/views/tirePartsMall/salesManagement/Inventory/detailsPage.vue

@@ -10,7 +10,16 @@
         <el-button class="el-button&#45;&#45;small-yh" style="margin-left: 6px;" type="primary" size="small" v-if="editButton" @click="confirmEditing"
         <el-button class="el-button&#45;&#45;small-yh" style="margin-left: 6px;" type="primary" size="small" v-if="editButton" @click="confirmEditing"
           >编 辑
           >编 辑
         </el-button>
         </el-button>
-        <el-button class="el-button--small-yh" v-else style="margin-left: 6px;" type="primary" size="small" @click="editCustomer">保 存 </el-button>
+        <el-button
+          class="el-button--small-yh"
+          v-else
+          style="margin-left: 6px;"
+          type="primary"
+          size="small"
+          @click="editCustomer"
+          :disabled="editDisabled"
+          >保 存
+        </el-button>
         <el-button type="primary" icon="el-icon-printer" size="small" :disabled="!(form.orderItemsList.length != 0 && form.id)" @click="handlePrint"
         <el-button type="primary" icon="el-icon-printer" size="small" :disabled="!(form.orderItemsList.length != 0 && form.id)" @click="handlePrint"
           >打印</el-button
           >打印</el-button
         >
         >
@@ -22,8 +31,8 @@
           style="margin-left: 6px;"
           style="margin-left: 6px;"
           type="success"
           type="success"
           size="small"
           size="small"
-          v-if="form.id"
-          :disabled="form.status == '已确认'"
+          v-if="form.status == '录入'"
+          :disabled="editDisabled"
           @click="generateOutbound"
           @click="generateOutbound"
         >
         >
           提交盘点结果
           提交盘点结果
@@ -50,9 +59,9 @@
           @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.4)"
           @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 269.4)"
         >
         >
           <template slot-scope="{ scope, row }" slot="menuLeft">
           <template slot-scope="{ scope, row }" slot="menuLeft">
-            <el-button type="primary" icon="el-icon-plus" size="small" :disabled="form.status == '已确认'" @click="rowAdd(row)">添加库存</el-button>
-            <el-button type="success" icon="el-icon-download" size="small" @click="outExport">导出</el-button>
-            <el-button type="warning" icon="el-icon-upload" size="small" @click="excelBox = true">导入</el-button>
+            <el-button type="primary" icon="el-icon-plus" size="small" :disabled="editDisabled" @click="rowAdd(row)">添加库存</el-button>
+            <el-button type="success" icon="el-icon-download" size="small" @click="outExport" :disabled="editDisabled">导出</el-button>
+            <el-button type="warning" icon="el-icon-upload" size="small" @click="excelBox = true" :disabled="editDisabled">导入</el-button>
           </template>
           </template>
           <template slot="sendNum" slot-scope="{ row }">
           <template slot="sendNum" slot-scope="{ row }">
             <el-input
             <el-input
@@ -100,7 +109,7 @@
             <el-button
             <el-button
               v-if="reservoirArea == 1 && row.historyList.length"
               v-if="reservoirArea == 1 && row.historyList.length"
               :size="size"
               :size="size"
-              :disabled="!row.id || form.status == '已确认'"
+              :disabled="!row.id || editDisabled"
               type="text"
               type="text"
               @click="rowDelArea(row, index)"
               @click="rowDelArea(row, index)"
             >
             >
@@ -112,42 +121,37 @@
             <el-button
             <el-button
               v-if="reservoirArea == 1 && row.historyList.length == 0"
               v-if="reservoirArea == 1 && row.historyList.length == 0"
               :size="size"
               :size="size"
-              :disabled="!row.id || form.status == '已确认'"
+              :disabled="!row.id || editDisabled"
               type="text"
               type="text"
               @click="rowArea(row, index)"
               @click="rowArea(row, index)"
             >
             >
               选择库区
               选择库区
             </el-button>
             </el-button>
             <el-button
             <el-button
-              v-if="mingxibaocun&&reservoirArea != 1"
+              v-if="mingxibaocun && reservoirArea != 1"
               :size="size"
               :size="size"
               :type="type"
               :type="type"
-              :disabled="form.status == '已确认'"
+              :disabled="editDisabled"
               :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
               :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
               @click="hangeditBtn(row, index)"
               @click="hangeditBtn(row, index)"
               >编辑
               >编辑
             </el-button>
             </el-button>
             <el-button
             <el-button
-              v-else
+              v-if="!mingxibaocun && reservoirArea != 1"
               :size="size"
               :size="size"
               :type="type"
               :type="type"
-              :disabled="form.status == '已确认'"
+              :disabled="editDisabled"
               :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
               :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
               @click="hangbaocun(row, index)"
               @click="hangbaocun(row, index)"
               >保存
               >保存
             </el-button>
             </el-button>
-            <el-button
-              icon="el-icon-delete"
-              :size="size"
-              :disabled="form.status == '已确认'"
-              :type="type"
-              @click="rowDelBox(row, index, 'orderItemsList')"
+            <el-button icon="el-icon-delete" :size="size" :disabled="editDisabled" :type="type" @click="rowDelBox(row, index, 'orderItemsList')"
               >删除
               >删除
             </el-button>
             </el-button>
           </template>
           </template>
         </avue-crud>
         </avue-crud>
       </trade-card>
       </trade-card>
-      <view-area ref="viewArea" @areaData="areaData" :disabled="form.status == '已确认'"></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>
       <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" table-loading="excelLoading" :upload-before="uploadBefore" :upload-after="uploadAfter"> </avue-form>
         <avue-form :option="excelOption" table-loading="excelLoading" :upload-before="uploadBefore" :upload-after="uploadAfter"> </avue-form>
         <p style="text-align: center;color: #DC0505">
         <p style="text-align: center;color: #DC0505">
@@ -493,13 +497,8 @@ export default {
       dataList: [],
       dataList: [],
       dicUrlWithCustomId: "",
       dicUrlWithCustomId: "",
       sharedCompanyId: 0,
       sharedCompanyId: 0,
-      isAddBtn: true,
-      isAdd: false,
-      editButton: false, // 编辑按钮和保存按钮的显示隐藏
-      isSaveBtn: false, // 保存的禁用
-      isDisabledTask: false, // 生成,撤销任务按钮是否禁用
-      isDisabled: false,
-      disabled: false,
+      editButton: false,
+      editDisabled: false,
       key: 0,
       key: 0,
       excelOption: {
       excelOption: {
         submitBtn: false,
         submitBtn: false,
@@ -628,7 +627,6 @@ export default {
         border: true,
         border: true,
         align: "center",
         align: "center",
         index: true,
         index: true,
-        addBtnText: "添加商品",
         updateBtnText: "保存",
         updateBtnText: "保存",
         refreshBtn: false,
         refreshBtn: false,
         dialogDrag: true,
         dialogDrag: true,
@@ -879,7 +877,6 @@ export default {
   },
   },
   components: { reportDialog, check, checkSchedule, viewArea },
   components: { reportDialog, check, checkSchedule, viewArea },
   props: {
   props: {
-    onLoad: Object,
     detailData: Object
     detailData: Object
   },
   },
   async created() {
   async created() {
@@ -912,6 +909,8 @@ export default {
     });
     });
     if (this.detailData.id) {
     if (this.detailData.id) {
       this.editButton = true;
       this.editButton = true;
+      this.editDisabled = true;
+      this.optionForm.disabled = true;
       this.refresh(this.detailData.id);
       this.refresh(this.detailData.id);
     }
     }
     this.key++;
     this.key++;
@@ -968,7 +967,7 @@ export default {
       this.form.orderItemsList[index].dot = row.dot;
       this.form.orderItemsList[index].dot = row.dot;
       this.form.orderItemsList[index].historyList = row.historyList;
       this.form.orderItemsList[index].historyList = row.historyList;
       this.form.orderItemsList[index].sendNumHave = row.sendNum;
       this.form.orderItemsList[index].sendNumHave = row.sendNum;
-      this.form.orderItemsList[index].sendNum = row.sendNum+row.inventoryFinancing;
+      this.form.orderItemsList[index].sendNum = row.sendNum + row.inventoryFinancing;
       this.calculator(this.form.orderItemsList[index]);
       this.calculator(this.form.orderItemsList[index]);
     },
     },
     outExport() {
     outExport() {
@@ -1111,8 +1110,11 @@ export default {
     },
     },
     //表头编辑
     //表头编辑
     confirmEditing() {
     confirmEditing() {
-      this.editButton = false; // 让保存按钮出来
-      loading.close();
+      this.editButton = false;
+      if (this.form.status == "录入") {
+        this.editDisabled = false;
+        this.optionForm.disabled = false;
+      }
     },
     },
     // 确认盘点
     // 确认盘点
     generateOutbound() {
     generateOutbound() {
@@ -1150,8 +1152,7 @@ export default {
         confirmInventory(this.form)
         confirmInventory(this.form)
           .then(res => {
           .then(res => {
             this.$message.success("操作成功");
             this.$message.success("操作成功");
-            this.refresh(res.data.data.id);
-            loading.close();
+            this.refresh(this.form.id);
           })
           })
           .finally(() => {
           .finally(() => {
             loading.close();
             loading.close();
@@ -1163,31 +1164,12 @@ export default {
       this.$refs["form"].validate((valid, done) => {
       this.$refs["form"].validate((valid, done) => {
         done();
         done();
         if (valid) {
         if (valid) {
-          // for (let item of this.form.orderItemsList) {
-          //     if (!item.sendNum) {
-          //         this.$message.success('请填写实际数量');
-          //         return
-          //     }
-          // }
-          console.info("this.financingInventory----", this.financingInventory);
-          /*                    if (this.financingInventory) {
-                        // 不允许盘点融资货  sendNumFinancing
-                        let financing = this.form.orderItemsList.find(item => item.inventoryFinancing > 0)
-                        console.info('financing----', financing)
-                        if (financing) {
-                            this.$message.error('当前不允许盘点融资货货物');
-                            return false
-                        }
-                    }*/
-          console.log(this.form, 857);
-          // return
           const loading = this.$loading({
           const loading = this.$loading({
             lock: true,
             lock: true,
             text: "加载中",
             text: "加载中",
             spinner: "el-icon-loading",
             spinner: "el-icon-loading",
             background: "rgba(255,255,255,0.7)"
             background: "rgba(255,255,255,0.7)"
           });
           });
-
           submitInventory({
           submitInventory({
             bsType: "PD",
             bsType: "PD",
             ...this.form
             ...this.form
@@ -1195,8 +1177,6 @@ export default {
             .then(res => {
             .then(res => {
               this.$message.success("保存成功");
               this.$message.success("保存成功");
               this.refresh(res.data.data.id);
               this.refresh(res.data.data.id);
-              this.mingxibaocun = true;
-              loading.close();
             })
             })
             .finally(() => {
             .finally(() => {
               loading.close();
               loading.close();
@@ -1221,16 +1201,16 @@ export default {
       });
       });
       getDetails({ id: id })
       getDetails({ id: id })
         .then(res => {
         .then(res => {
-          this.form = res.data.data;
-          if (this.form.status == "已确认") {
+          if (res.data.data.status == "已确认") {
+            this.editDisabled = true;
             this.optionForm.disabled = true;
             this.optionForm.disabled = true;
           }
           }
+          this.form = res.data.data;
           this.$nextTick(() => {
           this.$nextTick(() => {
             this.$refs.formContacts.doLayout();
             this.$refs.formContacts.doLayout();
           });
           });
-          loading.close();
         })
         })
-        .catch(() => {
+        .finally(() => {
           loading.close();
           loading.close();
         });
         });
     },
     },

+ 1 - 1
src/views/tirePartsMall/salesManagement/Inventory/index.vue

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