|
@@ -4,7 +4,7 @@ import {
|
4
|
4
|
putTfItemFinance,
|
5
|
5
|
getTfItemFinanceId,
|
6
|
6
|
} from '@/services/tfFinanceItem'
|
7
|
|
-import { Button, Card, Row, Col, Form, Input } from 'antd'
|
|
7
|
+import { Button, Card, Row, Col, Form, Input, Radio } from 'antd'
|
8
|
8
|
import {
|
9
|
9
|
ProForm,
|
10
|
10
|
ProFormDateTimeRangePicker,
|
|
@@ -25,23 +25,28 @@ export default (props) => {
|
25
|
25
|
|
26
|
26
|
const [params] = useSearchParams()
|
27
|
27
|
const id = params.get('id')
|
|
28
|
+ const [ycType, setYcType] = useState()
|
28
|
29
|
|
|
30
|
+ const onChange = (e) => {
|
|
31
|
+ setYcType(e.target.value);
|
|
32
|
+ };
|
29
|
33
|
useEffect(() => {
|
30
|
34
|
if (id) {
|
31
|
35
|
getTfItemFinanceId(id).then((res) => {
|
32
|
36
|
formRef.current?.setFieldsValue(res)
|
|
37
|
+ setYcType(res?.ycType);
|
33
|
38
|
})
|
34
|
39
|
}
|
35
|
40
|
}, [])
|
36
|
41
|
|
37
|
42
|
const onFinish = (values) => {
|
38
|
43
|
if (!id) {
|
39
|
|
- postTfItemFinance(values).then((res) => {
|
|
44
|
+ postTfItemFinance(ycType, ...values).then((res) => {
|
40
|
45
|
navigate(-1)
|
41
|
46
|
})
|
42
|
47
|
} else if (id) {
|
43
|
48
|
let financeItemId = id
|
44
|
|
- putTfItemFinance(id, { financeItemId, ...values }).then((res) => {
|
|
49
|
+ putTfItemFinance(id, { financeItemId, ycType, ...values }).then((res) => {
|
45
|
50
|
navigate(-1)
|
46
|
51
|
})
|
47
|
52
|
}
|
|
@@ -51,7 +56,7 @@ export default (props) => {
|
51
|
56
|
minimumFractionDigits: 4,
|
52
|
57
|
maximumFractionDigits: 4,
|
53
|
58
|
})
|
54
|
|
-
|
|
59
|
+ console.log('ycType', ycType);
|
55
|
60
|
return (
|
56
|
61
|
<Page>
|
57
|
62
|
<Card>
|
|
@@ -82,7 +87,20 @@ export default (props) => {
|
82
|
87
|
<ProFormText name="fromOrg" label="来源机构" />
|
83
|
88
|
<ProFormText name="toOrg" label="目的机构" />
|
84
|
89
|
<ProFormText name="attach" label="附件" />
|
85
|
|
- <ProFormRadio.Group name="ycType" label="收支类型" />
|
|
90
|
+ {/* <ProFormRadio.Group
|
|
91
|
+ name="ycType"
|
|
92
|
+ label="收支类型"
|
|
93
|
+ options={[
|
|
94
|
+ { label: '收入', value: 1 },
|
|
95
|
+ { label: '支出', value: `${-1}` },
|
|
96
|
+ ]}
|
|
97
|
+ /> */}
|
|
98
|
+ <Form.Item label="收支类型">
|
|
99
|
+ <Radio.Group name="ycType" onChange={onChange} value={ycType}>
|
|
100
|
+ <Radio value={1}>收入</Radio>
|
|
101
|
+ <Radio value={0}>支出</Radio>
|
|
102
|
+ </Radio.Group>
|
|
103
|
+ </Form.Item>
|
86
|
104
|
</ProForm>
|
87
|
105
|
</Card>
|
88
|
106
|
</Page>
|