From f30af5243423bafd4b79ad9ec448db327cda89f0 Mon Sep 17 00:00:00 2001 From: ck_yeun9 Date: Sat, 24 Jan 2026 13:45:50 +0800 Subject: [PATCH 01/10] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E9=80=89=E6=8B=A9=E5=92=8C=E5=88=A0=E9=99=A4=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E6=9B=B4=E6=96=B0=E9=83=A8=E9=97=A8=E8=A7=86?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/departmentapi.js | 2 +- src/entities/common.entity.js | 1 + src/entities/department.entity.js | 23 ++- src/i18n.js | 9 + src/views/base/DepartmentView.vue | 262 ++++++++++++++++++++++++++---- 5 files changed, 254 insertions(+), 43 deletions(-) diff --git a/src/api/departmentapi.js b/src/api/departmentapi.js index b2b6cc2..060545a 100644 --- a/src/api/departmentapi.js +++ b/src/api/departmentapi.js @@ -33,7 +33,7 @@ export const updateDepartment = async (data) => { // 删除部门 export const deleteDepartment = async (data) => { try { - const response = await api.post(`/Base/DelDept`, data); + const response = await api.post(`/Base/DelDept`, { data }); return response.data; } catch (error) { throw error; diff --git a/src/entities/common.entity.js b/src/entities/common.entity.js index 5f55dd4..bf46bef 100644 --- a/src/entities/common.entity.js +++ b/src/entities/common.entity.js @@ -7,6 +7,7 @@ export const BaseFields = { PAGE: "Page", PAGE_SIZE: "PageSize", VERSION: "RowVersion", + SELECTED: "selected", }; export const BaseInitialValues = { diff --git a/src/entities/department.entity.js b/src/entities/department.entity.js index 704861a..b73d32b 100644 --- a/src/entities/department.entity.js +++ b/src/entities/department.entity.js @@ -34,13 +34,24 @@ export const initialFormValues = { }, }; -export const getColumns = (t) => [ +export const getColumns = (t, handleView) => [ + { + title: "", + dataIndex: "selection", + key: "selection", + width: 50, + }, + { + title: t("message.action"), + key: "action", + width: 100, + }, { title: t("message.departmentNo"), dataIndex: DepartmentFields.NUMBER, key: DepartmentFields.NUMBER, sorter: (a, b) => - a[DepartmentFields.NUMBER].localeCompare(b[DepartmentFields.NUMBER]), + a[DepartmentFields.NUMBER]?.localeCompare(b[DepartmentFields.NUMBER]), defaultSortOrder: "ascend", }, { @@ -67,11 +78,7 @@ export const getColumns = (t) => [ title: t("message.departmentDate"), dataIndex: DepartmentFields.CREATIONDATE, key: DepartmentFields.CREATIONDATE, - }, - { - title: t("message.operation"), - key: "operation", - }, + } ]; export const getFormRules = (t) => ({ @@ -82,4 +89,4 @@ export const getFormRules = (t) => ({ trigger: "blur", }, ], -}); +}); \ No newline at end of file diff --git a/src/i18n.js b/src/i18n.js index 615a6b0..fa16c85 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -65,6 +65,9 @@ const messages = { backToHome: "Back to Home Page", isDeleted: "Is Deleted?", areYouSureToDeleteRecord: "Are you sure to delete this record?", + areYouSureToDeleteSelectedRecords: + "Are you sure to delete selected records?", + action: "Action", areYouSureToRestoreRecord: "Are you sure to restore this record?", checkUsernameAndPassword: "Please check username and password", fetchDataFailed: "Fetch Data Failed", @@ -150,6 +153,8 @@ const messages = { department: "Department Management", insertDepartment: "Create Department", updateDepartment: "Edit Department", + viewDepartment: "View Department", + deleteDepartment: "Delete Department", pleaseInputDepartmentName: "Please input department name", pleaseInputDepartmentNo: "Please input department no", pleaseInputDepartmentLeader: "Please select department leader", @@ -681,6 +686,8 @@ const messages = { isDeleted: "已删除?", undefined: "未定义", areYouSureToDeleteRecord: "确定要删除这条记录吗?", + areYouSureToDeleteSelectedRecords: "确定要删除选中的记录吗?", + action: "操作", areYouSureToRestoreRecord: "确定要恢复这条记录吗?", checkUsernameAndPassword: "请检查用户名和密码", fetchDataFailed: "获取数据失败", @@ -769,6 +776,8 @@ const messages = { department: "部门管理", insertDepartment: "添加部门", updateDepartment: "编辑部门", + viewDepartment: "查看部门", + deleteDepartment: "删除部门", pleaseInputDepartmentName: "请输入部门名称", pleaseInputDepartmentNo: "请输入部门编号", pleaseInputDepartmentLeader: "请输入部门主管", diff --git a/src/views/base/DepartmentView.vue b/src/views/base/DepartmentView.vue index 0882e06..8b4506e 100644 --- a/src/views/base/DepartmentView.vue +++ b/src/views/base/DepartmentView.vue @@ -1,18 +1,44 @@