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>
<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;"> :class="`showselect-item ${submitVals.regIds.indexOf(sItem.code) > -1?'active':''}`"
<view v-for="(sItem, sIndex) in item.data" @click="selectItemRegion(sItem)">
:class="`showselect-item ${submitVals.regIds.indexOf(sItem.code) > -1?'active':''}`" {{sItem.name}}
@click="selectItemRegion(sItem)"> <view class="chk">
{{sItem.name}} <u-icon name="checkbox-mark" size="32" :bold="true" color="inherit"></u-icon>
<view class="chk">
<u-icon name="checkbox-mark" size="32" :bold="true" color="inherit"></u-icon>
</view>
</view> </view>
</view> </view>
</view> </view>
<view v-if="curShowData.length == 0 && keywords">
<tpx-empty size="sm"></tpx-empty>
</view>
</view> </view>
</template> </template>
@ -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;

View File

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