This commit is contained in:
aihe 2024-05-29 17:01:58 +08:00
parent d3a15a5936
commit 770d51c73d
2 changed files with 22 additions and 30 deletions

View File

@ -16,20 +16,24 @@
</template>
<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 v-for="(item, index) in curShowData" class="showselect-group">
<view v-if="item.letters" class="pr-20">{{item.letters}}</view>
<view style="flex: 1;">
<view v-for="(sItem, sIndex) in item.data"
:class="`showselect-item ${submitVals.regIds.indexOf(sItem.code) > -1?'active':''}`"
@click="selectItemRegion(sItem)">
{{sItem.name}}
<view class="chk">
<u-icon name="checkbox-mark" size="32" :bold="true" color="inherit"></u-icon>
</view>
<view>
<view v-for="(sItem, sIndex) in curShowData"
:class="`showselect-item ${submitVals.regIds.indexOf(sItem.code) > -1?'active':''}`"
@click="selectItemRegion(sItem)">
{{sItem.name}}
<view class="chk">
<u-icon name="checkbox-mark" size="32" :bold="true" color="inherit"></u-icon>
</view>
</view>
</view>
<view v-if="curShowData.length == 0 && keywords">
<tpx-empty size="sm"></tpx-empty>
</view>
</view>
</template>
@ -60,21 +64,10 @@
},
computed: {
curShowData() {
const ret = []
let letterMap = {}
this.curList.map(t => {
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]
})
})
let ret = this.curList || []
if(this.keywords) {
ret = ret?.filter?.(t=> t.name?.indexOf(this.keywords) > -1)
}
return ret
}
},
@ -96,6 +89,7 @@
data() {
return {
curTabIndex: 0,
keywords: '',
curCountryList: [], // { id , name, nameEn }
curList: [], // { id , name, nameEn }
submitVals: {
@ -144,6 +138,7 @@
return list
},
changeCurTab(index) {
this.keywords = ''
this.curTabIndex = index
if (index == 0) {
// 国家特殊处理
@ -174,6 +169,7 @@
}
},
async selectItemRegion(item = {}) {
this.keywords = ''
// 选择数据变化,需清除下所有层级选中数据
if (item.code != this.submitVals.regIds[this.curTabIndex]) {
this.submitVals.regIds.length = this.curTabIndex
@ -249,10 +245,6 @@
.showselect-list {}
.showselect-group {
display: flex;
}
.showselect-item {
display: flex;
align-items: center;

View File

@ -99,7 +99,7 @@
{ ...dealBtnMap.baoJiaShiSuan },
{ ...dealBtnMap.wenTiJian },
{ ...dealBtnMap.mianDanDayin },
{ ...dealBtnMap.shuiFeiYuGu }
// { ...dealBtnMap.shuiFeiYuGu }
]
}
},