远程搜索修改问题

dev-scheduling
zhangdi 1 month ago
parent 53333d01e4
commit d3aea85ae0
  1. 41
      src/components/jh-select/index.vue
  2. 4
      src/views/flowManagement/addDialog.vue

@ -52,10 +52,10 @@ export default {
type: String, type: String,
default: '', // id default: '', // id
}, },
title: { title:{
type: String, type: String,
default: '新增', default: '新增'
}, }
}, },
data() { data() {
return { return {
@ -69,7 +69,6 @@ export default {
dropdownVisible: false, dropdownVisible: false,
bindTimer: null, bindTimer: null,
total: 0, total: 0,
isSearching: false, //
}; };
}, },
watch: { watch: {
@ -101,14 +100,7 @@ export default {
let timeout = null; let timeout = null;
return (...args) => { return (...args) => {
clearTimeout(timeout); clearTimeout(timeout);
// / timeout = setTimeout(() => func.apply(this, args), wait);
const validArgs = args
.map(arg => {
if (arg && arg.target) return arg.target.value; //
return arg;
})
.filter(arg => arg != null);
timeout = setTimeout(() => func.apply(this, validArgs), wait);
}; };
}, },
@ -180,25 +172,7 @@ export default {
}, },
handleSearch(val) { handleSearch(val) {
// this.searchText = val;
let searchVal = '';
// InputEvent
if (val && typeof val === 'object' && val.target) {
searchVal = (val.target.value || '').trim();
}
//
else {
searchVal = String(val || '').trim();
}
//
this.searchText = searchVal;
this.localValue = searchVal;
//
this.isSearching = true;
this.reset(); this.reset();
this.debounceSearch(); this.debounceSearch();
}, },
@ -236,7 +210,7 @@ export default {
// //
async getEchoData(val) { async getEchoData(val) {
try { try {
const params = { [this.echoParamsKey]: val == null ? '' : val }; const params = { [this.echoParamsKey]: val==null?'':val };
let res; let res;
if (this.echoMethod.toLowerCase() === 'post') { if (this.echoMethod.toLowerCase() === 'post') {
res = await axios.post(this.echoApi, params); res = await axios.post(this.echoApi, params);
@ -255,10 +229,9 @@ export default {
}, },
async initEcho() { async initEcho() {
if (this.isSearching || this.searchText) return;
const val = this.localValue; const val = this.localValue;
// (!val || !this.echoApi)&& // (!val || !this.echoApi)&&
if (this.title === '新增' || !val) return; if (this.title=='新增') return;
// //
if (this.multiple && Array.isArray(val)) { if (this.multiple && Array.isArray(val)) {

@ -91,7 +91,6 @@
<el-form-item label="项目负责人:" prop="projectHeadId"> <el-form-item label="项目负责人:" prop="projectHeadId">
<jhSelect <jhSelect
:value="addForm.projectHeadId" :value="addForm.projectHeadId"
@input="val => (addForm.projectHeadId = val)"
placeholder="请搜索选择" placeholder="请搜索选择"
api-url="/blade-system/user/page" api-url="/blade-system/user/page"
echo-api="/blade-system/user/page" echo-api="/blade-system/user/page"
@ -114,7 +113,6 @@
<el-form-item label="成员名称:" prop="memberName"> <el-form-item label="成员名称:" prop="memberName">
<jhSelect <jhSelect
:value="addForm.memberName" :value="addForm.memberName"
@input="val => (addForm.memberName = val)"
placeholder="请搜索选择" placeholder="请搜索选择"
api-url="/blade-system/user/page" api-url="/blade-system/user/page"
echo-api="/blade-system/user/page" echo-api="/blade-system/user/page"
@ -138,7 +136,6 @@
<el-form-item label="项目支持人:" prop="projectSupportMan"> <el-form-item label="项目支持人:" prop="projectSupportMan">
<jhSelect <jhSelect
:value="addForm.projectSupportMan" :value="addForm.projectSupportMan"
@input="val => (addForm.projectSupportMan = val)"
placeholder="请搜索选择" placeholder="请搜索选择"
api-url="/blade-system/user/page" api-url="/blade-system/user/page"
echo-api="/blade-system/user/page" echo-api="/blade-system/user/page"
@ -248,7 +245,6 @@
> >
<jhSelect <jhSelect
:value="scope.row.milestoneMemo" :value="scope.row.milestoneMemo"
@input="val => (scope.row.milestoneMemo = val)"
placeholder="请搜索选择" placeholder="请搜索选择"
api-url="/blade-system/user/page" api-url="/blade-system/user/page"
echo-api="/blade-system/user/page" echo-api="/blade-system/user/page"

Loading…
Cancel
Save