瀏覽代碼

Merge branch 'purchaseDev' into 'dev'

Purchase dev

See merge request new-business/drp-web!115
黄梓星 2 年之前
父節點
當前提交
5486c24982

+ 8 - 3
src/views/purchase/PurchaseDemandList/add.vue

@@ -247,7 +247,7 @@
             </el-table-column>
             <el-table-column show-overflow-tooltip label="预留周期" align="center" prop="reservedPeriod" width="150px">
               <template slot-scope="scope">
-                <el-form-item class="hang">
+                <el-form-item class="hang" :prop="'puDemandItemList.' + scope.$index + '.' + 'reservedPeriod'" :rules="{ required: isYl, message: '请填写预留周期', trigger: 'blur' }">
                   <el-input clearable :readonly="sonDisable" size="small" v-model="scope.row.reservedPeriod"/>
                 </el-form-item>
               </template>
@@ -550,8 +550,7 @@ export default {
       deptOptions: [],
       customerOptions: [],
       isBDXQ: false,
-      // 刷新表格数据
-      refreshData: 0
+      isYl: false
     }
   },
   created() {
@@ -603,6 +602,12 @@ export default {
     // 获取预留数量
     getYLSL(scope) {
       scope.row.reservedQty = Math.ceil(scope.row.reservedProportion.replace('%', '') / 100 * scope.row.qty)
+      // 如果选择预留比例,预留周期必填
+      if(scope.row.reservedQty && scope.row.reservedQty !== 0) {
+        this.isYl = true
+      } else {
+        this.isYl = false
+      }
     },
     copy() {
       this.$modal.msgSuccess("复制成功");

+ 0 - 2
src/views/purchase/purchase-order/add/index.vue

@@ -68,7 +68,6 @@ export default {
       handler(nVal, oVal) {
         // 组织变化
         if (this.visible && nVal.puOrg != oVal.puOrg) {
-          console.log(nVal.puOrg, "nVal.puOrg", oVal.puOrg, "oVal.puOrg");
           for (const key in this.params) {
             if (Array.isArray(this.params[key])) {
               this.params[key] = [];
@@ -111,7 +110,6 @@ export default {
     },
     // 复制赋值
     async setCopyParams(id) {
-      console.log(id, "iid-----------------------");
       try {
         const { code, msg, data } = await orderApi.details(id);
 

+ 1 - 15
src/views/purchase/purchase-order/edit/index.vue

@@ -77,13 +77,10 @@ export default {
     },
     // 判断属性是否禁用
    async handleIsForbidden(status) {
-      console.log(status);
         let { updateColumns, updateTabColumns } = await forbidden(status != '2');
         this.columns = updateColumns;
         this.tabColumns = updateTabColumns;
         this.count++;
-        console.log(this.columns,'this.columns');
-        console.log(this.tabColumns,'this.tabColumns');
     },
     // 查询详细
     async fetchItem(prop) {
@@ -215,10 +212,6 @@ export default {
     },
     // 子表参照改变之后
     handleReferChange(val, source, type) {
-      console.log(val, 'val');
-      console.log(source, 'source');
-      console.log(type, 'type');
-
       // 触发物料参照
       if (type == 'MATERIAL_PARAM' && source.qty && source.qty != '') {
 
@@ -244,7 +237,6 @@ export default {
 
      // 子表下拉框改变
      handleTabSelectChange(type,row){
-      console.log(type,'type');
 
       if(type == 'priceType' && row.material && row.qty && row.qty != ""){
         this.handleGetPrice();
@@ -252,7 +244,6 @@ export default {
     },
     // 子表inputNumber
     handleInputChange(row, type) {
-      console.log(type, 'type');
       // 物料数量变化----询价
       if (type == 'qty' && row.material) {
         this.handleGetPrice();
@@ -290,12 +281,7 @@ export default {
     },
     
   },
-  created() {
-    console.log("EDIT CREATED");
-    console.log(this.params, 'this.params');
-
-
-  },
+  created() {},
   mounted() { },
   destroyed() { },
 };

+ 76 - 38
src/views/purchase/purchase-order/index.vue

@@ -146,34 +146,68 @@ export default {
         // this.loading = false;
       }
     },
-    // 删除操作
-     handleDeleteList(row) {
-      try {
-        this.loading = true;
 
-        this.$confirm('此操作将删除该订单, 是否继续?', '提示', {
+    // 操作提示弹窗
+    handleConfirmTips(success){
+
+      this.$confirm('是否继续此操作?', '提示', {
           confirmButtonText: '确定',
           cancelButtonText: '取消',
           type: 'warning'
-        }).then( async() => {
+        }).then(() => {
+
+          success();
+
+        }).catch(() => {
+
+          this.$message({
+            type: 'info',
+            message: '已取消操作!'
+          });          
+        });
+    },
+
+    // 删除操作
+    handleDeleteList(row) {
+      try {
+        this.loading = true;
+
+        this.handleConfirmTips(async()=>{
 
           const { id } = row;
 
           const { code } = await orderApi.remove(id);
-          
+
           if (code === 200) {
 
             this.fetchList(this.params, this.page);
 
           }
+        })
 
-        }).catch(() => {
+        // this.$confirm('此操作将删除该订单, 是否继续?', '提示', {
+        //   confirmButtonText: '确定',
+        //   cancelButtonText: '取消',
+        //   type: 'warning'
+        // }).then( async() => {
 
-          this.$message({
-            type: 'info',
-            message: '已取消删除'
-          });          
-        });
+        //   const { id } = row;
+
+        //   const { code } = await orderApi.remove(id);
+          
+        //   if (code === 200) {
+
+        //     this.fetchList(this.params, this.page);
+
+        //   }
+
+        // }).catch(() => {
+
+        //   this.$message({
+        //     type: 'info',
+        //     message: '已取消删除'
+        //   });          
+        // });
         
       } catch (err) {
         //
@@ -182,17 +216,21 @@ export default {
       }
     },
     // 提交
-    async handleSubmit(row) {
-      try {
-
-        let { code } = await orderApi.submit({ puOrderId: row.id });
+    handleSubmit(row) {
 
-        if (code == 200) {
+      try {
 
-          this.fetchList(this.params, this.page);
+       this.handleConfirmTips(async()=>{
 
-        }
+         let { code } = await orderApi.submit({ puOrderId: row.id });
+ 
+         if (code == 200) {
+ 
+           this.fetchList(this.params, this.page);
+ 
+         }
 
+       })
       } catch (error) {
       } finally {
       }
@@ -218,12 +256,15 @@ export default {
           inputPattern: /\s*\S+?/,
           inputErrorMessage: '退回原因不能为空'
         }).then(({ value }) => {
+
           let data = {
             id: this.checkedList[0].id,
             documentIds: [],
             baskCause: value,
           };
+
           console.log(data);
+
           try {
 
             let { code, msg } = orderApi.documentsReturn(data);
@@ -233,12 +274,8 @@ export default {
               this.fetchList(this.params, this.page);
 
             }
-          } catch (error) {
-          } finally {
-          }
-        }).catch(() => {    
-        });
-      
+          } catch (error) {}
+        }).catch(() => {   });
       
     },
     // 判断是否满足整单关闭
@@ -256,28 +293,27 @@ export default {
 
     },
     // 整单关闭
-    async handleAllClose() {
+     handleAllClose() {
       // 未审批状态下整单关闭
       try {
 
-        let puOrderIds = this.checkedList.map(order => {
+        this.handleDeleteList(async() =>{
 
-          return order.id;
+          let puOrderIds = this.checkedList.map(order => {
 
-        })
-
-        let { code } = await orderApi.close({ puOrderIds });
+            return order.id;
 
-        if (code === 200) {
+          })
 
-          this.fetchList(this.params, this.page);
+          let { code } = await orderApi.close({ puOrderIds });
 
-        }
+          if (code === 200) {
 
-      } catch (error) {
+            this.fetchList(this.params, this.page);
 
-      } finally {
-      }
+          }
+        })
+      } catch (error) { } 
     },
     // 付款协议
     async handlePaymentRequest(){
@@ -285,6 +321,8 @@ export default {
       try {
         // let {name} = this.$store.state.user;
 
+
+
         let {code,msg} = await orderApi.payRequest();
 
         if(code == 200){

+ 31 - 10
src/views/purchase/transferOrder/add.vue

@@ -4,7 +4,7 @@
       <el-row :gutter="10">
         <el-col :span="1.5">
           <el-form-item label="调出库存组织">
-            <el-select clearable size="small" v-model="basicForm.deliveryInventoryOrg" :disabled="sonDisable" @focus="chooseRefer('ORG_PARAM', true, '调出库存组织')" style="width: 200px">
+            <el-select clearable size="small" v-model="basicForm.deliveryInventoryOrg" :disabled="sonDisable" @change="controlCk" @focus="chooseRefer('ORG_PARAM', true, '调出库存组织')" style="width: 200px">
               <el-option v-for="item in chuOrgOptions" :key="item.id" :label="item.name" :value="item.id" />
             </el-select>
           </el-form-item>
@@ -73,7 +73,7 @@
          </el-col>
         <el-col :span="1.5">
             <el-form-item label="调入库存组织">
-              <el-select clearable size="small" v-model="basicForm.storageInventoryOrg" :disabled="sonDisable" @focus="chooseRefer('ORG_PARAM', true, '调入库存组织')" style="width: 200px">
+              <el-select clearable size="small" v-model="basicForm.storageInventoryOrg" :disabled="sonDisable" @change="controlCk" @focus="chooseRefer('ORG_PARAM', true, '调入库存组织')" style="width: 200px">
                 <el-option v-for="item in ruOrgOptions" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
             </el-form-item>
@@ -87,7 +87,7 @@
          </el-col>
         <el-col :span="1.5">
             <el-form-item label="调出部门">
-              <el-select clearable size="small" v-model="basicForm.deliveryDept" :disabled="sonDisable" @focus="chooseRefer('DEPT_PARAM', true, '调出部门', basicForm.deliveryInventoryOrg)" style="width: 200px">
+              <el-select clearable size="small" v-model="basicForm.deliveryDept" :disabled="sonDisable || isOrg" @focus="chooseRefer('DEPT_PARAM', true, '调出部门', basicForm.deliveryInventoryOrg)" style="width: 200px">
                 <el-option v-for="item in deptOptions" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
             </el-form-item>
@@ -158,14 +158,14 @@
          </el-col>
         <el-col :span="1.5">
             <el-form-item label="调入仓库">
-              <el-select clearable size="small" v-model="basicForm.storageWarehouse" :disabled="sonDisable" @focus="chooseRefer('WAREHOUSE_PARAM', true, '调入仓库', basicForm.storageInventoryOrg, 'N', 'N')" style="width: 200px">
+              <el-select clearable size="small" v-model="basicForm.storageWarehouse" :disabled="sonDisable || isOrg" @change="controlDCHW" @focus="chooseRefer('WAREHOUSE_PARAM', true, '调入仓库', basicForm.storageInventoryOrg, 'N', 'N')" style="width: 200px">
                 <el-option v-for="item in ruHouseOptions" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
             </el-form-item>
          </el-col>
         <el-col :span="1.5">
             <el-form-item label="调出仓库">
-              <el-select clearable size="small" v-model="basicForm.deliveryWarehouse" :disabled="sonDisable" @focus="chooseRefer('WAREHOUSE_PARAM', true, '调出仓库')" style="width: 200px">
+              <el-select clearable size="small" v-model="basicForm.deliveryWarehouse" :disabled="sonDisable || isOrg" @change="controlDRHW" @focus="chooseRefer('WAREHOUSE_PARAM', true, '调出仓库')" style="width: 200px">
                 <el-option v-for="item in chuHouseOptions" :key="item.id" :label="item.name" :value="item.id" />
               </el-select>
             </el-form-item>
@@ -271,8 +271,8 @@
           <el-table-column show-overflow-tooltip label="调出货位" align="center" prop="deliveryAllocationName" width="230px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.deliveryAllocationName" @focus="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '调出货位', basicForm.deliveryWarehouse)">
-                  <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '调出货位', basicForm.deliveryWarehouse)"></el-button>
+                <el-input clearable :disabled="sonDisable || isCk" size="small" v-model="scope.row.deliveryAllocationName" @focus="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '调出货位', basicForm.deliveryWarehouse)">
+                  <el-button size="small" :disabled="sonDisable || isCk" slot="append" icon="el-icon-more" @click="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '调出货位', basicForm.deliveryWarehouse)"></el-button>
                 </el-input>
               </el-form-item>
             </template>
@@ -289,8 +289,8 @@
           <el-table-column show-overflow-tooltip label="调入货位" align="center" prop="storageAllocationName" width="230px">
             <template slot-scope="scope">
               <el-form-item class="hang">
-                <el-input clearable :disabled="sonDisable" size="small" v-model="scope.row.storageAllocationName" @focus="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '调入货位', basicForm.storageWarehouse)">
-                  <el-button size="small" :disabled="sonDisable" slot="append" icon="el-icon-more" @click="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '调入货位', basicForm.storageWarehouse)"></el-button>
+                <el-input clearable :disabled="sonDisable || isCk" size="small" v-model="scope.row.storageAllocationName" @focus="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '调入货位', basicForm.storageWarehouse)">
+                  <el-button size="small" :disabled="sonDisable || isCk" slot="append" icon="el-icon-more" @click="chooseMxHW(scope.$index, 'ALLOCATION_PARAM', true, '调入货位', basicForm.storageWarehouse)"></el-button>
                 </el-input>
               </el-form-item>
             </template>
@@ -704,7 +704,9 @@ export default {
             );
           }
         }
-      }
+      },
+      isOrg: true,
+      isCk: false
     }
   },
   created() {
@@ -716,6 +718,21 @@ export default {
     }
   },
   methods: {
+    // 控制先选调出库存组织和调入库存组织再选调出部门和调入调出仓库
+    controlCk() {
+      console.log('进了吗')
+      if (this.basicForm.deliveryInventoryOrg && this.basicForm.storageInventoryOrg) {
+        this.isOrg = false
+      } else {
+        this.basicForm.deliveryDept = ''
+        this.basicForm.storageWarehouse = ''
+        this.basicForm.deliveryWarehouse = ''
+        this.isOrg = true
+      }
+    },
+    // 控制子表内货位是否可以填写,根据选择仓库内csFlag
+    controlDCHW() {},
+    controlDRHW() {},
     // 输入数量或者主数量同步改变
     getZSL(scope) {
       scope.row.qty = scope.row.mainQty
@@ -788,6 +805,8 @@ export default {
           if(this.basicForm.storageWarehouse) { this.reBackRefer('WAREHOUSE_PARAM', this.basicForm.storageWarehouse, '调入仓库') }
           if(this.basicForm.deliveryWarehouse) { this.reBackRefer('WAREHOUSE_PARAM', this.basicForm.deliveryWarehouse, '调出仓库') }
           if(this.basicForm.liacenter) { this.reBackRefer('LIACENTER_PARAM', this.basicForm.liacenter) }
+          // 控制先选调出库存组织和调入库存组织再选调出部门和调入调出仓库
+          this.controlCk()
         }
       })
     },
@@ -945,6 +964,8 @@ export default {
         this.materialInfo[this.tableIndex].storageDeptName = selection[0].name
         this.materialInfo[this.tableIndex].storageDept = selection[0].id
       }
+      // 控制先选调出库存组织和调入库存组织再选调出部门和调入调出仓库
+      this.controlCk()
     },
     chooseTreeRefer(type, isPage, title) {
       this.referCondition.type = type