From d143cfdef5ae5d8c7e254317e812b995ca0a7e5e Mon Sep 17 00:00:00 2001
From: Je <967707@dms.yudean.com>
Date: Tue, 14 Jan 2025 10:24:33 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E7=94=A8=E6=88=B7?=
=?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=BC=B9=E7=AA=97=EF=BC=8C=E5=88=A0=E9=99=A4?=
=?UTF-8?q?=E7=94=A8=E6=88=B7=E7=9A=84=E9=97=AE=E9=A2=98index=E7=9A=84?=
=?UTF-8?q?=E5=8F=96=E5=80=BC=E4=B8=8D=E5=AF=B9=E7=9A=84=EF=BC=8C=E6=9B=B4?=
=?UTF-8?q?=E6=96=B0=E4=B8=BArecord=E8=8E=B7=E5=8F=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../system/user/components/UserModal.vue | 48 ++++++++++---------
1 file changed, 25 insertions(+), 23 deletions(-)
diff --git a/src/views/system/user/components/UserModal.vue b/src/views/system/user/components/UserModal.vue
index a13d9a4..c6438ef 100644
--- a/src/views/system/user/components/UserModal.vue
+++ b/src/views/system/user/components/UserModal.vue
@@ -48,8 +48,8 @@
{{ column.customTitle }}
-
- 删除
+
+ 删除
@@ -61,8 +61,8 @@
{{ column.customTitle }}
-
- 删除
+
+ 删除
@@ -74,8 +74,8 @@
{{ column.customTitle }}
-
- 删除
+
+ 删除
@@ -87,8 +87,8 @@
{{ column.customTitle }}
-
- 删除
+
+ 删除
@@ -702,21 +702,23 @@
orgs: deptDatasource.value,
});
};
- const handleDelete = (index, type) => {
- switch (type) {
- case 1:
- roleDatasource.value.splice(index, 1);
- break;
- case 2:
- postDatasource.value.splice(index, 1);
- break;
- case 3:
- orgDatasource.value.splice(index, 1);
- break;
- case 4:
- deptDatasource.value.splice(index, 1);
- break;
- }
+ const handleDelete = (index, type, record) => {
+ // 映射不同类型对应的数据源
+ const dataSources = {
+ 1: roleDatasource,
+ 2: postDatasource,
+ 3: orgDatasource,
+ 4: deptDatasource,
+ };
+
+ // 获取对应的数据源
+ const dataSource = dataSources[type]?.value;
+ if (dataSource) {
+ const index = dataSource.findIndex(item => item.id === record.id);
+ if (index !== -1) {
+ dataSource.splice(index, 1);
+ }
+ }
};
const handleRoleSuccess = (data) => {