| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- import { BasicColumn, FormSchema } from '/@/components/Table';
- import moment from 'moment';
- import { findDictItemByCode } from '/@/api/system/dict';
- import { format } from '../util';
- import { Tag } from 'ant-design-vue';
- import { h } from 'vue';
- //格式化资源类型和操作类型
- let formatText;
- let actionTypeText;
- async function formatTextFunc() {
- formatText = await findDictItemByCode({ dictCode: 'operate_log' });
- actionTypeText = await findDictItemByCode({ dictCode: 'exception_log' });
- }
- formatTextFunc();
- // 表格数据
- export const columns: BasicColumn[] = [
- {
- title: '租户名称',
- dataIndex: 'tenantName',
- width: 120,
- },
- {
- title: '客户名称',
- dataIndex: 'customerName',
- width: 120,
- },
- {
- title: '资源类型',
- dataIndex: 'entityType',
- width: 180,
- format: (_, record) => {
- const text = formatText.find((f) => {
- if (f.itemValue == record.entityType) {
- return f.itemText;
- }
- });
- return text?.itemText;
- },
- },
- {
- title: '资源名称',
- dataIndex: 'entityName',
- width: 180,
- },
- {
- title: '操作人员',
- dataIndex: 'userName',
- width: 180,
- },
- {
- title: '操作类型',
- dataIndex: 'actionType',
- width: 180,
- format: (_, record) => {
- const text = actionTypeText.find((f) => {
- if (f.itemValue == record.actionType) {
- return f.itemText;
- }
- });
- return text?.itemText;
- },
- },
- {
- title: '操作状态',
- dataIndex: 'actionStatus',
- width: 180,
- customRender: ({ record }) => {
- const status = record.actionStatus;
- const enable = status === 'SUCCESS' ? '成功' : '失败';
- const color = enable === '成功' ? 'green' : 'red';
- const text = enable === '成功' ? '成功' : '失败';
- return h(Tag, { color }, () => text);
- },
- },
- {
- title: '操作时间',
- dataIndex: 'createdTime',
- width: 180,
- format: (_, record) => {
- return format(record.createdTime, 'yyyy-MM-dd HH:mm:ss');
- },
- },
- ];
- // 分页查询
- export const searchFormSchema: FormSchema[] = [
- {
- field: 'entityType',
- label: '资源类型',
- component: 'ApiSelect',
- componentProps: {
- api: findDictItemByCode,
- params: {
- dictCode: 'operate_log',
- },
- labelField: 'itemText',
- valueField: 'itemValue',
- },
- colProps: { span: 6 },
- },
- {
- field: 'actionType',
- label: '操作类型',
- component: 'ApiSelect',
- componentProps: {
- api: findDictItemByCode,
- params: {
- dictCode: 'exception_log',
- },
- labelField: 'itemText',
- valueField: 'itemValue',
- },
- colProps: { span: 6 },
- },
- {
- field: 'queryTime',
- label: '查询时间',
- component: 'RangePicker',
- componentProps: {
- showTime: {
- defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')],
- },
- },
- colProps: { span: 6 },
- },
- ];
- // 详情配置
- export const formSchema: FormSchema[] = [
- {
- field: 'createdTime',
- label: '操作时间',
- component: 'Input',
- componentProps: {
- disabled: true,
- },
- },
- {
- field: 'tenantName',
- label: '租户名称',
- component: 'Input',
- componentProps: {
- disabled: true,
- },
- },
- {
- field: 'customerName',
- label: '客户名称',
- component: 'Input',
- componentProps: {
- disabled: true,
- },
- },
- {
- field: 'entityType',
- label: '资源类型',
- component: 'Input',
- componentProps: {
- disabled: true,
- },
- },
- {
- field: 'entityName',
- label: '资源名称',
- component: 'Input',
- componentProps: {
- disabled: true,
- },
- },
- {
- field: 'userName',
- label: '操作人员',
- colProps: { span: 24 },
- component: 'Input',
- componentProps: {
- disabled: true,
- },
- },
- {
- field: 'actionType',
- label: '操作类型',
- component: 'Input',
- componentProps: {
- disabled: true,
- },
- },
- {
- field: 'actionStatus',
- label: '操作状态',
- component: 'Input',
- componentProps: {
- disabled: true,
- },
- },
- {
- field: 'actionData',
- label: '操作数据',
- component: 'InputTextArea',
- componentProps: {
- disabled: true,
- autosize: true,
- allowClear: false,
- },
- },
- {
- field: 'actionFailureDetails',
- label: '失败信息',
- component: 'InputTextArea',
- componentProps: {
- disabled: true,
- autosize: true,
- allowClear: false,
- },
- },
- ];
|