Commit a625d7d3 authored by 涂伟's avatar 涂伟

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

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