12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- import { Button, Input, InputNumber, Select, Spin } from 'antd';
- import React, { useState } from 'react';
- const { Option } = Select;
- function PsrControl(props) {
- const { sheetRef } = props;
- const [value1, setValue1] = useState(0.15);
- const [value2, setValue2] = useState(0.25);
- const [value3, setValue3] = useState(14096800);
- const [loading, setLoading] = useState(false);
- const changeProjectType = type => {
- sheetRef.current.luckysheet.setCellValue(101, 1, type, {
- order: 0,
- });
- sheetRef.current.luckysheet.setCellFormat(101, 1, 'ct', { fa: 'General', t: 'g' });
- sheetRef.current.luckysheet.refreshFormula();
- };
- const changeBiddingType = type => {
- sheetRef.current.luckysheet.setCellValue(102, 1, type, {
- order: 0,
- });
- sheetRef.current.luckysheet.setCellFormat(102, 1, 'ct', { fa: 'General', t: 'g' });
- sheetRef.current.luckysheet.refreshFormula();
- };
- const goalSeek = (type, value) => {
- setLoading(true);
- try {
- sheetRef.current.goalSeek(type, value);
- } catch (error) {}
- setLoading(false);
- };
- return (
- <div style={{ marginBottom: 20 }}>
- <Spin spinning={loading}>
- <Input
- value={value1}
- style={{ width: 160, marginRight: 20 }}
- onChange={e => setValue1(e.target.value)}
- addonAfter={<a onClick={() => goalSeek(1, value1)}>净利率</a>}
- />
- <Input
- value={value2}
- style={{ width: 160, marginRight: 20 }}
- onChange={e => setValue2(e.target.value)}
- addonAfter={<a onClick={() => goalSeek(2, value2)}>毛利率</a>}
- />
- <Input
- value={value3}
- style={{ width: 220, marginRight: 20 }}
- onChange={e => setValue3(e.target.value)}
- addonAfter={<a onClick={() => goalSeek(3, value3)}>合同总价</a>}
- />
- <Select
- placeholder="项目类别"
- onChange={changeProjectType}
- style={{ width: 120, marginRight: 20 }}
- >
- <Option value="UF">UF</Option>
- <Option value="RO/NF">RO/NF</Option>
- <Option value="UF&RO/NF">UF+RO/NF</Option>
- <Option value="MBR">MBR</Option>
- <Option value="其他">其他</Option>
- </Select>
- <Select placeholder="招标类型" onChange={changeBiddingType} style={{ width: 120 }}>
- <Option value="货物招标">货物招标</Option>
- <Option value="服务招标">服务招标</Option>
- <Option value="工程招标">工程招标</Option>
- </Select>
- </Spin>
- </div>
- );
- }
- export default PsrControl;
|