Commit e6952f65 authored by 皮倩雯's avatar 皮倩雯

fix: 修复巡检反馈GIS图层数据重复造成组件bug'

parent c308a881
Pipeline #66482 passed with stages
/* eslint-disable prefer-destructuring */
/* eslint-disable no-else-return */ /* eslint-disable no-else-return */
/* eslint-disable prefer-promise-reject-errors */ /* eslint-disable prefer-promise-reject-errors */
/* eslint-disable guard-for-in */ /* eslint-disable guard-for-in */
...@@ -84,9 +85,19 @@ const AddModal = props => { ...@@ -84,9 +85,19 @@ const AddModal = props => {
form.setFieldsValue({ ...res.data }); form.setFieldsValue({ ...res.data });
console.log(res.data); console.log(res.data);
if (!res.data.businessGroup) { if (!res.data.businessGroup) {
form.setFieldsValue({ businessGroup: '区域巡检' }); form.setFieldsValue({
businessGroup: '区域巡检',
gisLayer: res.data.gisServerName
? `${res.data.gisServerName}&${res.data.gisLayer}`
: res.data.gisLayer,
});
} else { } else {
form.setFieldsValue({ businessGroup: res.data.businessGroup.split(',') }); form.setFieldsValue({
businessGroup: res.data.businessGroup.split(','),
gisLayer: res.data.gisServerName
? `${res.data.gisServerName}&${res.data.gisLayer}`
: res.data.gisLayer,
});
} }
let aa = JSON.parse(res.data.mappingFields); let aa = JSON.parse(res.data.mappingFields);
getGetTaskSyncField(aa); // 获取字段名数据 getGetTaskSyncField(aa); // 获取字段名数据
...@@ -342,9 +353,19 @@ const AddModal = props => { ...@@ -342,9 +353,19 @@ const AddModal = props => {
}); });
console.log(obj); console.log(obj);
obj.businessGroup = obj.businessGroup.toString(); obj.businessGroup = obj.businessGroup.toString();
let list = [];
let groupNameSever = '';
if (obj.gisLayer && obj.gisLayer.indexOf('&') !== -1) {
list = obj.gisLayer.split('&');
console.log(list);
obj.gisLayer = list[1];
groupNameSever = list[0];
}
console.log(groupNameSever);
if (type == 'add') { if (type == 'add') {
CM_Feedback_OperatePatrolFeedback({ CM_Feedback_OperatePatrolFeedback({
...obj, ...obj,
gisServerName: groupNameSever,
mappingFields: objaa && JSON.stringify(objaa), mappingFields: objaa && JSON.stringify(objaa),
}).then(res => { }).then(res => {
if (res.msg == '') { if (res.msg == '') {
...@@ -366,6 +387,7 @@ const AddModal = props => { ...@@ -366,6 +387,7 @@ const AddModal = props => {
} else { } else {
CM_Feedback_OperatePatrolFeedback({ CM_Feedback_OperatePatrolFeedback({
...obj, ...obj,
gisServerName: groupNameSever,
id: formObj.id, id: formObj.id,
mappingFields: objaa && JSON.stringify(objaa), mappingFields: objaa && JSON.stringify(objaa),
}).then(res => { }).then(res => {
...@@ -598,14 +620,14 @@ const AddModal = props => { ...@@ -598,14 +620,14 @@ const AddModal = props => {
} }
}; };
const mapTree = org => { const mapTree = (org, server) => {
const haveChildren = Array.isArray(org.items) && org.items.length > 0; const haveChildren = Array.isArray(org.items) && org.items.length > 0;
return haveChildren ? ( return haveChildren ? (
<TreeNode value={org.serverName} title={org.serverName} disabled> <TreeNode value={org.serverName} title={org.serverName} disabled>
{org.items.map(item => mapTree(item))} {org.items.map(item => mapTree(item, org.serverName))}
</TreeNode> </TreeNode>
) : ( ) : (
<TreeNode value={org.name} title={org.name} /> <TreeNode value={`${server}&${org.name}`} title={org.name} />
); );
}; };
......
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