|
@@ -0,0 +1,84 @@
|
|
|
+import { useEffect, useMemo, useState } from 'react';
|
|
|
+import { Divider, Input, Modal, Select, Table } from 'antd';
|
|
|
+
|
|
|
+const { TextArea } = Input;
|
|
|
+
|
|
|
+const FormulaModal = (props) => {
|
|
|
+ const { item, numFiledList = [], visible, onCancel, onChange } = props;
|
|
|
+ const symbolList = ['+', '-', '*', '/', '(', ')'];
|
|
|
+ const numberList = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '.'];
|
|
|
+
|
|
|
+ const [formula, setFormula] = useState();
|
|
|
+
|
|
|
+ const [data, setData] = useState([]);
|
|
|
+
|
|
|
+ const value = useMemo(() => {
|
|
|
+ return '计算公式=';
|
|
|
+ }, [formula]);
|
|
|
+
|
|
|
+ return (
|
|
|
+ <Modal
|
|
|
+ title="编辑计算公式"
|
|
|
+ open={visible}
|
|
|
+ onCancel={onCancel}
|
|
|
+ onOk={() => {
|
|
|
+ const linked = {};
|
|
|
+ data?.forEach((cur) => {
|
|
|
+ linked[cur.name] = cur.linked;
|
|
|
+ });
|
|
|
+ onChange?.({ linked });
|
|
|
+ }}
|
|
|
+ width={1000}
|
|
|
+ pagination={false}
|
|
|
+ >
|
|
|
+ <Divider />
|
|
|
+ <TextArea value={value} />
|
|
|
+ <div style={{ margin: '20px 20px 20px 0' }}>
|
|
|
+ 计算对象:
|
|
|
+ {numFiledList.map((item) => (
|
|
|
+ <span
|
|
|
+ style={{
|
|
|
+ padding: '6px 10px',
|
|
|
+ border: '1px solid #e5e5e5',
|
|
|
+ borderRadius: '2px',
|
|
|
+ marginRight: '10px',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {item.props.label}
|
|
|
+ </span>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ <div style={{ margin: '0 20px 20px 0' }}>
|
|
|
+ 计算对象:
|
|
|
+ {symbolList.map((item) => (
|
|
|
+ <span
|
|
|
+ style={{
|
|
|
+ padding: '6px 10px',
|
|
|
+ border: '1px solid #e5e5e5',
|
|
|
+ borderRadius: '2px',
|
|
|
+ marginRight: '10px',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {item}
|
|
|
+ </span>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ <div style={{ margin: '0 20px 20px 0' }}>
|
|
|
+ 数字键盘:
|
|
|
+ {numberList.map((item) => (
|
|
|
+ <span
|
|
|
+ style={{
|
|
|
+ padding: '6px 10px',
|
|
|
+ border: '1px solid #e5e5e5',
|
|
|
+ borderRadius: '2px',
|
|
|
+ marginRight: '10px',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {item}
|
|
|
+ </span>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+ );
|
|
|
+};
|
|
|
+export default FormulaModal;
|