Merge remote-tracking branch 'yudao/v-next-dev' into v-next-dev
# Conflicts: # apps/web-antd/src/views/system/notify/my/modules/detail.vuepull/80/head
commit
5d3ba20596
|
|
@ -27,7 +27,7 @@ export namespace InfraFileApi {
|
||||||
|
|
||||||
/** 上传文件 */
|
/** 上传文件 */
|
||||||
export interface FileUploadReqVO {
|
export interface FileUploadReqVO {
|
||||||
file: File;
|
file: globalThis.File;
|
||||||
path?: string;
|
path?: string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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,10 +57,6 @@ export function createFile(data: InfraFileApi.File) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 上传文件 */
|
/** 上传文件 */
|
||||||
// TODO @芋艿:这里有爆红
|
export function uploadFile(data: InfraFileApi.FileUploadReqVO, onUploadProgress?: AxiosProgressEvent) {
|
||||||
export function uploadFile(
|
|
||||||
data: InfraFileApi.FileUploadReqVO,
|
|
||||||
onUploadProgress?: AxiosProgressEvent,
|
|
||||||
) {
|
|
||||||
return requestClient.upload('/infra/file/upload', data, { onUploadProgress });
|
return requestClient.upload('/infra/file/upload', data, { onUploadProgress });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
import type { PageParam } from '@vben/request';
|
||||||
|
|
||||||
import { requestClient } from '#/api/request';
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
export namespace SystemDictDataApi {
|
export namespace SystemDictDataApi {
|
||||||
|
|
@ -22,7 +24,7 @@ export function getSimpleDictDataList() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询字典数据列表
|
// 查询字典数据列表
|
||||||
export function getDictDataPage(params: any) {
|
export function getDictDataPage(params: PageParam) {
|
||||||
return requestClient.get('/system/dict-data/page', { params });
|
return requestClient.get('/system/dict-data/page', { params });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 生成文件名称
|
||||||
|
|
@ -113,7 +104,6 @@ export const useUpload = () => {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 模式二:后端上传
|
// 模式二:后端上传
|
||||||
// TODO @芋艿:这里有爆红
|
|
||||||
return uploadFile({ file }, onUploadProgress);
|
return uploadFile({ file }, onUploadProgress);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -138,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,7 +1,4 @@
|
||||||
import type {
|
import type { AppRouteRecordRaw, ComponentRecordType, GenerateMenuAndRoutesOptions } from '@vben/types';
|
||||||
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';
|
||||||
|
|
@ -25,8 +22,8 @@ async function generateAccess(options: GenerateMenuAndRoutesOptions) {
|
||||||
...options,
|
...options,
|
||||||
fetchMenuListAsync: async () => {
|
fetchMenuListAsync: async () => {
|
||||||
// 由于 yudao 通过 accessStore 读取,所以不在进行 message.loading 提示
|
// 由于 yudao 通过 accessStore 读取,所以不在进行 message.loading 提示
|
||||||
const accessMenus = accessStore.accessMenus;
|
// 补充说明:accessStore.accessMenus 一开始是 AppRouteRecordRaw 类型(后端加载),后面被赋值成 MenuRecordRaw 类型(前端转换)
|
||||||
// TODO @芋艿:爆红!!!
|
const accessMenus = accessStore.accessMenus as AppRouteRecordRaw[];
|
||||||
return convertServerMenuToRouteRecordStringComponent(accessMenus);
|
return convertServerMenuToRouteRecordStringComponent(accessMenus);
|
||||||
},
|
},
|
||||||
// 可以指定没有权限跳转403页面
|
// 可以指定没有权限跳转403页面
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,28 @@
|
||||||
import type { RouteRecordRaw } from 'vue-router';
|
import type { RouteRecordRaw } from 'vue-router';
|
||||||
|
|
||||||
import { $t } from '#/locales';
|
// import { $t } from '#/locales';
|
||||||
|
|
||||||
const routes: RouteRecordRaw[] = [
|
const routes: RouteRecordRaw[] = [
|
||||||
{
|
// {
|
||||||
meta: {
|
// meta: {
|
||||||
icon: 'ic:baseline-view-in-ar',
|
// icon: 'ic:baseline-view-in-ar',
|
||||||
keepAlive: true,
|
// keepAlive: true,
|
||||||
order: 1000,
|
// order: 1000,
|
||||||
title: $t('demos.title'),
|
// title: $t('demos.title'),
|
||||||
},
|
// },
|
||||||
name: 'Demos',
|
// name: 'Demos',
|
||||||
path: '/demos',
|
// path: '/demos',
|
||||||
children: [
|
// children: [
|
||||||
{
|
// {
|
||||||
meta: {
|
// meta: {
|
||||||
title: $t('demos.antd'),
|
// title: $t('demos.antd'),
|
||||||
},
|
// },
|
||||||
name: 'AntDesignDemos',
|
// name: 'AntDesignDemos',
|
||||||
path: '/demos/ant-design',
|
// path: '/demos/ant-design',
|
||||||
component: () => import('#/views/demos/antd/index.vue'),
|
// component: () => import('#/views/demos/antd/index.vue'),
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
];
|
];
|
||||||
|
|
||||||
// export default routes; // update by 芋艿:不展示
|
export default routes; // update by 芋艿:不展示
|
||||||
|
|
|
||||||
|
|
@ -1,81 +1,81 @@
|
||||||
import type { RouteRecordRaw } from 'vue-router';
|
import type { RouteRecordRaw } from 'vue-router';
|
||||||
|
|
||||||
import {
|
// import {
|
||||||
VBEN_DOC_URL,
|
// VBEN_DOC_URL,
|
||||||
VBEN_ELE_PREVIEW_URL,
|
// VBEN_ELE_PREVIEW_URL,
|
||||||
VBEN_GITHUB_URL,
|
// VBEN_GITHUB_URL,
|
||||||
VBEN_LOGO_URL,
|
// VBEN_LOGO_URL,
|
||||||
VBEN_NAIVE_PREVIEW_URL,
|
// VBEN_NAIVE_PREVIEW_URL,
|
||||||
} from '@vben/constants';
|
// } from '@vben/constants';
|
||||||
|
//
|
||||||
import { IFrameView } from '#/layouts';
|
// import { IFrameView } from '#/layouts';
|
||||||
import { $t } from '#/locales';
|
// import { $t } from '#/locales';
|
||||||
|
|
||||||
const routes: RouteRecordRaw[] = [
|
const routes: RouteRecordRaw[] = [
|
||||||
{
|
// {
|
||||||
meta: {
|
// meta: {
|
||||||
badgeType: 'dot',
|
// badgeType: 'dot',
|
||||||
icon: VBEN_LOGO_URL,
|
// icon: VBEN_LOGO_URL,
|
||||||
order: 9998,
|
// order: 9998,
|
||||||
title: $t('demos.vben.title'),
|
// title: $t('demos.vben.title'),
|
||||||
},
|
// },
|
||||||
name: 'VbenProject',
|
// name: 'VbenProject',
|
||||||
path: '/vben-admin',
|
// path: '/vben-admin',
|
||||||
children: [
|
// children: [
|
||||||
{
|
// {
|
||||||
name: 'VbenDocument',
|
// name: 'VbenDocument',
|
||||||
path: '/vben-admin/document',
|
// path: '/vben-admin/document',
|
||||||
component: IFrameView,
|
// component: IFrameView,
|
||||||
meta: {
|
// meta: {
|
||||||
icon: 'lucide:book-open-text',
|
// icon: 'lucide:book-open-text',
|
||||||
link: VBEN_DOC_URL,
|
// link: VBEN_DOC_URL,
|
||||||
title: $t('demos.vben.document'),
|
// title: $t('demos.vben.document'),
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: 'VbenGithub',
|
// name: 'VbenGithub',
|
||||||
path: '/vben-admin/github',
|
// path: '/vben-admin/github',
|
||||||
component: IFrameView,
|
// component: IFrameView,
|
||||||
meta: {
|
// meta: {
|
||||||
icon: 'mdi:github',
|
// icon: 'mdi:github',
|
||||||
link: VBEN_GITHUB_URL,
|
// link: VBEN_GITHUB_URL,
|
||||||
title: 'Github',
|
// title: 'Github',
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: 'VbenNaive',
|
// name: 'VbenNaive',
|
||||||
path: '/vben-admin/naive',
|
// path: '/vben-admin/naive',
|
||||||
component: IFrameView,
|
// component: IFrameView,
|
||||||
meta: {
|
// meta: {
|
||||||
badgeType: 'dot',
|
// badgeType: 'dot',
|
||||||
icon: 'logos:naiveui',
|
// icon: 'logos:naiveui',
|
||||||
link: VBEN_NAIVE_PREVIEW_URL,
|
// link: VBEN_NAIVE_PREVIEW_URL,
|
||||||
title: $t('demos.vben.naive-ui'),
|
// title: $t('demos.vben.naive-ui'),
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: 'VbenElementPlus',
|
// name: 'VbenElementPlus',
|
||||||
path: '/vben-admin/ele',
|
// path: '/vben-admin/ele',
|
||||||
component: IFrameView,
|
// component: IFrameView,
|
||||||
meta: {
|
// meta: {
|
||||||
badgeType: 'dot',
|
// badgeType: 'dot',
|
||||||
icon: 'logos:element',
|
// icon: 'logos:element',
|
||||||
link: VBEN_ELE_PREVIEW_URL,
|
// link: VBEN_ELE_PREVIEW_URL,
|
||||||
title: $t('demos.vben.element-plus'),
|
// title: $t('demos.vben.element-plus'),
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
],
|
// ],
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: 'VbenAbout',
|
// name: 'VbenAbout',
|
||||||
path: '/vben-admin/about',
|
// path: '/vben-admin/about',
|
||||||
component: () => import('#/views/_core/about/index.vue'),
|
// component: () => import('#/views/_core/about/index.vue'),
|
||||||
meta: {
|
// meta: {
|
||||||
icon: 'lucide:copyright',
|
// icon: 'lucide:copyright',
|
||||||
title: $t('demos.vben.about'),
|
// title: $t('demos.vben.about'),
|
||||||
order: 9999,
|
// order: 9999,
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
];
|
];
|
||||||
|
|
||||||
// export default routes; // update by 芋艿:不展示
|
export default routes; // update by 芋艿:不展示
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,28 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {type SystemUserProfileApi, updateUserPassword} from '#/api/system/user/profile';
|
import type { SystemUserProfileApi } from '#/api/system/user/profile';
|
||||||
|
|
||||||
import {Descriptions, DescriptionsItem, message, Tooltip} from 'ant-design-vue';
|
|
||||||
import { IconifyIcon } from '@vben/icons';
|
|
||||||
|
|
||||||
import { computed } from 'vue';
|
|
||||||
import { preferences } from '@vben/preferences';
|
|
||||||
import { updateUserProfile } from '#/api/system/user/profile';
|
|
||||||
import { formatDateTime } from '@vben/utils';
|
|
||||||
import { CropperAvatar } from '#/components/cropper';
|
import { CropperAvatar } from '#/components/cropper';
|
||||||
import { useUpload } from '#/components/upload/use-upload';
|
import { useUpload } from '#/components/upload/use-upload';
|
||||||
|
import { IconifyIcon } from '@vben/icons';
|
||||||
|
import { Descriptions, DescriptionsItem, Tooltip } from 'ant-design-vue';
|
||||||
|
|
||||||
const props = defineProps<{ profile?: SystemUserProfileApi.UserProfileRespVO }>();
|
import { updateUserProfile } from '#/api/system/user/profile';
|
||||||
|
import { computed } from 'vue';
|
||||||
|
|
||||||
|
import { preferences } from '@vben/preferences';
|
||||||
|
import { formatDateTime } from '@vben/utils';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
profile?: SystemUserProfileApi.UserProfileRespVO;
|
||||||
|
}>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
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({ file, filename }: { file: Blob; filename: string; }) {
|
async function handelUpload({ file, filename }: { file: Blob; filename: string }) {
|
||||||
// 1. 上传头像,获取 URL
|
// 1. 上传头像,获取 URL
|
||||||
const { httpRequest } = useUpload();
|
const { httpRequest } = useUpload();
|
||||||
// 将 Blob 转换为 File
|
// 将 Blob 转换为 File
|
||||||
|
|
@ -63,7 +64,7 @@ async function handelUpload({ file, filename }: { file: Blob; filename: string;
|
||||||
所属角色
|
所属角色
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
{{ profile.roles.map(role => role.name).join(',') }}
|
{{ profile.roles.map((role) => role.name).join(',') }}
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
<DescriptionsItem>
|
<DescriptionsItem>
|
||||||
<template #label>
|
<template #label>
|
||||||
|
|
@ -99,7 +100,7 @@ async function handelUpload({ file, filename }: { file: Blob; filename: string;
|
||||||
所属岗位
|
所属岗位
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
{{ profile.posts.map(post => post.name).join(',') }}
|
{{ profile.posts.map((post) => post.name).join(',') }}
|
||||||
</DescriptionsItem>
|
</DescriptionsItem>
|
||||||
<DescriptionsItem>
|
<DescriptionsItem>
|
||||||
<template #label>
|
<template #label>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
import { Page } from '@vben/common-ui';
|
import { Page } from '@vben/common-ui';
|
||||||
|
import { Button } from 'ant-design-vue';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -10,8 +9,13 @@ import { Page } from '@vben/common-ui';
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
该功能支持 Vue3 + element-plus 版本!
|
||||||
</Button>
|
</Button>
|
||||||
<br />
|
<br />
|
||||||
<Button type="link" target="_blank" href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/model/index">
|
<Button
|
||||||
可参考 https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/model/index 代码,pull request 贡献给我们!
|
type="link"
|
||||||
|
target="_blank"
|
||||||
|
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
|
||||||
|
贡献给我们!
|
||||||
</Button>
|
</Button>
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { DocAlert } from '#/components/doc-alert';
|
|
||||||
import { Button } from 'ant-design-vue';
|
|
||||||
import { Page } from '@vben/common-ui';
|
import { Page } from '@vben/common-ui';
|
||||||
|
import { Button } from 'ant-design-vue';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -10,8 +9,13 @@ import { Page } from '@vben/common-ui';
|
||||||
该功能支持 Vue3 + element-plus 版本!
|
该功能支持 Vue3 + element-plus 版本!
|
||||||
</Button>
|
</Button>
|
||||||
<br />
|
<br />
|
||||||
<Button type="link" target="_blank" href="https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/processInstance/create/index">
|
<Button
|
||||||
可参考 https://github.com/yudaocode/yudao-ui-admin-vue3/blob/master/src/views/bpm/processInstance/create/index 代码,pull request 贡献给我们!
|
type="link"
|
||||||
|
target="_blank"
|
||||||
|
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
|
||||||
|
代码,pull request 贡献给我们!
|
||||||
</Button>
|
</Button>
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -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,13 +65,10 @@ 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>
|
||||||
<!-- TODO @芋艿:处理爆红 -->
|
<div v-else-if="formData && formData?.resultCode > 0">
|
||||||
<div v-else-if="formData?.resultCode > 0">
|
|
||||||
失败 | {{ formData?.resultCode }} | {{ formData?.resultMsg }}
|
失败 | {{ formData?.resultCode }} | {{ formData?.resultMsg }}
|
||||||
</div>
|
</div>
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
|
|
@ -96,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', ['学生']);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 子表的表单 */
|
/** 子表的表单 */
|
||||||
|
|
@ -54,12 +46,11 @@ const [Modal, modalApi] = useVbenModal({
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const data = (await formApi.getValues()) as Demo03StudentApi.Demo03Student;
|
const data = (await formApi.getValues()) as Demo03StudentApi.Demo03Student;
|
||||||
// 拼接子表的数据
|
// 拼接子表的数据
|
||||||
|
// TODO @puhui999:字段对不上
|
||||||
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');
|
||||||
|
|
@ -103,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" />
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
import type { VbenFormSchema } from '#/adapter/form';
|
import type { VbenFormSchema } from '#/adapter/form';
|
||||||
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
import type { SystemDictDataApi } from '#/api/system/dict/data';
|
||||||
import { useAccess } from '@vben/access';
|
import type { SystemDictTypeApi } from '#/api/system/dict/type';
|
||||||
|
|
||||||
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();
|
||||||
|
|
||||||
// ============================== 字典类型 ==============================
|
// ============================== 字典类型 ==============================
|
||||||
|
|
@ -94,7 +96,7 @@ export function useTypeGridFormSchema(): VbenFormSchema[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 类型列表的字段 */
|
/** 类型列表的字段 */
|
||||||
export function useTypeGridColumns<T = any>(
|
export function useTypeGridColumns<T = SystemDictTypeApi.DictType>(
|
||||||
onActionClick: OnActionClickFn<T>,
|
onActionClick: OnActionClickFn<T>,
|
||||||
): VxeTableGridOptions['columns'] {
|
): VxeTableGridOptions['columns'] {
|
||||||
return [
|
return [
|
||||||
|
|
@ -312,7 +314,7 @@ export function useDataGridFormSchema(): VbenFormSchema[] {
|
||||||
/**
|
/**
|
||||||
* 字典数据表格列
|
* 字典数据表格列
|
||||||
*/
|
*/
|
||||||
export function useDataGridColumns<T = any>(
|
export function useDataGridColumns<T = SystemDictDataApi.DictData>(
|
||||||
onActionClick: OnActionClickFn<T>,
|
onActionClick: OnActionClickFn<T>,
|
||||||
): VxeTableGridOptions['columns'] {
|
): VxeTableGridOptions['columns'] {
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,16 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { OnActionClickParams } from '#/adapter/vxe-table';
|
import type { OnActionClickParams, VxeTableGridOptions } from '#/adapter/vxe-table';
|
||||||
|
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';
|
||||||
|
|
@ -100,8 +95,8 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
return await getDictDataPage({
|
return await getDictDataPage({
|
||||||
pageNo: page.currentPage,
|
pageNo: page.currentPage,
|
||||||
pageSize: page.pageSize,
|
pageSize: page.pageSize,
|
||||||
...formValues,
|
|
||||||
dictType: props.dictType,
|
dictType: props.dictType,
|
||||||
|
...formValues,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -113,7 +108,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
refresh: { code: 'query' },
|
refresh: { code: 'query' },
|
||||||
search: true,
|
search: true,
|
||||||
},
|
},
|
||||||
},
|
} as VxeTableGridOptions<SystemDictDataApi.DictData>,
|
||||||
});
|
});
|
||||||
|
|
||||||
/** 监听 dictType 变化,重新查询 */
|
/** 监听 dictType 变化,重新查询 */
|
||||||
|
|
@ -133,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,18 +1,13 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { OnActionClickParams } from '#/adapter/vxe-table';
|
import type { 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';
|
||||||
|
|
||||||
|
|
@ -67,7 +62,7 @@ async function onDelete(row: SystemDictTypeApi.DictType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 表格操作按钮回调 */
|
/** 表格操作按钮回调 */
|
||||||
function onActionClick({ code, row }: OnActionClickParams) {
|
function onActionClick({ code, row }: OnActionClickParams<SystemDictTypeApi.DictType>) {
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case 'delete': {
|
case 'delete': {
|
||||||
onDelete(row);
|
onDelete(row);
|
||||||
|
|
@ -81,8 +76,7 @@ function onActionClick({ code, row }: OnActionClickParams) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 表格事件 */
|
/** 表格事件 */
|
||||||
// TODO @芋艿:这里有爆红
|
const gridEvents: VxeGridListeners<SystemDictTypeApi.DictType> = {
|
||||||
const gridEvents: VxeGridListeners<RowType> = {
|
|
||||||
cellClick: ({ row }) => {
|
cellClick: ({ row }) => {
|
||||||
emit('select', row.type);
|
emit('select', row.type);
|
||||||
},
|
},
|
||||||
|
|
@ -115,7 +109,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
refresh: { code: 'query' },
|
refresh: { code: 'query' },
|
||||||
search: true,
|
search: true,
|
||||||
},
|
},
|
||||||
},
|
} as VxeTableGridOptions<SystemDictTypeApi.DictType>,
|
||||||
gridEvents,
|
gridEvents,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -126,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,6 +1,9 @@
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
export function formatDate(time: number | string | Date, format = 'YYYY-MM-DD') {
|
export function formatDate(time: Date | number | string | undefined, format = 'YYYY-MM-DD') {
|
||||||
|
if (!time) {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const date = dayjs(time);
|
const date = dayjs(time);
|
||||||
if (!date.isValid()) {
|
if (!date.isValid()) {
|
||||||
|
|
@ -13,7 +16,10 @@ export function formatDate(time: number | string | Date, format = 'YYYY-MM-DD')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatDateTime(time: number | string | Date) {
|
export function formatDateTime(time: Date | number | string | undefined) {
|
||||||
|
if (!time) {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
return formatDate(time, 'YYYY-MM-DD HH:mm:ss');
|
return formatDate(time, 'YYYY-MM-DD HH:mm:ss');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,8 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { VerificationProps } from '../types';
|
import type { VerificationProps } from '../types';
|
||||||
|
import type { ComponentInternalInstance } from 'vue';
|
||||||
|
|
||||||
import {
|
import { getCurrentInstance, nextTick, onMounted, reactive, ref, toRefs } from 'vue';
|
||||||
type ComponentInternalInstance,
|
|
||||||
getCurrentInstance,
|
|
||||||
nextTick,
|
|
||||||
onMounted,
|
|
||||||
reactive,
|
|
||||||
ref,
|
|
||||||
toRefs,
|
|
||||||
} from 'vue';
|
|
||||||
|
|
||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
|
|
||||||
|
|
@ -127,7 +120,7 @@ onMounted(() => {
|
||||||
const canvas = ref(null);
|
const canvas = ref(null);
|
||||||
|
|
||||||
// 获取坐标
|
// 获取坐标
|
||||||
const getMousePos = function (obj: any, e: any) {
|
const getMousePos = function (_obj: any, e: any) {
|
||||||
const x = e.offsetX;
|
const x = e.offsetX;
|
||||||
const y = e.offsetY;
|
const y = e.offsetY;
|
||||||
return { x, y };
|
return { x, y };
|
||||||
|
|
@ -173,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,
|
||||||
|
|
@ -211,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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 请求背景图片和验证图片
|
// 请求背景图片和验证图片
|
||||||
|
|
@ -250,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,
|
||||||
|
|
@ -69,13 +47,13 @@ function extendProxyOption(
|
||||||
export function extendsDefaultFormatter(vxeUI: VxeUIExport) {
|
export function extendsDefaultFormatter(vxeUI: VxeUIExport) {
|
||||||
vxeUI.formats.add('formatDate', {
|
vxeUI.formats.add('formatDate', {
|
||||||
tableCellFormatMethod({ cellValue }) {
|
tableCellFormatMethod({ cellValue }) {
|
||||||
return formatDate(cellValue);
|
return formatDate(cellValue) as string;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
vxeUI.formats.add('formatDateTime', {
|
vxeUI.formats.add('formatDateTime', {
|
||||||
tableCellFormatMethod({ cellValue }) {
|
tableCellFormatMethod({ cellValue }) {
|
||||||
return formatDateTime(cellValue);
|
return formatDateTime(cellValue) as string;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue