diff --git a/src/components/AiAreaPicker.vue b/src/components/AiAreaPicker.vue
index 5d7dfb40..00cc9b39 100644
--- a/src/components/AiAreaPicker.vue
+++ b/src/components/AiAreaPicker.vue
@@ -26,9 +26,12 @@ export default {
event: "select"
},
props: {
+ /**
+ * 用于标定最大地区范围地区编码
+ */
areaId: String,
name: {default: ''},
- value: String,
+ value: {default: ''},
all: Boolean,
icon: {default: "location.svg"},
isForm: Boolean,
@@ -36,6 +39,7 @@ export default {
fullName: {default: ''},
disabled: Boolean,
selectRoot: Boolean,
+ multiple: Boolean
},
computed: {
...mapState(['user']),
@@ -57,6 +61,9 @@ export default {
locationIcon() {
return this.$cdn + this.icon
},
+ hasValue() {
+ return this.multiple ? this.value?.length > 0 : !!this.value
+ }
},
data() {
return {
@@ -73,7 +80,7 @@ export default {
v && !this.areaName && this.getAreaName(this.value)
},
fullArea(v) {
- v && this.value && this.$emit('update:fullName', v?.map(e => e.name)?.join("") || "")
+ v && this.value && !this.multiple && this.$emit('update:fullName', v?.map(e => e.name)?.join("") || "")
},
areaName(v) {
v && this.$emit('update:name', v)
@@ -122,20 +129,30 @@ export default {
this.areaName = data.name
this.fullArea = data.fullArea
this.$forceUpdate()
+ } else if (data.length > -1) {
+ this.$emit("select", data)
+ this.areaName = data.length == 0 ? '' : `已选择${data.length}个`
+ this.$forceUpdate()
}
})
- let {value, all, valueLevel, selectRoot, areaId = this.root} = this.$props
+ let {value, all, valueLevel, selectRoot, areaId = this.root} = this.$props,
+ action = "/components/pages/selectArea"
+ if (this.multiple) {
+ action = "/components/pages/multiplyArea"
+ }
let url = qs.stringifyUrl({
- url: "/components/pages/selectArea", query: {...this.$attrs, value, all, valueLevel, selectRoot, areaId}
+ url: action, query: {...this.$attrs, value, all, valueLevel, selectRoot, areaId}
})
uni.navigateTo({url})
}
},
getAreaName(area, name) {
- name ? this.areaName = name : this.getFullArea(area).then(list => {
- let arr = JSON.parse(JSON.stringify(list))
- this.areaName = arr?.reverse()?.[0]?.name
- })
+ name ? this.areaName = name :
+ this.multiple ? this.areaName = !![area].toString() ? `已选择${[area].flat().length}个` : '' :
+ this.getFullArea(area).then(list => {
+ let arr = JSON.parse(JSON.stringify(list))
+ this.areaName = arr?.reverse()?.[0]?.name || ""
+ })
},
}
}
diff --git a/src/components/pages/multiplyArea.vue b/src/components/pages/multiplyArea.vue
new file mode 100644
index 00000000..a5ab24db
--- /dev/null
+++ b/src/components/pages/multiplyArea.vue
@@ -0,0 +1,208 @@
+
+
+
+
+
+
+
diff --git a/src/components/pages/selectGird.vue b/src/components/pages/selectGird.vue
index 2755015e..2640af04 100644
--- a/src/components/pages/selectGird.vue
+++ b/src/components/pages/selectGird.vue
@@ -272,29 +272,6 @@ export default {
}
}
}
-
- .subBtn {
- position: fixed;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 118px;
- background: #f4f8fb;
-
- div {
- width: 192px;
- height: 80px;
- line-height: 80px;
- text-align: center;
- background: #1365dd;
- border-radius: 4px;
- font-size: 32px;
- color: #fff;
- margin: 20px 34px 0 0;
- float: right;
- }
- }
-
.footer {
width: 100%;
height: 118px;