|
@@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect } from 'react';
|
2
|
2
|
import { Form, Input, Popconfirm, Select, Button, Modal, InputNumber, message, Col, Row, Card } from 'antd';
|
3
|
3
|
import { PlusOutlined } from '@ant-design/icons';
|
4
|
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
|
6
|
import { history } from 'umi';
|
7
|
7
|
import PageTable from '@/components/PageTable';
|
8
|
8
|
|
|
@@ -19,7 +19,6 @@ export default (props) => {
|
19
|
19
|
const [formModel] = Form.useForm();
|
20
|
20
|
const [editModal, setEditModal] = useState(false);
|
21
|
21
|
const [modelLoading, setModelLoading] = useState(false);
|
22
|
|
- const [regionId, setRegionId] = useState();
|
23
|
22
|
const [invoiceItem, setinvoiceItem] = useState();
|
24
|
23
|
const actionRef = useRef();
|
25
|
24
|
|
|
@@ -56,7 +55,7 @@ export default (props) => {
|
56
|
55
|
const Submit = (val) => {
|
57
|
56
|
setModelLoading(true);
|
58
|
57
|
if (invoiceItem) {
|
59
|
|
- updateInvoiceItemTpl(invoiceItem.itemId,{...invoiceItem,...val,invoiceId:invoiceId}).then((res)=>{
|
|
58
|
+ updateInvoiceItemTpl(invoiceItem.invoiceItemTplId, { ...invoiceItem, ...val, invoiceId: invoiceId }).then((res) => {
|
60
|
59
|
message.success('修改成功')
|
61
|
60
|
setModelLoading(false)
|
62
|
61
|
actionRef.current.reload()
|
|
@@ -65,8 +64,8 @@ export default (props) => {
|
65
|
64
|
setModelLoading(false);
|
66
|
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
|
69
|
message.success('添加成功')
|
71
|
70
|
setModelLoading(false)
|
72
|
71
|
actionRef.current.reload()
|
|
@@ -98,7 +97,7 @@ export default (props) => {
|
98
|
97
|
}
|
99
|
98
|
//删除报销项目
|
100
|
99
|
const handleDelete = (invoiceItemTplId) => {
|
101
|
|
- deleteInvoiceItemTpl(invoiceItemTplId).then(res=>{
|
|
100
|
+ deleteInvoiceItemTpl(invoiceItemTplId).then(res => {
|
102
|
101
|
message.success('删除成功')
|
103
|
102
|
actionRef.current.reload()
|
104
|
103
|
}).catch((err) => {
|
|
@@ -106,7 +105,7 @@ export default (props) => {
|
106
|
105
|
});
|
107
|
106
|
}
|
108
|
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
|
110
|
</Button>,
|
112
|
111
|
];
|
|
@@ -180,20 +179,24 @@ export default (props) => {
|
180
|
179
|
</FormItem>
|
181
|
180
|
</Form>
|
182
|
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
|
198
|
</Row>
|
|
199
|
+
|
197
|
200
|
<Modal
|
198
|
201
|
forceRender
|
199
|
202
|
title={invoiceItem ? '报销项目编辑' : '报销项目新增'}
|
|
@@ -226,6 +229,7 @@ export default (props) => {
|
226
|
229
|
</FormItem>
|
227
|
230
|
</Form>
|
228
|
231
|
</Modal>
|
|
232
|
+
|
229
|
233
|
</>
|
230
|
234
|
)
|
231
|
235
|
}
|