瀏覽代碼

fix: 修复客户编辑省市区显示问题

liuyaqi 2 年之前
父節點
當前提交
bd13509dcf
共有 1 個文件被更改,包括 3 次插入14 次删除
  1. 3 14
      src/views/customer/components/Edit.vue

+ 3 - 14
src/views/customer/components/Edit.vue

@@ -301,20 +301,9 @@
         this.$refs.editForm.resetFields()
       },
       showLocation() {
-        const arr = this.editForm.custLocation.split('/')
-        if (!arr.length) return
-        this.editForm.province = this.provinceOptions.find((item) => item.distName == arr[0])
-        if (arr[1]) {
-          this.editForm.city = this.editForm.province.children.find((item) => item.distName == arr[1])
-        } else {
-          this.editForm.city = {}
-        }
-
-        if (arr[2]) {
-          this.editForm.region = this.editForm.city.children.find((item) => item.distName == arr[2])
-        } else {
-          this.editForm.region = {}
-        }
+        this.editForm.province = this.provinceOptions.find((item) => item.distName == this.editForm.custProvince)
+        this.editForm.city = this.editForm.province.children.find((item) => item.distName == this.editForm.custCity)
+        this.editForm.region = this.editForm.city.children.find((item) => item.distName == this.editForm.custRegion)
       },
       provinceChange(val) {
         this.editForm.city = {}