From f27b19b34b6a8751fabcedebc4c1d51b51ba6825 Mon Sep 17 00:00:00 2001 From: gssong <1742057357@qq.com> Date: Sun, 4 Aug 2024 13:48:17 +0800 Subject: [PATCH 01/88] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0warm-flow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/workflow/definition/index.ts | 114 ++++++++++++++++++ .../types.ts | 16 ++- src/api/workflow/processDefinition/index.ts | 114 ------------------ src/api/workflow/processInstance/index.ts | 2 +- src/api/workflow/task/types.ts | 41 +++---- src/api/workflow/workflowCommon/index.ts | 57 +++++---- src/api/workflow/workflowCommon/types.ts | 2 +- .../workflow/processDefinition/index.vue | 34 +++--- src/views/workflow/processInstance/index.vue | 2 +- src/views/workflow/task/taskWaiting.vue | 14 +-- 10 files changed, 196 insertions(+), 200 deletions(-) create mode 100644 src/api/workflow/definition/index.ts rename src/api/workflow/{processDefinition => definition}/types.ts (57%) delete mode 100644 src/api/workflow/processDefinition/index.ts diff --git a/src/api/workflow/definition/index.ts b/src/api/workflow/definition/index.ts new file mode 100644 index 0000000..9f8fb3a --- /dev/null +++ b/src/api/workflow/definition/index.ts @@ -0,0 +1,114 @@ +import request from '@/utils/request'; +import { definitionQuery, definitionVO, definitionXmlVO } from '@/api/workflow/definition/types'; +import { AxiosPromise } from 'axios'; + +/** + * 获取流程定义列表 + * @param query 流程实例id + * @returns + */ +export const listDefinition = (query: definitionQuery): AxiosPromise => { + return request({ + url: `/workflow/definition/list`, + method: 'get', + params: query + }); +}; +/** + * 按照流程定义key获取流程定义 + * @param processInstanceId 流程实例id + * @returns + */ +export const getListByKey = (key: string) => { + return request({ + url: `/workflow/definition/getListByKey/${key}`, + method: 'get' + }); +}; + +/** + * 通过流程定义id获取流程图 + */ +export const definitionImage = (definitionId: string): AxiosPromise => { + return request({ + url: `/workflow/definition/definitionImage/${definitionId}` + '?t' + Math.random(), + method: 'get' + }); +}; + +/** + * 通过流程定义id获取xml + * @param definitionId 流程定义id + * @returns + */ +export const definitionXml = (definitionId: string): AxiosPromise => { + return request({ + url: `/workflow/definition/definitionXml/${definitionId}`, + method: 'get' + }); +}; + +/** + * 删除流程定义 + * @param deploymentId 部署id + * @param definitionId 流程定义id + * @returns + */ +export const deleteDefinition = (deploymentId: string | string[], definitionId: string | string[]) => { + return request({ + url: `/workflow/definition/${deploymentId}/${definitionId}`, + method: 'delete' + }); +}; + +/** + * 挂起/激活 + * @param definitionId 流程定义id + * @returns + */ +export const updateDefinitionState = (definitionId: string) => { + return request({ + url: `/workflow/definition/updateDefinitionState/${definitionId}`, + method: 'put' + }); +}; + +/** + * 流程定义转换为模型 + * @param definitionId 流程定义id + * @returns + */ +export const convertToModel = (definitionId: string) => { + return request({ + url: `/workflow/definition/convertToModel/${definitionId}`, + method: 'put' + }); +}; + +/** + * 通过zip或xml部署流程定义 + * @returns + */ +export function deployProcessFile(data: any) { + return request({ + url: '/workflow/definition/deployByFile', + method: 'post', + data: data, + headers: { + repeatSubmit: false + } + }); +} + +/** + * 迁移流程 + * @param currentdefinitionId + * @param fromdefinitionId + * @returns + */ +export const migrationDefinition = (currentdefinitionId: string, fromdefinitionId: string) => { + return request({ + url: `/workflow/definition/migrationDefinition/${currentdefinitionId}/${fromdefinitionId}`, + method: 'put' + }); +}; diff --git a/src/api/workflow/processDefinition/types.ts b/src/api/workflow/definition/types.ts similarity index 57% rename from src/api/workflow/processDefinition/types.ts rename to src/api/workflow/definition/types.ts index 979ec25..dd5c309 100644 --- a/src/api/workflow/processDefinition/types.ts +++ b/src/api/workflow/definition/types.ts @@ -5,16 +5,14 @@ export interface ProcessDefinitionQuery extends PageQuery { categoryCode?: string; } -export interface ProcessDefinitionVO extends BaseEntity { +export interface FlowDefinitionVo extends BaseEntity { id: string; - name: string; - key: string; - version: number; - suspensionState: number; - resourceName: string; - diagramResourceName: string; - deploymentId: string; - deploymentTime: string; + flowName: string; + flowCode: string; + version: string; + isPublish: number; + createTime: Date; + updateTime: Date; wfDefinitionConfigVo: DefinitionConfigVO; } diff --git a/src/api/workflow/processDefinition/index.ts b/src/api/workflow/processDefinition/index.ts deleted file mode 100644 index c063120..0000000 --- a/src/api/workflow/processDefinition/index.ts +++ /dev/null @@ -1,114 +0,0 @@ -import request from '@/utils/request'; -import { ProcessDefinitionQuery, ProcessDefinitionVO, definitionXmlVO } from '@/api/workflow/processDefinition/types'; -import { AxiosPromise } from 'axios'; - -/** - * 获取流程定义列表 - * @param query 流程实例id - * @returns - */ -export const listProcessDefinition = (query: ProcessDefinitionQuery): AxiosPromise => { - return request({ - url: `/workflow/processDefinition/list`, - method: 'get', - params: query - }); -}; -/** - * 按照流程定义key获取流程定义 - * @param processInstanceId 流程实例id - * @returns - */ -export const getListByKey = (key: string) => { - return request({ - url: `/workflow/processDefinition/getListByKey/${key}`, - method: 'get' - }); -}; - -/** - * 通过流程定义id获取流程图 - */ -export const definitionImage = (processDefinitionId: string): AxiosPromise => { - return request({ - url: `/workflow/processDefinition/definitionImage/${processDefinitionId}` + '?t' + Math.random(), - method: 'get' - }); -}; - -/** - * 通过流程定义id获取xml - * @param processDefinitionId 流程定义id - * @returns - */ -export const definitionXml = (processDefinitionId: string): AxiosPromise => { - return request({ - url: `/workflow/processDefinition/definitionXml/${processDefinitionId}`, - method: 'get' - }); -}; - -/** - * 删除流程定义 - * @param deploymentId 部署id - * @param processDefinitionId 流程定义id - * @returns - */ -export const deleteProcessDefinition = (deploymentId: string | string[], processDefinitionId: string | string[]) => { - return request({ - url: `/workflow/processDefinition/${deploymentId}/${processDefinitionId}`, - method: 'delete' - }); -}; - -/** - * 挂起/激活 - * @param processDefinitionId 流程定义id - * @returns - */ -export const updateDefinitionState = (processDefinitionId: string) => { - return request({ - url: `/workflow/processDefinition/updateDefinitionState/${processDefinitionId}`, - method: 'put' - }); -}; - -/** - * 流程定义转换为模型 - * @param processDefinitionId 流程定义id - * @returns - */ -export const convertToModel = (processDefinitionId: string) => { - return request({ - url: `/workflow/processDefinition/convertToModel/${processDefinitionId}`, - method: 'put' - }); -}; - -/** - * 通过zip或xml部署流程定义 - * @returns - */ -export function deployProcessFile(data: any) { - return request({ - url: '/workflow/processDefinition/deployByFile', - method: 'post', - data: data, - headers: { - repeatSubmit: false - } - }); -} - -/** - * 迁移流程 - * @param currentProcessDefinitionId - * @param fromProcessDefinitionId - * @returns - */ -export const migrationDefinition = (currentProcessDefinitionId: string, fromProcessDefinitionId: string) => { - return request({ - url: `/workflow/processDefinition/migrationDefinition/${currentProcessDefinitionId}/${fromProcessDefinitionId}`, - method: 'put' - }); -}; diff --git a/src/api/workflow/processInstance/index.ts b/src/api/workflow/processInstance/index.ts index 6d5e53b..784185e 100644 --- a/src/api/workflow/processInstance/index.ts +++ b/src/api/workflow/processInstance/index.ts @@ -118,7 +118,7 @@ export const getPageByCurrent = (query: ProcessInstanceQuery): AxiosPromise { return request({ url: `/workflow/processInstance/cancelProcessApply/${businessKey}`, - method: 'post' + method: 'put' }); }; diff --git a/src/api/workflow/task/types.ts b/src/api/workflow/task/types.ts index 0425a1a..92b6cf2 100644 --- a/src/api/workflow/task/types.ts +++ b/src/api/workflow/task/types.ts @@ -12,33 +12,20 @@ export interface ParticipantVo { candidateName: string[]; claim: boolean; } - -export interface TaskVO extends BaseEntity { - id: string; - name: string; - description?: string; - priority: number; - owner?: string; - assignee?: string | number; - assigneeName?: string; - processInstanceId: string; - executionId: string; - taskDefinitionId?: any; - processDefinitionId: string; - endTime?: string; - taskDefinitionKey: string; - dueDate?: string; - category?: any; - parentTaskId?: any; - tenantId: string; - claimTime?: string; - businessStatus?: string; - businessStatusName?: string; - processDefinitionName?: string; - processDefinitionKey?: string; - participantVo?: ParticipantVo; - multiInstance?: boolean; - businessKey?: string; +export interface FlowTaskVO { + id: string | number; + createTime?: Date; + updateTime?: Date; + tenantId?: string; + definitionId?: string; + instanceId: string; + flowName: string; + businessId: string; + nodeCode: string; + nodeName: string; + flowCode: string; + flowStatus: string; + nodeType: number; wfNodeConfigVo?: NodeConfigVO; wfDefinitionConfigVo?: DefinitionConfigVO; } diff --git a/src/api/workflow/workflowCommon/index.ts b/src/api/workflow/workflowCommon/index.ts index 63ce318..a827d8d 100644 --- a/src/api/workflow/workflowCommon/index.ts +++ b/src/api/workflow/workflowCommon/index.ts @@ -2,28 +2,39 @@ import { RouterJumpVo } from '@/api/workflow/workflowCommon/types'; export default { routerJump(routerJumpVo: RouterJumpVo, proxy) { - if (routerJumpVo.wfNodeConfigVo && routerJumpVo.wfNodeConfigVo.formType === 'static' && routerJumpVo.wfNodeConfigVo.wfFormManageVo) { - proxy.$tab.closePage(proxy.$route); - proxy.$router.push({ - path: `${routerJumpVo.wfNodeConfigVo.wfFormManageVo.router}`, - query: { - id: routerJumpVo.businessKey, - type: routerJumpVo.type, - taskId: routerJumpVo.taskId - } - }); - } else if (routerJumpVo.wfNodeConfigVo && routerJumpVo.wfNodeConfigVo.formType === 'dynamic' && routerJumpVo.wfNodeConfigVo.wfFormManageVo) { - proxy.$tab.closePage(proxy.$route); - proxy.$router.push({ - path: `${routerJumpVo.wfNodeConfigVo.wfFormManageVo.router}`, - query: { - id: routerJumpVo.businessKey, - type: routerJumpVo.type, - taskId: routerJumpVo.taskId - } - }); - } else { - proxy?.$modal.msgError('请到模型配置菜单!'); - } + proxy.$tab.closePage(proxy.$route); + console.log(routerJumpVo); + proxy.$router.push({ + path: `/workflow/leaveEdit/index`, + query: { + id: routerJumpVo.businessKey, + type: routerJumpVo.type, + taskId: routerJumpVo.taskId + } + }); + + // if (routerJumpVo.wfNodeConfigVo && routerJumpVo.wfNodeConfigVo.formType === 'static' && routerJumpVo.wfNodeConfigVo.wfFormManageVo) { + // proxy.$tab.closePage(proxy.$route); + // proxy.$router.push({ + // path: `${routerJumpVo.wfNodeConfigVo.wfFormManageVo.router}`, + // query: { + // id: routerJumpVo.businessKey, + // type: routerJumpVo.type, + // taskId: routerJumpVo.taskId + // } + // }); + // } else if (routerJumpVo.wfNodeConfigVo && routerJumpVo.wfNodeConfigVo.formType === 'dynamic' && routerJumpVo.wfNodeConfigVo.wfFormManageVo) { + // proxy.$tab.closePage(proxy.$route); + // proxy.$router.push({ + // path: `${routerJumpVo.wfNodeConfigVo.wfFormManageVo.router}`, + // query: { + // id: routerJumpVo.businessKey, + // type: routerJumpVo.type, + // taskId: routerJumpVo.taskId + // } + // }); + // } else { + // proxy?.$modal.msgError('请到模型配置菜单!'); + // } } }; diff --git a/src/api/workflow/workflowCommon/types.ts b/src/api/workflow/workflowCommon/types.ts index 0f1ef1f..e2dd5e3 100644 --- a/src/api/workflow/workflowCommon/types.ts +++ b/src/api/workflow/workflowCommon/types.ts @@ -5,7 +5,7 @@ export interface RouterJumpVo { wfNodeConfigVo: NodeConfigVO; wfDefinitionConfigVo: DefinitionConfigVO; businessKey: string; - taskId: string; + taskId: string | number; type: string; } diff --git a/src/views/workflow/processDefinition/index.vue b/src/views/workflow/processDefinition/index.vue index 1dacb80..1aa2617 100644 --- a/src/views/workflow/processDefinition/index.vue +++ b/src/views/workflow/processDefinition/index.vue @@ -54,8 +54,8 @@ - - + + @@ -167,8 +167,8 @@ - - + + @@ -252,20 +252,20 @@ + + diff --git a/src/components/WarmFlow/PropertySetting/end.vue b/src/components/WarmFlow/PropertySetting/end.vue new file mode 100644 index 0000000..823f030 --- /dev/null +++ b/src/components/WarmFlow/PropertySetting/end.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/src/components/WarmFlow/PropertySetting/index.vue b/src/components/WarmFlow/PropertySetting/index.vue new file mode 100644 index 0000000..f61856d --- /dev/null +++ b/src/components/WarmFlow/PropertySetting/index.vue @@ -0,0 +1,246 @@ + + + + + diff --git a/src/components/WarmFlow/PropertySetting/parallel.vue b/src/components/WarmFlow/PropertySetting/parallel.vue new file mode 100644 index 0000000..7ef7a92 --- /dev/null +++ b/src/components/WarmFlow/PropertySetting/parallel.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/src/components/WarmFlow/PropertySetting/serial.vue b/src/components/WarmFlow/PropertySetting/serial.vue new file mode 100644 index 0000000..592a00a --- /dev/null +++ b/src/components/WarmFlow/PropertySetting/serial.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/src/components/WarmFlow/PropertySetting/skip.vue b/src/components/WarmFlow/PropertySetting/skip.vue new file mode 100644 index 0000000..08000cc --- /dev/null +++ b/src/components/WarmFlow/PropertySetting/skip.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/src/components/WarmFlow/PropertySetting/start.vue b/src/components/WarmFlow/PropertySetting/start.vue new file mode 100644 index 0000000..74be79e --- /dev/null +++ b/src/components/WarmFlow/PropertySetting/start.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/src/components/WarmFlow/js/between.js b/src/components/WarmFlow/js/between.js new file mode 100644 index 0000000..472b4ec --- /dev/null +++ b/src/components/WarmFlow/js/between.js @@ -0,0 +1,23 @@ +import { RectNode, RectNodeModel } from "@logicflow/core"; + +class BetweenModel extends RectNodeModel { + + initNodeData(data) { + super.initNodeData(data); + this.width = 100; + this.height = 80; + this.radius = 5; + } + getNodeStyle() { + const style = super.getNodeStyle(); + return style + } +} + +class BetweenView extends RectNode {} + +export default { + type: "between", + model: BetweenModel, + view: BetweenView, +}; diff --git a/src/components/WarmFlow/js/data.js b/src/components/WarmFlow/js/data.js new file mode 100644 index 0000000..e0cd79f --- /dev/null +++ b/src/components/WarmFlow/js/data.js @@ -0,0 +1,139 @@ +// 测试数据 +const graphData = { + flowName: "请假流程-串行1", + flowCode: "leaveFlow-serial1", + version: "1.0", + formCustom: "N", + formPath: "test/leave/approve", + nodes: [ + { + id: "node_id_1", + type: "start", + x: 200, + y: 200, + text: { x: 200, y: 200, value: "开始" }, + properties: { + status: "approval" + }, + }, + { + id: "node_id_2", + type: "between", + x: 400, + y: 200, + text: { x: 400, y: 200, value: "待提交" }, + properties: { + status: "pass" + }, + }, + { + id: "node_id_3", + type: "between", + x: 600, + y: 200, + text: { x: 600, y: 200, value: "组长审批" }, + properties: { + status: "approval" + }, + }, + { + id: "node_id_4", + type: "between", + x: 800, + y: 200, + text: { x: 800, y: 200, value: "部门审批" }, + properties: { + status: "approval" + }, + }, + { + id: "node_id_5", + type: "between", + x: 1000, + y: 200, + text: { x: 1000, y: 200, value: "hr审批" }, + properties: { + status: "approval" + }, + }, + { + id: "node_id_6", + type: "end", + x: 1200, + y: 200, + text: { x: 1200, y: 200, value: "结束" }, + properties: {}, + }, + ], + edges: [ + { + id: "edge_id", + type: "skip", + sourceNodeId: "node_id_1", + targetNodeId: "node_id_2", + text: { x: 280, y: 200, value: "通过" }, + startPoint: { x: 220, y: 200 }, + endPoint: { x: 350, y: 200 }, + properties: {}, + }, + { + id: "edge_id", + type: "skip", + sourceNodeId: "node_id_2", + targetNodeId: "node_id_3", + text: { x: 500, y: 200, value: "通过" }, + startPoint: { x: 450, y: 200 }, + endPoint: { x: 550, y: 200 }, + properties: {}, + }, + { + id: "edge_id", + type: "skip", + sourceNodeId: "node_id_3", + targetNodeId: "node_id_4", + text: { x: 700, y: 200, value: "通过" }, + startPoint: { x: 650, y: 200 }, + endPoint: { x: 750, y: 200 }, + properties: {}, + }, + { + id: "edge_id", + type: "skip", + sourceNodeId: "node_id_4", + targetNodeId: "node_id_5", + text: { x: 900, y: 200, value: "通过" }, + startPoint: { x: 850, y: 200 }, + endPoint: { x: 950, y: 200 }, + properties: {}, + }, + { + id: "edge_id", + type: "skip", + sourceNodeId: "node_id_5", + targetNodeId: "node_id_6", + text: { x: 1120, y: 200, value: "通过" }, + startPoint: { x: 1050, y: 200 }, + endPoint: { x: 1180, y: 200 }, + properties: {}, + }, + + { + id: "edge_id", + type: "skip", + sourceNodeId: "node_id_4", + targetNodeId: "node_id_2", + text: { x: 600, y: 100, value: "退回" }, + startPoint: { x: 800, y: 160 }, + endPoint: { x: 400, y: 160 }, + pointsList: [ + { x: 800, y: 160 }, + { x: 800, y: 100 }, + { x: 400, y: 100 }, + { x: 400, y: 160 }, + ], + properties: {}, + }, + ], +}; + +export default graphData diff --git a/src/components/WarmFlow/js/end.js b/src/components/WarmFlow/js/end.js new file mode 100644 index 0000000..3ac6a1a --- /dev/null +++ b/src/components/WarmFlow/js/end.js @@ -0,0 +1,17 @@ +import { CircleNode, CircleNodeModel } from "@logicflow/core"; + +class endModel extends CircleNodeModel { + + initNodeData(data) { + super.initNodeData(data); + this.r = 20 + } +} + +class endView extends CircleNode {} + +export default { + type: "end", + model: endModel, + view: endView, +}; diff --git a/src/components/WarmFlow/js/parallel.js b/src/components/WarmFlow/js/parallel.js new file mode 100644 index 0000000..8ebc88d --- /dev/null +++ b/src/components/WarmFlow/js/parallel.js @@ -0,0 +1,57 @@ +import { h, PolygonNode, PolygonNodeModel } from '@logicflow/core' + +class ParallelModel extends PolygonNodeModel { + static extendKey = 'ParallelModel'; + constructor (data, graphModel) { + if (!data.text) { + data.text = '' + } + if (data.text && typeof data.text === 'string') { + data.text = { + value: data.text, + x: data.x, + y: data.y + 40 + } + } + super(data, graphModel) + this.points = [ + [25, 0], + [50, 25], + [25, 50], + [0, 25] + ] + } + +} + +class ParallelView extends PolygonNode { + static extendKey = 'ParallelNode'; + getShape () { + const { model } = this.props + const { x, y, width, height, points } = model + const style = model.getNodeStyle() + return h( + 'g', + { + transform: `matrix(1 0 0 1 ${x - width / 2} ${y - height / 2})` + }, + h('polygon', { + ...style, + x, + y, + points + }), + h('path', { + d: + 'm 23,10 0,12.5 -12.5,0 0,5 12.5,0 0,12.5 5,0 0,-12.5 12.5,0 0,-5 -12.5,0 0,-12.5 -5,0 z', + ...style + }) + ) + } +} + +export default { + type: 'parallel', + view: ParallelView, + model: ParallelModel +}; diff --git a/src/components/WarmFlow/js/serial.js b/src/components/WarmFlow/js/serial.js new file mode 100644 index 0000000..7a9012c --- /dev/null +++ b/src/components/WarmFlow/js/serial.js @@ -0,0 +1,57 @@ +import { h, PolygonNode, PolygonNodeModel } from '@logicflow/core' + +class SerialModel extends PolygonNodeModel { + static extendKey = 'SerialModel'; + constructor (data, graphModel) { + if (!data.text) { + data.text = '' + } + if (data.text && typeof data.text === 'string') { + data.text = { + value: data.text, + x: data.x, + y: data.y + 40 + } + } + super(data, graphModel) + this.points = [ + [25, 0], + [50, 25], + [25, 50], + [0, 25] + ] + } + +} + +class SerialView extends PolygonNode { + static extendKey = 'SerialNode'; + getShape () { + const { model } = this.props + const { x, y, width, height, points } = model + const style = model.getNodeStyle() + return h( + 'g', + { + transform: `matrix(1 0 0 1 ${x - width / 2} ${y - height / 2})` + }, + h('polygon', { + ...style, + x, + y, + points + }), + h('path', { + d: + 'm 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z', + ...style + }) + ) + } +} + +export default { + type: 'serial', + view: SerialView, + model: SerialModel +}; diff --git a/src/components/WarmFlow/js/skip.js b/src/components/WarmFlow/js/skip.js new file mode 100644 index 0000000..4167f1b --- /dev/null +++ b/src/components/WarmFlow/js/skip.js @@ -0,0 +1,33 @@ +import { PolylineEdge, PolylineEdgeModel } from "@logicflow/core"; + +class SkipModel extends PolylineEdgeModel { + setAttributes() { + this.offset = 20; + } + + getEdgeStyle() { + const style = super.getEdgeStyle(); + const { properties } = this; + if (properties.isActived) { + style.strokeDasharray = "4 4"; + } + return style; + } + + /** + * 重写此方法,使保存数据是能带上锚点数据。 + */ + getData() { + const data = super.getData(); + data.sourceAnchorId = this.sourceAnchorId; + data.targetAnchorId = this.targetAnchorId; + return data; + } + +} + +export default { + type: "skip", + view: PolylineEdge, + model: SkipModel, +}; diff --git a/src/components/WarmFlow/js/start.js b/src/components/WarmFlow/js/start.js new file mode 100644 index 0000000..71fc66e --- /dev/null +++ b/src/components/WarmFlow/js/start.js @@ -0,0 +1,17 @@ +import { CircleNode, CircleNodeModel } from "@logicflow/core"; + +class StartModel extends CircleNodeModel { + + initNodeData(data) { + super.initNodeData(data); + this.r = 20 + } +} + +class StartView extends CircleNode {} + +export default { + type: "start", + model: StartModel, + view: StartView, +}; diff --git a/src/components/WarmFlow/js/tool.js b/src/components/WarmFlow/js/tool.js new file mode 100644 index 0000000..91d840e --- /dev/null +++ b/src/components/WarmFlow/js/tool.js @@ -0,0 +1,356 @@ +/** + * 节点样式处理方法 + * @param _this + * @param style + * @returns {*} + */ +export const nodeStyleHandle = (_this, style) => { + if (_this.properties.status === "pass") { + style.stroke = "green"; + } else if (_this.properties.status === "reject") { + style.stroke = "#ffba00"; + } else if (_this.properties.status === "approval") { + style.stroke = "red"; + } else { + style.stroke = "#909399"; + } + return style +} + +/** + * 节点大小处理方法 + * @param _this + * @param style + * @returns {*} + */ +export const nodeSizeHandle = (_this) => { + _this.width = 120; + _this.height = 80; + _this.radius = 5; +} + +/** + * 节点大小处理方法 + * @param _this + * @param style + * @returns {*} + */ +export const skipText = (skipType) => { + let text = '' + if (skipType && skipType === 'PASS') { + text = '审批通过' + } else if (skipType && skipType === 'REJECT') { + text = '退回' + } + return text +} + + +/** + * 解析xml成Dom对象 + * @param {} xml + * @returns + */ +export const parseXml2Dom = (xml) => { + let xmlDoc = null + if (window.DOMParser) { + const parser = new DOMParser() + xmlDoc = parser.parseFromString(xml, 'text/xml') + } else { // Internet Explorer + // eslint-disable-next-line no-undef + xmlDoc = new ActiveXObject('Microsoft.XMLDOM') + xmlDoc.async = false + xmlDoc.loadXML(xml) + } + return xmlDoc +} + +// 节点标签 +const NODE_NAMES = ['start', 'between', 'serial', 'parallel', 'end'] +// 流程节点属性 +const DEFINITION_KEYS = ['flowCode', 'flowName', 'version', 'formCustom', 'formPath'] +// 节点属性 +const NODE_ATTR_KEYS = ['nodeType', 'nodeCode', 'nodeName', 'coordinate', 'nodeRatio', 'permissionFlag', "skipAnyNode" + , "listenerType", "listenerPath", "formCustom", "formPath"] +// 变迁节点属性 +const SKIP_ATTR_KEYS = ['skipName', 'skipType', 'coordinate', 'skipCondition'] + +/** + * 将warm-flow的定义文件转成LogicFlow支持的数据格式 + * @param {*} xml + * @returns + */ +export const snakerXml2LogicFlowJson = (xml) => { + const graphData = { + nodes: [], + edges: [] + } + const xmlDoc = parseXml2Dom(xml) + const definitionDom = xmlDoc.getElementsByTagName('definition') + if (!definitionDom.length) { + return graphData + } + let value = null + // 解析definition属性 + DEFINITION_KEYS.forEach(key => { + value = definitionDom[0].getAttribute(key) + if (value) { + graphData[key] = value + } + }) + let nodeEles = null + let node = null + let lfNode = {} + // 解析节点 + nodeEles = definitionDom[0].getElementsByTagName("node") + if (nodeEles.length) { + for (var i = 0, len = nodeEles.length; i < len; i++) { + node = nodeEles[i] + lfNode = { + text:{}, + properties: {} + } + // 处理节点 + NODE_ATTR_KEYS.forEach(attrKey => { + value = node.getAttribute(attrKey) + if (value) { + if (attrKey === 'nodeType') { + lfNode.type = value + } else if (attrKey === 'nodeCode') { + lfNode.id = value + } else if (attrKey === 'coordinate') { + const attr = value.split('|') + const nodeXy = attr[0].split(',') + lfNode.x = parseInt(nodeXy[0]) + lfNode.y = parseInt(nodeXy[1]) + if (attr.length === 2) { + const textXy = attr[1].split(',') + lfNode.text.x = parseInt(textXy[0]) + lfNode.text.y = parseInt(textXy[1]) + } + } else if (attrKey === 'nodeName') { + lfNode.text.value = value + } else { + lfNode.properties[attrKey] = value + } + } + }) + graphData.nodes.push(lfNode) + // 处理边 + let skipEles = null + let skipEle = null + let edge = {} + skipEles = node.getElementsByTagName('skip') + for (var j = 0, lenn = skipEles.length; j < lenn; j++) { + skipEle = skipEles[j] + edge = { + text: {}, + properties: {}, + } + edge.id = skipEle.getAttribute('id') + edge.type = 'skip' + edge.sourceNodeId = lfNode.id + edge.targetNodeId = skipEle.textContent + edge.text = { + value: skipEle.getAttribute('skipName') + } + edge.properties.skipCondition = skipEle.getAttribute('skipCondition') + edge.properties.skipName = skipEle.getAttribute('skipName') + edge.properties.skipType = skipEle.getAttribute('skipType') + const expr = skipEle.getAttribute('expr') + if (expr) { + edge.properties.expr = expr + } + const coordinate = skipEle.getAttribute('coordinate') + if (coordinate) { + const coordinateXy = coordinate.split('|') + edge.pointsList = [] + coordinateXy[0].split(';').forEach((item) => { + const pointArr = item.split(',') + edge.pointsList.push({ + x: parseInt(pointArr[0]), + y: parseInt(pointArr[1]) + }) + }) + edge.startPoint = edge.pointsList[0] + edge.endPoint = edge.pointsList[edge.pointsList.length - 1] + if (coordinateXy.length > 1) { + let textXy = coordinateXy[1].split(","); + edge.text.x = parseInt(textXy[0]) + edge.text.y = parseInt(textXy[1]) + } + } + graphData.edges.push(edge) + } + } + } + + return graphData +} + +/** + * 将LogicFlow的数据转成warm-flow的定义文件 + * @param {*} data(...definitionInfo,nodes,edges) + * @returns + */ +export const logicFlowJsonToFlowXml = (data) => { + let xml = '' + // data的数据由流程定义文件信息+logicFlow数据构成 + // 先构建成流程对象 + const definitionObj = { + flowCode: data.flowCode, // 流程定义编码 + flowName: data.flowName, // 流程定义名称 + version: data.version, // 流程定义版本号 + formCustom: data.formCustom, // 表单自定义 + formPath: data.formPath, // 表单自定义路径 + } + /** + * 获取开始节点 + * @returns + */ + const getStartNode = () => { + return data.nodes.find((node) => { + return node.type === 'start' + }) + } + /** + * 获取当前节点的所有下一个节点集合 + * @param {*} id 当前节点名称 + * @returns + */ + const getNextNodes = (id) => { + return data.edges.filter(edge => { + return edge.sourceNodeId === id + }).map(edge => { + return data.nodes.find((node) => { + return node.id === edge.targetNodeId + }) + }) + } + /** + * 获取节点所有跳转 + * @param {*} id + * @returns + */ + const getSkip = (id) => { + return data.edges.filter((edge) => { + return edge.sourceNodeId === id + }).map(edge => { + let coordinate = '' + for (let i = 0; i < edge.pointsList.length; i++) { + coordinate = coordinate + parseInt(edge.pointsList[i].x) + ',' + parseInt(edge.pointsList[i].y) + if (i !== edge.pointsList.length - 1) { + coordinate = coordinate + ';' + } + } + if (edge.text) { + coordinate = coordinate + '|' + parseInt(edge.text.x) + ',' + parseInt(edge.text.y) + } + return { + skipType: edge.properties.skipType, + skipCondition: edge.properties.skipCondition, + skipName: edge.properties.skipName, + textContent: edge.targetNodeId, // 目地节点id + coordinate: coordinate, + } + }) + } + /** + * 构建节点属性 + * @param {} node + * @returns + */ + const buildNode = (node) => { + let textXy = ''; + if (node.text) { + textXy = '|' + node.text.x + ',' + node.text.y; + } + return { + nodeType: node.type, + nodeCode: node.id, + nodeName: (node.text instanceof String || node.text === undefined) ? node.text : node.text.value, + permissionFlag: node.properties.permissionFlag, + nodeRatio: node.properties.nodeRatio, + skipAnyNode: node.properties.skipAnyNode, + listenerType: node.properties.listenerType, + listenerPath: node.properties.listenerPath, + coordinate: node.x + ',' + node.y + textXy, + skip: getSkip(node.id), + formCustom: node.properties.formCustom, + formPath: node.properties.formPath, + } + } + /** + * 特殊字符转义 + * @param {*} text + * @returns + */ + const textEncode = (text) => { + text = text.replace(/&/g, '&') + .replace(/"/g, '"') + .replace(//g, '>') + return text + } + /** + * 递归构建节点属性 + * @param {} node + */ + const recursionBuildNode = (node) => { + const nodeName = node.type + if (!definitionObj[nodeName + '_' + node.id]) { + definitionObj[nodeName + '_' + node.id] = buildNode(node) + const nextNodes = getNextNodes(node.id) + nextNodes.forEach(nextNode => { + recursionBuildNode(nextNode) + }) + } + } + const startNode = getStartNode() + if (!startNode) { + // 开始节点不存在,xml不合法 + return '' + } + recursionBuildNode(startNode) + xml = '\n' + xml += ' { + const value = definitionObj[key] + if (DEFINITION_KEYS.includes(key) && value) { + xml += ' ' + key + '=' + '"' + textEncode(value) + '"' + } + }) + xml += '>\n' + // 生成节点xml + Object.keys(definitionObj).forEach(key => { + const value = definitionObj[key] + let nodeName = key.split('_')[0] + if (NODE_NAMES.includes(nodeName)) { + xml += '\t { + if (NODE_ATTR_KEYS.includes(nodeAttrKey) && value[nodeAttrKey]) { + xml += ' ' + nodeAttrKey + '=' + '"' + textEncode(value[nodeAttrKey]) + '"' + } + }) + xml += '>\n\t' + // 构建skip + if (value.skip) { + value.skip.forEach(skip => { + xml += '\t { + if (SKIP_ATTR_KEYS.includes(skipAttrKey) && skip[skipAttrKey]) { + xml += ' ' + skipAttrKey + '=' + '"' + textEncode(skip[skipAttrKey]) + '"' + } + }) + xml += '>' + xml += skip['textContent'] + '\n' + }) + } + xml += '\t\n' + } + }) + xml += '' + return xml +} diff --git a/src/router/index.ts b/src/router/index.ts index 86e0092..1d784f7 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -176,6 +176,20 @@ export const dynamicRoutes: RouteRecordRaw[] = [ meta: { title: '请假申请', activeMenu: '/workflow/leave', noCache: true } } ] + }, + { + path: '/workflow/modelDesign', + component: Layout, + hidden: true, + permissions: ['workflow:leave:edit'], + children: [ + { + path: 'index', + component: () => import('@/views/workflow/processDefinition/modelDesign.vue'), + name: 'modelDesign', + meta: { title: '请假申请', activeMenu: '/workflow/processDefinition', noCache: true } + } + ] } ]; diff --git a/src/views/workflow/processDefinition/index.vue b/src/views/workflow/processDefinition/index.vue index 67551b6..7985546 100644 --- a/src/views/workflow/processDefinition/index.vue +++ b/src/views/workflow/processDefinition/index.vue @@ -112,6 +112,9 @@ 删除 + + 设计 + @@ -534,4 +537,12 @@ const handlerSaveForm = async () => { } }); }; +const design = async (row: FlowDefinitionVo) => { + proxy.$router.push({ + path: `/workflow/modelDesign/index`, + query: { + id: row.id + } + }); +}; diff --git a/src/views/workflow/processDefinition/modelDesign.vue b/src/views/workflow/processDefinition/modelDesign.vue new file mode 100644 index 0000000..eb182ec --- /dev/null +++ b/src/views/workflow/processDefinition/modelDesign.vue @@ -0,0 +1,287 @@ + + + + + + diff --git a/src/views/workflow/processInstance/index.vue b/src/views/workflow/processInstance/index.vue index 4edde0c..ff23b7c 100644 --- a/src/views/workflow/processInstance/index.vue +++ b/src/views/workflow/processInstance/index.vue @@ -203,8 +203,7 @@ const deleteReason = ref(''); const queryParams = ref({ pageNum: 1, pageSize: 10, - name: undefined, - key: undefined, + flowCode: undefined, categoryCode: undefined }); @@ -307,11 +306,11 @@ const changeTab = async (data: string) => { }; /** 作废按钮操作 */ const handleInvalid = async (row: ProcessInstanceVO) => { - await proxy?.$modal.confirm('是否确认作废业务id为【' + row.businessKey + '】的数据项?'); + await proxy?.$modal.confirm('是否确认作废业务id为【' + row.businessId + '】的数据项?'); loading.value = true; if ('running' === tab.value) { let param = { - businessKey: row.businessKey, + businessKey: row.businessId, deleteReason: deleteReason.value }; await deleteRunInstance(param).finally(() => (loading.value = false)); @@ -322,18 +321,6 @@ const handleInvalid = async (row: ProcessInstanceVO) => { const cancelPopover = async (index: any) => { (proxy?.$refs[`popoverRef${index}`] as any).hide(); //关闭弹窗 }; -//获取流程定义 -const getProcessDefinitionHitoryList = (id: string, key: string) => { - processDefinitionDialog.visible = true; - processDefinitionId.value = id; - loading.value = true; - getListByKey(key).then((resp) => { - if (resp.data && resp.data.length > 0) { - processDefinitionHistoryList.value = resp.data.filter((item: any) => item.id !== id); - } - loading.value = false; - }); -}; //切换流程版本 const handleChange = async (id: string) => { await proxy?.$modal.confirm('是否确认切换?'); From 42a4ef4c9672d5cd24061ba3422295d550615032 Mon Sep 17 00:00:00 2001 From: gssong <1742057357@qq.com> Date: Sat, 26 Oct 2024 17:44:36 +0800 Subject: [PATCH 26/88] =?UTF-8?q?add=20=E6=B7=BB=E5=8A=A0warm-ui=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1=E5=99=A8,=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=20update=20=E8=B0=83=E6=95=B4=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E5=9B=BE=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 +- src/api/workflow/processInstance/index.ts | 20 +- src/components/Process/approvalRecord.vue | 37 +- .../WarmFlow/PropertySetting/between.vue | 267 ------------- .../WarmFlow/PropertySetting/end.vue | 52 --- .../WarmFlow/PropertySetting/index.vue | 246 ------------ .../WarmFlow/PropertySetting/parallel.vue | 52 --- .../WarmFlow/PropertySetting/serial.vue | 52 --- .../WarmFlow/PropertySetting/skip.vue | 93 ----- .../WarmFlow/PropertySetting/start.vue | 75 ---- src/components/WarmFlow/js/between.js | 23 -- src/components/WarmFlow/js/data.js | 139 ------- src/components/WarmFlow/js/end.js | 17 - src/components/WarmFlow/js/parallel.js | 57 --- src/components/WarmFlow/js/serial.js | 57 --- src/components/WarmFlow/js/skip.js | 33 -- src/components/WarmFlow/js/start.js | 17 - src/components/WarmFlow/js/tool.js | 356 ------------------ src/router/index.ts | 6 +- src/views/workflow/leave/index.vue | 6 +- src/views/workflow/leave/leaveEdit.vue | 14 +- .../workflow/processDefinition/design.vue | 52 +++ .../workflow/processDefinition/index.vue | 15 +- .../processDefinition/modelDesign.vue | 287 -------------- src/views/workflow/processInstance/index.vue | 17 - src/views/workflow/task/allTaskWaiting.vue | 2 +- 26 files changed, 93 insertions(+), 1903 deletions(-) delete mode 100644 src/components/WarmFlow/PropertySetting/between.vue delete mode 100644 src/components/WarmFlow/PropertySetting/end.vue delete mode 100644 src/components/WarmFlow/PropertySetting/index.vue delete mode 100644 src/components/WarmFlow/PropertySetting/parallel.vue delete mode 100644 src/components/WarmFlow/PropertySetting/serial.vue delete mode 100644 src/components/WarmFlow/PropertySetting/skip.vue delete mode 100644 src/components/WarmFlow/PropertySetting/start.vue delete mode 100644 src/components/WarmFlow/js/between.js delete mode 100644 src/components/WarmFlow/js/data.js delete mode 100644 src/components/WarmFlow/js/end.js delete mode 100644 src/components/WarmFlow/js/parallel.js delete mode 100644 src/components/WarmFlow/js/serial.js delete mode 100644 src/components/WarmFlow/js/skip.js delete mode 100644 src/components/WarmFlow/js/start.js delete mode 100644 src/components/WarmFlow/js/tool.js create mode 100644 src/views/workflow/processDefinition/design.vue delete mode 100644 src/views/workflow/processDefinition/modelDesign.vue diff --git a/package.json b/package.json index fbc9c5b..48b1571 100644 --- a/package.json +++ b/package.json @@ -45,9 +45,7 @@ "vue-i18n": "9.10.2", "vue-router": "4.3.2", "vue-types": "5.1.1", - "vxe-table": "4.5.22", - "@logicflow/core": "^1.2.15", - "@logicflow/extension": "^1.2.16" + "vxe-table": "4.5.22" }, "devDependencies": { "@iconify/json": "2.2.201", diff --git a/src/api/workflow/processInstance/index.ts b/src/api/workflow/processInstance/index.ts index 784185e..8b3f8d9 100644 --- a/src/api/workflow/processInstance/index.ts +++ b/src/api/workflow/processInstance/index.ts @@ -1,6 +1,7 @@ import request from '@/utils/request'; import { ProcessInstanceQuery, ProcessInstanceVO } from '@/api/workflow/processInstance/types'; import { AxiosPromise } from 'axios'; +import { number } from 'vue-types'; /** * 查询运行中实例列表 @@ -31,9 +32,9 @@ export const getPageByFinish = (query: ProcessInstanceQuery): AxiosPromise { +export const getFlowImage = (businessKey: string | number) => { return request({ - url: `/workflow/processInstance/getHistoryImage/${businessKey}` + '?t' + Math.random(), + url: `/workflow/processInstance/getFlowImage/${businessKey}` + '?t' + Math.random(), method: 'get' }); }; @@ -48,18 +49,6 @@ export const getHistoryList = (businessKey: string): AxiosPromise { - return request({ - url: `/workflow/processInstance/getHistoryRecord/${businessKey}`, - method: 'get' - }); -}; - /** * 作废 * @param data 参数 @@ -125,9 +114,8 @@ export const cancelProcessApply = (businessKey: string) => { export default { getPageByRunning, getPageByFinish, - getHistoryImage, + getFlowImage, getHistoryList, - getHistoryRecord, deleteRunInstance, deleteRunAndHisInstance, deleteFinishAndHisInstance, diff --git a/src/components/Process/approvalRecord.vue b/src/components/Process/approvalRecord.vue index bb4ed91..d2417f2 100644 --- a/src/components/Process/approvalRecord.vue +++ b/src/components/Process/approvalRecord.vue @@ -2,27 +2,22 @@
- - + +
- - + + - - - - - - + + + - - diff --git a/src/components/WarmFlow/PropertySetting/end.vue b/src/components/WarmFlow/PropertySetting/end.vue deleted file mode 100644 index 823f030..0000000 --- a/src/components/WarmFlow/PropertySetting/end.vue +++ /dev/null @@ -1,52 +0,0 @@ - - - - - diff --git a/src/components/WarmFlow/PropertySetting/index.vue b/src/components/WarmFlow/PropertySetting/index.vue deleted file mode 100644 index f61856d..0000000 --- a/src/components/WarmFlow/PropertySetting/index.vue +++ /dev/null @@ -1,246 +0,0 @@ - - - - - diff --git a/src/components/WarmFlow/PropertySetting/parallel.vue b/src/components/WarmFlow/PropertySetting/parallel.vue deleted file mode 100644 index 7ef7a92..0000000 --- a/src/components/WarmFlow/PropertySetting/parallel.vue +++ /dev/null @@ -1,52 +0,0 @@ - - - - - diff --git a/src/components/WarmFlow/PropertySetting/serial.vue b/src/components/WarmFlow/PropertySetting/serial.vue deleted file mode 100644 index 592a00a..0000000 --- a/src/components/WarmFlow/PropertySetting/serial.vue +++ /dev/null @@ -1,52 +0,0 @@ - - - - - diff --git a/src/components/WarmFlow/PropertySetting/skip.vue b/src/components/WarmFlow/PropertySetting/skip.vue deleted file mode 100644 index 08000cc..0000000 --- a/src/components/WarmFlow/PropertySetting/skip.vue +++ /dev/null @@ -1,93 +0,0 @@ - - - - - diff --git a/src/components/WarmFlow/PropertySetting/start.vue b/src/components/WarmFlow/PropertySetting/start.vue deleted file mode 100644 index 74be79e..0000000 --- a/src/components/WarmFlow/PropertySetting/start.vue +++ /dev/null @@ -1,75 +0,0 @@ - - - - - diff --git a/src/components/WarmFlow/js/between.js b/src/components/WarmFlow/js/between.js deleted file mode 100644 index 472b4ec..0000000 --- a/src/components/WarmFlow/js/between.js +++ /dev/null @@ -1,23 +0,0 @@ -import { RectNode, RectNodeModel } from "@logicflow/core"; - -class BetweenModel extends RectNodeModel { - - initNodeData(data) { - super.initNodeData(data); - this.width = 100; - this.height = 80; - this.radius = 5; - } - getNodeStyle() { - const style = super.getNodeStyle(); - return style - } -} - -class BetweenView extends RectNode {} - -export default { - type: "between", - model: BetweenModel, - view: BetweenView, -}; diff --git a/src/components/WarmFlow/js/data.js b/src/components/WarmFlow/js/data.js deleted file mode 100644 index e0cd79f..0000000 --- a/src/components/WarmFlow/js/data.js +++ /dev/null @@ -1,139 +0,0 @@ -// 测试数据 -const graphData = { - flowName: "请假流程-串行1", - flowCode: "leaveFlow-serial1", - version: "1.0", - formCustom: "N", - formPath: "test/leave/approve", - nodes: [ - { - id: "node_id_1", - type: "start", - x: 200, - y: 200, - text: { x: 200, y: 200, value: "开始" }, - properties: { - status: "approval" - }, - }, - { - id: "node_id_2", - type: "between", - x: 400, - y: 200, - text: { x: 400, y: 200, value: "待提交" }, - properties: { - status: "pass" - }, - }, - { - id: "node_id_3", - type: "between", - x: 600, - y: 200, - text: { x: 600, y: 200, value: "组长审批" }, - properties: { - status: "approval" - }, - }, - { - id: "node_id_4", - type: "between", - x: 800, - y: 200, - text: { x: 800, y: 200, value: "部门审批" }, - properties: { - status: "approval" - }, - }, - { - id: "node_id_5", - type: "between", - x: 1000, - y: 200, - text: { x: 1000, y: 200, value: "hr审批" }, - properties: { - status: "approval" - }, - }, - { - id: "node_id_6", - type: "end", - x: 1200, - y: 200, - text: { x: 1200, y: 200, value: "结束" }, - properties: {}, - }, - ], - edges: [ - { - id: "edge_id", - type: "skip", - sourceNodeId: "node_id_1", - targetNodeId: "node_id_2", - text: { x: 280, y: 200, value: "通过" }, - startPoint: { x: 220, y: 200 }, - endPoint: { x: 350, y: 200 }, - properties: {}, - }, - { - id: "edge_id", - type: "skip", - sourceNodeId: "node_id_2", - targetNodeId: "node_id_3", - text: { x: 500, y: 200, value: "通过" }, - startPoint: { x: 450, y: 200 }, - endPoint: { x: 550, y: 200 }, - properties: {}, - }, - { - id: "edge_id", - type: "skip", - sourceNodeId: "node_id_3", - targetNodeId: "node_id_4", - text: { x: 700, y: 200, value: "通过" }, - startPoint: { x: 650, y: 200 }, - endPoint: { x: 750, y: 200 }, - properties: {}, - }, - { - id: "edge_id", - type: "skip", - sourceNodeId: "node_id_4", - targetNodeId: "node_id_5", - text: { x: 900, y: 200, value: "通过" }, - startPoint: { x: 850, y: 200 }, - endPoint: { x: 950, y: 200 }, - properties: {}, - }, - { - id: "edge_id", - type: "skip", - sourceNodeId: "node_id_5", - targetNodeId: "node_id_6", - text: { x: 1120, y: 200, value: "通过" }, - startPoint: { x: 1050, y: 200 }, - endPoint: { x: 1180, y: 200 }, - properties: {}, - }, - - { - id: "edge_id", - type: "skip", - sourceNodeId: "node_id_4", - targetNodeId: "node_id_2", - text: { x: 600, y: 100, value: "退回" }, - startPoint: { x: 800, y: 160 }, - endPoint: { x: 400, y: 160 }, - pointsList: [ - { x: 800, y: 160 }, - { x: 800, y: 100 }, - { x: 400, y: 100 }, - { x: 400, y: 160 }, - ], - properties: {}, - }, - ], -}; - -export default graphData diff --git a/src/components/WarmFlow/js/end.js b/src/components/WarmFlow/js/end.js deleted file mode 100644 index 3ac6a1a..0000000 --- a/src/components/WarmFlow/js/end.js +++ /dev/null @@ -1,17 +0,0 @@ -import { CircleNode, CircleNodeModel } from "@logicflow/core"; - -class endModel extends CircleNodeModel { - - initNodeData(data) { - super.initNodeData(data); - this.r = 20 - } -} - -class endView extends CircleNode {} - -export default { - type: "end", - model: endModel, - view: endView, -}; diff --git a/src/components/WarmFlow/js/parallel.js b/src/components/WarmFlow/js/parallel.js deleted file mode 100644 index 8ebc88d..0000000 --- a/src/components/WarmFlow/js/parallel.js +++ /dev/null @@ -1,57 +0,0 @@ -import { h, PolygonNode, PolygonNodeModel } from '@logicflow/core' - -class ParallelModel extends PolygonNodeModel { - static extendKey = 'ParallelModel'; - constructor (data, graphModel) { - if (!data.text) { - data.text = '' - } - if (data.text && typeof data.text === 'string') { - data.text = { - value: data.text, - x: data.x, - y: data.y + 40 - } - } - super(data, graphModel) - this.points = [ - [25, 0], - [50, 25], - [25, 50], - [0, 25] - ] - } - -} - -class ParallelView extends PolygonNode { - static extendKey = 'ParallelNode'; - getShape () { - const { model } = this.props - const { x, y, width, height, points } = model - const style = model.getNodeStyle() - return h( - 'g', - { - transform: `matrix(1 0 0 1 ${x - width / 2} ${y - height / 2})` - }, - h('polygon', { - ...style, - x, - y, - points - }), - h('path', { - d: - 'm 23,10 0,12.5 -12.5,0 0,5 12.5,0 0,12.5 5,0 0,-12.5 12.5,0 0,-5 -12.5,0 0,-12.5 -5,0 z', - ...style - }) - ) - } -} - -export default { - type: 'parallel', - view: ParallelView, - model: ParallelModel -}; diff --git a/src/components/WarmFlow/js/serial.js b/src/components/WarmFlow/js/serial.js deleted file mode 100644 index 7a9012c..0000000 --- a/src/components/WarmFlow/js/serial.js +++ /dev/null @@ -1,57 +0,0 @@ -import { h, PolygonNode, PolygonNodeModel } from '@logicflow/core' - -class SerialModel extends PolygonNodeModel { - static extendKey = 'SerialModel'; - constructor (data, graphModel) { - if (!data.text) { - data.text = '' - } - if (data.text && typeof data.text === 'string') { - data.text = { - value: data.text, - x: data.x, - y: data.y + 40 - } - } - super(data, graphModel) - this.points = [ - [25, 0], - [50, 25], - [25, 50], - [0, 25] - ] - } - -} - -class SerialView extends PolygonNode { - static extendKey = 'SerialNode'; - getShape () { - const { model } = this.props - const { x, y, width, height, points } = model - const style = model.getNodeStyle() - return h( - 'g', - { - transform: `matrix(1 0 0 1 ${x - width / 2} ${y - height / 2})` - }, - h('polygon', { - ...style, - x, - y, - points - }), - h('path', { - d: - 'm 16,15 7.42857142857143,9.714285714285715 -7.42857142857143,9.714285714285715 3.428571428571429,0 5.714285714285715,-7.464228571428572 5.714285714285715,7.464228571428572 3.428571428571429,0 -7.42857142857143,-9.714285714285715 7.42857142857143,-9.714285714285715 -3.428571428571429,0 -5.714285714285715,7.464228571428572 -5.714285714285715,-7.464228571428572 -3.428571428571429,0 z', - ...style - }) - ) - } -} - -export default { - type: 'serial', - view: SerialView, - model: SerialModel -}; diff --git a/src/components/WarmFlow/js/skip.js b/src/components/WarmFlow/js/skip.js deleted file mode 100644 index 4167f1b..0000000 --- a/src/components/WarmFlow/js/skip.js +++ /dev/null @@ -1,33 +0,0 @@ -import { PolylineEdge, PolylineEdgeModel } from "@logicflow/core"; - -class SkipModel extends PolylineEdgeModel { - setAttributes() { - this.offset = 20; - } - - getEdgeStyle() { - const style = super.getEdgeStyle(); - const { properties } = this; - if (properties.isActived) { - style.strokeDasharray = "4 4"; - } - return style; - } - - /** - * 重写此方法,使保存数据是能带上锚点数据。 - */ - getData() { - const data = super.getData(); - data.sourceAnchorId = this.sourceAnchorId; - data.targetAnchorId = this.targetAnchorId; - return data; - } - -} - -export default { - type: "skip", - view: PolylineEdge, - model: SkipModel, -}; diff --git a/src/components/WarmFlow/js/start.js b/src/components/WarmFlow/js/start.js deleted file mode 100644 index 71fc66e..0000000 --- a/src/components/WarmFlow/js/start.js +++ /dev/null @@ -1,17 +0,0 @@ -import { CircleNode, CircleNodeModel } from "@logicflow/core"; - -class StartModel extends CircleNodeModel { - - initNodeData(data) { - super.initNodeData(data); - this.r = 20 - } -} - -class StartView extends CircleNode {} - -export default { - type: "start", - model: StartModel, - view: StartView, -}; diff --git a/src/components/WarmFlow/js/tool.js b/src/components/WarmFlow/js/tool.js deleted file mode 100644 index 91d840e..0000000 --- a/src/components/WarmFlow/js/tool.js +++ /dev/null @@ -1,356 +0,0 @@ -/** - * 节点样式处理方法 - * @param _this - * @param style - * @returns {*} - */ -export const nodeStyleHandle = (_this, style) => { - if (_this.properties.status === "pass") { - style.stroke = "green"; - } else if (_this.properties.status === "reject") { - style.stroke = "#ffba00"; - } else if (_this.properties.status === "approval") { - style.stroke = "red"; - } else { - style.stroke = "#909399"; - } - return style -} - -/** - * 节点大小处理方法 - * @param _this - * @param style - * @returns {*} - */ -export const nodeSizeHandle = (_this) => { - _this.width = 120; - _this.height = 80; - _this.radius = 5; -} - -/** - * 节点大小处理方法 - * @param _this - * @param style - * @returns {*} - */ -export const skipText = (skipType) => { - let text = '' - if (skipType && skipType === 'PASS') { - text = '审批通过' - } else if (skipType && skipType === 'REJECT') { - text = '退回' - } - return text -} - - -/** - * 解析xml成Dom对象 - * @param {} xml - * @returns - */ -export const parseXml2Dom = (xml) => { - let xmlDoc = null - if (window.DOMParser) { - const parser = new DOMParser() - xmlDoc = parser.parseFromString(xml, 'text/xml') - } else { // Internet Explorer - // eslint-disable-next-line no-undef - xmlDoc = new ActiveXObject('Microsoft.XMLDOM') - xmlDoc.async = false - xmlDoc.loadXML(xml) - } - return xmlDoc -} - -// 节点标签 -const NODE_NAMES = ['start', 'between', 'serial', 'parallel', 'end'] -// 流程节点属性 -const DEFINITION_KEYS = ['flowCode', 'flowName', 'version', 'formCustom', 'formPath'] -// 节点属性 -const NODE_ATTR_KEYS = ['nodeType', 'nodeCode', 'nodeName', 'coordinate', 'nodeRatio', 'permissionFlag', "skipAnyNode" - , "listenerType", "listenerPath", "formCustom", "formPath"] -// 变迁节点属性 -const SKIP_ATTR_KEYS = ['skipName', 'skipType', 'coordinate', 'skipCondition'] - -/** - * 将warm-flow的定义文件转成LogicFlow支持的数据格式 - * @param {*} xml - * @returns - */ -export const snakerXml2LogicFlowJson = (xml) => { - const graphData = { - nodes: [], - edges: [] - } - const xmlDoc = parseXml2Dom(xml) - const definitionDom = xmlDoc.getElementsByTagName('definition') - if (!definitionDom.length) { - return graphData - } - let value = null - // 解析definition属性 - DEFINITION_KEYS.forEach(key => { - value = definitionDom[0].getAttribute(key) - if (value) { - graphData[key] = value - } - }) - let nodeEles = null - let node = null - let lfNode = {} - // 解析节点 - nodeEles = definitionDom[0].getElementsByTagName("node") - if (nodeEles.length) { - for (var i = 0, len = nodeEles.length; i < len; i++) { - node = nodeEles[i] - lfNode = { - text:{}, - properties: {} - } - // 处理节点 - NODE_ATTR_KEYS.forEach(attrKey => { - value = node.getAttribute(attrKey) - if (value) { - if (attrKey === 'nodeType') { - lfNode.type = value - } else if (attrKey === 'nodeCode') { - lfNode.id = value - } else if (attrKey === 'coordinate') { - const attr = value.split('|') - const nodeXy = attr[0].split(',') - lfNode.x = parseInt(nodeXy[0]) - lfNode.y = parseInt(nodeXy[1]) - if (attr.length === 2) { - const textXy = attr[1].split(',') - lfNode.text.x = parseInt(textXy[0]) - lfNode.text.y = parseInt(textXy[1]) - } - } else if (attrKey === 'nodeName') { - lfNode.text.value = value - } else { - lfNode.properties[attrKey] = value - } - } - }) - graphData.nodes.push(lfNode) - // 处理边 - let skipEles = null - let skipEle = null - let edge = {} - skipEles = node.getElementsByTagName('skip') - for (var j = 0, lenn = skipEles.length; j < lenn; j++) { - skipEle = skipEles[j] - edge = { - text: {}, - properties: {}, - } - edge.id = skipEle.getAttribute('id') - edge.type = 'skip' - edge.sourceNodeId = lfNode.id - edge.targetNodeId = skipEle.textContent - edge.text = { - value: skipEle.getAttribute('skipName') - } - edge.properties.skipCondition = skipEle.getAttribute('skipCondition') - edge.properties.skipName = skipEle.getAttribute('skipName') - edge.properties.skipType = skipEle.getAttribute('skipType') - const expr = skipEle.getAttribute('expr') - if (expr) { - edge.properties.expr = expr - } - const coordinate = skipEle.getAttribute('coordinate') - if (coordinate) { - const coordinateXy = coordinate.split('|') - edge.pointsList = [] - coordinateXy[0].split(';').forEach((item) => { - const pointArr = item.split(',') - edge.pointsList.push({ - x: parseInt(pointArr[0]), - y: parseInt(pointArr[1]) - }) - }) - edge.startPoint = edge.pointsList[0] - edge.endPoint = edge.pointsList[edge.pointsList.length - 1] - if (coordinateXy.length > 1) { - let textXy = coordinateXy[1].split(","); - edge.text.x = parseInt(textXy[0]) - edge.text.y = parseInt(textXy[1]) - } - } - graphData.edges.push(edge) - } - } - } - - return graphData -} - -/** - * 将LogicFlow的数据转成warm-flow的定义文件 - * @param {*} data(...definitionInfo,nodes,edges) - * @returns - */ -export const logicFlowJsonToFlowXml = (data) => { - let xml = '' - // data的数据由流程定义文件信息+logicFlow数据构成 - // 先构建成流程对象 - const definitionObj = { - flowCode: data.flowCode, // 流程定义编码 - flowName: data.flowName, // 流程定义名称 - version: data.version, // 流程定义版本号 - formCustom: data.formCustom, // 表单自定义 - formPath: data.formPath, // 表单自定义路径 - } - /** - * 获取开始节点 - * @returns - */ - const getStartNode = () => { - return data.nodes.find((node) => { - return node.type === 'start' - }) - } - /** - * 获取当前节点的所有下一个节点集合 - * @param {*} id 当前节点名称 - * @returns - */ - const getNextNodes = (id) => { - return data.edges.filter(edge => { - return edge.sourceNodeId === id - }).map(edge => { - return data.nodes.find((node) => { - return node.id === edge.targetNodeId - }) - }) - } - /** - * 获取节点所有跳转 - * @param {*} id - * @returns - */ - const getSkip = (id) => { - return data.edges.filter((edge) => { - return edge.sourceNodeId === id - }).map(edge => { - let coordinate = '' - for (let i = 0; i < edge.pointsList.length; i++) { - coordinate = coordinate + parseInt(edge.pointsList[i].x) + ',' + parseInt(edge.pointsList[i].y) - if (i !== edge.pointsList.length - 1) { - coordinate = coordinate + ';' - } - } - if (edge.text) { - coordinate = coordinate + '|' + parseInt(edge.text.x) + ',' + parseInt(edge.text.y) - } - return { - skipType: edge.properties.skipType, - skipCondition: edge.properties.skipCondition, - skipName: edge.properties.skipName, - textContent: edge.targetNodeId, // 目地节点id - coordinate: coordinate, - } - }) - } - /** - * 构建节点属性 - * @param {} node - * @returns - */ - const buildNode = (node) => { - let textXy = ''; - if (node.text) { - textXy = '|' + node.text.x + ',' + node.text.y; - } - return { - nodeType: node.type, - nodeCode: node.id, - nodeName: (node.text instanceof String || node.text === undefined) ? node.text : node.text.value, - permissionFlag: node.properties.permissionFlag, - nodeRatio: node.properties.nodeRatio, - skipAnyNode: node.properties.skipAnyNode, - listenerType: node.properties.listenerType, - listenerPath: node.properties.listenerPath, - coordinate: node.x + ',' + node.y + textXy, - skip: getSkip(node.id), - formCustom: node.properties.formCustom, - formPath: node.properties.formPath, - } - } - /** - * 特殊字符转义 - * @param {*} text - * @returns - */ - const textEncode = (text) => { - text = text.replace(/&/g, '&') - .replace(/"/g, '"') - .replace(//g, '>') - return text - } - /** - * 递归构建节点属性 - * @param {} node - */ - const recursionBuildNode = (node) => { - const nodeName = node.type - if (!definitionObj[nodeName + '_' + node.id]) { - definitionObj[nodeName + '_' + node.id] = buildNode(node) - const nextNodes = getNextNodes(node.id) - nextNodes.forEach(nextNode => { - recursionBuildNode(nextNode) - }) - } - } - const startNode = getStartNode() - if (!startNode) { - // 开始节点不存在,xml不合法 - return '' - } - recursionBuildNode(startNode) - xml = '\n' - xml += ' { - const value = definitionObj[key] - if (DEFINITION_KEYS.includes(key) && value) { - xml += ' ' + key + '=' + '"' + textEncode(value) + '"' - } - }) - xml += '>\n' - // 生成节点xml - Object.keys(definitionObj).forEach(key => { - const value = definitionObj[key] - let nodeName = key.split('_')[0] - if (NODE_NAMES.includes(nodeName)) { - xml += '\t { - if (NODE_ATTR_KEYS.includes(nodeAttrKey) && value[nodeAttrKey]) { - xml += ' ' + nodeAttrKey + '=' + '"' + textEncode(value[nodeAttrKey]) + '"' - } - }) - xml += '>\n\t' - // 构建skip - if (value.skip) { - value.skip.forEach(skip => { - xml += '\t { - if (SKIP_ATTR_KEYS.includes(skipAttrKey) && skip[skipAttrKey]) { - xml += ' ' + skipAttrKey + '=' + '"' + textEncode(skip[skipAttrKey]) + '"' - } - }) - xml += '>' - xml += skip['textContent'] + '\n' - }) - } - xml += '\t\n' - } - }) - xml += '' - return xml -} diff --git a/src/router/index.ts b/src/router/index.ts index 1d784f7..831b9b7 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -178,15 +178,15 @@ export const dynamicRoutes: RouteRecordRaw[] = [ ] }, { - path: '/workflow/modelDesign', + path: '/workflow/design', component: Layout, hidden: true, permissions: ['workflow:leave:edit'], children: [ { path: 'index', - component: () => import('@/views/workflow/processDefinition/modelDesign.vue'), - name: 'modelDesign', + component: () => import('@/views/workflow/processDefinition/design.vue'), + name: 'design', meta: { title: '请假申请', activeMenu: '/workflow/processDefinition', noCache: true } } ] diff --git a/src/views/workflow/leave/index.vue b/src/views/workflow/leave/index.vue index f413136..49c4d6a 100644 --- a/src/views/workflow/leave/index.vue +++ b/src/views/workflow/leave/index.vue @@ -59,7 +59,7 @@ @@ -261,11 +261,9 @@ - - - diff --git a/src/views/workflow/processInstance/index.vue b/src/views/workflow/processInstance/index.vue index ff23b7c..806ed60 100644 --- a/src/views/workflow/processInstance/index.vue +++ b/src/views/workflow/processInstance/index.vue @@ -133,11 +133,6 @@ - - -
@@ -151,7 +146,6 @@ import { deleteFinishAndHisInstance, deleteRunInstance } from '@/api/workflow/processInstance'; -import { migrationDefinition } from '@/api/workflow/definition'; import { listCategory } from '@/api/workflow/category'; import { CategoryVO } from '@/api/workflow/category/types'; import { ProcessInstanceQuery, ProcessInstanceVO } from '@/api/workflow/processInstance/types'; @@ -321,17 +315,6 @@ const handleInvalid = async (row: ProcessInstanceVO) => { const cancelPopover = async (index: any) => { (proxy?.$refs[`popoverRef${index}`] as any).hide(); //关闭弹窗 }; -//切换流程版本 -const handleChange = async (id: string) => { - await proxy?.$modal.confirm('是否确认切换?'); - loading.value = true; - migrationDefinition(processDefinitionId.value, id).then((resp) => { - proxy?.$modal.msgSuccess('操作成功'); - getProcessInstanceRunningList(); - processDefinitionDialog.visible = false; - loading.value = false; - }); -}; /** 查看按钮操作 */ const handleView = (row) => { const routerJumpVo = reactive({ diff --git a/src/views/workflow/task/allTaskWaiting.vue b/src/views/workflow/task/allTaskWaiting.vue index 01d4a06..89c5207 100644 --- a/src/views/workflow/task/allTaskWaiting.vue +++ b/src/views/workflow/task/allTaskWaiting.vue @@ -262,7 +262,7 @@ const handleView = (row) => { const routerJumpVo = reactive({ wfDefinitionConfigVo: row.wfDefinitionConfigVo, wfNodeConfigVo: row.wfNodeConfigVo, - businessKey: row.businessKey, + businessKey: row.businessId, taskId: row.id, type: 'view' }); From d8df0dbc1f0fdbb10569852f64cb4c203911cd60 Mon Sep 17 00:00:00 2001 From: gssong <1742057357@qq.com> Date: Sat, 26 Oct 2024 19:52:34 +0800 Subject: [PATCH 27/88] =?UTF-8?q?add=20=E6=B7=BB=E5=8A=A0=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/workflow/definition/index.ts | 15 ++- src/api/workflow/definition/types.ts | 8 +- .../workflow/processDefinition/index.vue | 105 ++++++++++++++++-- 3 files changed, 115 insertions(+), 13 deletions(-) diff --git a/src/api/workflow/definition/index.ts b/src/api/workflow/definition/index.ts index 9dcf8ba..03031a4 100644 --- a/src/api/workflow/definition/index.ts +++ b/src/api/workflow/definition/index.ts @@ -1,5 +1,5 @@ import request from '@/utils/request'; -import { definitionQuery, definitionVO, definitionXmlVO } from '@/api/workflow/definition/types'; +import { definitionQuery, definitionVO, definitionXmlVO, FlowDefinitionForm } from '@/api/workflow/definition/types'; import { AxiosPromise } from 'axios'; /** @@ -112,3 +112,16 @@ export const xmlString = (id: string) => { method: 'get' }); }; + +/** + * 新增 + * @param data 参数 + * @returns + */ +export const add = (data: FlowDefinitionForm) => { + return request({ + url: `/workflow/definition`, + method: 'post', + data: data + }); +}; diff --git a/src/api/workflow/definition/types.ts b/src/api/workflow/definition/types.ts index d30cb25..d04d949 100644 --- a/src/api/workflow/definition/types.ts +++ b/src/api/workflow/definition/types.ts @@ -1,5 +1,5 @@ import { DefinitionConfigVO } from '@/api/workflow/definitionConfig/types'; -export interface ProcessDefinitionQuery extends PageQuery { +export interface FlowDefinitionQuery extends PageQuery { key?: string; name?: string; categoryCode?: string; @@ -18,6 +18,12 @@ export interface FlowDefinitionVo extends BaseEntity { wfDefinitionConfigVo: DefinitionConfigVO; } +export interface FlowDefinitionForm { + flowName: string; + flowCode: string; + category: string; +} + export interface definitionXmlVO { xml: string[]; xmlStr: string; diff --git a/src/views/workflow/processDefinition/index.vue b/src/views/workflow/processDefinition/index.vue index ffb6ad5..18b92fc 100644 --- a/src/views/workflow/processDefinition/index.vue +++ b/src/views/workflow/processDefinition/index.vue @@ -41,6 +41,9 @@ - + @@ -255,6 +268,36 @@
+ + + + + @@ -267,13 +310,14 @@ import { importDefinition, getHisListByKey, publish, - unPublish + unPublish, + add } from '@/api/workflow/definition'; import { getByTableNameNotDefId, getByDefId, saveOrUpdate } from '@/api/workflow/definitionConfig'; import ProcessPreview from './components/processPreview.vue'; import { listCategory } from '@/api/workflow/category'; import { CategoryVO } from '@/api/workflow/category/types'; -import { ProcessDefinitionQuery, FlowDefinitionVo } from '@/api/workflow/definition/types'; +import { FlowDefinitionQuery, FlowDefinitionVo, FlowDefinitionForm } from '@/api/workflow/definition/types'; import { DefinitionConfigForm } from '@/api/workflow/definitionConfig/types'; import { UploadRequestOptions, ElMessage, ElMessageBox } from 'element-plus'; @@ -303,9 +347,9 @@ const processDefinitionList = ref([]); const processDefinitionHistoryList = ref([]); const categoryOptions = ref([]); const categoryName = ref(''); -const disabled = ref(true); /** 部署文件分类选择 */ const selectCategory = ref(); +const defFormRef = ref(); const uploadDialog = reactive({ visible: false, @@ -322,16 +366,30 @@ const definitionConfigDialog = reactive({ title: '流程定义配置' }); +const modelDialog = reactive({ + visible: false, + title: '新增流程' +}); + // 查询参数 -const queryParams = ref({ +const queryParams = ref({ pageNum: 1, pageSize: 10, name: undefined, key: undefined, - categoryCode: undefined, - isPublish: 1 + categoryCode: undefined +}); +const rules = { + category: [{ required: true, message: '分类名称不能为空', trigger: 'blur' }], + flowName: [{ required: true, message: '流程定义名称不能为空', trigger: 'blur' }], + flowCode: [{ required: true, message: '流程定义编码不能为空', trigger: 'blur' }] +}; +//新增流程定义参数 +const form = ref({ + flowName: '', + flowCode: '', + category: '' }); - onMounted(() => { getList(); getTreeselect(); @@ -449,6 +507,7 @@ const handleUnPublish = async (row?: FlowDefinitionVo) => { loading.value = true; await unPublish(row.id).finally(() => (loading.value = false)); await getList(); + processDefinitionDialog.visible = false; proxy?.$modal.msgSuccess('取消发布成功'); }; /** 挂起/激活 */ @@ -536,6 +595,10 @@ const handlerSaveForm = async () => { } }); }; +/** + * 设计流程 + * @param row + */ const design = async (row: FlowDefinitionVo) => { proxy.$router.push({ path: `/workflow/design/index`, @@ -544,4 +607,24 @@ const design = async (row: FlowDefinitionVo) => { } }); }; +/** + * 新增 + */ +const handleAdd = async () => { + modelDialog.visible = true; +}; +//保存 +const handleAddSubmit = async () => { + defFormRef.value.validate(async (valid: boolean) => { + if (valid) { + add(form.value).then((resp) => { + if (resp.code === 200) { + proxy?.$modal.msgSuccess('操作成功'); + modelDialog.visible = false; + getList(); + } + }); + } + }); +}; From d678c54b1adfc5681afc1f92ee7eaea8dec1a53d Mon Sep 17 00:00:00 2001 From: gssong <1742057357@qq.com> Date: Sun, 27 Oct 2024 13:21:01 +0800 Subject: [PATCH 28/88] =?UTF-8?q?update=20=E8=B0=83=E6=95=B4=E5=8A=9E?= =?UTF-8?q?=E7=90=86=20=E9=A9=B3=E5=9B=9E=20=E7=BB=88=E6=AD=A2=E7=AD=89?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Process/approvalRecord.vue | 8 ++++++-- src/components/Process/submitVerify.vue | 19 ++++++++++++------- src/views/workflow/leave/index.vue | 11 ++--------- src/views/workflow/leave/leaveEdit.vue | 8 ++++---- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/components/Process/approvalRecord.vue b/src/components/Process/approvalRecord.vue index d2417f2..dec8ec3 100644 --- a/src/components/Process/approvalRecord.vue +++ b/src/components/Process/approvalRecord.vue @@ -15,10 +15,14 @@ {{ scope.row.approveName || '无' }}
+ + + - - - + + - + diff --git a/src/views/workflow/task/myDocument.vue b/src/views/workflow/task/myDocument.vue index 6cead1a..fe38a77 100644 --- a/src/views/workflow/task/myDocument.vue +++ b/src/views/workflow/task/myDocument.vue @@ -49,7 +49,7 @@ - + - + + + - + @@ -56,31 +56,36 @@ - + @@ -225,7 +230,11 @@ const handleExport = () => { const handleCancelProcessApply = async (id: string) => { await proxy?.$modal.confirm('是否确认撤销当前单据?'); loading.value = true; - await cancelProcessApply(id).finally(() => (loading.value = false)); + let data = { + businessId:id, + message:'撤销流程!' + } + await cancelProcessApply(data).finally(() => (loading.value = false)); await getList(); proxy?.$modal.msgSuccess('撤销成功'); }; diff --git a/src/views/workflow/task/allTaskWaiting.vue b/src/views/workflow/task/allTaskWaiting.vue index 5e88dd1..7c47090 100644 --- a/src/views/workflow/task/allTaskWaiting.vue +++ b/src/views/workflow/task/allTaskWaiting.vue @@ -70,6 +70,11 @@ + + + - +
@@ -226,11 +222,15 @@ const handleDelete = async (row: ProcessInstanceVO) => { }; /** 撤销按钮操作 */ -const handleCancelProcessApply = async (businessKey: string) => { +const handleCancelProcessApply = async (businessId: string) => { await proxy?.$modal.confirm('是否确认撤销当前单据?'); loading.value = true; if ('running' === tab.value) { - await cancelProcessApply(businessKey).finally(() => (loading.value = false)); + let data = { + businessId:businessId, + message:'撤销流程!' + } + await cancelProcessApply(data).finally(() => (loading.value = false)); getList(); } proxy?.$modal.msgSuccess('撤销成功'); diff --git a/src/views/workflow/task/taskFinish.vue b/src/views/workflow/task/taskFinish.vue index 52013c8..cdd2017 100644 --- a/src/views/workflow/task/taskFinish.vue +++ b/src/views/workflow/task/taskFinish.vue @@ -45,6 +45,16 @@ + + + + + + @@ -144,13 +163,16 @@ import { getPageByFinish, deleteRunAndHisInstance, deleteFinishAndHisInstance, - deleteRunInstance + deleteRunInstance, + getInstanceVariable } from '@/api/workflow/processInstance'; import { listCategory } from '@/api/workflow/category'; import { CategoryVO } from '@/api/workflow/category/types'; import { ProcessInstanceQuery, ProcessInstanceVO } from '@/api/workflow/processInstance/types'; import workflowCommon from '@/api/workflow/workflowCommon'; import { RouterJumpVo } from '@/api/workflow/workflowCommon/types'; +import VueJsonPretty from 'vue-json-pretty'; +import 'vue-json-pretty/lib/styles.css'; //审批记录组件 const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { wf_business_status } = toRefs(proxy?.useDict('wf_business_status')); @@ -171,8 +193,13 @@ const multiple = ref(true); const showSearch = ref(true); // 总条数 const total = ref(0); -// 流程定义id -const processDefinitionId = ref(''); + +// 流程变量是否显示 +const variableVisible = ref(false); +const variableLoading = ref(true); +const variables = ref('') +//流程定义名称 +const processDefinitionName = ref(); // 模型定义表格数据 const processInstanceList = ref([]); const processDefinitionHistoryList = ref>([]); @@ -327,6 +354,27 @@ const handleView = (row) => { workflowCommon.routerJump(routerJumpVo, proxy); }; +//查询流程变量 +const handleInstanceVariable = async (row: ProcessInstanceVO) => { + variableLoading.value = true; + variableVisible.value = true; + processDefinitionName.value = row.flowName; + let data = await getInstanceVariable(row.id); + variables.value = data.data.variable; + variableLoading.value = false; +}; + +/** + * json转为对象 + * @param data 原始数据 + */ + function formatToJsonObject(data: string) { + try { + return JSON.parse(data); + } catch (error) { + return data; + } +} onMounted(() => { getProcessInstanceRunningList(); getTreeselect(); diff --git a/src/views/workflow/task/allTaskWaiting.vue b/src/views/workflow/task/allTaskWaiting.vue index 7c47090..853dcfa 100644 --- a/src/views/workflow/task/allTaskWaiting.vue +++ b/src/views/workflow/task/allTaskWaiting.vue @@ -80,18 +80,15 @@ @@ -109,32 +106,11 @@ - - - - -
- - - {{ v.value }} - - -
-
-
- diff --git a/src/components/Process/submitVerify.vue b/src/components/Process/submitVerify.vue index 4f05f75..d5db922 100644 --- a/src/components/Process/submitVerify.vue +++ b/src/components/Process/submitVerify.vue @@ -27,14 +27,19 @@ 委托 转办 加签 - + 减签 终止 @@ -171,9 +176,6 @@ const backForm = ref>({ variables: {}, messageType: ['1'] }); -const closeDialog = () => { - dialog.visible = false; -}; //打开弹窗 const openDialog = (id?: string) => { selectCopyUserIds.value = undefined; @@ -317,10 +319,12 @@ const deleteMultiInstanceUser = async (row) => { message: form.value.message }); await taskOperation(taskOperationBo, 'reductionSignature').finally(() => { - dialog.visible = false; - emits('submitCallback'); - proxy?.$modal.msgSuccess('操作成功'); + loading.value = false; + buttonDisabled.value = false; }); + dialog.visible = false; + emits('submitCallback'); + proxy?.$modal.msgSuccess('操作成功'); }; //打开转办 const openTransferTask = () => { From a9cd07785dd37122dc0fc4adc80768c658c157da Mon Sep 17 00:00:00 2001 From: gssong <1742057357@qq.com> Date: Sun, 8 Dec 2024 15:02:33 +0800 Subject: [PATCH 45/88] =?UTF-8?q?add=20=E6=B7=BB=E5=8A=A0=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E5=B9=B2=E9=A2=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/workflow/processInstance/index.ts | 64 +---- src/api/workflow/processInstance/types.ts | 7 +- src/api/workflow/task/index.ts | 64 +---- src/api/workflow/task/types.ts | 3 +- src/components/Process/approvalRecord.vue | 9 +- src/components/Process/processMeddle.vue | 237 +++++++++++++++++++ src/views/workflow/processInstance/index.vue | 48 ++-- src/views/workflow/task/allTaskWaiting.vue | 43 +--- 8 files changed, 299 insertions(+), 176 deletions(-) create mode 100644 src/components/Process/processMeddle.vue diff --git a/src/api/workflow/processInstance/index.ts b/src/api/workflow/processInstance/index.ts index ec9c675..cd8a7e5 100644 --- a/src/api/workflow/processInstance/index.ts +++ b/src/api/workflow/processInstance/index.ts @@ -38,53 +38,6 @@ export const getFlowImage = (businessKey: string | number) => { }); }; -/** - * 通过业务id获取历史流程图运行中,历史等节点 - */ -export const getHistoryList = (businessKey: string): AxiosPromise> => { - return request({ - url: `/workflow/processInstance/getHistoryList/${businessKey}` + '?t' + Math.random(), - method: 'get' - }); -}; - -/** - * 作废 - * @param data 参数 - * @returns - */ -export const deleteRunInstance = (data: object) => { - return request({ - url: `/workflow/processInstance/deleteRunInstance`, - method: 'post', - data: data - }); -}; - -/** - * 运行中的实例 删除程实例,删除历史记录,删除业务与流程关联信息 - * @param businessKey 业务id - * @returns - */ -export const deleteRunAndHisInstance = (businessKey: string | string[]) => { - return request({ - url: `/workflow/processInstance/deleteRunAndHisInstance/${businessKey}`, - method: 'delete' - }); -}; - -/** - * 已完成的实例 删除程实例,删除历史记录,删除业务与流程关联信息 - * @param businessKey 业务id - * @returns - */ -export const deleteFinishAndHisInstance = (businessKey: string | string[]) => { - return request({ - url: `/workflow/processInstance/deleteFinishAndHisInstance/${businessKey}`, - method: 'delete' - }); -}; - /** * 分页查询当前登录人单据 * @param query @@ -122,14 +75,23 @@ export const getInstanceVariable = (instanceId: string) => { method: 'get' }); }; + +/** + * 删除 + * @param instanceIds 流程实例id + * @returns + */ +export const deleteByInstanceIds = (instanceIds: Array | string | number) => { + return request({ + url: `/workflow/processInstance/deleteByInstanceIds/${instanceIds}`, + method: 'delete' + }); +}; + export default { getPageByRunning, getPageByFinish, getFlowImage, - getHistoryList, - deleteRunInstance, - deleteRunAndHisInstance, - deleteFinishAndHisInstance, getPageByCurrent, cancelProcessApply }; diff --git a/src/api/workflow/processInstance/types.ts b/src/api/workflow/processInstance/types.ts index 3f0ac69..33eadff 100644 --- a/src/api/workflow/processInstance/types.ts +++ b/src/api/workflow/processInstance/types.ts @@ -1,14 +1,15 @@ import { FlowTaskVO } from '@/api/workflow/task/types'; -export interface ProcessInstanceQuery extends PageQuery { +export interface FlowInstanceQuery extends PageQuery { categoryCode?: string; flowCode?: string; + flowName?: string; createBy?: string; businessId?: string; } -export interface ProcessInstanceVO extends BaseEntity { - id: string; +export interface FlowInstanceVO extends BaseEntity { + id: string | number; definitionId: string; flowName: string; flowCode: string; diff --git a/src/api/workflow/task/index.ts b/src/api/workflow/task/index.ts index 0aac90a..25441a4 100644 --- a/src/api/workflow/task/index.ts +++ b/src/api/workflow/task/index.ts @@ -93,30 +93,6 @@ export const completeTask = (data: object) => { }); }; -/** - * 认领任务 - * @param taskId - * @returns {*} - */ -export const claim = (taskId: string): any => { - return request({ - url: '/workflow/task/claim/' + taskId, - method: 'post' - }); -}; - -/** - * 归还任务 - * @param taskId - * @returns {*} - */ -export const returnTask = (taskId: string): any => { - return request({ - url: '/workflow/task/returnTask/' + taskId, - method: 'post' - }); -}; - /** * 任务驳回 * @param data @@ -142,32 +118,6 @@ export const getTaskById = (taskId: string) => { }); }; -/** - * 加签 - * @param data - * @returns - */ -export const addMultiInstanceExecution = (data: any) => { - return request({ - url: '/workflow/task/addMultiInstanceExecution', - method: 'post', - data: data - }); -}; - -/** - * 减签 - * @param data - * @returns - */ -export const deleteMultiInstanceExecution = (data: any) => { - return request({ - url: '/workflow/task/deleteMultiInstanceExecution', - method: 'post', - data: data - }); -}; - /** * 修改任务办理人 * @param taskIds @@ -182,18 +132,6 @@ export const updateAssignee = (taskIdList: Array, userId: string) => { }); }; -/** - * 转办任务 - * @returns - */ -export const transferTask = (data: any) => { - return request({ - url: `/workflow/task/transferTask`, - method: 'post', - data: data - }); -}; - /** * 终止任务 * @returns @@ -281,7 +219,7 @@ export const taskOperation = (data: TaskOperationBo, operation: string) => { * @param taskId 任务id * @returns */ -export const getUserListTaskId = (taskId: string) => { +export const getUserListTaskId = (taskId: string | number) => { return request({ url: `/workflow/task/getUserListTaskId/${taskId}`, method: 'get' diff --git a/src/api/workflow/task/types.ts b/src/api/workflow/task/types.ts index 612cddb..ee869c4 100644 --- a/src/api/workflow/task/types.ts +++ b/src/api/workflow/task/types.ts @@ -27,6 +27,7 @@ export interface FlowTaskVO { flowStatus: string; nodeType: number; nodeRatio: string | number; + version?: string; wfNodeConfigVo?: NodeConfigVO; wfDefinitionConfigVo?: DefinitionConfigVO; } @@ -42,7 +43,7 @@ export interface TaskOperationBo { //加签/减签人的用户ID列表(必填,针对加签/减签操作) userIds?: string[]; //任务ID(必填) - taskId: string; + taskId: string | number; //意见或备注信息(可选) message?: string; } diff --git a/src/components/Process/approvalRecord.vue b/src/components/Process/approvalRecord.vue index 22dd00a..6d5d0c1 100644 --- a/src/components/Process/approvalRecord.vue +++ b/src/components/Process/approvalRecord.vue @@ -23,7 +23,14 @@ - + - - diff --git a/src/bpmn/panel/GatewayPanel.vue b/src/bpmn/panel/GatewayPanel.vue deleted file mode 100644 index 20cc134..0000000 --- a/src/bpmn/panel/GatewayPanel.vue +++ /dev/null @@ -1,68 +0,0 @@ - - - - diff --git a/src/bpmn/panel/ParticipantPanel.vue b/src/bpmn/panel/ParticipantPanel.vue deleted file mode 100644 index b1d42e6..0000000 --- a/src/bpmn/panel/ParticipantPanel.vue +++ /dev/null @@ -1,68 +0,0 @@ - - - - diff --git a/src/bpmn/panel/ProcessPanel.vue b/src/bpmn/panel/ProcessPanel.vue deleted file mode 100644 index 9e118e2..0000000 --- a/src/bpmn/panel/ProcessPanel.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - - - diff --git a/src/bpmn/panel/SequenceFlowPanel.vue b/src/bpmn/panel/SequenceFlowPanel.vue deleted file mode 100644 index eac8227..0000000 --- a/src/bpmn/panel/SequenceFlowPanel.vue +++ /dev/null @@ -1,95 +0,0 @@ - - - - diff --git a/src/bpmn/panel/StartEndPanel.vue b/src/bpmn/panel/StartEndPanel.vue deleted file mode 100644 index bde1212..0000000 --- a/src/bpmn/panel/StartEndPanel.vue +++ /dev/null @@ -1,67 +0,0 @@ - - - - diff --git a/src/bpmn/panel/SubProcessPanel.vue b/src/bpmn/panel/SubProcessPanel.vue deleted file mode 100644 index 3490fff..0000000 --- a/src/bpmn/panel/SubProcessPanel.vue +++ /dev/null @@ -1,193 +0,0 @@ - - - - diff --git a/src/bpmn/panel/TaskPanel.vue b/src/bpmn/panel/TaskPanel.vue deleted file mode 100644 index a42de8a..0000000 --- a/src/bpmn/panel/TaskPanel.vue +++ /dev/null @@ -1,491 +0,0 @@ - - - - diff --git a/src/bpmn/panel/index.vue b/src/bpmn/panel/index.vue deleted file mode 100644 index 445571a..0000000 --- a/src/bpmn/panel/index.vue +++ /dev/null @@ -1,110 +0,0 @@ - - - - diff --git a/src/bpmn/panel/property/DueDate.vue b/src/bpmn/panel/property/DueDate.vue deleted file mode 100644 index 882766b..0000000 --- a/src/bpmn/panel/property/DueDate.vue +++ /dev/null @@ -1,252 +0,0 @@ - - - diff --git a/src/bpmn/panel/property/ExecutionListener.vue b/src/bpmn/panel/property/ExecutionListener.vue deleted file mode 100644 index 3c584cb..0000000 --- a/src/bpmn/panel/property/ExecutionListener.vue +++ /dev/null @@ -1,308 +0,0 @@ - - - - diff --git a/src/bpmn/panel/property/ListenerParam.vue b/src/bpmn/panel/property/ListenerParam.vue deleted file mode 100644 index 21c6de1..0000000 --- a/src/bpmn/panel/property/ListenerParam.vue +++ /dev/null @@ -1,121 +0,0 @@ - - - - - diff --git a/src/bpmn/panel/property/TaskListener.vue b/src/bpmn/panel/property/TaskListener.vue deleted file mode 100644 index 9a32c47..0000000 --- a/src/bpmn/panel/property/TaskListener.vue +++ /dev/null @@ -1,310 +0,0 @@ - - - - diff --git a/src/components/BpmnDesign/index.vue b/src/components/BpmnDesign/index.vue deleted file mode 100644 index 1f84516..0000000 --- a/src/components/BpmnDesign/index.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - - - diff --git a/src/components/BpmnView/index.vue b/src/components/BpmnView/index.vue deleted file mode 100644 index 845d41e..0000000 --- a/src/components/BpmnView/index.vue +++ /dev/null @@ -1,411 +0,0 @@ - - - - - diff --git a/src/enums/bpmn/IndexEnums.ts b/src/enums/bpmn/IndexEnums.ts deleted file mode 100644 index 8c39823..0000000 --- a/src/enums/bpmn/IndexEnums.ts +++ /dev/null @@ -1,17 +0,0 @@ -export enum AllocationTypeEnum { - USER = 'user', - CANDIDATE = 'candidate', - YOURSELF = 'yourself', - SPECIFY = 'specify' -} - -export enum SpecifyDescEnum { - SPECIFY_MULTIPLE = 'specifyMultiple', - SPECIFY_SINGLE = 'specifySingle' -} - -export enum MultiInstanceTypeEnum { - SERIAL = 'serial', - PARALLEL = 'parallel', - NONE = 'none' -} diff --git a/src/types/bpmn/editor/global.d.ts b/src/types/bpmn/editor/global.d.ts deleted file mode 100644 index 1b9a634..0000000 --- a/src/types/bpmn/editor/global.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { MessageApiInjection } from 'naive-ui/lib/message/src/MessageProvider'; - -declare global { - interface Window { - bpmnInstances: any; - __messageBox: MessageApiInjection; - URL: any; - } -} - -declare interface Window { - bpmnInstances: any; -} diff --git a/src/types/bpmn/index.d.ts b/src/types/bpmn/index.d.ts deleted file mode 100644 index f8e8d15..0000000 --- a/src/types/bpmn/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -declare module 'bpmn' { - import type modeler from 'bpmn-js/lib/Modeler'; - import type modeling from 'bpmn-js/lib/features/modeling/Modeling'; - import type canvas from 'diagram-js/lib/core/Canvas'; - import type elementRegistry from 'diagram-js/lib/core/ElementRegistry'; - import type bpmnFactory from 'bpmn-js/lib/features/modeling/BpmnFactory'; - - export type Modeler = modeler; - export type Modeling = modeling; - export type Canvas = canvas; - export type ElementRegistry = elementRegistry; - export type Moddle = import('moddle').Moddle; - export type ModdleElement = import('moddle').ModdleElement; - export type BpmnFactory = bpmnFactory; -} diff --git a/src/types/bpmn/moddle.d.ts b/src/types/bpmn/moddle.d.ts deleted file mode 100644 index 1ed7933..0000000 --- a/src/types/bpmn/moddle.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -declare module 'moddle' { - import type { Element as element } from 'bpmn-js/lib/model/Types'; - - export type Element = { - get(name: string): T; - - set(name: string, value: any): void; - } & element; - - export interface ModdleElement extends Element { - $model: Moddle; - readonly $type: string; - $attrs: object | {}; - $parent: any; - businessObject: ModdleElement; - type: string; - - [field: string]: any; - - hasType(element: ModdleElement, type?: string): boolean; - } - - export interface Package { - name: string; - prefix: string; - } - - export interface Moddle { - typeCache: Record; - - getPackage: typeof Registry.prototype.getPackage; - - getPackages: typeof Registry.prototype.getPackages; - - create(type: string, attrs?: any): ModdleElement; - } -} diff --git a/src/types/bpmn/panel.d.ts b/src/types/bpmn/panel.d.ts deleted file mode 100644 index 3179261..0000000 --- a/src/types/bpmn/panel.d.ts +++ /dev/null @@ -1,92 +0,0 @@ -declare module 'bpmnDesign' { - import { AllocationTypeEnum, SpecifyDescEnum, MultiInstanceTypeEnum } from '@/enums/bpmn/IndexEnums'; - - export interface ParamVO { - type: string; - name: string; - value: string; - } - - export interface TaskListenerVO { - event: string; - type: string; - name: string; - className: string; - params: ParamVO[]; - } - - export interface ExecutionListenerVO { - event: string; - type: string; - className: string; - params: ParamVO[]; - } - - interface BasePanel { - id: string; - name: string; - } - export interface ProcessPanel extends BasePanel {} - - export interface TaskPanel extends BasePanel { - allocationType: AllocationTypeEnum; - specifyDesc: SpecifyDescEnum; - multiInstanceType: MultiInstanceTypeEnum; - async?: boolean; - priority?: number; - formKey?: string; - skipExpression?: string; - isForCompensation?: boolean; - triggerServiceTask?: boolean; - autoStoreVariables?: boolean; - ruleVariablesInput?: string; - excludeTaskListener?: boolean; - exclude?: boolean; - class?: string; - dueDate?: string; - fixedAssignee?: string; - - candidateUsers?: string; - assignee?: string; - candidateGroups?: string; - collection?: string; - elementVariable?: string; - completionCondition?: string; - isSequential?: boolean; - - loopCharacteristics?: { - collection: string; - elementVariable: string; - isSequential: boolean; - completionCondition: { - body: string; - }; - }; - } - - export interface StartEndPanel extends BasePanel {} - export interface GatewayPanel extends BasePanel {} - export interface SequenceFlowPanel extends BasePanel { - conditionExpression: { - body: string; - }; - conditionExpressionValue: string; - skipExpression: string; - } - - export interface ParticipantPanel extends BasePanel {} - export interface SubProcessPanel extends BasePanel { - multiInstanceType: MultiInstanceTypeEnum; - collection?: string; - elementVariable?: string; - completionCondition?: string; - loopCharacteristics?: { - collection: string; - elementVariable: string; - isSequential: boolean; - completionCondition: { - body: string; - }; - }; - } -} From 5ecb871a51cea53670bbe4eb454a7e45ca909c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Wed, 11 Dec 2024 16:25:47 +0800 Subject: [PATCH 50/88] =?UTF-8?q?remove=20=E5=88=A0=E9=99=A4=20bpmn.js=20?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/modeler.ts | 76 ---- src/views/workflow/formManage/index.vue | 243 ----------- src/views/workflow/model/index.vue | 383 ------------------ .../components/processPreview.vue | 45 -- vite.config.ts | 10 - 5 files changed, 757 deletions(-) delete mode 100644 src/store/modules/modeler.ts delete mode 100644 src/views/workflow/formManage/index.vue delete mode 100644 src/views/workflow/model/index.vue delete mode 100644 src/views/workflow/processDefinition/components/processPreview.vue diff --git a/src/store/modules/modeler.ts b/src/store/modules/modeler.ts deleted file mode 100644 index 204f450..0000000 --- a/src/store/modules/modeler.ts +++ /dev/null @@ -1,76 +0,0 @@ -import type { Modeler, Modeling, Canvas, ElementRegistry, Moddle, BpmnFactory } from 'bpmn'; - -type ModelerStore = { - modeler: Modeler | undefined; - moddle: Moddle | undefined; - modeling: Modeling | undefined; - canvas: Canvas | undefined; - elementRegistry: ElementRegistry | undefined; - bpmnFactory: BpmnFactory | undefined; - // 流程定义根节点信息 - procDefId: string | undefined; - procDefName: string | undefined; -}; - -const defaultState: ModelerStore = { - modeler: undefined, - moddle: undefined, - modeling: undefined, - canvas: undefined, - elementRegistry: undefined, - bpmnFactory: undefined, - procDefId: undefined, - procDefName: undefined -}; -export const useModelerStore = defineStore('modeler', () => { - let modeler = defaultState.modeler; - let moddle = defaultState.moddle; - let modeling = defaultState.modeling; - let canvas = defaultState.canvas; - let elementRegistry = defaultState.elementRegistry; - let bpmnFactory = defaultState.bpmnFactory; - const procDefId = ref(defaultState.procDefId); - const procDefName = ref(defaultState.procDefName); - - const getModeler = () => modeler; - const getModdle = () => moddle; - const getModeling = (): Modeling | undefined => modeling; - const getCanvas = (): Canvas | undefined => canvas; - const getElRegistry = (): ElementRegistry | undefined => elementRegistry; - const getBpmnFactory = (): BpmnFactory | undefined => bpmnFactory; - const getProcDefId = (): string | undefined => procDefId.value; - const getProcDefName = (): string | undefined => procDefName.value; - - // 设置根节点 - const setModeler = (modelers: Modeler | undefined) => { - if (modelers) { - modeler = modelers; - modeling = modelers.get('modeling'); - moddle = modelers.get('moddle'); - canvas = modelers.get('canvas'); - bpmnFactory = modelers.get('bpmnFactory'); - elementRegistry = modelers.get('elementRegistry'); - } else { - modeling = moddle = canvas = elementRegistry = bpmnFactory = undefined; - } - }; - // 设置流程定义根节点信息 - const setProcDef = (modeler: Modeler | undefined) => { - procDefId.value = modeler.get('canvas').getRootElement().businessObject.get('id'); - procDefName.value = modeler.get('canvas').getRootElement().businessObject.get('name'); - }; - - return { - getModeler, - getModdle, - getModeling, - getCanvas, - getElRegistry, - getBpmnFactory, - getProcDefId, - getProcDefName, - setModeler, - setProcDef - }; -}); -export default useModelerStore; diff --git a/src/views/workflow/formManage/index.vue b/src/views/workflow/formManage/index.vue deleted file mode 100644 index e77fd75..0000000 --- a/src/views/workflow/formManage/index.vue +++ /dev/null @@ -1,243 +0,0 @@ - - - diff --git a/src/views/workflow/model/index.vue b/src/views/workflow/model/index.vue deleted file mode 100644 index 86249bb..0000000 --- a/src/views/workflow/model/index.vue +++ /dev/null @@ -1,383 +0,0 @@ - - - diff --git a/src/views/workflow/processDefinition/components/processPreview.vue b/src/views/workflow/processDefinition/components/processPreview.vue deleted file mode 100644 index 19a95df..0000000 --- a/src/views/workflow/processDefinition/components/processPreview.vue +++ /dev/null @@ -1,45 +0,0 @@ - - - diff --git a/vite.config.ts b/vite.config.ts index 97c8d9d..e125e36 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -64,16 +64,6 @@ export default defineConfig(({ mode, command }: ConfigEnv): UserConfig => { 'echarts', 'vue-i18n', '@vueup/vue-quill', - 'bpmn-js/lib/Viewer', - 'bpmn-js/lib/Modeler.js', - 'bpmn-js-properties-panel', - 'min-dash', - 'diagram-js/lib/navigation/movecanvas', - 'diagram-js/lib/navigation/zoomscroll', - 'bpmn-js/lib/features/palette/PaletteProvider', - 'bpmn-js/lib/features/context-pad/ContextPadProvider', - 'diagram-js/lib/draw/BaseRenderer', - 'tiny-svg', 'image-conversion', 'element-plus/es/components/**/css' ] From f5415e80d6aef8bf32781dad8578f26b1535161f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Wed, 11 Dec 2024 16:27:31 +0800 Subject: [PATCH 51/88] =?UTF-8?q?remove=20=E5=88=A0=E9=99=A4=20bpmn.js=20?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/styles/variables.module.scss | 10 ---------- src/components/Process/approvalRecord.vue | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/assets/styles/variables.module.scss b/src/assets/styles/variables.module.scss index 36a8df6..e7d66cd 100644 --- a/src/assets/styles/variables.module.scss +++ b/src/assets/styles/variables.module.scss @@ -14,11 +14,6 @@ --tableHeaderBg: #f8f8f9; --tableHeaderTextColor: #515a6e; - // 工作流 - --bpmn-panel-border: #eeeeee; - --bpmn-panel-box-shadow: #cccccc; - --bpmn-panel-bar-background-color: #f5f7fa; - // ele --brder-color: #e8e8e8; } @@ -54,11 +49,6 @@ html.dark { --vxe-table-border-color: #37373a; --vxe-toolbar-background-color: #37373a; - // 工作流 - --bpmn-panel-border: #37373a; - --bpmn-panel-box-shadow: #37373a; - --bpmn-panel-bar-background-color: #37373a; - // ele --brder-color: #37373a; } diff --git a/src/components/Process/approvalRecord.vue b/src/components/Process/approvalRecord.vue index 17e166d..837b3b7 100644 --- a/src/components/Process/approvalRecord.vue +++ b/src/components/Process/approvalRecord.vue @@ -56,7 +56,7 @@ From 3fb12ad758a0c7e3c734f8880ac0b6ee919c7c60 Mon Sep 17 00:00:00 2001 From: liyang Date: Fri, 13 Dec 2024 16:37:02 +0800 Subject: [PATCH 57/88] =?UTF-8?q?=E9=99=84=E4=BB=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Process/submitVerify.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/Process/submitVerify.vue b/src/components/Process/submitVerify.vue index ef5b29a..1f9cead 100644 --- a/src/components/Process/submitVerify.vue +++ b/src/components/Process/submitVerify.vue @@ -9,7 +9,7 @@ - + @@ -83,14 +83,14 @@ -
+ +
@@ -105,9 +105,11 @@ import { ComponentInternalInstance } from 'vue'; import { ElForm } from 'element-plus'; import { completeTask, backProcess, getTask, taskOperation, terminationTask, getBackTaskNode, currentTaskAllUser } from '@/api/workflow/task'; import UserSelect from '@/components/UserSelect'; + const { proxy } = getCurrentInstance() as ComponentInternalInstance; import { UserVO } from '@/api/system/user/types'; import { FlowTaskVO, TaskOperationBo } from '@/api/workflow/task/types'; + const userSelectCopyRef = ref>(); const transferTaskRef = ref>(); const delegateTaskRef = ref>(); From 62685a136b82cf6d4e31167518f5eb800f94c4df Mon Sep 17 00:00:00 2001 From: liyang Date: Fri, 13 Dec 2024 18:01:31 +0800 Subject: [PATCH 58/88] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Process/approvalRecord.vue | 25 +++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/components/Process/approvalRecord.vue b/src/components/Process/approvalRecord.vue index 735637d..127a64f 100644 --- a/src/components/Process/approvalRecord.vue +++ b/src/components/Process/approvalRecord.vue @@ -31,17 +31,17 @@ sortable align="center" > - +