10.11 标书费功能优化,增加免费选项

This commit is contained in:
jl-zhoujl2
2022-10-12 10:19:08 +08:00
parent 8ae7936eea
commit 53632cf00e
4 changed files with 43 additions and 25 deletions

View File

@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import ProTable, { ProColumns } from '@ant-design/pro-table';
import React, { useEffect, useRef, useState } from 'react';
import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table';
import { Button, Descriptions, Form, Input, message, Radio, Spin } from 'antd';
import styles from './indexStyles.less';
import '@/assets/xsy_style.less'
@ -83,25 +83,40 @@ const costConfig: React.FC<{}> = () => {
{ title: '序号', valueType: 'index', width: 50 },
{ title: showName.sec, dataIndex: 'sectionName', },
{
title: showName.bsf + '(元)', dataIndex: 'expenses1Amount',
title: showName.bsf + '(元)', dataIndex: 'expenses1Amount', width: '20%',
render: (_, record) => {
return (
<Form form={form}>
<FormItem
name={`expenses1Amount${record.key}`}
rules={[
{ pattern: /^[0-9]+(\.[0-9]{1,2})?$/, message: '请输入正确数值(最多2位小数)' },
{ pattern: /^.{0,21}$/, message: '超长' }
]}
>
<Input
readOnly={returnDisabled(record.sendOut)}
style={{ width: '80%', maxWidth: '300px' }}
placeholder={`请输入${showName.bsf}`}
defaultValue={record.expenses1Amount}
onBlur={(event) => record.expenses1Amount = event.target.value}
/>
</FormItem>
<Radio.Group disabled={returnDisabled(record.sendOut)} onChange={(event) => {
const value = event.target.value;
if (value != undefined) {
const data = [...costData];
const now = data[data.findIndex(item => item.sectionId === record.sectionId)];
now.expenses1Type = value;
record.expenses1Amount = 0;
setCostData(data);
}
}} value={parseInt(record.expenses1Type)}>
<Radio value={0} className={styles.radioStyle}></Radio>
<Radio value={2} className={styles.radioStyle}>
{parseInt(record.expenses1Type) == 2 ? <><FormItem
name={`expenses1Amount${record.key}`}
style={{ display: 'inline-block', width: '60%', paddingLeft: '6px', position: 'relative', top: '-4px' }}
rules={[
{ pattern: /^[0-9]+(\.[0-9]{1,2})?$/, message: '请输入正确数值(最多2位小数)' },
{ pattern: /^.{0,21}$/, message: '超长' }
]}
>
<Input
readOnly={returnDisabled(record.sendOut)}
size="small"
type="number"
placeholder={`请输入${showName.bsf}`}
defaultValue={record.expenses1Amount}
onBlur={(event) => record.expenses1Amount = event.target.value}
/>
</FormItem> </> : null}</Radio>
</Radio.Group>
</Form>
)
}