李志伟 2 years ago
parent
commit
fb6c8d2de9

+ 24
- 20
src/pages/invoiceFill/components/BasicInfo.jsx View File

2
 import { Form, Input, Popconfirm, Select, Button, Modal, InputNumber, message, Col, Row, Card } from 'antd';
2
 import { Form, Input, Popconfirm, Select, Button, Modal, InputNumber, message, Col, Row, Card } from 'antd';
3
 import { PlusOutlined } from '@ant-design/icons';
3
 import { PlusOutlined } from '@ant-design/icons';
4
 import { saveInvoiceFill, updateInvoiceFill, getInvoiceFillDetail } from '@/services/invoiceFill'
4
 import { saveInvoiceFill, updateInvoiceFill, getInvoiceFillDetail } from '@/services/invoiceFill'
5
-import { saveInvoiceItemTpl, updateInvoiceItemTpl, getInvoiceItemTplDetail,getInvoiceItemTplList,deleteInvoiceItemTpl } from '@/services/invoiceItemTpl'
5
+import { saveInvoiceItemTpl, updateInvoiceItemTpl, getInvoiceItemTplDetail, getInvoiceItemTplList, deleteInvoiceItemTpl } from '@/services/invoiceItemTpl'
6
 import { history } from 'umi';
6
 import { history } from 'umi';
7
 import PageTable from '@/components/PageTable';
7
 import PageTable from '@/components/PageTable';
8
 
8
 
19
   const [formModel] = Form.useForm();
19
   const [formModel] = Form.useForm();
20
   const [editModal, setEditModal] = useState(false);
20
   const [editModal, setEditModal] = useState(false);
21
   const [modelLoading, setModelLoading] = useState(false);
21
   const [modelLoading, setModelLoading] = useState(false);
22
-  const [regionId, setRegionId] = useState();
23
   const [invoiceItem, setinvoiceItem] = useState();
22
   const [invoiceItem, setinvoiceItem] = useState();
24
   const actionRef = useRef();
23
   const actionRef = useRef();
25
 
24
 
56
   const Submit = (val) => {
55
   const Submit = (val) => {
57
     setModelLoading(true);
56
     setModelLoading(true);
58
     if (invoiceItem) {
57
     if (invoiceItem) {
59
-      updateInvoiceItemTpl(invoiceItem.itemId,{...invoiceItem,...val,invoiceId:invoiceId}).then((res)=>{
58
+      updateInvoiceItemTpl(invoiceItem.invoiceItemTplId, { ...invoiceItem, ...val, invoiceId: invoiceId }).then((res) => {
60
         message.success('修改成功')
59
         message.success('修改成功')
61
         setModelLoading(false)
60
         setModelLoading(false)
62
         actionRef.current.reload()
61
         actionRef.current.reload()
65
         setModelLoading(false);
64
         setModelLoading(false);
66
         message.error(err.message || err);
65
         message.error(err.message || err);
67
       });
66
       });
68
-    } else{
69
-      saveInvoiceItemTpl({...val,invoiceId:invoiceId}).then(res=>{
67
+    } else {
68
+      saveInvoiceItemTpl({ ...val, invoiceId: invoiceId }).then(res => {
70
         message.success('添加成功')
69
         message.success('添加成功')
71
         setModelLoading(false)
70
         setModelLoading(false)
72
         actionRef.current.reload()
71
         actionRef.current.reload()
98
   }
97
   }
99
   //删除报销项目
98
   //删除报销项目
100
   const handleDelete = (invoiceItemTplId) => {
99
   const handleDelete = (invoiceItemTplId) => {
101
-    deleteInvoiceItemTpl(invoiceItemTplId).then(res=>{
100
+    deleteInvoiceItemTpl(invoiceItemTplId).then(res => {
102
       message.success('删除成功')
101
       message.success('删除成功')
103
       actionRef.current.reload()
102
       actionRef.current.reload()
104
     }).catch((err) => {
103
     }).catch((err) => {
106
     });
105
     });
107
   }
106
   }
108
   const actions = () => [
107
   const actions = () => [
109
-    <Button key="add" type="primary" icon={<PlusOutlined />} onClick={showModel}>
108
+    <Button key="add" type="primary" icon={<PlusOutlined />} onClick={() => showModel()}>
110
       新增报销项目
109
       新增报销项目
111
     </Button>,
110
     </Button>,
112
   ];
111
   ];
180
             </FormItem>
179
             </FormItem>
181
           </Form>
180
           </Form>
182
         </Col>
181
         </Col>
183
-        <Col span={12}>
184
-          报销项目
185
-          <PageTable
186
-            request={getInvoiceItemTplList}
187
-            toolBarRender={actions}
188
-            actionRef={actionRef}
189
-            columns={columns}
190
-            rowKey="ItemId"
191
-            options={false}
192
-            search={false}
193
-            params={{invoiceId}}
194
-          />
195
-        </Col>
182
+        {
183
+          invoiceId &&
184
+          <Col span={12}>
185
+            报销项目
186
+            <PageTable
187
+              request={getInvoiceItemTplList}
188
+              toolBarRender={actions}
189
+              actionRef={actionRef}
190
+              columns={columns}
191
+              rowKey="invoiceItemTplId"
192
+              options={false}
193
+              search={false}
194
+              params={{ invoiceId }}
195
+            />
196
+          </Col>
197
+        }
196
       </Row>
198
       </Row>
199
+
197
       <Modal
200
       <Modal
198
         forceRender
201
         forceRender
199
         title={invoiceItem ? '报销项目编辑' : '报销项目新增'}
202
         title={invoiceItem ? '报销项目编辑' : '报销项目新增'}
226
           </FormItem>
229
           </FormItem>
227
         </Form>
230
         </Form>
228
       </Modal>
231
       </Modal>
232
+
229
     </>
233
     </>
230
   )
234
   )
231
 }
235
 }

+ 2
- 2
src/pages/invoiceFill/components/ReimbursementPerson.jsx View File

20
   const Submit = (val) => {
20
   const Submit = (val) => {
21
     setModelLoading(true);
21
     setModelLoading(true);
22
     if (person) {
22
     if (person) {
23
-      updateInvoicePerson(person.itemId,{...person,...val,invoiceId:invoiceId}).then((res)=>{
23
+      updateInvoicePerson(person.invoicePersonId,{...person,...val,invoiceId:invoiceId}).then((res)=>{
24
         message.success('修改成功')
24
         message.success('修改成功')
25
         setModelLoading(false)
25
         setModelLoading(false)
26
         actionRef.current.reload()
26
         actionRef.current.reload()
123
         toolBarRender={actions}
123
         toolBarRender={actions}
124
         actionRef={actionRef}
124
         actionRef={actionRef}
125
         columns={columns}
125
         columns={columns}
126
-        rowKey="personId"
126
+        rowKey="invoicePersonId"
127
         options={false}
127
         options={false}
128
         search={false}
128
         search={false}
129
         params={{invoiceId}}
129
         params={{invoiceId}}

+ 9
- 5
src/pages/invoiceFill/edit.jsx View File

9
 export default (props) => {
9
 export default (props) => {
10
   const { location } = props;
10
   const { location } = props;
11
   const { id } = location.query;
11
   const { id } = location.query;
12
-  const detailRef=useRef();
13
-  const addDetail=()=>{
12
+  const detailRef = useRef();
13
+  const addDetail = () => {
14
     detailRef.current.refrash();
14
     detailRef.current.refrash();
15
   }
15
   }
16
   return (
16
   return (
17
-    <PageHeaderWrapper extra={[<Button key='addDetail' onClick={addDetail}>生成明细</Button>]}>
17
+    <PageHeaderWrapper extra={[id&&<Button key='addDetail' onClick={addDetail}>生成明细</Button>]}>
18
       <ProCard tabs={{ type: 'card' }} style={{ minHeight: '700px' }}>
18
       <ProCard tabs={{ type: 'card' }} style={{ minHeight: '700px' }}>
19
         <ProCard.TabPane key={1} tab="基本信息">
19
         <ProCard.TabPane key={1} tab="基本信息">
20
           <BasicInfo invoiceId={id} />
20
           <BasicInfo invoiceId={id} />
21
-          报销明细
22
-          <InvoiceDetail ref={detailRef} invoiceId={id} />
21
+          {
22
+            id &&
23
+            <>报销明细
24
+              <InvoiceDetail ref={detailRef} invoiceId={id} /></>
25
+          }
26
+
23
         </ProCard.TabPane>
27
         </ProCard.TabPane>
24
         <ProCard.TabPane key={2} disabled={!id} tab="报销人员">
28
         <ProCard.TabPane key={2} disabled={!id} tab="报销人员">
25
           <ReimbursementPerson invoiceId={id} />
29
           <ReimbursementPerson invoiceId={id} />