From 4e341517d907c66d93486be1351a267d763b4f5e Mon Sep 17 00:00:00 2001 From: xingyu Date: Tue, 21 Mar 2023 22:47:30 +0800 Subject: [PATCH] feat: views --- .../Table/src/components/TableAction.vue | 4 +- .../Table/src/hooks/useTableForm.ts | 1 + .../Tree/src/components/TreeHeader.vue | 2 +- .../setting/components/InputNumberItem.vue | 2 +- .../default/setting/components/SelectItem.vue | 9 +- src/layouts/default/tabs/index.vue | 1 - src/utils/http/axios/Axios.ts | 5 +- src/views/system/errorCode/index.vue | 2 +- src/views/system/menu/index.vue | 2 +- src/views/system/notice/index.vue | 2 +- src/views/system/operatelog/index.vue | 42 ++++++- .../system/operatelog/operateLog.data.ts | 106 ++++++++++++++++++ src/views/system/post/index.vue | 2 +- src/views/system/role/index.vue | 6 +- src/views/system/sensitiveWord/index.vue | 2 +- src/views/system/user/index.vue | 17 +-- src/views/system/user/user.data.ts | 8 +- 17 files changed, 174 insertions(+), 39 deletions(-) create mode 100644 src/views/system/operatelog/operateLog.data.ts diff --git a/src/components/Table/src/components/TableAction.vue b/src/components/Table/src/components/TableAction.vue index c1f649d2..194f813c 100644 --- a/src/components/Table/src/components/TableAction.vue +++ b/src/components/Table/src/components/TableAction.vue @@ -15,9 +15,7 @@ - - - + 更多 diff --git a/src/components/Table/src/hooks/useTableForm.ts b/src/components/Table/src/hooks/useTableForm.ts index 1af5b499..badba616 100644 --- a/src/components/Table/src/hooks/useTableForm.ts +++ b/src/components/Table/src/hooks/useTableForm.ts @@ -36,6 +36,7 @@ export function useTableForm( if (handleSearchInfoFn && isFunction(handleSearchInfoFn)) { info = handleSearchInfoFn(info) || info } + console.info(info) fetch({ searchInfo: info, page: 1 }) } diff --git a/src/components/Tree/src/components/TreeHeader.vue b/src/components/Tree/src/components/TreeHeader.vue index b7fb6abc..4a06a677 100644 --- a/src/components/Tree/src/components/TreeHeader.vue +++ b/src/components/Tree/src/components/TreeHeader.vue @@ -6,7 +6,7 @@
- +
diff --git a/src/layouts/default/setting/components/InputNumberItem.vue b/src/layouts/default/setting/components/InputNumberItem.vue index 4171f270..51012645 100644 --- a/src/layouts/default/setting/components/InputNumberItem.vue +++ b/src/layouts/default/setting/components/InputNumberItem.vue @@ -1,7 +1,7 @@ diff --git a/src/views/system/operatelog/operateLog.data.ts b/src/views/system/operatelog/operateLog.data.ts new file mode 100644 index 00000000..9a0b7051 --- /dev/null +++ b/src/views/system/operatelog/operateLog.data.ts @@ -0,0 +1,106 @@ +import { getIntDictOptions } from './../../../utils/dict' +import { BasicColumn, FormSchema, useRender } from '@/components/Table' +import { DICT_TYPE } from '@/utils/dict' +import { h } from 'vue' + +export const columns: BasicColumn[] = [ + { + title: '日志编号', + dataIndex: 'id', + width: 100 + }, + { + title: '操作模块', + dataIndex: 'module', + width: 120 + }, + { + title: '操作名', + dataIndex: 'name', + width: 180 + }, + { + title: '操作类型', + dataIndex: 'type', + width: 180, + customRender: ({ text }) => { + return useRender.renderDict(text, DICT_TYPE.SYSTEM_OPERATE_TYPE) + } + }, + { + title: '操作人', + dataIndex: 'userNickname', + width: 120 + }, + { + title: 'userAgent', + dataIndex: 'userAgent', + width: 400 + }, + { + title: '操作结果', + dataIndex: 'resultCode', + width: 180, + customRender: ({ text }) => { + return h('span', text === 0 ? '成功' : '失败') + } + }, + { + title: '操作日期', + dataIndex: 'startTime', + width: 180, + customRender: ({ text }) => { + return useRender.renderDate(text) + } + }, + { + title: '执行时长', + dataIndex: 'duration', + width: 180, + customRender: ({ text }) => { + return h('span', text + 'ms') + } + } +] + +export const searchFormSchema: FormSchema[] = [ + { + label: '系统模块', + field: 'title', + component: 'Input', + colProps: { span: 8 } + }, + { + label: '操作人员', + field: 'operName', + component: 'Input', + colProps: { span: 8 } + }, + { + label: '类型', + field: 'type', + component: 'Select', + componentProps: { + options: getIntDictOptions(DICT_TYPE.SYSTEM_OPERATE_TYPE) + }, + colProps: { span: 8 } + }, + { + label: '状态', + field: 'success', + component: 'Select', + componentProps: { + options: [ + { value: true, key: true, label: '成功' }, + { value: false, key: false, label: '失败' } + ] + }, + colProps: { span: 8 } + }, + { + label: '操作时间', + field: 'startTime', + component: 'RangePicker', + colProps: { span: 8 } + } +] diff --git a/src/views/system/post/index.vue b/src/views/system/post/index.vue index 778ef3fb..797cb5eb 100644 --- a/src/views/system/post/index.vue +++ b/src/views/system/post/index.vue @@ -56,7 +56,7 @@ const [registerTable, { getForm, reload }] = useTable({ showTableSetting: true, showIndexColumn: false, actionColumn: { - width: 120, + width: 160, title: '操作', dataIndex: 'action', fixed: 'right' diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index 77519787..e553b3b5 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -13,7 +13,9 @@ icon: 'clarity:note-edit-line', label: '修改', onClick: handleEdit.bind(null, record) - }, + } + ]" + :dropDownActions="[ { icon: 'clarity:note-edit-line', label: '菜单权限', @@ -66,7 +68,7 @@ const [registerTable, { getForm, reload }] = useTable({ showTableSetting: true, showIndexColumn: false, actionColumn: { - width: 240, + width: 160, title: '操作', dataIndex: 'action', fixed: 'right' diff --git a/src/views/system/sensitiveWord/index.vue b/src/views/system/sensitiveWord/index.vue index 75283b66..b6066321 100644 --- a/src/views/system/sensitiveWord/index.vue +++ b/src/views/system/sensitiveWord/index.vue @@ -61,7 +61,7 @@ const [registerTable, { getForm, reload }] = useTable({ showTableSetting: true, showIndexColumn: false, actionColumn: { - width: 120, + width: 160, title: '操作', dataIndex: 'action', fixed: 'right' diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index ee2e9ac7..56b01bf6 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -30,7 +30,7 @@ - +