From f12af238f4935712e7a0fa5d88e63055a2d20a8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=B2=E4=B9=88=E4=BA=86?= Date: Fri, 26 Jan 2024 09:08:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8A=B6=E6=80=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/auth/role/index.vue | 15 ++++++- src/views/auth/userList/index.vue | 46 ++++++++++----------- src/views/setting/dictionary/list/index.vue | 11 ++++- src/views/setting/dictionary/tree/index.vue | 7 +--- 4 files changed, 47 insertions(+), 32 deletions(-) diff --git a/src/views/auth/role/index.vue b/src/views/auth/role/index.vue index 7fb58c8..dc25107 100644 --- a/src/views/auth/role/index.vue +++ b/src/views/auth/role/index.vue @@ -54,7 +54,20 @@ const tableStore = new TableStore({ { title: '角色名称', field: 'name', align: 'center' }, { title: '角色编码', field: 'code', align: 'center' }, { title: '备注', field: 'remark', align: 'center' }, - { title: '状态', field: 'state', align: 'center' }, + { + title: '状态', + field: 'state', + width: '80', + render: 'tag', + custom: { + 0: 'danger', + 1: 'success', + }, + replaceValue: { + 0: '注销', + 1: '正常', + } + }, { title: '操作', align: 'center', diff --git a/src/views/auth/userList/index.vue b/src/views/auth/userList/index.vue index e2f51f7..df3cc52 100644 --- a/src/views/auth/userList/index.vue +++ b/src/views/auth/userList/index.vue @@ -68,7 +68,28 @@ const tableStore = new TableStore({ { title: '注册时间', field: 'registerTime', minWidth: '130' }, { title: '登录时间', field: 'loginTime', minWidth: '130' }, { title: '类型', field: 'casualUserName', minWidth: '80' }, - { title: '状态', field: 'stateName', minWidth: '80' }, + { + title: '状态', + field: 'state', + width: '80', + render: 'tag', + custom: { + 0: 'danger', + 1: 'success', + 2: 'warning', + 3: 'warning', + 4: 'info', + 5: 'danger' + }, + replaceValue: { + 0: '注销', + 1: '正常', + 2: '锁定', + 3: '待审核', + 4: '休眠', + 5: '密码过期' + } + }, { title: '操作', width: '180', @@ -166,29 +187,6 @@ const tableStore = new TableStore({ item.casualUserName = '/' break } - switch (item.state) { - case 0: - item.stateName = '注销' - break - case 1: - item.stateName = '正常' - break - case 2: - item.stateName = '锁定' - break - case 3: - item.stateName = '待审核' - break - case 4: - item.stateName = '休眠' - break - case 5: - item.stateName = '密码过期' - break - default: - item.stateName = '/' - break - } }) } }) diff --git a/src/views/setting/dictionary/list/index.vue b/src/views/setting/dictionary/list/index.vue index c4c4c24..51fbe41 100644 --- a/src/views/setting/dictionary/list/index.vue +++ b/src/views/setting/dictionary/list/index.vue @@ -45,10 +45,19 @@ const tableStore = new TableStore({ { title: '编码', field: 'code' }, { title: '开启等级', field: 'openLevelName' }, { title: '开启算法', field: 'openDescribeName' }, - { title: '状态', field: 'stateName' }, { title: '字典描述', field: 'remark' }, { title: '创建时间', field: 'createTime' }, { title: '更新时间', field: 'updateTime' }, + { + title: '状态', + field: 'stateName', + width: '80', + render: 'tag', + custom: { + '正常': 'success', + '删除': 'danger' + }, + }, { title: '操作', width: '180', diff --git a/src/views/setting/dictionary/tree/index.vue b/src/views/setting/dictionary/tree/index.vue index 30cb37b..9330d8d 100644 --- a/src/views/setting/dictionary/tree/index.vue +++ b/src/views/setting/dictionary/tree/index.vue @@ -98,12 +98,7 @@ const tableStore = new TableStore({ } ] } - ], - loadCallback: () => { - tableStore.table.data.forEach((item: any) => { - item.statusName = item.status === 0 ? '正常' : item.status === 1 ? '停用' : '删除' - }) - } + ] }) provide('tableStore', tableStore)