From b9686c7739bf131922005e86128ba9232c0313ac Mon Sep 17 00:00:00 2001 From: wangting <wangting@vci-tech.com> Date: 星期二, 17 十二月 2024 17:55:56 +0800 Subject: [PATCH] 图标管理 --- Source/plt-web/plt-web-ui/src/components/PLT-basic-component/input-icon.vue | 42 ++++++++++++++++++++++++++++++++++++------ 1 files changed, 36 insertions(+), 6 deletions(-) diff --git a/Source/plt-web/plt-web-ui/src/components/PLT-basic-component/input-icon.vue b/Source/plt-web/plt-web-ui/src/components/PLT-basic-component/input-icon.vue index 2617ce8..cd445af 100644 --- a/Source/plt-web/plt-web-ui/src/components/PLT-basic-component/input-icon.vue +++ b/Source/plt-web/plt-web-ui/src/components/PLT-basic-component/input-icon.vue @@ -23,7 +23,7 @@ {{ item }} </el-tag> </div> - <avue-input v-model="searchText" placeholder="鏌ヨ" size="mini" prefixIcon="el-icon-search" style="width: 300px;max-width: 30%"></avue-input> + <avue-input v-model="searchText" @change="handleSearch" placeholder="鏌ヨ" size="mini" prefixIcon="el-icon-search" style="width: 300px;max-width: 30%"></avue-input> </div> <div style="height: 60vh"> <el-tabs v-model="activeName" @tab-click="handleTabClick"> @@ -84,6 +84,7 @@ searchText:'', activeName:'', svgHtml:'', + allIconList:[], iconList:[] } }, @@ -100,23 +101,25 @@ } else { this.iconList = getStore({ name:'icons'}); } + this.allIconList=this.iconList; if(this.iconList && this.iconList.length>0){ this.activeName=this.iconList[0].label; }else { - getIcons().then(res => { + /*getIcons().then(res => { this.iconList=res.data.data; + this.allIconList=this.iconList; store.dispatch("setIcons", this.iconList); if(this.iconList&&this.iconList.length>0) { this.activeName=this.iconList[0].label; } - }) + })*/ } }, methods:{ dialogClose() { this.visible = false; }, - handleFocus() {debugger; + handleFocus() { if (!this.disabled) { if(this.iconList&&this.iconList.length>0) { this.activeName=this.iconList[0].label; @@ -126,16 +129,18 @@ } else { this.iconList = getStore({ name:'icons'}); } + this.allIconList=this.iconList; if(this.iconList && this.iconList.length>0){ this.activeName=this.iconList[0].label; }else { - getIcons().then(res => { + /*getIcons().then(res => { this.iconList=res.data.data; + this.allIconList=this.iconList; store.dispatch("setIcons", this.iconList); if(this.iconList&&this.iconList.length>0) { this.activeName=this.iconList[0].label; } - }) + })*/ } } this.visible = true; @@ -148,10 +153,35 @@ }else { this.checkedTypes.push(type) } + //鎸夌収鍒嗙被杩囨护鍥炬爣 + if(this.checkedTypes.length==0){ + this.iconList=this.allIconList + }else{ + this.iconList=this.allIconList.filter(item=> { + return this.checkedTypes.includes(item.type); + }) + } + this.activeName=this.iconList[0].label; }, handleTabClick(tab, event){ }, + handleSearch(data){ + if(data.value==''){ + this.iconList=this.allIconList; + } + let iconList=[] + this.allIconList.forEach(item=> { + iconList.push({ + label:item.label, + type:item.type, + list: item.list.filter(iconItem=>{ + return iconItem.name.replace(item.label,'').indexOf(data.value)!=-1; + }) + }) + }) + this.iconList=iconList; + }, clearValue(){ this.svgHtml=''; this.$emit('input','') -- Gitblit v1.9.3