uu
This commit is contained in:
parent
b3c11a43a4
commit
647c1dd0fd
@ -3,7 +3,6 @@
|
||||
<view style="position: relative;height: calc(75vh);">
|
||||
<tpx-layout>
|
||||
<template v-slot:header>
|
||||
|
||||
<view class="stp-list">
|
||||
<view v-for="(item, index) in submitVals.regNames"
|
||||
:class="`stp-item ${curTabIndex == index?'active':''}`" @click="changeCurTab(index)">
|
||||
@ -124,14 +123,14 @@
|
||||
}
|
||||
},
|
||||
async getListData({
|
||||
parentId
|
||||
parentId, regionType
|
||||
} = {}) {
|
||||
let countryId = this.submitVals.regIds[0] // 最外层是国家id
|
||||
if (parentId == countryId) {
|
||||
parentId = undefined
|
||||
}
|
||||
const res = await apiService.getEmisRegion({
|
||||
regionType: this.curTabIndex + 1, // 必填
|
||||
regionType, // 必填
|
||||
parentCode: parentId,
|
||||
countryCode: countryId,
|
||||
})
|
||||
@ -141,31 +140,38 @@
|
||||
t.nameEn = t.regionNameEn
|
||||
t.code = t.code || t.regionCode
|
||||
})
|
||||
if (list.length > 0) {
|
||||
this.curList = list
|
||||
}
|
||||
this.curList = list
|
||||
return list
|
||||
},
|
||||
changeCurTab(index) {
|
||||
this.curTabIndex = index
|
||||
if (index == 0) {
|
||||
// 国家特殊处理
|
||||
this.curList = this.curCountryList
|
||||
} else {
|
||||
let parentId = this.submitVals.regIds[index]
|
||||
this.getListData({
|
||||
parentId
|
||||
})
|
||||
let parentId = this.submitVals.regIds[index-1]
|
||||
// 有父级code的才做刷新列表视图
|
||||
if(parentId) {
|
||||
this.getListData({
|
||||
regionType: this.curTabIndex,
|
||||
parentId
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
async addEmptyItem(item) {
|
||||
const list = await this.getListData({
|
||||
regionType: this.curTabIndex + 1,
|
||||
parentId: item.code
|
||||
})
|
||||
if (list.length > 0) {
|
||||
this.curTabIndex = this.curTabIndex + 1
|
||||
this.submitVals.regIds.push()
|
||||
// 选择最后一个tab视图 才做追加
|
||||
if (list.length > 0 && this.curTabIndex + 1 == this.submitVals.regIds.length) {
|
||||
this.submitVals.regIds.push(undefined)
|
||||
this.submitVals.regNames.push('请选择')
|
||||
}
|
||||
if(list.length > 0) {
|
||||
this.curTabIndex = this.curTabIndex + 1
|
||||
}
|
||||
},
|
||||
async selectItemRegion(item = {}) {
|
||||
// 选择数据变化,需清除下所有层级选中数据
|
||||
|
||||
Loading…
Reference in New Issue
Block a user