BUG 28419

This commit is contained in:
aixianling
2022-03-22 09:35:55 +08:00
parent 42df33d265
commit aa6b4ed108

View File

@@ -10,7 +10,7 @@
</div>
<div/>
<span v-if="all" v-text="`省`" @click="selectNode({}, -1)"/>
<span v-for="(area,i) in fullArea.filter(e=>e.type<valueLevel)" :key="area.id"
<span v-for="(area,i) in typeLabels" :key="area.id"
v-text="area.levelLabel" @click="selectNode(area, i)"/>
</div>
</div>
@@ -29,19 +29,16 @@
</template>
<script>
import {mapState} from "vuex";
export default {
name: "selectArea",
appName: "选择地区",
computed: {
...mapState(['user']),
dataRange() {
if (this.all || this.disabled) return 0
return this.getAreaType(this.root)
return this.urlParams.all || this.urlParams.disabled ? 0 : this.getAreaType(this.root)
},
root() {
return this.areaId || this.user.areaId || this.$areaId
return this.areaId || this.$areaId
},
pending() {
return this.list?.map(e => ({...e, levelLabel: this.levelLabels[e.type]})) || []
@@ -51,6 +48,9 @@ export default {
},
hasLastLevelValue() {
return this.fullArea.some(e => e.type >= this.valueLevel)
},
typeLabels() {
return this.fullArea.filter(e => e.type < this.valueLevel)
}
},
data() {
@@ -128,13 +128,14 @@ export default {
if (op.id != this.index) {
this.selected = op
this.index = op.id
let {length} = this.fullArea
if (op.type == this.valueLevel) {
if (this.hasLastLevelValue) {
this.fullArea.splice(this.fullArea.length - 1, 1, op)
this.fullArea.splice(length - 1, 1, op)
} else this.fullArea.push(op)
} else if (op.type < this.valueLevel) {
if (this.hasLastLevelValue) {
this.fullArea.splice(this.fullArea.length - 1, 1)
this.fullArea.splice(length - 1, 1)
} else {
this.fullArea.push(op)
this.getChildAreas(op.id)