Skip to content

Commit

Permalink
style: 🎨修改代码格式
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Dec 23, 2021
1 parent ae2615d commit 84d85b9
Show file tree
Hide file tree
Showing 13 changed files with 381 additions and 400 deletions.
4 changes: 2 additions & 2 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
ENV = 'production'

# base api
VUE_APP_BASE_API = 'http://buqiyuan.site:7001/admin/'
VUE_APP_BASE_API = 'http://175.24.200.3:7001/admin/'
VUE_APP_BASE_SOCKET_PATH = '/ws-api'
VUE_APP_BASE_SOCKET_NSP = 'ws://buqiyuan.site:7002/admin'
VUE_APP_BASE_SOCKET_NSP = 'ws://175.24.200.3:7002/admin'

# 网站前缀
BASE_URL = /vue3-antd-admin/
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@commitlint/cli": "^15.0.0",
"@commitlint/config-conventional": "^15.0.0",
"@types/lodash": "^4.14.178",
"@types/node": "^17.0.2",
"@types/node": "^17.0.3",
"@types/webpack-env": "^1.16.3",
"@typescript-eslint/eslint-plugin": "^5.8.0",
"@typescript-eslint/parser": "^5.8.0",
Expand Down
15 changes: 10 additions & 5 deletions src/api/system/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ export function updateUser(data: API.UpdateAdminInfoParams) {
}

export function updateUserPassword(data: API.UpdateAdminUserPassword) {
return request({
url: Api.password,
method: 'post',
data,
});
return request(
{
url: Api.password,
method: 'post',
data,
},
{
successMsg: '操作成功',
},
);
}

export function deleteUsers(data: { userIds: number[] }) {
Expand Down
147 changes: 57 additions & 90 deletions src/views/system/permission/menu/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import type { TableColumn } from '@/components/dynamic-table';
// import { Avatar, Space, Tag } from 'ant-design-vue';

export type TableListItem = API.MenuListResultItem;

interface ColumnsParams {
openMenuModal: (record: TableListItem) => void;
delRowConfirm: (record: TableListItem) => void;
}
export type TableColumnItem = TableColumn<TableListItem>;

/**
* 将对应菜单类型转为字符串字意
Expand All @@ -24,88 +20,59 @@ const getMenuType = (type) => {
}
};

export const getColumns = (columnParams: ColumnsParams): TableColumn<TableListItem>[] => {
const { delRowConfirm, openMenuModal } = columnParams;
return [
{
title: '名称',
dataIndex: 'name',
},
{
title: '图标',
width: 80,
dataIndex: 'icon',
align: 'center',
bodyCell: ({ record }) => <>{record.icon && <icon-font type={record.icon} size="22" />}</>,
},
{
title: '类型',
width: 80,
align: 'center',
dataIndex: 'type',
bodyCell: ({ record }) => <>{getMenuType(record.type)}</>,
},
{
title: '节点路由',
dataIndex: 'router',
align: 'center',
width: 240,
},
{
title: '路由缓存',
dataIndex: 'keepalive',
align: 'center',
width: 80,
},
{
title: '文件路径',
width: 280,
align: 'center',
dataIndex: 'viewPath',
},
{
title: '权限',
width: 300,
align: 'center',
dataIndex: 'perms',
},
{
title: '排序号',
width: 80,
align: 'center',
dataIndex: 'orderNum',
},
{
title: '更新时间',
width: 180,
align: 'center',
dataIndex: 'updatedAt',
},
{
title: '操作',
width: 160,
dataIndex: '$action',
hideInSearch: true,
align: 'center',
fixed: 'right',
actions: ({ record }) => [
{
label: '编辑',
auth: {
perm: 'sys/menu/update',
effect: 'disable',
},
onClick: () => openMenuModal(record),
},
{
label: '删除',
auth: 'sys/menu/delete',
popConfirm: {
title: '你确定要删除吗?',
onConfirm: () => delRowConfirm(record),
},
},
],
},
];
};
export const baseColumns: TableColumnItem[] = [
{
title: '名称',
dataIndex: 'name',
},
{
title: '图标',
width: 80,
dataIndex: 'icon',
align: 'center',
bodyCell: ({ record }) => <>{record.icon && <icon-font type={record.icon} size="22" />}</>,
},
{
title: '类型',
width: 80,
align: 'center',
dataIndex: 'type',
bodyCell: ({ record }) => <>{getMenuType(record.type)}</>,
},
{
title: '节点路由',
dataIndex: 'router',
align: 'center',
width: 240,
},
{
title: '路由缓存',
dataIndex: 'keepalive',
align: 'center',
width: 80,
},
{
title: '文件路径',
width: 280,
align: 'center',
dataIndex: 'viewPath',
},
{
title: '权限',
width: 300,
align: 'center',
dataIndex: 'perms',
},
{
title: '排序号',
width: 80,
align: 'center',
dataIndex: 'orderNum',
},
{
title: '更新时间',
width: 180,
align: 'center',
dataIndex: 'updatedAt',
},
];
32 changes: 30 additions & 2 deletions src/views/system/permission/menu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import { getMenuList, updateMenu, createMenu, deleteMenu } from '@/api/system/menu';
import { DynamicTable } from '@/components/dynamic-table';
import { useFormModal } from '@/hooks/useModal/useFormModal';
import { getColumns, TableListItem } from './columns';
import { baseColumns, type TableListItem, type TableColumnItem } from './columns';
import { menuSchemas } from './formSchemas';
import { formatMenu2Tree } from '@/core/permission/utils';
import { cloneDeep } from 'lodash';
Expand Down Expand Up @@ -94,5 +94,33 @@
dynamicTableRef.value?.refreshTable();
};
const columns = getColumns({ openMenuModal, delRowConfirm });
const columns: TableColumnItem[] = [
...baseColumns,
{
title: '操作',
width: 160,
dataIndex: '$action',
hideInSearch: true,
align: 'center',
fixed: 'right',
actions: ({ record }) => [
{
label: '编辑',
auth: {
perm: 'sys/menu/update',
effect: 'disable',
},
onClick: () => openMenuModal(record),
},
{
label: '删除',
auth: 'sys/menu/delete',
popConfirm: {
title: '你确定要删除吗?',
onConfirm: () => delRowConfirm(record),
},
},
],
},
];
</script>
111 changes: 39 additions & 72 deletions src/views/system/permission/role/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,43 @@ import type { TableColumn } from '@/components/dynamic-table';
// import { Avatar, Space, Tag } from 'ant-design-vue';

export type TableListItem = API.RoleListResultItem;
export type TableColumnItem = TableColumn<TableListItem>;

interface ColumnsParams {
openMenuModal: (record: TableListItem) => void;
delRowConfirm: (record: TableListItem) => void;
}

export const getColumns = (columnParams: ColumnsParams): TableColumn<TableListItem>[] => {
const { delRowConfirm, openMenuModal } = columnParams;
return [
{
title: '#',
dataIndex: 'id',
width: 55,
align: 'center',
hideInSearch: true,
},
{
title: '名称',
width: 200,
align: 'center',
dataIndex: 'name',
},
{
title: '标识',
width: 80,
align: 'center',
dataIndex: 'label',
},
{
title: '备注',
dataIndex: 'remark',
align: 'center',
},
{
title: '创建时间',
dataIndex: 'createdAt',
align: 'center',
hideInSearch: true,
},
{
title: '更新时间',
align: 'center',
dataIndex: 'updatedAt',
hideInSearch: true,
},
{
title: '操作',
width: 160,
dataIndex: '$action',
hideInSearch: true,
align: 'center',
fixed: 'right',
actions: ({ record }) => [
{
label: '编辑',
auth: {
perm: 'sys/role/update',
effect: 'disable',
},
onClick: () => openMenuModal(record),
},
{
label: '删除',
auth: 'sys/role/delete',
popConfirm: {
title: '你确定要删除吗?',
onConfirm: () => delRowConfirm(record),
},
},
],
},
];
};
export const baseColumns: TableColumnItem[] = [
{
title: '#',
dataIndex: 'id',
width: 55,
align: 'center',
hideInSearch: true,
},
{
title: '名称',
width: 200,
align: 'center',
dataIndex: 'name',
},
{
title: '标识',
width: 80,
align: 'center',
dataIndex: 'label',
},
{
title: '备注',
dataIndex: 'remark',
align: 'center',
},
{
title: '创建时间',
dataIndex: 'createdAt',
align: 'center',
hideInSearch: true,
},
{
title: '更新时间',
align: 'center',
dataIndex: 'updatedAt',
hideInSearch: true,
},
];
Loading

0 comments on commit 84d85b9

Please sign in to comment.