feat(web-admin): 驾押人员页按归属分册并仅山峡强制证书
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3396e3d164
commit
5543f26dca
1 file changed
+28
-39
@@ -1,9 +1,9 @@
|
||||
<!-- 驾押人员管理 -->
|
||||
<!-- 驾押人员管理(山峡 / 三方分册) -->
|
||||
<template>
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2 class="title-bar-heading">人员列表</h2>
|
||||
<h2 class="title-bar-heading">{{ isCarrierPersonnel ? '三方驾押人员' : '山峡驾押人员' }}</h2>
|
||||
</div>
|
||||
|
||||
<!-- 筛选区 -->
|
||||
@@ -24,16 +24,6 @@
|
||||
<el-option label="停用" value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="人员归属">
|
||||
<el-select v-model="searchForm.personnelAffiliation" placeholder="全部" clearable>
|
||||
<el-option
|
||||
v-for="option in PL_PERSONNEL_AFFILIATION_OPTIONS"
|
||||
:key="option.value"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="filter-actions">
|
||||
<div class="filter-actions-end">
|
||||
@@ -266,16 +256,6 @@
|
||||
<el-form-item label="身份证号" prop="idCardNo">
|
||||
<el-input v-model="formData.idCardNo" placeholder="请输入身份证号" maxlength="32" />
|
||||
</el-form-item>
|
||||
<el-form-item label="人员归属" prop="personnelAffiliation">
|
||||
<el-select v-model="formData.personnelAffiliation" placeholder="请选择人员归属">
|
||||
<el-option
|
||||
v-for="option in PL_PERSONNEL_AFFILIATION_OPTIONS"
|
||||
:key="option.value"
|
||||
:label="option.label"
|
||||
:value="option.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="人员类型" prop="personnelType">
|
||||
<el-select v-model="formData.personnelType" placeholder="请选择人员类型">
|
||||
<el-option
|
||||
@@ -389,7 +369,6 @@ import {
|
||||
getPersonnelTypeTagType,
|
||||
getPersonnelAffiliationLabel,
|
||||
getPersonnelAffiliationTagType,
|
||||
PL_PERSONNEL_AFFILIATION_OPTIONS,
|
||||
PL_PERSONNEL_BOTH_REQUIRED_CERT_NAMES,
|
||||
PL_PERSONNEL_TYPE_OPTIONS
|
||||
} from '@/utils/pl-personnel-cert'
|
||||
@@ -397,6 +376,12 @@ import {
|
||||
type CertListItem = CertRow & { _key?: string }
|
||||
type CertFormListRef = InstanceType<typeof PlCertFormList>
|
||||
|
||||
const route = useRoute()
|
||||
const affiliationMode = computed(() =>
|
||||
(route.meta.affiliationMode as string) === 'carrier' ? 'carrier' : 'self'
|
||||
)
|
||||
const isCarrierPersonnel = computed(() => affiliationMode.value === 'carrier')
|
||||
|
||||
const loading = ref(false)
|
||||
|
||||
const listColumnDefs = [
|
||||
@@ -465,13 +450,15 @@ const formData = reactive({
|
||||
})
|
||||
|
||||
const requiredPersonnelCertNames = computed(() =>
|
||||
formData.personnelType
|
||||
? getRequiredPersonnelCertNamesByType(formData.personnelType)
|
||||
: []
|
||||
isCarrierPersonnel.value
|
||||
? []
|
||||
: formData.personnelType
|
||||
? getRequiredPersonnelCertNamesByType(formData.personnelType)
|
||||
: []
|
||||
)
|
||||
|
||||
function mergePersonnelCertSlots(list: CertListItem[]) {
|
||||
if (!formData.personnelType) return list
|
||||
if (isCarrierPersonnel.value || !formData.personnelType) return list
|
||||
return mergeCertListWithRequiredSlots(
|
||||
list,
|
||||
getRequiredPersonnelCertNamesByType(formData.personnelType),
|
||||
@@ -568,13 +555,15 @@ function validateCerts(): boolean {
|
||||
ElMessage.warning('请选择人员类型')
|
||||
return false
|
||||
}
|
||||
const errors = collectRequiredCertSlotErrors(
|
||||
certList.value,
|
||||
requiredPersonnelCertNames.value
|
||||
)
|
||||
if (errors.length) {
|
||||
ElMessage.warning(formatRequiredCertErrors(errors))
|
||||
return false
|
||||
if (!isCarrierPersonnel.value) {
|
||||
const errors = collectRequiredCertSlotErrors(
|
||||
certList.value,
|
||||
requiredPersonnelCertNames.value
|
||||
)
|
||||
if (errors.length) {
|
||||
ElMessage.warning(formatRequiredCertErrors(errors))
|
||||
return false
|
||||
}
|
||||
}
|
||||
for (const cert of certList.value) {
|
||||
if (!cert._required && !cert.certName?.trim()) {
|
||||
@@ -605,7 +594,7 @@ async function fetchData() {
|
||||
const res = await personnelApi.list({
|
||||
q: searchForm.q || undefined,
|
||||
status: searchForm.status || undefined,
|
||||
personnelAffiliation: searchForm.personnelAffiliation || undefined,
|
||||
personnelAffiliation: affiliationMode.value,
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize
|
||||
})
|
||||
@@ -627,7 +616,7 @@ function handleSearch() {
|
||||
function handleReset() {
|
||||
searchForm.q = ''
|
||||
searchForm.status = ''
|
||||
searchForm.personnelAffiliation = ''
|
||||
searchForm.personnelAffiliation = affiliationMode.value
|
||||
selectedRows.value = []
|
||||
pagination.page = 1
|
||||
fetchData()
|
||||
@@ -685,7 +674,7 @@ function handleAdd() {
|
||||
age: null,
|
||||
idCardNo: '',
|
||||
personnelType: '',
|
||||
personnelAffiliation: 'self',
|
||||
personnelAffiliation: affiliationMode.value,
|
||||
status: '1',
|
||||
remark: ''
|
||||
})
|
||||
@@ -728,7 +717,7 @@ async function handleEdit(row: Personnel) {
|
||||
age: detail.age ?? null,
|
||||
idCardNo: detail.idCardNo || '',
|
||||
personnelType: detail.personnelType || 'both',
|
||||
personnelAffiliation: detail.personnelAffiliation || 'self',
|
||||
personnelAffiliation: affiliationMode.value,
|
||||
status: detail.status,
|
||||
remark: detail.remark || ''
|
||||
})
|
||||
@@ -816,7 +805,7 @@ useDbInstantSearch(
|
||||
() => ({
|
||||
q: searchForm.q,
|
||||
status: searchForm.status,
|
||||
personnelAffiliation: searchForm.personnelAffiliation
|
||||
personnelAffiliation: affiliationMode.value
|
||||
}),
|
||||
handleSearch
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user