feat: 优化 system
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import type { VbenFormSchema } from '#/adapter/form';
|
||||
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||
import type { DescriptionItemSchema } from '#/components/description';
|
||||
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import { getSimpleUserList } from '#/api/system/user';
|
||||
import { getRangePickerDefaultProps } from '#/utils';
|
||||
@@ -113,3 +116,68 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** 详情页的字段 */
|
||||
export function useDetailSchema(): DescriptionItemSchema[] {
|
||||
return [
|
||||
{
|
||||
field: 'id',
|
||||
label: '日志编号',
|
||||
},
|
||||
{
|
||||
field: 'traceId',
|
||||
label: '链路追踪',
|
||||
content: (data) => data?.traceId || '',
|
||||
},
|
||||
{
|
||||
field: 'userId',
|
||||
label: '操作人编号',
|
||||
},
|
||||
{
|
||||
field: 'userName',
|
||||
label: '操作人名字',
|
||||
},
|
||||
{
|
||||
field: 'userIp',
|
||||
label: '操作人IP',
|
||||
},
|
||||
{
|
||||
field: 'userAgent',
|
||||
label: '操作人UA',
|
||||
},
|
||||
{
|
||||
field: 'type',
|
||||
label: '操作模块',
|
||||
},
|
||||
{
|
||||
field: 'subType',
|
||||
label: '操作名',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
label: '操作内容',
|
||||
},
|
||||
{
|
||||
field: 'extra',
|
||||
label: '操作拓展参数',
|
||||
},
|
||||
{
|
||||
field: 'requestUrl',
|
||||
label: '请求URL',
|
||||
content: (data) => {
|
||||
const method = data?.requestMethod || '';
|
||||
const url = data?.requestUrl || '';
|
||||
return `${method} ${url}`.trim();
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
label: '操作时间',
|
||||
content: (data) => formatDateTime(data?.createTime || '') as string,
|
||||
},
|
||||
{
|
||||
field: 'bizId',
|
||||
label: '业务编号',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -4,12 +4,22 @@ import type { SystemOperateLogApi } from '#/api/system/operate-log';
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { formatDateTime } from '@vben/utils';
|
||||
|
||||
import { Descriptions } from 'ant-design-vue';
|
||||
import { useDescription } from '#/components/description';
|
||||
|
||||
import { useDetailSchema } from '../data';
|
||||
|
||||
const formData = ref<SystemOperateLogApi.OperateLog>();
|
||||
|
||||
const [Descriptions] = useDescription({
|
||||
componentProps: {
|
||||
bordered: true,
|
||||
column: 1,
|
||||
class: 'mx-4',
|
||||
},
|
||||
schema: useDetailSchema(),
|
||||
});
|
||||
|
||||
const [Modal, modalApi] = useVbenModal({
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (!isOpen) {
|
||||
@@ -38,52 +48,6 @@ const [Modal, modalApi] = useVbenModal({
|
||||
:show-cancel-button="false"
|
||||
:show-confirm-button="false"
|
||||
>
|
||||
<Descriptions
|
||||
bordered
|
||||
:column="1"
|
||||
size="middle"
|
||||
class="mx-4"
|
||||
:label-style="{ width: '110px' }"
|
||||
>
|
||||
<Descriptions.Item label="日志编号">
|
||||
{{ formData?.id }}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="链路追踪" v-if="formData?.traceId">
|
||||
{{ formData?.traceId }}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="操作人编号">
|
||||
{{ formData?.userId }}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="操作人名字">
|
||||
{{ formData?.userName }}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="操作人IP">
|
||||
{{ formData?.userIp }}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="操作人UA">
|
||||
{{ formData?.userAgent }}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="操作模块">
|
||||
{{ formData?.type }}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="操作名">
|
||||
{{ formData?.subType }}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="操作内容">
|
||||
{{ formData?.action }}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item v-if="formData?.extra" label="操作拓展参数">
|
||||
{{ formData?.extra }}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="请求URL">
|
||||
{{ formData?.requestMethod }} {{ formData?.requestUrl }}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="操作时间">
|
||||
{{ formatDateTime(formData?.createTime || '') }}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="业务编号">
|
||||
{{ formData?.bizId }}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
<Descriptions :data="formData" />
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user