<el-autocomplete style="width: 98%;"
size="mini"
v-model="scope.row.Drug.value"
:fetch-suggestions="
(queryString, cb) => {
querySearchAsync(queryString, cb, 1);
}
"
@blur="onInputBlur(scope.row.Drug)"
placeholder="请输入药品名称"
@select="(item) => handleSelect(item, 1, scope.row)"
>
<template slot-scope="{ item }" v-if="item.value.length>20">
<el-tooltip
class="item"
effect="dark"
:content="item.value"
placement="right-end"
>
<div class="query-item-text" style=" width: 98%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap">
{{ item.value }}
</div>
</el-tooltip>
</template>
</el-autocomplete>
querySearchAsync(val, cb, flag) {
var list = [{}];
let params = {
KeyWord: val,
LinkageID: 0,
FunCode: flag,
PageInfo: {
PageIndex: 1,
PageSize: 100,
},
};
Methods.requestData(Api.url.AAA, params)
.then((data) => {
console.log(27777, data);
if (data.StatusCode === 200) {
if (data.Content.length == 0) {
this.SearchList = data.Content
list = data.Content;
}else {
list = data.Content;
}
cb(list);
}
})
.catch((error) => {
console.log(error);
});
},
onInputBlur(val){
console.log(2299, val)
console.log(2299, this.SearchList)
if (this.SearchList.length == 0) {
console.log(3388, val)
val.value = ''
}
console.log(3388, val)
},
handleSelect(item, flag, scope) {
if (flag === 1) {
scope.Drug = item;
scope.ClassName = item.ClassName;
scope.ClassCode = item.ClassCode;
}
},