|
|
@ -7,7 +7,7 @@ |
|
|
</div> --> |
|
|
</div> --> |
|
|
|
|
|
|
|
|
<!-- 表单主体 --> |
|
|
<!-- 表单主体 --> |
|
|
<van-form @submit="onSubmit" scroll-to-error class="page-content"> |
|
|
<van-form ref="formRef" @submit="onSubmit" scroll-to-error class="page-content"> |
|
|
<!-- 企业信息组件 --> |
|
|
<!-- 企业信息组件 --> |
|
|
<EnterpriseInfoSection :enterprise-data="enterpriseData" :is-sign-mode="isSignMode" |
|
|
<EnterpriseInfoSection :enterprise-data="enterpriseData" :is-sign-mode="isSignMode" |
|
|
@open-picker="showPopups.enterprise = true" /> |
|
|
@open-picker="showPopups.enterprise = true" /> |
|
|
@ -54,6 +54,7 @@ import { ref, reactive, computed, onMounted } from 'vue'; |
|
|
import { useRouter, useRoute } from 'vue-router'; |
|
|
import { useRouter, useRoute } from 'vue-router'; |
|
|
import { showConfirmDialog, showSuccessToast, showToast } from 'vant'; |
|
|
import { showConfirmDialog, showSuccessToast, showToast } from 'vant'; |
|
|
import { loadDict } from '@/util/dictUtil'; |
|
|
import { loadDict } from '@/util/dictUtil'; |
|
|
|
|
|
import { maskPhone } from '@/util/util'; |
|
|
import { saveEnfRegistration, submitEnfRegistration, addNonRegistration, getEnforcementRegistrationDetailById, getSystemConfig } from '@/api/enforcement/index'; |
|
|
import { saveEnfRegistration, submitEnfRegistration, addNonRegistration, getEnforcementRegistrationDetailById, getSystemConfig } from '@/api/enforcement/index'; |
|
|
import EnterpriseInfoSection from '@/components/enforcement/register/EnterpriseInfoSection.vue'; |
|
|
import EnterpriseInfoSection from '@/components/enforcement/register/EnterpriseInfoSection.vue'; |
|
|
import EnforcementInfoSection from '@/components/enforcement/register/EnforcementInfoSection.vue'; |
|
|
import EnforcementInfoSection from '@/components/enforcement/register/EnforcementInfoSection.vue'; |
|
|
@ -156,13 +157,20 @@ const selectedPersonsList = computed(() => { |
|
|
const list = []; |
|
|
const list = []; |
|
|
// 添加默认执法人员 |
|
|
// 添加默认执法人员 |
|
|
if (enforcementPersons.value[0]) { |
|
|
if (enforcementPersons.value[0]) { |
|
|
list.push({ id: enforcementPersons.value[0].id, name: enforcementPersons.value[0].name, userId: enforcementPersons.value[0].userId }); |
|
|
list.push( |
|
|
|
|
|
{ |
|
|
|
|
|
id: enforcementPersons.value[0].id, |
|
|
|
|
|
name: enforcementPersons.value[0].name, |
|
|
|
|
|
userId: enforcementPersons.value[0].userId || '', |
|
|
|
|
|
phone: maskPhone(enforcementPersons.value[0].phonenumber || ''), |
|
|
|
|
|
lawCertificateNum: enforcementPersons.value[0].lawCertificateNum || '' |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
// 添加额外执法人员 |
|
|
// 添加额外执法人员 |
|
|
additionalPersons.value.forEach(p => { |
|
|
additionalPersons.value.forEach(p => { |
|
|
if (p.id || p.name) { |
|
|
if (p.id || p.name) { |
|
|
list.push({ id: p.id, name: p.name, userId: p.userId }); |
|
|
list.push({ id: p.id, name: p.name, userId: p.userId || '', lawCertificateNum: p.lawCertificateNum || '' }); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
return list; |
|
|
return list; |
|
|
}); |
|
|
}); |
|
|
@ -186,6 +194,7 @@ const handleOpenPersonPicker = (index) => { |
|
|
|
|
|
|
|
|
// 选择人员 |
|
|
// 选择人员 |
|
|
const handleSelectPerson = (person) => { |
|
|
const handleSelectPerson = (person) => { |
|
|
|
|
|
console.log(person); |
|
|
if (currentEditIndex.value === -1) { |
|
|
if (currentEditIndex.value === -1) { |
|
|
// 新增人员 |
|
|
// 新增人员 |
|
|
additionalPersons.value.push({ name: person.name, id: person.id, phonenumber: person.id }); |
|
|
additionalPersons.value.push({ name: person.name, id: person.id, phonenumber: person.id }); |
|
|
@ -441,29 +450,41 @@ const getCurrentDateTime = () => { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
// 保存 |
|
|
// 保存 |
|
|
|
|
|
const formRef = ref(); |
|
|
const handleSave = () => { |
|
|
const handleSave = () => { |
|
|
showConfirmDialog({ |
|
|
// 验证执法人员数量 |
|
|
title: '确认保存', |
|
|
const totalPersons = enforcementPersons.value.length + additionalPersons.value.length; |
|
|
message: '确认保存吗?', |
|
|
if (totalPersons < 2) { |
|
|
width: '80%', |
|
|
showToast('人员至少需要2人'); |
|
|
}).then(() => { |
|
|
return; |
|
|
const payload = buildSubmitPayload(); |
|
|
} |
|
|
saveEnfRegistration(payload, (res) => { |
|
|
// 验证表单必填项 |
|
|
if (res.code === 200 || res.code === 0) { |
|
|
formRef.value?.validate().then(() => { |
|
|
showSuccessToast('保存成功'); |
|
|
showConfirmDialog({ |
|
|
sessionStorage.removeItem('enterpriseScanData'); |
|
|
title: '确认保存', |
|
|
sessionStorage.removeItem('outOfCityEnterprise'); |
|
|
message: '确认保存吗?', |
|
|
sessionStorage.removeItem('scanReason'); |
|
|
width: '80%', |
|
|
router.replace('/enforcement/enforcementList'); |
|
|
}).then(() => { |
|
|
} else { |
|
|
const payload = buildSubmitPayload(); |
|
|
showToast(res.msg || '保存失败'); |
|
|
saveEnfRegistration(payload, (res) => { |
|
|
} |
|
|
if (res.code === 200 || res.code === 0) { |
|
|
}, (err) => { |
|
|
showSuccessToast('保存成功'); |
|
|
console.error('保存接口失败', err); |
|
|
sessionStorage.removeItem('enterpriseScanData'); |
|
|
showToast('保存失败'); |
|
|
sessionStorage.removeItem('outOfCityEnterprise'); |
|
|
|
|
|
sessionStorage.removeItem('scanReason'); |
|
|
|
|
|
router.replace('/enforcement/enforcementList'); |
|
|
|
|
|
} else { |
|
|
|
|
|
showToast(res.msg || '保存失败'); |
|
|
|
|
|
} |
|
|
|
|
|
}, (err) => { |
|
|
|
|
|
console.error('保存接口失败', err); |
|
|
|
|
|
showToast('保存失败'); |
|
|
|
|
|
}); |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
// 用户取消 |
|
|
}); |
|
|
}); |
|
|
}).catch(() => { |
|
|
}).catch(() => { |
|
|
// 用户取消 |
|
|
showToast('请完善必填信息'); |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
@ -710,8 +731,11 @@ onMounted(() => { |
|
|
let useCommon = JSON.parse(useCommonStr);; |
|
|
let useCommon = JSON.parse(useCommonStr);; |
|
|
const name = useCommon.userName || ''; |
|
|
const name = useCommon.userName || ''; |
|
|
const phonenumber = useCommon.phonenumber || ''; |
|
|
const phonenumber = useCommon.phonenumber || ''; |
|
|
|
|
|
const lawCertificateNum = useCommon.lawCertificateNum || ''; |
|
|
if (name || phonenumber) { |
|
|
if (name || phonenumber) { |
|
|
enforcementPersons.value = [{ name, phonenumber, userId: useCommon.userId || '' }]; |
|
|
enforcementPersons.value = [ |
|
|
|
|
|
{ name, phonenumber: maskPhone(phonenumber || ''), userId:useCommon.userId || '',lawCertificateNum } |
|
|
|
|
|
]; |
|
|
} |
|
|
} |
|
|
formData.enforcementUnit = useCommon.bureauUnitName || ''; |
|
|
formData.enforcementUnit = useCommon.bureauUnitName || ''; |
|
|
|
|
|
|
|
|
|