Browse Source

feat(web-admin): 驾押人员页按归属分册并仅山峡强制证书

Co-authored-by: Cursor <cursoragent@cursor.com>
zlwu 3 tháng trước cách đây
mục cha
commit
5543f26dca

+ 28 - 39
web-admin/src/views/pl/personnel/index.vue

@@ -1,9 +1,9 @@
-<!-- 驾押人员管理 -->
+<!-- 驾押人员管理(山峡 / 三方分册) -->
 <template>
 <template>
   <div class="page-container">
   <div class="page-container">
     <section class="panel">
     <section class="panel">
       <div class="panel-top">
       <div class="panel-top">
-        <h2 class="title-bar-heading">人员列表</h2>
+        <h2 class="title-bar-heading">{{ isCarrierPersonnel ? '三方驾押人员' : '山峡驾押人员' }}</h2>
       </div>
       </div>
 
 
       <!-- 筛选区 -->
       <!-- 筛选区 -->
@@ -24,16 +24,6 @@
                 <el-option label="停用" value="0" />
                 <el-option label="停用" value="0" />
               </el-select>
               </el-select>
             </el-form-item>
             </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>
           <div class="filter-actions">
           <div class="filter-actions">
             <div class="filter-actions-end">
             <div class="filter-actions-end">
@@ -266,16 +256,6 @@
           <el-form-item label="身份证号" prop="idCardNo">
           <el-form-item label="身份证号" prop="idCardNo">
             <el-input v-model="formData.idCardNo" placeholder="请输入身份证号" maxlength="32" />
             <el-input v-model="formData.idCardNo" placeholder="请输入身份证号" maxlength="32" />
           </el-form-item>
           </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-form-item label="人员类型" prop="personnelType">
             <el-select v-model="formData.personnelType" placeholder="请选择人员类型">
             <el-select v-model="formData.personnelType" placeholder="请选择人员类型">
               <el-option
               <el-option
@@ -389,7 +369,6 @@ import {
   getPersonnelTypeTagType,
   getPersonnelTypeTagType,
   getPersonnelAffiliationLabel,
   getPersonnelAffiliationLabel,
   getPersonnelAffiliationTagType,
   getPersonnelAffiliationTagType,
-  PL_PERSONNEL_AFFILIATION_OPTIONS,
   PL_PERSONNEL_BOTH_REQUIRED_CERT_NAMES,
   PL_PERSONNEL_BOTH_REQUIRED_CERT_NAMES,
   PL_PERSONNEL_TYPE_OPTIONS
   PL_PERSONNEL_TYPE_OPTIONS
 } from '@/utils/pl-personnel-cert'
 } from '@/utils/pl-personnel-cert'
@@ -397,6 +376,12 @@ import {
 type CertListItem = CertRow & { _key?: string }
 type CertListItem = CertRow & { _key?: string }
 type CertFormListRef = InstanceType<typeof PlCertFormList>
 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 loading = ref(false)
 
 
 const listColumnDefs = [
 const listColumnDefs = [
@@ -465,13 +450,15 @@ const formData = reactive({
 })
 })
 
 
 const requiredPersonnelCertNames = computed(() =>
 const requiredPersonnelCertNames = computed(() =>
-  formData.personnelType
-    ? getRequiredPersonnelCertNamesByType(formData.personnelType)
-    : []
+  isCarrierPersonnel.value
+    ? []
+    : formData.personnelType
+      ? getRequiredPersonnelCertNamesByType(formData.personnelType)
+      : []
 )
 )
 
 
 function mergePersonnelCertSlots(list: CertListItem[]) {
 function mergePersonnelCertSlots(list: CertListItem[]) {
-  if (!formData.personnelType) return list
+  if (isCarrierPersonnel.value || !formData.personnelType) return list
   return mergeCertListWithRequiredSlots(
   return mergeCertListWithRequiredSlots(
     list,
     list,
     getRequiredPersonnelCertNamesByType(formData.personnelType),
     getRequiredPersonnelCertNamesByType(formData.personnelType),
@@ -568,13 +555,15 @@ function validateCerts(): boolean {
     ElMessage.warning('请选择人员类型')
     ElMessage.warning('请选择人员类型')
     return false
     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) {
   for (const cert of certList.value) {
     if (!cert._required && !cert.certName?.trim()) {
     if (!cert._required && !cert.certName?.trim()) {
@@ -605,7 +594,7 @@ async function fetchData() {
     const res = await personnelApi.list({
     const res = await personnelApi.list({
       q: searchForm.q || undefined,
       q: searchForm.q || undefined,
       status: searchForm.status || undefined,
       status: searchForm.status || undefined,
-      personnelAffiliation: searchForm.personnelAffiliation || undefined,
+      personnelAffiliation: affiliationMode.value,
       page: pagination.page,
       page: pagination.page,
       pageSize: pagination.pageSize
       pageSize: pagination.pageSize
     })
     })
@@ -627,7 +616,7 @@ function handleSearch() {
 function handleReset() {
 function handleReset() {
   searchForm.q = ''
   searchForm.q = ''
   searchForm.status = ''
   searchForm.status = ''
-  searchForm.personnelAffiliation = ''
+  searchForm.personnelAffiliation = affiliationMode.value
   selectedRows.value = []
   selectedRows.value = []
   pagination.page = 1
   pagination.page = 1
   fetchData()
   fetchData()
@@ -685,7 +674,7 @@ function handleAdd() {
     age: null,
     age: null,
     idCardNo: '',
     idCardNo: '',
     personnelType: '',
     personnelType: '',
-    personnelAffiliation: 'self',
+    personnelAffiliation: affiliationMode.value,
     status: '1',
     status: '1',
     remark: ''
     remark: ''
   })
   })
@@ -728,7 +717,7 @@ async function handleEdit(row: Personnel) {
       age: detail.age ?? null,
       age: detail.age ?? null,
       idCardNo: detail.idCardNo || '',
       idCardNo: detail.idCardNo || '',
       personnelType: detail.personnelType || 'both',
       personnelType: detail.personnelType || 'both',
-      personnelAffiliation: detail.personnelAffiliation || 'self',
+      personnelAffiliation: affiliationMode.value,
       status: detail.status,
       status: detail.status,
       remark: detail.remark || ''
       remark: detail.remark || ''
     })
     })
@@ -816,7 +805,7 @@ useDbInstantSearch(
   () => ({
   () => ({
     q: searchForm.q,
     q: searchForm.q,
     status: searchForm.status,
     status: searchForm.status,
-    personnelAffiliation: searchForm.personnelAffiliation
+    personnelAffiliation: affiliationMode.value
   }),
   }),
   handleSearch
   handleSearch
 )
 )