This commit is contained in:
LiJianZhao 2025-05-06 14:54:51 +08:00
parent 3a8c371e9c
commit 227ea607cb
1 changed files with 12 additions and 7 deletions

View File

@ -1,10 +1,10 @@
<template> <template>
<el-input v-model="keyword" style="width:100%;height: 100%" @input="changeInput" :disabled="disabled" <el-input v-model="keyword" style="width:100%;height: 100%" @input="changeInput" :disabled="disabled" @click="changeInput"
placeholder="诊断选择" ref="inputRef"></el-input> placeholder="诊断选择" ref="inputRef"></el-input>
<el-popover placement="bottom-start" trigger="click" :width="props.width" ref="popoverRef" @before-enter="beforeShow" :virtual-ref="inputRef" @hide ="afterShow"> <el-popover placement="bottom-start" trigger="click" :width="props.width" ref="popoverRef" @before-enter="beforeShow" :virtual-ref="inputRef" @hide ="afterShow">
<div class="container" v-if="searchList.length > 0"> <div class="container">
<el-table :data="searchList" style="width: 100%" @row-click="clickRow" :show-header="props.showHeader" size="small" <el-table :data="searchList" style="width: 100%" @row-click="clickRow" :show-header="props.showHeader" size="small"
max-height="250px"> max-height="250px">
<el-table-column v-for="item in showConfig" :prop="item.prop" :label="item.label" <el-table-column v-for="item in showConfig" :prop="item.prop" :label="item.label"
@ -58,8 +58,13 @@ const changeInput = (inputStr: string) => {
if (!props.requestApi || props.requestApi === "") { if (!props.requestApi || props.requestApi === "") {
return return
} }
let tempList = inputStr.split(","); debugger
let searchKeyword = tempList[tempList.length - 1]; let tempList = keyword.value.split(",");
let searchKeyword ="";
if (tempList.length != 0){
searchKeyword = tempList[tempList.length - 1];
}
nameList.value = [] nameList.value = []
selectList.value = selectList.value ? selectList.value.slice(0, tempList.length) : [] selectList.value = selectList.value ? selectList.value.slice(0, tempList.length) : []
let updateKeyword = false let updateKeyword = false
@ -88,9 +93,9 @@ const clickRow = (row: any) => {
popoverRef.value.hide() popoverRef.value.hide()
} }
const beforeShow = () => { const beforeShow = () => {
if (searchList.value.length === 0) { // if (searchList.value.length === 0) {
popoverRef.value.hide() // popoverRef.value.hide()
} // }
} }
const afterShow = () => { const afterShow = () => {
if (nameList.value.length === 0){ if (nameList.value.length === 0){