fubin 2 лет назад
Родитель
Сommit
6b7c1e4902
3 измененных файлов с 128 добавлено и 69 удалено
  1. 46 5
      src/view/sale/order-out/form.vue
  2. 81 64
      src/view/sale/order/form.vue
  3. 1 0
      src/view/sale/order/index.vue

+ 46 - 5
src/view/sale/order-out/form.vue

@@ -60,6 +60,16 @@
             <DatePickerPop v-model="formData.outDate"
                            :short-cut-flag="true"/>
           </DkFormItem>
+          <!--自动出库标识-->
+          <DkFormItem prop="autoOutFlag" v-show="showAutoFlag">
+            <template>
+              <i-switch v-model="formData.flgAutoHandle" @on-change="changeOutStatus"
+                        :disabled="type === $config.formMode.handle">
+                <span slot="open"></span>
+                <span slot="close"></span>
+              </i-switch>
+            </template>
+          </DkFormItem>
           <!--单据备注-->
           <DkFormItem prop="remarks">
             <InputPop ref="remarks" v-model="formData.remarks"
@@ -116,9 +126,9 @@ export default {
   data() {
     let self = this
     return {
-      allCanNoEdit: false, //是否所有的都不允许编辑
-      currentRow: null,// 表格中的当前行
-      // 画面表单数据
+      showAutoFlag: true, //是否显示自动办理出库标识
+      showOutDate: true, //是否显示自动办理出库标识
+      currentRow: null,   // 表格中的当前行
       formData: {
         outId: null,
         outNo: null,
@@ -304,6 +314,24 @@ export default {
       }
     },
     /**
+     * @desc   : 自动出库标识变更
+     * @author : 付斌
+     * @date   : 2024-04-11 14:47
+     */
+    changeOutStatus() {
+      if (this.type === this.$config.formMode.add) {
+        if (this.formData.flgAutoHandle) {
+          this.formData.outDate = new Date().format("yyyy-MM-dd")
+          this.showOutDate = true
+        } else {
+          this.formData.outDate = null
+          this.showOutDate = false
+        }
+      } else {
+        this.formData.outDate = new Date().format("yyyy-MM-dd")
+      }
+    },
+    /**
      * @desc   : 通过id查询
      * @author : 付斌
      * @date   : 2022/03/04 13:17
@@ -329,6 +357,12 @@ export default {
         if (this.type === this.$config.formMode.add) {
           this.goodsFootFormData.sumOutingQty = this.formData.sumQuantity;
           this.goodsFootFormData.sumOutingAmt = this.formData.sumAmount;
+          //系统自动办理出库
+          if (this.$store.state.user.setting[this.$config.settingCode.IVT001] == 1) {
+            this.formData.flgAutoHandle = true;
+          } else {
+            this.formData.flgAutoHandle = false;
+          }
         } else if (this.type === this.$config.formMode.edit) {
           this.goodsFootFormData.sumOutingQty = this.formData.outingQty;
           this.goodsFootFormData.sumOutingAmt = this.formData.outingAmt;
@@ -342,7 +376,6 @@ export default {
         if (!this.formData.makeStaff) {
           this.formData.makeStaff = this.$store.state.user.id;
         }
-        this.formData.flgAutoHandle = true;
       }
     },
     /**
@@ -402,7 +435,7 @@ export default {
     saveData() {
       if (this.type === this.$config.formMode.add) {
         return this.excute(this.$service.orderOutService, this.$service.orderOutService.outboundInsert, this.params);
-      } else if (this.type === this.$config.formMode.edit){
+      } else if (this.type === this.$config.formMode.edit) {
         return this.excute(this.$service.orderOutService, this.$service.orderOutService.outboundUpdate, this.params);
       }
     },
@@ -426,6 +459,14 @@ export default {
   created() {
     this.focusItem = 'outId';    // 给第一个组件赋值,可以在混入中自动去聚焦
     this.primaryKey = 'outId'  // 设置主键Id
+
+    //设置默认值
+    if (this.$route.params.id) {
+      // 出库办理
+      if (this.type === this.$config.formMode.handle) {
+        this.showAutoFlag = false;
+      }
+    }
   },
 }
 </script>

+ 81 - 64
src/view/sale/order/form.vue

@@ -225,7 +225,8 @@ export default {
       cityData: [],
       channelList: [],
       cusFromList: [],
-      defaultWhList: [],     // 默认仓库
+      canUseWhList: [],     // 可用仓库列表
+      defaultWh: null,      // 默认仓库
       addOrderItemColumns: [
         {
           field: 'skuModel',
@@ -282,6 +283,7 @@ export default {
             return {
               skuId: self.currentRow?.skuId,
               nonStdCode: self.currentRow?.nonStdCode,
+              orgId: self.formData.orgId,
             }
           },
           fieldUpdate: [
@@ -381,6 +383,7 @@ export default {
             return {
               skuId: self.currentRow?.skuId,
               nonStdCode: self.currentRow?.nonStdCode,
+              orgId: self.formData.orgId,
             }
           },
           fieldUpdate: [
@@ -480,8 +483,8 @@ export default {
       this.getChannel();
       // 获取数据字典
       this.getDictionaryData();
-      // 获取默认仓库
-      this.getDefaultWh();
+      // 获取可用的仓库列表及默认仓库
+      this.getCanUseWh();
 
       // 设置默认业务员业务部门
       this.formData.staffList = []
@@ -529,34 +532,6 @@ export default {
       })
     },
     /**
-     * @desc   : 获取默认仓库
-     * @author : 付斌
-     * @date   : 2024-03-02 11:15
-     */
-    getDefaultWh(orgId) {
-      if (!orgId) {
-        orgId = this.$store.state.user.orgId
-      }
-      let params = {orgId: orgId}
-      this.excute(this.$service.commonService, this.$service.commonService.getOrgWh, params, false).then(res => {
-        if (res.code === this.$config.SUCCESS_CODE) {
-          let list = res.data.filter(it => it.flgDefault)
-          if (list.length > 0) {
-            this.defaultWhList = list
-          } else {
-            this.excute(this.$service.commonService, this.$service.commonService.getWarehouse, {}, false).then(res => {
-              if (res.code === this.$config.SUCCESS_CODE) {
-                let list = res.data.filter(it => it.flgDefault)
-                if (list.length > 0) {
-                  this.defaultWhList = list
-                }
-              }
-            })
-          }
-        }
-      })
-    },
-    /**
      *   @desc   : 业务部门OK
      *   @date   : 2022/5/28 10:43
      *   @author : 付斌
@@ -571,7 +546,8 @@ export default {
             this.formData.orgCode = i.orgCode
             this.formData.orgName = i.orgName
             this.formData.allocationRatio = i.allocationRatio
-            this.getDefaultWh(i.orgId);
+            // 获取可用的仓库列表及默认仓库
+            this.getCanUseWh(i.orgId);
           }
           //存放从部门id和分配比
           this.formData.orgList.push({
@@ -582,18 +558,6 @@ export default {
             ownerFlag: i.ownerFlag
           })
         }
-        // 设置默认仓库
-        if (this.defaultWhList && this.defaultWhList.length > 0) {
-          let table = this.$refs['goodsTable'].tableData
-          if (table && table.length > 0) {
-            table.forEach(row => {
-              if (!row["whId"] || row["whId"] == '') {
-                this.$set(row, 'whId', this.defaultWhList[0].whId);
-                this.$set(row, 'whName', this.defaultWhList[0].whName);
-              }
-            })
-          }
-        }
       }
     },
     /**
@@ -682,7 +646,8 @@ export default {
         this.formData.addressGcj02 = value.addressGcj02;
         this.formData.addressFull = value.addressFull + (this.formData.addressNo ? this.formData.addressNo : '');
       }
-    },
+    }
+    ,
     /**
      *   @desc   : 拼写详细地址
      *   @date   : 2022/6/9 10:08
@@ -733,18 +698,20 @@ export default {
       let sumStandard = 0;  // 标价总额
       if (table && table.length > 0) {
         table.forEach(row => {
-          if (row["itemQty"]) {
-            sumQuantity += parseFloat(row["itemQty"]);
+          if (!row["itemQty"] || row["itemQty"] == '') {
+            this.$set(row, 'itemQty', 0);
           }
-          if (row["itemAmt"]) {
-            sumAmount += parseFloat(row["itemAmt"]);
+          if (!row["itemAmt"] || row["itemQty"] == '') {
+            this.$set(row, 'itemAmt', 0);
           }
+          sumQuantity += parseFloat(row["itemQty"]);
+          sumAmount += parseFloat(row["itemAmt"]);
           this.$set(row, 'amtStd', parseFloat(row["itemQty"]) * parseFloat(row["priceStd"]));
           sumStandard += parseFloat(row["amtStd"]);
 
           if (!row["whId"] || row["whId"] == '') {
-            this.$set(row, 'whId', this.defaultWhList[0].whId);
-            this.$set(row, 'whName', this.defaultWhList[0].whName);
+            this.$set(row, 'whId', this.defaultWh.whId);
+            this.$set(row, 'whName', this.defaultWh.whName);
           }
         })
       }
@@ -930,19 +897,69 @@ export default {
         return true;
       }
     },
-    // /**
-    //  * @desc   : 修改客户电话后,清除当前客户信息
-    //  * @author : 付斌
-    //  * @date   : 2022-08-01 14:39
-    //  */
-    // customerPhoneChange(e, change) {
-    //   // 文本改变时不清空数据
-    //   if (!change && this.formData.cusId) {
-    //     this.clearCutomer()
-    //   }
-    // },
-  }
-  ,
+
+    // region 私有方法
+    /**
+     * @desc   : 获取可用的仓库列表及默认仓库
+     * @author : 付斌
+     * @date   : 2024-03-02 11:15
+     */
+    getCanUseWh(orgId) {
+      if (!orgId) {
+        orgId = this.$store.state.user.orgId
+      }
+      let params = {orgId: orgId}
+      this.excute(this.$service.commonService, this.$service.commonService.getOrgWh, params, false).then(res => {
+          if (res.code === this.$config.SUCCESS_CODE) {
+            this.canUseWhList = [...res.data]
+            let list = res.data.filter(it => it.flgDefault)
+            if (list.length > 0) {
+              this.defaultWh = list[0]
+              // 设置默认仓库
+              this.setDefaultWh()
+            } else {
+              this.excute(this.$service.commonService, this.$service.commonService.getWarehouse, {}, false).then(res => {
+                if (res.code === this.$config.SUCCESS_CODE) {
+                  this.canUseWhList = [...res.data]
+                  let list = res.data.filter(it => it.flgDefault)
+                  if (list.length > 0) {
+                    this.defaultWh = list[0]
+                    // 设置默认仓库
+                    this.setDefaultWh()
+                  }
+                }
+              })
+            }
+          }
+        }
+      )
+    },
+    /**
+     * @desc   : 设置默认仓库
+     * @author : 付斌
+     * @date   : 2024-04-11 13:56
+     */
+    setDefaultWh() {
+      let table = this.$refs['goodsTable'].tableData
+      if (table && table.length > 0) {
+        table.forEach(row => {
+          if (row.skuId) {
+            if (row.whId) {
+              let list2 = this.canUseWhList.filter(it => it.whId === row.whId)
+              if (list2.length == 0) {
+                this.$set(row, 'whId', this.defaultWh.whId);
+                this.$set(row, 'whName', this.defaultWh.whName);
+              }
+            } else {
+              this.$set(row, 'whId', this.defaultWh.whId);
+              this.$set(row, 'whName', this.defaultWh.whName);
+            }
+          }
+        })
+      }
+    },
+    // endregion 私有方法
+  },
   /**
    * @desc   : 在实例创建完成后被立即同步调用
    * @author : 付斌

+ 1 - 0
src/view/sale/order/index.vue

@@ -79,6 +79,7 @@
             <DkTableColumn field="priceSale" :digits="2" dataType="number" sum/>
             <DkTableColumn field="itemAmt" :digits="2" dataType="number" sum/>
             <DkTableColumn field="priceDiscount" :digits="2" dataType="number" sum/>
+            <DkTableColumn field="whName"/>
             <DkTableColumn field="outingQty" dataType="number" sum/>
             <DkTableColumn field="outingAmt" :digits="2" dataType="number" sum/>
             <DkTableColumn field="outQty" dataType="number" sum/>