|
|
@@ -5,7 +5,10 @@
|
|
|
<workflowChart :ID="ID" :data="state.workflowData" ref="ref_workflow" />
|
|
|
<div class="absolute top-4 left-4 flex items-center gap-4">
|
|
|
<CzrButton type="primary" title="保存" @click="onSave" />
|
|
|
- <div class="flex items-center text-[var(--czr-error-color)]">
|
|
|
+ <div
|
|
|
+ class="flex items-center text-[var(--czr-error-color)]"
|
|
|
+ v-if="state.isEdit"
|
|
|
+ >
|
|
|
<SvgIcon name="czr_tip" color="var(--czr-error-color)" class="mr-1" />
|
|
|
有未保存的修改
|
|
|
</div>
|
|
|
@@ -32,11 +35,12 @@ import {
|
|
|
import workflowChart from './chart/index.vue'
|
|
|
import workflowPanel from './chart/panel-index.vue'
|
|
|
import { getTeleport } from '@antv/x6-vue-shape'
|
|
|
-import { useAppStore, useDictionaryStore, useProcessStore } from '@/stores'
|
|
|
+import { useAppStore, useDialogStore, useProcessStore } from '@/stores'
|
|
|
import { debounce } from 'lodash'
|
|
|
-import { ElLoading } from 'element-plus'
|
|
|
+import { ElLoading, ElMessage } from 'element-plus'
|
|
|
+import { appApiKeysAdd, appApiKeysEdit } from '@/api/modules/app'
|
|
|
|
|
|
-const DictionaryStore = useDictionaryStore()
|
|
|
+const DialogStore = useDialogStore()
|
|
|
const AppStore = useAppStore()
|
|
|
const TeleportContainer = getTeleport()
|
|
|
const ProcessStore = useProcessStore()
|
|
|
@@ -47,16 +51,13 @@ const props = defineProps({
|
|
|
const { proxy }: any = getCurrentInstance()
|
|
|
const state: any = reactive({
|
|
|
workflowData: null,
|
|
|
+ isEdit: false,
|
|
|
})
|
|
|
const ref_workflow = ref()
|
|
|
-
|
|
|
-const autoSave = debounce(() => {
|
|
|
- onSave()
|
|
|
-}, 5000)
|
|
|
watch(
|
|
|
() => ProcessStore.autoSaveFlag,
|
|
|
() => {
|
|
|
- autoSave()
|
|
|
+ state.isEdit = true
|
|
|
},
|
|
|
)
|
|
|
const onSave = () => {
|
|
|
@@ -91,11 +92,22 @@ const onSave = () => {
|
|
|
res.graph.nodes.push(node)
|
|
|
}
|
|
|
})
|
|
|
+ const isValid = res.graph.nodes.every((v) => v.data.valid)
|
|
|
+ if (!isValid) {
|
|
|
+ DialogStore.confirm({
|
|
|
+ props: {
|
|
|
+ showCancel: false,
|
|
|
+ },
|
|
|
+ content: `检测到未校验成功的节点,请重新检查节点配置!`,
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
const loading = ElLoading.service({
|
|
|
text: '保存中……',
|
|
|
background: 'rgba(0, 0,0, 0.3)',
|
|
|
})
|
|
|
console.log(res)
|
|
|
+ state.isEdit = false
|
|
|
loading.close()
|
|
|
}
|
|
|
const initData = () => {
|
|
|
@@ -107,91 +119,101 @@ const initData = () => {
|
|
|
graph: {
|
|
|
nodes: [
|
|
|
{
|
|
|
- id: '56ad6c45-c8b5-4add-b39a-48ecf4c11b3d',
|
|
|
+ id: '40fc7fd8-9adc-4446-a1bb-a0e8546cbdce',
|
|
|
type: 'start',
|
|
|
position: {
|
|
|
x: 23,
|
|
|
y: 35,
|
|
|
},
|
|
|
data: {
|
|
|
- id: '56ad6c45-c8b5-4add-b39a-48ecf4c11b3d',
|
|
|
+ id: '40fc7fd8-9adc-4446-a1bb-a0e8546cbdce',
|
|
|
title: '发起',
|
|
|
edgeSource: null,
|
|
|
- edgeTarget: ['c9102b83-cda6-495f-b8c0-4d3a85fa26db'],
|
|
|
+ edgeTarget: ['3f1ebbdd-ba81-47e5-9e28-47106774cabb'],
|
|
|
+ valid: true,
|
|
|
type: 'start',
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
- id: 'cbec7e8f-c094-440a-bbc5-714c032196eb',
|
|
|
+ id: '937362a7-7122-4b1a-a7b2-02c9a1a155fd',
|
|
|
type: 'end',
|
|
|
position: {
|
|
|
x: 23,
|
|
|
y: 477,
|
|
|
},
|
|
|
data: {
|
|
|
- id: 'cbec7e8f-c094-440a-bbc5-714c032196eb',
|
|
|
+ id: '937362a7-7122-4b1a-a7b2-02c9a1a155fd',
|
|
|
title: '结束',
|
|
|
- edgeSource: ['3f2a36d7-94f6-404c-bcc1-c3392d0ee626'],
|
|
|
+ edgeSource: ['0bf28835-8eb2-4596-bab4-ec5bb2314390'],
|
|
|
edgeTarget: null,
|
|
|
+ valid: true,
|
|
|
type: 'end',
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
- id: '3f2a36d7-94f6-404c-bcc1-c3392d0ee626',
|
|
|
+ id: '3f1ebbdd-ba81-47e5-9e28-47106774cabb',
|
|
|
type: 'approval',
|
|
|
position: {
|
|
|
- x: 260,
|
|
|
- y: 350,
|
|
|
+ x: -200,
|
|
|
+ y: 234,
|
|
|
},
|
|
|
data: {
|
|
|
- id: '3f2a36d7-94f6-404c-bcc1-c3392d0ee626',
|
|
|
+ id: '3f1ebbdd-ba81-47e5-9e28-47106774cabb',
|
|
|
title: '审批节点',
|
|
|
- edgeSource: ['c9102b83-cda6-495f-b8c0-4d3a85fa26db'],
|
|
|
- edgeTarget: ['cbec7e8f-c094-440a-bbc5-714c032196eb'],
|
|
|
+ edgeSource: ['40fc7fd8-9adc-4446-a1bb-a0e8546cbdce'],
|
|
|
+ edgeTarget: ['0bf28835-8eb2-4596-bab4-ec5bb2314390'],
|
|
|
+ valid: true,
|
|
|
type: 'approval',
|
|
|
+ name: '55555',
|
|
|
+ linkAccount: 'role',
|
|
|
+ roles: ['1968135147337920512'],
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
- id: 'c9102b83-cda6-495f-b8c0-4d3a85fa26db',
|
|
|
+ id: '0bf28835-8eb2-4596-bab4-ec5bb2314390',
|
|
|
type: 'approval',
|
|
|
position: {
|
|
|
- x: -240,
|
|
|
- y: 210,
|
|
|
+ x: 170,
|
|
|
+ y: 270,
|
|
|
},
|
|
|
data: {
|
|
|
- id: 'c9102b83-cda6-495f-b8c0-4d3a85fa26db',
|
|
|
+ id: '0bf28835-8eb2-4596-bab4-ec5bb2314390',
|
|
|
title: '审批节点',
|
|
|
- edgeSource: ['56ad6c45-c8b5-4add-b39a-48ecf4c11b3d'],
|
|
|
- edgeTarget: ['3f2a36d7-94f6-404c-bcc1-c3392d0ee626'],
|
|
|
+ edgeSource: ['3f1ebbdd-ba81-47e5-9e28-47106774cabb'],
|
|
|
+ edgeTarget: ['937362a7-7122-4b1a-a7b2-02c9a1a155fd'],
|
|
|
+ valid: true,
|
|
|
type: 'approval',
|
|
|
+ name: 'kkfkkfkk',
|
|
|
+ linkAccount: 'account',
|
|
|
+ accounts: ['0', '1950731839749042176', '1977563023736336384'],
|
|
|
},
|
|
|
},
|
|
|
],
|
|
|
edges: [
|
|
|
{
|
|
|
- id: '4baed89d-c158-4359-85f4-3bd12519e4b0',
|
|
|
- target: 'cbec7e8f-c094-440a-bbc5-714c032196eb',
|
|
|
- source: '3f2a36d7-94f6-404c-bcc1-c3392d0ee626',
|
|
|
+ id: 'ab1c1778-94d8-450c-b823-dd169a434fd2',
|
|
|
+ target: '3f1ebbdd-ba81-47e5-9e28-47106774cabb',
|
|
|
+ source: '40fc7fd8-9adc-4446-a1bb-a0e8546cbdce',
|
|
|
},
|
|
|
{
|
|
|
- id: '931f583d-4cd0-4e2e-ae9b-06e780f07fa7',
|
|
|
- target: 'c9102b83-cda6-495f-b8c0-4d3a85fa26db',
|
|
|
- source: '56ad6c45-c8b5-4add-b39a-48ecf4c11b3d',
|
|
|
+ id: 'c766ffc2-fc71-4739-ba87-054fa164adcf',
|
|
|
+ target: '0bf28835-8eb2-4596-bab4-ec5bb2314390',
|
|
|
+ source: '3f1ebbdd-ba81-47e5-9e28-47106774cabb',
|
|
|
},
|
|
|
{
|
|
|
- id: 'e1c401eb-a538-46f8-ac45-6c6deaf90338',
|
|
|
- target: '3f2a36d7-94f6-404c-bcc1-c3392d0ee626',
|
|
|
- source: 'c9102b83-cda6-495f-b8c0-4d3a85fa26db',
|
|
|
+ id: '09fef45f-f143-48a8-993f-6592ec313598',
|
|
|
+ target: '937362a7-7122-4b1a-a7b2-02c9a1a155fd',
|
|
|
+ source: '0bf28835-8eb2-4596-bab4-ec5bb2314390',
|
|
|
},
|
|
|
],
|
|
|
viewport: {
|
|
|
zoom: 1,
|
|
|
- x: 616,
|
|
|
- y: 86,
|
|
|
+ x: 423,
|
|
|
+ y: 129,
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
- if (data.graph.viewport) {
|
|
|
+ if (data?.graph?.viewport) {
|
|
|
state.workflowData = {
|
|
|
viewport: data.graph.viewport,
|
|
|
nodes: formatNodes(data.graph.nodes),
|