BUG 29320

This commit is contained in:
aixianling
2022-04-29 19:26:41 +08:00
parent 6e5038e4c7
commit b12ae2c588
2 changed files with 18 additions and 8 deletions

View File

@@ -121,8 +121,7 @@
<span>现住址</span> <span>现住址</span>
</div> </div>
<div class="right"> <div class="right">
<!-- :areaId="user.areaId" v-model="form.currentAreaId"--> <AiAreaPicker :fullName.sync="form.currentAreaName" v-model="form.currentAreaId">
<AiAreaPicker :fullName.sync="form.currentAreaName" v-model="form.currentAreaId" :root="user.areaId">
<AiMore v-model="form.currentAreaName"/> <AiMore v-model="form.currentAreaName"/>
</AiAreaPicker> </AiAreaPicker>
</div> </div>

View File

@@ -26,7 +26,7 @@ export default {
event: "select" event: "select"
}, },
props: { props: {
areaId: {default: ''}, areaId: String,
name: {default: ''}, name: {default: ''},
value: String, value: String,
all: Boolean, all: Boolean,
@@ -52,7 +52,7 @@ export default {
return level return level
}, },
root() { root() {
return this.areaId || this.user.areaId || this.$areaId return this.areaId || this.rootArea
}, },
locationIcon() { locationIcon() {
return this.$cdn + this.icon return this.$cdn + this.icon
@@ -61,7 +61,8 @@ export default {
data() { data() {
return { return {
fullArea: [], fullArea: [],
areaName: "" areaName: "",
rootArea: ""
} }
}, },
watch: { watch: {
@@ -72,16 +73,27 @@ export default {
v && !this.areaName && this.getAreaName(this.value) v && !this.areaName && this.getAreaName(this.value)
}, },
fullArea(v) { fullArea(v) {
v && this.$emit('update:fullName', v?.map(e => e.name)?.join("") || "") v && this.value && this.$emit('update:fullName', v?.map(e => e.name)?.join("") || "")
}, },
areaName(v) { areaName(v) {
v && this.$emit('update:name', v) v && this.$emit('update:name', v)
} }
}, },
created() { created() {
this.getRootArea()
this.value && this.getAreaName(this.value) this.value && this.getAreaName(this.value)
}, },
methods: { methods: {
getRootArea() {
if (uni.getStorageSync("rootArea")) {
this.rootArea = uni.getStorageSync("rootArea")
} else this.$http.post("/app/appdvcpconfig/getCorpArea", null, {}).then(res => {
if (res?.data) {
this.rootArea = res.data
uni.setStorageSync("rootArea", res.data)
}
})
},
getInfo(areaId) { getInfo(areaId) {
return areaId && this.$http.post('/admin/area/getAllParentAreaId', null, { return areaId && this.$http.post('/admin/area/getAllParentAreaId', null, {
withoutToken: true, withoutToken: true,
@@ -111,9 +123,8 @@ export default {
this.fullArea = data.fullArea this.fullArea = data.fullArea
this.$forceUpdate() this.$forceUpdate()
} }
}) })
let {value, all, valueLevel, selectRoot, areaId} = this.$props let {value, all, valueLevel, selectRoot, areaId = this.root} = this.$props
let url = qs.stringifyUrl({ let url = qs.stringifyUrl({
url: "/components/pages/selectArea", query: {...this.$attrs, value, all, valueLevel, selectRoot, areaId} url: "/components/pages/selectArea", query: {...this.$attrs, value, all, valueLevel, selectRoot, areaId}
}) })