Files
im_manager/web/src/views/imLoginFailureLog/model.ts
T

93 lines
2.5 KiB
TypeScript

import { computed, ref } from 'vue';
import { FormSchema } from '@/components/Form';
import { defRangeShortcuts } from '@/utils/dateUtil';
import { useDictStore } from '@/store/modules/dict';
import { imQueryTenantOptions } from '@/views/imAdminQueryShared';
const dict = useDictStore();
export const schemas = ref<FormSchema[]>([
{
field: 'tenantId',
component: 'NSelect',
label: '商户',
componentProps: {
clearable: false,
options: computed(() => imQueryTenantOptions.value),
placeholder: '请选择商户',
},
},
{
field: 'userId',
component: 'NInput',
label: '用户ID',
componentProps: { placeholder: '请输入用户ID' },
},
{
field: 'account',
component: 'NInput',
label: '账号',
componentProps: { placeholder: '请输入脱敏账号' },
},
{
field: 'failureType',
component: 'NSelect',
label: '失败类型',
componentProps: {
clearable: true,
options: dict.getOption('ImLoginFailureTypeOptions'),
placeholder: '全部类型',
},
},
{
field: 'platform',
component: 'NSelect',
label: '客户端',
componentProps: {
clearable: true,
options: dict.getOption('ImClientPlatformOptions'),
placeholder: '全部客户端',
},
},
{
field: 'ip',
component: 'NInput',
label: 'IP',
componentProps: { placeholder: '请输入IP地址' },
},
{
field: 'attemptAt',
component: 'NDatePicker',
label: '尝试时间',
componentProps: { type: 'datetimerange', clearable: true, shortcuts: defRangeShortcuts() },
},
]);
export const columns = [
{ title: 'ID', key: 'id', width: 90 },
{ title: '用户ID', key: 'userId', width: 130 },
{ title: '账号', key: 'accountMask', width: 170 },
{
title: '失败类型',
key: 'failureType',
width: 140,
render: (row) => dict.getLabel('ImLoginFailureTypeOptions', row.failureType) || row.failureType,
},
{ title: '原因码', key: 'reason', width: 180 },
{ title: 'IP', key: 'ip', width: 140 },
{ title: '地区', key: 'region', width: 150 },
{
title: '客户端',
key: 'platform',
width: 110,
render: (row) => dict.getLabel('ImClientPlatformOptions', row.platform) || row.platform,
},
{ title: '风险', key: 'riskLevel', width: 90 },
{ title: '风控动作', key: 'riskAction', width: 120 },
{ title: '尝试时间', key: 'attemptAt', width: 180 },
];
export function loadOptions() {
dict.loadOptions(['ImLoginFailureTypeOptions', 'ImClientPlatformOptions']);
}