Prechádzať zdrojové kódy

feat:修改地址选择组件更换

snow 1 rok pred
rodič
commit
e82b4b65c1

+ 14 - 11
src/apis/service/serviceParam/storeSet/index.js

@@ -1,19 +1,22 @@
 // 供应商仓库管理-吴广广
 // 供应商仓库管理-吴广广
-import http from "@/apis/axios";
-const api = "admin/";
+import http from '@/apis/axios'
+const api = 'admin/'
 export default {
 export default {
   // 添加
   // 添加
-  add: (data, params) => http(api + "wareadd", data, "post", params),
+  add: (data, params) => http(api + 'wareadd', data, 'post', params),
 
 
   // 分页查询
   // 分页查询
-  list: (data, params) => http(api + "warelist", data, "post", params),
+  list: (data, params) => http(api + 'warelist', data, 'post', params),
   // 详情
   // 详情
-  detail: (data, params) => http(api + "wareinfo", data, "post", params),
+  detail: (data, params) => http(api + 'wareinfo', data, 'post', params),
   // 更新
   // 更新
-  update: (data, params) => http(api + "waresave", data, "post", params),
+  update: (data, params) => http(api + 'waresave', data, 'post', params),
   // 修改状态
   // 修改状态
-  status: (data, params) => http(api + "warestatus", data, "post", params),
-    // 删除
-  delete: (data, params) => http(api + "waredel", data, "post", params),
-};
-   
+  status: (data, params) => http(api + 'warestatus', data, 'post', params),
+  // 删除
+  delete: (data, params) => http(api + 'waredel', data, 'post', params),
+  area: (data, params) => http(api + 'area', data, 'post', params),
+  city: (data, params) => http(api + 'city', data, 'post', params),
+  province: (data, params) => http(api + 'province', data, 'post', params)
+}
+

+ 0 - 6
src/components/addr-add-edit-modal/index.vue

@@ -44,12 +44,6 @@
           :label="type == '1' ? '省市区(系统解析)' : '收货省市区'"
           :label="type == '1' ? '省市区(系统解析)' : '收货省市区'"
           prop="addr_code"
           prop="addr_code"
         >
         >
-          <!-- <select-area
-            :value="ruleForm.addr_code"
-            placeholder="收货省市区"
-            @selectChange="select_area_change($event)"
-          /> -->
-
           <search-area
           <search-area
             :value="ruleForm.areaCode"
             :value="ruleForm.areaCode"
             :is-detail="true"
             :is-detail="true"

+ 55 - 16
src/views/goodStore/goodsCost/components/baseForm.vue

@@ -616,7 +616,7 @@
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
 
 
-          <el-col :span="6">
+          <el-col :span="6" style="padding-bottom:1px">
             <el-form-item label="物流时间" prop="delivery_day">
             <el-form-item label="物流时间" prop="delivery_day">
               <digital-input
               <digital-input
                 :values="ruleForm.delivery_day"
                 :values="ruleForm.delivery_day"
@@ -634,7 +634,7 @@
               />
               />
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
-          <el-col :span="6">
+          <el-col :span="6" style="padding-bottom:1px">
             <el-form-item label="供货周期" prop="lead_time">
             <el-form-item label="供货周期" prop="lead_time">
               <digital-input
               <digital-input
                 :values="ruleForm.lead_time"
                 :values="ruleForm.lead_time"
@@ -652,7 +652,7 @@
               />
               />
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
-          <el-col :span="6">
+          <el-col :span="6" style="padding-bottom:1px">
             <el-form-item label="调样周期" prop="sample_day">
             <el-form-item label="调样周期" prop="sample_day">
               <digital-input
               <digital-input
                 :values="ruleForm.sample_day"
                 :values="ruleForm.sample_day"
@@ -672,25 +672,29 @@
           </el-col>
           </el-col>
           <el-col :span="12">
           <el-col :span="12">
             <el-form-item label="发货地" prop="delivery_place">
             <el-form-item label="发货地" prop="delivery_place">
-              <select-area
-                :placeholder="'发货地'"
-                :value="ruleForm.delivery_place"
-                :is-detail="id !== 'add'"
+              <search-area
+                :value="areaInfo.delivery_place.code"
+                :is-detail="true"
+                size="mini"
                 :disabled="type === 'view' || type === 'editCoin'"
                 :disabled="type === 'view' || type === 'editCoin'"
-                :size="'mini'"
-                @selectChange="selectAreaChange($event, 'delivery_place')"
+                :names="areaInfo.delivery_place.label"
+                placeholder="收货省市区"
+                :level="3"
+                @searchChange="areaChange($event, 'delivery_place')"
               />
               />
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
           <el-col :span="12">
           <el-col :span="12">
             <el-form-item label="产地" prop="origin_place">
             <el-form-item label="产地" prop="origin_place">
-              <select-area
-                :placeholder="'产地'"
-                :value="ruleForm.origin_place"
-                :size="'mini'"
-                :is-detail="id !== 'add'"
+              <search-area
+                :value="areaInfo.origin_place.code"
                 :disabled="type === 'view' || type === 'editCoin'"
                 :disabled="type === 'view' || type === 'editCoin'"
-                @selectChange="selectAreaChange($event, 'origin_place')"
+                :is-detail="true"
+                size="mini"
+                :names="areaInfo.origin_place.label"
+                placeholder="收货省市区"
+                :level="3"
+                @searchChange="areaChange($event, 'origin_place')"
               />
               />
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
@@ -1103,6 +1107,16 @@ export default {
   },
   },
   data() {
   data() {
     return {
     return {
+      areaInfo:{
+        delivery_place:{
+          code:[],
+          label:[]
+        },
+        origin_place:{
+          code:[],
+          label:[]
+        }
+      },
       companyName: '',
       companyName: '',
       spec_tableData: [],
       spec_tableData: [],
       is_support_stock: "",
       is_support_stock: "",
@@ -1792,9 +1806,18 @@ export default {
             stock_moq,
             stock_moq,
             is_support_stock,
             is_support_stock,
           } = this.sitem;
           } = this.sitem;
+
+
+          if(this.type !== 'add'){
+            const {name, area_code} = await this.getArea('delivery_place')
+            this.areaInfo.delivery_place.label = [name]
+            this.areaInfo.delivery_place.code = [area_code]
+            const {name:_name, area_code:_area_code} = await this.getArea('origin_place')
+            this.areaInfo.origin_place.label = [_name]
+            this.areaInfo.origin_place.code = [_area_code]
+          }
           
           
           this.companyName = companyName
           this.companyName = companyName
-
           this.is_support_stock = is_support_stock || "1";
           this.is_support_stock = is_support_stock || "1";
           let cat_id_name = "";
           let cat_id_name = "";
           let cat_id = [];
           let cat_id = [];
@@ -1988,6 +2011,15 @@ export default {
       await this.set_must_spec();
       await this.set_must_spec();
       await this.get_all_fee();
       await this.get_all_fee();
     },
     },
+    async getArea(prop = "delivery_place") {
+      const chunks = this.sitem[prop].split(",");
+      let { data: province } = await asyncRequest.province();
+      province = province.find(({ province_code }) => province_code === chunks[0]);
+      let { data: city } = await asyncRequest.city({ code: chunks[0] });
+      city = city.find(({ city_code }) => city_code === chunks[1]);
+      let { data: area } = await asyncRequest.area({ code: chunks[1] });
+      return area.find(({ area_code }) => area_code === chunks[2]) || {};
+    },
     async set_must_spec() {
     async set_must_spec() {
       const { cat_id } = this.ruleForm;
       const { cat_id } = this.ruleForm;
       let id = cat_id.length == 1 ? cat_id[0] : "";
       let id = cat_id.length == 1 ? cat_id[0] : "";
@@ -2123,6 +2155,13 @@ export default {
       this.$refs.ruleForm.validateField("noble_metal");
       this.$refs.ruleForm.validateField("noble_metal");
       await this.get_all_fee();
       await this.get_all_fee();
     },
     },
+    async areaChange(e,key) {
+      const { code, area_code, label } = e
+      this.ruleForm[key] = code ? code.split(',') : []
+      this.areaInfo[key].code = area_code ? [area_code] : []
+      this.areaInfo[key].label = label ? [label] : []
+      this.$refs.ruleForm.validateField(key)
+    },
     //省市区
     //省市区
     selectAreaChange(e, key) {
     selectAreaChange(e, key) {
       this.ruleForm[key] = e;
       this.ruleForm[key] = e;

+ 62 - 18
src/views/goodStore/supplierGoodsCost/components/baseForm.vue

@@ -619,7 +619,7 @@
           </el-col>
           </el-col>
 
 
           <el-col :span="6">
           <el-col :span="6">
-            <el-form-item label="物流时间" prop="delivery_day">
+            <el-form-item label="物流时间" prop="delivery_day" style="padding-bottom:1px">
               <digital-input
               <digital-input
                 :values="ruleForm.delivery_day"
                 :values="ruleForm.delivery_day"
                 :placeholder="'物流时间'"
                 :placeholder="'物流时间'"
@@ -637,7 +637,7 @@
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
           <el-col :span="6">
           <el-col :span="6">
-            <el-form-item label="供货周期" prop="lead_time">
+            <el-form-item label="供货周期" prop="lead_time" style="padding-bottom:1px">
               <digital-input
               <digital-input
                 :values="ruleForm.lead_time"
                 :values="ruleForm.lead_time"
                 :placeholder="'物流时间'"
                 :placeholder="'物流时间'"
@@ -655,7 +655,7 @@
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
           <el-col :span="6">
           <el-col :span="6">
-            <el-form-item label="调样周期" prop="sample_day">
+            <el-form-item label="调样周期" prop="sample_day" style="padding-bottom:1px">
               <digital-input
               <digital-input
                 :values="ruleForm.sample_day"
                 :values="ruleForm.sample_day"
                 :placeholder="'调样周期'"
                 :placeholder="'调样周期'"
@@ -674,25 +674,29 @@
           </el-col>
           </el-col>
           <el-col :span="12">
           <el-col :span="12">
             <el-form-item label="发货地" prop="delivery_place">
             <el-form-item label="发货地" prop="delivery_place">
-              <select-area
-                :placeholder="'发货地'"
-                :value="ruleForm.delivery_place"
-                :is-detail="id !== 'add'"
+              <search-area
+                :value="areaInfo.delivery_place.code"
+                :is-detail="true"
+                size="mini"
                 :disabled="type === 'view' || type === 'editCoin'"
                 :disabled="type === 'view' || type === 'editCoin'"
-                :size="'mini'"
-                @selectChange="selectAreaChange($event, 'delivery_place')"
+                :names="areaInfo.delivery_place.label"
+                placeholder="收货省市区"
+                :level="3"
+                @searchChange="areaChange($event, 'delivery_place')"
               />
               />
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
           <el-col :span="12">
           <el-col :span="12">
             <el-form-item label="产地" prop="origin_place">
             <el-form-item label="产地" prop="origin_place">
-              <select-area
-                :placeholder="'产地'"
-                :value="ruleForm.origin_place"
-                :size="'mini'"
-                :is-detail="id !== 'add'"
+              <search-area
+                :value="areaInfo.origin_place.code"
                 :disabled="type === 'view' || type === 'editCoin'"
                 :disabled="type === 'view' || type === 'editCoin'"
-                @selectChange="selectAreaChange($event, 'origin_place')"
+                :is-detail="true"
+                size="mini"
+                :names="areaInfo.origin_place.label"
+                placeholder="收货省市区"
+                :level="3"
+                @searchChange="areaChange($event, 'origin_place')"
               />
               />
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
@@ -1104,6 +1108,16 @@ export default {
   },
   },
   data() {
   data() {
     return {
     return {
+      areaInfo:{
+        delivery_place:{
+          code:[],
+          label:[]
+        },
+        origin_place:{
+          code:[],
+          label:[]
+        }
+      },
       spec_tableData: [],
       spec_tableData: [],
       is_support_stock: "",
       is_support_stock: "",
       cat_id_name: "",
       cat_id_name: "",
@@ -1146,6 +1160,22 @@ export default {
     this.$nextTick(() => this.onCompanyChange())  //MARK
     this.$nextTick(() => this.onCompanyChange())  //MARK
   },
   },
   methods: {
   methods: {
+    async getArea(prop = "delivery_place") {
+      const chunks = this.sitem[prop].split(",");
+      let { data: province } = await asyncRequest.province();
+      province = province.find(({ province_code }) => province_code === chunks[0]);
+      let { data: city } = await asyncRequest.city({ code: chunks[0] });
+      city = city.find(({ city_code }) => city_code === chunks[1]);
+      let { data: area } = await asyncRequest.area({ code: chunks[1] });
+      return area.find(({ area_code }) => area_code === chunks[2]) || {};
+    },
+    async areaChange(e,key) {
+      const { code, area_code, label } = e
+      this.ruleForm[key] = code ? code.split(',') : []
+      this.areaInfo[key].code = area_code ? [area_code] : []
+      this.areaInfo[key].label = label ? [label] : []
+      this.$refs.ruleForm.validateField(key)
+    },
     onCompanyChange(){ //MARK
     onCompanyChange(){ //MARK
       // this.ruleForm.supplierNo = this.currentCompany
       // this.ruleForm.supplierNo = this.currentCompany
       this.supplierNosearchChange({code: this.currentCompany})
       this.supplierNosearchChange({code: this.currentCompany})
@@ -1790,6 +1820,17 @@ export default {
             stock_moq,
             stock_moq,
             is_support_stock,
             is_support_stock,
           } = this.sitem;
           } = this.sitem;
+
+
+          if(this.type !== 'add'){
+            const {name, area_code} = await this.getArea('delivery_place')
+            this.areaInfo.delivery_place.label = [name]
+            this.areaInfo.delivery_place.code = [area_code]
+            const {name:_name, area_code:_area_code} = await this.getArea('origin_place')
+            this.areaInfo.origin_place.label = [_name]
+            this.areaInfo.origin_place.code = [_area_code]
+          }
+
           this.is_support_stock = is_support_stock || "1";
           this.is_support_stock = is_support_stock || "1";
           let cat_id_name = "";
           let cat_id_name = "";
           let cat_id = [];
           let cat_id = [];
@@ -1908,8 +1949,11 @@ export default {
           };
           };
         }
         }
 
 
-        this.ruleForm.supplierNo = this.currentCompany
-        this.$refs.ruleForm.validateField('supplierNo');
+        if(this.type === 'add'){
+          this.ruleForm.supplierNo = this.currentCompany
+          this.$refs.ruleForm.validateField('supplierNo');
+        }
+        
         await this.set_must_spec();
         await this.set_must_spec();
       });
       });
     },
     },
@@ -1978,7 +2022,7 @@ export default {
     },
     },
     //商品分类选择
     //商品分类选择
     async goods_class_change(e) {
     async goods_class_change(e) {
-      const { code, is_gold, id, label, cat_desc } = e;
+      const { code, is_gold, id, label, cat_desc, pid } = e;
       this.spec_tableData = []
       this.spec_tableData = []
 
 
       if(is_gold){
       if(is_gold){

+ 0 - 12
src/views/netOrderEntry/netOrderEnter/addEdit-c.vue

@@ -152,18 +152,6 @@
                 </el-form-item>
                 </el-form-item>
               </el-col>
               </el-col>
 
 
-              <!-- <el-col :span="12">
-                <el-form-item label="收货省市区" prop="addr_code" label-width="100px">
-                  <select-area
-                    size="mini"
-                    :value="ruleForm.addr_code"
-                    placeholder="收货省市区"
-                    :disabled="id === '007'"
-                    @selectChange="select_area_change($event)"
-                  />
-                </el-form-item>
-              </el-col> -->
-
               <el-col :span="8">
               <el-col :span="8">
                 <el-form-item label="发货时间" prop="sendtime">
                 <el-form-item label="发货时间" prop="sendtime">
                   <el-date-picker
                   <el-date-picker

+ 0 - 12
src/views/netOrderEntry/netOrderEnter/addEdit.vue

@@ -147,18 +147,6 @@
                 </el-form-item>
                 </el-form-item>
               </el-col>
               </el-col>
 
 
-              <!-- <el-col :span="12">
-                <el-form-item label="收货省市区" prop="addr_code" label-width="100px">
-                  <select-area
-                    size="mini"
-                    :value="ruleForm.addr_code"
-                    placeholder="收货省市区"
-                    :disabled="id === '007'"
-                    @selectChange="select_area_change($event)"
-                  />
-                </el-form-item>
-              </el-col> -->
-
               <el-col :span="8">
               <el-col :span="8">
                 <el-form-item label="发货时间" prop="sendtime">
                 <el-form-item label="发货时间" prop="sendtime">
                   <el-date-picker
                   <el-date-picker

+ 0 - 12
src/views/netOrderEntry/netOrderEnter/detail-modal.vue

@@ -127,18 +127,6 @@
                 </el-form-item>
                 </el-form-item>
               </el-col>
               </el-col>
 
 
-              <!-- <el-col :span="12">
-                <el-form-item label="收货省市区" prop="addr_code" label-width="100px">
-                  <select-area
-                    size="mini"
-                    :value="ruleForm.addr_code"
-                    placeholder="收货省市区"
-                    :disabled="id === '007'"
-                    @selectChange="select_area_change($event)"
-                  />
-                </el-form-item>
-              </el-col> -->
-
               <el-col :span="8">
               <el-col :span="8">
                 <el-form-item label="发货时间" prop="sendtime">
                 <el-form-item label="发货时间" prop="sendtime">
                   <el-date-picker
                   <el-date-picker

+ 0 - 12
src/views/netOrderEntry/prestoreRecordingOrders/addEdit.vue

@@ -147,18 +147,6 @@
                 </el-form-item>
                 </el-form-item>
               </el-col>
               </el-col>
 
 
-              <!-- <el-col :span="12">
-                <el-form-item label="收货省市区" prop="addr_code" label-width="100px">
-                  <select-area
-                    size="mini"
-                    :value="ruleForm.addr_code"
-                    placeholder="收货省市区"
-                    :disabled="id === '007'"
-                    @selectChange="select_area_change($event)"
-                  />
-                </el-form-item>
-              </el-col> -->
-
               <el-col :span="8">
               <el-col :span="8">
                 <el-form-item label="发货时间" prop="sendtime">
                 <el-form-item label="发货时间" prop="sendtime">
                   <el-date-picker
                   <el-date-picker

+ 24 - 7
src/views/orderEntry/orderConfirm/index.vue

@@ -454,12 +454,11 @@
             </div>
             </div>
             <div class="tab-item-main">
             <div class="tab-item-main">
               <el-row class="tab-title">
               <el-row class="tab-title">
-                <el-col :span="4">
+                <el-col :span="4"> 
                   <div style="min-height: 26px; word-break: break-all">&nbsp;</div>
                   <div style="min-height: 26px; word-break: break-all">&nbsp;</div>
                   <div style="min-height: 26px; word-break: break-all">
                   <div style="min-height: 26px; word-break: break-all">
                     {{ importSitem.addr }}
                     {{ importSitem.addr }}
-                  </div></el-col
-                >
+                  </div></el-col>
                 <el-col :span="9">
                 <el-col :span="9">
                   <div style="min-height: 26px; word-break: break-all">
                   <div style="min-height: 26px; word-break: break-all">
                     {{ confirmSitem.addr_name }}&nbsp;
                     {{ confirmSitem.addr_name }}&nbsp;
@@ -472,12 +471,15 @@
                   <el-row>
                   <el-row>
                     <el-col :span="12" class="border">
                     <el-col :span="12" class="border">
                       <el-form-item prop="addr_code">
                       <el-form-item prop="addr_code">
-                        <select-area
-                          :value="ruleForm.addr_code"
-                          :size="'mini'"
+                        <search-area
+                          :value="code"
+                          :is-detail="true"
                           :disabled="!(status + '' === '2' && powers.some((i) => i == '008'))"
                           :disabled="!(status + '' === '2' && powers.some((i) => i == '008'))"
+                          size="mini"
+                          :names="label"
                           placeholder="收货省市区"
                           placeholder="收货省市区"
-                          @selectChange="select_area_change($event)"
+                          :level="3"
+                          @searchChange="areaChange($event)"
                         />
                         />
                       </el-form-item>
                       </el-form-item>
                     </el-col>
                     </el-col>
@@ -806,6 +808,13 @@ export default {
     this.initForm();
     this.initForm();
   },
   },
   methods: {
   methods: {
+    async areaChange(e) {
+      const { code, area_code, label } = e
+      this.ruleForm.addr_code = code ? code.split(',') : []
+      this.code = area_code ? [area_code] : []
+      this.label = label ? [label] : []
+      this.$refs.ruleForm.validateField('addr_code')
+    },
     change_good() {},
     change_good() {},
 
 
     statusActive(status) {
     statusActive(status) {
@@ -876,7 +885,14 @@ export default {
         order_remark,
         order_remark,
         addr,
         addr,
         addr_code,
         addr_code,
+        addr_name,
       } = sitem;
       } = sitem;
+
+      this.label = [addr_name]
+      this.code = addr_code ? [addr_code.split(',')[2]] : []
+
+      console.log(sitem,'------')
+      
       this.ruleForm = {
       this.ruleForm = {
         id: this.queryId || "",
         id: this.queryId || "",
         platform_code: platform_code || "", //平台订单号
         platform_code: platform_code || "", //平台订单号
@@ -929,6 +945,7 @@ export default {
           platform_title,
           platform_title,
           platform_id,
           platform_id,
         } = data;
         } = data;
+        
         this.platform_id = platform_id;
         this.platform_id = platform_id;
         this.sitem = {
         this.sitem = {
           orderCode,
           orderCode,

+ 46 - 14
src/views/purchaseIn/workbench/components/baseForm.vue

@@ -155,24 +155,28 @@
               ></el-input>
               ></el-input>
             </el-form-item>
             </el-form-item>
             <el-form-item label="产地" prop="origin_place">
             <el-form-item label="产地" prop="origin_place">
-              <select-area
-                :placeholder="'产地'"
-                :value="ruleForm.origin_place"
-                :size="'mini'"
-                :disabled="type === 'view'"
-                :is-detail="id !== 'add'"
-                @selectChange="selectAreaorigin_place"
+              <search-area
+                :value="areaInfo.origin_place.code"
+                :disabled="type === 'view' || type === 'editCoin'"
+                :is-detail="true"
+                size="mini"
+                :names="areaInfo.origin_place.label"
+                placeholder="产地"
+                :level="3"
+                @searchChange="areaChange($event, 'origin_place')"
               />
               />
             </el-form-item>
             </el-form-item>
 
 
             <el-form-item label="发货地" prop="delivery_place">
             <el-form-item label="发货地" prop="delivery_place">
-              <select-area
-                :placeholder="'发货地'"
-                :value="ruleForm.delivery_place"
-                :size="'mini'"
-                :disabled="type === 'view'"
-                :is-detail="id !== 'add'"
-                @selectChange="selectAreadelivery_place"
+              <search-area
+                :value="areaInfo.delivery_place.code"
+                :is-detail="true"
+                size="mini"
+                :disabled="type === 'view' || type === 'editCoin'"
+                :names="areaInfo.delivery_place.label"
+                placeholder="发货地"
+                :level="3"
+                @searchChange="areaChange($event, 'delivery_place')"
               />
               />
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
@@ -693,6 +697,16 @@ export default {
 
 
   data() {
   data() {
     return {
     return {
+      areaInfo:{
+        delivery_place:{
+          code:[],
+          label:[]
+        },
+        origin_place:{
+          code:[],
+          label:[]
+        }
+      },
       pid: "",
       pid: "",
       cat_id_name: "",
       cat_id_name: "",
       supplierNo: "",
       supplierNo: "",
@@ -739,6 +753,13 @@ export default {
     this.initForm();
     this.initForm();
   },
   },
   methods: {
   methods: {
+    async areaChange(e,key) {
+      const { code, area_code, label } = e
+      this.ruleForm[key] = code ? code.split(',') : []
+      this.areaInfo[key].code = area_code ? [area_code] : []
+      this.areaInfo[key].label = label ? [label] : []
+      this.$refs.ruleForm.validateField(key)
+    },
     //图片悬浮删除
     //图片悬浮删除
     closeImg(index, key) {
     closeImg(index, key) {
       this.ruleForm[key].splice(index, 1);
       this.ruleForm[key].splice(index, 1);
@@ -829,7 +850,9 @@ export default {
           weight, //	string	重量
           weight, //	string	重量
           supply_area, //	string	供货区域 1 全国2 除偏远地区
           supply_area, //	string	供货区域 1 全国2 除偏远地区
           origin_place, //	string	产地
           origin_place, //	string	产地
+          origin_place_cn, //	string	产地
           delivery_place, // string 发货地
           delivery_place, // string 发货地
+          delivery_place_cn, // string 发货地
           delivery_day, //	string	物流天数
           delivery_day, //	string	物流天数
           expire_day, //	string	信息有效期
           expire_day, //	string	信息有效期
           good_img, //
           good_img, //
@@ -856,6 +879,15 @@ export default {
           supplierName,
           supplierName,
           specinfo,
           specinfo,
         } = JSON.parse(JSON.stringify(data));
         } = JSON.parse(JSON.stringify(data));
+
+        
+        if(this.type !== 'add'){
+          this.areaInfo.origin_place.code =    origin_place ? [origin_place.split(',')[2]] : []
+          this.areaInfo.origin_place.label =   origin_place_cn ? [origin_place_cn] : []
+          this.areaInfo.delivery_place.code =  delivery_place ? [delivery_place.split(',')[2]] : []
+          this.areaInfo.delivery_place.label = delivery_place_cn ? [delivery_place_cn] : []
+        }
+
         if (specinfo && specinfo.length > 0) {
         if (specinfo && specinfo.length > 0) {
           this.spec_tableData = JSON.parse(JSON.stringify(specinfo));
           this.spec_tableData = JSON.parse(JSON.stringify(specinfo));
         }
         }

+ 71 - 13
src/views/serviceParam/storeSet/addEdit.vue

@@ -11,7 +11,7 @@
     element-loading-text="拼命加载中"
     element-loading-text="拼命加载中"
     element-loading-spinner="el-icon-loading"
     element-loading-spinner="el-icon-loading"
     element-loading-background="rgba(0, 0, 0, 0.8)"
     element-loading-background="rgba(0, 0, 0, 0.8)"
-    @close="showModelThis = false"
+    @close="handleClose"
   >
   >
     <el-card style="margin-top: -20px">
     <el-card style="margin-top: -20px">
       <el-row :gutter="10">
       <el-row :gutter="10">
@@ -120,13 +120,15 @@
                   prop="addr_code"
                   prop="addr_code"
                   label-width="140px"
                   label-width="140px"
                 >
                 >
-                  <select-area
-                    :placeholder="'仓库所在省/市/区'"
-                    :value="ruleForm.addr_code"
-                    :is-detail="id !== 'add'"
-                    :size="'mini'"
+                  <search-area
+                    :value="areaInfo.addr_code.code"
                     :disabled="isDetail"
                     :disabled="isDetail"
-                    @selectChange="selectAreaAddr_code"
+                    :is-detail="id !== 'add'"
+                    size="mini"
+                    :names="areaInfo.addr_code.label"
+                    :placeholder="'仓库所在省/市/区'"
+                    :level="3"
+                    @searchChange="areaChange($event, 'addr_code')"
                   />
                   />
                 </el-form-item>
                 </el-form-item>
               </el-col>
               </el-col>
@@ -184,14 +186,17 @@
                   prop="addrs_code"
                   prop="addrs_code"
                   label-width="130px"
                   label-width="130px"
                 >
                 >
-                  <select-area
-                    :is-detail="id !== 'add'"
+                  <search-area
+                    :value="areaInfo.addrs_code.code"
                     :disabled="isDetail"
                     :disabled="isDetail"
-                    :size="'mini'"
-                    :value="ruleForm.addrs_code"
+                    :is-detail="id !== 'add'"
+                    size="mini"
+                    :names="areaInfo.addrs_code.label"
                     :placeholder="'收发货省/市/区'"
                     :placeholder="'收发货省/市/区'"
-                    @selectChange="selectAreaAddrs_code"
-                  /> </el-form-item></el-col>
+                    :level="3"
+                    @searchChange="areaChange($event, 'addrs_code')"
+                  />
+                </el-form-item></el-col>
               <el-col :span="12">
               <el-col :span="12">
                 <el-form-item label="收发货详细地址" prop="wsm_addr" label-width="126px">
                 <el-form-item label="收发货详细地址" prop="wsm_addr" label-width="126px">
                   <el-input
                   <el-input
@@ -275,6 +280,16 @@ export default {
       }
       }
     }
     }
     return {
     return {
+      areaInfo: {
+        addrs_code: {
+          code: [],
+          label: []
+        },
+        addr_code: {
+          code: [],
+          label: []
+        }
+      },
       supplier_name: '',
       supplier_name: '',
       accountNames: '',
       accountNames: '',
       loading: false,
       loading: false,
@@ -415,6 +430,26 @@ export default {
     }
     }
   },
   },
   methods: {
   methods: {
+    handleClose() {
+      this.showModelThis = false
+      this.areaInfo = {
+        addrs_code: {
+          code: [],
+          label: []
+        },
+        addr_code: {
+          code: [],
+          label: []
+        }
+      }
+    },
+    async areaChange(e, key) {
+      const { code, area_code, label } = e
+      this.ruleForm[key] = code ? code.split(',') : []
+      this.areaInfo[key].code = area_code ? [area_code] : []
+      this.areaInfo[key].label = label ? [label] : []
+      this.$refs.ruleForm.validateField(key)
+    },
     // 业务公司选择
     // 业务公司选择
     async companyNosearchChange(e) {
     async companyNosearchChange(e) {
       const { id, code, label } = e
       const { id, code, label } = e
@@ -472,6 +507,19 @@ export default {
       }
       }
       this.loading = false
       this.loading = false
     },
     },
+    async getArea(data, prop = 'addr_code') {
+      const chunks = Object.keys(data[prop]).map(key => data[prop][key])
+      let { data: province } = await asyncRequest.province()
+      province = province.find(({ province_code }) => province_code === chunks[0])
+      let { data: city } = await asyncRequest.city({ code: chunks[0] })
+      city = city.find(({ city_code }) => city_code === chunks[1])
+      const { data: area } = await asyncRequest.area({ code: chunks[1] })
+      const _area = area.find(({ area_code }) => area_code === chunks[2]) || {}
+      return {
+        ..._area,
+        name: [province, city, _area].map(({ name }) => name).join('')
+      }
+    },
     async initData() {
     async initData() {
       const res = await asyncRequest.detail({ id: this.id })
       const res = await asyncRequest.detail({ id: this.id })
       if (res && res.code === 0 && res.data) {
       if (res && res.code === 0 && res.data) {
@@ -495,6 +543,16 @@ export default {
 
 
         this.supplier_name = supplier_name
         this.supplier_name = supplier_name
         this.accountNames = contactor_name
         this.accountNames = contactor_name
+
+        if (this.type !== 'add') {
+          const addrCodeInfo = await this.getArea(res.data)
+          this.areaInfo.addr_code.code = [addrCodeInfo.area_code]
+          this.areaInfo.addr_code.label = [addrCodeInfo.name]
+          const addrsCodeInfo = await this.getArea(res.data, 'addrs_code')
+          this.areaInfo.addrs_code.code = [addrsCodeInfo.area_code]
+          this.areaInfo.addrs_code.label = [addrsCodeInfo.name]
+        }
+
         this.ruleForm = {
         this.ruleForm = {
           companyNo: companyNo || this.business_companyNo || '',
           companyNo: companyNo || this.business_companyNo || '',
           name: name, // 仓库名称
           name: name, // 仓库名称

+ 56 - 14
src/views/supplierPurchaseIn/supplierWorkbench/components/baseForm.vue

@@ -154,24 +154,28 @@
               ></el-input>
               ></el-input>
             </el-form-item>
             </el-form-item>
             <el-form-item label="产地" prop="origin_place">
             <el-form-item label="产地" prop="origin_place">
-              <select-area
-                :placeholder="'产地'"
-                :value="ruleForm.origin_place"
-                :size="'mini'"
-                :disabled="type === 'view'"
-                :is-detail="id !== 'add'"
-                @selectChange="selectAreaorigin_place"
+                <search-area
+                :value="areaInfo.origin_place.code"
+                :disabled="type === 'view' || type === 'editCoin'"
+                :is-detail="true"
+                size="mini"
+                :names="areaInfo.origin_place.label"
+                placeholder="产地"
+                :level="3"
+                @searchChange="areaChange($event, 'origin_place')"
               />
               />
             </el-form-item>
             </el-form-item>
 
 
             <el-form-item label="发货地" prop="delivery_place">
             <el-form-item label="发货地" prop="delivery_place">
-              <select-area
-                :placeholder="'发货地'"
-                :value="ruleForm.delivery_place"
-                :size="'mini'"
-                :disabled="type === 'view'"
-                :is-detail="id !== 'add'"
-                @selectChange="selectAreadelivery_place"
+              <search-area
+                :value="areaInfo.delivery_place.code"
+                :is-detail="true"
+                size="mini"
+                :disabled="type === 'view' || type === 'editCoin'"
+                :names="areaInfo.delivery_place.label"
+                placeholder="发货地"
+                :level="3"
+                @searchChange="areaChange($event, 'delivery_place')"
               />
               />
             </el-form-item>
             </el-form-item>
           </el-col>
           </el-col>
@@ -693,6 +697,16 @@ export default {
 
 
   data() {
   data() {
     return {
     return {
+      areaInfo:{
+        delivery_place:{
+          code:[],
+          label:[]
+        },
+        origin_place:{
+          code:[],
+          label:[]
+        }
+      },
       pid: "",
       pid: "",
       cat_id_name: "",
       cat_id_name: "",
       supplierNo: "",
       supplierNo: "",
@@ -740,6 +754,13 @@ export default {
     this.initForm();
     this.initForm();
   },
   },
   methods: {
   methods: {
+    async areaChange(e, key) {
+      const { code, area_code, label } = e
+      this.ruleForm[key] = code ? code.split(',') : []
+      this.areaInfo[key].code = area_code ? [area_code] : []
+      this.areaInfo[key].label = label ? [label] : []
+      this.$refs.ruleForm.validateField(key)
+    },
     //图片悬浮删除
     //图片悬浮删除
     closeImg(index, key) {
     closeImg(index, key) {
       this.ruleForm[key].splice(index, 1);
       this.ruleForm[key].splice(index, 1);
@@ -761,6 +782,17 @@ export default {
 
 
       if (this.type === "edit" || this.type === "view") {
       if (this.type === "edit" || this.type === "view") {
         await this.initData();
         await this.initData();
+      }else{
+      this.areaInfo = {
+        delivery_place:{
+          code:[],
+          label:[]
+        },
+        origin_place:{
+           code:[],
+           label:[]
+          }
+        }
       }
       }
 
 
       if(this.type === 'add'){
       if(this.type === 'add'){
@@ -836,7 +868,9 @@ export default {
           weight, //	string	重量
           weight, //	string	重量
           supply_area, //	string	供货区域 1 全国2 除偏远地区
           supply_area, //	string	供货区域 1 全国2 除偏远地区
           origin_place, //	string	产地
           origin_place, //	string	产地
+          origin_place_cn, //	string	产地
           delivery_place, // string 发货地
           delivery_place, // string 发货地
+          delivery_place_cn, // string 发货地
           delivery_day, //	string	物流天数
           delivery_day, //	string	物流天数
           expire_day, //	string	信息有效期
           expire_day, //	string	信息有效期
           good_img, //
           good_img, //
@@ -863,6 +897,14 @@ export default {
           supplierName,
           supplierName,
           specinfo,
           specinfo,
         } = JSON.parse(JSON.stringify(data));
         } = JSON.parse(JSON.stringify(data));
+
+        if(this.type !== 'add'){
+          this.areaInfo.origin_place.code =    origin_place ? [origin_place.split(',')[2]] : []
+          this.areaInfo.origin_place.label =   origin_place_cn ? [origin_place_cn] : []
+          this.areaInfo.delivery_place.code =  delivery_place ? [delivery_place.split(',')[2]] : []
+          this.areaInfo.delivery_place.label = delivery_place_cn ? [delivery_place_cn] : []
+        }
+
         if (specinfo && specinfo.length > 0) {
         if (specinfo && specinfo.length > 0) {
           this.spec_tableData = JSON.parse(JSON.stringify(specinfo));
           this.spec_tableData = JSON.parse(JSON.stringify(specinfo));
         }
         }