Browse Source

🎟 构建平台业务模块

master
wangxiang 3 years ago
parent
commit
c0ccf056ad
  1. 2
      kicc-ui/src/api/system/role.ts
  2. 1
      kicc-ui/src/views/system/role/index.vue
  3. 16
      kicc-ui/src/views/system/role/role.data.ts

2
kicc-ui/src/api/system/role.ts

@ -26,4 +26,4 @@ export const getRole = (params: { id: String }) => defHttp.get<Role>({ url: `${A
export const delRole = (params: { id: String }) => defHttp.delete({ url: `${Api.del}/${params.id}` }); export const delRole = (params: { id: String }) => defHttp.delete({ url: `${Api.del}/${params.id}` });
// 修改角色状态 // 修改角色状态
export const changeStatus = (params: Partial<Role>) => defHttp.post({ url: Api.changeStatus, data: params }); export const changeStatus = (id: string, status: string) => defHttp.put({ url: Api.changeStatus, data: { id: id, status: status } });

1
kicc-ui/src/views/system/role/index.vue

@ -77,6 +77,7 @@
bordered: true, bordered: true,
rowSelection: { type: 'checkbox' }, rowSelection: { type: 'checkbox' },
showIndexColumn: false, showIndexColumn: false,
clickToRowSelect: false,
actionColumn: { actionColumn: {
width: 220, width: 220,
title: '操作', title: '操作',

16
kicc-ui/src/views/system/role/role.data.ts

@ -8,7 +8,7 @@
import { BasicColumn } from '/@/components/Table'; import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table'; import { FormSchema } from '/@/components/Table';
import { h } from 'vue'; import { h } from 'vue';
import { Switch } from 'ant-design-vue'; import { Switch, Tag } from 'ant-design-vue';
import { changeStatus } from '/@/api/system/role'; import { changeStatus } from '/@/api/system/role';
import { useMessage } from '/@/hooks/web/useMessage'; import { useMessage } from '/@/hooks/web/useMessage';
const { createConfirm } = useMessage(); const { createConfirm } = useMessage();
@ -22,7 +22,7 @@ export const columns: BasicColumn[] = [
{ {
title: '显示顺序', title: '显示顺序',
dataIndex: 'sort', dataIndex: 'sort',
width: 50, width: 200,
}, },
{ {
title: '状态', title: '状态',
@ -48,14 +48,12 @@ export const columns: BasicColumn[] = [
record.pendingStatus = true; record.pendingStatus = true;
const newStatus = checked ? '0' : '1'; const newStatus = checked ? '0' : '1';
const { createMessage } = useMessage(); const { createMessage } = useMessage();
changeStatus({ id: record.id, status: newStatus }).then(() => { changeStatus(record.id, newStatus).then(() => {
record.status = newStatus; record.status = newStatus;
createMessage.success(`${text}成功`); createMessage.success(`${text}成功`);
}).catch(() => { }).catch(() => {
createMessage.error(`${text}失败`); createMessage.error(`${text}失败`);
}).finally(() => { }).finally(() => record.pendingStatus = false);
record.pendingStatus = false;
});
} }
}); });
} }
@ -65,11 +63,13 @@ export const columns: BasicColumn[] = [
{ {
title: '备注', title: '备注',
dataIndex: 'remarks', dataIndex: 'remarks',
customRender: ({record}) => {
return record.remarks || h(Tag, { color: 'red' }, () => '暂无数据');
}
}, },
{ {
title: '创建时间', title: '创建时间',
dataIndex: 'createTime', dataIndex: 'createTime'
width: 180,
}, },
]; ];

Loading…
Cancel
Save