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