3 Commits
vite8 ... dev

Author SHA1 Message Date
YunaiV
1cbdf442ee feat: 添加 URL 验证工具函数并优化 area-select 组件的类型定义 2026-03-07 17:33:02 +08:00
YunaiV
f91a2702c9 merge: 合并 master 分支的 form-create 修复
合并 master 分支中关于 form-create 组件的修复,包括 area-select 和 iframe 组件的改进。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 11:32:54 +08:00
YunaiV
a8f67ab717 !335 fix: 修复上传头像时,如果图片加载失败,弹框一直loading的问题,针对 ele 版本 2026-03-07 11:21:03 +08:00
648 changed files with 11029 additions and 12955 deletions

7
.gitignore vendored
View File

@@ -50,10 +50,3 @@ vite.config.ts.*
*.sw?
.history
.cursor
# AI
.agent
.agents
.claude
.codex
skills-lock.json

4
.npmrc
View File

@@ -1,8 +1,8 @@
registry=https://registry.npmmirror.com
public-hoist-pattern[]=lefthook
public-hoist-pattern[]=eslint
public-hoist-pattern[]=oxfmt
public-hoist-pattern[]=oxlint
public-hoist-pattern[]=prettier
public-hoist-pattern[]=prettier-plugin-tailwindcss
public-hoist-pattern[]=stylelint
public-hoist-pattern[]=*postcss*
public-hoist-pattern[]=@commitlint/*

18
.prettierignore Normal file
View File

@@ -0,0 +1,18 @@
dist
dev-dist
.local
.output.js
node_modules
.nvmrc
coverage
CODEOWNERS
.nitro
.output
**/*.svg
**/*.sh
public
.npmrc
*-lock.yaml

1
.prettierrc.mjs Normal file
View File

@@ -0,0 +1 @@
export { default } from '@vben/prettier-config';

View File

@@ -2,7 +2,3 @@ dist
public
__tests__
coverage
.codex
.claude
.agent
.agents

View File

@@ -2,18 +2,14 @@
"recommendations": [
// Vue 3 的语言支持
"Vue.volar",
// 将 eslint 集成到 VS Code 中。
// 将 ESLint JavaScript 集成到 VS Code 中。
"dbaeumer.vscode-eslint",
// 将 oxlint 集成到 VS Code 中。
"oxc.oxc-vscode",
// Visual Studio Code 的官方 Stylelint 扩展
"stylelint.vscode-stylelint",
// 使用 oxfmt 的代码格式化程序
"oxc.oxc-vscode",
// 使用 Prettier 的代码格式化程序
"esbenp.prettier-vscode",
// 支持 dotenv 文件语法
"mikestead.dotenv",
// YAML 语言支持,供 ESLint 校验 pnpm-workspace.yaml 等文件
"redhat.vscode-yaml",
// 源代码的拼写检查器
"streetsidesoftware.code-spell-checker",
// Tailwind CSS 的官方 VS Code 插件

48
.vscode/settings.json vendored
View File

@@ -1,6 +1,5 @@
{
"tailwindCSS.experimental.configFile": "internal/tailwind-config/src/theme.css",
"tailwindCSS.lint.suggestCanonicalClasses": "ignore",
"tailwindCSS.experimental.configFile": "internal/tailwind-config/src/index.ts",
// workbench
"workbench.list.smoothScrolling": true,
"workbench.startupEditor": "newUntitledFile",
@@ -32,51 +31,39 @@
"editor.autoClosingOvertype": "always",
"editor.autoClosingQuotes": "beforeWhitespace",
"editor.wordSeparators": "`~!@#%^&*()=+[{]}\\|;:'\",.<>/?",
"editor.quickSuggestions": {
"strings": "on"
},
// lint && format
"oxc.enable": true,
"oxc.typeAware": true,
"oxc.configPath": "oxlint.config.ts",
"oxc.fmt.configPath": "oxfmt.config.ts",
"eslint.useFlatConfig": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.oxc": "explicit",
"source.fixAll.stylelint": "explicit",
"source.organizeImports": "never"
},
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[html]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[jsonc]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.defaultFormatter": "oxc.oxc-vscode"
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
// extensions
"extensions.ignoreRecommendations": true,
@@ -92,7 +79,6 @@
"files.insertFinalNewline": true,
"files.simpleDialog.enable": true,
"files.associations": {
"*.css": "tailwindcss",
"*.ejs": "html",
"*.art": "html",
"**/tsconfig.json": "jsonc",
@@ -132,7 +118,7 @@
// search
"search.searchEditor.singleClickBehaviour": "peekDefinition",
"search.followSymlinks": false,
// 使用搜索功能时,将这些文件文件排除在外
// 使用搜索功能时,将这些文件夹/文件排除在外
"search.exclude": {
"**/node_modules": true,
"**/*.log": true,
@@ -173,7 +159,7 @@
"emmet.triggerExpansionOnTab": false,
"errorLens.enabledDiagnosticLevels": ["warning", "error"],
"errorLens.excludeBySource": ["cSpell", "Grammarly"],
"errorLens.excludeBySource": ["cSpell", "Grammarly", "eslint"],
"stylelint.enable": true,
"stylelint.packageManager": "pnpm",
@@ -207,7 +193,7 @@
"*": false
},
"cssVariables.lookupFiles": ["packages/@core/base/design/src/**/*.css"],
"cssVariables.lookupFiles": ["packages/core/base/design/src/**/*.css"],
"i18n-ally.localesPaths": [
"packages/locales/src/langs",
@@ -232,10 +218,12 @@
"*.env": "$(capture).env.*",
"README.md": "README*,CHANGELOG*,LICENSE,CNAME",
"package.json": "pnpm-lock.yaml,pnpm-workspace.yaml,.gitattributes,.gitignore,.gitpod.yml,.npmrc,.browserslistrc,.node-version,.git*,.tazerc.json",
"oxlint.config.ts": ".eslintignore,.stylelintignore,.commitlintrc.*,stylelint.config.*,.lintstagedrc.mjs,cspell.json,lefthook.yml,oxfmt.config.*,eslint.config.*"
"eslint.config.mjs": ".eslintignore,.prettierignore,.stylelintignore,.commitlintrc.*,.prettierrc.*,stylelint.config.*,.lintstagedrc.mjs,cspell.json,lefthook.yml",
"tailwind.config.mjs": "postcss.*"
},
"commentTranslate.hover.enabled": false,
"commentTranslate.multiLineMerge": true,
"vue.server.hybridMode": true,
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"oxc.enable": false
}

View File

@@ -9,7 +9,7 @@
## 🐶 新手必读
- nodejs >= v20.19.0(推荐 v22 / v24 && pnpm >= 10.32.1强制使用 pnpm
- nodejs > v20.19.0 | v22 | v24 && pnpm > 10.20.0 (强制使用pnpm)
- 演示地址【Vue3 + element-plus】<http://dashboard-vue3.yudao.iocoder.cn>
- 演示地址【Vue3 + vben5(ant-design-vue)】:<http://dashboard-vben.yudao.iocoder.cn>
- 演示地址【Vue2 + element-ui】<http://dashboard.yudao.iocoder.cn>
@@ -20,12 +20,12 @@
**芋道**,以开发者为中心,打造中国第一流的快速开发平台,全部开源,个人与企业可 100% 免费使用。
- 采用最新 [vue-vben-admin](https://github.com/vbenjs/vue-vben-admin) v5.7.0 实现
- 采用最新 [vue-vben-admin](https://github.com/vbenjs/vue-vben-admin) v5 实现
- 支持 [Ant Design Vue](https://www.antdv.com/) | [Element Plus](https://element-plus.org/zh-CN/) | [Naive UI](https://www.naiveui.com/) | [TDesign](https://tdesign.tencent.com/) 多种免费开源的中后台模版,具备如下特性:
![首页](.gitee/image/demo/vben.png)
- **最新技术栈**:使用 Vue3、Vite8 等前端前沿技术开发
- **最新技术栈**:使用 Vue3、Vite7 等前端前沿技术开发
- **TypeScript**: 应用程序级 JavaScript 的语言
- **主题**: 提供多套主题色彩,可配置自定义主题
- **国际化**:内置完善的国际化方案
@@ -41,24 +41,24 @@
| 框架 | 说明 | 版本 |
| --- | --- | --- |
| [Vue](https://staging-cn.vuejs.org/) | vue框架 | 3.5.30 |
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 8.0.0 |
| [Vue](https://staging-cn.vuejs.org/) | vue框架 | 3.5.27 |
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 7.3.1 |
| [Ant Design Vue](https://www.antdv.com/) | Ant Design Vue | 4.2.6 |
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.13.5 |
| [Naive UI](https://www.naiveui.com/) | Naive UI | 2.44.1 |
| [TDesign](https://tdesign.tencent.com/) | TDesign | 1.18.5 |
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.13.1 |
| [Naive UI](https://www.naiveui.com/) | Naive UI | 2.43.2 |
| [TDesign](https://tdesign.tencent.com/) | TDesign | 1.18.0 |
| [TypeScript](https://www.typescriptlang.org/docs/) | JavaScript 超集 | 5.9.3 |
| [pinia](https://pinia.vuejs.org/) | Vue 存储库替代 vuex5 | 3.0.4 |
| [vueuse](https://vueuse.org/) | 常用工具集 | 14.2.1 |
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 11.3.0 |
| [vue-router](https://router.vuejs.org/) | Vue 路由 | 5.0.3 |
| [Tailwind CSS](https://tailwindcss.com/) | 原子 CSS | 4.2.1 |
| [vueuse](https://vueuse.org/) | 常用工具集 | 14.1.0 |
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 11.2.8 |
| [vue-router](https://router.vuejs.org/) | Vue 路由 | 4.6.4 |
| [Tailwind CSS](https://tailwindcss.com/) | 原子 CSS | 3.4.19 |
| [Iconify](https://iconify.design/) | 图标组件 | 5.0.0 |
| [Iconify](https://icon-sets.iconify.design/) | 在线图标库 | 2.2.449 |
| [Iconify](https://icon-sets.iconify.design/) | 在线图标库 | 2.2.431 |
| [TinyMCE](https://www.tiny.cloud/) | 富文本编辑器 | 7.3.0 |
| [Echarts](https://echarts.apache.org/) | 图表库 | 6.0.0 |
| [axios](https://axios-http.com/) | http客户端 | 1.13.6 |
| [dayjs](https://day.js.org/) | 日期处理库 | 1.11.20 |
| [axios](https://axios-http.com/) | http客户端 | 1.13.2 |
| [dayjs](https://day.js.org/) | 日期处理库 | 1.11.19 |
| [vee-validate](https://vee-validate.logaretm.com/) | 表单验证 | 4.15.1 |
| [zod](https://zod.dev/) | 数据验证 | 3.25.76 |

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/web-antd",
"version": "5.7.0",
"version": "5.6.0",
"homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {

View File

@@ -0,0 +1 @@
export { default } from '@vben/tailwind-config/postcss';

View File

@@ -2537,12 +2537,12 @@ interface EditorSelection {
normalize: () => Range;
selectorChanged: (selector: string, callback: (active: boolean, args: {
node: Node;
selector: string;
selector: String;
parents: Node[];
}) => void) => EditorSelection;
selectorChangedWithUnbind: (selector: string, callback: (active: boolean, args: {
node: Node;
selector: string;
selector: String;
parents: Node[];
}) => void) => {
unbind: () => void;
@@ -3217,9 +3217,9 @@ interface Tools {
<T, R>(arr: ArrayLike<T> | null | undefined, cb: ArrayCallback<T, R>): R[];
<T, R>(obj: Record<string, T> | null | undefined, cb: ObjCallback<T, R>): R[];
};
extend: (obj: object, ext: object, ...objs: object[]) => any;
extend: (obj: Object, ext: Object, ...objs: Object[]) => any;
walk: <T extends Record<string, any>>(obj: T, f: WalkCallback<T>, n?: keyof T, scope?: any) => void;
resolve: (path: string, o?: object) => any;
resolve: (path: string, o?: Object) => any;
explode: (s: string | string[], d?: string | RegExp) => string[];
_addCacheSuffix: (url: string) => string;
}

View File

@@ -14,7 +14,6 @@ import type {
import type { Component, Ref } from 'vue';
import type { BaseFormComponentType } from '@vben/common-ui';
import type { Sortable } from '@vben/hooks';
import type { Recordable } from '@vben/types';
import {
@@ -22,9 +21,6 @@ import {
defineAsyncComponent,
defineComponent,
h,
nextTick,
onMounted,
onUnmounted,
ref,
render,
unref,
@@ -37,7 +33,6 @@ import {
IconPicker,
VCropper,
} from '@vben/common-ui';
import { useSortable } from '@vben/hooks';
import { IconifyIcon } from '@vben/icons';
import { $t } from '@vben/locales';
import { isEmpty } from '@vben/utils';
@@ -137,261 +132,260 @@ const withDefaultPlaceholder = <T extends Component>(
});
};
const IMAGE_EXTENSIONS = new Set([
'bmp',
'gif',
'jpeg',
'jpg',
'png',
'svg',
'webp',
]);
/**
* 检查是否为图片文件
*/
function isImageFile(file: UploadFile): boolean {
if (file.url) {
try {
const pathname = new URL(file.url, 'http://localhost').pathname;
const ext = pathname.split('.').pop()?.toLowerCase();
return ext ? IMAGE_EXTENSIONS.has(ext) : false;
} catch {
const ext = file.url?.split('.').pop()?.toLowerCase();
return ext ? IMAGE_EXTENSIONS.has(ext) : false;
const withPreviewUpload = () => {
// 检查是否为图片文件的辅助函数
const isImageFile = (file: UploadFile): boolean => {
const imageExtensions = new Set([
'bmp',
'gif',
'jpeg',
'jpg',
'png',
'svg',
'webp',
]);
if (file.url) {
try {
const pathname = new URL(file.url, 'http://localhost').pathname;
const ext = pathname.split('.').pop()?.toLowerCase();
return ext ? imageExtensions.has(ext) : false;
} catch {
const ext = file.url?.split('.').pop()?.toLowerCase();
return ext ? imageExtensions.has(ext) : false;
}
}
}
if (!file.type) {
const ext = file.name?.split('.').pop()?.toLowerCase();
return ext ? IMAGE_EXTENSIONS.has(ext) : false;
}
return file.type.startsWith('image/');
}
/**
* 创建默认的上传按钮插槽
*/
function createDefaultUploadSlots(listType: string, placeholder: string) {
if (listType === 'picture-card') {
return { default: () => placeholder };
}
return {
default: () =>
h(
Button,
{
icon: h(IconifyIcon, {
icon: 'ant-design:upload-outlined',
class: 'mb-1 size-4',
}),
},
() => placeholder,
),
if (!file.type) {
const ext = file.name?.split('.').pop()?.toLowerCase();
return ext ? imageExtensions.has(ext) : false;
}
return file.type.startsWith('image/');
};
}
/**
* 获取文件的 Base64
*/
function getBase64(file: File): Promise<string> {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.addEventListener('load', () => resolve(reader.result as string));
reader.addEventListener('error', reject);
});
}
/**
* 预览图片
*/
async function previewImage(
file: UploadFile,
visible: Ref<boolean>,
fileList: Ref<UploadProps['fileList']>,
) {
// 非图片文件直接打开链接
if (!isImageFile(file)) {
const url = file.url || file.preview;
if (url) {
window.open(url, '_blank');
} else {
message.error($t('ui.formRules.previewWarning'));
}
return;
}
const [ImageComponent, PreviewGroupComponent] = await Promise.all([
Image,
PreviewGroup,
]);
// 过滤图片文件并生成预览
const imageFiles = (unref(fileList) || []).filter((f) => isImageFile(f));
for (const imgFile of imageFiles) {
if (!imgFile.url && !imgFile.preview && imgFile.originFileObj) {
imgFile.preview = await getBase64(imgFile.originFileObj);
}
}
const container = document.createElement('div');
document.body.append(container);
let isUnmounted = false;
const currentIndex = imageFiles.findIndex((f) => f.uid === file.uid);
const PreviewWrapper = {
setup() {
return () => {
if (isUnmounted) return null;
return h(
PreviewGroupComponent,
{
class: 'hidden',
preview: {
visible: visible.value,
current: currentIndex,
onVisibleChange: (value: boolean) => {
visible.value = value;
if (!value) {
setTimeout(() => {
if (!isUnmounted && container) {
isUnmounted = true;
render(null, container);
container.remove();
}
}, 300);
}
// 创建默认的上传按钮插槽
const createDefaultSlotsWithUpload = (
listType: string,
placeholder: string,
) => {
switch (listType) {
case 'picture-card': {
return {
default: () => placeholder,
};
}
default: {
return {
default: () =>
h(
Button,
{
icon: h(IconifyIcon, {
icon: 'ant-design:upload-outlined',
class: 'mb-1 size-4',
}),
},
},
},
() =>
imageFiles.map((imgFile) =>
h(ImageComponent, {
key: imgFile.uid,
src: imgFile.url || imgFile.preview,
}),
() => placeholder,
),
);
};
},
};
}
}
};
// 构建预览图片组
const previewImage = async (
file: UploadFile,
visible: Ref<boolean>,
fileList: Ref<UploadProps['fileList']>,
) => {
// 如果当前文件不是图片,直接打开
if (!isImageFile(file)) {
if (file.url) {
window.open(file.url, '_blank');
} else if (file.preview) {
window.open(file.preview, '_blank');
} else {
message.error($t('ui.formRules.previewWarning'));
}
return;
}
render(h(PreviewWrapper), container);
}
// 对于图片文件,继续使用预览组
const [ImageComponent, PreviewGroupComponent] = await Promise.all([
Image,
PreviewGroup,
]);
/**
* 图片裁剪操作
*/
function cropImage(file: File, aspectRatio: string | undefined) {
return new Promise<Blob | string | undefined>((resolve, reject) => {
const container = document.createElement('div');
const getBase64 = (file: File) => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.addEventListener('load', () => resolve(reader.result));
reader.addEventListener('error', (error) => reject(error));
});
};
// 从fileList中过滤出所有图片文件
const imageFiles = (unref(fileList) || []).filter((element) =>
isImageFile(element),
);
// 为所有没有预览地址的图片生成预览
for (const imgFile of imageFiles) {
if (!imgFile.url && !imgFile.preview && imgFile.originFileObj) {
imgFile.preview = (await getBase64(imgFile.originFileObj)) as string;
}
}
const container: HTMLElement | null = document.createElement('div');
document.body.append(container);
// 用于追踪组件是否已卸载
let isUnmounted = false;
let objectUrl: null | string = null;
const open = ref<boolean>(true);
const cropperRef = ref<InstanceType<typeof VCropper> | null>(null);
const closeModal = () => {
open.value = false;
setTimeout(() => {
if (!isUnmounted && container) {
if (objectUrl) {
URL.revokeObjectURL(objectUrl);
}
isUnmounted = true;
render(null, container);
container.remove();
}
}, 300);
};
const CropperWrapper = {
const PreviewWrapper = {
setup() {
return () => {
if (isUnmounted) return null;
if (!objectUrl) {
objectUrl = URL.createObjectURL(file);
}
return h(
Modal,
PreviewGroupComponent,
{
open: open.value,
title: h('div', {}, [
$t('ui.crop.title'),
h(
'span',
{
class: `${aspectRatio ? '' : 'hidden'} ml-2 text-sm text-gray-400 font-normal`,
},
$t('ui.crop.titleTip', [aspectRatio]),
),
]),
centered: true,
width: 548,
keyboard: false,
maskClosable: false,
closable: false,
cancelText: $t('common.cancel'),
okText: $t('ui.crop.confirm'),
destroyOnClose: true,
onOk: async () => {
const cropper = cropperRef.value;
if (!cropper) {
reject(new Error('Cropper not found'));
closeModal();
return;
}
try {
const dataUrl = await cropper.getCropImage();
if (dataUrl) {
resolve(dataUrl);
} else {
reject(new Error($t('ui.crop.errorTip')));
class: 'hidden',
preview: {
visible: visible.value,
// 设置初始显示的图片索引
current: imageFiles.findIndex((f) => f.uid === file.uid),
onVisibleChange: (value: boolean) => {
visible.value = value;
if (!value) {
// 延迟清理,确保动画完成
setTimeout(() => {
if (!isUnmounted && container) {
isUnmounted = true;
render(null, container);
container.remove();
}
}, 300);
}
} catch {
reject(new Error($t('ui.crop.errorTip')));
} finally {
closeModal();
}
},
onCancel() {
resolve('');
closeModal();
},
},
},
() =>
h(VCropper, {
ref: (ref: any) => (cropperRef.value = ref),
img: objectUrl as string,
aspectRatio,
}),
// 渲染所有图片文件
imageFiles.map((imgFile) =>
h(ImageComponent, {
key: imgFile.uid,
src: imgFile.url || imgFile.preview,
}),
),
);
};
},
};
render(h(CropperWrapper), container);
});
}
render(h(PreviewWrapper), container);
};
// 图片裁剪操作
const cropImage = (file: File, aspectRatio: string | undefined) => {
return new Promise((resolve, reject) => {
const container: HTMLElement | null = document.createElement('div');
document.body.append(container);
// 用于追踪组件是否已卸载
let isUnmounted = false;
let objectUrl: null | string = null;
const open = ref<boolean>(true);
const cropperRef = ref<InstanceType<typeof VCropper> | null>(null);
const closeModal = () => {
open.value = false;
// 延迟清理,确保动画完成
setTimeout(() => {
if (!isUnmounted && container) {
if (objectUrl) {
URL.revokeObjectURL(objectUrl);
}
isUnmounted = true;
render(null, container);
container.remove();
}
}, 300);
};
const CropperWrapper = {
setup() {
return () => {
if (isUnmounted) return null;
if (!objectUrl) {
objectUrl = URL.createObjectURL(file);
}
return h(
Modal,
{
open: open.value,
title: h('div', {}, [
$t('ui.crop.title'),
h(
'span',
{
class: `${aspectRatio ? '' : 'hidden'} ml-2 text-sm text-gray-400 font-normal`,
},
$t('ui.crop.titleTip', [aspectRatio]),
),
]),
centered: true,
width: 548,
keyboard: false,
maskClosable: false,
closable: false,
cancelText: $t('common.cancel'),
okText: $t('ui.crop.confirm'),
destroyOnClose: true,
onOk: async () => {
const cropper = cropperRef.value;
if (!cropper) {
reject(new Error('Cropper not found'));
closeModal();
return;
}
try {
const dataUrl = await cropper.getCropImage();
resolve(dataUrl);
} catch {
reject(new Error($t('ui.crop.errorTip')));
} finally {
closeModal();
}
},
onCancel() {
resolve('');
closeModal();
},
},
() =>
h(VCropper, {
ref: (ref: any) => (cropperRef.value = ref),
img: objectUrl as string,
aspectRatio,
}),
);
};
},
};
render(h(CropperWrapper), container);
});
};
/**
* 带预览功能的上传组件
*/
const withPreviewUpload = () => {
return defineComponent({
name: Upload.name,
emits: ['update:modelValue'],
setup(
setup: (
props: any,
{ attrs, slots, emit }: { attrs: any; emit: any; slots: any },
) {
) => {
const previewVisible = ref<boolean>(false);
const placeholder = attrs?.placeholder || $t('ui.placeholder.upload');
const placeholder = attrs?.placeholder || $t(`ui.placeholder.upload`);
const listType = attrs?.listType || attrs?.['list-type'] || 'text';
const fileList = ref<UploadProps['fileList']>(
attrs?.fileList || attrs?.['file-list'] || [],
);
@@ -405,14 +399,12 @@ const withPreviewUpload = () => {
file: UploadFile,
originFileList: Array<File>,
) => {
// 文件大小限制
if (maxSize.value && (file.size || 0) / 1024 / 1024 > maxSize.value) {
message.error($t('ui.formRules.sizeLimit', [maxSize.value]));
file.status = 'removed';
return false;
}
// 图片裁剪处理
// 多选或者非图片不唤起裁剪框
if (
attrs.crop &&
!attrs.multiple &&
@@ -420,11 +412,14 @@ const withPreviewUpload = () => {
isImageFile(file)
) {
file.status = 'removed';
// antd Upload组件问题 file参数获取的是UploadFile类型对象无法取到File类型 所以通过originFileList[0]获取
const blob = await cropImage(originFileList[0], aspectRatio.value);
if (!blob) {
throw new Error($t('ui.crop.errorTip'));
}
return blob;
return new Promise((resolve, reject) => {
if (!blob) {
return reject(new Error($t('ui.crop.errorTip')));
}
resolve(blob);
});
}
return attrs.beforeUpload?.(file) ?? true;
@@ -432,9 +427,12 @@ const withPreviewUpload = () => {
const handleChange = (event: UploadChangeParam) => {
try {
// 行内写法 handleChange: (event) => {}
attrs.handleChange?.(event);
// template写法 @handle-change="(event) => {}"
attrs.onHandleChange?.(event);
} catch (error) {
// Avoid breaking internal v-model sync on user handler errors
console.error(error);
}
fileList.value = event.fileList.filter(
@@ -451,88 +449,21 @@ const withPreviewUpload = () => {
await previewImage(file, previewVisible, fileList);
};
const renderUploadButton = () => {
if (attrs.disabled) return null;
const renderUploadButton = (): any => {
const isDisabled = attrs.disabled;
// 如果禁用,不渲染上传按钮
if (isDisabled) {
return null;
}
// 否则渲染默认上传按钮
return isEmpty(slots)
? createDefaultUploadSlots(listType, placeholder)
? createDefaultSlotsWithUpload(listType, placeholder)
: slots;
};
// 拖拽排序
const draggable = computed(
() => (attrs.draggable ?? false) && !attrs.disabled,
);
const uploadId = `upload-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
const sortableInstance = ref<null | Sortable>(null);
const styleId = `upload-drag-style-${uploadId}`;
function injectDragStyle() {
if (!document.querySelector(`[id="${styleId}"]`)) {
const style = document.createElement('style');
style.id = styleId;
style.textContent = `
[data-upload-id="${uploadId}"] .ant-upload-list-item { cursor: move; }
[data-upload-id="${uploadId}"] .ant-upload-list-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
`;
document.head.append(style);
}
}
function removeDragStyle() {
document.querySelector(`[id="${styleId}"]`)?.remove();
}
async function initSortable(retryCount = 0) {
if (!draggable.value) return;
injectDragStyle();
await nextTick();
await new Promise((resolve) => setTimeout(resolve, 100));
const container = document.querySelector(
`[data-upload-id="${uploadId}"] .ant-upload-list`,
) as HTMLElement;
if (!container) {
if (retryCount < 5) {
setTimeout(() => initSortable(retryCount + 1), 200);
}
return;
}
const { initializeSortable } = useSortable(container, {
animation: 300,
delay: 400,
delayOnTouchOnly: true,
filter:
'.ant-upload-select, .ant-upload-list-item-error, .ant-upload-list-item-uploading',
onEnd: (evt) => {
const { oldIndex, newIndex } = evt;
if (
oldIndex === undefined ||
newIndex === undefined ||
oldIndex === newIndex
) {
return;
}
const list = [...(fileList.value || [])];
const [movedItem] = list.splice(oldIndex, 1);
if (movedItem) {
list.splice(newIndex, 0, movedItem);
fileList.value = list;
}
attrs.onDragSort?.(oldIndex, newIndex);
emit('update:modelValue', fileList.value);
},
});
sortableInstance.value = await initializeSortable();
}
// 监听表单值变化
// 可以监听到表单API设置的值
watch(
() => attrs.modelValue,
(res) => {
@@ -540,28 +471,18 @@ const withPreviewUpload = () => {
},
);
onMounted(initSortable);
onUnmounted(() => {
sortableInstance.value?.destroy();
removeDragStyle();
});
return () =>
h(
'div',
{ 'data-upload-id': uploadId, class: 'w-full' },
h(
Upload,
{
...props,
...attrs,
fileList: fileList.value,
beforeUpload: handleBeforeUpload,
onChange: handleChange,
onPreview: handlePreview,
},
renderUploadButton() as any,
),
Upload,
{
...props,
...attrs,
fileList: fileList.value,
beforeUpload: handleBeforeUpload,
onChange: handleChange,
onPreview: handlePreview,
},
renderUploadButton(),
);
},
});

View File

@@ -199,7 +199,7 @@ setupVbenVxeTable({
vxeUI.renderer.add('CellOperation', {
renderTableDefault({ attrs, options, props }, { column, row }) {
const defaultProps = { size: 'small', type: 'link', ...props };
let align: string;
let align = 'end';
switch (column.align) {
case 'center': {
align = 'center';

View File

@@ -16,10 +16,10 @@ export namespace CrmCustomerLimitConfigApi {
/** 客户限制配置类型 */
export enum LimitConfType {
/** 拥有客户数限制 */
CUSTOMER_QUANTITY_LIMIT = 1,
/** 锁定客户数限制 */
CUSTOMER_LOCK_LIMIT = 2,
/** 拥有客户数限制 */
CUSTOMER_QUANTITY_LIMIT = 1,
}
/** 查询客户限制配置列表 */

View File

@@ -35,11 +35,11 @@ export namespace CrmPermissionApi {
* CRM 业务类型枚举
*/
export enum BizTypeEnum {
CRM_CLUE = 1, // 线索
CRM_CUSTOMER = 2, // 客户
CRM_CONTACT = 3, // 联系人
CRM_BUSINESS = 4, // 商机
CRM_CLUE = 1, // 线索
CRM_CONTACT = 3, // 联系人
CRM_CONTRACT = 5, // 合同
CRM_CUSTOMER = 2, // 客户
CRM_PRODUCT = 6, // 产品
CRM_RECEIVABLE = 7, // 回款
CRM_RECEIVABLE_PLAN = 8, // 回款计划

View File

@@ -37,12 +37,16 @@ export function getModbusPoint(id: number) {
}
/** 创建 Modbus 点位配置 */
export function createModbusPoint(data: IotDeviceModbusPointApi.ModbusPoint) {
export function createModbusPoint(
data: IotDeviceModbusPointApi.ModbusPoint,
) {
return requestClient.post('/iot/device-modbus-point/create', data);
}
/** 更新 Modbus 点位配置 */
export function updateModbusPoint(data: IotDeviceModbusPointApi.ModbusPoint) {
export function updateModbusPoint(
data: IotDeviceModbusPointApi.ModbusPoint,
) {
return requestClient.put('/iot/device-modbus-point/update', data);
}

View File

@@ -119,9 +119,7 @@ function createRequestClient(baseURL: string, options?: RequestClientOptions) {
response.data = apiEncrypt.decryptResponse(response.data);
} catch (error) {
console.error('响应数据解密失败:', error);
throw new Error(`响应数据解密失败: ${(error as Error).message}`, {
cause: error,
});
throw new Error(`响应数据解密失败: ${(error as Error).message}`);
}
}
return response;

View File

@@ -21,7 +21,7 @@ export function useDescription(options?: Partial<DescriptionProps>) {
inheritAttrs: false,
setup(_props, { attrs, slots }) {
return () => {
// @ts-expect-error - 避免类型实例化过深
// @ts-ignore - 避免类型实例化过深
return h(Description, { ...propsState, ...attrs }, slots);
};
},

View File

@@ -47,7 +47,6 @@ interface Props {
clearable?: boolean;
showAllLevels?: boolean;
separator?: string;
// eslint-disable-next-line vue/require-default-prop
formCreateInject?: any;
}
@@ -72,7 +71,7 @@ async function loadAreaTree(): Promise<void> {
const data = await getAreaTree();
// 根据 level 限制层级
areaTree.value = filterTreeByLevel((data || []) as AreaVO[], props.level);
areaTree.value = filterTreeByLevel(data || [], props.level);
} catch (error) {
console.warn('[AreaSelect] 加载地区数据失败:', error);
areaTree.value = [];
@@ -101,7 +100,7 @@ function filterTreeByLevel(tree: AreaVO[], maxLevel: number): AreaVO[] {
}
// 处理选中值变化
function handleChange(value: any): void {
function handleChange(value: number[] | undefined): void {
if (value === undefined || value === null) {
emit('update:modelValue', undefined);
emit('update:value', undefined);

View File

@@ -39,16 +39,15 @@ interface DeptVO {
status?: number;
}
// TODO @puhui999linter 报错;
/** 接受父组件参数 */
interface Props {
// eslint-disable-next-line vue/require-default-prop
modelValue?: number | number[] | string | string[];
multiple?: boolean;
returnType?: 'id' | 'name';
defaultCurrentDept?: boolean;
disabled?: boolean;
placeholder?: string;
// eslint-disable-next-line vue/require-default-prop
formCreateInject?: any;
}

View File

@@ -29,7 +29,6 @@ interface Props {
allowfullscreen?: boolean;
loading?: 'eager' | 'lazy';
sandbox?: string;
// eslint-disable-next-line vue/require-default-prop
formCreateInject?: any;
}

View File

@@ -193,8 +193,7 @@ export function useApiSelect(option: ApiSelectProps) {
let parse: any = null;
if (props.parseFunc) {
// 解析字符串函数
// oxlint-disable-next-line typescript/no-implied-eval
// oxlint-disable-next-line no-new-func, typescript/no-implied-eval
// eslint-disable-next-line no-new-func
parse = new Function(`return ${props.parseFunc}`)();
}
return parse;

View File

@@ -11,14 +11,14 @@ import formCreate from '@form-create/ant-design-vue';
import { apiSelectRule } from '#/components/form-create/rules/data';
import {
useAreaSelectRule,
useDictSelectRule,
useEditorRule,
useIframeRule,
useSelectRule,
useUploadFileRule,
useUploadImageRule,
useUploadImagesRule,
useIframeRule,
useAreaSelectRule,
} from './rules';
/** 编码表单 Conf */

View File

@@ -1,3 +1,4 @@
/* eslint-disable no-template-curly-in-string */
const selectRule = [
{
type: 'select',
@@ -133,7 +134,7 @@ const apiSelectRule = [
type: 'input',
field: 'labelField',
title: 'label 属性',
info: `可以使用 el 表达式:\${},来实现复杂数据组合。如:\${nickname}-\${id}`,
info: '可以使用 el 表达式:${属性},来实现复杂数据组合。如:${nickname}-${id}',
props: {
placeholder: 'nickname',
},
@@ -142,7 +143,7 @@ const apiSelectRule = [
type: 'input',
field: 'valueField',
title: 'value 属性',
info: `可以使用 el 表达式:\${},来实现复杂数据组合。如:\${nickname}-\${id}`,
info: '可以使用 el 表达式:${属性},来实现复杂数据组合。如:${nickname}-${id}',
props: {
placeholder: 'id',
},

View File

@@ -47,7 +47,6 @@ onMounted(async () => {
</script>
<template>
<!-- eslint-disable-next-line vue/no-v-html -->
<div ref="contentRef" class="markdown-view" v-html="renderedMarkdown"></div>
</template>

View File

@@ -146,7 +146,6 @@ async function handlePreview(file: UploadFile) {
async function handleRemove(file: UploadFile) {
if (fileList.value) {
const index = fileList.value.findIndex((item) => item.uid === file.uid);
// oxlint-disable-next-line no-unused-expressions
index !== -1 && fileList.value.splice(index, 1);
const value = getValue();
isInnerOperate.value = true;
@@ -351,8 +350,6 @@ function getValue() {
<style>
.ant-upload-select-picture-card {
display: flex;
align-items: center;
justify-content: center;
@apply flex items-center justify-center;
}
</style>

View File

@@ -83,7 +83,6 @@ export const useAuthStore = defineStore('auth', () => {
if (accessStore.loginExpired) {
accessStore.setLoginExpired(false);
} else {
// oxlint-disable-next-line no-unused-expressions
onSuccess
? await onSuccess?.()
: await router.push(
@@ -133,7 +132,6 @@ export const useAuthStore = defineStore('auth', () => {
async function fetchUserInfo() {
// 加载
// eslint-disable-next-line no-useless-assignment
let authPermissionInfo: AuthPermissionInfo | null = null;
authPermissionInfo = await getAuthPermissionInfoApi();
// userStore

View File

@@ -3,6 +3,9 @@ import type { Recordable } from '@vben/types';
export * from './rangePickerProps';
export * from './routerHelper';
// 从共享包导出 URL 工具函数
export { isUrl } from '@vben/utils';
/**
* 查找数组对象的某个下标
* @param {Array} ary 查找的数组
@@ -27,14 +30,3 @@ export const findIndex = <T = Recordable<any>>(
});
return index;
};
/**
* URL 验证
* @param path URL 路径
*/
export const isUrl = (path: string): boolean => {
// fix:修复hash路由无法跳转的问题
const reg =
/(((^https?:(?:\/\/)?)(?:[-:&=+$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%#/.\w-]*)?\??[-+=&%@.\w]*(?:#\w*)?)?)$/;
return reg.test(path);
};

View File

@@ -571,7 +571,6 @@ onMounted(async () => {
size="small"
@click="openChatConversationUpdateForm"
>
<!-- eslint-disable-next-line vue/no-v-html -->
<span v-html="activeConversation?.modelName"></span>
<IconifyIcon icon="lucide:settings" class="ml-2 size-4" />
</Button>

View File

@@ -21,7 +21,6 @@ const imageListRef = ref<any>(); // image 列表 ref
const dall3Ref = ref<any>(); // dall3(openai) ref
const midjourneyRef = ref<any>(); // midjourney ref
const stableDiffusionRef = ref<any>(); // stable diffusion ref
// @ts-expect-error: template ref is retained for future provider expansion
const commonRef = ref<any>(); // stable diffusion ref
const selectPlatform = ref('common'); // 选中的平台
@@ -46,9 +45,7 @@ const platformOptions = [
const models = ref<AiModelModelApi.Model[]>([]); // 模型列表
/** 绘画 start */
function handleDrawStart() {
// drawing state is handled by child components
}
async function handleDrawStart() {}
/** 绘画 complete */
async function handleDrawComplete() {

View File

@@ -150,12 +150,10 @@ defineExpose({
ref="mdContainerRef"
class="wh-full overflow-y-auto"
>
<!-- eslint-disable vue/no-v-html -->
<div
class="flex flex-col items-center justify-center"
v-html="html"
></div>
<!-- eslint-enable vue/no-v-html -->
</div>
<div ref="mindMapRef" class="wh-full">
<svg

View File

@@ -20,7 +20,6 @@ const currentSong = inject<any>('currentSong', {});
{{ currentSong.date }}
</div>
<Button size="small" shape="round" class="my-2">信息复用</Button>
<!-- eslint-disable-next-line vue/no-v-html -->
<div class="text-xs" v-html="currentSong.lyric"></div>
</Card>
</template>

View File

@@ -106,9 +106,7 @@ async function goRun() {
try {
convertedParams[paramKey] = convertParamValue(value, dataType);
} catch (error: any) {
throw new Error(`参数 ${paramKey} 转换失败: ${error.message}`, {
cause: error,
});
throw new Error(`参数 ${paramKey} 转换失败: ${error.message}`);
}
}
@@ -177,7 +175,7 @@ function convertParamValue(value: string, dataType: string) {
try {
return JSON.parse(value);
} catch (error: any) {
throw new Error(`JSON格式错误: ${error.message}`, { cause: error });
throw new Error(`JSON格式错误: ${error.message}`);
}
}
default: {

View File

@@ -22,7 +22,7 @@ import {
import { Button, ButtonGroup, message, Modal, Tooltip } from 'ant-design-vue';
// 模拟流转流程
// @ts-expect-error: token simulation package does not ship compatible types
// @ts-ignore
import tokenSimulation from 'bpmn-js-token-simulation';
import BpmnModeler from 'bpmn-js/lib/Modeler';
// 代码高亮插件
@@ -132,7 +132,6 @@ const emit = defineEmits([
'element-click',
]);
// @ts-expect-error: file input ref is set imperatively by the template
const bpmnCanvas = ref();
const refFile = ref();
@@ -179,7 +178,6 @@ const additionalModules = computed(() => {
) {
Modules.push(...(props.additionalModel as any[]));
} else {
// oxlint-disable-next-line no-unused-expressions
props.additionalModel && Modules.push(props.additionalModel);
}
@@ -419,7 +417,6 @@ const processSimulation = () => {
// bpmnModeler.get('toggleMode', 'strict'),
// "bpmnModeler.get('toggleMode')",
// );
// oxlint-disable-next-line no-unused-expressions
props.simulation && bpmnModeler.get('toggleMode', 'strict').toggleMode();
};
const processRedo = () => {

View File

@@ -7,7 +7,7 @@ import { hasPrimaryModifier } from 'diagram-js/lib/util/Mouse';
/**
* A provider for BPMN 2.0 elements context pad
*/
function ContextPadProvider(
export default function ContextPadProvider(
config,
injector,
eventBus,
@@ -57,8 +57,6 @@ function ContextPadProvider(
});
}
export default ContextPadProvider;
ContextPadProvider.$inject = [
'config.contextPad',
'injector',

View File

@@ -1,6 +1,6 @@
import PaletteProvider from 'bpmn-js/lib/features/palette/PaletteProvider';
function CustomPalette(
export default function CustomPalette(
palette,
create,
elementFactory,
@@ -24,21 +24,11 @@ function CustomPalette(
);
}
CustomPalette.$inject = [
'palette',
'create',
'elementFactory',
'spaceTool',
'lassoTool',
'handTool',
'globalConnect',
'translate',
];
const F = function () {}; // 核心,利用空对象作为中介;
F.prototype = PaletteProvider.prototype; // 核心将父类的原型赋值给空对象F
CustomPalette.prototype = Object.create(PaletteProvider.prototype);
CustomPalette.prototype.constructor = CustomPalette;
CustomPalette.prototype.getPaletteEntries = function () {
// 利用中介函数重写原型链方法
F.prototype.getPaletteEntries = function () {
const actions = {};
const create = this._create;
const elementFactory = this._elementFactory;
@@ -104,7 +94,8 @@ CustomPalette.prototype.getPaletteEntries = function () {
'hand-tool': {
group: 'tools',
className: 'bpmn-icon-hand-tool',
title: translate('Activate the hand tool'),
title: '激活抓手工具',
// title: translate("Activate the hand tool"),
action: {
click(event) {
handTool.activateHand(event);
@@ -228,4 +219,16 @@ CustomPalette.prototype.getPaletteEntries = function () {
return actions;
};
export default CustomPalette;
CustomPalette.$inject = [
'palette',
'create',
'elementFactory',
'spaceTool',
'lassoTool',
'handTool',
'globalConnect',
'translate',
];
CustomPalette.prototype = new F(); // 核心,将 F的实例赋值给子类
CustomPalette.prototype.constructor = CustomPalette; // 修复子类CustomPalette的构造器指向防止原型链的混乱

View File

@@ -1,7 +1,7 @@
/**
* A palette provider for BPMN 2.0 elements.
*/
function PaletteProvider(
export default function PaletteProvider(
palette,
create,
elementFactory,
@@ -23,8 +23,6 @@ function PaletteProvider(
palette.registerProvider(this);
}
export default PaletteProvider;
PaletteProvider.$inject = [
'palette',
'create',

View File

@@ -1,3 +1,4 @@
/* eslint-disable no-template-curly-in-string */
/**
* This is a sample file that should be replaced with the actual translation.
*
@@ -237,8 +238,10 @@ export default {
'Due Date': '到期时间',
'Follow Up Date': '跟踪日期',
Priority: '优先级',
[`The follow up date as an EL expression (e.g. \${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)`]: `跟踪日期必须符合EL表达式 \${someDate} ,或者一个ISO标准日期2015-06-26T09:54:00`,
[`The due date as an EL expression (e.g. \${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)`]: `跟踪日期必须符合EL表达式 \${someDate} ,或者一个ISO标准日期2015-06-26T09:54:00`,
'The follow up date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)':
'跟踪日期必须符合EL表达式 ${someDate} ,或者一个ISO标准日期2015-06-26T09:54:00',
'The due date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)':
'跟踪日期必须符合EL表达式 ${someDate} ,或者一个ISO标准日期2015-06-26T09:54:00',
Variables: '变量',
'Candidate Starter Configuration': '候选人起动器配置',
'Candidate Starter Groups': '候选人起动器组',

View File

@@ -39,7 +39,7 @@ watch(
val +=
props.businessObject.eventDefinitions[0]?.$type.split(':')[1] || '';
}
// @ts-expect-error: async component registry is indexed dynamically
// @ts-ignore
customConfigComponent.value = (
CustomConfigMap as Record<string, { component: Component }>
)[val]?.component;

View File

@@ -1,3 +1,4 @@
<!-- eslint-disable no-unused-vars -->
<script lang="ts" setup>
import { inject, nextTick, onBeforeUnmount, ref, toRaw, watch } from 'vue';
@@ -65,13 +66,13 @@ const bpmnElement = ref<any>(null);
const multiLoopInstance = ref<any>(null);
declare global {
interface Window {
// @ts-ignore
bpmnInstances?: () => any;
}
}
const bpmnInstances = () => (window as any)?.bpmnInstances;
// @ts-expect-error: retained for legacy multi-instance mode compatibility
// eslint-disable-next-line unused-imports/no-unused-vars
const getElementLoop = (businessObject: any): void => {
if (!businessObject.loopCharacteristics) {
@@ -140,7 +141,8 @@ const changeLoopCharacteristicsType = (type: any): void => {
isSequential: true,
})
: bpmnInstances().moddle.create('bpmn:MultiInstanceLoopCharacteristics', {
collection: `\${coll_userList}`,
// eslint-disable-next-line no-template-curly-in-string
collection: '${coll_userList}',
});
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
loopCharacteristics: toRaw(multiLoopInstance.value),
@@ -231,7 +233,7 @@ const updateLoopAsync = (key: any): void => {
extensionElements: null,
};
} else {
// @ts-expect-error: dynamic async flags are assigned by runtime key
// @ts-ignore
asyncAttr[key] = loopInstanceForm.value[key];
}
bpmnInstances().modeling.updateModdleProperties(
@@ -245,23 +247,23 @@ const changeConfig = (config: string): void => {
switch (config) {
case '会签': {
changeLoopCharacteristicsType('ParallelMultiInstance');
updateLoopCondition(`\${ nrOfCompletedInstances >= nrOfInstances }`);
// eslint-disable-next-line no-template-curly-in-string
updateLoopCondition('${ nrOfCompletedInstances >= nrOfInstances }');
break;
}
case '依次审批': {
changeLoopCharacteristicsType('SequentialMultiInstance');
updateLoopCardinality('1');
updateLoopCondition(`\${ nrOfCompletedInstances >= nrOfInstances }`);
// eslint-disable-next-line no-template-curly-in-string
updateLoopCondition('${ nrOfCompletedInstances >= nrOfInstances }');
break;
}
case '或签': {
changeLoopCharacteristicsType('ParallelMultiInstance');
updateLoopCondition(`\${ nrOfCompletedInstances > 0 }`);
// eslint-disable-next-line no-template-curly-in-string
updateLoopCondition('${ nrOfCompletedInstances > 0 }');
break;
}
@@ -329,8 +331,8 @@ const updateLoopCharacteristics = (): void => {
if (approveMethod.value === ApproveMethodType.APPROVE_BY_RATIO) {
multiLoopInstance.value = bpmnInstances().moddle.create(
'bpmn:MultiInstanceLoopCharacteristics',
{ isSequential: false, collection: `\${coll_userList}` },
// eslint-disable-next-line no-template-curly-in-string
{ isSequential: false, collection: '${coll_userList}' },
);
multiLoopInstance.value.completionCondition =
bpmnInstances().moddle.create('bpmn:FormalExpression', {
@@ -342,19 +344,20 @@ const updateLoopCharacteristics = (): void => {
if (approveMethod.value === ApproveMethodType.ANY_APPROVE) {
multiLoopInstance.value = bpmnInstances().moddle.create(
'bpmn:MultiInstanceLoopCharacteristics',
{ isSequential: false, collection: `\${coll_userList}` },
// eslint-disable-next-line no-template-curly-in-string
{ isSequential: false, collection: '${coll_userList}' },
);
multiLoopInstance.value.completionCondition =
bpmnInstances().moddle.create('bpmn:FormalExpression', {
body: `\${ nrOfCompletedInstances > 0 }`,
// eslint-disable-next-line no-template-curly-in-string
body: '${ nrOfCompletedInstances > 0 }',
});
}
if (approveMethod.value === ApproveMethodType.SEQUENTIAL_APPROVE) {
multiLoopInstance.value = bpmnInstances().moddle.create(
'bpmn:MultiInstanceLoopCharacteristics',
{ isSequential: true, collection: `\${coll_userList}` },
// eslint-disable-next-line no-template-curly-in-string
{ isSequential: true, collection: '${coll_userList}' },
);
multiLoopInstance.value.loopCardinality = bpmnInstances().moddle.create(
'bpmn:FormalExpression',
@@ -364,7 +367,8 @@ const updateLoopCharacteristics = (): void => {
);
multiLoopInstance.value.completionCondition =
bpmnInstances().moddle.create('bpmn:FormalExpression', {
body: `\${ nrOfCompletedInstances >= nrOfInstances }`,
// eslint-disable-next-line no-template-curly-in-string
body: '${ nrOfCompletedInstances >= nrOfInstances }',
});
}
bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {

View File

@@ -53,7 +53,7 @@ watch(
() => props.type,
() => {
if (props.type) {
// @ts-expect-error: installed task component map is indexed dynamically
// @ts-ignore
witchTaskComponent.value = installedComponent[props.type].component;
}
},

View File

@@ -65,7 +65,7 @@ const initCallActivity = () => {
// 初始化所有配置项
Object.keys(formData.value).forEach((key: string) => {
// @ts-expect-error: form state is updated through dynamic schema keys
// @ts-ignore
formData.value[key] =
bpmnElement.value.businessObject[key] ??
formData.value[key as keyof FormData];
@@ -183,7 +183,6 @@ const updateElementExtensions = () => {
watch(
() => props.id,
(val) => {
// oxlint-disable-next-line no-unused-expressions
val &&
val.length > 0 &&
nextTick(() => {

View File

@@ -82,6 +82,7 @@ onMounted(() => {
bpmnRootElements.value
.filter((el: any) => el.$type === 'bpmn:Message')
.forEach((m: any) => {
// @ts-ignore
if (bpmnMessageRefsMap.value) {
bpmnMessageRefsMap.value[m.id] = m;
}

View File

@@ -34,6 +34,7 @@ const bpmnInstances = () => (window as any)?.bpmnInstances;
const resetTaskForm = () => {
for (const key in defaultTaskForm.value) {
// @ts-ignore
scriptTaskForm.value[key] =
bpmnElement.value?.businessObject[
key as keyof typeof defaultTaskForm.value

View File

@@ -1,4 +1,3 @@
<!-- eslint-disable unicorn/no-nested-ternary -->
<!-- eslint-disable prettier/prettier -->
<script lang="ts" setup>
import { inject, nextTick, onBeforeUnmount, ref, watch } from 'vue';
@@ -207,9 +206,9 @@ const updateHttpExtensions = (force = false) => {
const persisted = HTTP_BOOLEAN_FIELDS.has(name)
? String(!!rawValue)
: rawValue === undefined
: (rawValue === undefined
? ''
: rawValue.toString();
: rawValue.toString());
desiredEntries.push([name, persisted]);
});

View File

@@ -70,7 +70,6 @@ const deptTreeOptions = ref<any>(); // 部门树
const postOptions = ref<SystemPostApi.Post[]>([]); // 岗位列表
const userOptions = ref<SystemUserApi.User[]>([]); // 用户列表
const userGroupOptions = ref<BpmUserGroupApi.UserGroup[]>([]); // 用户组列表
// @ts-expect-error: tree ref instance type is provided by the UI library at runtime
const treeRef = ref<any>();
const { formFieldOptions } = useFormFieldsPermission(FieldPermissionType.READ);
@@ -129,7 +128,7 @@ const resetTaskForm = () => {
// eslint-disable-next-line unicorn/prefer-switch
if (userTaskForm.value.candidateStrategy === CandidateStrategy.EXPRESSION) {
// 特殊:流程表达式,只有一个 input 输入框
// @ts-expect-error: expression strategy stores a scalar in an array-shaped field
// @ts-ignore
userTaskForm.value.candidateParam = [candidateParamStr];
} else if (
userTaskForm.value.candidateStrategy ===
@@ -153,7 +152,7 @@ const resetTaskForm = () => {
userTaskForm.value.candidateStrategy ===
CandidateStrategy.START_USER_MULTI_LEVEL_DEPT_LEADER
) {
// @ts-expect-error: dynamic candidate param shape varies by strategy
// @ts-ignore
userTaskForm.value.candidateParam = +candidateParamStr;
deptLevel.value = +candidateParamStr;
} else if (
@@ -304,7 +303,7 @@ const openProcessExpressionDialog = async () => {
const selectProcessExpression = (
expression: BpmProcessExpressionApi.ProcessExpression,
) => {
// @ts-expect-error: modal helper exposes runtime methods outside static typing
// @ts-ignore
userTaskForm.value.candidateParam = [expression.expression];
updateElementTask();
};
@@ -312,7 +311,7 @@ const selectProcessExpression = (
const handleFormUserChange = (e: any) => {
if (e === 'PROCESS_START_USER_ID') {
userTaskForm.value.candidateParam = [];
// @ts-expect-error: modal helper exposes runtime methods outside static typing
// @ts-ignore
userTaskForm.value.candidateStrategy = CandidateStrategy.START_USER;
}
updateElementTask();

View File

@@ -1,6 +1,6 @@
import BpmnRenderer from 'bpmn-js/lib/draw/BpmnRenderer';
function CustomRenderer(
export default function CustomRenderer(
config,
eventBus,
styles,
@@ -19,10 +19,12 @@ function CustomRenderer(
2000,
);
this.handlers.label = () => null;
this.handlers.label = function () {
return null;
};
}
CustomRenderer.prototype = Object.create(BpmnRenderer.prototype);
CustomRenderer.prototype.constructor = CustomRenderer;
export default CustomRenderer;
const F = function () {}; // 核心,利用空对象作为中介;
F.prototype = BpmnRenderer.prototype; // 核心将父类的原型赋值给空对象F
CustomRenderer.prototype = new F(); // 核心,将 F的实例赋值给子类
CustomRenderer.prototype.constructor = CustomRenderer; // 修复子类CustomRenderer的构造器指向防止原型链的混乱

View File

@@ -1,8 +1,7 @@
import BpmnRules from 'bpmn-js/lib/features/rules/BpmnRules';
// eslint-disable-next-line n/no-extraneous-import
import inherits from 'inherits';
function CustomRules(eventBus) {
export default function CustomRules(eventBus) {
BpmnRules.call(this, eventBus);
}
@@ -15,5 +14,3 @@ CustomRules.prototype.canDrop = function () {
CustomRules.prototype.canMove = function () {
return false;
};
export default CustomRules;

View File

@@ -1,5 +1,4 @@
function xmlStr2XmlObj(xmlStr) {
// eslint-disable-next-line no-useless-assignment
let xmlObj = {};
if (document.all) {
const xmlDom = new window.ActiveXObject('Microsoft.XMLDOM');

View File

@@ -71,7 +71,6 @@ const [Drawer, drawerApi] = useVbenDrawer({
// 当前节点
const currentNode = useWatchNode(props);
// 节点名称
// @ts-expect-error: composable typing does not preserve this node schema exactly
const { nodeName, showInput, clickIcon, changeNodeName, inputRef } =
useNodeName(BpmNodeTypeEnum.TRIGGER_NODE);
// 触发器表单配置

View File

@@ -25,13 +25,12 @@ const emits = defineEmits<{
}>();
// 是否只读
const readonly = inject<boolean>('readonly');
const readonly = inject<Boolean>('readonly');
/** 监控节点的变化 */
const currentNode = useWatchNode(props);
/** 节点名称编辑 */
// @ts-expect-error: composable typing does not preserve this node schema exactly
const { showInput, changeNodeName, clickTitle, inputRef } = useNodeName2(
currentNode,
BpmNodeTypeEnum.CHILD_PROCESS_NODE,

View File

@@ -27,11 +27,10 @@ const emits = defineEmits<{
'update:flowNode': [node: SimpleFlowNode | undefined];
}>();
// 是否只读
const readonly = inject<boolean>('readonly');
const readonly = inject<Boolean>('readonly');
// 监控节点的变化
const currentNode = useWatchNode(props);
// 节点名称编辑
// @ts-expect-error: composable typing does not preserve this node schema exactly
const { showInput, changeNodeName, clickTitle, inputRef } = useNodeName2(
currentNode,
BpmNodeTypeEnum.COPY_TASK_NODE,

View File

@@ -25,11 +25,10 @@ const emits = defineEmits<{
'update:flowNode': [node: SimpleFlowNode | undefined];
}>();
// 是否只读
const readonly = inject<boolean>('readonly');
const readonly = inject<Boolean>('readonly');
// 监控节点的变化
const currentNode = useWatchNode(props);
// 节点名称编辑
// @ts-expect-error: composable typing does not preserve this node schema exactly
const { showInput, changeNodeName, clickTitle, inputRef } = useNodeName2(
currentNode,
BpmNodeTypeEnum.DELAY_TIMER_NODE,

View File

@@ -20,7 +20,7 @@ const props = defineProps({
// 监控节点变化
const currentNode = useWatchNode(props);
// 是否只读
const readonly = inject<boolean>('readonly');
const readonly = inject<Boolean>('readonly');
const processInstance = inject<Ref<any>>('processInstance', ref({}));
const [Modal, modalApi] = useVbenModal({

View File

@@ -41,7 +41,7 @@ const emits = defineEmits<{
const { proxy } = getCurrentInstance() as any;
// 是否只读
const readonly = inject<boolean>('readonly');
const readonly = inject<Boolean>('readonly');
const currentNode = ref<SimpleFlowNode>(props.flowNode);
watch(

View File

@@ -46,7 +46,7 @@ const emits = defineEmits<{
const { proxy } = getCurrentInstance() as any;
// 是否只读
const readonly = inject<boolean>('readonly');
const readonly = inject<Boolean>('readonly');
const currentNode = ref<SimpleFlowNode>(props.flowNode);

View File

@@ -36,7 +36,7 @@ const props = defineProps({
const emits = defineEmits(['update:childNode']);
const popoverShow = ref(false);
const readonly = inject<boolean>('readonly'); // 是否只读
const readonly = inject<Boolean>('readonly'); // 是否只读
function addNode(type: number) {
// 校验:条件分支、包容分支后面,不允许直接添加并行分支

View File

@@ -36,7 +36,7 @@ const emits = defineEmits<{
const currentNode = ref<SimpleFlowNode>(props.flowNode);
// 是否只读
const readonly = inject<boolean>('readonly');
const readonly = inject<Boolean>('readonly');
watch(
() => props.flowNode,

View File

@@ -28,11 +28,10 @@ const emits = defineEmits<{
}>();
// 是否只读
const readonly = inject<boolean>('readonly');
const readonly = inject<Boolean>('readonly');
// 监控节点的变化
const currentNode = useWatchNode(props);
// 节点名称编辑
// @ts-expect-error: composable typing does not preserve this node schema exactly
const { showInput, changeNodeName, clickTitle, inputRef } = useNodeName2(
currentNode,
BpmNodeTypeEnum.ROUTER_BRANCH_NODE,

View File

@@ -32,12 +32,11 @@ defineEmits<{
'update:modelValue': [node: SimpleFlowNode | undefined];
}>();
const readonly = inject<boolean>('readonly'); // 是否只读
const readonly = inject<Boolean>('readonly'); // 是否只读
const tasks = inject<Ref<any[]>>('tasks', ref([]));
// 监控节点变化
const currentNode = useWatchNode(props);
// 节点名称编辑
// @ts-expect-error: composable typing does not preserve this node schema exactly
const { showInput, changeNodeName, clickTitle, inputRef } = useNodeName2(
currentNode,
BpmNodeTypeEnum.START_USER_NODE,

View File

@@ -30,7 +30,7 @@ const emits = defineEmits<{
}>();
// 是否只读
const readonly = inject<boolean>('readonly');
const readonly = inject<Boolean>('readonly');
// 监控节点的变化
const currentNode = useWatchNode(props);
// 节点名称编辑

View File

@@ -32,12 +32,11 @@ const emits = defineEmits<{
}>();
// 是否只读
const readonly = inject<boolean>('readonly');
const readonly = inject<Boolean>('readonly');
const tasks = inject<Ref<any[]>>('tasks', ref([]));
// 监控节点变化
const currentNode = useWatchNode(props);
// 节点名称编辑
// @ts-expect-error: composable typing does not preserve this node schema exactly
const { showInput, changeNodeName, clickTitle, inputRef } = useNodeName2(
currentNode,
BpmNodeTypeEnum.USER_TASK_NODE,

View File

@@ -7,10 +7,6 @@ interface DictDataType {
// 用户任务的审批类型。 【参考飞书】
export enum ApproveType {
/**
* 人工审批
*/
USER = 1,
/**
* 自动通过
*/
@@ -19,14 +15,18 @@ export enum ApproveType {
* 自动拒绝
*/
AUTO_REJECT = 3,
/**
* 人工审批
*/
USER = 1,
}
// 多人审批方式类型枚举 用于审批节点
export enum ApproveMethodType {
/**
* 随机挑选一人审批
* 多人或签(通过只需一人,拒绝只需一人)
*/
RANDOM_SELECT_ONE_APPROVE = 1,
ANY_APPROVE = 3,
/**
* 多人会签(按通过比例)
@@ -34,9 +34,9 @@ export enum ApproveMethodType {
APPROVE_BY_RATIO = 2,
/**
* 多人或签(通过只需一人,拒绝只需一人)
* 随机挑选一人审批
*/
ANY_APPROVE = 3,
RANDOM_SELECT_ONE_APPROVE = 1,
/**
* 多人依次审批
*/
@@ -70,34 +70,34 @@ export enum ConditionType {
// 操作按钮类型枚举 (用于审批节点)
export enum OperationButtonType {
/**
* 加签
*/
ADD_SIGN = 5,
/**
* 通过
*/
APPROVE = 1,
/**
* 拒绝
* 抄送
*/
REJECT = 2,
/**
* 转办
*/
TRANSFER = 3,
COPY = 7,
/**
* 委派
*/
DELEGATE = 4,
/**
* 加签
* 拒绝
*/
ADD_SIGN = 5,
REJECT = 2,
/**
* 退回
*/
RETURN = 6,
/**
* 抄送
* 转办
*/
COPY = 7,
TRANSFER = 3,
}
// 审批拒绝类型枚举
@@ -114,10 +114,6 @@ export enum RejectHandlerType {
// 用户任务超时处理类型枚举
export enum TimeoutHandlerType {
/**
* 自动提醒
*/
REMINDER = 1,
/**
* 自动同意
*/
@@ -126,6 +122,10 @@ export enum TimeoutHandlerType {
* 自动拒绝
*/
REJECT = 3,
/**
* 自动提醒
*/
REMINDER = 1,
}
// 用户任务的审批人为空时,处理类型枚举
@@ -135,49 +135,49 @@ export enum AssignEmptyHandlerType {
*/
APPROVE = 1,
/**
* 自动拒绝
* 转交给流程管理员
*/
REJECT = 2,
ASSIGN_ADMIN = 4,
/**
* 指定人员审批
*/
ASSIGN_USER = 3,
/**
* 转交给流程管理员
* 自动拒绝
*/
ASSIGN_ADMIN = 4,
REJECT = 2,
}
// 用户任务的审批人与发起人相同时,处理类型枚举
export enum AssignStartUserHandlerType {
/**
* 由发起人对自己审批
* 转交给部门负责人审批
*/
START_USER_AUDIT = 1,
ASSIGN_DEPT_LEADER = 3,
/**
* 自动跳过【参考飞书】1如果当前节点还有其他审批人则交由其他审批人进行审批2如果当前节点没有其他审批人则该节点自动通过
*/
SKIP = 2,
/**
* 转交给部门负责人审批
* 由发起人对自己审批
*/
ASSIGN_DEPT_LEADER = 3,
START_USER_AUDIT = 1,
}
// 时间单位枚举
export enum TimeUnitType {
/**
* 分钟
*
*/
MINUTE = 1,
DAY = 3,
/**
* 小时
*/
HOUR = 2,
/**
*
* 分钟
*/
DAY = 3,
MINUTE = 1,
}
/**
@@ -202,14 +202,14 @@ export enum FieldPermissionType {
* 延迟类型
*/
export enum DelayTypeEnum {
/**
* 固定时长
*/
FIXED_TIME_DURATION = 1,
/**
* 固定日期时间
*/
FIXED_DATE_TIME = 2,
/**
* 固定时长
*/
FIXED_TIME_DURATION = 1,
}
/**
@@ -217,39 +217,35 @@ export enum DelayTypeEnum {
*/
export enum TriggerTypeEnum {
/**
* 发送 HTTP 请求触发器
* 表单数据删除触发器
*/
HTTP_REQUEST = 1,
/**
* 接收 HTTP 回调请求触发器
*/
HTTP_CALLBACK = 2,
FORM_DELETE = 11,
/**
* 表单数据更新触发器
*/
FORM_UPDATE = 10,
/**
* 表单数据删除触发器
* 接收 HTTP 回调请求触发器
*/
FORM_DELETE = 11,
HTTP_CALLBACK = 2,
/**
* 发送 HTTP 请求触发器
*/
HTTP_REQUEST = 1,
}
export enum ChildProcessStartUserTypeEnum {
/**
* 同主流程发起人
*/
MAIN_PROCESS_START_USER = 1,
/**
* 表单
*/
FROM_FORM = 2,
}
export enum ChildProcessStartUserEmptyTypeEnum {
/**
* 同主流程发起人
*/
MAIN_PROCESS_START_USER = 1,
}
export enum ChildProcessStartUserEmptyTypeEnum {
/**
* 子流程管理员
*/
@@ -258,6 +254,10 @@ export enum ChildProcessStartUserEmptyTypeEnum {
* 主流程管理员
*/
MAIN_PROCESS_ADMIN = 3,
/**
* 同主流程发起人
*/
MAIN_PROCESS_START_USER = 1,
}
export enum ChildProcessMultiInstanceSourceTypeEnum {
@@ -265,50 +265,54 @@ export enum ChildProcessMultiInstanceSourceTypeEnum {
* 固定数量
*/
FIXED_QUANTITY = 1,
/**
* 数字表单
*/
NUMBER_FORM = 2,
/**
* 多选表单
*/
MULTIPLE_FORM = 3,
/**
* 数字表单
*/
NUMBER_FORM = 2,
}
// 候选人策略枚举 用于审批节点。抄送节点 )
export enum CandidateStrategy {
/**
* 指定角色
* 审批人自选
*/
ROLE = 10,
/**
* 部门成员
*/
DEPT_MEMBER = 20,
APPROVE_USER_SELECT = 34,
/**
* 部门的负责人
*/
DEPT_LEADER = 21,
/**
* 指定岗位
* 部门成员
*/
POST = 22,
DEPT_MEMBER = 20,
/**
* 流程表达式
*/
EXPRESSION = 60,
/**
* 表单内部门负责人
*/
FORM_DEPT_LEADER = 51,
/**
* 表单内用户字段
*/
FORM_USER = 50,
/**
* 连续多级部门的负责人
*/
MULTI_LEVEL_DEPT_LEADER = 23,
/**
* 指定用户
* 指定岗位
*/
USER = 30,
POST = 22,
/**
* 审批人自选
* 指定角色
*/
APPROVE_USER_SELECT = 34,
/**
* 发起人自选
*/
START_USER_SELECT = 35,
ROLE = 10,
/**
* 发起人自己
*/
@@ -321,22 +325,18 @@ export enum CandidateStrategy {
* 发起人连续多级部门的负责人
*/
START_USER_MULTI_LEVEL_DEPT_LEADER = 38,
/**
* 发起人自选
*/
START_USER_SELECT = 35,
/**
* 指定用户
*/
USER = 30,
/**
* 指定用户组
*/
USER_GROUP = 40,
/**
* 表单内用户字段
*/
FORM_USER = 50,
/**
* 表单内部门负责人
*/
FORM_DEPT_LEADER = 51,
/**
* 流程表达式
*/
EXPRESSION = 60,
}
export enum BpmHttpRequestParamTypeEnum {

View File

@@ -27,7 +27,7 @@ type EnvType = 'h5' | 'miniapp'; // 环境类型
// UniApp WebView 类型声明
interface UniWebView {
postMessage: (options: { data: any }, targetOrigin?: string) => void;
postMessage: (options: { data: any }) => void;
getEnv: (callback: (res: any) => void) => void;
navigateTo: (options: {
fail?: () => void;
@@ -182,7 +182,7 @@ function postMessageToParent(message: { data: any; type: string }) {
if (envType.value === 'miniapp') {
if (window.uni?.postMessage) {
// 传递的消息信息,必须写在 data 对象中
window.uni.postMessage({ data: message.data }, window.location.origin);
window.uni.postMessage({ data: message.data });
} else {
console.error('小程序环境下 uni 对象未定义');
}

View File

@@ -3,7 +3,7 @@
* - @ 自动补全:插入 mention 占位元素
*/
// TinyMCE 全局或通过打包器提供
// @ts-ignore TinyMCE 全局或通过打包器提供
import type { Editor } from 'tinymce';
export interface MentionItem {

View File

@@ -9,7 +9,7 @@ const props = withDefaults(
defineProps<{
bpmnXml?: string;
loading?: boolean; // 是否加载中
modelView?: object;
modelView?: Object;
}>(),
{
loading: false,
@@ -29,7 +29,7 @@ watch(
async (newModelView) => {
// 加载最新
if (newModelView) {
// @ts-expect-error: viewer instance type is broader than local ref typing
// @ts-ignore
view.value = newModelView;
}
},

View File

@@ -107,7 +107,6 @@ const nodeTypeName = ref('审批'); // 节点类型名称
const reasonRequire = ref();
const approveFormRef = ref<FormInstance>(); // 审批通过意见表单
// @ts-expect-error: template ref is retained for future provider expansion
const approveSignFormRef = ref();
const nextAssigneesActivityNode = ref<BpmProcessInstanceApi.ApprovalNodeInfo[]>(
[],

View File

@@ -10,7 +10,7 @@ import { useUserStore } from '@vben/stores';
import { formatDate } from '@vben/utils';
import { Button } from 'ant-design-vue';
// @ts-expect-error - 安装 vue3-print-nb 局部指令 v-print
// @ts-ignore - 安装 vue3-print-nb 局部指令 v-print
import vPrint from 'vue3-print-nb';
import { getProcessInstancePrintData } from '#/api/bpm/processInstance';

View File

@@ -76,10 +76,10 @@ const chartTabs: TabOption[] = [
</AnalysisChartsTabs>
<div class="mt-5 w-full md:flex">
<AnalysisChartCard class="mt-5 md:mt-0 md:mr-4 md:w-1/3" title="访问数量">
<AnalysisChartCard class="mt-5 md:mr-4 md:mt-0 md:w-1/3" title="访问数量">
<AnalyticsVisitsData />
</AnalysisChartCard>
<AnalysisChartCard class="mt-5 md:mt-0 md:mr-4 md:w-1/3" title="访问来源">
<AnalysisChartCard class="mt-5 md:mr-4 md:mt-0 md:w-1/3" title="访问来源">
<AnalyticsVisitsSource />
</AnalysisChartCard>
<AnalysisChartCard class="mt-5 md:mt-0 md:w-1/3" title="访问来源">

View File

@@ -1,5 +1,5 @@
<!-- eslint-disable no-useless-escape -->
<script setup lang="ts">
// oxlint-disable no-useless-escape
import { onMounted, ref, unref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';

View File

@@ -1,7 +1,6 @@
<!-- Modbus 配置 -->
<script lang="ts" setup>
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { VbenFormSchema, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { IotDeviceApi } from '#/api/iot/device/device';
import type { IotDeviceModbusConfigApi } from '#/api/iot/device/modbus/config';
import type { IotDeviceModbusPointApi } from '#/api/iot/device/modbus/point';
@@ -228,7 +227,7 @@ function usePointColumns(): VxeTableGridOptions['columns'] {
];
}
const [Grid, gridApi] = useVbenVxeGrid({
const [Grid, gridApi] = useVbenVxeGrid<IotDeviceModbusPointApi.ModbusPoint>({
formOptions: {
schema: usePointFormSchema(),
submitOnChange: true,
@@ -256,7 +255,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
refresh: true,
search: true,
},
} as VxeTableGridOptions<IotDeviceModbusPointApi.ModbusPoint>,
},
});
/** 新增点位 - 使用 useVbenModal */

View File

@@ -118,7 +118,7 @@ function useFormSchema(): VbenFormSchema[] {
rules: 'required',
suffix: () => {
const addr = formApi.form.values?.registerAddress;
if (addr === null || addr === undefined) {
if (addr == null) {
return '';
}
return h(

View File

@@ -1,6 +1,5 @@
<script lang="ts" setup>
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { VbenFormSchema, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { IotDeviceApi } from '#/api/iot/device/device';
import { ref, watch } from 'vue';
@@ -72,7 +71,7 @@ function useGridColumns(): VxeTableGridOptions['columns'] {
];
}
const [Grid, gridApi] = useVbenVxeGrid({
const [Grid, gridApi] = useVbenVxeGrid<IotDeviceApi.Device>({
gridOptions: {
columns: useGridColumns(),
height: 'auto',
@@ -97,7 +96,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
pagerConfig: {
enabled: false,
},
} as VxeTableGridOptions<IotDeviceApi.Device>,
},
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,
@@ -220,7 +219,7 @@ function useAddGridColumns(): VxeTableGridOptions['columns'] {
];
}
const [AddGrid, addGridApi] = useVbenVxeGrid({
const [AddGrid, addGridApi] = useVbenVxeGrid<IotDeviceApi.Device>({
formOptions: {
schema: useAddGridFormSchema(),
submitOnChange: true,
@@ -248,7 +247,7 @@ const [AddGrid, addGridApi] = useVbenVxeGrid({
refresh: true,
search: true,
},
} as VxeTableGridOptions<IotDeviceApi.Device>,
},
gridEvents: {
checkboxAll: handleAddSelectionChange,
checkboxChange: handleAddSelectionChange,

View File

@@ -210,7 +210,7 @@ function handleRowCheckboxChange({
checkedIds.value = records.map((item) => item.id!);
}
const [Grid, gridApi] = useVbenVxeGrid({
const [Grid, gridApi] = useVbenVxeGrid<IotDeviceApi.Device>({
gridOptions: {
checkboxConfig: {
highlight: true,
@@ -242,7 +242,7 @@ const [Grid, gridApi] = useVbenVxeGrid({
refresh: true,
search: true,
},
} as VxeTableGridOptions<IotDeviceApi.Device>,
},
gridEvents: {
checkboxAll: handleRowCheckboxChange,
checkboxChange: handleRowCheckboxChange,

View File

@@ -13,8 +13,8 @@ export const IOT_PROVIDE_KEY = {
/** IoT 设备状态枚举 */
export enum DeviceStateEnum {
INACTIVE = 0, // 未激活
ONLINE = 1, // 在线
OFFLINE = 2, // 离线
ONLINE = 1, // 在线
}
/** IoT 产品物模型类型枚举类 */

View File

@@ -3,8 +3,8 @@ import dayjs from 'dayjs';
/** 时间范围类型枚举 */
export enum TimeRangeTypeEnum {
DAY30 = 1,
WEEK = 7,
MONTH = 30,
WEEK = 7,
YEAR = 365,
}

View File

@@ -3,8 +3,8 @@ import dayjs from 'dayjs';
/** 时间范围类型枚举 */
export enum TimeRangeTypeEnum {
DAY30 = 1,
WEEK = 7,
MONTH = 30,
WEEK = 7,
YEAR = 365,
}

View File

@@ -12,7 +12,7 @@ defineOptions({ name: 'ProductCategorySelect' });
const props = defineProps({
modelValue: {
type: [Number, Array<number>],
type: [Number, Array<Number>],
default: undefined,
}, // 选中的 ID
multiple: {

View File

@@ -50,7 +50,7 @@ const selectedSku = ref<MallSpuApi.Sku>();
/** 处理商品的选择变化 */
async function handleSpuChange(spu?: MallSpuApi.Spu | null) {
// 处理商品选择:如果 spu 为 null 或 id 为 0表示清空选择
const spuId = spu && spu.id ? spu.id : undefined;
const spuId = spu?.id && spu.id ? spu.id : undefined;
formData.value.spuId = spuId;
await formApi.setFieldValue('spuId', spuId);
// 清空已选规格

View File

@@ -110,7 +110,7 @@ function validateSku() {
let validate = true;
for (const sku of formData.value!.skus!) {
for (const rule of props.ruleConfig as RuleConfig[]) {
for (const rule of props?.ruleConfig as RuleConfig[]) {
const value = getNestedValue(sku, rule.name);
if (!rule.rule(value)) {
validate = false;

View File

@@ -102,7 +102,6 @@ async function showInput(index: number) {
attributeIndex.value = index;
inputRef.value?.[index]?.focus();
// 获取属性下拉选项
// oxlint-disable-next-line typescript/no-non-null-asserted-optional-chain
await getAttributeOptions(attributeList.value?.[index]?.id!);
}

View File

@@ -64,12 +64,12 @@ const [Form, formApi] = useVbenForm({
// ================= 商品选择相关 =================
/** SKU 扩展类型 */
interface SkuExtension extends MallSpuApi.Sku {
interface SkuExtension extends MallSpuApi.Sku {
productConfig: MallDiscountActivityApi.DiscountProduct;
}
/** SPU 扩展类型 */
interface SpuExtension extends MallSpuApi.Spu {
interface SpuExtension extends MallSpuApi.Spu {
skus?: SkuExtension[];
}

View File

@@ -50,7 +50,7 @@ function openRightMessage(item: MallKefuConversationApi.Conversation) {
/** 获得消息类型 */
const getConversationDisplayText = computed(
() => (lastMessageContentType: number, lastMessageContent: string) => {
() => (lastMessageContentType: number, lastMessageContent: string) => {
switch (lastMessageContentType) {
case KeFuMessageContentTypeEnum.IMAGE: {
return '[图片消息]';

View File

@@ -21,7 +21,7 @@ import ProductBrowsingHistory from './product-browsing-history.vue';
const activeTab = ref<string>('会员信息');
const tabActivation = computed(() => (tab: string) => activeTab.value === tab);
const tabActivation = computed(() => (tab: string) => activeTab.value === tab);
/** tab 切换 */
const productBrowsingHistoryRef =

View File

@@ -51,7 +51,7 @@ const loadHistory = ref(false); // 加载历史消息
/** 获悉消息内容 */
const getMessageContent = computed(
() => (item: any) => jsonParse(item.content),
() => (item: any) => jsonParse(item.content),
);
/** 获得消息列表 */

View File

@@ -25,7 +25,7 @@ const emits = defineEmits<{
}>();
/** 选择赠送的优惠类型拓展 */
interface GiveCoupon extends MallCouponTemplateApi.CouponTemplate {
interface GiveCoupon extends MallCouponTemplateApi.CouponTemplate {
giveCount?: number;
}

View File

@@ -42,7 +42,7 @@ function handleSend(userId: number) {
messageBoxVisible.value = true;
}
const [Grid, gridApi] = useVbenVxeGrid({
const [Grid, gridApi] = useVbenVxeGrid<MpMessageApi.Message>({
formOptions: {
schema: useGridFormSchema(),
},

View File

@@ -65,7 +65,7 @@ const [Modal, modalApi] = useVbenModal({
modalApi.lock();
try {
formData.value = await getTenant(data.id);
// @ts-expect-error: special-case workaround for yudao-ui-admin-vben issue ID43CX
// @ts-ignore 特殊https://gitee.com/yudaocode/yudao-ui-admin-vben/issues/ID43CX
formData.value.expireTime = String(formData.value.expireTime);
// 设置到 values
await formApi.setValues(formData.value);

View File

@@ -0,0 +1 @@
export { default } from '@vben/tailwind-config';

View File

@@ -2,6 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@vben/tsconfig/web-app.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"#/*": ["./src/*"]
},

View File

@@ -6,5 +6,5 @@
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"noEmit": false
},
"include": ["vite.config.ts"]
"include": ["vite.config.mts"]
}

View File

@@ -1,6 +1,6 @@
{
"name": "@vben/web-antdv-next",
"version": "5.7.0",
"version": "5.6.0",
"homepage": "https://vben.pro",
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
"repository": {
@@ -16,7 +16,7 @@
},
"type": "module",
"scripts": {
"#build": "pnpm vite build --mode production",
"build": "pnpm vite build --mode production",
"build:analyze": "pnpm vite build --mode analyze",
"dev": "pnpm vite --mode development",
"preview": "vite preview",

View File

@@ -0,0 +1 @@
export { default } from '@vben/tailwind-config/postcss';

Binary file not shown.

Before

Width:  |  Height:  |  Size: 495 KiB

View File

@@ -98,7 +98,8 @@ export const useAuthStore = defineStore('auth', () => {
}
async function fetchUserInfo() {
const userInfo = await getUserInfoApi();
let userInfo: null | UserInfo = null;
userInfo = await getUserInfoApi();
userStore.setUserInfo(userInfo);
return userInfo;
}

View File

@@ -55,7 +55,8 @@ const formSchema = computed((): VbenFormSchema[] => {
* @param values 登录表单数据
*/
async function handleLogin(values: Recordable<any>) {
void values;
// eslint-disable-next-line no-console
console.log(values);
}
</script>

View File

@@ -29,7 +29,8 @@ const formSchema = computed((): VbenFormSchema[] => {
});
function handleSubmit(value: Recordable<any>) {
void value;
// eslint-disable-next-line no-console
console.log('reset email:', value);
}
</script>

View File

@@ -82,7 +82,8 @@ const formSchema = computed((): VbenFormSchema[] => {
});
function handleSubmit(value: Recordable<any>) {
void value;
// eslint-disable-next-line no-console
console.log('register submit:', value);
}
</script>

View File

@@ -76,10 +76,10 @@ const chartTabs: TabOption[] = [
</AnalysisChartsTabs>
<div class="mt-5 w-full md:flex">
<AnalysisChartCard class="mt-5 md:mt-0 md:mr-4 md:w-1/3" title="访问数量">
<AnalysisChartCard class="mt-5 md:mr-4 md:mt-0 md:w-1/3" title="访问数量">
<AnalyticsVisitsData />
</AnalysisChartCard>
<AnalysisChartCard class="mt-5 md:mt-0 md:mr-4 md:w-1/3" title="访问来源">
<AnalysisChartCard class="mt-5 md:mr-4 md:mt-0 md:w-1/3" title="访问来源">
<AnalyticsVisitsSource />
</AnalysisChartCard>
<AnalysisChartCard class="mt-5 md:mt-0 md:w-1/3" title="访问来源">

Some files were not shown because too many files have changed in this diff Show More