uu
This commit is contained in:
parent
d3a15a5936
commit
770d51c73d
@ -16,11 +16,13 @@
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:body>
|
<template v-slot:body>
|
||||||
|
<view v-if="curList.length > 0" class="mb-10">
|
||||||
|
<tpx-input v-model:value="keywords" isWhite="true" placeholder="请输入关键字"></tpx-input>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="showselect-list">
|
<view class="showselect-list">
|
||||||
<view v-for="(item, index) in curShowData" class="showselect-group">
|
<view>
|
||||||
<view v-if="item.letters" class="pr-20">{{item.letters}}</view>
|
<view v-for="(sItem, sIndex) in curShowData"
|
||||||
<view style="flex: 1;">
|
|
||||||
<view v-for="(sItem, sIndex) in item.data"
|
|
||||||
:class="`showselect-item ${submitVals.regIds.indexOf(sItem.code) > -1?'active':''}`"
|
:class="`showselect-item ${submitVals.regIds.indexOf(sItem.code) > -1?'active':''}`"
|
||||||
@click="selectItemRegion(sItem)">
|
@click="selectItemRegion(sItem)">
|
||||||
{{sItem.name}}
|
{{sItem.name}}
|
||||||
@ -29,6 +31,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view v-if="curShowData.length == 0 && keywords">
|
||||||
|
<tpx-empty size="sm"></tpx-empty>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -60,21 +64,10 @@
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
curShowData() {
|
curShowData() {
|
||||||
const ret = []
|
let ret = this.curList || []
|
||||||
let letterMap = {}
|
if(this.keywords) {
|
||||||
this.curList.map(t => {
|
ret = ret?.filter?.(t=> t.name?.indexOf(this.keywords) > -1)
|
||||||
const firstUpCase = (t.nameEn || '').toLocaleUpperCase()[0]
|
|
||||||
if (!letterMap[firstUpCase]) {
|
|
||||||
letterMap[firstUpCase] = []
|
|
||||||
}
|
}
|
||||||
letterMap[firstUpCase].push(t)
|
|
||||||
})
|
|
||||||
Object.keys(letterMap).sort((a, b) => a - b > 0).map((key) => {
|
|
||||||
ret.push({
|
|
||||||
letters: key,
|
|
||||||
data: letterMap[key]
|
|
||||||
})
|
|
||||||
})
|
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -96,6 +89,7 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
curTabIndex: 0,
|
curTabIndex: 0,
|
||||||
|
keywords: '',
|
||||||
curCountryList: [], // { id , name, nameEn }
|
curCountryList: [], // { id , name, nameEn }
|
||||||
curList: [], // { id , name, nameEn }
|
curList: [], // { id , name, nameEn }
|
||||||
submitVals: {
|
submitVals: {
|
||||||
@ -144,6 +138,7 @@
|
|||||||
return list
|
return list
|
||||||
},
|
},
|
||||||
changeCurTab(index) {
|
changeCurTab(index) {
|
||||||
|
this.keywords = ''
|
||||||
this.curTabIndex = index
|
this.curTabIndex = index
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
// 国家特殊处理
|
// 国家特殊处理
|
||||||
@ -174,6 +169,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async selectItemRegion(item = {}) {
|
async selectItemRegion(item = {}) {
|
||||||
|
this.keywords = ''
|
||||||
// 选择数据变化,需清除下所有层级选中数据
|
// 选择数据变化,需清除下所有层级选中数据
|
||||||
if (item.code != this.submitVals.regIds[this.curTabIndex]) {
|
if (item.code != this.submitVals.regIds[this.curTabIndex]) {
|
||||||
this.submitVals.regIds.length = this.curTabIndex
|
this.submitVals.regIds.length = this.curTabIndex
|
||||||
@ -249,10 +245,6 @@
|
|||||||
|
|
||||||
.showselect-list {}
|
.showselect-list {}
|
||||||
|
|
||||||
.showselect-group {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.showselect-item {
|
.showselect-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@ -99,7 +99,7 @@
|
|||||||
{ ...dealBtnMap.baoJiaShiSuan },
|
{ ...dealBtnMap.baoJiaShiSuan },
|
||||||
{ ...dealBtnMap.wenTiJian },
|
{ ...dealBtnMap.wenTiJian },
|
||||||
{ ...dealBtnMap.mianDanDayin },
|
{ ...dealBtnMap.mianDanDayin },
|
||||||
{ ...dealBtnMap.shuiFeiYuGu }
|
// { ...dealBtnMap.shuiFeiYuGu }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user