59 lines
2.0 KiB
JavaScript
59 lines
2.0 KiB
JavaScript
import React from "react";
|
||
import { Button } from "antd";
|
||
import { WeaDialog, WeaSearchGroup, WeaTextarea } from "ecCom";
|
||
import { inject, observer } from "mobx-react";
|
||
import "./index.less";
|
||
|
||
@inject("ledgerStore")
|
||
@observer
|
||
export default class TestModal extends React.Component {
|
||
constructor(props) {
|
||
super(props);
|
||
this.state = {
|
||
testValue: [],
|
||
showResults: "显示结果"
|
||
};
|
||
}
|
||
|
||
componentWillReceiveProps(nextProps, nextContext) {
|
||
if (nextProps.testParams !== this.props.testParams && nextProps.testParams) {
|
||
this.setState({
|
||
testValue: nextProps.testParams.split(/({.*?})/).filter(s => !!s)
|
||
});
|
||
}
|
||
}
|
||
|
||
render() {
|
||
const { visible, onCancel, testParams } = this.props;
|
||
const { showResults, testValue } = this.state;
|
||
return (
|
||
<WeaDialog
|
||
visible={visible}
|
||
onCancel={onCancel}
|
||
initLoadCss
|
||
className="testModalWrapper"
|
||
style={{ width: 800 }}
|
||
title="公式测试"
|
||
buttons={[
|
||
<Button type="primary" onClick={() => {
|
||
}}> 执行 </Button>
|
||
]}>
|
||
<div className="testContent">
|
||
<WeaSearchGroup title="" showGroup><WeaTextarea viewAttr={1} value={testParams}/></WeaSearchGroup>
|
||
<WeaSearchGroup title="输入参数测试值" showGroup></WeaSearchGroup>
|
||
<WeaSearchGroup title="测试结果" showGroup><WeaTextarea viewAttr={1} value={showResults}/></WeaSearchGroup>
|
||
<TestTip/>
|
||
</div>
|
||
</WeaDialog>
|
||
);
|
||
}
|
||
}
|
||
|
||
const TestTip = () => {
|
||
return <div className="testTipWrapper">
|
||
<div>涉及到选择具体数据进行运算时,请先检查对应数据源中是否有数据项;</div>
|
||
<div>涉及到日期控件时,请先选择日期控件的格式,保持和控件本身设置的格式一致,否则可能会导致预期与实际执行结果不一致;</div>
|
||
<div>涉及到日期控件判断与预期不符合时,请先检查日期控件的格式是否与等号右边的格式保持一致;</div>
|
||
</div>;
|
||
};
|