Browse Source

1.改变供应商后,供应商业务联系人的值未清空

002390 2 years ago
parent
commit
b33d80937c

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

@@ -293,8 +293,10 @@ export default {
       })
     },
     // 主表参照改变之后
-   async handleReferChange(val, source, type){
+   async handleReferChange(val, type, source){
      console.log(val,'val-------------------');
+     console.log(source,'source-------------------');
+     console.log(type,'type-------------------');
       // 供应商选择  
       if( type === 'SUPPLIER_PARAM' ){
 
@@ -359,7 +361,7 @@ export default {
 
 
     // 子表参照改变之后
-   async handleTabReferChange(val, source, type) {
+   async handleTabReferChange(val,  type, source) {
 
       // 触发物料参照询价   && source.qty && source.qty != ""
       if (type == "MATERIAL_PARAM" && source.qty && source.qty != "") {

+ 56 - 2
src/views/purchase/purchase-order/edit/index.vue

@@ -230,9 +230,62 @@ export default {
     },
     beforeOpen() {
     },
+
+     // 主表参照改变之后
+   async handleReferChange(val, type, source){
+      // 供应商选择  
+      if( type === 'SUPPLIER_PARAM' ){
+
+        let page = { pageNum: 1 , pageSize: 10 };
+
+        let relevanceRefer = [
+          {
+            // 供应商联系人
+            key:'supplierContacts',
+            params:{
+              type:'SUPPLIERCONTACTS_PARAM',
+              supplierId:val.id,
+            }
+          },
+          {
+            // 供应商业务员
+            key:'supplierPersonal',
+            params:{
+              type:'PSNLICENSE_PARAM',
+              supplierId:val.id,
+              pkOrg: source.puOrg,
+            }
+          }
+        ]
+
+      await  relevanceRefer.forEach(async (refer) =>{
+
+          try {
+
+            const { code, rows} = await orderApi.REFER(
+              {
+                ...refer.params,
+                search: "",
+                isPage: true,
+              }, page );
+
+            if (code === 200) {
+
+              source[refer.key] = rows[0]? rows[0].id :'';
+
+              source[`${refer.key}Name`] = rows[0] ? rows[0].name :'';
+
+            }
+            
+          } catch (error) {}
+          
+        })
+        
+      }
+    },
     // 子表参照改变之后
-    async handleTabReferChange(val, source, type) {
-      
+    async handleTabReferChange(val, type, source) {
+
       // 触发物料参照
       if (type == "MATERIAL_PARAM" && source.qty && source.qty != "") {
 
@@ -399,6 +452,7 @@ export default {
                 :data-mapping="column.dataMapping"
                 :disabled="column.disabled" 
                 :query-params="column.queryParams"
+                @change="handleReferChange"
                 ></dr-popover-select>
               <el-input v-if="column.inputType === 'Textarea'" 
                 v-model="params[column.key]"