From c0ccf056ad649000271c356027e2c0bc5efd51f8 Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Fri, 22 Apr 2022 02:38:05 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=9F=20=E6=9E=84=E5=BB=BA=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E4=B8=9A=E5=8A=A1=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kicc-ui/src/api/system/role.ts | 2 +- kicc-ui/src/views/system/role/index.vue | 1 + kicc-ui/src/views/system/role/role.data.ts | 16 ++++++++-------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/kicc-ui/src/api/system/role.ts b/kicc-ui/src/api/system/role.ts index 611442d9..bab2a48b 100644 --- a/kicc-ui/src/api/system/role.ts +++ b/kicc-ui/src/api/system/role.ts @@ -26,4 +26,4 @@ export const getRole = (params: { id: String }) => defHttp.get({ url: `${A export const delRole = (params: { id: String }) => defHttp.delete({ url: `${Api.del}/${params.id}` }); // 修改角色状态 -export const changeStatus = (params: Partial) => defHttp.post({ url: Api.changeStatus, data: params }); +export const changeStatus = (id: string, status: string) => defHttp.put({ url: Api.changeStatus, data: { id: id, status: status } }); diff --git a/kicc-ui/src/views/system/role/index.vue b/kicc-ui/src/views/system/role/index.vue index 1d0d9148..f1cb9bd4 100644 --- a/kicc-ui/src/views/system/role/index.vue +++ b/kicc-ui/src/views/system/role/index.vue @@ -77,6 +77,7 @@ bordered: true, rowSelection: { type: 'checkbox' }, showIndexColumn: false, + clickToRowSelect: false, actionColumn: { width: 220, title: '操作', diff --git a/kicc-ui/src/views/system/role/role.data.ts b/kicc-ui/src/views/system/role/role.data.ts index 5d7a3605..ff4bb05b 100644 --- a/kicc-ui/src/views/system/role/role.data.ts +++ b/kicc-ui/src/views/system/role/role.data.ts @@ -8,7 +8,7 @@ import { BasicColumn } from '/@/components/Table'; import { FormSchema } from '/@/components/Table'; import { h } from 'vue'; -import { Switch } from 'ant-design-vue'; +import { Switch, Tag } from 'ant-design-vue'; import { changeStatus } from '/@/api/system/role'; import { useMessage } from '/@/hooks/web/useMessage'; const { createConfirm } = useMessage(); @@ -22,7 +22,7 @@ export const columns: BasicColumn[] = [ { title: '显示顺序', dataIndex: 'sort', - width: 50, + width: 200, }, { title: '状态', @@ -48,14 +48,12 @@ export const columns: BasicColumn[] = [ record.pendingStatus = true; const newStatus = checked ? '0' : '1'; const { createMessage } = useMessage(); - changeStatus({ id: record.id, status: newStatus }).then(() => { + changeStatus(record.id, newStatus).then(() => { record.status = newStatus; createMessage.success(`${text}成功`); }).catch(() => { createMessage.error(`${text}失败`); - }).finally(() => { - record.pendingStatus = false; - }); + }).finally(() => record.pendingStatus = false); } }); } @@ -65,11 +63,13 @@ export const columns: BasicColumn[] = [ { title: '备注', dataIndex: 'remarks', + customRender: ({record}) => { + return record.remarks || h(Tag, { color: 'red' }, () => '暂无数据'); + } }, { title: '创建时间', - dataIndex: 'createTime', - width: 180, + dataIndex: 'createTime' }, ];