|
|
|
@ -62,7 +62,7 @@ |
|
|
|
<span class="person-name">{{ person.name }}</span> |
|
|
|
<span class="person-phone">{{ person.phone }}</span> |
|
|
|
<van-icon |
|
|
|
v-if="personList.length > 1" |
|
|
|
v-if="personList.length > 1 && person.phone !== useCommon.phonenumber" |
|
|
|
name="close" |
|
|
|
class="person-remove" |
|
|
|
@click="removePerson(index)" |
|
|
|
@ -287,7 +287,7 @@ import { useRouter, useRoute } from 'vue-router'; |
|
|
|
import { showToast, showSuccessToast, showConfirmDialog } from 'vant'; |
|
|
|
import { addNotice, editNotice, getNoticeDetail } from '@/api/enforcement/notice'; |
|
|
|
import { getPlanList, searchUnionByEnterpriseName, searchBureauUnitUsers, getEnterpriseContactInfo } from '@/api/enforcement/plan'; |
|
|
|
|
|
|
|
import { maskPhone } from '@/util/util'; |
|
|
|
const router = useRouter(); |
|
|
|
const route = useRoute(); |
|
|
|
const { useCommon } = $globalStore; |
|
|
|
@ -402,7 +402,7 @@ onMounted(() => { |
|
|
|
|
|
|
|
const bindCurrentUserAsDefaultPerson = () => { |
|
|
|
const name = useCommon.nickName || useCommon.userName || ''; |
|
|
|
const phone = useCommon.phonenumber || ''; |
|
|
|
const phone = useCommon.lawCertificateNum || maskPhone(useCommon.phonenumber) || ''; |
|
|
|
const id = useCommon.userId || ''; |
|
|
|
if (!name && !id) return; |
|
|
|
personList.value = [{ id, name, phone, code: '' }]; |
|
|
|
@ -534,7 +534,13 @@ const triggerPersonSearch = (keyword) => { |
|
|
|
if (seq !== personSearchSeq) return; |
|
|
|
personSearching.value = false; |
|
|
|
if (res && res.code === 200 && Array.isArray(res.rows)) { |
|
|
|
personSearchResult.value = res.rows; |
|
|
|
let rows = res.rows; |
|
|
|
// 过滤掉已选择的执法人员 |
|
|
|
if (personList.value.length > 0) { |
|
|
|
const selectedIds = personList.value.map(p => String(p.id || '')).filter(Boolean); |
|
|
|
rows = rows.filter(item => !selectedIds.includes(String(item.userId || ''))); |
|
|
|
} |
|
|
|
personSearchResult.value = rows; |
|
|
|
} else { |
|
|
|
personSearchResult.value = []; |
|
|
|
} |
|
|
|
@ -552,17 +558,23 @@ const onSelectPerson = (user) => { |
|
|
|
const exists = personList.value.some(p => String(p.id || '') === uid); |
|
|
|
if (exists) { showToast('该人员已添加'); return; } |
|
|
|
if (personList.value.length >= maxPersonNum) { showToast(`最多只能添加 ${maxPersonNum} 名执法人员`); return; } |
|
|
|
personList.value.push({ id: uid, name: user.fullname || user.userName || '', phone: user.mobileNumber || '', code: '' }); |
|
|
|
personList.value.push({ id: uid, name: user.fullname || user.userName || '', phone: user.lawCertificateNum || maskPhone(user.mobileNumber) || '', code: '' }); |
|
|
|
syncPersonData(); |
|
|
|
showPersonPicker.value = false; |
|
|
|
}; |
|
|
|
|
|
|
|
const removePerson = (index) => { |
|
|
|
const person = personList.value[index]; |
|
|
|
if (person && person.id === useCommon.userId) { |
|
|
|
showToast('本人不可移除'); |
|
|
|
return; |
|
|
|
} |
|
|
|
personList.value.splice(index, 1); |
|
|
|
syncPersonData(); |
|
|
|
}; |
|
|
|
|
|
|
|
const syncPersonData = () => { |
|
|
|
console.log(personList.value); |
|
|
|
form.value.enforceUserNames = personList.value.map(p => p.name).join(','); |
|
|
|
form.value.enforceUserIds = personList.value.map(p => p.id || '').join(','); |
|
|
|
form.value.enforceUserTels = personList.value.map(p => p.phone || '').join(','); |
|
|
|
|