Commit a625d7d3 authored by 涂伟's avatar 涂伟

fix: '字段配置保存按钮添加防抖'

parent 33cf8382
Pipeline #67824 failed with stages
...@@ -87,6 +87,7 @@ const AddModal = props => { ...@@ -87,6 +87,7 @@ const AddModal = props => {
const [cho, setCho] = useState(false); const [cho, setCho] = useState(false);
const [site, setSite] = useState(false); const [site, setSite] = useState(false);
const [flag, setFlag] = useState(false); const [flag, setFlag] = useState(false);
const [saveBtnLoading, setSaveBtnLoading] = useState(false);
const [characteristics1, setCharacteristics1] = useState([ const [characteristics1, setCharacteristics1] = useState([
{ {
...@@ -235,6 +236,7 @@ const AddModal = props => { ...@@ -235,6 +236,7 @@ const AddModal = props => {
// 提交 // 提交
const onSubmit = () => { const onSubmit = () => {
setSaveBtnLoading(true)
// 不切换树 // 不切换树
if (valueData.length == 0) { if (valueData.length == 0) {
formAdd.validateFields().then(validate1 => { formAdd.validateFields().then(validate1 => {
...@@ -364,7 +366,7 @@ const AddModal = props => { ...@@ -364,7 +366,7 @@ const AddModal = props => {
} }
li.push(arr); li.push(arr);
let result = {}; let result = {};
result.siteJurisdiction = site ? true : false; result.siteJurisdiction = !!site;
result.fieldshine = li; result.fieldshine = li;
console.log(result); console.log(result);
let standData = fieldshineChecked ? JSON.stringify(result) : obj.fieldName; let standData = fieldshineChecked ? JSON.stringify(result) : obj.fieldName;
...@@ -508,6 +510,7 @@ const AddModal = props => { ...@@ -508,6 +510,7 @@ const AddModal = props => {
description: res.msg, description: res.msg,
}); });
} }
setSaveBtnLoading(false)
}); });
} }
}); });
...@@ -750,13 +753,13 @@ const AddModal = props => { ...@@ -750,13 +753,13 @@ const AddModal = props => {
break; break;
case '本人部门': case '本人部门':
let depart = res[0].data.root.Config; let depart = res[0].data.root.Config;
form.setFieldsValue({ AllID1: depart ? true : false }); form.setFieldsValue({ AllID1: !!depart });
setCheckboxAllID1(depart ? true : false); setCheckboxAllID1(!!depart);
break; break;
case '本人姓名': case '本人姓名':
let name = res[0].data.root.Config; let name = res[0].data.root.Config;
form.setFieldsValue({ AllID1: name ? true : false }); form.setFieldsValue({ AllID1: !!name });
setCheckboxAllID1(name ? true : false); setCheckboxAllID1(!!name);
break; break;
case '站点选择器': case '站点选择器':
let siteId = res[0].data.root.Config.split('+'); let siteId = res[0].data.root.Config.split('+');
...@@ -766,7 +769,7 @@ const AddModal = props => { ...@@ -766,7 +769,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
pepole: true, pepole: true,
choose: true, choose: true,
AllID1: siteId[1] ? true : false, AllID1: !!siteId[1],
}); });
setPep(true); setPep(true);
setCho(true); setCho(true);
...@@ -774,7 +777,7 @@ const AddModal = props => { ...@@ -774,7 +777,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
pepole: true, pepole: true,
choose: false, choose: false,
AllID1: siteId[1] ? true : false, AllID1: !!siteId[1],
}); });
setPep(true); setPep(true);
setCho(false); setCho(false);
...@@ -784,7 +787,7 @@ const AddModal = props => { ...@@ -784,7 +787,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
pepole: false, pepole: false,
choose: true, choose: true,
AllID1: siteId[1] ? true : false, AllID1: !!siteId[1],
}); });
setPep(false); setPep(false);
setCho(true); setCho(true);
...@@ -792,13 +795,13 @@ const AddModal = props => { ...@@ -792,13 +795,13 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
pepole: false, pepole: false,
choose: false, choose: false,
AllID1: siteId[1] ? true : false, AllID1: !!siteId[1],
}); });
setPep(false); setPep(false);
setCho(false); setCho(false);
} }
} }
setCheckboxAllID1(siteId[1] ? true : false); setCheckboxAllID1(!!siteId[1]);
break; break;
case '搜索选择器': case '搜索选择器':
let data = res[0].data.root.Config.split('.'); let data = res[0].data.root.Config.split('.');
...@@ -871,13 +874,13 @@ const AddModal = props => { ...@@ -871,13 +874,13 @@ const AddModal = props => {
case '部门选择器': case '部门选择器':
let department = res[0].data.root.Config.split('+'); let department = res[0].data.root.Config.split('+');
if (department[0] == '.n') { if (department[0] == '.n') {
form.setFieldsValue({ choose: true, AllID1: department[1] ? true : false }); form.setFieldsValue({ choose: true, AllID1: !!department[1] });
setCho(true); setCho(true);
} else { } else {
form.setFieldsValue({ choose: false, AllID1: department[1] ? true : false }); form.setFieldsValue({ choose: false, AllID1: !!department[1] });
setCho(false); setCho(false);
} }
setCheckboxAllID1(department[1] ? true : false); setCheckboxAllID1(!!department[1]);
break; break;
case '台账选择器': case '台账选择器':
let book = res[0].data.root.Config.split('.'); let book = res[0].data.root.Config.split('.');
...@@ -1023,18 +1026,18 @@ const AddModal = props => { ...@@ -1023,18 +1026,18 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态', PeShape: '分组模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
ConfigName: aa[0] !== 'n' ? aa[0] : '', ConfigName: aa[0] !== 'n' ? aa[0] : '',
}); });
} else { } else {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态', PeShape: '分组模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
ConfigName: '', ConfigName: '',
}); });
} }
setCheckboxAllID1(id[1] ? true : false); setCheckboxAllID1(!!id[1]);
if (res[0].data.root.Config.indexOf('.n') !== -1) { if (res[0].data.root.Config.indexOf('.n') !== -1) {
form.setFieldsValue({ choose: true }); form.setFieldsValue({ choose: true });
setCho(true); setCho(true);
...@@ -1054,7 +1057,7 @@ const AddModal = props => { ...@@ -1054,7 +1057,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '树形模态', PeShape: '树形模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
guolv: true, guolv: true,
choose: true, choose: true,
}); });
...@@ -1064,7 +1067,7 @@ const AddModal = props => { ...@@ -1064,7 +1067,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '树形模态', PeShape: '树形模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
guolv: false, guolv: false,
choose: true, choose: true,
}); });
...@@ -1075,7 +1078,7 @@ const AddModal = props => { ...@@ -1075,7 +1078,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '树形模态', PeShape: '树形模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
guolv: true, guolv: true,
choose: false, choose: false,
}); });
...@@ -1085,25 +1088,25 @@ const AddModal = props => { ...@@ -1085,25 +1088,25 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '树形模态', PeShape: '树形模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
guolv: false, guolv: false,
choose: false, choose: false,
}); });
setGl(false); setGl(false);
setCho(false); setCho(false);
} }
setCheckboxAllID1(id[1] ? true : false); setCheckboxAllID1(!!id[1]);
setPopeleShape('树形模态'); setPopeleShape('树形模态');
} else { } else {
setCheckboxAll1(false); setCheckboxAll1(false);
setCheckboxAllID1(id[1] ? true : false); setCheckboxAllID1(!!id[1]);
setHide(true); setHide(true);
setFlag(false); setFlag(false);
let aa = pepole[0].split('+'); let aa = pepole[0].split('+');
form.setFieldsValue({ form.setFieldsValue({
All1: false, All1: false,
PeShape: '下拉框', PeShape: '下拉框',
AllID1: id[1] ? true : false, AllID1: !!id[1],
Config: aa[0], Config: aa[0],
}); });
if (res[0].data.root.Config.indexOf('.n') !== -1) { if (res[0].data.root.Config.indexOf('.n') !== -1) {
...@@ -1812,13 +1815,13 @@ const AddModal = props => { ...@@ -1812,13 +1815,13 @@ const AddModal = props => {
break; break;
case '本人部门': case '本人部门':
let depart = aa.Config; let depart = aa.Config;
form.setFieldsValue({ AllID1: depart ? true : false }); form.setFieldsValue({ AllID1: !!depart });
setCheckboxAllID1(depart ? true : false); setCheckboxAllID1(!!depart);
break; break;
case '本人姓名': case '本人姓名':
let name = aa.Config; let name = aa.Config;
form.setFieldsValue({ AllID1: name ? true : false }); form.setFieldsValue({ AllID1: !!name });
setCheckboxAllID1(name ? true : false); setCheckboxAllID1(!!name);
break; break;
case '搜索选择器': case '搜索选择器':
let data = aa.Config.split('.'); let data = aa.Config.split('.');
...@@ -1891,7 +1894,7 @@ const AddModal = props => { ...@@ -1891,7 +1894,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
pepole: true, pepole: true,
choose: true, choose: true,
AllID1: siteId[1] ? true : false, AllID1: !!siteId[1],
}); });
setPep(true); setPep(true);
setCho(true); setCho(true);
...@@ -1899,7 +1902,7 @@ const AddModal = props => { ...@@ -1899,7 +1902,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
pepole: true, pepole: true,
choose: false, choose: false,
AllID1: siteId[1] ? true : false, AllID1: !!siteId[1],
}); });
setPep(true); setPep(true);
setCho(false); setCho(false);
...@@ -1909,7 +1912,7 @@ const AddModal = props => { ...@@ -1909,7 +1912,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
pepole: false, pepole: false,
choose: true, choose: true,
AllID1: siteId[1] ? true : false, AllID1: !!siteId[1],
}); });
setPep(false); setPep(false);
setCho(true); setCho(true);
...@@ -1917,24 +1920,24 @@ const AddModal = props => { ...@@ -1917,24 +1920,24 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
pepole: false, pepole: false,
choose: false, choose: false,
AllID1: siteId[1] ? true : false, AllID1: !!siteId[1],
}); });
setPep(false); setPep(false);
setCho(false); setCho(false);
} }
} }
setCheckboxAllID1(siteId[1] ? true : false); setCheckboxAllID1(!!siteId[1]);
break; break;
case '部门选择器': case '部门选择器':
let department = aa.Config.split('+'); let department = aa.Config.split('+');
if (department[0] == '.n') { if (department[0] == '.n') {
form.setFieldsValue({ choose: true, AllID1: department[1] ? true : false }); form.setFieldsValue({ choose: true, AllID1: !!department[1] });
setCho(true); setCho(true);
} else { } else {
form.setFieldsValue({ choose: false, AllID1: department[1] ? true : false }); form.setFieldsValue({ choose: false, AllID1: !!department[1] });
setCho(false); setCho(false);
} }
setCheckboxAllID1(department[1] ? true : false); setCheckboxAllID1(!!department[1]);
break; break;
case '关联表单': case '关联表单':
let data11 = JSON.parse(aa.Config); let data11 = JSON.parse(aa.Config);
...@@ -2080,18 +2083,18 @@ const AddModal = props => { ...@@ -2080,18 +2083,18 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态', PeShape: '分组模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
ConfigName: config[0] !== 'n' ? config[0] : '', ConfigName: config[0] !== 'n' ? config[0] : '',
}); });
} else { } else {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态', PeShape: '分组模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
ConfigName: '', ConfigName: '',
}); });
} }
setCheckboxAllID1(id[1] ? true : false); setCheckboxAllID1(!!id[1]);
if (aa.Config.indexOf('.n') !== -1) { if (aa.Config.indexOf('.n') !== -1) {
form.setFieldsValue({ choose: true }); form.setFieldsValue({ choose: true });
setCho(true); setCho(true);
...@@ -2111,7 +2114,7 @@ const AddModal = props => { ...@@ -2111,7 +2114,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '树形模态', PeShape: '树形模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
guolv: true, guolv: true,
choose: true, choose: true,
}); });
...@@ -2121,7 +2124,7 @@ const AddModal = props => { ...@@ -2121,7 +2124,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '树形模态', PeShape: '树形模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
guolv: false, guolv: false,
choose: true, choose: true,
}); });
...@@ -2132,7 +2135,7 @@ const AddModal = props => { ...@@ -2132,7 +2135,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '树形模态', PeShape: '树形模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
guolv: true, guolv: true,
choose: false, choose: false,
}); });
...@@ -2142,25 +2145,25 @@ const AddModal = props => { ...@@ -2142,25 +2145,25 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '树形模态', PeShape: '树形模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
guolv: false, guolv: false,
choose: false, choose: false,
}); });
setGl(false); setGl(false);
setCho(false); setCho(false);
} }
setCheckboxAllID1(id[1] ? true : false); setCheckboxAllID1(!!id[1]);
setPopeleShape('树形模态'); setPopeleShape('树形模态');
} else { } else {
setCheckboxAll1(false); setCheckboxAll1(false);
setCheckboxAllID1(id[1] ? true : false); setCheckboxAllID1(!!id[1]);
setHide(true); setHide(true);
setFlag(false); setFlag(false);
let aaa = pepole[0].split('+'); let aaa = pepole[0].split('+');
form.setFieldsValue({ form.setFieldsValue({
All1: false, All1: false,
PeShape: '下拉框', PeShape: '下拉框',
AllID1: id[1] ? true : false, AllID1: !!id[1],
Config: aaa[0], Config: aaa[0],
}); });
if (aa.Config.indexOf('.n') !== -1) { if (aa.Config.indexOf('.n') !== -1) {
...@@ -2300,13 +2303,13 @@ const AddModal = props => { ...@@ -2300,13 +2303,13 @@ const AddModal = props => {
break; break;
case '本人部门': case '本人部门':
let depart = res[0].data.root.Config; let depart = res[0].data.root.Config;
form.setFieldsValue({ AllID1: depart ? true : false }); form.setFieldsValue({ AllID1: !!depart });
setCheckboxAllID1(depart ? true : false); setCheckboxAllID1(!!depart);
break; break;
case '本人姓名': case '本人姓名':
let name = res[0].data.root.Config; let name = res[0].data.root.Config;
form.setFieldsValue({ AllID1: name ? true : false }); form.setFieldsValue({ AllID1: !!name });
setCheckboxAllID1(name ? true : false); setCheckboxAllID1(!!name);
break; break;
case '搜索选择器': case '搜索选择器':
let data = res[0].data.root.Config.split('.'); let data = res[0].data.root.Config.split('.');
...@@ -2361,7 +2364,7 @@ const AddModal = props => { ...@@ -2361,7 +2364,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
pepole: true, pepole: true,
choose: true, choose: true,
AllID1: siteId[1] ? true : false, AllID1: !!siteId[1],
}); });
setPep(true); setPep(true);
setCho(true); setCho(true);
...@@ -2369,7 +2372,7 @@ const AddModal = props => { ...@@ -2369,7 +2372,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
pepole: true, pepole: true,
choose: false, choose: false,
AllID1: siteId[1] ? true : false, AllID1: !!siteId[1],
}); });
setPep(true); setPep(true);
setCho(false); setCho(false);
...@@ -2379,7 +2382,7 @@ const AddModal = props => { ...@@ -2379,7 +2382,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
pepole: false, pepole: false,
choose: true, choose: true,
AllID1: siteId[1] ? true : false, AllID1: !!siteId[1],
}); });
setPep(false); setPep(false);
setCho(true); setCho(true);
...@@ -2387,13 +2390,13 @@ const AddModal = props => { ...@@ -2387,13 +2390,13 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
pepole: false, pepole: false,
choose: false, choose: false,
AllID1: siteId[1] ? true : false, AllID1: !!siteId[1],
}); });
setPep(false); setPep(false);
setCho(false); setCho(false);
} }
} }
setCheckboxAllID1(siteId[1] ? true : false); setCheckboxAllID1(!!siteId[1]);
break; break;
case '业务选择器': case '业务选择器':
let list = res[0].data.root.Config.split('.'); let list = res[0].data.root.Config.split('.');
...@@ -2417,13 +2420,13 @@ const AddModal = props => { ...@@ -2417,13 +2420,13 @@ const AddModal = props => {
case '部门选择器': case '部门选择器':
let department = res[0].data.root.Config.split('+'); let department = res[0].data.root.Config.split('+');
if (department[0] == '.n') { if (department[0] == '.n') {
form.setFieldsValue({ choose: true, AllID1: department[1] ? true : false }); form.setFieldsValue({ choose: true, AllID1: !!department[1] });
setCho(true); setCho(true);
} else { } else {
form.setFieldsValue({ choose: false, AllID1: department[1] ? true : false }); form.setFieldsValue({ choose: false, AllID1: !!department[1] });
setCho(false); setCho(false);
} }
setCheckboxAllID1(department[1] ? true : false); setCheckboxAllID1(!!department[1]);
break; break;
case '关联表单': case '关联表单':
...@@ -2574,18 +2577,18 @@ const AddModal = props => { ...@@ -2574,18 +2577,18 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态', PeShape: '分组模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
ConfigName: aa[0] !== 'n' ? aa[0] : '', ConfigName: aa[0] !== 'n' ? aa[0] : '',
}); });
} else { } else {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '分组模态', PeShape: '分组模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
ConfigName: '', ConfigName: '',
}); });
} }
setCheckboxAllID1(id[1] ? true : false); setCheckboxAllID1(!!id[1]);
if (res[0].data.root.Config.indexOf('.n') !== -1) { if (res[0].data.root.Config.indexOf('.n') !== -1) {
form.setFieldsValue({ choose: true }); form.setFieldsValue({ choose: true });
setCho(true); setCho(true);
...@@ -2605,7 +2608,7 @@ const AddModal = props => { ...@@ -2605,7 +2608,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '树形模态', PeShape: '树形模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
guolv: true, guolv: true,
choose: true, choose: true,
}); });
...@@ -2615,7 +2618,7 @@ const AddModal = props => { ...@@ -2615,7 +2618,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '树形模态', PeShape: '树形模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
guolv: false, guolv: false,
choose: true, choose: true,
}); });
...@@ -2626,7 +2629,7 @@ const AddModal = props => { ...@@ -2626,7 +2629,7 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '树形模态', PeShape: '树形模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
guolv: true, guolv: true,
choose: false, choose: false,
}); });
...@@ -2636,25 +2639,25 @@ const AddModal = props => { ...@@ -2636,25 +2639,25 @@ const AddModal = props => {
form.setFieldsValue({ form.setFieldsValue({
PeShape: '树形模态', PeShape: '树形模态',
All1: true, All1: true,
AllID1: id[1] ? true : false, AllID1: !!id[1],
guolv: false, guolv: false,
choose: false, choose: false,
}); });
setGl(false); setGl(false);
setCho(false); setCho(false);
} }
setCheckboxAllID1(id[1] ? true : false); setCheckboxAllID1(!!id[1]);
setPopeleShape('树形模态'); setPopeleShape('树形模态');
} else { } else {
setCheckboxAll1(false); setCheckboxAll1(false);
setCheckboxAllID1(id[1] ? true : false); setCheckboxAllID1(!!id[1]);
setHide(true); setHide(true);
setFlag(false); setFlag(false);
let aa = pepole[0].split('+'); let aa = pepole[0].split('+');
form.setFieldsValue({ form.setFieldsValue({
All1: false, All1: false,
PeShape: '下拉框', PeShape: '下拉框',
AllID1: id[1] ? true : false, AllID1: !!id[1],
Config: aa[0], Config: aa[0],
}); });
if (res[0].data.root.Config.indexOf('.n') !== -1) { if (res[0].data.root.Config.indexOf('.n') !== -1) {
...@@ -2823,7 +2826,7 @@ const AddModal = props => { ...@@ -2823,7 +2826,7 @@ const AddModal = props => {
} }
li.push(arr); li.push(arr);
let result = {}; let result = {};
result.siteJurisdiction = site ? true : false; result.siteJurisdiction = !!site;
result.fieldshine = li; result.fieldshine = li;
let standData = fieldshineChecked ? JSON.stringify(result) : obj.fieldName; let standData = fieldshineChecked ? JSON.stringify(result) : obj.fieldName;
if (obj.fieldName && obj.fieldName.endsWith('.n')) { if (obj.fieldName && obj.fieldName.endsWith('.n')) {
...@@ -3304,7 +3307,7 @@ const AddModal = props => { ...@@ -3304,7 +3307,7 @@ const AddModal = props => {
}} }}
footer={ footer={
<Space> <Space>
<Button onClick={onSubmit} type="primary"> <Button onClick={onSubmit} loading={saveBtnLoading} type="primary">
保存 保存
</Button> </Button>
</Space> </Space>
......
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