Commit 0269ca50 authored by 涂伟's avatar 涂伟
parents 8e3007d0 baf378c8
Pipeline #96717 failed with stages
......@@ -94,8 +94,8 @@
"@wangeditor/editor-for-react": "^1.0.6",
"@wisdom-cesium/cesium": "1.1.12",
"@wisdom-cesium/krpano": "^1.0.29-60",
"@wisdom-map/arcgismap":"^2.0.97",
"@wisdom-map/basemap":"^2.0.4",
"@wisdom-map/arcgismap": "^2.0.97",
"@wisdom-map/basemap": "^2.0.4",
"@wisdom-map/gis-component": "^1.0.46",
"@wisdom-map/gis-utils": "^1.0.41",
"@wisdom-map/pd-map": "^1.0.140",
......@@ -131,7 +131,7 @@
"jszip": "^3.10.1",
"lodash": "4.17.11",
"minimist": "1.2.0",
"panda-xform": "6.11.09",
"panda-xform": "6.11.19",
"parseForm": "^2.3.8",
"prop-types": "15.7.2",
"qrcode.react": "^3.1.0",
......@@ -165,7 +165,8 @@
"styled-components": "4.2.0",
"use-merge-value": "^1.0.2",
"virtuallist-antd": "^0.8.0-beta.1",
"voca": "^1.4.0"
"voca": "^1.4.0",
"xlsx": "^0.18.5"
},
"devDependencies": {
"@ant-design/icons": "^4.0.0",
......
......@@ -13,6 +13,7 @@ import {
InputNumber,
Checkbox,
message,
Switch
} from 'antd';
import 'moment/dist/locale/zh-cn';
import locale from 'antd/es/date-picker/locale/zh_CN';
......@@ -20,7 +21,11 @@ import moment from 'moment/moment';
import RuleConfig from '@/components/RuleConfig';
import PeopleSelector from '@/components/PeopleSelector';
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 imgEnd from '@/assets/images/workFlow/nodeEnd.png';
import gatewayConfluence from '@/assets/images/workFlow/gatewayParallel.png';
......@@ -28,8 +33,19 @@ import gatewayExclusive from '@/assets/images/workFlow/gatewayCondition.png';
import gatewayInclude from '@/assets/images/workFlow/gatewayJoin.png';
import imgGeneral from '@/assets/images/workFlow/nodeGeneral.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 { isObject } from 'lodash';
import { FormRender } from 'panda-xform';
const convertKeysToLowercase = (obj) => {
return Object.fromEntries(
Object.entries(obj).map(([key, value]) => {
const newKey = key.charAt(0).toLowerCase() + key.slice(1);
return [newKey, value];
})
);
};
const days = moment().daysInMonth();
const allDays = [...Array.from({ length: days + 1 }, (_, i) => i + 1)];
const weeks = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期天'];
......@@ -37,7 +53,7 @@ const weeks1 = ['第一周', '第二周', '第三周', '第四周', '最后一
let myDiagram = null;
const CaseModify = props => {
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 [timeType, setTimeType] = useState('');
const [showTtype, setShowTtype] = useState('time');
......@@ -45,6 +61,7 @@ const CaseModify = props => {
const [showPersonSelect, setShowPersonSelect] = useState(false);
const [openTeditor, setOpenTeditor] = useState(false);
const [loadding, setloadding] = useState(false);
const [schemaValues, setSchemaValues] = useState({ values: [], formJson: {} });
const [configInfo, setConfigInfo] = useState({
schemeName: '',
schemeNameErrMsg: '', //验证必填提示词
......@@ -75,14 +92,18 @@ const CaseModify = props => {
const [weekValues, setWeekValues] = useState([]); //每周 每月 按周 星期几
const [weekValues1, setWeekValues1] = useState([]); //每月 按周 第几周
const [dayValues, setDayValues] = useState([]); //每月 按日
const [startTime, setStartTime] = useState(moment());
const [startTime, setStartTime] = useState(moment(moment().format('YYYY-MM-DD HH:00:00')));
const [endTime, setEndTime] = useState('');
const [tip, setTip] = useState('');
const [num, setNum] = useState(0);
const [flowList, setFlowList] = useState([]);
const [nodeNams, setNodeNames] = useState([]);
const [isPreview, setIsPreView] = useState(false);
const [formVisible, setFormVisible] = useState(false);
const [showForm, setShowForm] = useState(false);
const [errorMsg, setErrorMsg] = useState(''); //定时触发下的参数校验
let formRef = useRef(null);
let formJsonRef = useRef({})
let weekType = useRef(''); //每周 按周 第几周 周几执行
let timeUnit = useRef('hour');
let ruleContent = useRef('');
......@@ -90,9 +111,7 @@ const CaseModify = props => {
let roleIdsRef = useRef([]);
let ruleField = useRef([]);
let flowData = useRef([]);
let imgUrl = useRef('');
let flowTree = useRef([])
let flowDataList = useRef({})
let flowDataList = useRef({});
let postData = useRef({
id: null,
schemeName: '',
......@@ -110,6 +129,7 @@ const CaseModify = props => {
scheduledConfig: {
userIds: [], //用户ID
roleIds: [], //角色ID
values: [], //工单模板提交数据
agentConfig: '',
}, //定时触发
});
......@@ -128,13 +148,13 @@ const CaseModify = props => {
} else if (planType === 'ByMonth' && timeType == 'week') {
setTip(getTipByWeek(timeValues, weekValues, weekValues1));
}
}, [timeUnit.current, num, timeValues, weekValues, dayValues]);
}, [timeUnit.current, num, timeValues, weekValues, dayValues, startTime]);
useEffect(() => {
if (visible) {
getEventFlow();
if (mode === 'edit' && flowConfigDetail) {
dealPostData(flowConfigDetail);
dealPostData(flowConfigDetail);//编辑模式数据回填
}
// else {
// init();
......@@ -142,57 +162,6 @@ const CaseModify = props => {
}
}, [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 {
ID,
......@@ -223,6 +192,9 @@ const CaseModify = props => {
{
let res;
if (TriggerMethod === '定时触发') {
setShowForm(ScheduledConfig.Values.length > 0);
postData.current.scheduledConfig.values = ScheduledConfig.Values.map(v=> convertKeysToLowercase(v))
getBizMetaData(detail);
res = await GetConditionConfigFlowNode({ flowId: FlowId });
} else {
res = await GetScheduledConfigFlowNode({ flowId: FlowId });
......@@ -250,24 +222,28 @@ const CaseModify = props => {
return;
}
}
const { UserIds, AgentConfig, RoleIds } = ScheduledConfig
let userIds = []
let roleIds = []
if(UserIds.length > 0){
userIds = UserIds && UserIds.map(v=> {
const { UserIds, AgentConfig, RoleIds } = ScheduledConfig;
let userIds = [];
let roleIds = [];
if (UserIds.length > 0) {
userIds =
UserIds &&
UserIds.map(v => {
return {
id: v.ID,
name: v.Name
}
})
name: v.Name,
};
});
}
if(RoleIds.length > 0){
roleIds = RoleIds && RoleIds.map(v=> {
if (RoleIds.length > 0) {
roleIds =
RoleIds &&
RoleIds.map(v => {
return {
id: v.ID,
name: v.Name
}
})
name: v.Name,
};
});
}
setConfigInfo({
...configInfo,
......@@ -276,7 +252,7 @@ const CaseModify = props => {
triggerType: TriggerMethod,
schemeName: SchemeName,
roleIds,
userIds
userIds,
});
if (TriggerMethod === '条件触发') {
const { code, msg, data } = await GetFormDataSource({ flowId: FlowId });
......@@ -334,7 +310,6 @@ const CaseModify = props => {
setRuleInfos(rules);
}
} else {
const {
LoopMode,
LoopUnit,
......@@ -385,25 +360,12 @@ 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 { code, data, msg } = await GetSubEventFlows();
if (code === 0) {
flowData.current = data;
const list = data.map(v => {
const d = data.filter(v=> v.CreateMode === 1);
flowData.current =d
const list = d.map(v => {
return { value: v.SubFlowId, label: `${v.FlowName}(${v.EventName})` };
});
setFlowList(list);
......@@ -411,54 +373,118 @@ const CaseModify = props => {
message.error(msg);
}
};
const getPrewViewImage = async (flowId) =>{
const getPrewViewImage = async flowId => {
let res = await GetFlowNode({ flowID: flowId });
if (res.code === 0) {
res.data.Nodes.forEach(item => {
item.nodeDetail = JSON.stringify(item);
item.key = item.NodeName
item.key = item.NodeName;
});
res.data.Lines.forEach(item => {
item.lineDetail = JSON.stringify(item);
});
flowDataList.current = { ...res.data, flowName: postData.current.flowName }
initMap(flowDataList.current)
flowDataList.current = { ...res.data, flowName: postData.current.flowName };
initMap(flowDataList.current);
} else {
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);
console.log(paramObj, EventName,FlowName, 'paramObjparamObj')
if (paramObj) {
paramObj = {
...paramObj,
userId: 1,
};
const vals = ScheduledConfig.Values
const { code, data, msg } = await GetBizMetaData(paramObj);
const { formJson, values } = data[0];
const jsonObj = JSON.parse(formJson)
const formValues =vals.length > 0 ? values.map(v=> {
const d = vals.find(x=> v.fieldName === x.FieldName)
if(d){
return {
...v,
fieldValue: d.FieldValue
}
}
return v
}) : values
console.log(formValues, 'formValuesformValuesformValues');
formJsonRef.current = jsonObj
setSchemaValues({ values: formValues, formJson: jsonObj });
}else{
formJsonRef.current = null
setSchemaValues({ values: [], formJson: {} });
}
};
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) => {
if (startTime) {
setTip(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) => {
if (!timeVals.length || !dayVals.length) return;
const now = moment(startTime);
const times = timeVals.sort((a, b) => a - b);
if (dayVals.length == 1 && dayVals[0] === allDays[allDays.length - 1]) {
return moment()
return now
.endOf('month')
.hour(times[0])
.minute(0)
.second(0)
.format(`YYYY-MM-DD HH:mm:ss`);
}
const dayOfMonth = moment().date(); //当前第几天
const dayOfMonth = now.date(); //当前第几天
const dayvals = dayVals.sort((a, b) => a - b).filter(v => v >= dayOfMonth);
if (dayvals.length > 0) {
return moment()
return now
.hour(times[0])
.minute(0)
.second(0)
.format(`YYYY-MM-${dayvals[0] < 10 ? `0${dayvals[0]}` : dayvals[0]} HH:mm:ss`);
} else {
const days = dayVals.filter(v => v !== allDays[allDays.length - 1]);
return moment()
return now
.add(1, 'month')
.hour(times[0])
.minute(0)
......@@ -478,7 +504,7 @@ const CaseModify = props => {
};
const getNextDateByTierAndWeekday = (y, m, tier, weekday, timeVals) => {
let now = moment();
let now = moment(startTime);
let year = y || now.year();
let month = m || now.month() + 1; // 获取当前月份(1~12)
......@@ -526,34 +552,34 @@ const CaseModify = props => {
const weekObj = {};
weeks.forEach((v, i) => (weekObj[v] = i + 1));
const weekNum = weekObj[targetWeekday];
const today = moment();
const today = moment(startTime);
const nextDay =
today.isoWeekday() < weekNum
? today.isoWeekday(weekNum) // 本周还没到目标周几
: today.add(1, 'weeks').isoWeekday(weekNum); // 目标周几已过,跳到下周
return nextDay.format(`YYYY-MM-DD ${times[0]}:mm:ss`);
return nextDay.format(`YYYY-MM-DD ${times[0]}:00:00`);
};
//计算每天的下次请求时间
const getNextClosestTime = hourArray => {
if (!hourArray.length) return;
const timeArry = hourArray.sort((a, b) => a - b);
const now = moment();
const now = moment(startTime);
const currentHour = now.hour();
// 找到大于当前小时的最近时间
// const nextHour = timeArry.find(h => h > currentHour);
if (timeArry[0] > currentHour) {
return moment()
if (timeArry[0] >= currentHour) {
return now
.hour(timeArry[0])
.minute(0)
.second(0)
.format('YYYY-MM-DD HH:mm:ss');
} else {
// 如果所有时间都已经过了,返回明天的最早时间
return moment()
return now
.add(1, 'days')
.hour(timeArry[0])
.minute(0)
......@@ -812,6 +838,7 @@ const CaseModify = props => {
getNodeAPI = GetScheduledConfigFlowNode({ flowId });
getRuleConfigAPI = GetFormDataSource({ flowId });
} else {
getNodeAPI = GetConditionConfigFlowNode({ flowId });
}
Promise.all([getNodeAPI, getRuleConfigAPI && getRuleConfigAPI]).then(res => {
......@@ -824,6 +851,17 @@ const CaseModify = props => {
});
setNodeNames(nodeNames);
if (configInfo.triggerType == '定时触发') {
const d = flowData.current.find(v=> v.SubFlowId == flowId);
console.log(flowData.current, d, 'wwwwww')
if(d){
const { FlowName, EventName } = d
getBizMetaData({
FlowName,
EventName,
ScheduledConfig: { Values: [] }
})
}
setConfigInfo({ ...configInfo, activityId: nodeNames[0].value, flowId: flowId });
generatePostData({ activityId: nodeNames[0].value, activityName: nodeNames[0].label });
} else {
......@@ -924,7 +962,6 @@ const CaseModify = props => {
const handleSelectRuleType = (e, type) => {
const { checked } = e.target;
generatePostData({ triggerMethod: type });
if (type === '定时触发') {
generatePostData({});
if (nodeNams.length > 0) {
......@@ -978,32 +1015,52 @@ const CaseModify = props => {
return;
}
console.log(e, 'eeeeeeee');
let list = ruleInfos;
if (person.length) {
list = list.map(v =>
v.id === (id || currentRuleId.current)
? {
...v,
userIds: person.map(x => {
userIds:
person.length > 0
? person.map(x => {
return { id: Number(x.value), name: x.label };
}),
})
: [],
userIds:
person.length > 0
? person.map(x => {
return { id: Number(x.value), name: x.label };
})
: [],
}
: v,
);
}
// if (person.length) {
// list = list.map(v =>
// v.id === (id || currentRuleId.current)
// ? {
// ...v,
// userIds: person.length > 0 ? person.map(x => {
// return { id: Number(x.value), name: x.label };
// }) : [] ,
// }
// : v,
// );
// }
if (role.length) {
list = list.map(v =>
v.id === (id || currentRuleId.current)
? {
...v,
roleIds: role.map(x => {
return { id: x.value, name: x.label };
}),
}
: v,
);
}
// if (role.length) {
// list = list.map(v =>
// v.id === (id || currentRuleId.current)
// ? {
// ...v,
// roleIds: role.length > 0 ? role.map(x => {
// return { id: x.value, name: x.label };
// }) : [],
// }
// : v,
// );
// }
setRuleInfos(list);
setShowPersonSelect(false);
} else if (type == 'rule') {
......@@ -1024,13 +1081,12 @@ const CaseModify = props => {
};
const hasValue = field => field !== undefined && field !== null && field.trim?.() !== '';
const isValid = () => {
const { schemeName, flowId, activityId, userIds } = configInfo;
const { schemeName, flowId, activityId, userIds, roleIds } = configInfo;
let schemeNameErrMsg = '';
let flowIdErrMsg = '';
let activityIdErrMsg = '';
let userIdsErrMsg = '';
let isOk =
hasValue(schemeName) && hasValue(flowId) && hasValue(activityId);
let isOk = hasValue(schemeName) && hasValue(flowId) && hasValue(activityId);
if (!schemeName) {
schemeNameErrMsg = '方案名称必填';
......@@ -1049,7 +1105,8 @@ const CaseModify = props => {
} else {
activityIdErrMsg = '';
}
if (userIds.length < 1) {
console.log(userIds, roleIds, 'userIds, roleIdsuserIds, roleIds');
if (userIds.length < 1 && roleIds.length < 1) {
userIdsErrMsg = '请选择下一节点办理人';
} else {
userIdsErrMsg = '';
......@@ -1066,7 +1123,10 @@ const CaseModify = props => {
isOk =
isOk &&
ruleInfos.every(
v => v.userIds.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;
for (let i of infos) {
......@@ -1081,7 +1141,7 @@ const CaseModify = props => {
i.ruleContentErrMsg = '';
}
if (i.userIds.length < 1) {
if (i.userIds.length < 1 && i.roleIds.length < 1) {
i.userIdsErrMsg = '下一节点办理人必填';
} else {
i.userIdsErrMsg = '';
......@@ -1089,7 +1149,7 @@ const CaseModify = props => {
}
setRuleInfos(infos);
} else {
isOk = isOk && userIds.length > 0;
isOk = isOk && (userIds.length > 0 || roleIds.length > 0);
let msg = '';
if (planType === 'ByLoop') {
if (!num || num < 0) {
......@@ -1143,10 +1203,10 @@ const CaseModify = props => {
const handleOnOk = () => {
if (!isValid()) {
message.warn('校验未通过,请检查表单填写信息!')
message.warn('校验未通过,请检查表单填写信息!');
return;
}
setloadding(true)
setloadding(true);
if (configInfo.triggerType === '条件触发') {
postData.current.conditionConfig = {
ruleList: ruleInfos,
......@@ -1176,14 +1236,15 @@ const CaseModify = props => {
agentConfig.dayOfWeek = weekValues.map(v => weeks.indexOf(v) + 1).join(',');
}
}
console.log(postData.current.scheduledConfig.values, 'postData.current.scheduledConfig.values')
postData.current.scheduledConfig = {
agentConfig,
userIds: configInfo.userIds,
roleIds: configInfo.roleIds,
values: showForm ? postData.current.scheduledConfig.values : []
};
}
const fn = ()=> setloadding(false)
const fn = () => setloadding(false);
onOk(postData.current, fn);
};
......@@ -1207,8 +1268,7 @@ const CaseModify = props => {
setShowPersonSelect(true);
};
const initMap = (data) => {
const initMap = data => {
setTimeout(() => {
if (myDiagram) {
myDiagram.div = null; // 断开现有 Diagram 的 div 绑定
......@@ -1242,9 +1302,7 @@ const CaseModify = props => {
go.Node,
'Auto',
// { deletable: false, toolTip: tooltiptemplate },
new go.Binding('location', 'points', go.Point.parse).makeTwoWay(
go.Point.stringify,
),
new go.Binding('location', 'points', go.Point.parse).makeTwoWay(go.Point.stringify),
// 节点样式配置
_$(
go.Panel,
......@@ -1252,7 +1310,7 @@ const CaseModify = props => {
nodeBoxStyle('height'),
_$(
go.Picture,
new go.Binding('source', 'nodeDetail', (v) => {
new go.Binding('source', 'nodeDetail', v => {
const obj = JSON.parse(v);
console.log(obj, 'vvvvvvv');
switch (obj.NodeType) {
......@@ -1301,13 +1359,9 @@ const CaseModify = props => {
overflow: go.TextBlock.OverflowEllipsis,
font: 'normal 12pt Microsoft YaHei',
},
new go.Binding('text', 'nodeDetail', (v) => {
new go.Binding('text', 'nodeDetail', v => {
const obj = JSON.parse(v);
if (
obj.NodeType === '20' ||
obj.NodeType === '21' ||
obj.NodeType === '22'
) {
if (obj.NodeType === '20' || obj.NodeType === '21' || obj.NodeType === '22') {
return '';
}
return obj.NodeName.slice(0, 6);
......@@ -1322,22 +1376,14 @@ const CaseModify = props => {
overflow: go.TextBlock.OverflowEllipsis,
font: 'normal 12pt Microsoft YaHei',
},
new go.Binding('spacingAbove', 'undertakeman', (v) =>
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('spacingAbove', 'undertakeman', v => (v?.length > 0 ? 5 : 0)),
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,
),
new go.Binding('text', 'nodeDetail', (v) => {
new go.Binding('text', 'nodeDetail', v => {
const obj = JSON.parse(v);
if (
obj.NodeType === '20' ||
obj.NodeType === '21' ||
obj.NodeType === '22'
) {
if (obj.NodeType === '20' || obj.NodeType === '21' || obj.NodeType === '22') {
return '';
}
if (obj.RoleList?.length === 0) {
......@@ -1356,16 +1402,13 @@ const CaseModify = props => {
mouseEnter(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
toolTip: _$(
'ToolTip',
_$(go.TextBlock, { margin: 4 }, new go.Binding('text', 'tip')),
), // end of Adornment
toolTip: _$('ToolTip', _$(go.TextBlock, { margin: 4 }, new go.Binding('text', 'tip'))), // end of Adornment
},
);
// 链接设置
......@@ -1381,7 +1424,7 @@ const CaseModify = props => {
_$(
go.Shape, // 链接路径形状
{ isPanelMain: true, strokeWidth: 3, stroke: '#1685FF' },
new go.Binding('stroke', 'lineType', (v) => {
new go.Binding('stroke', 'lineType', v => {
// 未完成
if (v === 0) {
return '#342e2e11';
......@@ -1392,7 +1435,7 @@ const CaseModify = props => {
}
return '';
}),
new go.Binding('strokeDashArray', 'lineType', (v) => {
new go.Binding('strokeDashArray', 'lineType', v => {
// 未完成
if (v === 0) {
return [6, 3];
......@@ -1407,7 +1450,7 @@ const CaseModify = props => {
_$(
go.Shape, // 箭头
{ toArrow: 'Standard', stroke: '#1685FF', fill: '#1685FF' },
new go.Binding('fill', 'lineType', (v) => {
new go.Binding('fill', 'lineType', v => {
// 未完成
if (v === 0) {
return '#342e2e11';
......@@ -1418,7 +1461,7 @@ const CaseModify = props => {
}
return '';
}),
new go.Binding('stroke', 'lineType', (v) => {
new go.Binding('stroke', 'lineType', v => {
// 未完成
if (v === 0) {
return '#342e2e11';
......@@ -1446,7 +1489,7 @@ const CaseModify = props => {
font: '10pt helvetica, arial, Microsoft YaHei',
margin: 4,
},
new go.Binding('stroke', 'lineType', (v) => {
new go.Binding('stroke', 'lineType', v => {
// 未完成
if (v === 0) {
return '#d2d2d2';
......@@ -1457,7 +1500,7 @@ const CaseModify = props => {
}
return '';
}),
new go.Binding('text', 'lineDetail', (v) => lineText(v)),
new go.Binding('text', 'lineDetail', v => lineText(v)),
),
),
);
......@@ -1471,7 +1514,7 @@ const CaseModify = props => {
const nodeBoxStyle = (atr, classname) => {
switch (atr) {
case 'width':
return new go.Binding('width', 'NodeType', (v) => {
return new go.Binding('width', 'NodeType', v => {
switch (v) {
case '1':
return 140;
......@@ -1494,7 +1537,7 @@ const CaseModify = props => {
}
});
case 'height':
return new go.Binding('height', 'NodeType', (v) => {
return new go.Binding('height', 'NodeType', v => {
switch (v) {
case '1':
return 140;
......@@ -1517,7 +1560,7 @@ const CaseModify = props => {
}
});
case 'stroke':
return new go.Binding('stroke', 'nodeDetail', (v) => {
return new go.Binding('stroke', 'nodeDetail', v => {
const obj = JSON.parse(v);
switch (obj.NodeType) {
case '1':
......@@ -1550,16 +1593,65 @@ const CaseModify = props => {
return 'transparent';
}
return 'transparent';
};
// 线上的文案
const lineText = v => {
};
// 线上的文案
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 loaclPaths = ['【本人姓名】', '【本人电话】', '【本人部门】']
const onOK= async ()=>{
console.log(formJsonRef.current, 'formJsonRef.current');
if(isObject(formJsonRef.current)){
const formJsonData = getFormData(formJsonRef.current);
const { errors, formValue } = await formRef.current.getValues();
if(errors.length > 0){
message.warn('表单校验不通过,请先完善表单')
return;
}
const values = formValue.map(v=> {
if(formJsonData[v.fieldName]){
const { widget, presetValue, isStoreID, isMySite } = formJsonData[v.fieldName]
if(widget === 'TextInput' && loaclPaths.includes(presetValue)){
return {
fieldName: v.fieldName,
fieldValue: '',
presetValue,
isStoreID
}
}else if(widget === 'ComboBox' && isMySite){
return {
fieldName: v.fieldName,
fieldValue: '',
presetValue: '',
isStoreID
}
}
return {
fieldName: v.fieldName,
fieldValue: v.fieldValue,
presetValue: '',
isStoreID
}
}
})
setSchemaValues({ ...schemaValues, values: formValue })
console.log(values, formValue, 'valuesvaluesvalues');
postData.current.scheduledConfig.values = values
}
setFormVisible(false)
}
const onOpen = ()=>{
if(Object.keys(schemaValues.formJson).length === 0){
message.warn('未获取到表单配置')
}
setFormVisible(true)
}
const validContent = <span style={{ color: 'red', fontSize: '18px' }}>*</span>;
return (
......@@ -1587,7 +1679,7 @@ const lineText = v => {
disabled={mode === 'edit'}
onChange={v => {
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>
......@@ -1662,7 +1754,9 @@ const lineText = v => {
style={{ color: '#1890ff', border: '1px solid #1890ff' }}
onClick={() => handleCKPerson(configInfo)}
>
{configInfo.userIds.length > 0 ? '已选下一节点办理人' : '选择下一节点办理人'}
{configInfo.userIds.length > 0 || configInfo.roleIds.length > 0
? '已选下一节点办理人'
: '选择下一节点办理人'}
</Button>
<p style={{ position: 'absolute', color: 'red' }}>{configInfo.userIdsErrMsg}</p>
</div>
......@@ -1745,10 +1839,12 @@ const lineText = v => {
<span style={{ color: 'red' }}>{v.ruleContentErrMsg}</span>
<Button
block
style={{ color: '#1890ff', border: '1px solid #1890ff' }}
style={{ color: '#1890ff', border: '1px solid #1890ff', overflow: 'hidden' }}
onClick={() => handleRuleClick(() => setShowPersonSelect(true), v.id)}
>
{v.userIds.length ? v.userIds.map(v => v.name).join(',') : '选择下一节点办理人'}
{v.userIds.length || v.roleIds.length
? [...v.userIds, ...v.roleIds].map(v => v.name).join(',')
: '选择下一节点办理人'}
</Button>
<span style={{ color: 'red' }}>{v.userIdsErrMsg}</span>
</Space>
......@@ -1776,20 +1872,28 @@ const lineText = v => {
</Row>
<div
style={{
width: '500px',
width: '540px',
padding: '10px',
margin: '10px auto',
}}
>
<Space>
<span>开始时间:</span>
<DatePicker locale={locale} value={startTime} onChange={t => setStartTime(t)} />
<DatePicker
showTime={{
format: 'HH',
}}
locale={locale}
format={'YYYY-MM-DD HH:00'}
value={startTime}
onChange={t => setStartTime(moment(t.format('YYYY-MM-DD HH:00:00')))}
/>
<span>结束时间:</span>
<DatePicker locale={locale} value={endTime} onChange={t => setEndTime(t)} />
</Space>
<div
style={{
width: '500px',
width: '540px',
background: 'rgb(243, 243, 243)',
padding: '10px',
margin: '10px auto',
......@@ -1903,6 +2007,18 @@ const lineText = v => {
</div>
<p style={{ color: 'red' }}>{errorMsg}</p>
<span>下次请求时间:{tip}</span>
{configInfo.triggerType == '定时触发' &&
<div style={{ marginTop: '10px' }}>
<Space>
<span>是否填写表单:</span>
<Switch checkedChildren="开启" unCheckedChildren="关闭" checked={showForm} onChange={(e)=> setShowForm(e)}/>
{showForm && <Button onClick={onOpen}>点击查看</Button>}
</Space>
</div>
}
</div>
</>
)}
<Modal
title="选择时间"
visible={openTeditor}
......@@ -1917,9 +2033,6 @@ const lineText = v => {
>
{timeEditor()}
</Modal>
</div>
</>
)}
<Modal
visible={isPreview}
centered
......@@ -1930,9 +2043,22 @@ const lineText = v => {
footer={null}
>
<div className={styles.map}>
{isPreview && <div id="myDiagramDiv" className={styles.diagram}></div>}
{isPreview && <div id="myDiagramDiv" className={styles.diagram} />}
</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>
<RuleConfig
RuleContent={ruleContent.current}
fieldList={ruleField.current}
......
......@@ -28,6 +28,7 @@ import {
DeleteFlowAutoConfig,
EnableDisableFlowAutoConfig,
GetFlowAutoConfigDetail,
GetFlowCenterData
} from '@/services/flow/flow';
import {
GetIISAgentConfig,
......@@ -62,6 +63,7 @@ const AutoCase = props => {
let flowConfigDetail = useRef(null);
let showlogId = useRef(null);
let planName = useRef(null)
let flowCenterData = useRef(null);
const [refreshKey, setRefreshKey] = useState(0)
let mode = useRef('');
const statusObj = [<Tag color="default">已停用</Tag>, <Tag color="processing">已启用</Tag>];
......@@ -141,6 +143,7 @@ const AutoCase = props => {
{
align: 'center',
title: '操作',
fixed: 'right',
render: (text, record, i) => {
return (
<Space size={'middle'} direction={'horizontal'}>
......@@ -183,8 +186,20 @@ const AutoCase = props => {
useEffect(()=>{
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 = () => {
GetIISAgentConfig({ agentName: '' }).then(res => {
......@@ -352,7 +367,7 @@ const AutoCase = props => {
}
const res = await AddOrEditFlowAutoConfig(data);
if (res.code === 0) {
message.success('新增成功!');
message.success('操作成功!');
getData();
setOpeneditor(false);
} else {
......@@ -365,8 +380,8 @@ const AutoCase = props => {
<div className={style.content}>
<div className={style.header}>
<Space size={'middle'}>
<span>创建时间:</span>
<RangePicker showTime locale={locale} onChange={e => handleChange(e, 'date')} />
{/* <span>创建时间:</span>
<RangePicker showTime locale={locale} onChange={e => handleChange(e, 'date')} /> */}
<span>方案状态:</span>
<Radio.Group value={status} onChange={e => handleChange(e, 'status')}>
<Radio.Button value={-1}>全部</Radio.Button>
......@@ -422,6 +437,7 @@ const AutoCase = props => {
{openEditor && <CaseModify
visible={openEditor}
flowConfigDetail={flowConfigDetail.current}
flowCenterData={flowCenterData.current}
mode={mode.current}
onClose={() => setOpeneditor(false)}
onOk={onSubmit}
......
......@@ -91,7 +91,7 @@ const AddView = props => {
const getFormData = () => {
console.log(msg, 'msgmsgmsgmsg');
if ((msg.WebPage === 'GisGatherProjectView' || msg.WebPage === 'InventoryMaterials' || msg.WebPage === 'RelatedOrder' || msg.WebPage === 'ReturnFeedbackView') && msg.WebParam) {
if ((msg.WebPage === 'GisGatherProjectView' || msg.WebPage === 'DataAuditingView' || msg.WebPage === 'AttributeErrorCorrectionView' || msg.WebPage === 'InventoryMaterials' || msg.WebPage === 'RelatedOrder' || msg.WebPage === 'ReturnFeedbackView') && msg.WebParam) {
if (!Array.isArray(msg.WebParam)) {
msg.WebParam = msg.WebParam?.split(',');
}
......@@ -107,7 +107,7 @@ const AddView = props => {
const onFinish = () => {
form.validateFields().then(validate => {
if (validate) {
if ((validate.WebPage === 'GisGatherProjectView' || validate.WebPage === 'InventoryMaterials' || validate.WebPage === 'RelatedOrder' || validate.WebPage === 'ReturnFeedbackView') && validate.WebParam) {
if ((validate.WebPage === 'GisGatherProjectView' || msg.WebPage === 'DataAuditingView' || msg.WebPage === 'AttributeErrorCorrectionView' || validate.WebPage === 'InventoryMaterials' || validate.WebPage === 'RelatedOrder' || validate.WebPage === 'ReturnFeedbackView') && validate.WebParam) {
validate.WebParam = validate.WebParam.toString();
}
let obj = {};
......
import React, { useState, useEffect, useMemo } from 'react';
import { DatePicker, Table, Row, Col, Button, notification, message, Spin } from 'antd';
import { SwapRightOutlined, SyncOutlined } from '@ant-design/icons';
import { SwapRightOutlined, SyncOutlined, ExportOutlined } from '@ant-design/icons';
import moment from 'moment';
import 'moment/dist/locale/zh-cn';
import locale from 'antd/es/date-picker/locale/zh_CN';
import ReactEcharts from 'echarts-for-react';
import { post, PUBLISH_SERVICE } from '@/services/index';
import styles from './index.less';
import * as XLSX from "xlsx";
const { RangePicker } = DatePicker;
const LoginLog = () => {
......@@ -108,6 +109,11 @@ const LoginLog = () => {
key: 'IPTerritory',
width: 250,
},
{
title: '机构名称',
dataIndex: 'GroupName',
key: 'GroupName',
},
{
title: '用户名',
dataIndex: 'ShowName',
......@@ -212,6 +218,30 @@ const LoginLog = () => {
setAllTime([moment().startOf('week'), moment(new Date(), 'YYYY-MM-DD HH:mm:ss')]);
setFilteredValue([]);
};
const handleExport = ()=>{
const souceData = data0.map(v=>{
let obj = {}
Object.keys(v).forEach(k=>{
const d = columns.find(x=> x.key === k)
if(d){
obj[`${d.title}`] =v[k]
}
})
return obj
})
// 2. 创建工作表
const worksheet = XLSX.utils.json_to_sheet(souceData);
// 3. 创建工作簿
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1");
// 4. 生成 Excel 文件并下载
XLSX.writeFile(workbook, `导出数据_${new Date().toLocaleDateString()}.xlsx`);
}
const onChangeInput = filters => {
// console.log('filters', filters);
setFilteredValue(filters.LoginName, filters.ShowName, filters.Client);
......@@ -364,6 +394,17 @@ const LoginLog = () => {
>
重置
</Button> */}
<Button
icon={<ExportOutlined className={styles.icon} />}
onClick={handleExport}
style={{
marginLeft: '25px',
verticalAlign: 'middle',
marginTop: '-3px',
}}
>
导出
</Button>
</Col>
</Row>
<Spin spinning={loading} tip="loading">
......
......@@ -147,6 +147,12 @@ export const GetFlowAutoConfigDetail = query => get(`${PUBLISH_SERVICE}/WorkFlow
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