feat(web-admin): add maintain-cert action on document reminder list
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
0f1446b5d7
commit
7f54923acf
1 file changed
+68
-2
@@ -219,6 +219,18 @@
|
||||
min-width="160"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="操作" fixed="right" min-width="140" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
:loading="maintainLoadingId === row.id"
|
||||
@click="handleMaintainCert(row)"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>维护证件
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ListTable>
|
||||
</div>
|
||||
<div ref="docReminderBelowRef">
|
||||
@@ -238,8 +250,21 @@ 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 { CircleCheck, Filter } from '@element-plus/icons-vue'
|
||||
import { inventoryApi, type DocumentReminder } from '@/api/pl'
|
||||
import { CircleCheck, Filter, EditPen } from '@element-plus/icons-vue'
|
||||
import {
|
||||
inventoryApi,
|
||||
vehicleApi,
|
||||
personnelApi,
|
||||
type DocumentReminder,
|
||||
type VehicleDetail,
|
||||
type PersonnelDetail
|
||||
} from '@/api/pl'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { pickBxData } from '@/utils/http/bx'
|
||||
import {
|
||||
resolveDocumentReminderEditPath,
|
||||
DOCUMENT_REMINDER_JUMP_UNSUPPORTED
|
||||
} from '@/utils/pl-document-reminder-jump'
|
||||
import { usePersistedListColumns } from '@/composables/usePersistedListColumns'
|
||||
import { useServerColumnFilters } from '@/composables/useServerColumnFilters'
|
||||
import { useColumnSort } from '@/composables/useColumnSort'
|
||||
@@ -330,6 +355,9 @@ const { tableHeight, recalc: recalcTableHeight } = useListTableViewportHeight({
|
||||
tableRef: docReminderTableRef
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
const maintainLoadingId = ref<string | null>(null)
|
||||
|
||||
const loading = ref(false)
|
||||
const resolveLoading = ref(false)
|
||||
const reminderList = ref<DocumentReminder[]>([])
|
||||
@@ -445,6 +473,44 @@ function handleToolbarResolve() {
|
||||
handleResolve(selectedRow.value)
|
||||
}
|
||||
|
||||
async function handleMaintainCert(row: DocumentReminder) {
|
||||
const ownerId = String(row.ownerId || '').trim()
|
||||
const ownerType = String(row.ownerType || '').trim()
|
||||
if (!ownerId || !ownerType) {
|
||||
ElMessage.warning('缺少主体信息,无法跳转维护')
|
||||
return
|
||||
}
|
||||
maintainLoadingId.value = row.id
|
||||
try {
|
||||
let path: string | null = null
|
||||
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 })
|
||||
} 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 })
|
||||
} else {
|
||||
ElMessage.warning(DOCUMENT_REMINDER_JUMP_UNSUPPORTED)
|
||||
return
|
||||
}
|
||||
if (!path) {
|
||||
ElMessage.warning(DOCUMENT_REMINDER_JUMP_UNSUPPORTED)
|
||||
return
|
||||
}
|
||||
await router.push({ path, query: { editId: ownerId } })
|
||||
} catch {
|
||||
ElMessage.error('无法打开主体档案,请确认数据存在且有权限')
|
||||
} finally {
|
||||
maintainLoadingId.value = null
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchData()
|
||||
nextTick(() => recalcTableHeight())
|
||||
|
||||
Reference in new issue
Block a user