产品-规则设置保存方式修改
This commit is contained in:
parent
c4a0ea8bcd
commit
cb8ee2332e
|
|
@ -5,13 +5,15 @@
|
|||
* Date: 2022-09-19 18:15:32
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { WeaFormItem, WeaNewScroll, WeaSearchGroup, WeaSelect, WeaTop } from "ecCom";
|
||||
import { WeaFormItem, WeaLocaleProvider, WeaNewScroll, WeaSearchGroup, WeaSelect, WeaTop } from "ecCom";
|
||||
import { CheckBox } from "../appConfig";
|
||||
import { Button, message, Modal } from "antd";
|
||||
import { message, Modal } from "antd";
|
||||
import * as API from "../../apis/ruleconfig";
|
||||
import "./index.less";
|
||||
import ProgressModal from "../../components/progressModal";
|
||||
|
||||
const { getLabel } = WeaLocaleProvider;
|
||||
|
||||
class Index extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
|
@ -54,7 +56,7 @@ class Index extends Component {
|
|||
com: Select({
|
||||
label: "排序字段",
|
||||
onChange: this.handleChane,
|
||||
value: sysOrderRule.data.orderRule,
|
||||
value: sysOrderRule.data.orderRule || orderOptions[0].value,
|
||||
options: orderOptions
|
||||
})
|
||||
},
|
||||
|
|
@ -62,7 +64,7 @@ class Index extends Component {
|
|||
com: Select({
|
||||
label: "正序/倒序",
|
||||
onChange: this.handleChane,
|
||||
value: sysOrderRule.data.ascOrDesc,
|
||||
value: sysOrderRule.data.ascOrDesc || ascOptions[0].value,
|
||||
options: ascOptions
|
||||
})
|
||||
}
|
||||
|
|
@ -72,7 +74,7 @@ class Index extends Component {
|
|||
com: Select({
|
||||
label: "人员字段",
|
||||
onChange: this.handleChane,
|
||||
value: sysConfCodeRule.data,
|
||||
value: sysConfCodeRule.data || employeeOptions[0].value,
|
||||
options: employeeOptions
|
||||
})
|
||||
}
|
||||
|
|
@ -97,9 +99,9 @@ class Index extends Component {
|
|||
],
|
||||
saveParams: {
|
||||
...this.state.saveParams,
|
||||
orderRule: sysOrderRule.data.orderRule,
|
||||
ascOrDesc: sysOrderRule.data.ascOrDesc,
|
||||
rule: sysConfCodeRule.data,
|
||||
orderRule: sysOrderRule.data.orderRule || orderOptions[0].value,
|
||||
ascOrDesc: sysOrderRule.data.ascOrDesc || ascOptions[0].value,
|
||||
rule: sysConfCodeRule.data || employeeOptions[0].value,
|
||||
enctry: queryAppsetting.data.isOpenEncrypt,
|
||||
operateTaxDeclaration: queryAppsetting.data.isOpenTaxDeclaration
|
||||
}
|
||||
|
|
@ -136,119 +138,122 @@ class Index extends Component {
|
|||
handleSave = (type) => {
|
||||
const { saveParams } = this.state;
|
||||
if (type === "ORDER") {
|
||||
if (_.isEmpty(saveParams.orderRule) || _.isEmpty(saveParams.ascOrDesc)) {
|
||||
Modal.warning({
|
||||
title: "信息确认",
|
||||
content: "必要信息不完整,红色*为必填项!"
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.setState({ loading: { ...this.state.loading, order: true } });
|
||||
API.updateOrderRule(_.pick(saveParams, ["orderRule", "ascOrDesc"])).then(({ status, errormsg }) => {
|
||||
this.setState({ loading: { ...this.state.loading, order: false } });
|
||||
if (status) {
|
||||
message.success("保存成功!");
|
||||
let sysSetting = this.getSysSetting();
|
||||
} else {
|
||||
message.error(errormsg || "保存失败!");
|
||||
}
|
||||
});
|
||||
|
||||
// if (_.isEmpty(saveParams.orderRule) || _.isEmpty(saveParams.ascOrDesc)) {
|
||||
// Modal.warning({
|
||||
// title: "信息确认",
|
||||
// content: "必要信息不完整,红色*为必填项!"
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
// this.setState({ loading: { ...this.state.loading, order: true } });
|
||||
// API.updateOrderRule(_.pick(saveParams, ["orderRule", "ascOrDesc"])).then(({ status, errormsg }) => {
|
||||
// this.setState({ loading: { ...this.state.loading, order: false } });
|
||||
// if (status) {
|
||||
// message.success("保存成功!");
|
||||
// let sysSetting = this.getSysSetting();
|
||||
// } else {
|
||||
// message.error(errormsg || "保存失败!");
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
} else if (type === "EMPLOYEE") {
|
||||
if (_.isEmpty(saveParams.rule)) {
|
||||
Modal.warning({
|
||||
title: "信息确认",
|
||||
content: "必要信息不完整,红色*为必填项!"
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.setState({ loading: { ...this.state.loading, employee: true } });
|
||||
API.saveMatchEmployeeModeRule(_.pick(saveParams, ["rule"])).then(({ status, errormsg }) => {
|
||||
this.setState({ loading: { ...this.state.loading, employee: false } });
|
||||
if (status) {
|
||||
message.success("保存成功!");
|
||||
let sysSetting = this.getSysSetting();
|
||||
} else {
|
||||
message.error(errormsg || "保存失败!");
|
||||
}
|
||||
});
|
||||
// if (_.isEmpty(saveParams.rule)) {
|
||||
// Modal.warning({
|
||||
// title: "信息确认",
|
||||
// content: "必要信息不完整,红色*为必填项!"
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
// this.setState({ loading: { ...this.state.loading, employee: true } });
|
||||
// API.saveMatchEmployeeModeRule(_.pick(saveParams, ["rule"])).then(({ status, errormsg }) => {
|
||||
// this.setState({ loading: { ...this.state.loading, employee: false } });
|
||||
// if (status) {
|
||||
// message.success("保存成功!");
|
||||
// let sysSetting = this.getSysSetting();
|
||||
// } else {
|
||||
// message.error(errormsg || "保存失败!");
|
||||
// }
|
||||
// });
|
||||
} else if (type === "ENCRYTION") {
|
||||
Modal.confirm({
|
||||
title: "信息确认",
|
||||
content: "开启/关闭加密前请做好数据库备份!!!逆向解密会花费几分钟时间,请耐心等待!!!",
|
||||
onOk: () => {
|
||||
this.setState({ loading: { ...this.state.loading, encry: true } });
|
||||
API.saveEncryptSetting({ isOpenEncrypt: saveParams.enctry }).then(({ data, status, errormsg }) => {
|
||||
this.setState({ loading: { ...this.state.loading, encry: false } });
|
||||
if (status) {
|
||||
const { isSuccess, progressId, msg } = data;
|
||||
if (!isSuccess) {
|
||||
message.error(errormsg || msg || "保存失败!");
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
progressVisible: true,
|
||||
progress: 0
|
||||
}, () => {
|
||||
let number = 1;
|
||||
this.timer && clearInterval(this.timer);
|
||||
this.timer = setInterval(() => {
|
||||
API.getEncryptProgress({ progressId }).then(({ status, data, errormsg }) => {
|
||||
const { progress_statue } = data;
|
||||
if (progress_statue === "success" && this.timer) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
number = 1;
|
||||
this.setState({
|
||||
progress: 100
|
||||
}, () => {
|
||||
this.setState({
|
||||
progressVisible: false
|
||||
});
|
||||
});
|
||||
message.success("保存成功");
|
||||
} else if (progress_statue === "in_progress" && this.timer) {
|
||||
if (this.state.progress >= 90) {
|
||||
this.setState({
|
||||
progress: this.state.progress + (0.001 * this.state.progress)
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
progress: 10 * number
|
||||
}, () => number++);
|
||||
}
|
||||
} else if (!status || (progress_statue === "fail" && this.timer)) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
number = 1;
|
||||
this.setState({
|
||||
progress: 100
|
||||
}, () => {
|
||||
this.setState({
|
||||
progressVisible: false
|
||||
});
|
||||
});
|
||||
message.error(errormsg || "保存失败!");
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel: () => {
|
||||
}
|
||||
});
|
||||
// Modal.confirm({
|
||||
// title: "信息确认",
|
||||
// content: "开启/关闭加密前请做好数据库备份!!!逆向解密会花费几分钟时间,请耐心等待!!!",
|
||||
// onOk: () => {
|
||||
// this.setState({ loading: { ...this.state.loading, encry: true } });
|
||||
// API.saveEncryptSetting({ isOpenEncrypt: saveParams.enctry }).then(({ data, status, errormsg }) => {
|
||||
// this.setState({ loading: { ...this.state.loading, encry: false } });
|
||||
// if (status) {
|
||||
// const { isSuccess, progressId, msg } = data;
|
||||
// if (!isSuccess) {
|
||||
// message.error(errormsg || msg || "保存失败!");
|
||||
// return;
|
||||
// }
|
||||
// this.setState({
|
||||
// progressVisible: true,
|
||||
// progress: 0
|
||||
// }, () => {
|
||||
// let number = 1;
|
||||
// this.timer && clearInterval(this.timer);
|
||||
// this.timer = setInterval(() => {
|
||||
// API.getEncryptProgress({ progressId }).then(({ status, data, errormsg }) => {
|
||||
// const { progress_statue } = data;
|
||||
// if (progress_statue === "success" && this.timer) {
|
||||
// clearInterval(this.timer);
|
||||
// this.timer = null;
|
||||
// number = 1;
|
||||
// this.setState({
|
||||
// progress: 100
|
||||
// }, () => {
|
||||
// this.setState({
|
||||
// progressVisible: false
|
||||
// });
|
||||
// });
|
||||
// message.success("保存成功");
|
||||
// } else if (progress_statue === "in_progress" && this.timer) {
|
||||
// if (this.state.progress >= 90) {
|
||||
// this.setState({
|
||||
// progress: this.state.progress + (0.001 * this.state.progress)
|
||||
// });
|
||||
// } else {
|
||||
// this.setState({
|
||||
// progress: 10 * number
|
||||
// }, () => number++);
|
||||
// }
|
||||
// } else if (!status || (progress_statue === "fail" && this.timer)) {
|
||||
// clearInterval(this.timer);
|
||||
// this.timer = null;
|
||||
// number = 1;
|
||||
// this.setState({
|
||||
// progress: 100
|
||||
// }, () => {
|
||||
// this.setState({
|
||||
// progressVisible: false
|
||||
// });
|
||||
// });
|
||||
// message.error(errormsg || "保存失败!");
|
||||
// }
|
||||
// });
|
||||
// }, 1000);
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// },
|
||||
// onCancel: () => {
|
||||
// }
|
||||
// });
|
||||
} else if (type === "DECLARATION") {
|
||||
this.setState({ loading: { ...this.state.loading, declare: true } });
|
||||
API.operateTaxDeclarationFunction(_.pick(saveParams, ["operateTaxDeclaration"])).then(({ status, errormsg }) => {
|
||||
this.setState({ loading: { ...this.state.loading, declare: false } });
|
||||
if (status) {
|
||||
message.success("保存成功!");
|
||||
let sysSetting = this.getSysSetting();
|
||||
} else {
|
||||
message.error(errormsg || "保存失败!");
|
||||
}
|
||||
});
|
||||
// this.setState({ loading: { ...this.state.loading, declare: true } });
|
||||
// API.operateTaxDeclarationFunction(_.pick(saveParams, ["operateTaxDeclaration"])).then(({ status, errormsg }) => {
|
||||
// this.setState({ loading: { ...this.state.loading, declare: false } });
|
||||
// if (status) {
|
||||
// message.success("保存成功!");
|
||||
// let sysSetting = this.getSysSetting();
|
||||
// } else {
|
||||
// message.error(errormsg || "保存失败!");
|
||||
// }
|
||||
// });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -257,22 +262,161 @@ class Index extends Component {
|
|||
if (type === "排序字段") {
|
||||
this.setState({
|
||||
saveParams: { ...this.state.saveParams, orderRule: selected }
|
||||
}, () => {
|
||||
Modal.confirm({
|
||||
title: getLabel(131329, "信息确认"),
|
||||
content: getLabel(111, "确认要保存吗?"),
|
||||
onOk: () => {
|
||||
API.updateOrderRule(_.pick(this.state.saveParams, ["orderRule", "ascOrDesc"]))
|
||||
.then(({ status, errormsg }) => {
|
||||
if (status) {
|
||||
message.success(getLabel(22619, "保存成功!"));
|
||||
let sysSetting = this.getSysSetting();
|
||||
} else {
|
||||
message.error(errormsg || getLabel(22620, "保存失败!"));
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel: () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (type === "正序/倒序") {
|
||||
this.setState({
|
||||
saveParams: { ...this.state.saveParams, ascOrDesc: selected }
|
||||
}, () => {
|
||||
Modal.confirm({
|
||||
title: getLabel(131329, "信息确认"),
|
||||
content: getLabel(111, "确认要保存吗?"),
|
||||
onOk: () => {
|
||||
API.updateOrderRule(_.pick(this.state.saveParams, ["orderRule", "ascOrDesc"]))
|
||||
.then(({ status, errormsg }) => {
|
||||
if (status) {
|
||||
message.success(getLabel(22619, "保存成功!"));
|
||||
let sysSetting = this.getSysSetting();
|
||||
} else {
|
||||
message.error(errormsg || getLabel(22620, "保存失败!"));
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel: () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (type === "人员字段") {
|
||||
this.setState({
|
||||
saveParams: { ...this.state.saveParams, rule: selected }
|
||||
}, () => {
|
||||
Modal.confirm({
|
||||
title: getLabel(131329, "信息确认"),
|
||||
content: getLabel(111, "确认要保存吗?"),
|
||||
onOk: () => {
|
||||
API.saveMatchEmployeeModeRule(_.pick(this.state.saveParams, ["rule"])).then(({ status, errormsg }) => {
|
||||
this.setState({ loading: { ...this.state.loading, employee: false } });
|
||||
if (status) {
|
||||
message.success(getLabel(22619, "保存成功!"));
|
||||
let sysSetting = this.getSysSetting();
|
||||
} else {
|
||||
message.error(errormsg || getLabel(22620, "保存失败!"));
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel: () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (type === "加密设置") {
|
||||
this.setState({
|
||||
saveParams: { ...this.state.saveParams, enctry: selected }
|
||||
}, () => {
|
||||
Modal.confirm({
|
||||
title: getLabel(131329, "信息确认"),
|
||||
content: getLabel(543354, "开启/关闭加密前请做好数据库备份!!!逆向解密会花费几分钟时间,请耐心等待!!!"),
|
||||
onOk: () => {
|
||||
API.saveEncryptSetting({ isOpenEncrypt: this.state.saveParams.enctry })
|
||||
.then(({ data, status, errormsg }) => {
|
||||
this.setState({ loading: { ...this.state.loading, encry: false } });
|
||||
if (status) {
|
||||
const { isSuccess, progressId, msg } = data;
|
||||
if (!isSuccess) {
|
||||
message.error(errormsg || msg || getLabel(22620, "保存失败!"));
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
progressVisible: true,
|
||||
progress: 0
|
||||
}, () => {
|
||||
let number = 1;
|
||||
this.timer && clearInterval(this.timer);
|
||||
this.timer = setInterval(() => {
|
||||
API.getEncryptProgress({ progressId }).then(({ status, data, errormsg }) => {
|
||||
const { progress_statue } = data;
|
||||
if (progress_statue === "success" && this.timer) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
number = 1;
|
||||
this.setState({
|
||||
progress: 100
|
||||
}, () => {
|
||||
this.setState({
|
||||
progressVisible: false
|
||||
});
|
||||
});
|
||||
message.success(getLabel(22619, "保存成功!"));
|
||||
} else if (progress_statue === "in_progress" && this.timer) {
|
||||
if (this.state.progress >= 90) {
|
||||
this.setState({
|
||||
progress: this.state.progress + (0.001 * this.state.progress)
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
progress: 10 * number
|
||||
}, () => number++);
|
||||
}
|
||||
} else if (!status || (progress_statue === "fail" && this.timer)) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
number = 1;
|
||||
this.setState({
|
||||
progress: 100
|
||||
}, () => {
|
||||
this.setState({
|
||||
progressVisible: false
|
||||
});
|
||||
});
|
||||
message.error(errormsg || getLabel(22620, "保存失败!"));
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel: () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (type === "个税申报") {
|
||||
this.setState({
|
||||
saveParams: { ...this.state.saveParams, operateTaxDeclaration: selected }
|
||||
}, () => {
|
||||
Modal.confirm({
|
||||
title: getLabel(131329, "信息确认"),
|
||||
content: getLabel(111, "确认要保存吗?"),
|
||||
onOk: () => {
|
||||
API.operateTaxDeclarationFunction(_.pick(this.state.saveParams, ["operateTaxDeclaration"]))
|
||||
.then(({ status, errormsg }) => {
|
||||
if (status) {
|
||||
message.success(getLabel(22619, "保存成功!"));
|
||||
let sysSetting = this.getSysSetting();
|
||||
} else {
|
||||
message.error(errormsg || getLabel(22620, "保存失败!"));
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancel: () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -292,15 +436,17 @@ class Index extends Component {
|
|||
title={
|
||||
<div className="titleWrapper">
|
||||
<span>排序规则</span>
|
||||
<Button type="primary" onClick={() => this.handleSave("ORDER")} loading={loading.order}>保存</Button>
|
||||
<span></span>
|
||||
{/*<Button type="primary" onClick={() => this.handleSave("ORDER")} loading={loading.order}>保存</Button>*/}
|
||||
</div>
|
||||
} showGroup center items={items}/>
|
||||
<WeaSearchGroup
|
||||
title={
|
||||
<div className="titleWrapper">
|
||||
<span>人员校验规则</span>
|
||||
<Button type="primary" onClick={() => this.handleSave("EMPLOYEE")}
|
||||
loading={loading.employee}>保存</Button>
|
||||
<span></span>
|
||||
{/*<Button type="primary" onClick={() => this.handleSave("EMPLOYEE")}*/}
|
||||
{/* loading={loading.employee}>保存</Button>*/}
|
||||
</div>
|
||||
} showGroup center items={importItems}/>
|
||||
{
|
||||
|
|
@ -309,8 +455,9 @@ class Index extends Component {
|
|||
title={
|
||||
<div className="titleWrapper">
|
||||
<span>加密规则</span>
|
||||
<Button type="primary" onClick={() => this.handleSave("ENCRYTION")}
|
||||
loading={loading.encry}>保存</Button>
|
||||
<span></span>
|
||||
{/*<Button type="primary" onClick={() => this.handleSave("ENCRYTION")}*/}
|
||||
{/* loading={loading.encry}>保存</Button>*/}
|
||||
</div>
|
||||
} showGroup center items={enctryItems}/>
|
||||
}
|
||||
|
|
@ -318,8 +465,9 @@ class Index extends Component {
|
|||
title={
|
||||
<div className="titleWrapper">
|
||||
<span>报税规则</span>
|
||||
<Button type="primary" onClick={() => this.handleSave("DECLARATION")}
|
||||
loading={loading.declare}>保存</Button>
|
||||
<span></span>
|
||||
{/*<Button type="primary" onClick={() => this.handleSave("DECLARATION")}*/}
|
||||
{/* loading={loading.declare}>保存</Button>*/}
|
||||
</div>
|
||||
} showGroup center items={declareItems}/>
|
||||
{
|
||||
|
|
@ -354,7 +502,7 @@ export const Select = payload => {
|
|||
} = payload;
|
||||
return (
|
||||
<WeaFormItem label={label} labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}>
|
||||
<WeaSelect options={multiple ? options : [{ key: "", showname: "" }, ...options]} viewAttr={viewAttr}
|
||||
<WeaSelect options={multiple ? options : [...options]} viewAttr={viewAttr}
|
||||
detailtype={detailtype}
|
||||
value={value}
|
||||
multiple={multiple}
|
||||
|
|
|
|||
Loading…
Reference in New Issue