diff --git a/package.json b/package.json index 48b1571..fbc9c5b 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,9 @@ "vue-i18n": "9.10.2", "vue-router": "4.3.2", "vue-types": "5.1.1", - "vxe-table": "4.5.22" + "vxe-table": "4.5.22", + "@logicflow/core": "^1.2.15", + "@logicflow/extension": "^1.2.16" }, "devDependencies": { "@iconify/json": "2.2.201", diff --git a/src/api/system/dept/index.ts b/src/api/system/dept/index.ts index 7e097fd..db4e425 100644 --- a/src/api/system/dept/index.ts +++ b/src/api/system/dept/index.ts @@ -11,6 +11,17 @@ export const listDept = (query?: DeptQuery) => { }); }; +/** + * 通过deptIds查询部门 + * @param deptIds + */ +export const optionSelect = (deptIds: (number | string)[]): AxiosPromise => { + return request({ + url: '/system/dept/optionselect?deptIds=' + deptIds, + method: 'get' + }); +}; + // 查询部门列表(排除节点) export const listDeptExcludeChild = (deptId: string | number): AxiosPromise => { return request({ diff --git a/src/api/workflow/definition/index.ts b/src/api/workflow/definition/index.ts index 50720ff..9dcf8ba 100644 --- a/src/api/workflow/definition/index.ts +++ b/src/api/workflow/definition/index.ts @@ -26,16 +26,6 @@ export const getHisListByKey = (flowCode: string) => { }); }; -/** - * 通过流程定义id获取流程图 - */ -export const definitionImage = (definitionId: string): AxiosPromise => { - return request({ - url: `/workflow/definition/definitionImage/${definitionId}` + '?t' + Math.random(), - method: 'get' - }); -}; - /** * 通过流程定义id获取xml * @param definitionId 流程定义id @@ -72,18 +62,6 @@ export const updateDefinitionState = (definitionId: string, activityStatus: bool }); }; -/** - * 流程定义转换为模型 - * @param definitionId 流程定义id - * @returns - */ -export const convertToModel = (definitionId: string) => { - return request({ - url: `/workflow/definition/convertToModel/${definitionId}`, - method: 'put' - }); -}; - /** * 通过zip或xml部署流程定义 * @returns @@ -99,19 +77,6 @@ export function importDefinition(data: any) { }); } -/** - * 迁移流程 - * @param currentdefinitionId - * @param fromdefinitionId - * @returns - */ -export const migrationDefinition = (currentdefinitionId: string, fromdefinitionId: string) => { - return request({ - url: `/workflow/definition/migrationDefinition/${currentdefinitionId}/${fromdefinitionId}`, - method: 'put' - }); -}; - /** * 发布流程定义 * @param id 流程定义id @@ -135,3 +100,15 @@ export const unPublish = (id: string) => { method: 'put' }); }; + +/** + * 获取流程定义xml字符串 + * @param id 流程定义id + * @returns + */ +export const xmlString = (id: string) => { + return request({ + url: `/workflow/definition/xmlString/${id}`, + method: 'get' + }); +}; diff --git a/src/components/WarmFlow/PropertySetting/between.vue b/src/components/WarmFlow/PropertySetting/between.vue new file mode 100644 index 0000000..f6c5197 --- /dev/null +++ b/src/components/WarmFlow/PropertySetting/between.vue @@ -0,0 +1,267 @@ + + + + + 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('是否确认切换?');