1. 管理员管理模块拆分
2. 图片上传自动压缩(大于850kb) 3. 省市区选择组件重构,支持搜索
This commit is contained in:
@@ -7,6 +7,10 @@ import { Descriptions } from 'ant-design-vue';
|
||||
|
||||
import { Icon } from '#/components/icon';
|
||||
import { getIcon } from '#/util/tool';
|
||||
import {
|
||||
getApiOpLogOperatorLabel,
|
||||
getApiOpLogPlatformLabel,
|
||||
} from '../config/platform';
|
||||
|
||||
|
||||
|
||||
@@ -43,10 +47,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
>
|
||||
<Descriptions.Item label="ID">{{ data.id }}</Descriptions.Item>
|
||||
<Descriptions.Item label="操作人员">
|
||||
<span v-if="data.platform_type === 0">{{ data?.admin?.nick_name || '获取失败' }}</span>
|
||||
<span v-else-if="data.platform_type === 1">{{ data?.admin?.nick_name || '获取失败' }}</span>
|
||||
<span v-else-if="data.platform_type === 2">{{ data?.user?.nickname || '获取失败' }}</span>
|
||||
<span v-else>获取失败</span>
|
||||
<span>{{ getApiOpLogOperatorLabel(data) }}</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="URL">{{ data.url }}</Descriptions.Item>
|
||||
<Descriptions.Item label="控制器">
|
||||
@@ -62,11 +63,8 @@ const [Modal, modalApi] = useVbenModal({
|
||||
<Descriptions.Item label="返回结果代码">
|
||||
{{ data.result_code }}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="平台类型">
|
||||
<span v-if="data.platform_type === 0">平台</span>
|
||||
<span v-else-if="data.platform_type === 1">诊所</span>
|
||||
<span v-else-if="data.platform_type === 2">小程序</span>
|
||||
<span v-else>获取失败</span>
|
||||
<Descriptions.Item label="接口来源">
|
||||
<span>{{ getApiOpLogPlatformLabel(data.platform_type) }}</span>
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="设备">
|
||||
<Icon :icon="getIcon(data.equipment)" :size="20" />
|
||||
|
||||
35
apps/web-antd/src/views/log/api-log/config/platform.ts
Normal file
35
apps/web-antd/src/views/log/api-log/config/platform.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
export const API_OP_LOG_PLATFORM_OPTIONS = [
|
||||
{ label: '后台', value: 0 },
|
||||
{ label: '用户移动端', value: 1 },
|
||||
{ label: '医生移动端', value: 2 },
|
||||
{ label: '互医内部接口', value: 3 },
|
||||
] as const;
|
||||
|
||||
export function getApiOpLogPlatformLabel(
|
||||
platformType: number | string | null | undefined,
|
||||
): string {
|
||||
const value = Number(platformType);
|
||||
const found = API_OP_LOG_PLATFORM_OPTIONS.find((item) => item.value === value);
|
||||
return found?.label ?? '历史/未知';
|
||||
}
|
||||
|
||||
export function getApiOpLogOperatorLabel(row: {
|
||||
platform_type?: number;
|
||||
admin?: { nick_name?: string };
|
||||
user?: { nickname?: string };
|
||||
}): string {
|
||||
const type = row.platform_type;
|
||||
if (type === 3) {
|
||||
return '互医中转';
|
||||
}
|
||||
if (type === 2) {
|
||||
return row?.user?.nickname || row?.admin?.nick_name || '-';
|
||||
}
|
||||
if (type === 1) {
|
||||
return row?.user?.nickname || '获取失败';
|
||||
}
|
||||
if (type === 0) {
|
||||
return row?.admin?.nick_name || '获取失败';
|
||||
}
|
||||
return row?.admin?.nick_name || row?.user?.nickname || '-';
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
import type { VbenFormProps } from '#/adapter/form';
|
||||
|
||||
import { API_OP_LOG_PLATFORM_OPTIONS } from './platform';
|
||||
|
||||
// import dayjs from 'dayjs';
|
||||
|
||||
export const formOptions: VbenFormProps = {
|
||||
@@ -18,6 +20,16 @@ export const formOptions: VbenFormProps = {
|
||||
fieldName: 'router',
|
||||
label: 'api接口',
|
||||
},
|
||||
{
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
options: [...API_OP_LOG_PLATFORM_OPTIONS],
|
||||
placeholder: '全部',
|
||||
},
|
||||
fieldName: 'platform_type',
|
||||
label: '接口来源',
|
||||
},
|
||||
{
|
||||
component: 'RangePicker',
|
||||
componentProps: {
|
||||
|
||||
@@ -32,6 +32,12 @@ export const gridOptions: VxeGridProps<RowType> = {
|
||||
slots: { default: 'admin' },
|
||||
},
|
||||
{ field: 'url', title: '访问路由' },
|
||||
{
|
||||
field: 'platform_type',
|
||||
title: '接口来源',
|
||||
slots: { default: 'platform_type' },
|
||||
width: 120,
|
||||
},
|
||||
{ field: 'ip', title: '用户IP地址' },
|
||||
{ field: 'ip_address', title: 'IP归属地' },
|
||||
{ field: 'controller', title: '访问控制器' },
|
||||
|
||||
@@ -11,6 +11,10 @@ import { TableAction } from '#/components/table-action';
|
||||
import FormModalDemo from './components/modal.vue';
|
||||
import { formOptions } from './config/search';
|
||||
import { gridOptions } from './config/table';
|
||||
import {
|
||||
getApiOpLogOperatorLabel,
|
||||
getApiOpLogPlatformLabel,
|
||||
} from './config/platform';
|
||||
import { getIcon } from '#/util/tool';
|
||||
import {Icon} from "#/components/icon";
|
||||
|
||||
@@ -46,10 +50,10 @@ const showModal = (data = {}, isUpdate = false) => {
|
||||
<Tag v-else color="red"> 访问失败 </Tag>
|
||||
</template>
|
||||
<template #admin="{ row }">
|
||||
<span v-if="row.platform_type === 0">{{ row?.admin?.nick_name || '获取失败' }}</span>
|
||||
<span v-else-if="row.platform_type === 1">{{ row?.admin?.nick_name || '获取失败' }}</span>
|
||||
<span v-else-if="row.platform_type === 2">{{ row?.user?.nickname || '获取失败' }}</span>
|
||||
<span v-else>获取失败</span>
|
||||
<span>{{ getApiOpLogOperatorLabel(row) }}</span>
|
||||
</template>
|
||||
<template #platform_type="{ row }">
|
||||
<span>{{ getApiOpLogPlatformLabel(row.platform_type) }}</span>
|
||||
</template>
|
||||
<template #toolbar-tools></template>
|
||||
<template #equipment="{ row }">
|
||||
|
||||
Reference in New Issue
Block a user