调整工程目录
This commit is contained in:
@@ -2,21 +2,22 @@
|
||||
<section class="AiAreaPicker">
|
||||
<ai-search-popup mode="bottom" ref="areaSelector">
|
||||
<div slot="btn" @tap="handleInit">
|
||||
<slot v-if="$slots.default" />
|
||||
<slot v-if="$slots.default"/>
|
||||
<div v-else class="areaSelector">
|
||||
<image :src="icon" class="location" />
|
||||
<div v-text="currentArea.name" />
|
||||
<image :src="icon" class="location"/>
|
||||
<div v-text="currentArea.name"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="areaSelector">
|
||||
<div class="fixedTop">
|
||||
<span v-for="(area, i) in fullArea" :key="area.id" v-text="area.name" :class="{ current: area.id == index }" @click="selectNode(area, i)" />
|
||||
<span v-for="(area, i) in fullArea" :key="area.id" v-text="area.name" :class="{ current: area.id == index }"
|
||||
@click="selectNode(area, i)"/>
|
||||
</div>
|
||||
<span v-text="currentArea.name" />
|
||||
<span v-text="currentArea.name"/>
|
||||
</div>
|
||||
<div class="pendingItem flexRow" flex v-for="op in list" :key="op.id">
|
||||
<div class="fill" :class="{ self: index == op.id }" v-html="op.name" @tap="handleSelect(op)" />
|
||||
<u-icon v-if="index != op.id" name="arrow-right" color="#ddd" @click="getChild(op)" />
|
||||
<div class="fill" :class="{ self: index == op.id }" v-html="op.name" @tap="handleSelect(op)"/>
|
||||
<u-icon v-if="index != op.id" name="arrow-right" color="#ddd" @click="getChild(op)"/>
|
||||
</div>
|
||||
</ai-search-popup>
|
||||
</section>
|
||||
@@ -25,21 +26,21 @@
|
||||
<script>
|
||||
import AiSearchPopup from './AiSearchPopup'
|
||||
import AiCell from './AiCell.vue'
|
||||
import { mapState } from 'vuex'
|
||||
import {mapState} from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'AiAreaPicker',
|
||||
components: { AiCell, AiSearchPopup },
|
||||
components: {AiCell, AiSearchPopup},
|
||||
props: {
|
||||
areaId: { default: '' },
|
||||
name: { default: '' },
|
||||
areaId: {default: ''},
|
||||
name: {default: ''},
|
||||
all: Boolean,
|
||||
},
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
dataRange() {
|
||||
let rules = [10, 8, 6, 3, 0],
|
||||
level = 0
|
||||
level = 0
|
||||
if (this.all) return (level = 0)
|
||||
rules.some((e, i) => {
|
||||
let reg = new RegExp(`0{${e}}`, 'g')
|
||||
@@ -58,7 +59,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
fullArea: [{ name: '全国', id: 0 }],
|
||||
fullArea: [{name: '全国', id: 0}],
|
||||
index: '',
|
||||
list: [],
|
||||
}
|
||||
@@ -72,39 +73,39 @@ export default {
|
||||
getFullArea() {
|
||||
let areaId = this.areaId || (this.all ? '' : this.$areaId)
|
||||
areaId &&
|
||||
this.$http
|
||||
.post('/admin/area/getAllParentAreaId', null, {
|
||||
withoutToken: true,
|
||||
params: { areaId },
|
||||
})
|
||||
.then((res) => {
|
||||
if (res?.data) {
|
||||
if (res.data.length > 1) {
|
||||
this.fullArea = res.data.reverse().slice(this.dataRange)
|
||||
} else {
|
||||
this.fullArea = res.data
|
||||
}
|
||||
this.fullArea.unshift({ name: '全国', id: 0 })
|
||||
}
|
||||
})
|
||||
this.$http
|
||||
.post('/admin/area/getAllParentAreaId', null, {
|
||||
withoutToken: true,
|
||||
params: {areaId},
|
||||
})
|
||||
.then((res) => {
|
||||
if (res?.data) {
|
||||
if (res.data.length > 1) {
|
||||
this.fullArea = res.data.reverse().slice(this.dataRange)
|
||||
} else {
|
||||
this.fullArea = res.data
|
||||
}
|
||||
this.fullArea.unshift({name: '全国', id: 0})
|
||||
}
|
||||
})
|
||||
},
|
||||
getChildAreas(id) {
|
||||
id &&
|
||||
this.$http
|
||||
.post('/admin/area/queryAreaByParentId', null, {
|
||||
withoutToken: true,
|
||||
params: { id },
|
||||
})
|
||||
.then((res) => {
|
||||
if (res?.data) {
|
||||
this.list = res.data
|
||||
let self = this.fullArea.find((e) => e.id == this.index)
|
||||
this.list.unshift(self)
|
||||
}
|
||||
})
|
||||
this.$http
|
||||
.post('/admin/area/queryAreaByParentId', null, {
|
||||
withoutToken: true,
|
||||
params: {id},
|
||||
})
|
||||
.then((res) => {
|
||||
if (res?.data) {
|
||||
this.list = res.data
|
||||
let self = this.fullArea.find((e) => e.id == this.index)
|
||||
this.list.unshift(self)
|
||||
}
|
||||
})
|
||||
},
|
||||
getProvinces() {
|
||||
this.$http.post('/admin/area/queryProvinceList', null, { withoutToken: true }).then((res) => {
|
||||
this.$http.post('/admin/area/queryProvinceList', null, {withoutToken: true}).then((res) => {
|
||||
if (res?.data) {
|
||||
this.list = res.data
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user