Commit 5293754d authored by 彭俊龙's avatar 彭俊龙

feat:自动化工单测试

parent 9863752b
Pipeline #96628 failed with stages
...@@ -20,7 +20,11 @@ import moment from 'moment/moment'; ...@@ -20,7 +20,11 @@ import moment from 'moment/moment';
import RuleConfig from '@/components/RuleConfig'; import RuleConfig from '@/components/RuleConfig';
import PeopleSelector from '@/components/PeopleSelector'; import PeopleSelector from '@/components/PeopleSelector';
import { WFGetAllFlow, GetFormDataSource, GetFlowNode } from '@/services/workflow/workflow'; import { WFGetAllFlow, GetFormDataSource, GetFlowNode } from '@/services/workflow/workflow';
import { GetScheduledConfigFlowNode, GetConditionConfigFlowNode } from '@/services/flow/flow'; import {
GetScheduledConfigFlowNode,
GetConditionConfigFlowNode,
GetBizMetaData,
} from '@/services/flow/flow';
import { GetSubEventFlows } from '@/services/workflow/workflow'; import { GetSubEventFlows } from '@/services/workflow/workflow';
import imgEnd from '@/assets/images/workFlow/nodeEnd.png'; import imgEnd from '@/assets/images/workFlow/nodeEnd.png';
import gatewayConfluence from '@/assets/images/workFlow/gatewayParallel.png'; import gatewayConfluence from '@/assets/images/workFlow/gatewayParallel.png';
...@@ -28,16 +32,18 @@ import gatewayExclusive from '@/assets/images/workFlow/gatewayCondition.png'; ...@@ -28,16 +32,18 @@ import gatewayExclusive from '@/assets/images/workFlow/gatewayCondition.png';
import gatewayInclude from '@/assets/images/workFlow/gatewayJoin.png'; import gatewayInclude from '@/assets/images/workFlow/gatewayJoin.png';
import imgGeneral from '@/assets/images/workFlow/nodeGeneral.png'; import imgGeneral from '@/assets/images/workFlow/nodeGeneral.png';
import imgStart from '@/assets/images/workFlow/nodeStart.png'; import imgStart from '@/assets/images/workFlow/nodeStart.png';
import styles from './index.less' import styles from './index.less';
import * as go from 'gojs'; import * as go from 'gojs';
import { isObject } from 'lodash';
import { FormRender } from 'panda-xform';
const days = moment().daysInMonth(); const days = moment().daysInMonth();
const allDays = [...Array.from({ length: days + 1 }, (_, i) => i + 1)]; const allDays = [...Array.from({ length: days + 1 }, (_, i) => i + 1)];
const weeks = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期天']; const weeks = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期天'];
const weeks1 = ['第一周', '第二周', '第三周', '第四周', '最后一周']; const weeks1 = ['第一周', '第二周', '第三周', '第四周', '最后一周'];
let myDiagram = null; let myDiagram = null;
const CaseModify = props => { const CaseModify = props => {
let _$ = go.GraphObject.make; let _$ = go.GraphObject.make;
const { visible, mode, onClose, onOk, flowConfigDetail } = props; const { visible, mode, onClose, onOk, flowConfigDetail, flowCenterData } = props;
const [planType, setPlanType] = useState('ByLoop'); // ByLoop:循环 ByDay:每天 ByWeek:每周 ByMonth:每月 const [planType, setPlanType] = useState('ByLoop'); // ByLoop:循环 ByDay:每天 ByWeek:每周 ByMonth:每月
const [timeType, setTimeType] = useState(''); const [timeType, setTimeType] = useState('');
const [showTtype, setShowTtype] = useState('time'); const [showTtype, setShowTtype] = useState('time');
...@@ -45,6 +51,7 @@ const CaseModify = props => { ...@@ -45,6 +51,7 @@ const CaseModify = props => {
const [showPersonSelect, setShowPersonSelect] = useState(false); const [showPersonSelect, setShowPersonSelect] = useState(false);
const [openTeditor, setOpenTeditor] = useState(false); const [openTeditor, setOpenTeditor] = useState(false);
const [loadding, setloadding] = useState(false); const [loadding, setloadding] = useState(false);
const [schemaValues, setSchemaValues] = useState({ values: [], formJson: {} });
const [configInfo, setConfigInfo] = useState({ const [configInfo, setConfigInfo] = useState({
schemeName: '', schemeName: '',
schemeNameErrMsg: '', //验证必填提示词 schemeNameErrMsg: '', //验证必填提示词
...@@ -82,7 +89,11 @@ const CaseModify = props => { ...@@ -82,7 +89,11 @@ const CaseModify = props => {
const [flowList, setFlowList] = useState([]); const [flowList, setFlowList] = useState([]);
const [nodeNams, setNodeNames] = useState([]); const [nodeNams, setNodeNames] = useState([]);
const [isPreview, setIsPreView] = useState(false); const [isPreview, setIsPreView] = useState(false);
const [formVisible, setFormVisible] = useState(false);
const [showForm, setShowForm] = useState(false);
const [errorMsg, setErrorMsg] = useState(''); //定时触发下的参数校验 const [errorMsg, setErrorMsg] = useState(''); //定时触发下的参数校验
let formRef = useRef(null);
let formJsonRef = useRef({})
let weekType = useRef(''); //每周 按周 第几周 周几执行 let weekType = useRef(''); //每周 按周 第几周 周几执行
let timeUnit = useRef('hour'); let timeUnit = useRef('hour');
let ruleContent = useRef(''); let ruleContent = useRef('');
...@@ -90,9 +101,7 @@ const CaseModify = props => { ...@@ -90,9 +101,7 @@ const CaseModify = props => {
let roleIdsRef = useRef([]); let roleIdsRef = useRef([]);
let ruleField = useRef([]); let ruleField = useRef([]);
let flowData = useRef([]); let flowData = useRef([]);
let imgUrl = useRef(''); let flowDataList = useRef({});
let flowTree = useRef([])
let flowDataList = useRef({})
let postData = useRef({ let postData = useRef({
id: null, id: null,
schemeName: '', schemeName: '',
...@@ -110,6 +119,7 @@ const CaseModify = props => { ...@@ -110,6 +119,7 @@ const CaseModify = props => {
scheduledConfig: { scheduledConfig: {
userIds: [], //用户ID userIds: [], //用户ID
roleIds: [], //角色ID roleIds: [], //角色ID
Values: [], //工单移交模板
agentConfig: '', agentConfig: '',
}, //定时触发 }, //定时触发
}); });
...@@ -142,57 +152,6 @@ const CaseModify = props => { ...@@ -142,57 +152,6 @@ const CaseModify = props => {
} }
}, [visible]); }, [visible]);
const init = () => {
postData.current = {
id: null,
schemeName: '',
triggerMethod: '条件触发',
flowId: null,
flowName: '',
eventId: null,
eventName: '',
activityId: null,
activityName: '',
isEnabled: 1,
conditionConfig: {
ruleList: [],
}, //条件触发
scheduledConfig: {
userIds: [], //用户ID
roleIds: [], //角色ID
agentConfig: '',
}, //定时触发
};
setRuleInfos([
{
id: 1,
userIds: [],
userIdsErrMsg: '', //验证必填提示词
roleIds: [],
tableNames: '',
ruleContent: '',
ruleContentErrMsg: '', //验证必填提示词
ruleName: '',
ruleNameErrMsg: '', //验证必填提示词
},
]);
setConfigInfo({
schemeName: '',
schemeNameErrMsg: '', //验证必填提示词
triggerType: '条件触发',
flowId: '',
flowIdErrMsg: '', //验证必填提示词
activityId: '',
activityIdErrMsg: '', //验证必填提示词
userIds: [], //定时触发使用
roleIds: [], //定时触发使用
});
setNodeNames([]);
ruleField.current = []
tableName.current = null
ruleContent.current = ''
};
const dealPostData = async detail => { const dealPostData = async detail => {
const { const {
ID, ID,
...@@ -223,6 +182,8 @@ const CaseModify = props => { ...@@ -223,6 +182,8 @@ const CaseModify = props => {
{ {
let res; let res;
if (TriggerMethod === '定时触发') { if (TriggerMethod === '定时触发') {
setShowForm(true);
getBizMetaData(detail);
res = await GetConditionConfigFlowNode({ flowId: FlowId }); res = await GetConditionConfigFlowNode({ flowId: FlowId });
} else { } else {
res = await GetScheduledConfigFlowNode({ flowId: FlowId }); res = await GetScheduledConfigFlowNode({ flowId: FlowId });
...@@ -250,24 +211,28 @@ const CaseModify = props => { ...@@ -250,24 +211,28 @@ const CaseModify = props => {
return; return;
} }
} }
const { UserIds, AgentConfig, RoleIds } = ScheduledConfig const { UserIds, AgentConfig, RoleIds } = ScheduledConfig;
let userIds = [] let userIds = [];
let roleIds = [] let roleIds = [];
if(UserIds.length > 0){ if (UserIds.length > 0) {
userIds = UserIds && UserIds.map(v=> { userIds =
return { UserIds &&
id: v.ID, UserIds.map(v => {
name: v.Name return {
} id: v.ID,
}) name: v.Name,
};
});
} }
if(RoleIds.length > 0){ if (RoleIds.length > 0) {
roleIds = RoleIds && RoleIds.map(v=> { roleIds =
return { RoleIds &&
id: v.ID, RoleIds.map(v => {
name: v.Name return {
} id: v.ID,
}) name: v.Name,
};
});
} }
setConfigInfo({ setConfigInfo({
...configInfo, ...configInfo,
...@@ -276,7 +241,7 @@ const CaseModify = props => { ...@@ -276,7 +241,7 @@ const CaseModify = props => {
triggerType: TriggerMethod, triggerType: TriggerMethod,
schemeName: SchemeName, schemeName: SchemeName,
roleIds, roleIds,
userIds userIds,
}); });
if (TriggerMethod === '条件触发') { if (TriggerMethod === '条件触发') {
const { code, msg, data } = await GetFormDataSource({ flowId: FlowId }); const { code, msg, data } = await GetFormDataSource({ flowId: FlowId });
...@@ -334,7 +299,6 @@ const CaseModify = props => { ...@@ -334,7 +299,6 @@ const CaseModify = props => {
setRuleInfos(rules); setRuleInfos(rules);
} }
} else { } else {
const { const {
LoopMode, LoopMode,
LoopUnit, LoopUnit,
...@@ -385,20 +349,6 @@ const CaseModify = props => { ...@@ -385,20 +349,6 @@ const CaseModify = props => {
} }
}; };
const toLowerFirstLetterKeysDeep = obj => {
if (Array.isArray(obj)) {
return obj.map(toLowerFirstLetterKeysDeep);
} else if (obj !== null && typeof obj === 'object') {
return Object.fromEntries(
Object.entries(obj).map(([key, value]) => [
key.charAt(0).toLowerCase() + key.slice(1),
toLowerFirstLetterKeysDeep(value),
]),
);
}
return obj;
};
const getEventFlow = async () => { const getEventFlow = async () => {
const { code, data, msg } = await GetSubEventFlows(); const { code, data, msg } = await GetSubEventFlows();
if (code === 0) { if (code === 0) {
...@@ -411,35 +361,79 @@ const CaseModify = props => { ...@@ -411,35 +361,79 @@ const CaseModify = props => {
message.error(msg); message.error(msg);
} }
}; };
const getPrewViewImage = async (flowId) =>{ const getPrewViewImage = async flowId => {
let res = await GetFlowNode({ flowID: flowId }); let res = await GetFlowNode({ flowID: flowId });
if (res.code === 0) { if (res.code === 0) {
res.data.Nodes.forEach(item => { res.data.Nodes.forEach(item => {
item.nodeDetail = JSON.stringify(item); item.nodeDetail = JSON.stringify(item);
item.key = item.NodeName item.key = item.NodeName;
}); });
res.data.Lines.forEach(item => { res.data.Lines.forEach(item => {
item.lineDetail = JSON.stringify(item); item.lineDetail = JSON.stringify(item);
}); });
flowDataList.current = { ...res.data, flowName: postData.current.flowName } flowDataList.current = { ...res.data, flowName: postData.current.flowName };
initMap(flowDataList.current) initMap(flowDataList.current);
} else { } else {
message.error(res.msg); message.error(res.msg);
} }
setIsPreView(true) setIsPreView(true);
} };
const getBizMetaData = async detail => {
if (!flowCenterData.length) return;
const {
ID,
IsEnabled,
TriggerMethod,
SchemeName,
ActivityId,
ActivityName,
EventId,
EventName,
FlowId,
FlowName,
ScheduledConfig,
ConditionConfig,
} = detail;
let paramObj = flowCenterData.find(v => v.flowName === FlowName && v.eventName === EventName);
if (paramObj) {
paramObj = {
...paramObj,
userId: 1,
};
const { code, data, msg } = await GetBizMetaData(paramObj);
const { formJson, values } = data[0];
const jsonObj = JSON.parse(formJson)
setSchemaValues({ values, formJson: jsonObj });
console.log(formData, 'formDataformData')
}
};
const getFormData = (jsonObj) => {
let formData = {};
Object.keys(jsonObj.properties).forEach(v => {
const obj = jsonObj.properties[v];
Object.keys(obj.properties).forEach(x => {
formData[x] = obj.properties[x];
})
})
return formData;
}
//计算循环的下次执行时间 //计算循环的下次执行时间
const handleTimeInfo = (timeUnit, num) => { const handleTimeInfo = (timeUnit, num) => {
if (startTime) { if (startTime) {
setTip(moment(startTime).add(num, timeUnit).format('YYYY-MM-DD HH:mm:ss')); setTip(
moment(startTime)
.add(num, timeUnit)
.format('YYYY-MM-DD HH:mm:ss'),
);
} }
}; };
//计算下次执行时间每月按日 //计算下次执行时间每月按日
const getTipByDay = (dayVals, timeVals) => { const getTipByDay = (dayVals, timeVals) => {
if (!timeVals.length || !dayVals.length) return; if (!timeVals.length || !dayVals.length) return;
const now = moment(startTime) const now = moment(startTime);
const times = timeVals.sort((a, b) => a - b); const times = timeVals.sort((a, b) => a - b);
if (dayVals.length == 1 && dayVals[0] === allDays[allDays.length - 1]) { if (dayVals.length == 1 && dayVals[0] === allDays[allDays.length - 1]) {
return now return now
...@@ -925,7 +919,7 @@ const CaseModify = props => { ...@@ -925,7 +919,7 @@ const CaseModify = props => {
const handleSelectRuleType = (e, type) => { const handleSelectRuleType = (e, type) => {
const { checked } = e.target; const { checked } = e.target;
generatePostData({ triggerMethod: type }); generatePostData({ triggerMethod: type });
setShowForm(type === '定时触发')
if (type === '定时触发') { if (type === '定时触发') {
generatePostData({}); generatePostData({});
if (nodeNams.length > 0) { if (nodeNams.length > 0) {
...@@ -985,12 +979,18 @@ const CaseModify = props => { ...@@ -985,12 +979,18 @@ const CaseModify = props => {
v.id === (id || currentRuleId.current) v.id === (id || currentRuleId.current)
? { ? {
...v, ...v,
userIds: person.length > 0 ? person.map(x => { userIds:
return { id: Number(x.value), name: x.label }; person.length > 0
}) : [] , ? person.map(x => {
userIds: person.length > 0 ? person.map(x => { return { id: Number(x.value), name: x.label };
return { id: Number(x.value), name: x.label }; })
}) : [] , : [],
userIds:
person.length > 0
? person.map(x => {
return { id: Number(x.value), name: x.label };
})
: [],
} }
: v, : v,
); );
...@@ -1044,8 +1044,7 @@ const CaseModify = props => { ...@@ -1044,8 +1044,7 @@ const CaseModify = props => {
let flowIdErrMsg = ''; let flowIdErrMsg = '';
let activityIdErrMsg = ''; let activityIdErrMsg = '';
let userIdsErrMsg = ''; let userIdsErrMsg = '';
let isOk = let isOk = hasValue(schemeName) && hasValue(flowId) && hasValue(activityId);
hasValue(schemeName) && hasValue(flowId) && hasValue(activityId);
if (!schemeName) { if (!schemeName) {
schemeNameErrMsg = '方案名称必填'; schemeNameErrMsg = '方案名称必填';
...@@ -1064,7 +1063,7 @@ const CaseModify = props => { ...@@ -1064,7 +1063,7 @@ const CaseModify = props => {
} else { } else {
activityIdErrMsg = ''; activityIdErrMsg = '';
} }
console.log(userIds, roleIds , 'userIds, roleIdsuserIds, roleIds'); console.log(userIds, roleIds, 'userIds, roleIdsuserIds, roleIds');
if (userIds.length < 1 && roleIds.length < 1) { if (userIds.length < 1 && roleIds.length < 1) {
userIdsErrMsg = '请选择下一节点办理人'; userIdsErrMsg = '请选择下一节点办理人';
} else { } else {
...@@ -1082,7 +1081,10 @@ const CaseModify = props => { ...@@ -1082,7 +1081,10 @@ const CaseModify = props => {
isOk = isOk =
isOk && isOk &&
ruleInfos.every( ruleInfos.every(
v => (v.userIds.length > 0 || v.roleIds.length > 0) && hasValue(v.ruleContent) && hasValue(v.ruleName), v =>
(v.userIds.length > 0 || v.roleIds.length > 0) &&
hasValue(v.ruleContent) &&
hasValue(v.ruleName),
); );
let infos = ruleInfos; let infos = ruleInfos;
for (let i of infos) { for (let i of infos) {
...@@ -1159,10 +1161,10 @@ const CaseModify = props => { ...@@ -1159,10 +1161,10 @@ const CaseModify = props => {
const handleOnOk = () => { const handleOnOk = () => {
if (!isValid()) { if (!isValid()) {
message.warn('校验未通过,请检查表单填写信息!') message.warn('校验未通过,请检查表单填写信息!');
return; return;
} }
setloadding(true) setloadding(true);
if (configInfo.triggerType === '条件触发') { if (configInfo.triggerType === '条件触发') {
postData.current.conditionConfig = { postData.current.conditionConfig = {
ruleList: ruleInfos, ruleList: ruleInfos,
...@@ -1199,7 +1201,7 @@ const CaseModify = props => { ...@@ -1199,7 +1201,7 @@ const CaseModify = props => {
roleIds: configInfo.roleIds, roleIds: configInfo.roleIds,
}; };
} }
const fn = ()=> setloadding(false) const fn = () => setloadding(false);
onOk(postData.current, fn); onOk(postData.current, fn);
}; };
...@@ -1223,8 +1225,7 @@ const CaseModify = props => { ...@@ -1223,8 +1225,7 @@ const CaseModify = props => {
setShowPersonSelect(true); setShowPersonSelect(true);
}; };
const initMap = data => {
const initMap = (data) => {
setTimeout(() => { setTimeout(() => {
if (myDiagram) { if (myDiagram) {
myDiagram.div = null; // 断开现有 Diagram 的 div 绑定 myDiagram.div = null; // 断开现有 Diagram 的 div 绑定
...@@ -1258,9 +1259,7 @@ const CaseModify = props => { ...@@ -1258,9 +1259,7 @@ const CaseModify = props => {
go.Node, go.Node,
'Auto', 'Auto',
// { deletable: false, toolTip: tooltiptemplate }, // { deletable: false, toolTip: tooltiptemplate },
new go.Binding('location', 'points', go.Point.parse).makeTwoWay( new go.Binding('location', 'points', go.Point.parse).makeTwoWay(go.Point.stringify),
go.Point.stringify,
),
// 节点样式配置 // 节点样式配置
_$( _$(
go.Panel, go.Panel,
...@@ -1268,7 +1267,7 @@ const CaseModify = props => { ...@@ -1268,7 +1267,7 @@ const CaseModify = props => {
nodeBoxStyle('height'), nodeBoxStyle('height'),
_$( _$(
go.Picture, go.Picture,
new go.Binding('source', 'nodeDetail', (v) => { new go.Binding('source', 'nodeDetail', v => {
const obj = JSON.parse(v); const obj = JSON.parse(v);
console.log(obj, 'vvvvvvv'); console.log(obj, 'vvvvvvv');
switch (obj.NodeType) { switch (obj.NodeType) {
...@@ -1317,13 +1316,9 @@ const CaseModify = props => { ...@@ -1317,13 +1316,9 @@ const CaseModify = props => {
overflow: go.TextBlock.OverflowEllipsis, overflow: go.TextBlock.OverflowEllipsis,
font: 'normal 12pt Microsoft YaHei', font: 'normal 12pt Microsoft YaHei',
}, },
new go.Binding('text', 'nodeDetail', (v) => { new go.Binding('text', 'nodeDetail', v => {
const obj = JSON.parse(v); const obj = JSON.parse(v);
if ( if (obj.NodeType === '20' || obj.NodeType === '21' || obj.NodeType === '22') {
obj.NodeType === '20' ||
obj.NodeType === '21' ||
obj.NodeType === '22'
) {
return ''; return '';
} }
return obj.NodeName.slice(0, 6); return obj.NodeName.slice(0, 6);
...@@ -1338,22 +1333,14 @@ const CaseModify = props => { ...@@ -1338,22 +1333,14 @@ const CaseModify = props => {
overflow: go.TextBlock.OverflowEllipsis, overflow: go.TextBlock.OverflowEllipsis,
font: 'normal 12pt Microsoft YaHei', font: 'normal 12pt Microsoft YaHei',
}, },
new go.Binding('spacingAbove', 'undertakeman', (v) => new go.Binding('spacingAbove', 'undertakeman', v => (v?.length > 0 ? 5 : 0)),
v?.length > 0 ? 5 : 0, new go.Binding('height', 'undertakeman', v => (v?.length > 0 ? 30 : 0)),
), new go.Binding('margin', 'undertakeman', v =>
new go.Binding('height', 'undertakeman', (v) =>
v?.length > 0 ? 30 : 0,
),
new go.Binding('margin', 'undertakeman', (v) =>
v?.length > 0 ? new go.Margin(10, 10, 0, 10) : 0, v?.length > 0 ? new go.Margin(10, 10, 0, 10) : 0,
), ),
new go.Binding('text', 'nodeDetail', (v) => { new go.Binding('text', 'nodeDetail', v => {
const obj = JSON.parse(v); const obj = JSON.parse(v);
if ( if (obj.NodeType === '20' || obj.NodeType === '21' || obj.NodeType === '22') {
obj.NodeType === '20' ||
obj.NodeType === '21' ||
obj.NodeType === '22'
) {
return ''; return '';
} }
if (obj.RoleList?.length === 0) { if (obj.RoleList?.length === 0) {
...@@ -1372,16 +1359,13 @@ const CaseModify = props => { ...@@ -1372,16 +1359,13 @@ const CaseModify = props => {
mouseEnter(e, node) { mouseEnter(e, node) {
// console.log(e, node); // console.log(e, node);
}, },
mouseLeave(e, node) { }, mouseLeave(e, node) {},
// 处理双击 // 处理双击
doubleClick(e, node) { }, doubleClick(e, node) {},
// define a tooltip for each node that displays the color as text // define a tooltip for each node that displays the color as text
// define a tooltip for each node that displays the color as text // define a tooltip for each node that displays the color as text
toolTip: _$( toolTip: _$('ToolTip', _$(go.TextBlock, { margin: 4 }, new go.Binding('text', 'tip'))), // end of Adornment
'ToolTip',
_$(go.TextBlock, { margin: 4 }, new go.Binding('text', 'tip')),
), // end of Adornment
}, },
); );
// 链接设置 // 链接设置
...@@ -1397,7 +1381,7 @@ const CaseModify = props => { ...@@ -1397,7 +1381,7 @@ const CaseModify = props => {
_$( _$(
go.Shape, // 链接路径形状 go.Shape, // 链接路径形状
{ isPanelMain: true, strokeWidth: 3, stroke: '#1685FF' }, { isPanelMain: true, strokeWidth: 3, stroke: '#1685FF' },
new go.Binding('stroke', 'lineType', (v) => { new go.Binding('stroke', 'lineType', v => {
// 未完成 // 未完成
if (v === 0) { if (v === 0) {
return '#342e2e11'; return '#342e2e11';
...@@ -1408,7 +1392,7 @@ const CaseModify = props => { ...@@ -1408,7 +1392,7 @@ const CaseModify = props => {
} }
return ''; return '';
}), }),
new go.Binding('strokeDashArray', 'lineType', (v) => { new go.Binding('strokeDashArray', 'lineType', v => {
// 未完成 // 未完成
if (v === 0) { if (v === 0) {
return [6, 3]; return [6, 3];
...@@ -1423,7 +1407,7 @@ const CaseModify = props => { ...@@ -1423,7 +1407,7 @@ const CaseModify = props => {
_$( _$(
go.Shape, // 箭头 go.Shape, // 箭头
{ toArrow: 'Standard', stroke: '#1685FF', fill: '#1685FF' }, { toArrow: 'Standard', stroke: '#1685FF', fill: '#1685FF' },
new go.Binding('fill', 'lineType', (v) => { new go.Binding('fill', 'lineType', v => {
// 未完成 // 未完成
if (v === 0) { if (v === 0) {
return '#342e2e11'; return '#342e2e11';
...@@ -1434,7 +1418,7 @@ const CaseModify = props => { ...@@ -1434,7 +1418,7 @@ const CaseModify = props => {
} }
return ''; return '';
}), }),
new go.Binding('stroke', 'lineType', (v) => { new go.Binding('stroke', 'lineType', v => {
// 未完成 // 未完成
if (v === 0) { if (v === 0) {
return '#342e2e11'; return '#342e2e11';
...@@ -1462,7 +1446,7 @@ const CaseModify = props => { ...@@ -1462,7 +1446,7 @@ const CaseModify = props => {
font: '10pt helvetica, arial, Microsoft YaHei', font: '10pt helvetica, arial, Microsoft YaHei',
margin: 4, margin: 4,
}, },
new go.Binding('stroke', 'lineType', (v) => { new go.Binding('stroke', 'lineType', v => {
// 未完成 // 未完成
if (v === 0) { if (v === 0) {
return '#d2d2d2'; return '#d2d2d2';
...@@ -1473,7 +1457,7 @@ const CaseModify = props => { ...@@ -1473,7 +1457,7 @@ const CaseModify = props => {
} }
return ''; return '';
}), }),
new go.Binding('text', 'lineDetail', (v) => lineText(v)), new go.Binding('text', 'lineDetail', v => lineText(v)),
), ),
), ),
); );
...@@ -1487,7 +1471,7 @@ const CaseModify = props => { ...@@ -1487,7 +1471,7 @@ const CaseModify = props => {
const nodeBoxStyle = (atr, classname) => { const nodeBoxStyle = (atr, classname) => {
switch (atr) { switch (atr) {
case 'width': case 'width':
return new go.Binding('width', 'NodeType', (v) => { return new go.Binding('width', 'NodeType', v => {
switch (v) { switch (v) {
case '1': case '1':
return 140; return 140;
...@@ -1510,7 +1494,7 @@ const CaseModify = props => { ...@@ -1510,7 +1494,7 @@ const CaseModify = props => {
} }
}); });
case 'height': case 'height':
return new go.Binding('height', 'NodeType', (v) => { return new go.Binding('height', 'NodeType', v => {
switch (v) { switch (v) {
case '1': case '1':
return 140; return 140;
...@@ -1533,7 +1517,7 @@ const CaseModify = props => { ...@@ -1533,7 +1517,7 @@ const CaseModify = props => {
} }
}); });
case 'stroke': case 'stroke':
return new go.Binding('stroke', 'nodeDetail', (v) => { return new go.Binding('stroke', 'nodeDetail', v => {
const obj = JSON.parse(v); const obj = JSON.parse(v);
switch (obj.NodeType) { switch (obj.NodeType) {
case '1': case '1':
...@@ -1553,29 +1537,46 @@ const CaseModify = props => { ...@@ -1553,29 +1537,46 @@ const CaseModify = props => {
return null; return null;
} }
}; };
// 线上文案样式 // 线上文案样式
const lineTextStyle = v => { const lineTextStyle = v => {
let obj = JSON.parse(v); let obj = JSON.parse(v);
let nodeData = myDiagram.model.findNodeDataForKey(obj.from); let nodeData = myDiagram.model.findNodeDataForKey(obj.from);
if (nodeData.NodeType === '20' || nodeData.NodeType === '21') { if (nodeData.NodeType === '20' || nodeData.NodeType === '21') {
// if(nodeData.) // if(nodeData.)
if (nodeData.RuleList.some(ele => ele.NextNodeId === obj.to)) { if (nodeData.RuleList.some(ele => ele.NextNodeId === obj.to)) {
return '#EFF8FA'; return '#EFF8FA';
}
return 'transparent';
} }
return 'transparent'; return 'transparent';
};
// 线上的文案
const lineText = v => {
let obj = JSON.parse(v);
let nodeData = myDiagram.model.findNodeDataForKey(obj.from);
if (nodeData.NodeType === '20' || nodeData.NodeType === '21') {
return nodeData.RuleList.find(ele => ele.NextNodeId === obj.to).RuleName;
}
return '';
};
const onOK= async ()=>{
console.log(formJsonRef.current, 'formJsonRef.current');
if(isObject(formJsonRef.current)){
const formJsonData = getFormData(formJsonRef.current);
if(isObject(formJsonData)){
Object.keys(formJsonData).forEach(v => {
if(formJsonData[v].widget === 'TextInput'){
const { presetValue, isStoreID } = formJsonData[v];
}
})
}
const formData = await formRef.current.getValues();
console.log(formData, formJsonData, 'formDataformDataformData');
}
setFormVisible(false)
} }
return 'transparent';
};
// 线上的文案
const lineText = v => {
let obj = JSON.parse(v);
let nodeData = myDiagram.model.findNodeDataForKey(obj.from);
if (nodeData.NodeType === '20' || nodeData.NodeType === '21') {
return nodeData.RuleList.find(ele => ele.NextNodeId === obj.to).RuleName;
}
return '';
};
const validContent = <span style={{ color: 'red', fontSize: '18px' }}>*</span>; const validContent = <span style={{ color: 'red', fontSize: '18px' }}>*</span>;
return ( return (
...@@ -1603,7 +1604,7 @@ const lineText = v => { ...@@ -1603,7 +1604,7 @@ const lineText = v => {
disabled={mode === 'edit'} disabled={mode === 'edit'}
onChange={v => { onChange={v => {
setConfigInfo({ ...configInfo, schemeName: v.target.value }); setConfigInfo({ ...configInfo, schemeName: v.target.value });
generatePostData({ schemeName: v.target.value }) generatePostData({ schemeName: v.target.value });
}} }}
/> />
<p style={{ position: 'absolute', color: 'red' }}>{configInfo.schemeNameErrMsg}</p> <p style={{ position: 'absolute', color: 'red' }}>{configInfo.schemeNameErrMsg}</p>
...@@ -1678,7 +1679,9 @@ const lineText = v => { ...@@ -1678,7 +1679,9 @@ const lineText = v => {
style={{ color: '#1890ff', border: '1px solid #1890ff' }} style={{ color: '#1890ff', border: '1px solid #1890ff' }}
onClick={() => handleCKPerson(configInfo)} onClick={() => handleCKPerson(configInfo)}
> >
{(configInfo.userIds.length > 0 || configInfo.roleIds.length > 0) ? '已选下一节点办理人' : '选择下一节点办理人'} {configInfo.userIds.length > 0 || configInfo.roleIds.length > 0
? '已选下一节点办理人'
: '选择下一节点办理人'}
</Button> </Button>
<p style={{ position: 'absolute', color: 'red' }}>{configInfo.userIdsErrMsg}</p> <p style={{ position: 'absolute', color: 'red' }}>{configInfo.userIdsErrMsg}</p>
</div> </div>
...@@ -1761,10 +1764,12 @@ const lineText = v => { ...@@ -1761,10 +1764,12 @@ const lineText = v => {
<span style={{ color: 'red' }}>{v.ruleContentErrMsg}</span> <span style={{ color: 'red' }}>{v.ruleContentErrMsg}</span>
<Button <Button
block block
style={{ color: '#1890ff', border: '1px solid #1890ff', overflow: 'hidden' }} style={{ color: '#1890ff', border: '1px solid #1890ff', overflow: 'hidden' }}
onClick={() => handleRuleClick(() => setShowPersonSelect(true), v.id)} onClick={() => handleRuleClick(() => setShowPersonSelect(true), v.id)}
> >
{(v.userIds.length || v.roleIds.length) ? [...(v.userIds), ...(v.roleIds)].map(v => v.name).join(',') : '选择下一节点办理人'} {v.userIds.length || v.roleIds.length
? [...v.userIds, ...v.roleIds].map(v => v.name).join(',')
: '选择下一节点办理人'}
</Button> </Button>
<span style={{ color: 'red' }}>{v.userIdsErrMsg}</span> <span style={{ color: 'red' }}>{v.userIdsErrMsg}</span>
</Space> </Space>
...@@ -1799,9 +1804,15 @@ const lineText = v => { ...@@ -1799,9 +1804,15 @@ const lineText = v => {
> >
<Space> <Space>
<span>开始时间:</span> <span>开始时间:</span>
<DatePicker showTime={{ <DatePicker
format: 'HH' showTime={{
}} locale={locale} format={'YYYY-MM-DD HH:00'} value={startTime} onChange={t => setStartTime(t)} /> format: 'HH',
}}
locale={locale}
format={'YYYY-MM-DD HH:00'}
value={startTime}
onChange={t => setStartTime(t)}
/>
<span>结束时间:</span> <span>结束时间:</span>
<DatePicker locale={locale} value={endTime} onChange={t => setEndTime(t)} /> <DatePicker locale={locale} value={endTime} onChange={t => setEndTime(t)} />
</Space> </Space>
...@@ -1921,23 +1932,31 @@ const lineText = v => { ...@@ -1921,23 +1932,31 @@ const lineText = v => {
</div> </div>
<p style={{ color: 'red' }}>{errorMsg}</p> <p style={{ color: 'red' }}>{errorMsg}</p>
<span>下次请求时间:{tip}</span> <span>下次请求时间:{tip}</span>
<Modal {showForm && (
title="选择时间" <div style={{ marginTop: '20px' }}>
visible={openTeditor} <Space>
onOk={() => setOpenTeditor(false)} <span>工单移交模板:</span>
onCancel={() => setOpenTeditor(false)} <Button onClick={()=> setFormVisible(true)}>点击查看</Button>
destroyOnClose </Space>
footer={[ </div>
<Button type={'primary'} onClick={() => setOpenTeditor(false)}> )}
确定
</Button>,
]}
>
{timeEditor()}
</Modal>
</div> </div>
</> </>
)} )}
<Modal
title="选择时间"
visible={openTeditor}
onOk={() => setOpenTeditor(false)}
onCancel={() => setOpenTeditor(false)}
destroyOnClose
footer={[
<Button type={'primary'} onClick={() => setOpenTeditor(false)}>
确定
</Button>,
]}
>
{timeEditor()}
</Modal>
<Modal <Modal
visible={isPreview} visible={isPreview}
centered centered
...@@ -1947,9 +1966,22 @@ const lineText = v => { ...@@ -1947,9 +1966,22 @@ const lineText = v => {
onCancel={() => setIsPreView(false)} onCancel={() => setIsPreView(false)}
footer={null} footer={null}
> >
<div className={styles.map}> <div className={styles.map}>
{isPreview && <div id="myDiagramDiv" className={styles.diagram}></div>} {isPreview && <div id="myDiagramDiv" className={styles.diagram} />}
</div> </div>
</Modal>
<Modal
width={'80%'}
bodyStyle={{ overflow: 'auto', height: 600, padding: '10px' }}
title={'编辑移交模板'}
maskClosable={false}
visible={formVisible}
onCancel={() => setFormVisible(false)}
onOk={onOK}
destroyOnClose
>
<FormRender schemaValues={schemaValues} ref={formRef} />
</Modal> </Modal>
<RuleConfig <RuleConfig
RuleContent={ruleContent.current} RuleContent={ruleContent.current}
......
...@@ -28,6 +28,7 @@ import { ...@@ -28,6 +28,7 @@ import {
DeleteFlowAutoConfig, DeleteFlowAutoConfig,
EnableDisableFlowAutoConfig, EnableDisableFlowAutoConfig,
GetFlowAutoConfigDetail, GetFlowAutoConfigDetail,
GetFlowCenterData
} from '@/services/flow/flow'; } from '@/services/flow/flow';
import { import {
GetIISAgentConfig, GetIISAgentConfig,
...@@ -62,6 +63,7 @@ const AutoCase = props => { ...@@ -62,6 +63,7 @@ const AutoCase = props => {
let flowConfigDetail = useRef(null); let flowConfigDetail = useRef(null);
let showlogId = useRef(null); let showlogId = useRef(null);
let planName = useRef(null) let planName = useRef(null)
let flowCenterData = useRef(null);
const [refreshKey, setRefreshKey] = useState(0) const [refreshKey, setRefreshKey] = useState(0)
let mode = useRef(''); let mode = useRef('');
const statusObj = [<Tag color="default">已停用</Tag>, <Tag color="processing">已启用</Tag>]; const statusObj = [<Tag color="default">已停用</Tag>, <Tag color="processing">已启用</Tag>];
...@@ -184,8 +186,20 @@ const AutoCase = props => { ...@@ -184,8 +186,20 @@ const AutoCase = props => {
useEffect(()=>{ useEffect(()=>{
getTableList() getTableList()
getFlowCenterData()
}, []) }, [])
const getFlowCenterData = async () => {
const { code, data, msg } = await GetFlowCenterData({
userID: 1,
systemType: '业务系统',
isFilterOrderMode: 0,
isInternal: 0
});
if(code == 0){
flowCenterData.current = data;
}
}
const getTableList = () => { const getTableList = () => {
GetIISAgentConfig({ agentName: '' }).then(res => { GetIISAgentConfig({ agentName: '' }).then(res => {
...@@ -423,6 +437,7 @@ const AutoCase = props => { ...@@ -423,6 +437,7 @@ const AutoCase = props => {
{openEditor && <CaseModify {openEditor && <CaseModify
visible={openEditor} visible={openEditor}
flowConfigDetail={flowConfigDetail.current} flowConfigDetail={flowConfigDetail.current}
flowCenterData={flowCenterData.current}
mode={mode.current} mode={mode.current}
onClose={() => setOpeneditor(false)} onClose={() => setOpeneditor(false)}
onOk={onSubmit} onOk={onSubmit}
......
...@@ -147,6 +147,12 @@ export const GetFlowAutoConfigDetail = query => get(`${PUBLISH_SERVICE}/WorkFlow ...@@ -147,6 +147,12 @@ export const GetFlowAutoConfigDetail = query => get(`${PUBLISH_SERVICE}/WorkFlow
export const GetFlowAutoSchemeLogs = query => get(`${PUBLISH_SERVICE}/WorkFlow/GetFlowAutoSchemeLogs`, query); export const GetFlowAutoSchemeLogs = query => get(`${PUBLISH_SERVICE}/WorkFlow/GetFlowAutoSchemeLogs`, query);
export const GetBizMetaData = query => post(`${PANDAWORKFLOW}/EventManage/GetBizMetaData`, query);
export const GetFlowCenterData = query => get(`${PANDAWORKFLOW}/EventManage/GetFlowCenterData`, query);
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