Merge branch 'master' of https://gitee.com/yudaocode/yudao-ui-admin-vue3 into feat/optimize_vite

 Conflicts:
	package.json
	src/types/auto-imports.d.ts
This commit is contained in:
YunaiV 2023-03-07 19:05:26 +08:00
commit 6cf76691a1
79 changed files with 691 additions and 286 deletions

19
.env.front Normal file
View File

@ -0,0 +1,19 @@
# 本地开发环境
NODE_ENV=development
VITE_DEV=true
# 请求路径
VITE_BASE_URL='http://api-dashboard.yudao.iocoder.cn'
# 上传路径
VITE_UPLOAD_URL='http://api-dashboard.yudao.iocoder.cn/admin-api/infra/file/upload'
# 接口前缀
VITE_API_BASEPATH=/dev-api
# 接口地址
VITE_API_URL=/admin-api
# 打包路径
VITE_BASE_PATH=/

31
.env.static Normal file
View File

@ -0,0 +1,31 @@
# 开发环境
NODE_ENV=production
VITE_DEV=false
# 请求路径
VITE_BASE_URL='http://localhost:48080'
# 上传路径
VITE_UPLOAD_URL='http://localhost:48080/admin-api/infra/file/upload'
# 接口前缀
VITE_API_BASEPATH=
# 接口地址
VITE_API_URL=/admin-api
# 是否删除debugger
VITE_DROP_DEBUGGER=true
# 是否删除console.log
VITE_DROP_CONSOLE=true
# 是否sourcemap
VITE_SOURCEMAP=false
# 打包路径
VITE_BASE_PATH=/admin-ui-vue3/
# 输出路径
VITE_OUT_DIR=dist-dev

View File

@ -5,5 +5,7 @@
/docs/* /docs/*
/vite.config.ts /vite.config.ts
/src/types/env.d.ts /src/types/env.d.ts
/src/types/auto-components.d.ts
/src/types/auto-imports.d.ts
/docs/**/* /docs/**/*
CHANGELOG CHANGELOG

View File

@ -17,7 +17,9 @@
**芋道**,以开发者为中心,打造中国第一流的快速开发平台,全部开源,个人与企业可 100% 免费使用。 **芋道**,以开发者为中心,打造中国第一流的快速开发平台,全部开源,个人与企业可 100% 免费使用。
基于 [vue-element-plus-admin](https://gitee.com/kailong110120130/vue-element-plus-admin) 实现,使用 Element Plus 免费开源的中后台模版,具备如下特性: * 采用 [vue-element-plus-admin](https://gitee.com/kailong110120130/vue-element-plus-admin)
* 改换saas自动引入等功能 [vue-element-plus-admin](https://gitee.com/yudaocode/vue-element-plus-admin)
* 使用 Element Plus 免费开源的中后台模版,具备如下特性:
![首页](preview/home.png) ![首页](preview/home.png)
@ -34,16 +36,16 @@
| 框架 | 说明 | 版本 | | 框架 | 说明 | 版本 |
|----------------------------------------------------------------------|------------------|--------| |----------------------------------------------------------------------|------------------|--------|
| [Vue](https://staging-cn.vuejs.org/) | Vue 框架 | 3.2.47 | | [Vue](https://staging-cn.vuejs.org/) | Vue 框架 | 3.2.47 |
| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 4.1.1 | | [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 4.1.4 |
| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.2.29 | | [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.2.34 |
| [TypeScript](https://www.typescriptlang.org/docs/) | JavaScript 的超集 | 4.9.5 | | [TypeScript](https://www.typescriptlang.org/docs/) | JavaScript 的超集 | 4.9.5 |
| [pinia](https://pinia.vuejs.org/) | Vue 存储库 替代 vuex5 | 2.0.30 | | [pinia](https://pinia.vuejs.org/) | Vue 存储库 替代 vuex5 | 2.0.33 |
| [vueuse](https://vueuse.org/) | 常用工具集 | 9.12.0 | | [vueuse](https://vueuse.org/) | 常用工具集 | 9.13.0 |
| [vxe-table](https://vxetable.cn/) | Vue 最强表单 | 4.3.9 | | [vxe-table](https://vxetable.cn/) | Vue 最强表单 | 4.3.10 |
| [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 9.2.2 | | [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 9.2.2 |
| [vue-router](https://router.vuejs.org/) | Vue 路由 | 4.1.6 | | [vue-router](https://router.vuejs.org/) | Vue 路由 | 4.1.6 |
| [windicss](https://cn.windicss.org/) | 下一代工具优先的 CSS 框架 | 3.5.6 | | [windicss](https://cn.windicss.org/) | 下一代工具优先的 CSS 框架 | 3.5.6 |
| [iconify](https://icon-sets.iconify.design/) | 在线图标库 | 3.0.1 | | [iconify](https://icon-sets.iconify.design/) | 在线图标库 | 3.1.0 |
| [wangeditor](https://www.wangeditor.com/) | 富文本编辑器 | 5.1.23 | | [wangeditor](https://www.wangeditor.com/) | 富文本编辑器 | 5.1.23 |
## 开发工具 ## 开发工具

View File

@ -30,7 +30,7 @@ export function createVitePlugins(VITE_APP_TITLE: string) {
progress(), progress(),
PurgeIcons(), PurgeIcons(),
vueSetupExtend(), vueSetupExtend(),
ElementPlus(), ElementPlus({}),
AutoImport({ AutoImport({
include: [ include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx /\.[tj]sx?$/, // .ts, .tsx, .js, .jsx

View File

@ -16,10 +16,12 @@ const include = [
'crypto-js', 'crypto-js',
'cropperjs', 'cropperjs',
'lodash-es', 'lodash-es',
'vxe-table',
'nprogress', 'nprogress',
'animate.css', 'animate.css',
'vxe-table',
'vxe-table/es/style', 'vxe-table/es/style',
'vxe-table/lib/locale/lang/zh-CN',
'vxe-table/lib/locale/lang/en-US',
'web-storage-cache', 'web-storage-cache',
'@iconify/iconify', '@iconify/iconify',
'@vueuse/core', '@vueuse/core',
@ -35,6 +37,7 @@ const include = [
'element-plus/es', 'element-plus/es',
'element-plus/es/locale/lang/zh-cn', 'element-plus/es/locale/lang/zh-cn',
'element-plus/es/locale/lang/en', 'element-plus/es/locale/lang/en',
'element-plus/es/components/backtop/style/index',
'element-plus/es/components/form/style/index', 'element-plus/es/components/form/style/index',
'element-plus/es/components/radio-group/style/index', 'element-plus/es/components/radio-group/style/index',
'element-plus/es/components/radio/style/index', 'element-plus/es/components/radio/style/index',
@ -60,7 +63,11 @@ const include = [
'element-plus/es/components/menu/style/index', 'element-plus/es/components/menu/style/index',
'element-plus/es/components/sub-menu/style/index', 'element-plus/es/components/sub-menu/style/index',
'element-plus/es/components/menu-item/style/index', 'element-plus/es/components/menu-item/style/index',
'element-plus/es/components/option/style/index' 'element-plus/es/components/option/style/index',
'element-plus/es/components/dropdown/style/index',
'element-plus/es/components/dropdown-menu/style/index',
'element-plus/es/components/dropdown-item/style/index',
'element-plus/es/components/skeleton/style/index'
] ]
const exclude = ['@iconify/json'] const exclude = ['@iconify/json']

View File

@ -1,16 +1,18 @@
{ {
"name": "yudao-ui-admin-vue3", "name": "yudao-ui-admin-vue3",
"version": "1.7.0-snapshot.1922", "version": "1.7.1-snapshot.1941",
"description": "基于vue3、vite4、element-plus、typesScript", "description": "基于vue3、vite4、element-plus、typesScript",
"author": "xingyu", "author": "xingyu",
"private": false, "private": false,
"scripts": { "scripts": {
"i": "pnpm install", "i": "pnpm install",
"dev": "DEBUG=vite:plugin:mkcert vite --mode base --force", "dev": "vite --mode base",
"front": "vite --mode front",
"ts:check": "vue-tsc --noEmit", "ts:check": "vue-tsc --noEmit",
"build:pro": "vite build --mode pro", "build:pro": "node --max_old_space_size=8000 ./node_modules/vite/bin/vite.js build --mode pro",
"build:dev": "vite build --mode dev", "build:dev": "node --max_old_space_size=8000 ./node_modules/vite/bin/vite.js build --mode dev",
"build:test": "npm run ts:check && vite build --mode test", "build:test": "node --max_old_space_size=8000 ./node_modules/vite/bin/vite.js build --mode test",
"build:static": "node --max_old_space_size=8000 ./node_modules/vite/bin/vite.js build --mode static",
"serve:pro": "vite preview --mode pro", "serve:pro": "vite preview --mode pro",
"serve:dev": "vite preview --mode dev", "serve:dev": "vite preview --mode dev",
"serve:test": "vite preview --mode test", "serve:test": "vite preview --mode test",
@ -27,12 +29,12 @@
"@form-create/designer": "^3.1.0", "@form-create/designer": "^3.1.0",
"@form-create/element-ui": "^3.1.17", "@form-create/element-ui": "^3.1.17",
"@iconify/iconify": "^3.1.0", "@iconify/iconify": "^3.1.0",
"@vueuse/core": "^9.12.0", "@vueuse/core": "^9.13.0",
"@wangeditor/editor": "^5.1.23", "@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.10", "@wangeditor/editor-for-vue": "^5.1.10",
"@zxcvbn-ts/core": "^2.2.1", "@zxcvbn-ts/core": "^2.2.1",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"axios": "^1.3.2", "axios": "^1.3.4",
"bpmn-js-token-simulation": "^0.10.0", "bpmn-js-token-simulation": "^0.10.0",
"camunda-bpmn-moddle": "^7.0.1", "camunda-bpmn-moddle": "^7.0.1",
"cropperjs": "^1.5.13", "cropperjs": "^1.5.13",
@ -41,47 +43,44 @@
"diagram-js": "^11.6.0", "diagram-js": "^11.6.0",
"echarts": "^5.4.1", "echarts": "^5.4.1",
"echarts-wordcloud": "^2.1.0", "echarts-wordcloud": "^2.1.0",
"element-plus": "2.2.29", "element-plus": "2.2.34",
"fast-xml-parser": "^4.0.13", "fast-xml-parser": "^4.1.3",
"highlight.js": "^11.7.0", "highlight.js": "^11.7.0",
"intro.js": "^6.0.0", "intro.js": "^6.0.0",
"jsencrypt": "^3.3.1", "jsencrypt": "^3.3.2",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"min-dash": "^4.0.0", "min-dash": "^4.0.0",
"mitt": "^3.0.0", "mitt": "^3.0.0",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"pinia": "^2.0.30", "pinia": "^2.0.33",
"qrcode": "^1.5.1", "qrcode": "^1.5.1",
"qs": "^6.11.0", "qs": "^6.11.1",
"steady-xml": "^0.1.0", "steady-xml": "^0.1.0",
"url": "^0.11.0", "url": "^0.11.0",
"vite-plugin-mkcert": "^1.13.0",
"vite-plugin-optimize-persist": "^0.1.2",
"vite-plugin-package-config": "^0.1.1",
"vue": "3.2.47", "vue": "3.2.47",
"vue-i18n": "9.2.2", "vue-i18n": "9.2.2",
"vue-router": "^4.1.6", "vue-router": "^4.1.6",
"vue-types": "^5.0.2", "vue-types": "^5.0.2",
"vuedraggable": "^4.1.0", "vuedraggable": "^4.1.0",
"vxe-table": "^4.3.9", "vxe-table": "^4.3.10",
"web-storage-cache": "^1.1.1", "web-storage-cache": "^1.1.1",
"xe-utils": "^3.5.7", "xe-utils": "^3.5.7",
"xml-js": "^1.6.11" "xml-js": "^1.6.11"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^17.4.2", "@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.2", "@commitlint/config-conventional": "^17.4.4",
"@iconify/json": "^2.2.19", "@iconify/json": "^2.2.31",
"@intlify/unplugin-vue-i18n": "^0.8.2", "@intlify/unplugin-vue-i18n": "^0.8.2",
"@purge-icons/generated": "^0.9.0", "@purge-icons/generated": "^0.9.0",
"@types/intro.js": "^5.1.0", "@types/intro.js": "^5.1.1",
"@types/lodash-es": "^4.17.6", "@types/lodash-es": "^4.17.6",
"@types/node": "^18.13.0", "@types/node": "^18.14.6",
"@types/nprogress": "^0.2.0", "@types/nprogress": "^0.2.0",
"@types/qrcode": "^1.5.0", "@types/qrcode": "^1.5.0",
"@types/qs": "^6.9.7", "@types/qs": "^6.9.7",
"@typescript-eslint/eslint-plugin": "^5.51.0", "@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.51.0", "@typescript-eslint/parser": "^5.54.1",
"@vitejs/plugin-legacy": "^4.0.1", "@vitejs/plugin-legacy": "^4.0.1",
"@vitejs/plugin-vue": "^4.0.0", "@vitejs/plugin-vue": "^4.0.0",
"@vitejs/plugin-vue-jsx": "^3.0.0", "@vitejs/plugin-vue-jsx": "^3.0.0",
@ -89,31 +88,31 @@
"bpmn-js": "^8.9.0", "bpmn-js": "^8.9.0",
"bpmn-js-properties-panel": "^0.46.0", "bpmn-js-properties-panel": "^0.46.0",
"consola": "^2.15.3", "consola": "^2.15.3",
"eslint": "^8.33.0", "eslint": "^8.35.0",
"eslint-config-prettier": "^8.6.0", "eslint-config-prettier": "^8.7.0",
"eslint-define-config": "^1.15.0", "eslint-define-config": "^1.15.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.9.0", "eslint-plugin-vue": "^9.9.0",
"lint-staged": "^13.1.1", "lint-staged": "^13.1.2",
"postcss": "^8.4.21", "postcss": "^8.4.21",
"postcss-html": "^1.5.0", "postcss-html": "^1.5.0",
"postcss-scss": "^4.0.6", "postcss-scss": "^4.0.6",
"prettier": "^2.8.4", "prettier": "^2.8.4",
"rimraf": "^4.1.2", "rimraf": "^4.3.1",
"rollup": "^3.14.0", "rollup": "^3.18.0",
"sass": "^1.58.0", "sass": "^1.58.3",
"stylelint": "^14.16.1", "stylelint": "^15.2.0",
"stylelint-config-html": "^1.1.0", "stylelint-config-html": "^1.1.0",
"stylelint-config-prettier": "^9.0.4", "stylelint-config-prettier": "^9.0.5",
"stylelint-config-recommended": "^9.0.0", "stylelint-config-recommended": "^10.0.1",
"stylelint-config-standard": "^29.0.0", "stylelint-config-standard": "^30.0.1",
"stylelint-order": "^6.0.1", "stylelint-order": "^6.0.2",
"terser": "^5.16.3", "terser": "^5.16.5",
"typescript": "4.9.5", "typescript": "4.9.5",
"unplugin-auto-import": "^0.14.2", "unplugin-auto-import": "^0.15.1",
"unplugin-element-plus": "^0.6.0", "unplugin-element-plus": "^0.7.0",
"unplugin-vue-components": "^0.23.0", "unplugin-vue-components": "^0.24.1",
"vite": "4.1.1", "vite": "4.1.4",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-plugin-ejs": "^1.6.4", "vite-plugin-ejs": "^1.6.4",
"vite-plugin-eslint": "^1.8.1", "vite-plugin-eslint": "^1.8.1",
@ -122,7 +121,7 @@
"vite-plugin-svg-icons": "^2.0.1", "vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-vue-setup-extend": "^0.4.0", "vite-plugin-vue-setup-extend": "^0.4.0",
"vite-plugin-windicss": "^1.8.10", "vite-plugin-windicss": "^1.8.10",
"vue-tsc": "^1.0.24", "vue-tsc": "^1.2.0",
"windicss": "^3.5.6" "windicss": "^3.5.6"
}, },
"engines": { "engines": {
@ -131,10 +130,10 @@
"license": "MIT", "license": "MIT",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://gitee.com/zhijiantianya/ruoyi-vue-pro" "url": "git+https://gitee.com/yudaocode/yudao-ui-admin-vue3"
}, },
"bugs": { "bugs": {
"url": "https://gitee.com/zhijiantianya/ruoyi-vue-pro/issues" "url": "https://gitee.com/yudaocode/yudao-ui-admin-vue3/issues"
}, },
"homepage": "https://gitee.com/zhijiantianya/ruoyi-vue-pro" "homepage": "https://gitee.com/yudaocode/yudao-ui-admin-vue3"
} }

View File

@ -109,7 +109,13 @@ const toggleClick = () => {
v-bind="getBindItemValue(item)" v-bind="getBindItemValue(item)"
> >
<template #label> <template #label>
<slot :name="`${item.field}-label`" :label="item.label">{{ item.label }}</slot> <slot
:name="`${item.field}-label`"
:row="{
label: item.label
}"
>{{ item.label }}</slot
>
</template> </template>
<template #default> <template #default>

View File

@ -123,6 +123,9 @@ const setVisible = () => {
</ElButton> </ElButton>
</div> </div>
</template> </template>
<template #[name] v-for="name in Object.keys($slots)" :key="name"
><slot :name="name"></slot
></template>
</Form> </Form>
<template v-if="layout === 'bottom'"> <template v-if="layout === 'bottom'">

View File

@ -12,7 +12,9 @@ const props = defineProps({
height: propTypes.string, height: propTypes.string,
minWidth: propTypes.string.def('460'), minWidth: propTypes.string.def('460'),
minHeight: propTypes.string.def('320'), minHeight: propTypes.string.def('320'),
showFooter: propTypes.bool.def(true) showFooter: propTypes.bool.def(true),
maskClosable: propTypes.bool.def(false),
escClosable: propTypes.bool.def(false)
}) })
const getBindValue = computed(() => { const getBindValue = computed(() => {

View File

@ -12,7 +12,7 @@ import { useAppStore } from '@/store/modules/app'
import { useDesign } from '@/hooks/web/useDesign' import { useDesign } from '@/hooks/web/useDesign'
import { XTableProps } from './type' import { XTableProps } from './type'
import { isBoolean, isFunction } from '@/utils/is' import { isBoolean, isFunction } from '@/utils/is'
import styleCss from './style/dark.scss?inline'
import download from '@/utils/download' import download from '@/utils/download'
const { t } = useI18n() const { t } = useI18n()
@ -25,15 +25,38 @@ const prefixCls = getPrefixCls('x-vxe-table')
const attrs = useAttrs() const attrs = useAttrs()
const emit = defineEmits(['register']) const emit = defineEmits(['register'])
const removeStyles = () => {
const filename = 'cssTheme'
//
const targetelement = 'style'
const targetattr = 'id'
let allsuspects = document.getElementsByTagName(targetelement)
for (let i = allsuspects.length; i >= 0; i--) {
if (
allsuspects[i] &&
allsuspects[i].getAttribute(targetattr) != null &&
allsuspects[i].getAttribute(targetattr)?.indexOf(filename) != -1
) {
console.log(allsuspects[i], 'node')
allsuspects[i].parentNode?.removeChild(allsuspects[i])
}
}
}
const reImport = () => {
let head = document.getElementsByTagName('head')[0]
let style = document.createElement('style')
style.innerText = styleCss
style.id = 'cssTheme'
head.appendChild(style)
}
watch( watch(
() => appStore.getIsDark, () => appStore.getIsDark,
() => { () => {
if (appStore.getIsDark == true) { if (appStore.getIsDark == true) {
import('./style/dark.scss') reImport()
} }
if (appStore.getIsDark == false) { if (appStore.getIsDark == false) {
import('./style/light.scss') removeStyles()
} }
}, },
{ immediate: true } { immediate: true }

View File

@ -190,12 +190,12 @@
</div> </div>
<XModal title="预览" width="80%" height="90%" v-model="previewModelVisible" destroy-on-close> <XModal title="预览" width="80%" height="90%" v-model="previewModelVisible" destroy-on-close>
<!-- append-to-body --> <!-- append-to-body -->
<pre v-highlight> <div v-highlight>
<code class="hljs"> <code class="hljs">
<!-- 高亮代码块 --> <!-- 高亮代码块 -->
{{ previewResult }} {{ previewResult }}
</code> </code>
</pre> </div>
<!-- <pre> <!-- <pre>
<code class="hljs" v-html="highlightedCode(previewType, previewResult)"></code> <code class="hljs" v-html="highlightedCode(previewType, previewResult)"></code>
</pre> --> </pre> -->
@ -331,7 +331,7 @@ const additionalModules = computed(() => {
// //
if (Object.prototype.toString.call(props.additionalModel) == '[object Array]') { if (Object.prototype.toString.call(props.additionalModel) == '[object Array]') {
Modules.push(...props.additionalModel) Modules.push(...(props.additionalModel as any[]))
} else { } else {
props.additionalModel && Modules.push(props.additionalModel) props.additionalModel && Modules.push(props.additionalModel)
} }

View File

@ -8,9 +8,10 @@
<script setup lang="ts" name="MyProcessPalette"> <script setup lang="ts" name="MyProcessPalette">
import { assign } from 'min-dash' import { assign } from 'min-dash'
const addTask = (event, options = {}) => { const bpmnInstances = () => (window as any).bpmnInstances
const ElementFactory = window.bpmnInstances.elementFactory const addTask = (event, options: any = {}) => {
const create = window.bpmnInstances.modeler.get('create') const ElementFactory = bpmnInstances().elementFactory
const create = bpmnInstances().modeler.get('create')
console.log(ElementFactory, create) console.log(ElementFactory, create)

View File

@ -109,6 +109,7 @@ const bpmnElement = ref()
const timer = ref() const timer = ref()
provide('prefix', props.prefix) provide('prefix', props.prefix)
provide('width', props.width) provide('width', props.width)
const bpmnInstances = () => (window as any)?.bpmnInstances
const initModels = () => { const initModels = () => {
// console.log(props, 'props') // console.log(props, 'props')
// console.log(props.bpmnModeler, 'sakdjjaskdsajdkasdjkadsjk') // console.log(props.bpmnModeler, 'sakdjjaskdsajdkasdjkadsjk')
@ -121,7 +122,8 @@ const initModels = () => {
} }
if (timer.value) { if (timer.value) {
clearTimeout(timer.value) clearTimeout(timer.value)
window.bpmnInstances = { const w = window as any
w.bpmnInstances = {
modeler: props.bpmnModeler, modeler: props.bpmnModeler,
modeling: props.bpmnModeler.get('modeling'), modeling: props.bpmnModeler.get('modeling'),
moddle: props.bpmnModeler.get('moddle'), moddle: props.bpmnModeler.get('moddle'),
@ -134,7 +136,7 @@ const initModels = () => {
} }
} }
console.log(window.bpmnInstances, 'window.bpmnInstances') console.log(bpmnInstances(), 'window.bpmnInstances')
getActiveElement() getActiveElement()
// }) // })
} }
@ -161,8 +163,8 @@ const initFormOnChanged = (element) => {
let activatedElement = element let activatedElement = element
if (!activatedElement) { if (!activatedElement) {
activatedElement = activatedElement =
window.bpmnInstances.elementRegistry.find((el) => el.type === 'bpmn:Process') ?? bpmnInstances().elementRegistry.find((el) => el.type === 'bpmn:Process') ??
window.bpmnInstances.elementRegistry.find((el) => el.type === 'bpmn:Collaboration') bpmnInstances().elementRegistry.find((el) => el.type === 'bpmn:Collaboration')
} }
if (!activatedElement) return if (!activatedElement) return
console.log(` console.log(`
@ -173,7 +175,7 @@ const initFormOnChanged = (element) => {
---------- ----------
`) `)
console.log('businessObject: ', activatedElement.businessObject) console.log('businessObject: ', activatedElement.businessObject)
window.bpmnInstances.bpmnElement = activatedElement bpmnInstances().bpmnElement = activatedElement
bpmnElement.value = activatedElement bpmnElement.value = activatedElement
elementId.value = activatedElement.id elementId.value = activatedElement.id
elementType.value = activatedElement.type.split(':')[1] || '' elementType.value = activatedElement.type.split(':')[1] || ''
@ -191,7 +193,8 @@ onMounted(() => {
}, 100) }, 100)
}) })
onBeforeUnmount(() => { onBeforeUnmount(() => {
window.bpmnInstances = null const w = window as any
w.bpmnInstances = null
console.log(props, 'props1') console.log(props, 'props1')
console.log(props.bpmnModeler, 'props.bpmnModeler1') console.log(props.bpmnModeler, 'props.bpmnModeler1')
}) })

View File

@ -59,11 +59,12 @@ const rules = reactive({
name: [{ required: true, message: '流程名称不能为空', trigger: 'blur' }] name: [{ required: true, message: '流程名称不能为空', trigger: 'blur' }]
}) })
const bpmnInstances = () => (window as any)?.bpmnInstances
const resetBaseInfo = () => { const resetBaseInfo = () => {
console.log(window, 'window') console.log(window, 'window')
console.log(bpmnElement.value, 'bpmnElement') console.log(bpmnElement.value, 'bpmnElement')
bpmnElement.value = window?.bpmnInstances?.bpmnElement bpmnElement.value = bpmnInstances()?.bpmnElement
console.log(bpmnElement.value, 'resetBaseInfo11111111111') console.log(bpmnElement.value, 'resetBaseInfo11111111111')
elementBaseInfo.value = bpmnElement.value.businessObject elementBaseInfo.value = bpmnElement.value.businessObject
needProps.value['type'] = bpmnElement.value.businessObject.$type needProps.value['type'] = bpmnElement.value.businessObject.$type
@ -125,13 +126,13 @@ const updateBaseInfo = (key) => {
console.log(window, 'window') console.log(window, 'window')
console.log(bpmnElement.value, 'bpmnElement') console.log(bpmnElement.value, 'bpmnElement')
console.log(toRaw(bpmnElement.value), 'bpmnElement') console.log(toRaw(bpmnElement.value), 'bpmnElement')
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
id: elementBaseInfo.value[key], id: elementBaseInfo.value[key],
di: { id: `${elementBaseInfo.value[key]}_di` } di: { id: `${elementBaseInfo.value[key]}_di` }
}) })
} else { } else {
console.log(attrObj, 'attrObj') console.log(attrObj, 'attrObj')
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), attrObj) bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), attrObj)
} }
} }
onMounted(() => { onMounted(() => {

View File

@ -72,14 +72,16 @@ const bpmnElement = ref()
const bpmnElementSource = ref() const bpmnElementSource = ref()
const bpmnElementSourceRef = ref() const bpmnElementSourceRef = ref()
const flowConditionRef = ref() const flowConditionRef = ref()
const bpmnInstances = () => (window as any)?.bpmnInstances
const resetFlowCondition = () => { const resetFlowCondition = () => {
bpmnElement.value = window.bpmnInstances.bpmnElement bpmnElement.value = bpmnInstances().bpmnElement
bpmnElementSource.value = bpmnElement.value.source bpmnElementSource.value = bpmnElement.value.source
bpmnElementSourceRef.value = bpmnElement.value.businessObject.sourceRef bpmnElementSourceRef.value = bpmnElement.value.businessObject.sourceRef
if ( if (
bpmnElementSourceRef.value && bpmnElementSourceRef.value &&
bpmnElementSourceRef.value.default && bpmnElementSourceRef.value.default &&
bpmnElementSourceRef.value.default.id === this.bpmnElement.id bpmnElementSourceRef.value.default.id === bpmnElement.value.id &&
flowConditionForm.value.type == 'default'
) { ) {
// //
flowConditionForm.value = { type: 'default' } flowConditionForm.value = { type: 'default' }
@ -113,18 +115,18 @@ const resetFlowCondition = () => {
const updateFlowType = (flowType) => { const updateFlowType = (flowType) => {
// //
if (flowType === 'condition') { if (flowType === 'condition') {
flowConditionRef.value = window.bpmnInstances.moddle.create('bpmn:FormalExpression') flowConditionRef.value = bpmnInstances().moddle.create('bpmn:FormalExpression')
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
conditionExpression: flowConditionRef.value conditionExpression: flowConditionRef.value
}) })
return return
} }
// //
if (flowType === 'default') { if (flowType === 'default') {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
conditionExpression: null conditionExpression: null
}) })
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElementSource.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElementSource.value), {
default: bpmnElement.value default: bpmnElement.value
}) })
return return
@ -134,11 +136,11 @@ const updateFlowType = (flowType) => {
bpmnElementSourceRef.value.default && bpmnElementSourceRef.value.default &&
bpmnElementSourceRef.value.default.id === bpmnElement.value.id bpmnElementSourceRef.value.default.id === bpmnElement.value.id
) { ) {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElementSource.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElementSource.value), {
default: null default: null
}) })
} }
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
conditionExpression: null conditionExpression: null
}) })
} }
@ -146,22 +148,22 @@ const updateFlowCondition = () => {
let { conditionType, scriptType, body, resource, language } = flowConditionForm.value let { conditionType, scriptType, body, resource, language } = flowConditionForm.value
let condition let condition
if (conditionType === 'expression') { if (conditionType === 'expression') {
condition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', { body }) condition = bpmnInstances().moddle.create('bpmn:FormalExpression', { body })
} else { } else {
if (scriptType === 'inlineScript') { if (scriptType === 'inlineScript') {
condition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', { body, language }) condition = bpmnInstances().moddle.create('bpmn:FormalExpression', { body, language })
// this.$set(this.flowConditionForm, "resource", ""); // this.$set(this.flowConditionForm, "resource", "");
flowConditionForm.value['resource'] = '' flowConditionForm.value['resource'] = ''
} else { } else {
// this.$set(this.flowConditionForm, "body", ""); // this.$set(this.flowConditionForm, "body", "");
flowConditionForm.value['body'] = '' flowConditionForm.value['body'] = ''
condition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', { condition = bpmnInstances().moddle.create('bpmn:FormalExpression', {
resource, resource,
language language
}) })
} }
} }
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
conditionExpression: condition conditionExpression: condition
}) })
} }
@ -175,11 +177,13 @@ onBeforeUnmount(() => {
watch( watch(
() => props.businessObject, () => props.businessObject,
(val) => { (val) => {
if (val) { console.log(val, 'val')
nextTick(() => { nextTick(() => {
resetFlowCondition() resetFlowCondition()
}) })
} },
{
immediate: true
} }
) )
</script> </script>

View File

@ -239,17 +239,18 @@ const elExtensionElements = ref()
const formData = ref() const formData = ref()
const otherExtensions = ref() const otherExtensions = ref()
const bpmnInstances = () => (window as any)?.bpmnInstances
const resetFormList = () => { const resetFormList = () => {
bpmnELement.value = window.bpmnInstances.bpmnElement bpmnELement.value = bpmnInstances().bpmnElement
formKey.value = bpmnELement.value.businessObject.formKey formKey.value = bpmnELement.value.businessObject.formKey
// //
elExtensionElements.value = elExtensionElements.value =
bpmnELement.value.businessObject.get('extensionElements') || bpmnELement.value.businessObject.get('extensionElements') ||
window.bpmnInstances.moddle.create('bpmn:ExtensionElements', { values: [] }) bpmnInstances().moddle.create('bpmn:ExtensionElements', { values: [] })
// //
formData.value = formData.value =
elExtensionElements.value.values.filter((ex) => ex.$type === `${prefix}:FormData`)?.[0] || elExtensionElements.value.values.filter((ex) => ex.$type === `${prefix}:FormData`)?.[0] ||
window.bpmnInstances.moddle.create(`${prefix}:FormData`, { fields: [] }) bpmnInstances().moddle.create(`${prefix}:FormData`, { fields: [] })
// businessKey formData // businessKey formData
businessKey.value = formData.value.businessKey businessKey.value = formData.value.businessKey
@ -266,12 +267,12 @@ const resetFormList = () => {
updateElementExtensions() updateElementExtensions()
} }
const updateElementFormKey = () => { const updateElementFormKey = () => {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnELement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnELement.value), {
formKey: formKey.value formKey: formKey.value
}) })
} }
const updateElementBusinessKey = () => { const updateElementBusinessKey = () => {
window.bpmnInstances.modeling.updateModdleProperties(toRaw(bpmnELement.value), formData.value, { bpmnInstances().modeling.updateModdleProperties(toRaw(bpmnELement.value), formData.value, {
businessKey: businessKey.value businessKey: businessKey.value
}) })
} }
@ -353,37 +354,37 @@ const saveFieldOption = () => {
// //
const saveField = () => { const saveField = () => {
const { id, type, label, defaultValue, datePattern } = formFieldForm.value const { id, type, label, defaultValue, datePattern } = formFieldForm.value
const Field = window.bpmnInstances.moddle.create(`${prefix}:FormField`, { id, type, label }) const Field = bpmnInstances().moddle.create(`${prefix}:FormField`, { id, type, label })
defaultValue && (Field.defaultValue = defaultValue) defaultValue && (Field.defaultValue = defaultValue)
datePattern && (Field.datePattern = datePattern) datePattern && (Field.datePattern = datePattern)
// //
if (fieldPropertiesList.value && fieldPropertiesList.value.length) { if (fieldPropertiesList.value && fieldPropertiesList.value.length) {
const fieldPropertyList = fieldPropertiesList.value.map((fp) => { const fieldPropertyList = fieldPropertiesList.value.map((fp) => {
return window.bpmnInstances.moddle.create(`${prefix}:Property`, { return bpmnInstances().moddle.create(`${prefix}:Property`, {
id: fp.id, id: fp.id,
value: fp.value value: fp.value
}) })
}) })
Field.properties = window.bpmnInstances.moddle.create(`${this.prefix}:Properties`, { Field.properties = bpmnInstances().moddle.create(`${prefix}:Properties`, {
values: fieldPropertyList values: fieldPropertyList
}) })
} }
// //
if (fieldConstraintsList.value && fieldConstraintsList.value.length) { if (fieldConstraintsList.value && fieldConstraintsList.value.length) {
const fieldConstraintList = fieldConstraintsList.value.map((fc) => { const fieldConstraintList = fieldConstraintsList.value.map((fc) => {
return window.bpmnInstances.moddle.create(`${prefix}:Constraint`, { return bpmnInstances().moddle.create(`${prefix}:Constraint`, {
name: fc.name, name: fc.name,
config: fc.config config: fc.config
}) })
}) })
Field.validation = window.bpmnInstances.moddle.create(`${prefix}:Validation`, { Field.validation = bpmnInstances().moddle.create(`${prefix}:Validation`, {
constraints: fieldConstraintList constraints: fieldConstraintList
}) })
} }
// //
if (fieldEnumList.value && fieldEnumList.value.length) { if (fieldEnumList.value && fieldEnumList.value.length) {
Field.values = fieldEnumList.value.map((fe) => { Field.values = fieldEnumList.value.map((fe) => {
return window.bpmnInstances.moddle.create(`${prefix}:Value`, { name: fe.name, id: fe.id }) return bpmnInstances().moddle.create(`${prefix}:Value`, { name: fe.name, id: fe.id })
}) })
} }
// //
@ -421,11 +422,11 @@ const removeField = (field, index) => {
const updateElementExtensions = () => { const updateElementExtensions = () => {
// //
const newElExtensionElements = window.bpmnInstances.moddle.create(`bpmn:ExtensionElements`, { const newElExtensionElements = bpmnInstances().moddle.create(`bpmn:ExtensionElements`, {
values: otherExtensions.value.concat(formData.value) values: otherExtensions.value.concat(formData.value)
}) })
// //
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnELement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnELement.value), {
extensionElements: newElExtensionElements extensionElements: newElExtensionElements
}) })
} }

View File

@ -266,9 +266,10 @@ const otherExtensionList = ref()
const bpmnElementListeners = ref() const bpmnElementListeners = ref()
const listenerFormRef = ref() const listenerFormRef = ref()
const listenerFieldFormRef = ref() const listenerFieldFormRef = ref()
const bpmnInstances = () => (window as any)?.bpmnInstances
const resetListenersList = () => { const resetListenersList = () => {
bpmnElement.value = window.bpmnInstances.bpmnElement bpmnElement.value = bpmnInstances().bpmnElement
otherExtensionList.value = [] otherExtensionList.value = []
bpmnElementListeners.value = bpmnElementListeners.value =
bpmnElement.value.businessObject?.extensionElements?.values?.filter( bpmnElement.value.businessObject?.extensionElements?.values?.filter(

View File

@ -313,13 +313,14 @@ const bpmnElementListeners = ref()
const otherExtensionList = ref() const otherExtensionList = ref()
const listenerFormRef = ref() const listenerFormRef = ref()
const listenerFieldFormRef = ref() const listenerFieldFormRef = ref()
const bpmnInstances = () => (window as any)?.bpmnInstances
const resetListenersList = () => { const resetListenersList = () => {
console.log( console.log(
window.bpmnInstances.bpmnElement, bpmnInstances().bpmnElement,
'window.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElement' 'window.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElementwindow.bpmnInstances.bpmnElement'
) )
bpmnElement.value = window.bpmnInstances.bpmnElement bpmnElement.value = bpmnInstances().bpmnElement
otherExtensionList.value = [] otherExtensionList.value = []
bpmnElementListeners.value = bpmnElementListeners.value =
bpmnElement.value.businessObject?.extensionElements?.values.filter( bpmnElement.value.businessObject?.extensionElements?.values.filter(

View File

@ -87,6 +87,7 @@ const defaultLoopInstanceForm = ref({
const loopInstanceForm = ref<any>({}) const loopInstanceForm = ref<any>({})
const bpmnElement = ref(null) const bpmnElement = ref(null)
const multiLoopInstance = ref(null) const multiLoopInstance = ref(null)
const bpmnInstances = () => (window as any)?.bpmnInstances
const getElementLoop = (businessObject) => { const getElementLoop = (businessObject) => {
if (!businessObject.loopCharacteristics) { if (!businessObject.loopCharacteristics) {
@ -112,7 +113,7 @@ const getElementLoop = (businessObject) => {
loopCardinality: businessObject.loopCharacteristics?.loopCardinality?.body ?? '' loopCardinality: businessObject.loopCharacteristics?.loopCardinality?.body ?? ''
} }
// businessObject loopCharacteristics // businessObject loopCharacteristics
multiLoopInstance.value = window.bpmnInstances.bpmnElement.businessObject.loopCharacteristics multiLoopInstance.value = bpmnInstances().bpmnElement.businessObject.loopCharacteristics
// //
if ( if (
businessObject.loopCharacteristics.extensionElements && businessObject.loopCharacteristics.extensionElements &&
@ -127,17 +128,17 @@ const changeLoopCharacteristicsType = (type) => {
// this.loopInstanceForm = { ...this.defaultLoopInstanceForm }; // // this.loopInstanceForm = { ...this.defaultLoopInstanceForm }; //
// //
if (type === 'Null') { if (type === 'Null') {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
loopCharacteristics: null loopCharacteristics: null
}) })
return return
} }
// //
if (type === 'StandardLoop') { if (type === 'StandardLoop') {
const loopCharacteristicsObject = window.bpmnInstances.moddle.create( const loopCharacteristicsObject = bpmnInstances().moddle.create(
'bpmn:StandardLoopCharacteristics' 'bpmn:StandardLoopCharacteristics'
) )
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
loopCharacteristics: loopCharacteristicsObject loopCharacteristics: loopCharacteristicsObject
}) })
multiLoopInstance.value = null multiLoopInstance.value = null
@ -145,17 +146,17 @@ const changeLoopCharacteristicsType = (type) => {
} }
// //
if (type === 'SequentialMultiInstance') { if (type === 'SequentialMultiInstance') {
multiLoopInstance.value = window.bpmnInstances.moddle.create( multiLoopInstance.value = bpmnInstances().moddle.create(
'bpmn:MultiInstanceLoopCharacteristics', 'bpmn:MultiInstanceLoopCharacteristics',
{ isSequential: true } { isSequential: true }
) )
} else { } else {
multiLoopInstance.value = window.bpmnInstances.moddle.create( multiLoopInstance.value = bpmnInstances().moddle.create(
'bpmn:MultiInstanceLoopCharacteristics', 'bpmn:MultiInstanceLoopCharacteristics',
{ collection: '${coll_userList}' } { collection: '${coll_userList}' }
) )
} }
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
loopCharacteristics: toRaw(multiLoopInstance.value) loopCharacteristics: toRaw(multiLoopInstance.value)
}) })
} }
@ -163,11 +164,11 @@ const changeLoopCharacteristicsType = (type) => {
const updateLoopCardinality = (cardinality) => { const updateLoopCardinality = (cardinality) => {
let loopCardinality = null let loopCardinality = null
if (cardinality && cardinality.length) { if (cardinality && cardinality.length) {
loopCardinality = window.bpmnInstances.moddle.create('bpmn:FormalExpression', { loopCardinality = bpmnInstances().moddle.create('bpmn:FormalExpression', {
body: cardinality body: cardinality
}) })
} }
window.bpmnInstances.modeling.updateModdleProperties( bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value), toRaw(bpmnElement.value),
multiLoopInstance.value, multiLoopInstance.value,
{ {
@ -179,11 +180,11 @@ const updateLoopCardinality = (cardinality) => {
const updateLoopCondition = (condition) => { const updateLoopCondition = (condition) => {
let completionCondition = null let completionCondition = null
if (condition && condition.length) { if (condition && condition.length) {
completionCondition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', { completionCondition = bpmnInstances().moddle.create('bpmn:FormalExpression', {
body: condition body: condition
}) })
} }
window.bpmnInstances.modeling.updateModdleProperties( bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value), toRaw(bpmnElement.value),
multiLoopInstance.value, multiLoopInstance.value,
{ {
@ -193,14 +194,14 @@ const updateLoopCondition = (condition) => {
} }
// //
const updateLoopTimeCycle = (timeCycle) => { const updateLoopTimeCycle = (timeCycle) => {
const extensionElements = window.bpmnInstances.moddle.create('bpmn:ExtensionElements', { const extensionElements = bpmnInstances().moddle.create('bpmn:ExtensionElements', {
values: [ values: [
window.bpmnInstances.moddle.create(`${prefix}:FailedJobRetryTimeCycle`, { bpmnInstances().moddle.create(`${prefix}:FailedJobRetryTimeCycle`, {
body: timeCycle body: timeCycle
}) })
] ]
}) })
window.bpmnInstances.modeling.updateModdleProperties( bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value), toRaw(bpmnElement.value),
multiLoopInstance.value, multiLoopInstance.value,
{ {
@ -210,7 +211,7 @@ const updateLoopTimeCycle = (timeCycle) => {
} }
// //
const updateLoopBase = () => { const updateLoopBase = () => {
window.bpmnInstances.modeling.updateModdleProperties( bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value), toRaw(bpmnElement.value),
multiLoopInstance.value, multiLoopInstance.value,
{ {
@ -230,7 +231,7 @@ const updateLoopAsync = (key) => {
} else { } else {
asyncAttr[key] = loopInstanceForm.value[key] asyncAttr[key] = loopInstanceForm.value[key]
} }
window.bpmnInstances.modeling.updateModdleProperties( bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value), toRaw(bpmnElement.value),
multiLoopInstance.value, multiLoopInstance.value,
asyncAttr asyncAttr
@ -245,7 +246,7 @@ onBeforeUnmount(() => {
watch( watch(
() => props.businessObject, () => props.businessObject,
(val) => { (val) => {
bpmnElement.value = window.bpmnInstances.bpmnElement bpmnElement.value = bpmnInstances().bpmnElement
getElementLoop(val) getElementLoop(val)
}, },
{ immediate: true } { immediate: true }

View File

@ -22,13 +22,14 @@ const props = defineProps({
}) })
const documentation = ref('') const documentation = ref('')
const bpmnElement = ref() const bpmnElement = ref()
const bpmnInstances = () => (window as any).bpmnInstances
const updateDocumentation = () => { const updateDocumentation = () => {
;(bpmnElement.value && bpmnElement.value.id === props.id) || ;(bpmnElement.value && bpmnElement.value.id === props.id) ||
(bpmnElement.value = (window as any).bpmnInstances.elementRegistry.get(props.id)) (bpmnElement.value = bpmnInstances().elementRegistry.get(props.id))
const documentations = window.bpmnInstances.bpmnFactory.create('bpmn:Documentation', { const documentations = bpmnInstances().bpmnFactory.create('bpmn:Documentation', {
text: documentation.value text: documentation.value
}) })
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
documentation: [documentations] documentation: [documentations]
}) })
} }
@ -41,7 +42,7 @@ watch(
(id) => { (id) => {
if (id && id.length) { if (id && id.length) {
nextTick(() => { nextTick(() => {
const documentations = window.bpmnInstances.bpmnElement.businessObject?.documentation const documentations = bpmnInstances().bpmnElement.businessObject?.documentation
documentation.value = documentations && documentations.length ? documentations[0].text : '' documentation.value = documentations && documentations.length ? documentations[0].text : ''
}) })
} else { } else {

View File

@ -70,10 +70,11 @@ const otherExtensionList = ref()
const bpmnElementProperties = ref() const bpmnElementProperties = ref()
const bpmnElementPropertyList = ref() const bpmnElementPropertyList = ref()
const attributeFormRef = ref() const attributeFormRef = ref()
const bpmnInstances = () => (window as any)?.bpmnInstances
const resetAttributesList = () => { const resetAttributesList = () => {
console.log(window, 'windowwindowwindowwindowwindowwindowwindow') console.log(window, 'windowwindowwindowwindowwindowwindowwindow')
bpmnElement.value = window.bpmnInstances.bpmnElement bpmnElement.value = bpmnInstances().bpmnElement
otherExtensionList.value = [] // otherExtensionList.value = [] //
bpmnElementProperties.value = bpmnElementProperties.value =
// bpmnElement.value.businessObject?.extensionElements?.filter((ex) => { // bpmnElement.value.businessObject?.extensionElements?.filter((ex) => {
@ -110,7 +111,7 @@ const removeAttributes = (attr, index) => {
elementPropertyList.value.splice(index, 1) elementPropertyList.value.splice(index, 1)
bpmnElementPropertyList.value.splice(index, 1) bpmnElementPropertyList.value.splice(index, 1)
// //
const propertiesObject = window.bpmnInstances.moddle.create(`${prefix}:Properties`, { const propertiesObject = bpmnInstances().moddle.create(`${prefix}:Properties`, {
values: bpmnElementPropertyList.value values: bpmnElementPropertyList.value
}) })
updateElementExtensions(propertiesObject) updateElementExtensions(propertiesObject)
@ -122,7 +123,7 @@ const saveAttribute = () => {
console.log(propertyForm.value, 'propertyForm.value') console.log(propertyForm.value, 'propertyForm.value')
const { name, value } = propertyForm.value const { name, value } = propertyForm.value
if (editingPropertyIndex.value !== -1) { if (editingPropertyIndex.value !== -1) {
window.bpmnInstances.modeling.updateModdleProperties( bpmnInstances().modeling.updateModdleProperties(
toRaw(bpmnElement.value), toRaw(bpmnElement.value),
toRaw(bpmnElementPropertyList.value)[toRaw(editingPropertyIndex.value)], toRaw(bpmnElementPropertyList.value)[toRaw(editingPropertyIndex.value)],
{ {
@ -132,12 +133,12 @@ const saveAttribute = () => {
) )
} else { } else {
// //
const newPropertyObject = window.bpmnInstances.moddle.create(`${prefix}:Property`, { const newPropertyObject = bpmnInstances().moddle.create(`${prefix}:Property`, {
name, name,
value value
}) })
// //
const propertiesObject = window.bpmnInstances.moddle.create(`${prefix}:Properties`, { const propertiesObject = bpmnInstances().moddle.create(`${prefix}:Properties`, {
values: bpmnElementPropertyList.value.concat([newPropertyObject]) values: bpmnElementPropertyList.value.concat([newPropertyObject])
}) })
updateElementExtensions(propertiesObject) updateElementExtensions(propertiesObject)
@ -146,10 +147,10 @@ const saveAttribute = () => {
resetAttributesList() resetAttributesList()
} }
const updateElementExtensions = (properties) => { const updateElementExtensions = (properties) => {
const extensions = window.bpmnInstances.moddle.create('bpmn:ExtensionElements', { const extensions = bpmnInstances().moddle.create('bpmn:ExtensionElements', {
values: otherExtensionList.value.concat([properties]) values: otherExtensionList.value.concat([properties])
}) })
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
extensionElements: extensions extensionElements: extensions
}) })
} }

View File

@ -62,10 +62,11 @@ const modelConfig = computed(() => {
return { title: '创建信号', idLabel: '信号ID', nameLabel: '信号名称' } return { title: '创建信号', idLabel: '信号ID', nameLabel: '信号名称' }
} }
}) })
const bpmnInstances = () => (window as any)?.bpmnInstances
const initDataList = () => { const initDataList = () => {
console.log(window, 'window') console.log(window, 'window')
rootElements.value = window.bpmnInstances.modeler.getDefinitions().rootElements rootElements.value = bpmnInstances().modeler.getDefinitions().rootElements
messageIdMap.value = {} messageIdMap.value = {}
signalIdMap.value = {} signalIdMap.value = {}
messageList.value = [] messageList.value = []
@ -91,13 +92,13 @@ const addNewObject = () => {
if (messageIdMap.value[modelObjectForm.value.id]) { if (messageIdMap.value[modelObjectForm.value.id]) {
message.error('该消息已存在请修改id后重新保存') message.error('该消息已存在请修改id后重新保存')
} }
const messageRef = window.bpmnInstances.moddle.create('bpmn:Message', modelObjectForm.value) const messageRef = bpmnInstances().moddle.create('bpmn:Message', modelObjectForm.value)
rootElements.value.push(messageRef) rootElements.value.push(messageRef)
} else { } else {
if (signalIdMap.value[modelObjectForm.value.id]) { if (signalIdMap.value[modelObjectForm.value.id]) {
message.error('该信号已存在请修改id后重新保存') message.error('该信号已存在请修改id后重新保存')
} }
const signalRef = window.bpmnInstances.moddle.create('bpmn:Signal', modelObjectForm.value) const signalRef = bpmnInstances().moddle.create('bpmn:Signal', modelObjectForm.value)
rootElements.value.push(signalRef) rootElements.value.push(signalRef)
} }
modelVisible.value = false modelVisible.value = false

View File

@ -45,11 +45,12 @@ const installedComponent = ref({
}) })
const bpmnElement = ref() const bpmnElement = ref()
const bpmnInstances = () => (window as any).bpmnInstances
const changeTaskAsync = () => { const changeTaskAsync = () => {
if (!taskConfigForm.value.asyncBefore && !taskConfigForm.value.asyncAfter) { if (!taskConfigForm.value.asyncBefore && !taskConfigForm.value.asyncAfter) {
taskConfigForm.value.exclusive = false taskConfigForm.value.exclusive = false
} }
window.bpmnInstances.modeling.updateProperties(window.bpmnInstances.bpmnElement, { bpmnInstances().modeling.updateProperties(bpmnInstances().bpmnElement, {
...taskConfigForm.value ...taskConfigForm.value
}) })
} }
@ -57,7 +58,7 @@ const changeTaskAsync = () => {
watch( watch(
() => props.id, () => props.id,
() => { () => {
bpmnElement.value = window.bpmnInstances.bpmnElement bpmnElement.value = bpmnInstances().bpmnElement
taskConfigForm.value.asyncBefore = bpmnElement.value?.businessObject?.asyncBefore taskConfigForm.value.asyncBefore = bpmnElement.value?.businessObject?.asyncBefore
taskConfigForm.value.asyncAfter = bpmnElement.value?.businessObject?.asyncAfter taskConfigForm.value.asyncAfter = bpmnElement.value?.businessObject?.asyncAfter
taskConfigForm.value.exclusive = bpmnElement.value?.businessObject?.exclusive taskConfigForm.value.exclusive = bpmnElement.value?.businessObject?.exclusive

View File

@ -11,10 +11,10 @@
> >
<el-select v-model="bindMessageId" @change="updateTaskMessage"> <el-select v-model="bindMessageId" @change="updateTaskMessage">
<el-option <el-option
v-for="id in Object.keys(messageMap)" v-for="item in Object.keys(messageMap)"
:value="id" :value="item"
:label="messageMap[id]" :label="messageMap[item]"
:key="id" :key="item"
/> />
</el-select> </el-select>
<XButton <XButton
@ -64,8 +64,9 @@ const bpmnElement = ref<any>()
const bpmnMessageRefsMap = ref<any>() const bpmnMessageRefsMap = ref<any>()
const bpmnRootElements = ref<any>() const bpmnRootElements = ref<any>()
const bpmnInstances = () => (window as any).bpmnInstances
const getBindMessage = () => { const getBindMessage = () => {
bpmnElement.value = window.bpmnInstances.bpmnElement bpmnElement.value = bpmnInstances().bpmnElement
bindMessageId.value = bpmnElement.value.businessObject?.messageRef?.id || '-1' bindMessageId.value = bpmnElement.value.businessObject?.messageRef?.id || '-1'
} }
const openMessageModel = () => { const openMessageModel = () => {
@ -77,7 +78,7 @@ const createNewMessage = () => {
message.error('该消息已存在请修改id后重新保存') message.error('该消息已存在请修改id后重新保存')
return return
} }
const newMessage = window.bpmnInstances.moddle.create('bpmn:Message', newMessageForm.value) const newMessage = bpmnInstances().moddle.create('bpmn:Message', newMessageForm.value)
bpmnRootElements.value.push(newMessage) bpmnRootElements.value.push(newMessage)
messageMap.value[newMessageForm.value.id] = newMessageForm.value.name messageMap.value[newMessageForm.value.id] = newMessageForm.value.name
bpmnMessageRefsMap.value[newMessageForm.value.id] = newMessage bpmnMessageRefsMap.value[newMessageForm.value.id] = newMessage
@ -85,11 +86,11 @@ const createNewMessage = () => {
} }
const updateTaskMessage = (messageId) => { const updateTaskMessage = (messageId) => {
if (messageId === '-1') { if (messageId === '-1') {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
messageRef: null messageRef: null
}) })
} else { } else {
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), { bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), {
messageRef: bpmnMessageRefsMap.value[messageId] messageRef: bpmnMessageRefsMap.value[messageId]
}) })
} }
@ -97,7 +98,7 @@ const updateTaskMessage = (messageId) => {
onMounted(() => { onMounted(() => {
bpmnMessageRefsMap.value = Object.create(null) bpmnMessageRefsMap.value = Object.create(null)
bpmnRootElements.value = window.bpmnInstances.modeler.getDefinitions().rootElements bpmnRootElements.value = bpmnInstances().modeler.getDefinitions().rootElements
bpmnRootElements.value bpmnRootElements.value
.filter((el) => el.$type === 'bpmn:Message') .filter((el) => el.$type === 'bpmn:Message')
.forEach((m) => { .forEach((m) => {
@ -113,7 +114,7 @@ onBeforeUnmount(() => {
watch( watch(
() => props.id, () => props.id,
() => { () => {
// bpmnElement.value = window.bpmnInstances.bpmnElement // bpmnElement.value = bpmnInstances().bpmnElement
nextTick(() => { nextTick(() => {
getBindMessage() getBindMessage()
}) })

View File

@ -58,6 +58,8 @@ const defaultTaskForm = ref({
const scriptTaskForm = ref<any>({}) const scriptTaskForm = ref<any>({})
const bpmnElement = ref() const bpmnElement = ref()
const bpmnInstances = () => (window as any)?.bpmnInstances
const resetTaskForm = () => { const resetTaskForm = () => {
for (let key in defaultTaskForm.value) { for (let key in defaultTaskForm.value) {
let value = bpmnElement.value?.businessObject[key] || defaultTaskForm.value[key] let value = bpmnElement.value?.businessObject[key] || defaultTaskForm.value[key]
@ -76,7 +78,7 @@ const updateElementTask = () => {
taskAttr.resource = scriptTaskForm.value.resource || null taskAttr.resource = scriptTaskForm.value.resource || null
taskAttr.script = null taskAttr.script = null
} }
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), taskAttr) bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), taskAttr)
} }
onBeforeUnmount(() => { onBeforeUnmount(() => {
@ -86,7 +88,7 @@ onBeforeUnmount(() => {
watch( watch(
() => props.id, () => props.id,
() => { () => {
bpmnElement.value = window.bpmnInstances.bpmnElement bpmnElement.value = bpmnInstances().bpmnElement
nextTick(() => { nextTick(() => {
resetTaskForm() resetTaskForm()
}) })

View File

@ -53,6 +53,8 @@ const defaultTaskForm = ref({
const userTaskForm = ref<any>({}) const userTaskForm = ref<any>({})
// const mockData=ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) // const mockData=ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
const bpmnElement = ref() const bpmnElement = ref()
const bpmnInstances = () => (window as any)?.bpmnInstances
const resetTaskForm = () => { const resetTaskForm = () => {
for (let key in defaultTaskForm.value) { for (let key in defaultTaskForm.value) {
let value let value
@ -76,13 +78,13 @@ const updateElementTask = (key) => {
} else { } else {
taskAttr[key] = userTaskForm.value[key] || null taskAttr[key] = userTaskForm.value[key] || null
} }
window.bpmnInstances.modeling.updateProperties(toRaw(bpmnElement.value), taskAttr) bpmnInstances().modeling.updateProperties(toRaw(bpmnElement.value), taskAttr)
} }
watch( watch(
() => props.id, () => props.id,
() => { () => {
bpmnElement.value = window.bpmnInstances.bpmnElement bpmnElement.value = bpmnInstances().bpmnElement
nextTick(() => { nextTick(() => {
resetTaskForm() resetTaskForm()
}) })

View File

@ -1,4 +1,5 @@
import { toRaw } from 'vue' import { toRaw } from 'vue'
const bpmnInstances = () => (window as any)?.bpmnInstances
// 创建监听器实例 // 创建监听器实例
export function createListenerObject(options, isTask, prefix) { export function createListenerObject(options, isTask, prefix) {
const listenerObj = Object.create(null) const listenerObj = Object.create(null)
@ -25,16 +26,16 @@ export function createListenerObject(options, isTask, prefix) {
} }
// 任务监听器的 定时器 设置 // 任务监听器的 定时器 设置
if (isTask && options.event === 'timeout' && !!options.eventDefinitionType) { if (isTask && options.event === 'timeout' && !!options.eventDefinitionType) {
const timeDefinition = window.bpmnInstances.moddle.create('bpmn:FormalExpression', { const timeDefinition = bpmnInstances().moddle.create('bpmn:FormalExpression', {
body: options.eventTimeDefinitions body: options.eventTimeDefinitions
}) })
const TimerEventDefinition = window.bpmnInstances.moddle.create('bpmn:TimerEventDefinition', { const TimerEventDefinition = bpmnInstances().moddle.create('bpmn:TimerEventDefinition', {
id: `TimerEventDefinition_${uuid(8)}`, id: `TimerEventDefinition_${uuid(8)}`,
[`time${options.eventDefinitionType.replace(/^\S/, (s) => s.toUpperCase())}`]: timeDefinition [`time${options.eventDefinitionType.replace(/^\S/, (s) => s.toUpperCase())}`]: timeDefinition
}) })
listenerObj.eventDefinitions = [TimerEventDefinition] listenerObj.eventDefinitions = [TimerEventDefinition]
} }
return window.bpmnInstances.moddle.create( return bpmnInstances().moddle.create(
`${prefix}:${isTask ? 'TaskListener' : 'ExecutionListener'}`, `${prefix}:${isTask ? 'TaskListener' : 'ExecutionListener'}`,
listenerObj listenerObj
) )
@ -44,7 +45,7 @@ export function createListenerObject(options, isTask, prefix) {
export function createFieldObject(option, prefix) { export function createFieldObject(option, prefix) {
const { name, fieldType, string, expression } = option const { name, fieldType, string, expression } = option
const fieldConfig = fieldType === 'string' ? { name, string } : { name, expression } const fieldConfig = fieldType === 'string' ? { name, string } : { name, expression }
return window.bpmnInstances.moddle.create(`${prefix}:Field`, fieldConfig) return bpmnInstances().moddle.create(`${prefix}:Field`, fieldConfig)
} }
// 创建脚本实例 // 创建脚本实例
@ -52,21 +53,21 @@ export function createScriptObject(options, prefix) {
const { scriptType, scriptFormat, value, resource } = options const { scriptType, scriptFormat, value, resource } = options
const scriptConfig = const scriptConfig =
scriptType === 'inlineScript' ? { scriptFormat, value } : { scriptFormat, resource } scriptType === 'inlineScript' ? { scriptFormat, value } : { scriptFormat, resource }
return window.bpmnInstances.moddle.create(`${prefix}:Script`, scriptConfig) return bpmnInstances().moddle.create(`${prefix}:Script`, scriptConfig)
} }
// 更新元素扩展属性 // 更新元素扩展属性
export function updateElementExtensions(element, extensionList) { export function updateElementExtensions(element, extensionList) {
const extensions = window.bpmnInstances.moddle.create('bpmn:ExtensionElements', { const extensions = bpmnInstances().moddle.create('bpmn:ExtensionElements', {
values: extensionList values: extensionList
}) })
window.bpmnInstances.modeling.updateProperties(toRaw(element), { bpmnInstances().modeling.updateProperties(toRaw(element), {
extensionElements: extensions extensionElements: extensions
}) })
} }
// 创建一个id // 创建一个id
export function uuid(length = 8, chars) { export function uuid(length = 8, chars?) {
let result = '' let result = ''
const charsString = chars || '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' const charsString = chars || '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
for (let i = length; i > 0; --i) { for (let i = length; i > 0; --i) {

View File

@ -282,7 +282,7 @@ const filterDescriptionsSchema = (crudSchema: CrudSchema[]): DescriptionsSchema[
// 给options添加国际化 // 给options添加国际化
const filterOptions = (options: Recordable, labelField?: string) => { const filterOptions = (options: Recordable, labelField?: string) => {
return options.map((v: Recordable) => { return options?.map((v: Recordable) => {
if (labelField) { if (labelField) {
v['labelField'] = t(v.labelField) v['labelField'] = t(v.labelField)
} else { } else {

View File

@ -41,6 +41,7 @@ export const useI18n = (
const tFn: I18nGlobalTranslation = (key: string, ...arg: any[]) => { const tFn: I18nGlobalTranslation = (key: string, ...arg: any[]) => {
if (!key) return '' if (!key) return ''
if (!key.includes('.') && !namespace) return key if (!key.includes('.') && !namespace) return key
//@ts-ignore
return t(getKey(namespace, key), ...(arg as I18nTranslationRestParameters)) return t(getKey(namespace, key), ...(arg as I18nTranslationRestParameters))
} }
return { return {

View File

@ -5,6 +5,7 @@ const TIME_AGO_MESSAGE_MAP: {
'zh-CN': UseTimeAgoMessages 'zh-CN': UseTimeAgoMessages
en: UseTimeAgoMessages en: UseTimeAgoMessages
} = { } = {
// @ts-ignore
'zh-CN': { 'zh-CN': {
justNow: '刚刚', justNow: '刚刚',
past: (n) => (n.match(/\d/) ? `${n}` : n), past: (n) => (n.match(/\d/) ? `${n}` : n),
@ -17,6 +18,7 @@ const TIME_AGO_MESSAGE_MAP: {
minute: (n) => `${n} 分钟`, minute: (n) => `${n} 分钟`,
second: (n) => `${n}` second: (n) => `${n}`
}, },
// @ts-ignore
en: { en: {
justNow: 'just now', justNow: 'just now',
past: (n) => (n.match(/\d/) ? `${n} ago` : n), past: (n) => (n.match(/\d/) ? `${n} ago` : n),

View File

@ -409,7 +409,10 @@ watch(
{ {
icon: 'ep:close', icon: 'ep:close',
label: t('common.closeTab'), label: t('common.closeTab'),
disabled: !!visitedViews?.length && selectedTag?.meta.affix disabled: !!visitedViews?.length && selectedTag?.meta.affix,
command: () => {
closeSelectedTag(selectedTag!)
}
}, },
{ {
divided: true, divided: true,

View File

@ -37,3 +37,8 @@ const themeChange = (val: boolean) => {
@change="themeChange" @change="themeChange"
/> />
</template> </template>
<style lang="scss" scoped>
:deep(.el-switch__core .el-switch__inner .is-icon) {
overflow: visible;
}
</style>

View File

@ -55,7 +55,7 @@ import 'highlight.js/styles/github.css' //导入代码高亮样式 新版
import Logger from '@/utils/Logger' import Logger from '@/utils/Logger'
// 本地开发模式 全局引入 element-plus 样式,加快第一次进入速度 // 本地开发模式 全局引入 element-plus 样式,加快第一次进入速度
if (isDevMode() == true) { if (isDevMode()) {
import('element-plus/dist/index.css') import('element-plus/dist/index.css')
} }

View File

@ -58,7 +58,7 @@ export const useTagsViewStore = defineStore('tagsView', {
// 删除某个 // 删除某个
delView(view: RouteLocationNormalizedLoaded) { delView(view: RouteLocationNormalizedLoaded) {
this.delVisitedView(view) this.delVisitedView(view)
this.addCachedView() this.delCachedView()
}, },
// 删除tag // 删除tag
delVisitedView(view: RouteLocationNormalizedLoaded) { delVisitedView(view: RouteLocationNormalizedLoaded) {
@ -80,7 +80,7 @@ export const useTagsViewStore = defineStore('tagsView', {
// 删除所有缓存和tag // 删除所有缓存和tag
delAllViews() { delAllViews() {
this.delAllVisitedViews() this.delAllVisitedViews()
this.addCachedView() this.delCachedView()
}, },
// 删除所有tag // 删除所有tag
delAllVisitedViews() { delAllVisitedViews() {

View File

@ -6,6 +6,11 @@
margin-left: 2px !important; margin-left: 2px !important;
} }
// 解决抽屉弹出时body宽度变化的问题
.el-popup-parent--hidden {
width: 100% !important;
}
/* nprogress 适配 element-plus 的主题色 */ /* nprogress 适配 element-plus 的主题色 */
#nprogress { #nprogress {
& .bar { & .bar {

View File

@ -1,5 +1,7 @@
// generated by unplugin-vue-components /* eslint-disable */
// We suggest you to commit this file into source control /* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399 // Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core' import '@vue/runtime-core'
@ -50,6 +52,7 @@ declare module '@vue/runtime-core' {
ElForm: typeof import('element-plus/es')['ElForm'] ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElIcon: typeof import('element-plus/es')['ElIcon'] ElIcon: typeof import('element-plus/es')['ElIcon']
ElImage: typeof import('element-plus/es')['ElImage']
ElImageViewer: typeof import('element-plus/es')['ElImageViewer'] ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
ElInput: typeof import('element-plus/es')['ElInput'] ElInput: typeof import('element-plus/es')['ElInput']
ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
@ -71,6 +74,8 @@ declare module '@vue/runtime-core' {
ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs'] ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag'] ElTag: typeof import('element-plus/es')['ElTag']
ElTimeline: typeof import('element-plus/es')['ElTimeline']
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTransfer: typeof import('element-plus/es')['ElTransfer'] ElTransfer: typeof import('element-plus/es')['ElTransfer']
ElTree: typeof import('element-plus/es')['ElTree'] ElTree: typeof import('element-plus/es')['ElTree']

View File

@ -1,4 +1,7 @@
// Generated by 'unplugin-auto-import' /* eslint-disable */
/* prettier-ignore */
// @ts-nocheck
// Generated by unplugin-auto-import
export {} export {}
declare global { declare global {
const DICT_TYPE: typeof import('@/utils/dict')['DICT_TYPE'] const DICT_TYPE: typeof import('@/utils/dict')['DICT_TYPE']
@ -67,5 +70,5 @@ declare global {
// for type re-export // for type re-export
declare global { declare global {
// @ts-ignore // @ts-ignore
export type { Component,ComponentPublicInstance,ComputedRef,InjectionKey,PropType,Ref,VNode } from 'vue' export type { Component, ComponentPublicInstance, ComputedRef, InjectionKey, PropType, Ref, VNode } from 'vue'
} }

View File

@ -1,6 +1,6 @@
export const isDevMode = () => { export const isDevMode = () => {
const dev = import.meta.env.VITE_DEV const dev = import.meta.env.VITE_DEV
if (dev && dev === true) { if (dev && dev === 'true') {
return true return true
} else { } else {
return false return false

View File

@ -212,9 +212,11 @@ const addToChildren = (
} }
} }
const toCamelCase = (str: string, upperCaseFirst: boolean) => { const toCamelCase = (str: string, upperCaseFirst: boolean) => {
str = (str || '').toLowerCase().replace(/-(.)/g, function (group1: string) { str = (str || '')
return group1.toUpperCase() .replace(/-(.)/g, function (group1: string) {
}) return group1.toUpperCase()
})
.replaceAll('-', '')
if (upperCaseFirst && str) { if (upperCaseFirst && str) {
str = str.charAt(0).toUpperCase() + str.slice(1) str = str.charAt(0).toUpperCase() + str.slice(1)

View File

@ -17,23 +17,29 @@ const crudSchemas = reactive<VxeCrudSchema>({
title: '定义名称', title: '定义名称',
field: 'name', field: 'name',
table: { table: {
width: 120, // width: 120,
slots: { slots: {
default: 'name_default' default: 'name_default'
} }
} }
}, },
{ {
title: '流程分类', title: '定义分类',
field: 'category', field: 'category',
dictType: DICT_TYPE.BPM_MODEL_CATEGORY, // dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
dictClass: 'number' // dictClass: 'number',
table: {
// width: 120,
slots: {
default: 'category_default'
}
}
}, },
{ {
title: '表单信息', title: '表单信息',
field: 'formId', field: 'formId',
table: { table: {
width: 120, // width: 200,
slots: { slots: {
default: 'formId_default' default: 'formId_default'
} }
@ -43,7 +49,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
title: '流程版本', title: '流程版本',
field: 'version', field: 'version',
table: { table: {
width: 80, // width: 80,
slots: { slots: {
default: 'version_default' default: 'version_default'
} }
@ -53,7 +59,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
title: '激活状态', title: '激活状态',
field: 'suspensionState', field: 'suspensionState',
table: { table: {
width: 80, // width: 80,
slots: { slots: {
default: 'suspensionState_default' default: 'suspensionState_default'
} }
@ -63,10 +69,10 @@ const crudSchemas = reactive<VxeCrudSchema>({
title: '部署时间', title: '部署时间',
field: 'deploymentTime', field: 'deploymentTime',
isForm: false, isForm: false,
formatter: 'formatDate', formatter: 'formatDate'
table: { // table: {
width: 180 // width: 180
} // }
} }
] ]
}) })

View File

@ -6,6 +6,10 @@
<template #name_default="{ row }"> <template #name_default="{ row }">
<XTextButton :title="row.name" @click="handleBpmnDetail(row.id)" /> <XTextButton :title="row.name" @click="handleBpmnDetail(row.id)" />
</template> </template>
<!-- 流程分类 -->
<template #category_default="{ row }">
<DictTag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="Number(row?.category)" />
</template>
<!-- 表单信息 --> <!-- 表单信息 -->
<template #formId_default="{ row }"> <template #formId_default="{ row }">
<XTextButton <XTextButton
@ -43,6 +47,16 @@
v-if="formDetailVisible" v-if="formDetailVisible"
/> />
</XModal> </XModal>
<!-- 流程模型图的预览 -->
<XModal title="流程图" v-model="showBpmnOpen" width="80%" height="90%">
<my-process-viewer
key="designer"
v-model="bpmnXML"
:value="bpmnXML"
v-bind="bpmnControlForm"
:prefix="bpmnControlForm.prefix"
/>
</XModal>
</ContentWrap> </ContentWrap>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -51,8 +65,14 @@ import * as DefinitionApi from '@/api/bpm/definition'
// import * as ModelApi from '@/api/bpm/model' // import * as ModelApi from '@/api/bpm/model'
import { allSchemas } from './definition.data' import { allSchemas } from './definition.data'
import { setConfAndFields2 } from '@/utils/formCreate' import { setConfAndFields2 } from '@/utils/formCreate'
import { DICT_TYPE } from '@/utils/dict'
const message = useMessage() // const bpmnXML = ref(null)
const showBpmnOpen = ref(false)
const bpmnControlForm = ref({
prefix: 'flowable'
})
// const message = useMessage() //
const router = useRouter() // const router = useRouter() //
const { query } = useRoute() // const { query } = useRoute() //
@ -89,7 +109,13 @@ const handleFormDetail = async (row) => {
const handleBpmnDetail = (row) => { const handleBpmnDetail = (row) => {
// TODO // TODO
console.log(row) console.log(row)
message.success('流程组件开发中,预计 2 月底完成') DefinitionApi.getProcessDefinitionBpmnXMLApi(row).then((response) => {
console.log(response, 'response')
bpmnXML.value = response
//
showBpmnOpen.value = true
})
// message.success(' 2 ')
} }
// //
@ -97,7 +123,7 @@ const handleAssignRule = (row) => {
router.push({ router.push({
name: 'BpmTaskAssignRuleList', name: 'BpmTaskAssignRuleList',
query: { query: {
modelId: row.id processDefinitionId: row.id
} }
}) })
} }

View File

@ -3,9 +3,21 @@
<!-- 表单设计器 --> <!-- 表单设计器 -->
<fc-designer ref="designer" height="780px"> <fc-designer ref="designer" height="780px">
<template #handle> <template #handle>
<XButton type="primary" title="生成JSON" @click="showJson" />
<XButton type="primary" title="生成Options" @click="showOption" />
<XButton type="primary" :title="t('action.save')" @click="handleSave" /> <XButton type="primary" :title="t('action.save')" @click="handleSave" />
</template> </template>
</fc-designer> </fc-designer>
<Dialog :title="dialogTitle" v-model="dialogVisible1" maxHeight="600">
<div ref="editor" v-if="dialogVisible1">
<XTextButton style="float: right" :title="t('common.copy')" @click="copy(formValue)" />
<el-scrollbar height="580">
<pre>
{{ formValue }}
</pre>
</el-scrollbar>
</div>
</Dialog>
<!-- 表单保存的弹窗 --> <!-- 表单保存的弹窗 -->
<XModal v-model="dialogVisible" title="保存表单"> <XModal v-model="dialogVisible" title="保存表单">
<el-form ref="formRef" :model="formValues" :rules="formRules" label-width="80px"> <el-form ref="formRef" :model="formValues" :rules="formRules" label-width="80px">
@ -48,13 +60,18 @@ import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { CommonStatusEnum } from '@/utils/constants' import { CommonStatusEnum } from '@/utils/constants'
import * as FormApi from '@/api/bpm/form' import * as FormApi from '@/api/bpm/form'
import { encodeConf, encodeFields, setConfAndFields } from '@/utils/formCreate' import { encodeConf, encodeFields, setConfAndFields } from '@/utils/formCreate'
import { useClipboard } from '@vueuse/core'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
const { query } = useRoute() // const { query } = useRoute() //
const designer = ref() // const designer = ref() //
const type = ref(-1)
const formValue = ref('')
const dialogTitle = ref('')
const dialogVisible = ref(false) // const dialogVisible = ref(false) //
const dialogVisible1 = ref(false) //
const dialogLoading = ref(false) // const dialogLoading = ref(false) //
const formRef = ref<FormInstance>() const formRef = ref<FormInstance>()
const formRules = reactive({ const formRules = reactive({
@ -98,7 +115,32 @@ const submitForm = async () => {
dialogLoading.value = false dialogLoading.value = false
} }
} }
const showJson = () => {
openModel('生成JSON')
type.value = 0
formValue.value = designer.value.getRule()
}
const showOption = () => {
openModel('生成Options')
type.value = 1
formValue.value = designer.value.getOption()
}
const openModel = (title: string) => {
dialogVisible1.value = true
dialogTitle.value = title
}
/** 复制 **/
const copy = async (text: string) => {
const { copy, copied, isSupported } = useClipboard({ source: text })
if (!isSupported) {
message.error(t('common.copyError'))
} else {
await copy()
if (unref(copied)) {
message.success(t('common.copySuccess'))
}
}
}
// ========== ========== // ========== ==========
onMounted(() => { onMounted(() => {
// //

View File

@ -16,6 +16,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
primaryType: 'id', primaryType: 'id',
primaryTitle: '编号', primaryTitle: '编号',
action: true, action: true,
searchSpan: 8,
columns: [ columns: [
{ {
title: '组名', title: '组名',

View File

@ -43,7 +43,7 @@
</XTable> </XTable>
</ContentWrap> </ContentWrap>
<XModal v-model="dialogVisible" :title="dialogTitle"> <XModal v-model="dialogVisible" :title="dialogTitle" :mask-closable="false">
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<Form <Form
v-if="['create', 'update'].includes(actionType)" v-if="['create', 'update'].includes(actionType)"

View File

@ -24,6 +24,10 @@
<template #name_default="{ row }"> <template #name_default="{ row }">
<XTextButton :title="row.name" @click="handleBpmnDetail(row.id)" /> <XTextButton :title="row.name" @click="handleBpmnDetail(row.id)" />
</template> </template>
<!-- 流程分类 -->
<template #category_default="{ row }">
<DictTag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="Number(row?.category)" />
</template>
<!-- 表单信息 --> <!-- 表单信息 -->
<template #formId_default="{ row }"> <template #formId_default="{ row }">
<XTextButton <XTextButton
@ -429,6 +433,11 @@ const handleUpdate = async (rowId: number) => {
await setDialogTile('edit') await setDialogTile('edit')
// //
saveForm.value = await ModelApi.getModelApi(rowId) saveForm.value = await ModelApi.getModelApi(rowId)
if (saveForm.value.category == null) {
saveForm.value.category = 1
} else {
saveForm.value.category = Number(saveForm.value.category)
}
} }
// //

View File

@ -44,7 +44,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
field: 'category', field: 'category',
dictType: DICT_TYPE.BPM_MODEL_CATEGORY, dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
dictClass: 'number', dictClass: 'number',
isSearch: true isSearch: true,
table: {
slots: {
default: 'category_default'
}
}
}, },
{ {
title: '表单信息', title: '表单信息',

View File

@ -108,7 +108,7 @@ const initModeler = (item) => {
const save = (bpmnXml) => { const save = (bpmnXml) => {
const data: ModelVO = { const data: ModelVO = {
...model.value, ...(model.value ?? ({} as ModelVO)),
bpmnXml: bpmnXml // bpmnXml bpmnXml: bpmnXml // bpmnXml
} }
console.log(data, 'data') console.log(data, 'data')

View File

@ -2,6 +2,7 @@
<ContentWrap> <ContentWrap>
<!-- 详情 --> <!-- 详情 -->
<Descriptions :schema="allSchemas.detailSchema" :data="formData" /> <Descriptions :schema="allSchemas.detailSchema" :data="formData" />
<el-button @click="routerReturn" type="primary">返回</el-button>
</ContentWrap> </ContentWrap>
</template> </template>
@ -9,7 +10,8 @@
// import // import
import * as LeaveApi from '@/api/bpm/leave' import * as LeaveApi from '@/api/bpm/leave'
import { allSchemas } from '@/views/bpm/oa/leave/leave.data' import { allSchemas } from '@/views/bpm/oa/leave/leave.data'
import { useRouter } from 'vue-router'
const router = useRouter()
const { query } = useRoute() // const { query } = useRoute() //
const message = useMessage() // const message = useMessage() //
@ -22,6 +24,10 @@ const formData = ref({
reason: undefined reason: undefined
}) })
const routerReturn = () => {
router.back()
}
onMounted(() => { onMounted(() => {
id.value = query.id id.value = query.id
if (!id.value) { if (!id.value) {

View File

@ -16,6 +16,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
primaryTitle: '申请编号', primaryTitle: '申请编号',
action: true, action: true,
actionWidth: '260', actionWidth: '260',
searchSpan: 8,
columns: [ columns: [
{ {
title: t('common.status'), title: t('common.status'),

View File

@ -3,6 +3,10 @@
<!-- 第一步通过流程定义的列表选择对应的流程 --> <!-- 第一步通过流程定义的列表选择对应的流程 -->
<div v-if="!selectProcessInstance"> <div v-if="!selectProcessInstance">
<XTable @register="registerTable"> <XTable @register="registerTable">
<!-- 流程分类 -->
<template #category_default="{ row }">
<DictTag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="Number(row?.category)" />
</template>
<template #version_default="{ row }"> <template #version_default="{ row }">
<el-tag v-if="row">v{{ row.version }}</el-tag> <el-tag v-if="row">v{{ row.version }}</el-tag>
</template> </template>
@ -56,6 +60,7 @@ import * as DefinitionApi from '@/api/bpm/definition'
import * as ProcessInstanceApi from '@/api/bpm/processInstance' import * as ProcessInstanceApi from '@/api/bpm/processInstance'
import { setConfAndFields2 } from '@/utils/formCreate' import { setConfAndFields2 } from '@/utils/formCreate'
import { ApiAttrs } from '@form-create/element-ui/types/config' import { ApiAttrs } from '@form-create/element-ui/types/config'
import { DICT_TYPE } from '@/utils/dict'
const router = useRouter() // const router = useRouter() //
const message = useMessage() // const message = useMessage() //

View File

@ -201,13 +201,13 @@ import * as ActivityApi from '@/api/bpm/activity'
import { formatPast2 } from '@/utils/formatTime' import { formatPast2 } from '@/utils/formatTime'
import { setConfAndFields2 } from '@/utils/formCreate' import { setConfAndFields2 } from '@/utils/formCreate'
// import { OptionAttrs } from '@form-create/element-ui/types/config' // import { OptionAttrs } from '@form-create/element-ui/types/config'
import { ApiAttrs } from '@form-create/element-ui/types/config' import type { ApiAttrs } from '@form-create/element-ui/types/config'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
const { query } = useRoute() // const { query } = useRoute() //
const message = useMessage() // const message = useMessage() //
const { t } = useI18n() // const { t } = useI18n() //
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance() as any
// ========== ========== // ========== ==========
const id = query.id as unknown as number const id = query.id as unknown as number
@ -404,9 +404,9 @@ const getDetail = () => {
data.formVariables data.formVariables
) )
nextTick().then(() => { nextTick().then(() => {
fApi.value?.fapi.btn.show(false) fApi.value?.fapi?.btn.show(false)
fApi.value?.fapi.resetBtn.show(false) fApi.value?.fapi?.resetBtn.show(false)
fApi.value?.fapi.disabled(true) fApi.value?.fapi?.disabled(true)
}) })
} }

View File

@ -7,11 +7,15 @@
<XButton <XButton
type="primary" type="primary"
preIcon="ep:zoom-in" preIcon="ep:zoom-in"
title="新建流程" title="发起流程"
v-hasPermi="['bpm:process-instance:query']" v-hasPermi="['bpm:process-instance:query']"
@click="handleCreate" @click="handleCreate"
/> />
</template> </template>
<!-- 流程分类 -->
<template #category_default="{ row }">
<DictTag :type="DICT_TYPE.BPM_MODEL_CATEGORY" :value="Number(row?.category)" />
</template>
<!-- 当前审批任务 --> <!-- 当前审批任务 -->
<template #tasks_default="{ row }"> <template #tasks_default="{ row }">
<el-button v-for="task in row.tasks" :key="task.id" link> <el-button v-for="task in row.tasks" :key="task.id" link>
@ -40,6 +44,7 @@
<script setup lang="ts"> <script setup lang="ts">
// import // import
import { ElMessageBox } from 'element-plus' import { ElMessageBox } from 'element-plus'
import { DICT_TYPE } from '@/utils/dict'
// import // import
import * as ProcessInstanceApi from '@/api/bpm/processInstance' import * as ProcessInstanceApi from '@/api/bpm/processInstance'

View File

@ -14,7 +14,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
title: '流程分类', title: '流程分类',
field: 'category', field: 'category',
dictType: DICT_TYPE.BPM_MODEL_CATEGORY, dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
dictClass: 'number' dictClass: 'number',
table: {
slots: {
default: 'category_default'
}
}
}, },
{ {
title: '流程版本', title: '流程版本',

View File

@ -33,7 +33,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
field: 'category', field: 'category',
dictType: DICT_TYPE.BPM_MODEL_CATEGORY, dictType: DICT_TYPE.BPM_MODEL_CATEGORY,
dictClass: 'number', dictClass: 'number',
isSearch: true isSearch: true,
table: {
slots: {
default: 'category_default'
}
}
}, },
{ {
title: '当前审批任务', title: '当前审批任务',

View File

@ -21,6 +21,7 @@ const { push } = useRouter() // 路由
const [registerTable] = useXTable({ const [registerTable] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
topActionSlots: false,
getListApi: TaskApi.getDoneTaskPage getListApi: TaskApi.getDoneTaskPage
}) })

View File

@ -22,6 +22,7 @@ const { push } = useRouter() // 路由
const [registerTable] = useXTable({ const [registerTable] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
topActionSlots: false,
getListApi: TaskApi.getTodoTaskPage getListApi: TaskApi.getTodoTaskPage
}) })

View File

@ -7,6 +7,7 @@ const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id', primaryKey: 'id',
primaryType: null, primaryType: null,
action: true, action: true,
searchSpan: 8,
columns: [ columns: [
{ {
title: '任务编号', title: '任务编号',

View File

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 列表 --> <!-- 列表 -->
<XTable @register="registerTable"> <XTable @register="registerTable" ref="xGrid">
<template #options_default="{ row }"> <template #options_default="{ row }">
<span :key="option" v-for="option in row.options"> <span :key="option" v-for="option in row.options">
<el-tag> <el-tag>
@ -45,9 +45,9 @@
<el-select v-model="formData.roleIds" multiple clearable style="width: 100%"> <el-select v-model="formData.roleIds" multiple clearable style="width: 100%">
<el-option <el-option
v-for="item in roleOptions" v-for="item in roleOptions"
:key="parseInt(item.id)" :key="item.id"
:label="item.name" :label="item.name"
:value="parseInt(item.id)" :value="item.id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -145,11 +145,12 @@ import { listSimpleUserGroupsApi } from '@/api/bpm/userGroup'
import { listSimpleDeptApi } from '@/api/system/dept' import { listSimpleDeptApi } from '@/api/system/dept'
import { DICT_TYPE, getDictOptions } from '@/utils/dict' import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import { handleTree, defaultProps } from '@/utils/tree' import { handleTree, defaultProps } from '@/utils/tree'
import { allSchemas, rules } from './taskAssignRule.data' import { allSchemas, rules, idShowActionClick } from './taskAssignRule.data'
const { t } = useI18n() // const { t } = useI18n() //
const message = useMessage() // const message = useMessage() //
const { query } = useRoute() const { query } = useRoute()
const xGrid = ref()
// ========== ========== // ========== ==========
@ -165,6 +166,8 @@ const taskAssignScriptDictDatas = getDictOptions(DICT_TYPE.BPM_TASK_ASSIGN_SCRIP
const modelId = query.modelId const modelId = query.modelId
// processDefinitionId // processDefinitionId
const processDefinitionId = query.processDefinitionId const processDefinitionId = query.processDefinitionId
let isShow = idShowActionClick(modelId)
// //
const queryParams = reactive({ const queryParams = reactive({
modelId: modelId, modelId: modelId,
@ -346,5 +349,10 @@ onMounted(() => {
listSimpleUserGroupsApi().then((data) => { listSimpleUserGroupsApi().then((data) => {
userGroupOptions.value.push(...data) userGroupOptions.value.push(...data)
}) })
if (!isShow) {
setTimeout(() => {
xGrid.value.Ref.hideColumn('actionbtns')
}, 100)
}
}) })
</script> </script>

View File

@ -43,4 +43,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
} }
] ]
}) })
export const idShowActionClick = (modelId?: any) => {
if (modelId) {
return true
} else {
return false
}
}
export const { allSchemas } = useVxeCrudSchemas(crudSchemas) export const { allSchemas } = useVxeCrudSchemas(crudSchemas)

View File

@ -3,7 +3,7 @@
<IFrame :src="src" /> <IFrame :src="src" />
</ContentWrap> </ContentWrap>
</template> </template>
<script setup lang="ts" name="Server"> <script setup lang="ts" name="AdminServer">
const BASE_URL = import.meta.env.VITE_BASE_URL const BASE_URL = import.meta.env.VITE_BASE_URL
const src = ref(BASE_URL + '/admin/applications') const src = ref(BASE_URL + '/admin/applications')
</script> </script>

View File

@ -3,7 +3,7 @@
<IFrame :src="src" /> <IFrame :src="src" />
</ContentWrap> </ContentWrap>
</template> </template>
<script setup lang="ts" name="Jmreport"> <script setup lang="ts" name="JimuReport">
import { getAccessToken } from '@/utils/auth' import { getAccessToken } from '@/utils/auth'
const BASE_URL = import.meta.env.VITE_BASE_URL const BASE_URL = import.meta.env.VITE_BASE_URL

View File

@ -6,7 +6,15 @@ const { t } = useI18n() // 国际化
export const rules = reactive({ export const rules = reactive({
name: [required], name: [required],
sort: [required], sort: [required],
email: [required], // email: [required],
email: [
{ required: true, message: t('profile.rules.mail'), trigger: 'blur' },
{
type: 'email',
message: t('profile.rules.truemail'),
trigger: ['blur', 'change']
}
],
phone: [ phone: [
{ {
len: 11, len: 11,

View File

@ -179,6 +179,7 @@ const tableTypeSelect = ref(false)
const cellClickEvent: VxeTableEvents.CellClick = async ({ row }) => { const cellClickEvent: VxeTableEvents.CellClick = async ({ row }) => {
tableTypeSelect.value = true tableTypeSelect.value = true
queryParams.dictType = row['type'] queryParams.dictType = row['type']
await nextTick()
await dataGetList() await dataGetList()
parentType.value = row['type'] parentType.value = row['type']
} }
@ -197,6 +198,11 @@ const setDialogTile = (type: string) => {
dialogVisible.value = true dialogVisible.value = true
} }
// dictTypeValueform
watch(dictTypeValue, (val) => {
unref(typeFormRef)?.setValues({ type: val })
})
// //
const submitTypeForm = async () => { const submitTypeForm = async () => {
const elForm = unref(typeFormRef)?.getElFormRef() const elForm = unref(typeFormRef)?.getElFormRef()

View File

@ -1,8 +1,18 @@
import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas' import type { VxeCrudSchema } from '@/hooks/web/useVxeCrudSchemas'
const { t } = useI18n() // 国际化
// 表单校验 // 表单校验
export const rules = reactive({ export const rules = reactive({
mail: [required], // mail: [required],
mail: [
{ required: true, message: t('profile.rules.mail'), trigger: 'blur' },
{
type: 'email',
message: t('profile.rules.truemail'),
trigger: ['blur', 'change']
}
],
username: [required], username: [required],
password: [required], password: [required],
host: [required], host: [required],

View File

@ -59,6 +59,7 @@ const queryParams = reactive({
}) })
const [registerTable] = useXTable({ const [registerTable] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
topActionSlots: false,
params: queryParams, params: queryParams,
getListApi: MailLogApi.getMailLogPageApi getListApi: MailLogApi.getMailLogPageApi
}) })

View File

@ -37,6 +37,7 @@ const { t } = useI18n() // 国际化
// //
const [registerTable] = useXTable({ const [registerTable] = useXTable({
allSchemas: allSchemas, allSchemas: allSchemas,
topActionSlots: false,
getListApi: NotifyMessageApi.getNotifyMessagePageApi getListApi: NotifyMessageApi.getNotifyMessagePageApi
}) })

View File

@ -35,7 +35,7 @@ const [registerTable, { reload, getCheckboxRecords }] = useXTable({
}) })
const handleUpdateList = async () => { const handleUpdateList = async () => {
const list = getCheckboxRecords() const list = getCheckboxRecords() as any as any[]
if (list.length === 0) { if (list.length === 0) {
return return
} }

View File

@ -61,7 +61,7 @@ const openModal = async (type: string, id?: number) => {
} }
modelLoading.value = false modelLoading.value = false
} }
defineExpose({ openModal: openModal }) // openModal defineExpose({ openModal }) // openModal
// / // /
const emit = defineEmits(['success']) // success const emit = defineEmits(['success']) // success
@ -70,9 +70,7 @@ const submitForm = async () => {
const elForm = unref(formRef)?.getElFormRef() const elForm = unref(formRef)?.getElFormRef()
if (!elForm) return if (!elForm) return
const valid = await elForm.validate() const valid = await elForm.validate()
if (!valid) { if (!valid) return
return
}
// //
actionLoading.value = true actionLoading.value = true
try { try {

View File

@ -46,7 +46,6 @@
</template> </template>
</XTable> </XTable>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改/详情 --> <!-- 表单弹窗添加/修改/详情 -->
<PostForm ref="modalRef" @success="reload()" /> <PostForm ref="modalRef" @success="reload()" />
</template> </template>

View File

@ -99,37 +99,46 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<!-- 分配角色的菜单权限对话框 --> <!-- 分配角色的菜单权限对话框 -->
<el-form-item <el-row>
label="权限范围" <el-col :span="24">
v-if=" <el-form-item
actionScopeType === 'menu' || dataScopeForm.dataScope === SystemDataScopeEnum.DEPT_CUSTOM label="权限范围"
" v-if="
> actionScopeType === 'menu' ||
<el-card shadow="never"> dataScopeForm.dataScope === SystemDataScopeEnum.DEPT_CUSTOM
<template #header> "
父子联动(选中父节点自动选择子节点): style="display: flex"
<el-switch v-model="checkStrictly" inline-prompt active-text="" inactive-text="" /> >
全选/全不选: <el-card class="card" shadow="never">
<el-switch <template #header>
v-model="treeNodeAll" 父子联动(选中父节点自动选择子节点):
inline-prompt <el-switch
active-text="是" v-model="checkStrictly"
inactive-text="否" inline-prompt
@change="handleCheckedTreeNodeAll()" active-text="是"
/> inactive-text="否"
</template> />
<el-tree 全选/全不选:
ref="treeRef" <el-switch
node-key="id" v-model="treeNodeAll"
show-checkbox inline-prompt
:default-checked-keys="defaultCheckedKeys" active-text="是"
:check-strictly="!checkStrictly" inactive-text="否"
:props="defaultProps" @change="handleCheckedTreeNodeAll()"
:data="treeOptions" />
empty-text="加载中,请稍后" </template>
/> <el-tree
</el-card> ref="treeRef"
</el-form-item> node-key="id"
show-checkbox
:check-strictly="!checkStrictly"
:props="defaultProps"
:data="treeOptions"
empty-text="加载中,请稍后"
/>
</el-card>
</el-form-item> </el-col
></el-row>
</el-form> </el-form>
<!-- 操作按钮 --> <!-- 操作按钮 -->
<template #footer> <template #footer>
@ -245,7 +254,6 @@ const dialogScopeVisible = ref(false)
const dialogScopeTitle = ref('数据权限') const dialogScopeTitle = ref('数据权限')
const actionScopeType = ref('') const actionScopeType = ref('')
const dataScopeDictDatas = ref() const dataScopeDictDatas = ref()
const defaultCheckedKeys = ref()
// //
const checkStrictly = ref(true) const checkStrictly = ref(true)
const treeNodeAll = ref(false) const treeNodeAll = ref(false)
@ -258,13 +266,16 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
dataScopeForm.id = row.id dataScopeForm.id = row.id
dataScopeForm.name = row.name dataScopeForm.name = row.name
dataScopeForm.code = row.code dataScopeForm.code = row.code
actionScopeType.value = type
dialogScopeVisible.value = true
if (type === 'menu') { if (type === 'menu') {
const menuRes = await listSimpleMenusApi() const menuRes = await listSimpleMenusApi()
treeOptions.value = handleTree(menuRes) treeOptions.value = handleTree(menuRes)
const role = await PermissionApi.listRoleMenusApi(row.id) const role = await PermissionApi.listRoleMenusApi(row.id)
if (role) { if (role) {
// treeRef.value!.setCheckedKeys(role as unknown as Array<number>) role?.forEach((item: any) => {
defaultCheckedKeys.value = role unref(treeRef)?.setChecked(item, true, false)
})
} }
} else if (type === 'data') { } else if (type === 'data') {
const deptRes = await listSimpleDeptApi() const deptRes = await listSimpleDeptApi()
@ -272,12 +283,11 @@ const handleScope = async (type: string, row: RoleApi.RoleVO) => {
const role = await RoleApi.getRoleApi(row.id) const role = await RoleApi.getRoleApi(row.id)
dataScopeForm.dataScope = role.dataScope dataScopeForm.dataScope = role.dataScope
if (role.dataScopeDeptIds) { if (role.dataScopeDeptIds) {
// treeRef.value!.setCheckedKeys(role.dataScopeDeptIds as unknown as Array<number>, false) role.dataScopeDeptIds?.forEach((item: any) => {
defaultCheckedKeys.value = role.dataScopeDeptIds unref(treeRef)?.setChecked(item, true, false)
})
} }
} }
actionScopeType.value = type
dialogScopeVisible.value = true
} }
// //
const submitScope = async () => { const submitScope = async () => {
@ -312,3 +322,10 @@ onMounted(() => {
init() init()
}) })
</script> </script>
<style scoped>
.card {
width: 100%;
max-height: 400px;
overflow-y: scroll;
}
</style>

View File

@ -9,12 +9,19 @@ export const rules = reactive({
}) })
// CrudSchema // CrudSchema
const crudSchemas = reactive<VxeCrudSchema>({ const crudSchemas = reactive<VxeCrudSchema>({
primaryKey: 'id', // primaryKey: 'id',
primaryTitle: '角色编号', // primaryTitle: '角色编号',
primaryType: 'seq', // primaryType: 'seq',
action: true, action: true,
actionWidth: '400px', actionWidth: '400px',
columns: [ columns: [
{
title: '角色编号',
field: 'id',
table: {
width: 200
}
},
{ {
title: '角色名称', title: '角色名称',
field: 'name', field: 'name',

View File

@ -27,6 +27,24 @@ export const rules = reactive({
contactMobile: [required], contactMobile: [required],
accountCount: [required], accountCount: [required],
expireTime: [required], expireTime: [required],
username: [
required,
{
min: 4,
max: 30,
trigger: 'blur',
message: '用户名称长度为 4-30 个字符'
}
],
password: [
required,
{
min: 4,
max: 16,
trigger: 'blur',
message: '密码长度为 4-16 位'
}
],
domain: [required], domain: [required],
status: [required] status: [required]
}) })

View File

@ -25,7 +25,7 @@
ref="formRef" ref="formRef"
> >
<template #menuIds> <template #menuIds>
<el-card class="w-120"> <el-card>
<template #header> <template #header>
<div class="card-header"> <div class="card-header">
全选/全不选: 全选/全不选:
@ -91,6 +91,16 @@ const dialogTitle = ref('edit') // 弹出层标题
const handleCheckedTreeNodeAll = () => { const handleCheckedTreeNodeAll = () => {
treeRef.value!.setCheckedNodes(treeNodeAll.value ? menuOptions.value : []) treeRef.value!.setCheckedNodes(treeNodeAll.value ? menuOptions.value : [])
} }
const validateCategory = (rule: any, value: any, callback: any) => {
if (!treeRef.value!.getCheckedKeys().length) {
callback(new Error('该项为必填项'))
} else {
callback()
}
}
rules.menuIds = [{ required: true, validator: validateCategory, trigger: 'blur' }]
const getTree = async () => { const getTree = async () => {
const res = await listSimpleMenusApi() const res = await listSimpleMenusApi()
menuOptions.value = handleTree(res) menuOptions.value = handleTree(res)
@ -125,7 +135,9 @@ const handleUpdate = async (rowId: number) => {
const res = await TenantPackageApi.getTenantPackageApi(rowId) const res = await TenantPackageApi.getTenantPackageApi(rowId)
unref(formRef)?.setValues(res) unref(formRef)?.setValues(res)
// //
unref(treeRef)?.setCheckedKeys(res.menuIds) res.menuIds?.forEach((item: any) => {
unref(treeRef)?.setChecked(item, true, false)
})
} }
// //
@ -166,3 +178,10 @@ onMounted(async () => {
}) })
// getList() // getList()
</script> </script>
<style scoped>
.el-card {
width: 100%;
max-height: 400px;
overflow-y: scroll;
}
</style>

View File

@ -33,7 +33,12 @@ const crudSchemas = reactive<VxeCrudSchema>({
{ {
title: '菜单权限', title: '菜单权限',
field: 'menuIds', field: 'menuIds',
isTable: false isTable: false,
form: {
colProps: {
span: 24
}
}
}, },
{ {
title: t('form.remark'), title: t('form.remark'),

View File

@ -159,7 +159,7 @@
:data="detailData" :data="detailData"
> >
<template #deptId="{ row }"> <template #deptId="{ row }">
<span>{{ row.dept?.name }}</span> <el-tag>{{ dataFormater(row.deptId) }}</el-tag>
</template> </template>
<template #postIds="{ row }"> <template #postIds="{ row }">
<template v-if="row.postIds !== ''"> <template v-if="row.postIds !== ''">
@ -332,6 +332,28 @@ const getPostOptions = async () => {
const res = await listSimplePostsApi() const res = await listSimplePostsApi()
postOptions.value.push(...res) postOptions.value.push(...res)
} }
const dataFormater = (val) => {
return deptFormater(deptOptions.value, val)
}
//
const deptFormater = (ary, val: any) => {
var o = ''
if (ary && val) {
for (const v of ary) {
if (v.id == val) {
o = v.name
if (o) return o
} else if (v.children?.length) {
o = deptFormater(v.children, val)
if (o) return o
}
}
return o
} else {
return val
}
}
// //
const setDialogTile = async (type: string) => { const setDialogTile = async (type: string) => {
dialogTitle.value = t('action.' + type) dialogTitle.value = t('action.' + type)
@ -386,24 +408,31 @@ const handleDetail = async (rowId: number) => {
// //
const submitForm = async () => { const submitForm = async () => {
loading.value = true const elForm = unref(formRef)?.getElFormRef()
// if (!elForm) return
try { elForm.validate(async (valid) => {
const data = unref(formRef)?.formModel as UserApi.UserVO if (valid) {
if (actionType.value === 'create') { //
await UserApi.createUserApi(data) try {
message.success(t('common.createSuccess')) const data = unref(formRef)?.formModel as UserApi.UserVO
} else { if (actionType.value === 'create') {
await UserApi.updateUserApi(data) loading.value = true
message.success(t('common.updateSuccess')) await UserApi.createUserApi(data)
message.success(t('common.createSuccess'))
} else {
loading.value = true
await UserApi.updateUserApi(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
} finally {
// unref(formRef)?.setSchema(allSchemas.formSchema)
//
await reload()
loading.value = false
}
} }
dialogVisible.value = false })
} finally {
// unref(formRef)?.setSchema(allSchemas.formSchema)
//
await reload()
loading.value = false
}
} }
// //
const handleStatusChange = async (row: UserApi.UserVO) => { const handleStatusChange = async (row: UserApi.UserVO) => {

View File

@ -5,10 +5,20 @@ const { t } = useI18n()
export const rules = reactive({ export const rules = reactive({
username: [required], username: [required],
nickname: [required], nickname: [required],
email: [required], password: [required],
deptId: [required],
email: [
{ required: true, message: t('profile.rules.mail'), trigger: 'blur' },
{
type: 'email',
message: t('profile.rules.truemail'),
trigger: ['blur', 'change']
}
],
status: [required], status: [required],
mobile: [ mobile: [
{ {
required: true,
len: 11, len: 11,
trigger: 'blur', trigger: 'blur',
message: '请输入正确的手机号码' message: '请输入正确的手机号码'

2
types/env.d.ts vendored
View File

@ -11,7 +11,7 @@ interface ImportMetaEnv {
readonly VITE_APP_TITLE: string readonly VITE_APP_TITLE: string
readonly VITE_PORT: number readonly VITE_PORT: number
readonly VITE_OPEN: string readonly VITE_OPEN: string
readonly VITE_DEV: boolean readonly VITE_DEV: string
readonly VITE_APP_CAPTCHA_ENABLE: string readonly VITE_APP_CAPTCHA_ENABLE: string
readonly VITE_APP_TENANT_ENABLE: string readonly VITE_APP_TENANT_ENABLE: string
readonly VITE_BASE_URL: string readonly VITE_BASE_URL: string

1
types/global.d.ts vendored
View File

@ -1,4 +1,3 @@
import type { CSSProperties } from 'vue'
declare global { declare global {
declare interface Fn<T = any> { declare interface Fn<T = any> {
(...arg: T[]): T (...arg: T[]): T