This commit is contained in:
aihe 2024-07-19 18:24:32 +08:00
parent 4bc2a73210
commit 1c9bf50816

View File

@ -154,19 +154,10 @@
}
}
},
async addEmptyItem(item) {
const list = await this.getListData({
regionType: this.curTabIndex + 1,
parentId: item.code
})
// 选择最后一个tab视图 才做追加
if (list.length > 0 && this.curTabIndex + 1 == this.submitVals.regIds.length) {
async addEmptyItem() {
this.submitVals.regIds.push(undefined)
this.submitVals.regNames.push('请选择')
}
if(list.length > 0) {
this.curTabIndex = this.curTabIndex + 1
}
},
async selectItemRegion(item = {}) {
this.keywords = ''
@ -177,14 +168,22 @@
this.submitVals.regIds.push(item.code)
this.submitVals.regNames.push(item.name)
}
// 选中后切换下一层级视图
const list = await this.getListData({
regionType: this.curTabIndex + 1,
parentId: item.code
})
// 选择最后一个tab视图 才做追加
if (list.length > 0 && this.curTabIndex + 1 == this.submitVals.regIds.length) {
this.addEmptyItem(item)
}
},
handleCloseModal() {
this.$emit('update:show', false)
},
handleSubmitValue() {
const val = this.submitVals
val.regIds = val.regIds.filter(t=> typeof(t) != 'undefined')
val.regNames = val.regNames.filter(t=> t != '请选择')
this.$emit('onSure', val)
this.$emit('update:value', val)
this.handleCloseModal()