Commit 6c983903 authored by 涂伟's avatar 涂伟
parents f07881b4 e0e84e02
...@@ -1043,7 +1043,6 @@ const FlowChart = props => { ...@@ -1043,7 +1043,6 @@ const FlowChart = props => {
list.FlowNodeBackfillConfigs = jsonData(list.FlowNodeBackfillConfigs); list.FlowNodeBackfillConfigs = jsonData(list.FlowNodeBackfillConfigs);
currentNode.current = list; currentNode.current = list;
console.log(currentNode.current); console.log(currentNode.current);
debugger;
FlowNodeSave({ FlowNodeSave({
PreviewImage: response.data, PreviewImage: response.data,
CreateUser: sessionStorage.getItem('userName'), CreateUser: sessionStorage.getItem('userName'),
...@@ -1083,47 +1082,54 @@ const FlowChart = props => { ...@@ -1083,47 +1082,54 @@ const FlowChart = props => {
const jsonData = val => { const jsonData = val => {
let listArr = []; let listArr = [];
val.map((item, index) => { val.map((item, index) => {
let arr = []; if(!item.Config){
arr.push({ console.log(item);
mapServer: item.schemeName, debugger
tableName: item[0].nodeName, let arr = [];
filed: item[0].nodeValue, arr.push({
}); mapServer: item.schemeName,
if (item.users) { tableName: item[0].nodeName,
item.users.map(i => { filed: item[0].nodeValue,
arr.push({
mapServer: item.schemeName,
tableName: i.nodeName,
filed: i.nodeValue,
});
}); });
} if (item.users) {
let obj = {}; item.users.map(i => {
obj.type = 'GIS'; arr.push({
if (item.tableType === 'mapping') { mapServer: item.schemeName,
obj.mapping = [ tableName: i.nodeName,
{ filed: i.nodeValue,
fromData: { });
tableName: item.TableName, });
filed: item.Fields, }
let obj = {};
obj.type = 'GIS';
if (item.tableType === 'mapping') {
obj.mapping = [
{
fromData: {
tableName: item.TableName,
filed: item.Fields,
},
toData: arr,
}, },
toData: arr, ];
}, } else {
]; obj.relationFormMapping = [
} else { {
obj.relationFormMapping = [ fromData: {
{ tableName: item.TableName,
fromData: { filed: item.Fields,
tableName: item.TableName, },
filed: item.Fields, toData: arr,
}, },
toData: arr, ];
}, }
]; let json = JSON.stringify(obj);
let newObj = { Config: json, BackfillType: 'GIS', RuleName: item.RuleName };
listArr.push(newObj);
}else{
listArr.push(item);
} }
let json = JSON.stringify(obj);
let newObj = { Config: json, BackfillType: 'GIS', RuleName: item.RuleName };
listArr.push(newObj);
}); });
return listArr; return listArr;
}; };
...@@ -1280,7 +1286,6 @@ const FlowChart = props => { ...@@ -1280,7 +1286,6 @@ const FlowChart = props => {
i.FlowNodeBackfillConfigs = jsonData(i.FlowNodeBackfillConfigs); i.FlowNodeBackfillConfigs = jsonData(i.FlowNodeBackfillConfigs);
}); });
console.log(diagramObj.nodeDataArray); console.log(diagramObj.nodeDataArray);
debugger;
SaveNodeChange({ SaveNodeChange({
FlowId: flowID, FlowId: flowID,
// DeleteNodes, // DeleteNodes,
......
/* eslint-disable no-unused-expressions */
/* eslint-disable no-else-return */
/* eslint-disable prefer-destructuring */ /* eslint-disable prefer-destructuring */
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import { GetMaplayerByTerminalType, GetLayerList, GetLayerFields } from '@/services/flow/flow'; import { GetMaplayerByTerminalType, GetLayerList, GetLayerFields } from '@/services/flow/flow';
...@@ -45,9 +47,6 @@ const AddModal = props => { ...@@ -45,9 +47,6 @@ const AddModal = props => {
const [form] = Form.useForm(); const [form] = Form.useForm();
useEffect(() => { useEffect(() => {
if (visible) { if (visible) {
console.log(tableData);
console.log(msg);
debugger;
let arr = []; let arr = [];
tableData.map(i => { tableData.map(i => {
arr.push(i.RuleName); arr.push(i.RuleName);
...@@ -105,6 +104,8 @@ const AddModal = props => { ...@@ -105,6 +104,8 @@ const AddModal = props => {
const getLayerFields = (val, key, value, typeFields) => { const getLayerFields = (val, key, value, typeFields) => {
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
let newValue = value ? value : schemeValue; let newValue = value ? value : schemeValue;
console.log(schemeValue);
debugger;
let data = newValue.find(i => i.servicename === obj.schemeName); let data = newValue.find(i => i.servicename === obj.schemeName);
GetLayerFields({ GetLayerFields({
mapServer: data.servicename, mapServer: data.servicename,
...@@ -126,8 +127,13 @@ const AddModal = props => { ...@@ -126,8 +127,13 @@ const AddModal = props => {
// 表单监听 // 表单监听
const onValuesChange = val => { const onValuesChange = val => {
if (Object.keys(val)[0] === 'schemeName') { if (Object.keys(val)[0] === 'schemeName') {
form.setFieldsValue({ nodeName1: '', nodeValue1: '', users: [] });
setLayerValue([]);
setLayerFields([]);
layerData.current = {};
getLayerList(val[Object.keys(val)[0]]); getLayerList(val[Object.keys(val)[0]]);
} else if (Object.keys(val)[0] === 'nodeName1') { } else if (Object.keys(val)[0] === 'nodeName1') {
form.setFieldsValue({ nodeValue1: '' });
getLayerFields(val[Object.keys(val)[0]]); getLayerFields(val[Object.keys(val)[0]]);
} else if (Object.keys(val)[0] === 'Fields') { } else if (Object.keys(val)[0] === 'Fields') {
let arr = []; let arr = [];
...@@ -135,13 +141,13 @@ const AddModal = props => { ...@@ -135,13 +141,13 @@ const AddModal = props => {
arr.push(...item.TableFields); arr.push(...item.TableFields);
}); });
let data = arr.find(i => i.FieldName === val[Object.keys(val)[0]]); let data = arr.find(i => i.FieldName === val[Object.keys(val)[0]]);
console.log(data);
debugger;
setTableType(data.type); setTableType(data.type);
setType(data.FiledType); setType(data.FiledType);
setTableName(data.table); setTableName(data.table);
// 修改源字段字段类型改变要重新获取type更新所有目标字段下拉框数据 form.setFieldsValue({ schemeName: '', nodeName1: '', nodeValue1: '', users: [] });
getLayerFields() setLayerValue([]);
setLayerFields([]);
layerData.current = {};
} }
}; };
...@@ -226,9 +232,6 @@ const AddModal = props => { ...@@ -226,9 +232,6 @@ const AddModal = props => {
{ required: true }, { required: true },
{ {
validator: (_, value) => { validator: (_, value) => {
console.log(value);
console.log(ruleList);
debugger
if (modalType === 'add' && ruleList.indexOf(value) !== -1) { if (modalType === 'add' && ruleList.indexOf(value) !== -1) {
return Promise.reject(new Error('规则名称已存在')); return Promise.reject(new Error('规则名称已存在'));
} else if ( } else if (
...@@ -300,7 +303,7 @@ const AddModal = props => { ...@@ -300,7 +303,7 @@ const AddModal = props => {
{layerFields && {layerFields &&
layerFields.map(item => ( layerFields.map(item => (
<Option value={item.field} key={item.field}> <Option value={item.field} key={item.field}>
<span>{item.field}</span> <span>{item.fieldAlias}</span>
</Option> </Option>
))} ))}
</Select> </Select>
...@@ -332,6 +335,9 @@ const AddModal = props => { ...@@ -332,6 +335,9 @@ const AddModal = props => {
style={{ width: '100%' }} style={{ width: '100%' }}
onChange={e => { onChange={e => {
getLayerFields(e, key); getLayerFields(e, key);
let obj = form.getFieldsValue().users;
obj[key].nodeValue = '';
form.setFieldsValue({ users: obj });
}} }}
> >
{layerValue && {layerValue &&
...@@ -351,7 +357,7 @@ const AddModal = props => { ...@@ -351,7 +357,7 @@ const AddModal = props => {
fieldKey={[fieldKey, 'last']} fieldKey={[fieldKey, 'last']}
labelCol={{ span: 8 }} labelCol={{ span: 8 }}
rules={[{ required: true, message: '不能为空' }]} rules={[{ required: true, message: '不能为空' }]}
style={{ width: '230px', marginLeft: '3px' }} style={{ width: '230px', marginLeft: '5px' }}
> >
<Select <Select
placeholder="请选择设备字段" placeholder="请选择设备字段"
...@@ -362,7 +368,7 @@ const AddModal = props => { ...@@ -362,7 +368,7 @@ const AddModal = props => {
layerData.current[key].map(item => { layerData.current[key].map(item => {
return ( return (
<Option value={item.field} key={item.field}> <Option value={item.field} key={item.field}>
<span>{item.field}</span> <span>{item.fieldAlias}</span>
</Option> </Option>
); );
})} })}
...@@ -391,7 +397,7 @@ const AddModal = props => { ...@@ -391,7 +397,7 @@ const AddModal = props => {
onClick={() => add()} onClick={() => add()}
block block
icon={<PlusOutlined />} icon={<PlusOutlined />}
style={{ width: '411px', marginLeft: '87px' }} style={{ width: '394px', marginLeft: '99px' }}
> >
新增项 新增项
</Button> </Button>
......
/* eslint-disable no-else-return */
/* eslint-disable prettier/prettier */ /* eslint-disable prettier/prettier */
/* eslint-disable indent */ /* eslint-disable indent */
/* eslint-disable no-unused-expressions */ /* eslint-disable no-unused-expressions */
...@@ -78,55 +79,63 @@ const ConfigGIS = (props, ref) => { ...@@ -78,55 +79,63 @@ const ConfigGIS = (props, ref) => {
// }); // });
tableData.current = editMsg.FlowNodeBackfillConfigs?.map((item, index) => { tableData.current = editMsg.FlowNodeBackfillConfigs?.map((item, index) => {
let obj = {}; let obj = {};
let newConfig =JSON.parse(item.Config); if (item.Config) {
if (newConfig.mapping) { let newConfig = JSON.parse(item.Config);
let users = []; if (newConfig.mapping) {
newConfig.mapping[0].toData.map((x, y)=>{ let users = [];
obj[y]={nodeName: x.tableName, nodeValue: x.filed} newConfig.mapping[0].toData.map((x, y) => {
}) obj[y] = { nodeName: x.tableName, nodeValue: x.filed };
obj.Fields = newConfig.mapping[0].fromData.filed;
obj.ID = index;
obj.RuleName = item.RuleName;
obj.TableName = newConfig.mapping[0].fromData.tableName;
obj.key = index;
obj.nodeName1 = newConfig.mapping[0].toData[0].tableName;
obj.nodeValue1 = newConfig.mapping[0].toData[0].filed;
obj.schemeName = newConfig.mapping[0].toData[0].mapServer;
obj.tableType = 'mapping';
if (newConfig.mapping[0].toData.length > 1) {
newConfig.mapping[0].toData.map((i, j) => {
if (j !== 0) {
users.push({ nodeName: i.tableName, nodeValue: i.filed });
}
}); });
obj.users = users; obj.Fields = newConfig.mapping[0].fromData.filed;
} obj.ID = index;
} else { obj.RuleName = item.RuleName;
let users = []; obj.TableName = newConfig.mapping[0].fromData.tableName;
newConfig.relationFormMapping[0].toData.map((x, y)=>{ obj.key = index;
obj[y]={nodeName: x.tableName, nodeValue: x.filed} obj.nodeName1 = newConfig.mapping[0].toData[0].tableName;
}) obj.nodeValue1 = newConfig.mapping[0].toData[0].filed;
obj.Fields = newConfig.relationFormMapping[0].fromData.filed; obj.schemeName = newConfig.mapping[0].toData[0].mapServer;
obj.ID = index; obj.tableType = 'mapping';
obj.RuleName = item.RuleName; if (newConfig.mapping[0].toData.length > 1) {
obj.TableName = newConfig.relationFormMapping[0].fromData.tableName; newConfig.mapping[0].toData.map((i, j) => {
obj.key = index; if (j !== 0) {
obj.nodeName1 = newConfig.relationFormMapping[0].toData[0].tableName; users.push({ nodeName: i.tableName, nodeValue: i.filed });
obj.nodeValue1 = newConfig.relationFormMapping[0].toData[0].filed; }
obj.schemeName = newConfig.relationFormMapping[0].toData[0].mapServer; });
obj.tableType = 'relationFormMapping'; obj.users = users;
if (newConfig.relationFormMapping[0].toData.length > 1) { }
newConfig.relationFormMapping[0].toData.map((i, j) => { } else {
if (j !== 0) { let users = [];
users.push({ nodeName: i.tableName, nodeValue: i.filed }); newConfig.relationFormMapping[0].toData.map((x, y) => {
} obj[y] = { nodeName: x.tableName, nodeValue: x.filed };
}); });
obj.users = users; obj.Fields = newConfig.relationFormMapping[0].fromData.filed;
obj.ID = index;
obj.RuleName = item.RuleName;
obj.TableName = newConfig.relationFormMapping[0].fromData.tableName;
obj.key = index;
obj.nodeName1 = newConfig.relationFormMapping[0].toData[0].tableName;
obj.nodeValue1 = newConfig.relationFormMapping[0].toData[0].filed;
obj.schemeName = newConfig.relationFormMapping[0].toData[0].mapServer;
obj.tableType = 'relationFormMapping';
if (newConfig.relationFormMapping[0].toData.length > 1) {
newConfig.relationFormMapping[0].toData.map((i, j) => {
if (j !== 0) {
users.push({ nodeName: i.tableName, nodeValue: i.filed });
}
});
obj.users = users;
}
} }
return {
...obj,
};
} else {
return {
...item,
key: index,
ID: index,
};
} }
return {
...obj,
};
}); });
setFlag(flag + 1); setFlag(flag + 1);
tableFields(); tableFields();
...@@ -142,7 +151,7 @@ const ConfigGIS = (props, ref) => { ...@@ -142,7 +151,7 @@ const ConfigGIS = (props, ref) => {
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
res.data.FromData.map(i => { res.data.FromData.map(i => {
i.type = '工单、事件表'; i.type = '事件工单表';
i.TableFields.map(j => { i.TableFields.map(j => {
j.table = i.TableName; j.table = i.TableName;
j.type = 'mapping'; j.type = 'mapping';
...@@ -181,7 +190,6 @@ const ConfigGIS = (props, ref) => { ...@@ -181,7 +190,6 @@ const ConfigGIS = (props, ref) => {
} }
tableData.current = list; tableData.current = list;
console.log(list); console.log(list);
debugger;
nodeChage('FlowNodeBackfillConfigs', tableData.current); nodeChage('FlowNodeBackfillConfigs', tableData.current);
setViewModal(false); setViewModal(false);
}; };
...@@ -247,7 +255,7 @@ const ConfigGIS = (props, ref) => { ...@@ -247,7 +255,7 @@ const ConfigGIS = (props, ref) => {
fontWeight: 700, fontWeight: 700,
}} }}
> >
GIS配置 GIS数据回填
</Divider> </Divider>
<div <div
style={{ style={{
......
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