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