Pre Merge pull request !80 from puhui999/v-next-dev
commit
f31a79aa74
|
@ -46,12 +46,9 @@ export function deleteFile(id: number) {
|
||||||
|
|
||||||
/** 获取文件预签名地址 */
|
/** 获取文件预签名地址 */
|
||||||
export function getFilePresignedUrl(path: string) {
|
export function getFilePresignedUrl(path: string) {
|
||||||
return requestClient.get<InfraFileApi.FilePresignedUrlRespVO>(
|
return requestClient.get<InfraFileApi.FilePresignedUrlRespVO>('/infra/file/presigned-url', {
|
||||||
'/infra/file/presigned-url',
|
params: { path },
|
||||||
{
|
});
|
||||||
params: { path },
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 创建文件 */
|
/** 创建文件 */
|
||||||
|
@ -60,9 +57,6 @@ export function createFile(data: InfraFileApi.File) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 上传文件 */
|
/** 上传文件 */
|
||||||
export function uploadFile(
|
export function uploadFile(data: InfraFileApi.FileUploadReqVO, onUploadProgress?: AxiosProgressEvent) {
|
||||||
data: InfraFileApi.FileUploadReqVO,
|
|
||||||
onUploadProgress?: AxiosProgressEvent,
|
|
||||||
) {
|
|
||||||
return requestClient.upload('/infra/file/upload', data, { onUploadProgress });
|
return requestClient.upload('/infra/file/upload', data, { onUploadProgress });
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
<script lang="tsx">
|
||||||
|
import type { DescriptionItemSchema, DescriptionProps } from './typing';
|
||||||
|
import type { DescriptionsProps } from 'ant-design-vue';
|
||||||
|
import type { PropType } from 'vue';
|
||||||
|
|
||||||
|
import { Descriptions, DescriptionsItem } from 'ant-design-vue';
|
||||||
|
|
||||||
|
import { defineComponent } from 'vue';
|
||||||
|
|
||||||
|
/** 对 Descriptions 进行二次封装 */
|
||||||
|
const Description = defineComponent({
|
||||||
|
name: 'Description',
|
||||||
|
props: {
|
||||||
|
data: {
|
||||||
|
type: Object as PropType<Record<string, any>>,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
schema: {
|
||||||
|
type: Array as PropType<DescriptionItemSchema[]>,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
/** 原生 Descriptions 的参数 */
|
||||||
|
descriptionsProps: {
|
||||||
|
type: Object as PropType<DescriptionsProps>,
|
||||||
|
default: () => ({}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
setup(props: DescriptionProps) {
|
||||||
|
/** 过滤掉不需要展示的 */
|
||||||
|
const shouldShowItem = (item: DescriptionItemSchema) => {
|
||||||
|
if (item.hidden === undefined) return true;
|
||||||
|
return typeof item.hidden === 'function' ? !item.hidden(props.data) : !item.hidden;
|
||||||
|
};
|
||||||
|
/** 渲染内容 */
|
||||||
|
const renderContent = (item: DescriptionItemSchema) => {
|
||||||
|
if (item.content) {
|
||||||
|
return typeof item.content === 'function' ? item.content(props.data) : item.content;
|
||||||
|
}
|
||||||
|
return item.field ? props.data?.[item.field] : null;
|
||||||
|
};
|
||||||
|
|
||||||
|
return () => (
|
||||||
|
<Descriptions
|
||||||
|
{...props}
|
||||||
|
bordered={props.descriptionsProps?.bordered}
|
||||||
|
colon={props.descriptionsProps?.colon}
|
||||||
|
column={props.descriptionsProps?.column}
|
||||||
|
extra={props.descriptionsProps?.extra}
|
||||||
|
layout={props.descriptionsProps?.layout}
|
||||||
|
size={props.descriptionsProps?.size}
|
||||||
|
title={props.descriptionsProps?.title}
|
||||||
|
>
|
||||||
|
{props.schema?.filter(shouldShowItem).map((item) => (
|
||||||
|
<DescriptionsItem
|
||||||
|
contentStyle={item.contentStyle}
|
||||||
|
key={item.field || String(item.label)}
|
||||||
|
label={item.label}
|
||||||
|
labelStyle={item.labelStyle}
|
||||||
|
span={item.span}
|
||||||
|
>
|
||||||
|
{renderContent(item)}
|
||||||
|
</DescriptionsItem>
|
||||||
|
))}
|
||||||
|
</Descriptions>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default Description;
|
||||||
|
</script>
|
|
@ -0,0 +1,3 @@
|
||||||
|
export { default as Description } from './description.vue';
|
||||||
|
export * from './typing';
|
||||||
|
export { useDescription } from './use-description';
|
|
@ -0,0 +1,18 @@
|
||||||
|
import type { DescriptionsProps } from 'ant-design-vue';
|
||||||
|
import type { CSSProperties, VNode } from 'vue';
|
||||||
|
|
||||||
|
export interface DescriptionItemSchema {
|
||||||
|
label: string | VNode; // 内容的描述
|
||||||
|
field?: string; // 对应 data 中的字段名
|
||||||
|
content?: ((data: any) => string | VNode) | string | VNode; // 自定义需要展示的内容,比如说 dict-tag
|
||||||
|
span?: number; // 包含列的数量
|
||||||
|
labelStyle?: CSSProperties; // 自定义标签样式
|
||||||
|
contentStyle?: CSSProperties; // 自定义内容样式
|
||||||
|
hidden?: ((data: any) => boolean) | boolean; // 是否显示
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DescriptionProps {
|
||||||
|
data?: Record<string, any>; // 数据
|
||||||
|
schema?: DescriptionItemSchema[]; // 描述项配置
|
||||||
|
descriptionsProps?: DescriptionsProps; // 原生 Descriptions 的参数
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
import type { DescriptionProps } from './typing';
|
||||||
|
|
||||||
|
import { defineComponent, h, isReactive, reactive, watch } from 'vue';
|
||||||
|
|
||||||
|
import { Description } from './index';
|
||||||
|
|
||||||
|
/** 描述列表 api 定义 */
|
||||||
|
class DescriptionApi {
|
||||||
|
private state = reactive<Record<string, any>>({});
|
||||||
|
|
||||||
|
constructor(options: DescriptionProps) {
|
||||||
|
this.state = { ...options };
|
||||||
|
}
|
||||||
|
|
||||||
|
getState(): DescriptionProps {
|
||||||
|
return this.state as DescriptionProps;
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(newState: Partial<DescriptionProps>) {
|
||||||
|
this.state = { ...this.state, ...newState };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export type ExtendedDescriptionApi = DescriptionApi;
|
||||||
|
|
||||||
|
export function useDescription(options: DescriptionProps) {
|
||||||
|
const IS_REACTIVE = isReactive(options);
|
||||||
|
const api = new DescriptionApi(options);
|
||||||
|
// 扩展API
|
||||||
|
const extendedApi: ExtendedDescriptionApi = api as never;
|
||||||
|
const Desc = defineComponent({
|
||||||
|
name: 'UseDescription',
|
||||||
|
inheritAttrs: false,
|
||||||
|
setup(_, { attrs, slots }) {
|
||||||
|
// 合并props和attrs到state
|
||||||
|
api.setState({ ...attrs });
|
||||||
|
|
||||||
|
return () =>
|
||||||
|
h(
|
||||||
|
Description,
|
||||||
|
{
|
||||||
|
...api.getState(),
|
||||||
|
...attrs,
|
||||||
|
},
|
||||||
|
slots,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// 响应式支持
|
||||||
|
if (IS_REACTIVE) {
|
||||||
|
watch(
|
||||||
|
() => options.schema,
|
||||||
|
(newSchema) => {
|
||||||
|
api.setState({ schema: newSchema });
|
||||||
|
},
|
||||||
|
{ immediate: true, deep: true },
|
||||||
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => options.data,
|
||||||
|
(newData) => {
|
||||||
|
api.setState({ data: newData });
|
||||||
|
},
|
||||||
|
{ immediate: true, deep: true },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [Desc, extendedApi] as const;
|
||||||
|
}
|
|
@ -1,17 +1,14 @@
|
||||||
|
import type { AxiosProgressEvent, InfraFileApi } from '#/api/infra/file';
|
||||||
import type { Ref } from 'vue';
|
import type { Ref } from 'vue';
|
||||||
|
|
||||||
import type { AxiosProgressEvent, InfraFileApi } from '#/api/infra/file';
|
import { createFile, getFilePresignedUrl, uploadFile } from '#/api/infra/file';
|
||||||
|
import { baseRequestClient } from '#/api/request';
|
||||||
import { computed, unref } from 'vue';
|
import { computed, unref } from 'vue';
|
||||||
|
|
||||||
import { useAppConfig } from '@vben/hooks';
|
import { useAppConfig } from '@vben/hooks';
|
||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
|
|
||||||
import CryptoJS from 'crypto-js';
|
import CryptoJS from 'crypto-js';
|
||||||
|
|
||||||
import { createFile, getFilePresignedUrl, uploadFile } from '#/api/infra/file';
|
|
||||||
import { baseRequestClient } from '#/api/request';
|
|
||||||
|
|
||||||
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
const { apiURL } = useAppConfig(import.meta.env, import.meta.env.PROD);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,9 +43,7 @@ export function useUploadType({
|
||||||
const getStringAccept = computed(() => {
|
const getStringAccept = computed(() => {
|
||||||
return unref(getAccept)
|
return unref(getAccept)
|
||||||
.map((item) => {
|
.map((item) => {
|
||||||
return item.indexOf('/') > 0 || item.startsWith('.')
|
return item.indexOf('/') > 0 || item.startsWith('.') ? item : `.${item}`;
|
||||||
? item
|
|
||||||
: `.${item}`;
|
|
||||||
})
|
})
|
||||||
.join(',');
|
.join(',');
|
||||||
});
|
});
|
||||||
|
@ -85,13 +80,9 @@ export const useUpload = () => {
|
||||||
// 后端上传地址
|
// 后端上传地址
|
||||||
const uploadUrl = getUploadUrl();
|
const uploadUrl = getUploadUrl();
|
||||||
// 是否使用前端直连上传
|
// 是否使用前端直连上传
|
||||||
const isClientUpload =
|
const isClientUpload = UPLOAD_TYPE.CLIENT === import.meta.env.VITE_UPLOAD_TYPE;
|
||||||
UPLOAD_TYPE.CLIENT === import.meta.env.VITE_UPLOAD_TYPE;
|
|
||||||
// 重写ElUpload上传方法
|
// 重写ElUpload上传方法
|
||||||
const httpRequest = async (
|
const httpRequest = async (file: File, onUploadProgress?: AxiosProgressEvent) => {
|
||||||
file: File,
|
|
||||||
onUploadProgress?: AxiosProgressEvent,
|
|
||||||
) => {
|
|
||||||
// 模式一:前端上传
|
// 模式一:前端上传
|
||||||
if (isClientUpload) {
|
if (isClientUpload) {
|
||||||
// 1.1 生成文件名称
|
// 1.1 生成文件名称
|
||||||
|
@ -137,11 +128,7 @@ export const getUploadUrl = (): string => {
|
||||||
* @param name 文件名称
|
* @param name 文件名称
|
||||||
* @param file 文件
|
* @param file 文件
|
||||||
*/
|
*/
|
||||||
function createFile0(
|
function createFile0(vo: InfraFileApi.FilePresignedUrlRespVO, name: string, file: File) {
|
||||||
vo: InfraFileApi.FilePresignedUrlRespVO,
|
|
||||||
name: string,
|
|
||||||
file: File,
|
|
||||||
) {
|
|
||||||
const fileVO = {
|
const fileVO = {
|
||||||
configId: vo.configId,
|
configId: vo.configId,
|
||||||
url: vo.url,
|
url: vo.url,
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
import type {
|
import type { AppRouteRecordRaw, ComponentRecordType, GenerateMenuAndRoutesOptions } from '@vben/types';
|
||||||
AppRouteRecordRaw,
|
|
||||||
ComponentRecordType,
|
|
||||||
GenerateMenuAndRoutesOptions,
|
|
||||||
} from '@vben/types';
|
|
||||||
|
|
||||||
import { generateAccessible } from '@vben/access';
|
import { generateAccessible } from '@vben/access';
|
||||||
import { preferences } from '@vben/preferences';
|
import { preferences } from '@vben/preferences';
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { SystemUserProfileApi } from '#/api/system/user/profile';
|
import type { SystemUserProfileApi } from '#/api/system/user/profile';
|
||||||
|
|
||||||
import { computed } from 'vue';
|
import { CropperAvatar } from '#/components/cropper';
|
||||||
|
import { useUpload } from '#/components/upload/use-upload';
|
||||||
import { IconifyIcon } from '@vben/icons';
|
import { IconifyIcon } from '@vben/icons';
|
||||||
import { preferences } from '@vben/preferences';
|
|
||||||
import { formatDateTime } from '@vben/utils';
|
|
||||||
|
|
||||||
import { Descriptions, DescriptionsItem, Tooltip } from 'ant-design-vue';
|
import { Descriptions, DescriptionsItem, Tooltip } from 'ant-design-vue';
|
||||||
|
|
||||||
import { updateUserProfile } from '#/api/system/user/profile';
|
import { updateUserProfile } from '#/api/system/user/profile';
|
||||||
import { CropperAvatar } from '#/components/cropper';
|
import { computed } from 'vue';
|
||||||
import { useUpload } from '#/components/upload/use-upload';
|
|
||||||
|
import { preferences } from '@vben/preferences';
|
||||||
|
import { formatDateTime } from '@vben/utils';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
profile?: SystemUserProfileApi.UserProfileRespVO;
|
profile?: SystemUserProfileApi.UserProfileRespVO;
|
||||||
|
@ -21,17 +20,9 @@ const emit = defineEmits<{
|
||||||
(e: 'success'): void;
|
(e: 'success'): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const avatar = computed(
|
const avatar = computed(() => props.profile?.avatar || preferences.app.defaultAvatar);
|
||||||
() => props.profile?.avatar || preferences.app.defaultAvatar,
|
|
||||||
);
|
|
||||||
|
|
||||||
async function handelUpload({
|
async function handelUpload({ file, filename }: { file: Blob; filename: string }) {
|
||||||
file,
|
|
||||||
filename,
|
|
||||||
}: {
|
|
||||||
file: Blob;
|
|
||||||
filename: string;
|
|
||||||
}) {
|
|
||||||
// 1. 上传头像,获取 URL
|
// 1. 上传头像,获取 URL
|
||||||
const { httpRequest } = useUpload();
|
const { httpRequest } = useUpload();
|
||||||
// 将 Blob 转换为 File
|
// 将 Blob 转换为 File
|
||||||
|
@ -69,10 +60,7 @@ async function handelUpload({
|
||||||
<DescriptionsItem>
|
<DescriptionsItem>
|
||||||
<template #label>
|
<template #label>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<IconifyIcon
|
<IconifyIcon icon="ant-design:user-switch-outlined" class="mr-1" />
|
||||||
icon="ant-design:user-switch-outlined"
|
|
||||||
class="mr-1"
|
|
||||||
/>
|
|
||||||
所属角色
|
所属角色
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -108,10 +96,7 @@ async function handelUpload({
|
||||||
<DescriptionsItem>
|
<DescriptionsItem>
|
||||||
<template #label>
|
<template #label>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<IconifyIcon
|
<IconifyIcon icon="ant-design:usergroup-add-outlined" class="mr-1" />
|
||||||
icon="ant-design:usergroup-add-outlined"
|
|
||||||
class="mr-1"
|
|
||||||
/>
|
|
||||||
所属岗位
|
所属岗位
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -120,10 +105,7 @@ async function handelUpload({
|
||||||
<DescriptionsItem>
|
<DescriptionsItem>
|
||||||
<template #label>
|
<template #label>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<IconifyIcon
|
<IconifyIcon icon="ant-design:clock-circle-outlined" class="mr-1" />
|
||||||
icon="ant-design:clock-circle-outlined"
|
|
||||||
class="mr-1"
|
|
||||||
/>
|
|
||||||
创建时间
|
创建时间
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,17 +1,11 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { Page } from '@vben/common-ui';
|
import { Page } from '@vben/common-ui';
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
import { Button } from 'ant-design-vue';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page>
|
<Page>
|
||||||
<Button
|
<Button danger type="link" target="_blank" href="https://github.com/yudaocode/yudao-ui-admin-vue3">
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
该功能支持 Vue3 + element-plus 版本!
|
||||||
</Button>
|
</Button>
|
||||||
<br />
|
<br />
|
||||||
|
@ -20,9 +14,8 @@ import { Button } from 'ant-design-vue';
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/model/index"
|
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/model/index"
|
||||||
>
|
>
|
||||||
可参考
|
可参考 https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/model/index 代码,pull request
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/model/index
|
贡献给我们!
|
||||||
代码,pull request 贡献给我们!
|
|
||||||
</Button>
|
</Button>
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,17 +1,11 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { Page } from '@vben/common-ui';
|
import { Page } from '@vben/common-ui';
|
||||||
|
|
||||||
import { Button } from 'ant-design-vue';
|
import { Button } from 'ant-design-vue';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Page>
|
<Page>
|
||||||
<Button
|
<Button danger type="link" target="_blank" href="https://github.com/yudaocode/yudao-ui-admin-vue3">
|
||||||
danger
|
|
||||||
type="link"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3"
|
|
||||||
>
|
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
该功能支持 Vue3 + element-plus 版本!
|
||||||
</Button>
|
</Button>
|
||||||
<br />
|
<br />
|
||||||
|
@ -20,8 +14,7 @@ import { Button } from 'ant-design-vue';
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/processInstance/create/index"
|
href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/processInstance/create/index"
|
||||||
>
|
>
|
||||||
可参考
|
可参考 https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/processInstance/create/index
|
||||||
https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/processInstance/create/index
|
|
||||||
代码,pull request 贡献给我们!
|
代码,pull request 贡献给我们!
|
||||||
</Button>
|
</Button>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { InfraApiAccessLogApi } from '#/api/infra/api-access-log';
|
import type { InfraApiAccessLogApi } from '#/api/infra/api-access-log';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { DictTag } from '#/components/dict-tag';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
import { formatDateTime } from '@vben/utils';
|
|
||||||
|
|
||||||
import { Descriptions } from 'ant-design-vue';
|
import { Descriptions } from 'ant-design-vue';
|
||||||
|
|
||||||
import { DictTag } from '#/components/dict-tag';
|
|
||||||
import { DICT_TYPE } from '#/utils/dict';
|
import { DICT_TYPE } from '#/utils/dict';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
import { formatDateTime } from '@vben/utils';
|
||||||
|
|
||||||
const formData = ref<InfraApiAccessLogApi.ApiAccessLog>();
|
const formData = ref<InfraApiAccessLogApi.ApiAccessLog>();
|
||||||
|
|
||||||
|
@ -34,19 +33,8 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Modal
|
<Modal title="API 访问日志详情" class="w-1/2" :show-cancel-button="false" :show-confirm-button="false">
|
||||||
title="API 访问日志详情"
|
<Descriptions bordered :column="1" size="middle" class="mx-4" :label-style="{ width: '110px' }">
|
||||||
class="w-1/2"
|
|
||||||
:show-cancel-button="false"
|
|
||||||
:show-confirm-button="false"
|
|
||||||
>
|
|
||||||
<Descriptions
|
|
||||||
bordered
|
|
||||||
:column="1"
|
|
||||||
size="middle"
|
|
||||||
class="mx-4"
|
|
||||||
:label-style="{ width: '110px' }"
|
|
||||||
>
|
|
||||||
<Descriptions.Item label="日志编号">
|
<Descriptions.Item label="日志编号">
|
||||||
{{ formData?.id }}
|
{{ formData?.id }}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
|
@ -66,9 +54,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
<Descriptions.Item label="用户UA">
|
<Descriptions.Item label="用户UA">
|
||||||
{{ formData?.userAgent }}
|
{{ formData?.userAgent }}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="请求信息">
|
<Descriptions.Item label="请求信息"> {{ formData?.requestMethod }} {{ formData?.requestUrl }} </Descriptions.Item>
|
||||||
{{ formData?.requestMethod }} {{ formData?.requestUrl }}
|
|
||||||
</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="请求参数">
|
<Descriptions.Item label="请求参数">
|
||||||
{{ formData?.requestParams }}
|
{{ formData?.requestParams }}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
|
@ -79,9 +65,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
{{ formatDateTime(formData?.beginTime || '') }} ~
|
{{ formatDateTime(formData?.beginTime || '') }} ~
|
||||||
{{ formatDateTime(formData?.endTime || '') }}
|
{{ formatDateTime(formData?.endTime || '') }}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="请求耗时">
|
<Descriptions.Item label="请求耗时"> {{ formData?.duration }} ms </Descriptions.Item>
|
||||||
{{ formData?.duration }} ms
|
|
||||||
</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="操作结果">
|
<Descriptions.Item label="操作结果">
|
||||||
<div v-if="formData?.resultCode === 0">正常</div>
|
<div v-if="formData?.resultCode === 0">正常</div>
|
||||||
<div v-else-if="formData && formData?.resultCode > 0">
|
<div v-else-if="formData && formData?.resultCode > 0">
|
||||||
|
@ -95,10 +79,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
{{ formData?.operateName }}
|
{{ formData?.operateName }}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="操作类型">
|
<Descriptions.Item label="操作类型">
|
||||||
<DictTag
|
<DictTag :type="DICT_TYPE.INFRA_OPERATE_TYPE" :value="formData?.operateType" />
|
||||||
:type="DICT_TYPE.INFRA_OPERATE_TYPE"
|
|
||||||
:value="formData?.operateType"
|
|
||||||
/>
|
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
</Descriptions>
|
</Descriptions>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -1,19 +1,13 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { Demo03StudentApi } from '#/api/infra/demo/demo03/inner';
|
import type { Demo03StudentApi } from '#/api/infra/demo/demo03/inner';
|
||||||
|
|
||||||
import { computed, ref } from 'vue';
|
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
|
||||||
import { message, Tabs } from 'ant-design-vue';
|
import { message, Tabs } from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
import { useVbenForm } from '#/adapter/form';
|
||||||
import {
|
import { createDemo03Student, getDemo03Student, updateDemo03Student } from '#/api/infra/demo/demo03/inner';
|
||||||
createDemo03Student,
|
|
||||||
getDemo03Student,
|
|
||||||
updateDemo03Student,
|
|
||||||
} from '#/api/infra/demo/demo03/inner';
|
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
|
import { computed, ref } from 'vue';
|
||||||
|
|
||||||
import { useFormSchema } from '../data';
|
import { useFormSchema } from '../data';
|
||||||
import Demo03CourseForm from './demo03-course-form.vue';
|
import Demo03CourseForm from './demo03-course-form.vue';
|
||||||
|
@ -22,9 +16,7 @@ import Demo03GradeForm from './demo03-grade-form.vue';
|
||||||
const emit = defineEmits(['success']);
|
const emit = defineEmits(['success']);
|
||||||
const formData = ref<Demo03StudentApi.Demo03Student>();
|
const formData = ref<Demo03StudentApi.Demo03Student>();
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
return formData.value?.id
|
return formData.value?.id ? $t('ui.actionTitle.edit', ['学生']) : $t('ui.actionTitle.create', ['学生']);
|
||||||
? $t('ui.actionTitle.edit', ['学生'])
|
|
||||||
: $t('ui.actionTitle.create', ['学生']);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 子表的表单 */
|
/** 子表的表单 */
|
||||||
|
@ -58,9 +50,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
data.demo03Courses = demo03CourseFormRef.value?.getData();
|
data.demo03Courses = demo03CourseFormRef.value?.getData();
|
||||||
data.demo03Grade = await demo03GradeFormRef.value?.getValues();
|
data.demo03Grade = await demo03GradeFormRef.value?.getValues();
|
||||||
try {
|
try {
|
||||||
await (formData.value?.id
|
await (formData.value?.id ? updateDemo03Student(data) : createDemo03Student(data));
|
||||||
? updateDemo03Student(data)
|
|
||||||
: createDemo03Student(data));
|
|
||||||
// 关闭并提示
|
// 关闭并提示
|
||||||
await modalApi.close();
|
await modalApi.close();
|
||||||
emit('success');
|
emit('success');
|
||||||
|
@ -104,10 +94,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
<!-- 子表的表单 -->
|
<!-- 子表的表单 -->
|
||||||
<Tabs v-model:active-key="subTabsName">
|
<Tabs v-model:active-key="subTabsName">
|
||||||
<Tabs.TabPane key="demo03Course" tab="学生课程" force-render>
|
<Tabs.TabPane key="demo03Course" tab="学生课程" force-render>
|
||||||
<Demo03CourseForm
|
<Demo03CourseForm ref="demo03CourseFormRef" :student-id="formData?.id" />
|
||||||
ref="demo03CourseFormRef"
|
|
||||||
:student-id="formData?.id"
|
|
||||||
/>
|
|
||||||
</Tabs.TabPane>
|
</Tabs.TabPane>
|
||||||
<Tabs.TabPane key="demo03Grade" tab="学生班级" force-render>
|
<Tabs.TabPane key="demo03Grade" tab="学生班级" force-render>
|
||||||
<Demo03GradeForm ref="demo03GradeFormRef" :student-id="formData?.id" />
|
<Demo03GradeForm ref="demo03GradeFormRef" :student-id="formData?.id" />
|
||||||
|
|
|
@ -3,13 +3,13 @@ import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
import type { SystemDictDataApi } from '#/api/system/dict/data';
|
import type { SystemDictDataApi } from '#/api/system/dict/data';
|
||||||
import type { SystemDictTypeApi } from '#/api/system/dict/type';
|
import type { SystemDictTypeApi } from '#/api/system/dict/type';
|
||||||
|
|
||||||
import { useAccess } from '@vben/access';
|
|
||||||
|
|
||||||
import { z } from '#/adapter/form';
|
import { z } from '#/adapter/form';
|
||||||
import { getSimpleDictTypeList } from '#/api/system/dict/type';
|
import { getSimpleDictTypeList } from '#/api/system/dict/type';
|
||||||
import { CommonStatusEnum } from '#/utils/constants';
|
import { CommonStatusEnum } from '#/utils/constants';
|
||||||
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
|
import { DICT_TYPE, getDictOptions } from '#/utils/dict';
|
||||||
|
|
||||||
|
import { useAccess } from '@vben/access';
|
||||||
|
|
||||||
const { hasAccessByCodes } = useAccess();
|
const { hasAccessByCodes } = useAccess();
|
||||||
|
|
||||||
// ============================== 字典类型 ==============================
|
// ============================== 字典类型 ==============================
|
||||||
|
|
|
@ -1,25 +1,16 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type {
|
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
OnActionClickParams,
|
|
||||||
VxeTableGridOptions,
|
|
||||||
} from '#/adapter/vxe-table';
|
|
||||||
import type { SystemDictDataApi } from '#/api/system/dict/data';
|
import type { SystemDictDataApi } from '#/api/system/dict/data';
|
||||||
|
|
||||||
import { watch } from 'vue';
|
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
import { Download, Plus } from '@vben/icons';
|
import { Download, Plus } from '@vben/icons';
|
||||||
|
|
||||||
import { Button, message } from 'ant-design-vue';
|
import { Button, message } from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import {
|
import { deleteDictData, exportDictData, getDictDataPage } from '#/api/system/dict/data';
|
||||||
deleteDictData,
|
|
||||||
exportDictData,
|
|
||||||
getDictDataPage,
|
|
||||||
} from '#/api/system/dict/data';
|
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
import { downloadByData } from '#/utils/download';
|
import { downloadByData } from '#/utils/download';
|
||||||
|
import { watch } from 'vue';
|
||||||
|
|
||||||
import { useDataGridColumns, useDataGridFormSchema } from '../data';
|
import { useDataGridColumns, useDataGridFormSchema } from '../data';
|
||||||
import DataForm from './data-form.vue';
|
import DataForm from './data-form.vue';
|
||||||
|
@ -137,20 +128,11 @@ watch(
|
||||||
|
|
||||||
<Grid table-title="字典数据列表">
|
<Grid table-title="字典数据列表">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<Button
|
<Button type="primary" @click="onCreate" v-access:code="['system:dict:create']">
|
||||||
type="primary"
|
|
||||||
@click="onCreate"
|
|
||||||
v-access:code="['system:dict:create']"
|
|
||||||
>
|
|
||||||
<Plus class="size-5" />
|
<Plus class="size-5" />
|
||||||
{{ $t('ui.actionTitle.create', ['字典数据']) }}
|
{{ $t('ui.actionTitle.create', ['字典数据']) }}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button type="primary" class="ml-2" @click="onExport" v-access:code="['system:dict:export']">
|
||||||
type="primary"
|
|
||||||
class="ml-2"
|
|
||||||
@click="onExport"
|
|
||||||
v-access:code="['system:dict:export']"
|
|
||||||
>
|
|
||||||
<Download class="size-5" />
|
<Download class="size-5" />
|
||||||
{{ $t('ui.actionTitle.export') }}
|
{{ $t('ui.actionTitle.export') }}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -1,22 +1,13 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type {
|
import type { OnActionClickParams, VxeGridListeners, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
OnActionClickParams,
|
|
||||||
VxeGridListeners,
|
|
||||||
VxeTableGridOptions,
|
|
||||||
} from '#/adapter/vxe-table';
|
|
||||||
import type { SystemDictTypeApi } from '#/api/system/dict/type';
|
import type { SystemDictTypeApi } from '#/api/system/dict/type';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
import { Download, Plus } from '@vben/icons';
|
import { Download, Plus } from '@vben/icons';
|
||||||
|
|
||||||
import { Button, message } from 'ant-design-vue';
|
import { Button, message } from 'ant-design-vue';
|
||||||
|
|
||||||
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
import { useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||||
import {
|
import { deleteDictType, exportDictType, getDictTypePage } from '#/api/system/dict/type';
|
||||||
deleteDictType,
|
|
||||||
exportDictType,
|
|
||||||
getDictTypePage,
|
|
||||||
} from '#/api/system/dict/type';
|
|
||||||
import { $t } from '#/locales';
|
import { $t } from '#/locales';
|
||||||
import { downloadByData } from '#/utils/download';
|
import { downloadByData } from '#/utils/download';
|
||||||
|
|
||||||
|
@ -71,10 +62,7 @@ async function onDelete(row: SystemDictTypeApi.DictType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 表格操作按钮回调 */
|
/** 表格操作按钮回调 */
|
||||||
function onActionClick({
|
function onActionClick({ code, row }: OnActionClickParams<SystemDictTypeApi.DictType>) {
|
||||||
code,
|
|
||||||
row,
|
|
||||||
}: OnActionClickParams<SystemDictTypeApi.DictType>) {
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 'delete': {
|
case 'delete': {
|
||||||
onDelete(row);
|
onDelete(row);
|
||||||
|
@ -132,20 +120,11 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
|
|
||||||
<Grid table-title="字典类型列表">
|
<Grid table-title="字典类型列表">
|
||||||
<template #toolbar-tools>
|
<template #toolbar-tools>
|
||||||
<Button
|
<Button type="primary" @click="onCreate" v-access:code="['system:dict:create']">
|
||||||
type="primary"
|
|
||||||
@click="onCreate"
|
|
||||||
v-access:code="['system:dict:create']"
|
|
||||||
>
|
|
||||||
<Plus class="size-5" />
|
<Plus class="size-5" />
|
||||||
{{ $t('ui.actionTitle.create', ['字典类型']) }}
|
{{ $t('ui.actionTitle.create', ['字典类型']) }}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button type="primary" class="ml-2" @click="onExport" v-access:code="['system:dict:export']">
|
||||||
type="primary"
|
|
||||||
class="ml-2"
|
|
||||||
@click="onExport"
|
|
||||||
v-access:code="['system:dict:export']"
|
|
||||||
>
|
|
||||||
<Download class="size-5" />
|
<Download class="size-5" />
|
||||||
{{ $t('ui.actionTitle.export') }}
|
{{ $t('ui.actionTitle.export') }}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -1,18 +1,56 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { SystemNotifyMessageApi } from '#/api/system/notify/message';
|
import type { SystemNotifyMessageApi } from '#/api/system/notify/message';
|
||||||
|
|
||||||
import { ref } from 'vue';
|
import { useDescription } from '#/components/description';
|
||||||
|
import { DictTag } from '#/components/dict-tag';
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
|
||||||
|
import { DICT_TYPE } from '#/utils/dict';
|
||||||
|
import { h, ref } from 'vue';
|
||||||
|
|
||||||
import { formatDateTime } from '@vben/utils';
|
import { formatDateTime } from '@vben/utils';
|
||||||
|
|
||||||
import { Descriptions } from 'ant-design-vue';
|
|
||||||
|
|
||||||
import { DictTag } from '#/components/dict-tag';
|
|
||||||
import { DICT_TYPE } from '#/utils/dict';
|
|
||||||
|
|
||||||
const formData = ref<SystemNotifyMessageApi.NotifyMessage>();
|
const formData = ref<SystemNotifyMessageApi.NotifyMessage>();
|
||||||
|
|
||||||
|
const [Description, descApi] = useDescription({
|
||||||
|
descriptionsProps: {
|
||||||
|
bordered: true,
|
||||||
|
column: 1,
|
||||||
|
size: 'middle',
|
||||||
|
class: 'mx-4',
|
||||||
|
},
|
||||||
|
schema: [
|
||||||
|
{
|
||||||
|
field: 'templateNickname',
|
||||||
|
label: '发送人',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'createTime',
|
||||||
|
label: '发送时间',
|
||||||
|
content: (data) => formatDateTime(data?.createTime) as string,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'templateType',
|
||||||
|
label: '消息类型',
|
||||||
|
content: (data) => h(DictTag, { type: DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE, value: data?.templateType }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'readStatus',
|
||||||
|
label: '是否已读',
|
||||||
|
content: (data) => h(DictTag, { type: DICT_TYPE.INFRA_BOOLEAN_STRING, value: data?.readStatus }),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'readTime',
|
||||||
|
label: '阅读时间',
|
||||||
|
content: (data) => formatDateTime(data?.readTime) as string,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'templateContent',
|
||||||
|
label: '消息内容',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
const [Modal, modalApi] = useVbenModal({
|
const [Modal, modalApi] = useVbenModal({
|
||||||
async onOpenChange(isOpen: boolean) {
|
async onOpenChange(isOpen: boolean) {
|
||||||
if (!isOpen) {
|
if (!isOpen) {
|
||||||
|
@ -26,6 +64,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
modalApi.lock();
|
modalApi.lock();
|
||||||
try {
|
try {
|
||||||
formData.value = data;
|
formData.value = data;
|
||||||
|
descApi.setState({ data });
|
||||||
} finally {
|
} finally {
|
||||||
modalApi.lock(false);
|
modalApi.lock(false);
|
||||||
}
|
}
|
||||||
|
@ -34,36 +73,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Modal
|
<Modal title="消息详情" :show-cancel-button="false" :show-confirm-button="false">
|
||||||
title="消息详情"
|
<Description />
|
||||||
:show-cancel-button="false"
|
|
||||||
:show-confirm-button="false"
|
|
||||||
>
|
|
||||||
<Descriptions bordered :column="1" size="middle" class="mx-4">
|
|
||||||
<Descriptions.Item label="发送人">
|
|
||||||
{{ formData?.templateNickname }}
|
|
||||||
</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="发送时间">
|
|
||||||
{{ formatDateTime(formData?.createTime) }}
|
|
||||||
</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="消息类型">
|
|
||||||
<DictTag
|
|
||||||
:type="DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE"
|
|
||||||
:value="formData?.templateType"
|
|
||||||
/>
|
|
||||||
</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="是否已读">
|
|
||||||
<DictTag
|
|
||||||
:type="DICT_TYPE.INFRA_BOOLEAN_STRING"
|
|
||||||
:value="formData?.readStatus"
|
|
||||||
/>
|
|
||||||
</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="阅读时间">
|
|
||||||
{{ formatDateTime(formData?.readTime || '') }}
|
|
||||||
</Descriptions.Item>
|
|
||||||
<Descriptions.Item label="消息内容">
|
|
||||||
{{ formData?.templateContent }}
|
|
||||||
</Descriptions.Item>
|
|
||||||
</Descriptions>
|
|
||||||
</Modal>
|
</Modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
export function formatDate(
|
export function formatDate(time: Date | number | string | undefined, format = 'YYYY-MM-DD') {
|
||||||
time: Date | number | string | undefined,
|
|
||||||
format = 'YYYY-MM-DD',
|
|
||||||
) {
|
|
||||||
if (!time) {
|
if (!time) {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import type { VerificationProps } from '../types';
|
||||||
import type { ComponentInternalInstance } from 'vue';
|
import type { ComponentInternalInstance } from 'vue';
|
||||||
|
|
||||||
import type { VerificationProps } from '../types';
|
import { getCurrentInstance, nextTick, onMounted, reactive, ref, toRefs } from 'vue';
|
||||||
|
|
||||||
import {
|
|
||||||
getCurrentInstance,
|
|
||||||
nextTick,
|
|
||||||
onMounted,
|
|
||||||
reactive,
|
|
||||||
ref,
|
|
||||||
toRefs,
|
|
||||||
} from 'vue';
|
|
||||||
|
|
||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
|
|
||||||
|
@ -174,10 +166,7 @@ function canvasClick(e: any) {
|
||||||
// var flag = this.comparePos(this.fontPos, this.checkPosArr);
|
// var flag = this.comparePos(this.fontPos, this.checkPosArr);
|
||||||
// 发送后端请求
|
// 发送后端请求
|
||||||
const captchaVerification = secretKey.value
|
const captchaVerification = secretKey.value
|
||||||
? aesEncrypt(
|
? aesEncrypt(`${backToken.value}---${JSON.stringify(checkPosArr)}`, secretKey.value)
|
||||||
`${backToken.value}---${JSON.stringify(checkPosArr)}`,
|
|
||||||
secretKey.value,
|
|
||||||
)
|
|
||||||
: `${backToken.value}---${JSON.stringify(checkPosArr)}`;
|
: `${backToken.value}---${JSON.stringify(checkPosArr)}`;
|
||||||
const data = {
|
const data = {
|
||||||
captchaType: captchaType.value,
|
captchaType: captchaType.value,
|
||||||
|
@ -212,8 +201,7 @@ function canvasClick(e: any) {
|
||||||
});
|
});
|
||||||
}, 400);
|
}, 400);
|
||||||
}
|
}
|
||||||
if (num.value < checkNum.value)
|
if (num.value < checkNum.value) num.value = createPoint(getMousePos(canvas, e));
|
||||||
num.value = createPoint(getMousePos(canvas, e));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 请求背景图片和验证图片
|
// 请求背景图片和验证图片
|
||||||
|
@ -251,12 +239,7 @@ defineExpose({
|
||||||
}"
|
}"
|
||||||
class="verify-img-panel"
|
class="verify-img-panel"
|
||||||
>
|
>
|
||||||
<div
|
<div v-show="showRefresh" class="verify-refresh" style="z-index: 3" @click="refresh">
|
||||||
v-show="showRefresh"
|
|
||||||
class="verify-refresh"
|
|
||||||
style="z-index: 3"
|
|
||||||
@click="refresh"
|
|
||||||
>
|
|
||||||
<i class="iconfont icon-refresh"></i>
|
<i class="iconfont icon-refresh"></i>
|
||||||
</div>
|
</div>
|
||||||
<img
|
<img
|
||||||
|
|
|
@ -1,45 +1,23 @@
|
||||||
import type { VxeGridProps, VxeUIExport } from 'vxe-table';
|
|
||||||
|
|
||||||
import type { Recordable } from '@vben/types';
|
|
||||||
|
|
||||||
import type { VxeGridApi } from './api';
|
import type { VxeGridApi } from './api';
|
||||||
|
import type { Recordable } from '@vben/types';
|
||||||
|
import type { VxeGridProps, VxeUIExport } from 'vxe-table';
|
||||||
|
|
||||||
import { formatDate, formatDateTime, isFunction } from '@vben/utils';
|
import { formatDate, formatDateTime, isFunction } from '@vben/utils';
|
||||||
|
|
||||||
export function extendProxyOptions(
|
export function extendProxyOptions(api: VxeGridApi, options: VxeGridProps, getFormValues: () => Recordable<any>) {
|
||||||
api: VxeGridApi,
|
['query', 'querySuccess', 'queryError', 'queryAll', 'queryAllSuccess', 'queryAllError'].forEach((key) => {
|
||||||
options: VxeGridProps,
|
|
||||||
getFormValues: () => Recordable<any>,
|
|
||||||
) {
|
|
||||||
[
|
|
||||||
'query',
|
|
||||||
'querySuccess',
|
|
||||||
'queryError',
|
|
||||||
'queryAll',
|
|
||||||
'queryAllSuccess',
|
|
||||||
'queryAllError',
|
|
||||||
].forEach((key) => {
|
|
||||||
extendProxyOption(key, api, options, getFormValues);
|
extendProxyOption(key, api, options, getFormValues);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function extendProxyOption(
|
function extendProxyOption(key: string, api: VxeGridApi, options: VxeGridProps, getFormValues: () => Recordable<any>) {
|
||||||
key: string,
|
|
||||||
api: VxeGridApi,
|
|
||||||
options: VxeGridProps,
|
|
||||||
getFormValues: () => Recordable<any>,
|
|
||||||
) {
|
|
||||||
const { proxyConfig } = options;
|
const { proxyConfig } = options;
|
||||||
const configFn = (proxyConfig?.ajax as Recordable<any>)?.[key];
|
const configFn = (proxyConfig?.ajax as Recordable<any>)?.[key];
|
||||||
if (!isFunction(configFn)) {
|
if (!isFunction(configFn)) {
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wrapperFn = async (
|
const wrapperFn = async (params: Recordable<any>, customValues: Recordable<any>, ...args: Recordable<any>[]) => {
|
||||||
params: Recordable<any>,
|
|
||||||
customValues: Recordable<any>,
|
|
||||||
...args: Recordable<any>[]
|
|
||||||
) => {
|
|
||||||
const formValues = getFormValues();
|
const formValues = getFormValues();
|
||||||
const data = await configFn(
|
const data = await configFn(
|
||||||
params,
|
params,
|
||||||
|
|
Loading…
Reference in New Issue