From 63b4909ac5d0b7355be211cc7080673b41cdb3cc Mon Sep 17 00:00:00 2001
From: zhuguifei <zhuguifei>
Date: 星期三, 04 三月 2026 14:46:02 +0800
Subject: [PATCH] refactor(module(qa)): 代码重构
---
ruoyi-plus-soybean/src/views/qm/batch/index.vue | 709 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 354 insertions(+), 355 deletions(-)
diff --git a/ruoyi-plus-soybean/src/views/qm/batch/index.vue b/ruoyi-plus-soybean/src/views/qm/batch/index.vue
index 06ebbff..96d7c52 100644
--- a/ruoyi-plus-soybean/src/views/qm/batch/index.vue
+++ b/ruoyi-plus-soybean/src/views/qm/batch/index.vue
@@ -15,7 +15,6 @@
name: 'BatchList'
});
-
const appStore = useAppStore();
const { download } = useDownload();
const { hasAuth } = useAuth();
@@ -44,365 +43,365 @@
const { columns, columnChecks, data, getData, getDataByPage, loading, mobilePagination, scrollX } =
useNaivePaginatedTable({
- api: () => fetchGetBatchList(searchParams.value),
- transform: response => defaultTransform(response),
- onPaginationParamsChange: params => {
- searchParams.value.pageNum = params.page;
- searchParams.value.pageSize = params.pageSize;
- },
- columns: () => [
- {
- type: 'selection',
- align: 'center',
- width: 48
+ api: () => fetchGetBatchList(searchParams.value),
+ transform: response => defaultTransform(response),
+ onPaginationParamsChange: params => {
+ searchParams.value.pageNum = params.page;
+ searchParams.value.pageSize = params.pageSize;
},
- {
- key: 'index',
- title: $t('common.index'),
- align: 'center',
- width: 64,
- render: (_, index) => index + 1
- },
- {
- key: 'id',
- title: '缂栫爜',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'batchCode',
- title: '鎵规浠g爜',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'batchName',
- title: '鎵规鍚嶇О',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'typ',
- title: '绫诲瀷',
- align: 'center',
- minWidth: 120,
- render: row => TYP_MAP[row.typ] ?? row.typ
- },
- {
- key: 'eqpCode',
- title: '鏈哄彴浠g爜',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'matCode',
- title: '鐗屽彿',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'judgeCode',
- title: '鍒ゅ畾渚濇嵁浠g爜',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'batchDate',
- title: '鎵规鐢熸垚鏃ユ湡',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'isflag',
- title: '浣跨敤鏍囧織',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'enabled',
- title: '鍚敤鏍囧織',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'totalNum',
- title: '鍒拌揣鎬婚噺',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'results',
- title: '缁煎悎鍒ゅ畾',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'approver',
- title: '鎵瑰噯浜�',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'auditor',
- title: '瀹℃牳浜�',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'creater',
- title: '鍒涘缓浜�',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'tabDate',
- title: '鍒惰〃鏃ユ湡',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'verName',
- title: '鐗堟湰鍚嶇О',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'verCode',
- title: '鐗堟湰缂栧彿',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'archDate',
- title: '淇濆瓨鏈�',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'flag',
- title: '鍙嶉MES',
- align: 'center',
- minWidth: 120,
- render: row => FLAG_MAP[String(row.flag)] ?? row.flag
- },
- {
- key: 'toMesDate',
- title: '涓婁紶MES鏃堕棿',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'fromMesDate',
- title: '浠嶮ES鏃堕棿涓嬭浇',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'deleted',
- title: '鍒犻櫎鏍囧織',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'batchDes',
- title: '鎵规鎻忚堪',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'category',
- title: '绫诲埆',
- align: 'center',
- minWidth: 120,
- render: row => CATEGORY_MAP[String(row.category)] ?? row.category
- },
- {
- key: 'makeno',
- title: '鍗峰埗宸ュ彿',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'shifteqpno',
- title: '鐝鏈哄彿',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'boxno',
- title: '瑁呯鍙�',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'pid',
- title: '鐖舵壒娆″彿',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'reviewer',
- title: '澶嶆牳浜�',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'rvcount',
- title: '澶嶆娆℃暟',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'state',
- title: '鎵规鐘舵��',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'reviewTime',
- title: '澶嶆牳鏃ユ湡',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'auditTime',
- title: '瀹℃牳鏃ユ湡',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'spec',
- title: '瑙勬牸',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'approveTime',
- title: '鎵瑰噯鏃堕棿',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'unit',
- title: '鍒拌揣鍗曚綅',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'arrivalTime',
- title: '鍒拌揣鏃ユ湡',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'storagePlace',
- title: '瀛樻斁鍦扮偣',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'checker',
- title: '妫�楠屽憳',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'receiveTime',
- title: '鎺ュ崟鏃ユ湡',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'inspTime',
- title: '鎶ユ鏃ユ湡',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'storer',
- title: '浠撳簱淇濈鍛�',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'isverify',
- title: '鏄惁楠岃瘉',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'ischk',
- title: '鏄惁妫�楠�',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'bak1',
- title: '澶囩敤1',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'bak2',
- title: '澶囩敤2',
- align: 'center',
- minWidth: 120
- },
- {
- key: 'operate',
- title: $t('common.operate'),
- align: 'center',
- width: 130,
- render: row => {
- const divider = () => {
- if (!hasAuth('qm:batch:edit') || !hasAuth('qm:batch:remove')) {
- return null;
- }
- return <NDivider vertical />;
- };
+ columns: () => [
+ {
+ type: 'selection',
+ align: 'center',
+ width: 48
+ },
+ {
+ key: 'index',
+ title: $t('common.index'),
+ align: 'center',
+ width: 64,
+ render: (_, index) => index + 1
+ },
+ {
+ key: 'id',
+ title: '缂栫爜',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'batchCode',
+ title: '鎵规浠g爜',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'batchName',
+ title: '鎵规鍚嶇О',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'typ',
+ title: '绫诲瀷',
+ align: 'center',
+ minWidth: 120,
+ render: row => TYP_MAP[row.typ] ?? row.typ
+ },
+ {
+ key: 'eqpCode',
+ title: '鏈哄彴浠g爜',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'matCode',
+ title: '鐗屽彿',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'judgeCode',
+ title: '鍒ゅ畾渚濇嵁浠g爜',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'batchDate',
+ title: '鎵规鐢熸垚鏃ユ湡',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'isflag',
+ title: '浣跨敤鏍囧織',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'enabled',
+ title: '鍚敤鏍囧織',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'totalNum',
+ title: '鍒拌揣鎬婚噺',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'results',
+ title: '缁煎悎鍒ゅ畾',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'approver',
+ title: '鎵瑰噯浜�',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'auditor',
+ title: '瀹℃牳浜�',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'creater',
+ title: '鍒涘缓浜�',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'tabDate',
+ title: '鍒惰〃鏃ユ湡',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'verName',
+ title: '鐗堟湰鍚嶇О',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'verCode',
+ title: '鐗堟湰缂栧彿',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'archDate',
+ title: '淇濆瓨鏈�',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'flag',
+ title: '鍙嶉MES',
+ align: 'center',
+ minWidth: 120,
+ render: row => FLAG_MAP[String(row.flag)] ?? row.flag
+ },
+ {
+ key: 'toMesDate',
+ title: '涓婁紶MES鏃堕棿',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'fromMesDate',
+ title: '浠嶮ES鏃堕棿涓嬭浇',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'deleted',
+ title: '鍒犻櫎鏍囧織',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'batchDes',
+ title: '鎵规鎻忚堪',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'category',
+ title: '绫诲埆',
+ align: 'center',
+ minWidth: 120,
+ render: row => CATEGORY_MAP[String(row.category)] ?? row.category
+ },
+ {
+ key: 'makeno',
+ title: '鍗峰埗宸ュ彿',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'shifteqpno',
+ title: '鐝鏈哄彿',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'boxno',
+ title: '瑁呯鍙�',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'pid',
+ title: '鐖舵壒娆″彿',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'reviewer',
+ title: '澶嶆牳浜�',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'rvcount',
+ title: '澶嶆娆℃暟',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'state',
+ title: '鎵规鐘舵��',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'reviewTime',
+ title: '澶嶆牳鏃ユ湡',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'auditTime',
+ title: '瀹℃牳鏃ユ湡',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'spec',
+ title: '瑙勬牸',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'approveTime',
+ title: '鎵瑰噯鏃堕棿',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'unit',
+ title: '鍒拌揣鍗曚綅',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'arrivalTime',
+ title: '鍒拌揣鏃ユ湡',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'storagePlace',
+ title: '瀛樻斁鍦扮偣',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'checker',
+ title: '妫�楠屽憳',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'receiveTime',
+ title: '鎺ュ崟鏃ユ湡',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'inspTime',
+ title: '鎶ユ鏃ユ湡',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'storer',
+ title: '浠撳簱淇濈鍛�',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'isverify',
+ title: '鏄惁楠岃瘉',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'ischk',
+ title: '鏄惁妫�楠�',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'bak1',
+ title: '澶囩敤1',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'bak2',
+ title: '澶囩敤2',
+ align: 'center',
+ minWidth: 120
+ },
+ {
+ key: 'operate',
+ title: $t('common.operate'),
+ align: 'center',
+ width: 130,
+ render: row => {
+ const divider = () => {
+ if (!hasAuth('qm:batch:edit') || !hasAuth('qm:batch:remove')) {
+ return null;
+ }
+ return <NDivider vertical />;
+ };
- const editBtn = () => {
- if (!hasAuth('qm:batch:edit')) {
- return null;
- }
+ const editBtn = () => {
+ if (!hasAuth('qm:batch:edit')) {
+ return null;
+ }
+ return (
+ <ButtonIcon
+ text
+ type="primary"
+ icon="material-symbols:drive-file-rename-outline-outline"
+ tooltipContent={$t('common.edit')}
+ onClick={() => edit(row.id)}
+ />
+ );
+ };
+
+ const deleteBtn = () => {
+ if (!hasAuth('qm:batch:remove')) {
+ return null;
+ }
+ return (
+ <ButtonIcon
+ text
+ type="error"
+ icon="material-symbols:delete-outline"
+ tooltipContent={$t('common.delete')}
+ popconfirmContent={$t('common.confirmDelete')}
+ onPositiveClick={() => handleDelete(row.id)}
+ />
+ );
+ };
+
return (
- <ButtonIcon
- text
- type="primary"
- icon="material-symbols:drive-file-rename-outline-outline"
- tooltipContent={$t('common.edit')}
- onClick={() => edit(row.id)}
- />
+ <div class="flex-center gap-8px">
+ {editBtn()}
+ {divider()}
+ {deleteBtn()}
+ </div>
);
- };
-
- const deleteBtn = () => {
- if (!hasAuth('qm:batch:remove')) {
- return null;
- }
- return (
- <ButtonIcon
- text
- type="error"
- icon="material-symbols:delete-outline"
- tooltipContent={$t('common.delete')}
- popconfirmContent={$t('common.confirmDelete')}
- onPositiveClick={() => handleDelete(row.id)}
- />
- );
- };
-
- return (
- <div class="flex-center gap-8px">
- {editBtn()}
- {divider()}
- {deleteBtn()}
- </div>
- );
+ }
}
- }
- ]
-});
+ ]
+ });
const { drawerVisible, operateType, editingData, handleAdd, handleEdit, checkedRowKeys, onBatchDeleted, onDeleted } =
useTableOperate(data, 'id', getData);
--
Gitblit v1.9.3