Browse Source

加一个固定图片

dev-V1.2
wangmingyong@163.com 11 hours ago
parent
commit
7a0ae8b676
  1. BIN
      zdxt-web-client/zdxt-admin-plus-ui/public/mock/mock-certificate01.png
  2. 6
      zdxt-web-client/zdxt-admin-plus-ui/src/views/nos/certificateLibrary/assets/document-placeholder.svg
  3. 85
      zdxt-web-client/zdxt-admin-plus-ui/src/views/nos/certificateLibrary/index.vue

BIN
zdxt-web-client/zdxt-admin-plus-ui/public/mock/mock-certificate01.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

6
zdxt-web-client/zdxt-admin-plus-ui/src/views/nos/certificateLibrary/assets/document-placeholder.svg

@ -1,6 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="160" height="64" viewBox="0 0 160 64">
<rect width="160" height="64" fill="#f5f6f7"/>
<circle cx="124" cy="13" r="4" fill="#d8dbdf"/>
<path d="M24 51V32l20-23 22 29 15-14 31 27h-88Z" fill="#138dbb"/>
<path d="M91 51V38l21-21 22 22 15 12H91Z" fill="#0c82b1"/>
</svg>

Before

Width:  |  Height:  |  Size: 321 B

85
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 { getTaskPage } from '@/api/nos/index';
import type { NosLawEnforcementTaskItem, NosLawEnforcementTaskPageVO, Response as TaskPageResponse, TaskPageRequest } from '@/api/nos/type'; import type { NosLawEnforcementTaskItem, NosLawEnforcementTaskPageVO, Response as TaskPageResponse, TaskPageRequest } from '@/api/nos/type';
import { parseTime } from '@/utils/ruoyi'; import { parseTime } from '@/utils/ruoyi';
import documentPlaceholder from './assets/document-placeholder.svg';
type CertificateCategory = 'business-license' | 'license' | 'other'; 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 IMAGE_EXTENSIONS = new Set(['png', 'jpg', 'jpeg', 'gif', 'webp', 'bmp', 'svg', 'avif']);
const COMPLETED_TASK_STATUS = 4; const COMPLETED_TASK_STATUS = 4;
const VERIFY_TASK_TYPE_ID = 3; const VERIFY_TASK_TYPE_ID = 3;
// 模拟数据开关:后端接口联调时改为 false
const USE_MOCK_DATA = true;
const BASE_API = import.meta.env.VITE_APP_BASE_API || ''; const BASE_API = import.meta.env.VITE_APP_BASE_API || '';
const FILE_SERVER_PREFIX = import.meta.env.VITE_APP_FILE_SERVER_PREFIX || ''; 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)}`; 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 handleImageError = (event: Event) => {
const target = event.target as HTMLImageElement; const target = event.target as HTMLImageElement;
if (target?.src.endsWith('document-placeholder.svg')) return; if (!target || target.src === CERT_PLACEHOLDER_IMAGE) return;
if (target) target.src = documentPlaceholder; target.src = CERT_PLACEHOLDER_IMAGE;
}; };
const DocumentThumbnails = defineComponent({ 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<TaskPageResponse> => {
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 loading = ref(false);
const tableData = ref<NosLawEnforcementTaskPageVO[]>([]); const tableData = ref<NosLawEnforcementTaskPageVO[]>([]);
const total = ref(0); const total = ref(0);
@ -281,7 +357,8 @@ const buildQueryParams = (): TaskPageRequest => ({
const getList = async () => { const getList = async () => {
loading.value = true; loading.value = true;
try { 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 || []; tableData.value = res.rows || [];
total.value = res.total || 0; total.value = res.total || 0;
} catch (error) { } catch (error) {

Loading…
Cancel
Save