diff --git a/zdxt-web-client/zdxt-admin-plus-ui/public/mock/mock-certificate01.png b/zdxt-web-client/zdxt-admin-plus-ui/public/mock/mock-certificate01.png new file mode 100644 index 00000000..5eb686bb Binary files /dev/null and b/zdxt-web-client/zdxt-admin-plus-ui/public/mock/mock-certificate01.png differ diff --git a/zdxt-web-client/zdxt-admin-plus-ui/src/views/nos/certificateLibrary/assets/document-placeholder.svg b/zdxt-web-client/zdxt-admin-plus-ui/src/views/nos/certificateLibrary/assets/document-placeholder.svg deleted file mode 100644 index a282028a..00000000 --- a/zdxt-web-client/zdxt-admin-plus-ui/src/views/nos/certificateLibrary/assets/document-placeholder.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/zdxt-web-client/zdxt-admin-plus-ui/src/views/nos/certificateLibrary/index.vue b/zdxt-web-client/zdxt-admin-plus-ui/src/views/nos/certificateLibrary/index.vue index 6d4a2649..b09ce649 100644 --- a/zdxt-web-client/zdxt-admin-plus-ui/src/views/nos/certificateLibrary/index.vue +++ b/zdxt-web-client/zdxt-admin-plus-ui/src/views/nos/certificateLibrary/index.vue @@ -105,7 +105,6 @@ import { ElMessage } from 'element-plus'; import { getTaskPage } from '@/api/nos/index'; import type { NosLawEnforcementTaskItem, NosLawEnforcementTaskPageVO, Response as TaskPageResponse, TaskPageRequest } from '@/api/nos/type'; import { parseTime } from '@/utils/ruoyi'; -import documentPlaceholder from './assets/document-placeholder.svg'; type CertificateCategory = 'business-license' | 'license' | 'other'; @@ -124,6 +123,8 @@ interface SearchForm { const IMAGE_EXTENSIONS = new Set(['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp', 'svg', 'avif']); const COMPLETED_TASK_STATUS = 4; const VERIFY_TASK_TYPE_ID = 3; +// 模拟数据开关:后端接口联调时改为 false +const USE_MOCK_DATA = true; const BASE_API = import.meta.env.VITE_APP_BASE_API || ''; const FILE_SERVER_PREFIX = import.meta.env.VITE_APP_FILE_SERVER_PREFIX || ''; @@ -194,10 +195,13 @@ const buildFileUrl = (value?: string) => { return `${FILE_SERVER_PREFIX.replace(/\/+$/, '')}${toRelativeFilePath(raw)}`; }; +// 证照占位图:public/mock 下的本地静态文件,模拟数据与加载失败兜底共用 +const CERT_PLACEHOLDER_IMAGE = new URL(`${import.meta.env.BASE_URL}mock/mock-certificate01.png`, window.location.origin).href; + const handleImageError = (event: Event) => { const target = event.target as HTMLImageElement; - if (target?.src.endsWith('document-placeholder.svg')) return; - if (target) target.src = documentPlaceholder; + if (!target || target.src === CERT_PLACEHOLDER_IMAGE) return; + target.src = CERT_PLACEHOLDER_IMAGE; }; const DocumentThumbnails = defineComponent({ @@ -242,6 +246,78 @@ const DocumentThumbnails = defineComponent({ } }); +const mockItem = (id: string, itemName: string, count: number): NosLawEnforcementTaskItem => ({ + id, + itemName, + itemValue: Array.from({ length: count }, () => CERT_PLACEHOLDER_IMAGE) +}); + +const MOCK_ROWS: NosLawEnforcementTaskPageVO[] = [ + { + id: 'mock-1', + enterpriseName: '新粤云(深圳)信息技术有限公司', + enterpriseHandleTime: '2026-06-12 17:38:00', + taskItemList: [mockItem('mock-1-1', '其他证照材料', 2)] + }, + { + id: 'mock-2', + enterpriseName: '深圳市宏泰建筑工程有限公司', + usciCode: '91440300MA5F1X2K3L', + enterpriseHandleTime: '2026-06-09 16:28:00', + taskItemList: [mockItem('mock-2-1', '营业执照', 1), mockItem('mock-2-2', '排污许可证', 2), mockItem('mock-2-3', '其他证照材料', 1)] + }, + { + id: 'mock-3', + enterpriseName: '深圳前海智联科技有限公司', + usciCode: '91440300MA5G8H9P0Q', + enterpriseHandleTime: '2026-06-05 09:12:00', + taskItemList: [mockItem('mock-3-1', '营业执照', 1), mockItem('mock-3-2', '食品经营许可证', 1), mockItem('mock-3-3', '其他证照材料', 3)] + }, + { + id: 'mock-4', + enterpriseName: '广东南方检测服务有限公司', + enterpriseHandleTime: '2026-05-28 14:05:00', + taskItemList: [mockItem('mock-4-1', '其他证照材料', 2)] + }, + { + id: 'mock-5', + enterpriseName: '深圳市华信环保科技有限公司', + enterpriseNumber: '440300000123456', + enterpriseHandleTime: '2026-05-21 10:47:00', + taskItemList: [mockItem('mock-5-1', '危险废物经营许可证', 1), mockItem('mock-5-2', '其他证照材料', 1)] + }, + { + id: 'mock-6', + enterpriseName: '东莞市智造精密五金有限公司', + enterpriseHandleTime: '2026-05-14 18:23:00', + taskItemList: [mockItem('mock-6-1', '营业执照', 1), mockItem('mock-6-2', '其他证照材料', 2)] + } +]; + +const matchesMockFilters = (row: NosLawEnforcementTaskPageVO, params: TaskPageRequest) => { + if (params.enterpriseName && !(row.enterpriseName || '').includes(params.enterpriseName)) return false; + + const handleTime = row.enterpriseHandleTime || ''; + if (params.startTime && handleTime && handleTime < params.startTime) return false; + if (params.endTime && handleTime && handleTime > params.endTime) return false; + + return true; +}; + +const fetchMockPage = async (params: TaskPageRequest): Promise => { + await new Promise((resolve) => setTimeout(resolve, 300)); + + const matched = MOCK_ROWS.filter((row) => matchesMockFilters(row, params)); + const start = (params.pageNo - 1) * params.pageSize; + + return { + code: 200, + msg: 'ok', + rows: matched.slice(start, start + params.pageSize), + total: matched.length + }; +}; + const loading = ref(false); const tableData = ref([]); const total = ref(0); @@ -281,7 +357,8 @@ const buildQueryParams = (): TaskPageRequest => ({ const getList = async () => { loading.value = true; try { - const res = (await getTaskPage(buildQueryParams())) as unknown as TaskPageResponse; + const params = buildQueryParams(); + const res: TaskPageResponse = USE_MOCK_DATA ? await fetchMockPage(params) : ((await getTaskPage(params)) as unknown as TaskPageResponse); tableData.value = res.rows || []; total.value = res.total || 0; } catch (error) {