Commit 637ef695 authored by 皮倩雯's avatar 皮倩雯

fix: '巡检反馈字段映射优化'

parent c52c1119
Pipeline #63396 passed with stages
...@@ -307,6 +307,7 @@ const AddModal = props => { ...@@ -307,6 +307,7 @@ const AddModal = props => {
const onSubmit = () => { const onSubmit = () => {
formAdd.validateFields().then(validate1 => { formAdd.validateFields().then(validate1 => {
console.log(validate1);
if (validate1) { if (validate1) {
form.validateFields().then(validate => { form.validateFields().then(validate => {
if (validate) { if (validate) {
...@@ -314,18 +315,19 @@ const AddModal = props => { ...@@ -314,18 +315,19 @@ const AddModal = props => {
let objaa = formAdd.getFieldValue('parmars'); let objaa = formAdd.getFieldValue('parmars');
console.log(objaa); console.log(objaa);
console.log(keep); console.log(keep);
objaa.map(i => { objaa &&
keep.map(j => { objaa.map(i => {
if (j.key === i.fromField) { keep.map(j => {
i.fromField = j.value; if (j.key === i.fromField) {
} i.fromField = j.value;
}
});
}); });
});
console.log(objaa); console.log(objaa);
if (type == 'add') { if (type == 'add') {
CM_Feedback_OperatePatrolFeedback({ CM_Feedback_OperatePatrolFeedback({
...obj, ...obj,
mappingFields: JSON.stringify(objaa), mappingFields: objaa && JSON.stringify(objaa),
}).then(res => { }).then(res => {
if (res.msg == '') { if (res.msg == '') {
form.resetFields(); form.resetFields();
...@@ -347,7 +349,7 @@ const AddModal = props => { ...@@ -347,7 +349,7 @@ const AddModal = props => {
CM_Feedback_OperatePatrolFeedback({ CM_Feedback_OperatePatrolFeedback({
...obj, ...obj,
id: formObj.id, id: formObj.id,
mappingFields: JSON.stringify(objaa), mappingFields: objaa && JSON.stringify(objaa),
}).then(res => { }).then(res => {
if (res.msg == '') { if (res.msg == '') {
form.resetFields(); form.resetFields();
...@@ -593,36 +595,39 @@ const AddModal = props => { ...@@ -593,36 +595,39 @@ const AddModal = props => {
const changeValue = () => { const changeValue = () => {
console.log(formAdd.getFieldsValue().parmars); console.log(formAdd.getFieldsValue().parmars);
let aa = formAdd.getFieldsValue().parmars; let aa = formAdd.getFieldsValue().parmars;
let from = []; if (aa) {
let to = []; console.log(aa);
aa.map(i => { let from = [];
if (i && i.fromField) { let to = [];
from.push(i.fromField); aa.map(i => {
} if (i && i.fromField) {
if (i && i.toField) { from.push(i.fromField);
to.push(i.toField); }
} if (i && i.toField) {
}); to.push(i.toField);
}
});
let lastFrom = []; let lastFrom = [];
let lastTo = []; let lastTo = [];
console.log(from); console.log(from);
console.log(keep); console.log(keep);
keep.map(j => { keep.map(j => {
if (from.indexOf(j.key) == -1) { if (from.indexOf(j.key) == -1) {
lastFrom.push(j); lastFrom.push(j);
} }
}); });
console.log(lastFrom); console.log(lastFrom);
setKeepData(lastFrom); setKeepData(lastFrom);
keepAll.map(j => { keepAll.map(j => {
if (to.indexOf(j.name) == -1) { if (to.indexOf(j.name) == -1) {
lastTo.push(j); lastTo.push(j);
} }
}); });
console.log(lastTo); console.log(lastTo);
setKeepTree(lastTo); setKeepTree(lastTo);
}
// let data = keepAll; // let data = keepAll;
// data.map(k => { // data.map(k => {
......
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