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