feat(web-admin): open cert maintain dialog on reminder page
Keep users on the document reminder list by reusing vehicle/personnel form dialogs instead of navigating away to base-info pages. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
fba478dcca
commit
01d607d766
4 files changed
+156
-120
No files matched your search
@@ -242,6 +242,19 @@
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<PlVehicleFormDialog
|
||||
v-model="vehicleFormVisible"
|
||||
:vehicle-type="vehicleFormType"
|
||||
:vehicle-id="editingOwnerId"
|
||||
@saved="handleOwnerFormSaved"
|
||||
/>
|
||||
<PlPersonnelFormDialog
|
||||
v-model="personnelFormVisible"
|
||||
:affiliation="personnelFormAffiliation"
|
||||
:personnel-id="editingOwnerId"
|
||||
@saved="handleOwnerFormSaved"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -250,6 +263,8 @@ import ListQuickSearchInput from '@/components/business/list-quick-search-input/
|
||||
import ColumnHeaderFilter from '@/components/business/column-header-filter/index.vue'
|
||||
import ListToolbarEndActions from '@/components/business/list-toolbar-end-actions/index.vue'
|
||||
import ListExportDropdown from '@/components/business/list-export-dropdown/index.vue'
|
||||
import PlVehicleFormDialog from '@/components/business/pl-vehicle-form-dialog/index.vue'
|
||||
import PlPersonnelFormDialog from '@/components/business/pl-personnel-form-dialog/index.vue'
|
||||
import { CircleCheck, Filter, EditPen } from '@element-plus/icons-vue'
|
||||
import {
|
||||
inventoryApi,
|
||||
@@ -259,10 +274,9 @@ import {
|
||||
type VehicleDetail,
|
||||
type PersonnelDetail
|
||||
} from '@/api/pl'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { pickBxData } from '@/utils/http/bx'
|
||||
import {
|
||||
resolveDocumentReminderEditPath,
|
||||
resolveDocumentReminderFormMode,
|
||||
DOCUMENT_REMINDER_JUMP_UNSUPPORTED
|
||||
} from '@/utils/pl-document-reminder-jump'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
@@ -355,8 +369,12 @@ const { tableHeight, recalc: recalcTableHeight } = useListTableViewportHeight({
|
||||
tableRef: docReminderTableRef
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
const maintainLoadingId = ref<string | null>(null)
|
||||
const vehicleFormVisible = ref(false)
|
||||
const personnelFormVisible = ref(false)
|
||||
const vehicleFormType = ref<'self' | 'carrier'>('carrier')
|
||||
const personnelFormAffiliation = ref<'self' | 'carrier'>('self')
|
||||
const editingOwnerId = ref<string | null>(null)
|
||||
|
||||
const loading = ref(false)
|
||||
const resolveLoading = ref(false)
|
||||
@@ -473,37 +491,52 @@ function handleToolbarResolve() {
|
||||
handleResolve(selectedRow.value)
|
||||
}
|
||||
|
||||
function handleOwnerFormSaved() {
|
||||
ElMessage.success('保存成功')
|
||||
fetchData()
|
||||
}
|
||||
|
||||
async function handleMaintainCert(row: DocumentReminder) {
|
||||
const ownerId = String(row.ownerId || '').trim()
|
||||
const ownerType = String(row.ownerType || '').trim()
|
||||
if (!ownerId || !ownerType) {
|
||||
ElMessage.warning('缺少主体信息,无法跳转维护')
|
||||
ElMessage.warning('缺少主体信息,无法维护证件')
|
||||
return
|
||||
}
|
||||
maintainLoadingId.value = row.id
|
||||
try {
|
||||
let path: string | null = null
|
||||
let mode = null as ReturnType<typeof resolveDocumentReminderFormMode>
|
||||
if (ownerType === 'vehicle') {
|
||||
const res = await vehicleApi.get(ownerId)
|
||||
const detail = pickBxData<VehicleDetail>(res) || (res as any)?.data || res
|
||||
const vehicleType = String((detail as VehicleDetail)?.vehicleType || '')
|
||||
path = resolveDocumentReminderEditPath({ ownerType, vehicleType })
|
||||
mode = resolveDocumentReminderFormMode({ ownerType, vehicleType })
|
||||
} else if (ownerType === 'personnel') {
|
||||
const res = await personnelApi.get(ownerId)
|
||||
const detail = pickBxData<PersonnelDetail>(res) || (res as any)?.data || res
|
||||
const personnelAffiliation = String(
|
||||
(detail as PersonnelDetail)?.personnelAffiliation || ''
|
||||
)
|
||||
path = resolveDocumentReminderEditPath({ ownerType, personnelAffiliation })
|
||||
mode = resolveDocumentReminderFormMode({ ownerType, personnelAffiliation })
|
||||
} else {
|
||||
ElMessage.warning(DOCUMENT_REMINDER_JUMP_UNSUPPORTED)
|
||||
return
|
||||
}
|
||||
if (!path) {
|
||||
if (!mode) {
|
||||
ElMessage.warning(DOCUMENT_REMINDER_JUMP_UNSUPPORTED)
|
||||
return
|
||||
}
|
||||
await router.push({ path, query: { editId: ownerId } })
|
||||
editingOwnerId.value = ownerId
|
||||
vehicleFormVisible.value = false
|
||||
personnelFormVisible.value = false
|
||||
await nextTick()
|
||||
if (mode.kind === 'vehicle') {
|
||||
vehicleFormType.value = mode.vehicleType
|
||||
vehicleFormVisible.value = true
|
||||
} else {
|
||||
personnelFormAffiliation.value = mode.affiliation
|
||||
personnelFormVisible.value = true
|
||||
}
|
||||
} catch {
|
||||
ElMessage.error('无法打开主体档案,请确认数据存在且有权限')
|
||||
} finally {
|
||||
|
||||
Reference in new issue
Block a user