bug修复

This commit is contained in:
黎永顺 2023-03-01 09:05:57 +08:00
parent ef7e7d4ae5
commit 33ac08515e
2 changed files with 8 additions and 4 deletions

View File

@ -12,6 +12,7 @@ export default class FormalFormModal extends React.Component {
constructor(props) {
super(props);
this.state = {
formalua: false, //是否删除操作过公式数据
validateType: "",
returnType: "",
value: "",
@ -107,6 +108,7 @@ export default class FormalFormModal extends React.Component {
const index = value.lastIndexOf("{", end - 1);
const currentValue = value.substring(index, end);
this.setState({
formalua: true,
value: value.replace(currentValue, "")
}, () => {
if (propsTextarea.setSelectionRange) {
@ -141,7 +143,7 @@ export default class FormalFormModal extends React.Component {
this.parameters = [];
}
this.setState({
value
value, formalua: true
});
}
@ -209,6 +211,7 @@ export default class FormalFormModal extends React.Component {
referenceType: this.referenceType == "" ? this.props.valueType == "2" ? "formula" : this.props.valueType == "3" ? "sql" : "" : this.referenceType
};
saveFormual(params).then(data => {
this.setState({ formalua: false });
this.props.onSaveFormal(data);
this.props.onCancel();
});
@ -319,13 +322,13 @@ export default class FormalFormModal extends React.Component {
render() {
const { salaryItemStore } = this.props;
const { searchGroup, searchFields } = salaryItemStore;
const { value, formulaDatasourceList, extendParam, testVisible, showTestVal } = this.state;
const { value, formulaDatasourceList, extendParam, testVisible, showTestVal, formalua } = this.state;
const title = <div className="formulaTitleWrapper">
<div>{`${(this.props.valueType == 2 || this.props.valueType === "FORMULA") ? "函数" : "SQL"}公式`}</div>
{
value && <Button type="primary" onClick={() => {
const isSaveBool = _.every(this.parameters, it => !!it.id);
if (isSaveBool) {
if (isSaveBool && !formalua) {
this.setState({ testVisible: true });
} else {
message.info("请先保存公式后再进行测试");
@ -350,6 +353,7 @@ export default class FormalFormModal extends React.Component {
className="formula-wrapper"
initLoadCss
onCancel={() => {
this.setState({ formalua: false });
this.props.onCancel();
}}>
{

View File

@ -21,7 +21,7 @@ export default class TestModal extends React.Component {
testValue: nextProps.parameters
});
}
if (nextProps.showTestVal !== this.props.showTestVal && nextProps.showTestVal) {
if (nextProps.showTestVal !== this.props.showTestVal && !_.isNil(nextProps.showTestVal)) {
this.setState({
showResults: nextProps.showTestVal
});