Commit dbe4f6d5897c7558ef0584a35b35b75f047b1f29

Authored by loveumiko
1 parent 9d2453cd

feat/新增菜单客户租户

  1 +import { AccountParams } from './model/systemModel';
  2 +import { defHttp } from '/@/utils/http/axios';
  3 +enum Api {
  4 + TENANT_List = '/user/tenantt/page',
  5 +}
  6 +
  7 +export const getTenantList = (params: AccountParams) => {
  8 + const url = Api.TENANT_List;
  9 + return defHttp.get({ url: url, params });
  10 +};
1 import { BasicColumn, FormSchema } from '/@/components/Table'; 1 import { BasicColumn, FormSchema } from '/@/components/Table';
2 2
3 -export const searchFormSchema: FormSchema[] = [ 3 +export const columns: BasicColumn[] = [
4 { 4 {
5 - field: 'roleName',  
6 - label: '角色名称',  
7 - component: 'Input',  
8 - colProps: { span: 6 },  
9 - componentProps: {  
10 - maxLength: 255,  
11 - }, 5 + title: '用户名',
  6 + dataIndex: 'username',
  7 + width: 120,
12 }, 8 },
13 { 9 {
14 - field: 'status',  
15 - label: '状态',  
16 - component: 'Select',  
17 - componentProps: {  
18 - options: [  
19 - { label: '启用', value: 1 },  
20 - { label: '停用', value: 0 },  
21 - ],  
22 - },  
23 - colProps: { span: 6 }, 10 + title: '姓名',
  11 + dataIndex: 'realName',
  12 + width: 120,
24 }, 13 },
25 -];  
26 -  
27 -export const columns: BasicColumn[] = [  
28 { 14 {
29 - title: '角色名称',  
30 - dataIndex: 'name',  
31 - width: 200, 15 + title: '手机号码',
  16 + dataIndex: 'phoneNumber',
  17 + width: 120,
32 }, 18 },
33 { 19 {
34 - title: '角色Code',  
35 - dataIndex: 'code',  
36 - width: 200, 20 + title: '邮箱',
  21 + dataIndex: 'email',
  22 + width: 120,
  23 + },
  24 + {
  25 + title: '创建时间',
  26 + dataIndex: 'createTime',
  27 + width: 180,
37 }, 28 },
38 { 29 {
39 title: '状态', 30 title: '状态',
40 - dataIndex: 'status', 31 + dataIndex: 'userStatusEnum',
41 width: 120, 32 width: 120,
42 slots: { customRender: 'status' }, 33 slots: { customRender: 'status' },
43 }, 34 },
  35 +];
44 36
  37 +export const searchFormSchema: FormSchema[] = [
45 { 38 {
46 - title: '备注',  
47 - dataIndex: 'remark',  
48 - width: 240, 39 + field: 'username',
  40 + label: '用户名',
  41 + component: 'Input',
  42 + colProps: { span: 8 },
  43 + componentProps: {
  44 + maxLength: 255,
  45 + placeholder: '请输入用户名',
  46 + },
49 }, 47 },
50 { 48 {
51 - title: '创建时间',  
52 - dataIndex: 'createTime',  
53 - width: 180, 49 + field: 'realName',
  50 + label: '姓名',
  51 + component: 'Input',
  52 + colProps: { span: 8 },
  53 + componentProps: {
  54 + maxLength: 255,
  55 + placeholder: '请输入姓名',
  56 + },
54 }, 57 },
55 ]; 58 ];
1 <template> 1 <template>
2 - <div>123 </div> 2 + <div>
  3 + <BasicTable style="flex: auto" :clickToRowSelect="false" @register="registerTable">
  4 + <template #toolbar>
  5 + <Authority value="api:yt:user:post">
  6 + <a-button type="primary" @click="handleCreate">新增账号</a-button>
  7 + </Authority>
  8 + <Authority value="api:yt:user:delete">
  9 + <Popconfirm
  10 + title="您确定要批量删除数据"
  11 + ok-text="确定"
  12 + cancel-text="取消"
  13 + @confirm="() => {}"
  14 + >
  15 + <a-button color="error"> 批量删除 </a-button>
  16 + </Popconfirm>
  17 + </Authority>
  18 + </template>
  19 + <template #status="{ record }">
  20 + <Tag
  21 + :color="
  22 + record.userStatusEnum === 'NORMAL'
  23 + ? 'green'
  24 + : record.userStatusEnum === 'DISABLED'
  25 + ? 'red'
  26 + : 'orange'
  27 + "
  28 + >
  29 + {{
  30 + record.userStatusEnum === 'NORMAL'
  31 + ? '正常'
  32 + : record.userStatusEnum === 'DISABLED'
  33 + ? '已禁用'
  34 + : '已过期'
  35 + }}
  36 + </Tag>
  37 + </template>
  38 + <template #action="{ record }">
  39 + <TableAction
  40 + :actions="[
  41 + // {
  42 + // label: '进入',
  43 + // icon: 'ant-design:login-outlined',
  44 + // tooltip: `以${!isAdmin(role) ? '客户' : '平台'}用户身份登录`,
  45 + // onClick: handleLoginCustomAdmin.bind(null, record),
  46 + // },
  47 + {
  48 + label: '用户详情',
  49 + auth: 'api:yt:user:get',
  50 + icon: 'clarity:info-standard-line',
  51 + tooltip: '用户详情',
  52 + onClick: handledetail.bind(null, record),
  53 + ifShow: record.level != 0,
  54 + },
  55 + {
  56 + label: '编辑',
  57 + auth: 'api:yt:user:update',
  58 + icon: 'clarity:note-edit-line',
  59 + tooltip: '编辑',
  60 + onClick: handleEdit.bind(null, record),
  61 + ifShow: record.level != 0,
  62 + },
  63 + ]"
  64 + :drop-down-actions="[
  65 + {
  66 + label: '删除',
  67 + auth: 'api:yt:user:delete',
  68 + icon: 'ant-design:delete-outlined',
  69 + color: 'error',
  70 + tooltip: '删除',
  71 + ifShow: record.level != 0,
  72 + popConfirm: {
  73 + title: '是否确认删除',
  74 + confirm: handleDeleteOrBatchDelete.bind(null, record),
  75 + },
  76 + },
  77 + {
  78 + label: '清除密码',
  79 + auth: 'api:yt:user:resetPassword',
  80 + icon: 'ant-design:delete-outlined',
  81 + color: 'error',
  82 + tooltip: '清除密码',
  83 + popConfirm: {
  84 + title: '是否确认清除密码',
  85 + confirm: handleClearPassword.bind(null, record),
  86 + },
  87 + },
  88 + ]"
  89 + />
  90 + </template>
  91 + </BasicTable>
  92 + </div>
3 </template> 93 </template>
4 94
5 -<script lang="ts" setup></script> 95 +<script lang="ts" setup>
  96 + import { BasicTable, useTable, TableAction } from '/@/components/Table';
  97 + import { getTenantList } from '/@/api/system/account';
  98 + import { columns, searchFormSchema } from './config';
  99 + // import { useResetOrganizationTree } from '/@/views/common/organizationIdTree';
  100 + import { reactive } from 'vue';
  101 + import { Authority } from '/@/components/Authority';
  102 +
  103 + const searchInfo = reactive<Recordable>({});
  104 +
  105 + // const { organizationIdTreeRef, resetFn } = useResetOrganizationTree(searchInfo);
  106 +
  107 + const [registerTable, {}] = useTable({
  108 + title: '租户账号列表',
  109 + columns,
  110 + api: getTenantList,
  111 + formConfig: {
  112 + labelWidth: 100,
  113 + schemas: searchFormSchema,
  114 + // resetFunc: resetFn,
  115 + },
  116 + useSearchForm: true,
  117 + showTableSetting: true,
  118 + bordered: true,
  119 + showIndexColumn: false,
  120 + rowKey: 'id',
  121 + searchInfo: searchInfo,
  122 + clickToRowSelect: false,
  123 + actionColumn: {
  124 + width: 200,
  125 + title: '操作',
  126 + slots: { customRender: 'action' },
  127 + fixed: 'right',
  128 + },
  129 + });
  130 +
  131 + const handleCreate = () => {};
  132 + const handledetail = (_data?: any[]) => {};
  133 + const handleEdit = (_data?: any[]) => {};
  134 + const handleDeleteOrBatchDelete = (_data?: any[]) => {};
  135 + const handleClearPassword = (_data?: any[]) => {};
  136 +</script>