Commit 7dd0d1f5 authored by 邓超's avatar 邓超

fix: 工作流样式需改

parent b1c57d99
......@@ -61,6 +61,10 @@ const Workflow = () => {
GetFlowNode({ flowID: treeData[0].children[0].FlowID }).then(res => {
setChartLoading(false);
if (res.code === 0) {
res.data.Nodes.forEach(item => {
item.nodeDetail = JSON.stringify(item);
});
console.log(res.data, 'res.dasta');
setFlowData(res.data);
} else {
setFlowData({ Nodes: [], Lines: [] });
......
......@@ -11,6 +11,9 @@ import imgUrl from '@/assets/images/icons/closeBlue.png';
import imgEnd from '@/assets/images/workFlow/end.png';
import imgGeneral from '@/assets/images/workFlow/general.png';
import imgStart from '@/assets/images/workFlow/start.png';
import gatewayExclusive from '@/assets/images/workFlow/gatewayExclusive.png';
import gatewayParallel from '@/assets/images/workFlow/gatewayParallel.png';
import gatewayInclude from '@/assets/images/workFlow/gatewayInclude.png';
const { confirm } = Modal;
let diagram = null;
const FlowChart = props => {
......@@ -167,16 +170,66 @@ const FlowChart = props => {
objGo(
go.Picture,
new go.Binding('source', 'NodeType', v => {
if (v === '1') {
return imgStart;
switch (v) {
case '1':
return imgStart;
case '2':
return imgEnd;
case '0':
return imgGeneral;
case '3':
return gatewayExclusive;
case '4':
return gatewayParallel;
case '5':
return gatewayInclude;
case '6':
return imgGeneral;
default:
return null;
}
if (v === '2') {
return imgEnd;
}),
new go.Binding('width', 'NodeType', v => {
switch (v) {
case '1':
return 120;
case '2':
return 120;
case '0':
return 136;
case '3':
return 52;
case '4':
return 52;
case '5':
return 52;
case '6':
return 136;
default:
return null;
}
}),
new go.Binding('height', 'NodeType', v => {
switch (v) {
case '1':
return 120;
case '2':
return 120;
case '0':
return 76;
case '3':
return 52;
case '4':
return 52;
case '5':
return 52;
case '6':
return 76;
default:
return null;
}
return imgGeneral;
}),
new go.Binding('width', 'NodeType', v => (v === '0' ? 136 : 120)),
new go.Binding('height', 'NodeType', v => (v === '0' ? 76 : 120)),
),
),
......@@ -184,22 +237,32 @@ const FlowChart = props => {
objGo(
go.TextBlock,
{ maxSize: new go.Size(130, NaN), wrap: go.TextBlock.WrapFit },
new go.Binding('text', 'NodeName', v => v.slice(0, 6)),
new go.Binding('stroke', 'NodeType', v => {
// 普通节点
if (v === '0') {
return '#1685FF';
new go.Binding('text', 'nodeDetail', v => {
const obj = JSON.parse(v);
if (obj.NodeType === '3' || obj.NodeType === '4' || obj.NodeType === '5') {
return '';
}
// 开始节点
if (v === '1') {
return '#FEFFFF';
}
// 结束节点
if (v === '2') {
return '#51C21A';
return obj.NodeName;
}),
new go.Binding('stroke', 'NodeType', v => {
switch (v) {
case '1':
return '#FEFFFF';
case '2':
return '#51C21A';
case '0':
return '#1685FF';
case '3':
return 52;
case '4':
return 52;
case '5':
return 52;
case '6':
return 136;
default:
return null;
}
return '';
}),
),
// objGo(
......@@ -319,6 +382,7 @@ const FlowChart = props => {
};
// 节点配置回调
const nodeCallBack = obj => {
console.log(obj, 'obj');
let nameIsRepeat;
let { nodes } = diagram;
let keyArr = [];
......@@ -359,7 +423,7 @@ const FlowChart = props => {
if (modalType === 'edit') {
// 编辑节点
let nodeData = diagram.model.findNodeDataForKey(nodeKey);
const { NodeName, NodeType, roleList, SerialNo, aheadHandle, NodeHandling } = obj;
const { NodeName, NodeType, roleList, SerialNo, aheadHandle, NodeHandling, nodeDetail } = obj;
nodeData.NodeName = NodeName;
nodeData.NodeType = NodeType;
nodeData.NodeId = nodeKey;
......@@ -367,6 +431,7 @@ const FlowChart = props => {
nodeData.SerialNo = SerialNo;
nodeData.aheadHandle = aheadHandle;
nodeData.NodeHandling = NodeHandling;
nodeData.nodeDetail = nodeDetail;
diagram.model.updateTargetBindings(nodeData);
}
// 关闭时进行数据比对看数据是否改变
......
......@@ -32,6 +32,7 @@ const NodeModal = props => {
aheadHandle: 1,
NodeHandling: 1,
roleList: [],
nodeDetail: {},
});
useEffect(() => {
form.resetFields();
......@@ -46,7 +47,8 @@ const NodeModal = props => {
} else {
type = '1';
}
setNodeMsg({ ...nodeMsg, newSerialNo, NodeType: type, roleList: [] });
let nodeDetail = JSON.stringify({ ...nodeMsg, newSerialNo, NodeType: type, roleList: [] });
setNodeMsg({ ...nodeMsg, newSerialNo, NodeType: type, roleList: [], nodeDetail });
form.setFieldsValue({
SerialNo: newSerialNo,
NodeType: type,
......@@ -68,7 +70,8 @@ const NodeModal = props => {
form.validateFields().then(validate => {
if (validate) {
validate.SerialNo = Number(validate.SerialNo);
let obj = { ...validate, roleList: nodeMsg.roleList };
let nodeDetail = JSON.stringify({ ...validate, roleList: nodeMsg.roleList });
let obj = { ...validate, roleList: nodeMsg.roleList, nodeDetail };
onSubumit(obj);
}
});
......@@ -77,12 +80,14 @@ const NodeModal = props => {
const delUser = (record, index) => {
let roleList = [...nodeMsg.roleList];
roleList.splice(index, 1);
setNodeMsg({ ...nodeMsg, roleList });
let nodeDetail = JSON.stringify({ ...nodeMsg, roleList });
setNodeMsg({ ...nodeMsg, roleList, nodeDetail });
};
// 添加角色或机构
const addUser = selectList => {
console.log(selectList, 'selectList');
setNodeMsg({ ...nodeMsg, roleList: selectList });
let nodeDetail = JSON.stringify({ ...nodeMsg, roleList: selectList });
setNodeMsg({ ...nodeMsg, roleList: selectList, nodeDetail });
setShowRoal(false);
};
// 添加默认承办人
......@@ -92,7 +97,8 @@ const NodeModal = props => {
console.log(editIndex, 'editIndex');
list[editIndex].defauletUserName = userName;
list[editIndex].defaultUserId = userId;
setNodeMsg({ ...nodeMsg, roleList: list });
let nodeDetail = JSON.stringify({ ...nodeMsg, roleList: list });
setNodeMsg({ ...nodeMsg, roleList: list, nodeDetail });
setShowUnderTaker(false);
};
// 编辑默认承办人
......@@ -240,6 +246,10 @@ const NodeModal = props => {
<Option value="1">开始节点</Option>
<Option value="0">经办节点</Option>
<Option value="2">结束节点</Option>
<Option value="3">排他网关</Option>
<Option value="4">并行网关</Option>
<Option value="5">包含网关</Option>
<Option value="6">抄送节点</Option>
</Select>
</Form.Item>
<Form.Item label="检查前面在办" name="aheadHandle">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment