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