瀏覽代碼

Merge branch 'v2' of http://git.ycjcjy.com/yunzhi/crm_pc into v2

张涛 1 年之前
父節點
當前提交
33402ebc71
共有 2 個文件被更改,包括 30 次插入9 次删除
  1. 23
    5
      src/pages/financeItem/Edit.jsx
  2. 7
    4
      src/pages/financeItem/index.jsx

+ 23
- 5
src/pages/financeItem/Edit.jsx 查看文件

@@ -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>

+ 7
- 4
src/pages/financeItem/index.jsx 查看文件

@@ -19,10 +19,10 @@ export default (props) => {
19 19
     {
20 20
       title: '收支类型',
21 21
       dataIndex: 'ycType',
22
-      // valueEnum: {
23
-      //   1: '收入',
24
-      //   -1: '支出',
25
-      // },
22
+      valueEnum: {
23
+        1: '收入',
24
+        '-1': '支出',
25
+      },
26 26
       search: false,
27 27
       ellipsis: true,
28 28
     },
@@ -68,6 +68,9 @@ export default (props) => {
68 68
   return (
69 69
     <List
70 70
       actionRef={actionRef}
71
+      search={{
72
+        labelWidth: 90,
73
+      }}
71 74
       rowKey="financeItemId"
72 75
       onEdit={(record) =>
73 76
         navigate(`/finance/financeItem/edit?id=${record?.financeItemId}`)