瀏覽代碼

Merge branch 'purchaseDev' into 'dev'

Purchase dev

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

+ 12 - 11
src/views/purchase/purchase-order/add/column.js

@@ -555,6 +555,13 @@ export const TabColumns = [
         queryParams: () => ({}),
         width: 180,
       },
+      {
+        key: "priceType",
+        title: "价格类型",
+        inputType: "Select",
+        referName: "sys_price_type", // 字典名
+        width: 180,
+      },
       { 
         key: "taxPrice", 
         title: "含税单价", 
@@ -570,9 +577,9 @@ export const TabColumns = [
         inputType: "Input",
         disabled:true,
       },
-      { key: "taxDeductMoneya", title: "折扣金额", inputType: "Input", },
-      { key: "arrivalQty", title: "已到货数量", inputType: "Input", },
-      { key: "unarrivedQty", title: "未到货数量", inputType: "Input", },
+      { key: "taxDeductMoneya", title: "折扣金额", inputType: "Input",disabled:true, },
+      { key: "arrivalQty", title: "已到货数量", inputType: "Input", disabled:true,},
+      { key: "unarrivedQty", title: "未到货数量", inputType: "Input", disabled:true,},
       { 
         key: "price",
         title: "无税单价",
@@ -684,14 +691,8 @@ export const TabColumns = [
       { key: "sourceId", title: "上游单据ID", inputType: "Input", width: 180 },
       { key: "demandCode", title: "采购需求单号", inputType: "Input", width: 180 },
       { key: "arrivalDatePlan", title: "计划到货日期", inputType: "Input", width: 180 },
-      {
-        key: "priceType",
-        title: "价格类型",
-        inputType: "Select",
-        referName: "sys_price_type", // 字典名
-        width: 180,
-      },
-      { key: "isDistributionPrice", title: "配送价", inputType: "Input", },
+     
+      { key: "isDistributionPrice", title: "配送价", inputType: "Checkbox", },
      
       { //threeClass
         key: "materialClassifyOneName", 

+ 42 - 12
src/views/purchase/purchase-order/add/index.vue

@@ -244,6 +244,7 @@ export default {
          console.log(isPrice,'isPrice');
           cb();
         } else {
+          this.$message.error('存在必填项未填写');
           console.log('error submit!!');
           return false;
         }
@@ -292,7 +293,8 @@ export default {
       })
     },
     // 主表参照改变之后
-    handleReferChange(val, source, type){
+   async handleReferChange(val, source, type){
+     console.log(val,'val-------------------');
       // 供应商选择  
       if( type === 'SUPPLIER_PARAM' ){
 
@@ -304,7 +306,7 @@ export default {
             key:'supplierContacts',
             params:{
               type:'SUPPLIERCONTACTS_PARAM',
-              supplierId:val.supplier,
+              supplierId:val.id,
             }
           },
           {
@@ -312,13 +314,13 @@ export default {
             key:'supplierPersonal',
             params:{
               type:'PSNLICENSE_PARAM',
-              supplierId:val.supplier,
+              supplierId:val.id,
               pkOrg: source.puOrg,
             }
           }
         ]
 
-        relevanceRefer.forEach(async (refer) =>{
+      await  relevanceRefer.forEach(async (refer) =>{
 
           try {
 
@@ -357,20 +359,43 @@ export default {
 
 
     // 子表参照改变之后
-    handleTabReferChange(val, source, type) {
+   async handleTabReferChange(val, source, type) {
+
+      // 触发物料参照询价   && source.qty && source.qty != ""
+      if (type == "MATERIAL_PARAM") {
+
+        source['qty'] = 0;
+
+        source['whetherCompleteInquiry'] = false;
+
+        source['taxPrice'] = 0;
+
+        source['money'] = 0;
+
+        source['taxDeductMoneya'] = 0;
+
+        source['price'] = 0;
+        
+        source['notaxMoney'] = 0;
+
+        source['tax'] = 0;
+
+        source.isDrug = val.materialMedcine.isDrug  == '0' ? 'Y' : 'N';
+
+        await this.handleGetPrice();
 
-      // 触发物料参照询价
-      if (type == "MATERIAL_PARAM" && source.qty && source.qty != "") {
-        this.handleGetPrice();
       }
 
     },
 
     // 子表下拉框改变
-    handleTabSelectChange(type,row){
-
+    async handleTabSelectChange(type,row){
+     
       if(type == 'priceType' && row.material && row.qty && row.qty != ""){
-        this.handleGetPrice();
+
+        row['whetherCompleteInquiry'] = false;
+
+        await this.handleGetPrice();
       }
     },
 
@@ -378,7 +403,11 @@ export default {
     handleInputChange(row, type) {
       // 物料数量变化----询价
       if (type == "qty" && row.material) {
+
+        row['whetherCompleteInquiry'] = false;
+
         this.handleGetPrice();
+
       }
     },
 
@@ -661,12 +690,13 @@ export default {
                     <el-select
                       v-if="cColumn.inputType === 'Select'"
                       v-model="scope.row[cColumn.key]"
+                      
                       size="mini"
                       :disabled="cColumn.disabled"
                       :clearable="cColumn.clearable"
                       :placeholder="cColumn.placeholder"
                       style="width: 100%"
-                      @change="handleTabSelectChange(cColumn,scope.row)"
+                      @change="handleTabSelectChange(cColumn.key,scope.row)"
                     >
                       <el-option
                         v-for="item in dict.type[cColumn.referName]"

+ 43 - 13
src/views/purchase/purchase-order/edit/index.vue

@@ -76,8 +76,8 @@ export default {
       })
     },
     // 判断属性是否禁用
-   async handleIsForbidden(status) {
-        let { updateColumns, updateTabColumns } = await forbidden(status != '2');
+   async handleIsForbidden(status,source) {
+        let { updateColumns, updateTabColumns } = await forbidden(status != '2',source);
         this.columns = updateColumns;
         this.tabColumns = updateTabColumns;
         this.count++;
@@ -89,7 +89,7 @@ export default {
         const { code, msg, data } = await orderApi.details(prop);
         if (code === 200) {
           this.params = { ...this.params, ...data };
-          this.handleIsForbidden(this.params.status);
+          this.handleIsForbidden(this.params.status,this.params.source);
         }
       } catch (err) {
         //
@@ -131,6 +131,7 @@ export default {
             }
           // 是否完成询价,新增明细行需默认明细为false
           rowData['whetherCompleteInquiry'] = false;
+          rowData['delFlag'] = '0';
 
           this.params[key].push(rowData);
         }
@@ -146,8 +147,11 @@ export default {
       // prop.splice(index, 1);
       for (const key in this.params) {
 
-        if (Array.isArray(this.params[key])) {
-          this.params[key].splice(index, 1);
+        // if (Array.isArray(this.params[key])) {
+        if (key === 'puOrderItemList' || key === 'puOrderExecuteList') {
+
+          this.params[key][index].id ? (this.params[key][index]['delFlag'] = '2') :this.params[key].splice(index, 1);
+
         }
       }
     },
@@ -184,6 +188,7 @@ export default {
           cb();
 
         } else {
+          this.$message.error('存在必填项未填写');
           console.log('error submit!!');
           return false;
         }
@@ -191,6 +196,7 @@ export default {
     },
     // 保存
      handleSava() {
+      console.log(this.params,'this.params---------');
       this.judgeSaveCondition(async()=>{
         try {
             this.loading = true;
@@ -211,17 +217,32 @@ export default {
     beforeOpen() {
     },
     // 子表参照改变之后
-    handleReferChange(val, source, type) {
+    async handleTabReferChange(val, source, type) {
       // 触发物料参照
-      if (type == 'MATERIAL_PARAM' && source.qty && source.qty != '') {
+      if (type == "MATERIAL_PARAM") {
 
-        this.handleGetPrice();
-      }
+        source['qty'] = 0;
+
+        source['whetherCompleteInquiry'] = false;
+        
+        source['taxPrice'] = 0;
+
+        source['money'] = 0;
+
+        source['taxDeductMoneya'] = 0;
+
+        source['price'] = 0;
+        
+        source['notaxMoney'] = 0;
+        
+        source['tax'] = 0;
 
-      if(type == "MATERIAL_PARAM"){
         source.isDrug = val.materialMedcine.isDrug  == '0' ? 'Y' : 'N';
-        // return source;
+        
+        await this.handleGetPrice();
+
       }
+
     },
 
     // 子表Select改变之后
@@ -239,15 +260,24 @@ export default {
      handleTabSelectChange(type,row){
 
       if(type == 'priceType' && row.material && row.qty && row.qty != ""){
+
+        row['whetherCompleteInquiry'] = false;
+
         this.handleGetPrice();
+
       }
     },
     // 子表inputNumber
     handleInputChange(row, type) {
       // 物料数量变化----询价
       if (type == 'qty' && row.material) {
+
+        row['whetherCompleteInquiry'] = false;
+
         this.handleGetPrice();
+
       }
+
     },
     // 子表多选框改变
     handleTabCheckbox(type,source){
@@ -438,7 +468,7 @@ export default {
             :label="column.title" 
             :name="column.key"
             >
-            <el-table :data="params[column.key]" style="width: 100%">
+            <el-table :data="params[column.key].filter(item => item.delFlag === '0')" style="width: 100%">
               <el-table-column label="序号">
                 <template slot-scope="scope">
                   {{ scope.$index + 1 }}
@@ -484,7 +514,7 @@ export default {
                     :data-mapping="cColumn.dataMapping"
                     :query-params="cColumn.queryParams" 
                     size="mini" 
-                    @change="handleReferChange"
+                    @change="handleTabReferChange"
                   ></dr-popover-select>
 
                   <el-select v-if="cColumn.inputType === 'Select'" 

+ 25 - 5
src/views/purchase/purchase-order/edit/initColumn.js

@@ -6,7 +6,8 @@ import deepCopy from "@gby/deep-copy";
 
 export const editColumns = initColumns(Columns);
 
-export const editTabColumns = TabColumns.map((element) => ({
+export const editTabColumns = TabColumns.map((element) => 
+({
   ...element,
   tableColumns: initColumns(element.tableColumns),
 }));
@@ -21,16 +22,35 @@ editTabColumns.forEach(column => {
 
 
 // 禁用项
-export const forbidden = (isEdit) => {
+export const forbidden = (isEdit,source) => {
 
   // let updateColumns = deepCopy(editColumns);
   // let updateTabColumns = deepCopy(editTabColumns);
   let updateColumns = _.cloneDeep(editColumns);
   let updateTabColumns = _.cloneDeep(editTabColumns);
 
-  console.log(isEdit, 'isEdit');
-  
-  if(!isEdit){  
+  console.log(isEdit, 'isEdit',source,'source');
+  if(isEdit){
+    // 编辑
+    // 订单来源为:自动协议直采和协议直采
+    if(source === '1' || source === '2'){
+
+      updateTabColumns.forEach(tab =>{
+
+        tab.tableColumns.forEach(cColumn => {
+
+          if(cColumn.key === 'materialName' || cColumn.key === 'qty'){
+
+            cColumn.disabled = true;
+
+          }
+
+        })
+
+      })
+    }
+  }
+  else{  
 
     console.log('修订');
     // 修订