|
|
|
@ -224,10 +224,13 @@ |
|
|
|
@update:model-value="onPersonSearchInput" |
|
|
|
/> |
|
|
|
<div class="person-picker-body"> |
|
|
|
<div v-if="personSearching" class="person-loading"> |
|
|
|
<van-loading size="18" /> 加载中... |
|
|
|
</div> |
|
|
|
<template v-else> |
|
|
|
<van-list |
|
|
|
v-model:loading="personLoading" |
|
|
|
:finished="personFinished" |
|
|
|
finished-text="" |
|
|
|
:offset="50" |
|
|
|
@load="onPersonLoad" |
|
|
|
> |
|
|
|
<div |
|
|
|
v-for="(user, idx) in personSearchResult" |
|
|
|
:key="user.userId || idx" |
|
|
|
@ -236,12 +239,12 @@ |
|
|
|
> |
|
|
|
<div class="person-item-name">{{ user.fullname || user.userName }}</div> |
|
|
|
<div class="person-item-meta"> |
|
|
|
<span>{{ user.lawCertificateNum || user.phonenumber || user.mobileNumber }}</span> |
|
|
|
<span v-if="user.loginName" class="person-item-login">@{{ user.loginName }}</span> |
|
|
|
<span>{{user.lawCertificateNum?'执法证件号:':'联系电话:'}} {{ user.lawCertificateNum || user.phonenumber || user.mobileNumber }}</span> |
|
|
|
<!-- <span v-if="user.loginName" class="person-item-login">@{{ user.loginName }}</span> --> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<van-empty v-if="!personSearchResult.length" description="未检索到人员" image-size="80" /> |
|
|
|
</template> |
|
|
|
<van-empty v-if="!personLoading && !personSearchResult.length" description="未检索到人员" image-size="80" /> |
|
|
|
</van-list> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</van-popup> |
|
|
|
@ -378,7 +381,10 @@ let enterpriseSearchSeq = 0; |
|
|
|
const showPersonPicker = ref(false); |
|
|
|
const personSearchKeyword = ref(''); |
|
|
|
const personSearchResult = ref([]); |
|
|
|
const personSearching = ref(false); |
|
|
|
const personLoading = ref(false); |
|
|
|
const personFinished = ref(false); |
|
|
|
const personPageNum = ref(1); |
|
|
|
const personPageSize = 10; |
|
|
|
let personSearchTimer = null; |
|
|
|
let personSearchSeq = 0; |
|
|
|
|
|
|
|
@ -519,24 +525,39 @@ const onAddPerson = () => { |
|
|
|
} |
|
|
|
personSearchKeyword.value = ''; |
|
|
|
personSearchResult.value = []; |
|
|
|
personPageNum.value = 1; |
|
|
|
personFinished.value = false; |
|
|
|
personLoading.value = false; |
|
|
|
showPersonPicker.value = true; |
|
|
|
triggerPersonSearch(''); |
|
|
|
// van-list 挂载后自动触发 @load 加载第一页 |
|
|
|
}; |
|
|
|
|
|
|
|
const onPersonSearchInput = (val) => { |
|
|
|
if (personSearchTimer) clearTimeout(personSearchTimer); |
|
|
|
const keyword = (val || '').trim(); |
|
|
|
personSearchTimer = setTimeout(() => triggerPersonSearch(keyword), 300); |
|
|
|
personSearchTimer = setTimeout(() => { |
|
|
|
personPageNum.value = 1; |
|
|
|
personFinished.value = false; |
|
|
|
personSearchResult.value = []; |
|
|
|
personLoading.value = true; |
|
|
|
fetchPersonList(keyword); |
|
|
|
}, 300); |
|
|
|
}; |
|
|
|
|
|
|
|
const triggerPersonSearch = (keyword) => { |
|
|
|
// van-list 触底加载 |
|
|
|
const onPersonLoad = () => { |
|
|
|
fetchPersonList(personSearchKeyword.value.trim()); |
|
|
|
}; |
|
|
|
|
|
|
|
// 实际发起人员检索(分页追加) |
|
|
|
const fetchPersonList = (keyword) => { |
|
|
|
const seq = ++personSearchSeq; |
|
|
|
personSearching.value = true; |
|
|
|
personLoading.value = true; |
|
|
|
searchBureauUnitUsers( |
|
|
|
{ sysDeptId: useCommon.bureauUnitId || '', keyword, globalSearch: false, pageNum: 1, pageSize: 30 }, |
|
|
|
{ sysDeptId: useCommon.bureauUnitId || '', userName: keyword, globalSearch: false, pageNum: personPageNum.value, pageSize: personPageSize, isShowCardId: '0' }, |
|
|
|
(res) => { |
|
|
|
if (seq !== personSearchSeq) return; |
|
|
|
personSearching.value = false; |
|
|
|
personLoading.value = false; |
|
|
|
if (res && res.code === 200 && Array.isArray(res.rows)) { |
|
|
|
let rows = res.rows; |
|
|
|
// 过滤掉已选择的执法人员 |
|
|
|
@ -544,15 +565,26 @@ const triggerPersonSearch = (keyword) => { |
|
|
|
const selectedIds = personList.value.map(p => String(p.id || '')).filter(Boolean); |
|
|
|
rows = rows.filter(item => !selectedIds.includes(String(item.userId || ''))); |
|
|
|
} |
|
|
|
personSearchResult.value = rows; |
|
|
|
if (personPageNum.value === 1) { |
|
|
|
personSearchResult.value = rows; |
|
|
|
} else { |
|
|
|
personSearchResult.value = [...personSearchResult.value, ...rows]; |
|
|
|
} |
|
|
|
const total = res.total || 0; |
|
|
|
if (total <= personPageSize * personPageNum.value) { |
|
|
|
personFinished.value = true; |
|
|
|
} else { |
|
|
|
personPageNum.value++; |
|
|
|
} |
|
|
|
} else { |
|
|
|
personSearchResult.value = []; |
|
|
|
if (personPageNum.value === 1) personSearchResult.value = []; |
|
|
|
personFinished.value = true; |
|
|
|
} |
|
|
|
}, |
|
|
|
() => { |
|
|
|
if (seq !== personSearchSeq) return; |
|
|
|
personSearching.value = false; |
|
|
|
personSearchResult.value = []; |
|
|
|
personLoading.value = false; |
|
|
|
personFinished.value = true; |
|
|
|
} |
|
|
|
); |
|
|
|
}; |
|
|
|
|