review 细节调整

This commit is contained in:
yuebenshan committed 2023-02-15 22:04:28 +08:00
1 parent 367fbdc2e3
commit f5e7f5ae87
4 files changed
+364 -340

No files matched your search

+30 -28
View File
@@ -34,6 +34,7 @@
</div>
</template>
<!-- 加载logicflow组件 >>>>>>>>>>>>> -->
<link rel="stylesheet" href="/<$ ctx.app.config.appId $>/public/logicflow/core/dist/style/index.css" />
<link rel="stylesheet" href="/<$ ctx.app.config.appId $>/public/logicflow/extension/lib/style/index.css" />
<script src="/<$ ctx.app.config.appId $>/public/logicflow/core/dist/logic-flow.js"></script>
@@ -42,6 +43,7 @@
<script src="/<$ ctx.app.config.appId $>/public/logicflow/extension/lib/SelectionSelect.js"></script>
<script src="/<$ ctx.app.config.appId $>/public/logicflow/extension/lib/Control.js"></script>
<script src="/<$ ctx.app.config.appId $>/public/logicflow/extension/lib/Popup.js"></script>
<!-- <<<<<<<<<<<<< 加载logicflow组件 -->
<script type="module">
Vue.component("process-flow", {
@@ -262,6 +264,7 @@ Vue.component("process-flow", {
// 选中节点
logicFlow.on("node:click", (e) => {
const {data} = e;
data.properties.userList = [];
this.editNode(data);
});
// 添加边
@@ -341,7 +344,7 @@ Vue.component("process-flow", {
// this.logicFlow.render({ "nodes":[], "edges":[] })
// this.logicFlow.render({"nodes":[{"id":"3","type":"CustomNode","x":380,"y":140,"properties":{},"text":{"x":380,"y":140,"value":"开始"}},{"id":"1","type":"CustomNode","x":380,"y":280,"properties":{},"text":{"x":380,"y":280,"value":"经理"}},{"id":"2","type":"CustomNode","x":380,"y":420,"properties":{},"text":{"x":380,"y":420,"value":"结束"}}],"edges":[{"id":"a2ed12a0-7548-4725-a8e6-290d565d66da","type":"polyline","sourceNodeId":"3","targetNodeId":"1","startPoint":{"x":380,"y":160},"endPoint":{"x":380,"y":260},"properties":{},"text":{"x":380,"y":190,"value":"开始"},"pointsList":[{"x":380,"y":160},{"x":380,"y":260}]},{"id":"135f3e3a-d8c5-4329-83d6-833512175ea4","type":"polyline","sourceNodeId":"2","targetNodeId":"1","startPoint":{"x":330,"y":420},"endPoint":{"x":330,"y":280},"properties":{},"text":{"x":265,"y":350,"value":"经理审核拒绝"},"pointsList":[{"x":330,"y":420},{"x":265,"y":420},{"x":265,"y":280},{"x":330,"y":280}]},{"id":"c4dbefa6-1ce0-4cef-babe-444329affea7","type":"polyline","sourceNodeId":"1","targetNodeId":"2","startPoint":{"x":430,"y":280},"endPoint":{"x":430,"y":420},"properties":{},"text":{"x":495,"y":350,"value":"经理审核通过"},"pointsList":[{"x":430,"y":280},{"x":495,"y":280},{"x":495,"y":420},{"x":430,"y":420}]},{"id":"6fb6a3b1-a8fc-4d22-b9f0-5692208118d5","type":"polyline","sourceNodeId":"1","targetNodeId":"2","startPoint":{"x":348,"y":300},"endPoint":{"x":348,"y":400},"properties":{},"text":{"x":348,"y":350,"value":"同意-连线文本"},"pointsList":[{"x":348,"y":300},{"x":348,"y":400}]}]})
// this.logicFlow.render({"nodes":[{"id":"start-c31f75a55c48","type":"CustomNode","x":100,"y":80,"properties":{"id":"start-c31f75a55c48","label":"起点","type":"start","assignType":"person","assignValue":["admin"],"lineTypeList":"同意"},"text":{"x":100,"y":80,"value":"起点"}},{"id":"end-72e945407d48","type":"CustomNode","x":540,"y":80,"properties":{"id":"end-72e945407d48","label":"终点","type":"end","assignType":"person","assignValue":["admin"],"lineTypeList":""},"text":{"x":540,"y":80,"value":"终点"}},{"id":"userTask-fa96d9f1f548","type":"CustomNode","x":320,"y":80,"properties":{"id":"userTask-fa96d9f1f548","label":"审批节点","type":"userTask","assignType":"person","assignValue":["admin"],"lineTypeList":"同意,拒绝"},"text":{"x":320,"y":80,"value":"审批节点"}}],"edges":[{"id":"line-8c746156fb48","type":"polyline","sourceNodeId":"start-c31f75a55c48","targetNodeId":"userTask-fa96d9f1f548","startPoint":{"x":150,"y":80},"endPoint":{"x":270,"y":80},"properties":{"from":"start-c31f75a55c48","to":"userTask-fa96d9f1f548","label":"同意-连线文本3","type":"同意","id":"line-8c746156fb48","Remark":"","endpoint":"Dot"},"text":{"x":210,"y":80,"value":"同意-连线文本3"},"pointsList":[{"x":150,"y":80},{"x":270,"y":80}]},{"id":"line-088a246e9248","type":"polyline","sourceNodeId":"userTask-fa96d9f1f548","targetNodeId":"end-72e945407d48","startPoint":{"x":370,"y":80},"endPoint":{"x":490,"y":80},"properties":{"from":"userTask-fa96d9f1f548","to":"end-72e945407d48","label":"同意-连线文本","type":"同意","id":"line-088a246e9248","Remark":"","endpoint":"Dot"},"text":{"x":430,"y":80,"value":"同意-连线文本"},"pointsList":[{"x":370,"y":80},{"x":490,"y":80}]}]});
this.logicFlow.render(this.parseBusinessDataToLfData(this.data));
this.logicFlow.render(this.parseBusinessDataTologicFlowData(this.data));
},
/**
@@ -364,19 +367,19 @@ Vue.component("process-flow", {
* 拖拽生成节点
* @param 拖拽项
*/
startDrag(item) {
let id = this.getUUID(item.type);
startDrag(funObj) {
let id = this.getUUID(funObj.type);
let node = {
type: 'CustomNode',
id,
text: item.name,
text: funObj.name,
properties: {
id,
label: item.name,
type: item.type,
label: funObj.name,
type: funObj.type,
assignType: 'person',
assignValue: ['<$ ctx.userInfo.userId $>'],
lineTypeList: item.type === 'start' ? '同意' : item.type === 'end' ? '' : '同意,拒绝',
lineTypeList: funObj.type === 'start' ? '同意' : item.type === 'end' ? '' : '同意,拒绝',
}
}
this.logicFlow.dnd.startDrag(node);
@@ -413,35 +416,34 @@ Vue.component("process-flow", {
if (this.readonly) {
return
}
const {id, properties} = line;
let fromNodeData = this.logicFlow.getNodeDataById(line.sourceNodeId).properties;
const lineTypeList = fromNodeData.lineTypeList ? fromNodeData.lineTypeList.split(',') : [];
this.editType = 'line';
this.currentLineId = line.id;
// this.currentLineId = line.id;
this.$nextTick(function () {
this.$refs.lineForm.init(line, lineTypeList);
})
},
/**
* 获取流程图数据(组件外使用)
* 获取流程图业务数据(组件外使用)
* @returns {{nodeList: Array, lineList: Array}}
*/
getData() {
return this.parseLFDataToBusinessData();
getBusinessData() {
return this.parseLogicFlowDataToBusinessData();
},
/**
* 将流程设计器数据转换为业务数据
*/
parseLFDataToBusinessData() {
const lfData = this.getOrderedGraphData();
parseLogicFlowDataToBusinessData() {
const logicFlowData = this.getOrderedGraphData();
return {
nodeList: lfData.nodes.map(node => ({
nodeList: logicFlowData.nodes.map(node => ({
...node.properties,
origin: node
})),
lineList: lfData.edges.map(line => ({
lineList: logicFlowData.edges.map(line => ({
...line.properties,
origin: line
}))
@@ -453,30 +455,30 @@ Vue.component("process-flow", {
* @param nodeList
*/
getOrderedGraphData() {
const lfData = this.logicFlow.getGraphData();
const orderedNodes = lfData.edges.reduce((acc, edge) => {
const sourceNode = lfData.nodes.find(node => node.id === edge.sourceNodeId);
const targetNode = lfData.nodes.find(node => node.id === edge.targetNodeId);
const graphData = this.logicFlow.getGraphData();
const orderedNodes = graphData.edges.reduce((nodeList, edge) => {
const sourceNode = graphData.nodes.find(node => node.id === edge.sourceNodeId);
const targetNode = graphData.nodes.find(node => node.id === edge.targetNodeId);
if (sourceNode && targetNode) {
const sourceIndex = acc.findIndex(node => node.id === sourceNode.id);
const targetIndex = acc.findIndex(node => node.id === targetNode.id);
const sourceIndex = nodeList.findIndex(node => node.id === sourceNode.id);
const targetIndex = nodeList.findIndex(node => node.id === targetNode.id);
if (sourceIndex > targetIndex) {
acc.splice(targetIndex, 0, sourceNode);
acc.splice(sourceIndex + 1, 1);
nodeList.splice(targetIndex, 0, sourceNode);
nodeList.splice(sourceIndex + 1, 1);
}
}
return acc;
}, lfData.nodes);
return nodeList;
}, graphData.nodes);
return {
nodes: orderedNodes,
edges: lfData.edges
edges: graphData.edges
}
},
/**
* 将业务数据转换为流程设计器数据
*/
parseBusinessDataToLfData() {
parseBusinessDataTologicFlowData() {
return {
nodes: this.data.nodeList.map(node => node.origin).filter(node => node != null),
edges: this.data.lineList.map(line => line.origin).filter(line => line != null)