网格管理
This commit is contained in:
@@ -4,18 +4,18 @@
|
||||
<div slot="btn" @tap="handleInit">
|
||||
<slot v-if="$slots.default" />
|
||||
<div v-else class="areaSelector">
|
||||
<u-input v-model="currentSelected.name" disabled class="noEvents" />
|
||||
<u-input v-model="currentSelected.girdName" disabled class="noEvents" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="areaSelector">
|
||||
<div class="fixedTop">
|
||||
<span v-text="'全部'" :class="{ current: !index }" @click="selectNode({}, -1)" />
|
||||
<span v-for="(area, i) in fullSelected" :key="area.id" v-text="area.name" :class="{ current: area.id == index }" @click="selectNode(area, i)" />
|
||||
<span v-for="(area, i) in fullSelected" :key="area.id" v-text="area.girdName" :class="{ current: area.id == index }" @click="selectNode(area, i)" />
|
||||
</div>
|
||||
<span class="placeholder" v-text="currentSelected.name" />
|
||||
<span class="placeholder" v-text="currentSelected.girdName" />
|
||||
</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)" />
|
||||
<div class="fill" :class="{ self: index == op.id }" v-html="op.girdName" @tap="handleSelect(op)" />
|
||||
<u-icon v-if="showArrow(op)" name="arrow-right" color="#ddd" @click="getChild(op)" />
|
||||
</div>
|
||||
</AiSearchPopup>
|
||||
@@ -51,8 +51,8 @@ export default {
|
||||
while (meta.length > 0) {
|
||||
let p = meta.shift()
|
||||
origin.push(p)
|
||||
if (p.children?.length > 0) {
|
||||
meta.push(p.children.map((c) => ({ ...c, parent: p.id })))
|
||||
if (p.girdList?.length > 0) {
|
||||
meta.push(p.girdList.map((c) => ({ ...c, parent: p.id })))
|
||||
}
|
||||
}
|
||||
return origin.flat()
|
||||
@@ -82,12 +82,12 @@ export default {
|
||||
this.fullSelected = pend.reverse()
|
||||
}
|
||||
},
|
||||
getChildren(id) {
|
||||
if (id) this.list = this.origin?.find((e) => e.id == id)?.children || []
|
||||
getgirdList(id) {
|
||||
if (id) this.list = this.origin?.find((e) => e.id == id)?.girdList || []
|
||||
else this.list = this.ops
|
||||
},
|
||||
handleSelect(op) {
|
||||
if (op.children?.length > 0) {
|
||||
if (op.girdList?.length > 0) {
|
||||
this.getChild(op)
|
||||
} else {
|
||||
if (op.id != this.index) {
|
||||
@@ -102,21 +102,21 @@ export default {
|
||||
getChild(op) {
|
||||
this.fullSelected.push(op)
|
||||
this.index = op.id
|
||||
this.getChildren(op.id)
|
||||
this.getgirdList(op.id)
|
||||
},
|
||||
selectNode(item, i) {
|
||||
this.fullSelected.splice(i + 1, this.fullSelected.length - i)
|
||||
if (item.children?.length <= 0) {
|
||||
if (item.girdList?.length <= 0) {
|
||||
this.index = item.id
|
||||
}
|
||||
this.getChildren(item.id)
|
||||
this.getgirdList(item.id)
|
||||
},
|
||||
handleInit() {
|
||||
this.index = this.currentSelected.id
|
||||
this.getChildren(this.currentSelected.id)
|
||||
this.getgirdList(this.currentSelected.id)
|
||||
},
|
||||
showArrow(op) {
|
||||
return this.index != op.id && op.children?.length > 0
|
||||
return this.index != op.id && op.girdList?.length > 0
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
||||
Reference in New Issue
Block a user