From 5323b3ce03a4306519a442ff072b328a2e474909 Mon Sep 17 00:00:00 2001 From: aixianling Date: Tue, 31 May 2022 15:33:57 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=9C=B0=E5=8C=BA=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=99=A8=E8=BF=BD=E5=8A=A0=E5=A4=9A=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/pages/multiplyArea.vue | 208 ++++++++++++++++++++++++++ src/components/pages/selectGird.vue | 23 --- 2 files changed, 208 insertions(+), 23 deletions(-) create mode 100644 src/components/pages/multiplyArea.vue diff --git a/src/components/pages/multiplyArea.vue b/src/components/pages/multiplyArea.vue new file mode 100644 index 00000000..cdb071d1 --- /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; From 60a70df499428fb1fe79ca9ab2dd20a103067980 Mon Sep 17 00:00:00 2001 From: aixianling Date: Tue, 31 May 2022 15:34:34 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=9C=B0=E5=8C=BA=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=99=A8=E8=BF=BD=E5=8A=A0=E5=A4=9A=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AiAreaPicker.vue | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/components/AiAreaPicker.vue b/src/components/AiAreaPicker.vue index 5d7dfb40..064eff25 100644 --- a/src/components/AiAreaPicker.vue +++ b/src/components/AiAreaPicker.vue @@ -26,6 +26,9 @@ export default { event: "select" }, props: { + /** + * 用于标定最大地区范围地区编码 + */ areaId: String, name: {default: ''}, value: String, @@ -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 || "" + }) }, } } From 58bbe2d5bc565966379be0c3e137f48d1a1995ad Mon Sep 17 00:00:00 2001 From: aixianling Date: Tue, 31 May 2022 15:41:11 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=9C=B0=E5=8C=BA=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=99=A8=E8=BF=BD=E5=8A=A0=E5=A4=9A=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AiAreaPicker.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AiAreaPicker.vue b/src/components/AiAreaPicker.vue index 064eff25..00cc9b39 100644 --- a/src/components/AiAreaPicker.vue +++ b/src/components/AiAreaPicker.vue @@ -31,7 +31,7 @@ export default { */ areaId: String, name: {default: ''}, - value: String, + value: {default: ''}, all: Boolean, icon: {default: "location.svg"}, isForm: Boolean, From 43428029deaf70f3cc1621c1ac0bda0369b3c119 Mon Sep 17 00:00:00 2001 From: aixianling Date: Tue, 31 May 2022 15:49:03 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=BF=87=E6=BB=A4=E7=A9=BA=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/pages/multiplyArea.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/pages/multiplyArea.vue b/src/components/pages/multiplyArea.vue index cdb071d1..a5ab24db 100644 --- a/src/components/pages/multiplyArea.vue +++ b/src/components/pages/multiplyArea.vue @@ -116,7 +116,7 @@ export default { } }, created() { - [this.$route.query.value].flat().map(id => this.$set(this.selected, id, {id})) + [this.$route.query.value].filter(e=>!!e).flat().map(id => this.$set(this.selected, id, {id})) this.getOptionsByRoot() } }