李志伟 2 years ago
parent
commit
cfff45cc76

+ 3
- 3
config/proxy.js View File

@@ -11,11 +11,11 @@ export default {
11 11
     // localhost:8000/api/** -> https://preview.pro.ant.design/api/**
12 12
     '/api/': {
13 13
       // 要代理的地址
14
-      target: 'http://192.168.89.76:7081',
14
+      target: 'http://192.168.89.147:7081',
15 15
       changeOrigin: true,
16 16
       headers: {
17
-        origin: 'http://192.168.89.76:7081',
18
-        referer: 'http://192.168.89.76:7081',
17
+        origin: 'http://192.168.89.147:7081',
18
+        referer: 'http://192.168.89.147:7081',
19 19
       },
20 20
     },
21 21
   },

+ 2
- 1
src/components/PageTable/index.jsx View File

@@ -6,7 +6,7 @@ import { queryTable } from '@/utils/request';
6 6
 import useExport from '@/utils/hooks/useExport';
7 7
 
8 8
 export default (props) => {
9
-  const { formRef, request, expfunc, params = {}, toolBarRender, beforeSearchSubmit, ...leftProps } = props;
9
+  const { formRef, request, expfunc,invoiceId, params = {}, toolBarRender, beforeSearchSubmit, ...leftProps } = props;
10 10
 
11 11
   // 如果 formRef 未设置, 则使用 fmRef 去代理
12 12
   const fmRef = useRef();
@@ -15,6 +15,7 @@ export default (props) => {
15 15
   // 导出函数需要使用的 params
16 16
   const exportParams = useRef()
17 17
   const handleBeforSearch = (params) => {
18
+    params.invoiceId=invoiceId||''
18 19
     if (typeof beforeSearchSubmit === 'function') {
19 20
       exportParams.current = beforeSearchSubmit(params);
20 21
     } else {

+ 22
- 8
src/components/Upload/UploadExcel.jsx View File

@@ -1,12 +1,12 @@
1 1
 import React, { useState } from 'react';
2 2
 import { LoadingOutlined, UploadOutlined } from '@ant-design/icons';
3
-import { Button, message } from 'antd';
4
-import Upload from './Upload';
3
+import { Button, message, Upload } from 'antd';
4
+import { saveImportPerson } from '@/services/invoicePerson'
5 5
 
6 6
 function beforeUpload(file) {
7
-  const isExcel = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' || file.type === 'application/vnd.ms-excel';
7
+  const isExcel = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
8 8
   if (!isExcel) {
9
-    message.error('请上传 excel表格!');
9
+    message.error('请上传excle表格(务必通过模板下载修改)');
10 10
   }
11 11
   const isLt10M = file.size / 1024 / 1024 < 10;
12 12
   if (!isLt10M) {
@@ -16,18 +16,20 @@ function beforeUpload(file) {
16 16
   return isExcel && isLt10M;
17 17
 }
18 18
 
19
+
19 20
 export default (props) => {
20
-  const { onChange } = props;
21
+  const { onChange, id ,refrash } = props;
21 22
 
22 23
   const [loading, setLoading] = useState(false);
23 24
 
24 25
   const handleChange = info => {
25 26
     if (info.file.status === 'uploading') {
26
-      setLoading(true);
27
+      setLoading(true); 
27 28
       return;
28 29
     }
29 30
     if (info.file.status === 'error') {
30 31
       setLoading(false);
32
+      refrash()
31 33
       return;
32 34
     }
33 35
 
@@ -36,15 +38,27 @@ export default (props) => {
36 38
       onChange(info.file.response);
37 39
     }
38 40
   };
41
+  function uploadFile({ file, onSuccess, onError }) {
42
+    const formData = new FormData();
43
+    formData.append('file', file);
44
+    saveImportPerson(formData, id).then((url) => {
45
+      onSuccess(url, file)
46
+    }).catch((e) => {
47
+      onError(e)
48
+    });
39 49
 
50
+    return {
51
+      abort: () => { },
52
+    };
53
+  }
40 54
   return (
41 55
     <Upload
42
-      // listType="picture"
56
+      customRequest={uploadFile}
43 57
       showUploadList={false}
44 58
       beforeUpload={beforeUpload}
45 59
       onChange={handleChange}
46 60
     >
47
-       <Button type="primary" disabled={loading} icon={loading ? <LoadingOutlined /> : <UploadOutlined />}>上传</Button>
61
+      <Button type="primary" disabled={loading} icon={loading ? <LoadingOutlined /> : <UploadOutlined />}>上传</Button>
48 62
     </Upload>
49 63
   );
50 64
 }

+ 15
- 46
src/pages/invoiceFill/components/BasicInfo.jsx View File

@@ -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, 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 [invoiceItem, setinvoiceItem] = useState();
23 22
   const actionRef = useRef();
24 23
 
25 24
   //保存班级
@@ -54,46 +53,24 @@ export default (props) => {
54 53
   //报销项目弹窗保存
55 54
   const Submit = (val) => {
56 55
     setModelLoading(true);
57
-    if (invoiceItem) {
58
-      updateInvoiceItemTpl(invoiceItem.invoiceItemTplId, { ...invoiceItem, ...val, invoiceId: invoiceId }).then((res) => {
59
-        message.success('修改成功')
60
-        setModelLoading(false)
61
-        actionRef.current.reload()
62
-        onCancel()
63
-      }).catch((err) => {
64
-        setModelLoading(false);
65
-        message.error(err.message || err);
66
-      });
67
-    } else {
68
-      saveInvoiceItemTpl({ ...val, invoiceId: invoiceId }).then(res => {
69
-        message.success('添加成功')
70
-        setModelLoading(false)
71
-        actionRef.current.reload()
72
-        onCancel();
73
-      }).catch((err) => {
74
-        setModelLoading(false);
75
-        message.error(err.message || err);
76
-      });
77
-    }
56
+    saveInvoiceItemTpl(val, invoiceId).then(res => {
57
+      message.success('添加成功')
58
+      setModelLoading(false)
59
+      actionRef.current.reload()
60
+      onCancel();
61
+    }).catch((err) => {
62
+      setModelLoading(false);
63
+      message.error(err.message || err);
64
+    });
78 65
   }
79 66
   // 弹窗关闭
80 67
   const onCancel = () => {
81 68
     setEditModal(false);
82
-    setinvoiceItem()
69
+    formModel.resetFields()
83 70
   }
84 71
   //弹起弹窗
85
-  const showModel = (id) => {
86
-    if (id) {
87
-      getInvoiceItemTplDetail(id).then((res) => {
88
-        formModel.setFieldsValue(res)
89
-        setinvoiceItem(res)
90
-        setEditModal(true);
91
-      }).catch((err) => {
92
-        message.error(err.message || err);
93
-      });
94
-    } else {
95
-      setEditModal(true);
96
-    }
72
+  const showModel = () => {
73
+    setEditModal(true);
97 74
   }
98 75
   //删除报销项目
99 76
   const handleDelete = (invoiceItemTplId) => {
@@ -105,7 +82,7 @@ export default (props) => {
105 82
     });
106 83
   }
107 84
   const actions = () => [
108
-    <Button key="add" type="primary" icon={<PlusOutlined />} onClick={() => showModel()}>
85
+    <Button key="add" type="primary" icon={<PlusOutlined />} onClick={showModel}>
109 86
       新增报销项目
110 87
     </Button>,
111 88
   ];
@@ -133,14 +110,6 @@ export default (props) => {
133 110
       title: '操作',
134 111
       valueType: 'option',
135 112
       render: (_, record) => [
136
-        <Button
137
-          style={{ padding: 0 }}
138
-          type="link"
139
-          key={1}
140
-          onClick={() => showModel(record.invoiceItemTplId)}
141
-        >
142
-          编辑
143
-        </Button>,
144 113
         <Popconfirm
145 114
           key={2}
146 115
           title="您是否确认删除 ?"
@@ -199,7 +168,7 @@ export default (props) => {
199 168
 
200 169
       <Modal
201 170
         forceRender
202
-        title={invoiceItem ? '报销项目编辑' : '报销项目新增'}
171
+        title='报销项目新增'
203 172
         visible={editModal}
204 173
         onCancel={onCancel}
205 174
         keyboard={false}

+ 69
- 53
src/pages/invoiceFill/components/InvoiceDetail.jsx View File

@@ -1,23 +1,24 @@
1
-import React, { useState, useRef,useImperativeHandle,forwardRef } from 'react';
2
-import { Form, Input, Button, Modal, message } from 'antd';
1
+import React, { useState, useRef, useImperativeHandle, forwardRef } from 'react';
2
+import { Form, Input, Button, Modal, message, Popconfirm } from 'antd';
3 3
 import { PlusOutlined } from '@ant-design/icons';
4
-import { getInvoiceDetailList,getInvoiceDetailDetail,updateInvoiceDetail } from '@/services/invoiceDetail'
4
+import { getInvoiceDetailList, updateInvoiceDetail,deleteInvoiceDetail } from '@/services/invoiceDetail'
5
+import {getExport} from '@/services/invoiceFill'
5 6
 import PageTable from '@/components/PageTable';
6 7
 
7 8
 const FormItem = Form.Item;
8 9
 const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 } };
9 10
 
10
-export default forwardRef((props,ref) => {
11
+export default forwardRef((props, ref) => {
11 12
   const { invoiceId } = props
12
-  const [formModel] = Form.useForm();
13
+  const [form] = Form.useForm();
13 14
   const [editModal, setEditModal] = useState(false);
14 15
   const [modelLoading, setModelLoading] = useState(false);
15
-  const [invoiceDetail,setInvoiceDetail]=useState()
16
+  const [invoiceDetail, setInvoiceDetail] = useState()
16 17
   const actionRef = useRef();
17 18
 
18 19
   //弹窗保存
19
-  const Submit = () => {
20
-    updateInvoiceDetail(invoiceDetail.itemId,{...invoiceDetail,...val,invoiceId:invoiceId}).then((res)=>{
20
+  const Submit = (val) => {
21
+    updateInvoiceDetail(invoiceDetail.detailId,invoiceId, { ...invoiceDetail, ...val }).then((res) => {
21 22
       message.success('修改成功')
22 23
       setModelLoading(false)
23 24
       refrash()
@@ -31,49 +32,49 @@ export default forwardRef((props,ref) => {
31 32
   const onCancel = () => {
32 33
     setEditModal(false);
33 34
     setInvoiceDetail()
35
+    form.resetFields()
34 36
   }
35 37
 
36
-  const showModel = (id) => {
37
-    getInvoiceDetailDetail(id).then((res) => {
38
-      formModel.setFieldsValue(res)
39
-      setInvoiceDetail(res)
40
-      setEditModal(true);
41
-    }).catch((err) => {
42
-      message.error(err.message || err);
43
-    });
38
+  const showModel = (value) => {
39
+    form.setFieldsValue(value)
40
+    setInvoiceDetail(value)
41
+    setEditModal(true);
44 42
   }
45
-  const refrash=()=>{
43
+  const refrash = () => {
46 44
     actionRef.current.reload()
47 45
   }
48 46
   useImperativeHandle(ref, () => ({
49 47
     refrash
50 48
   }))
51
-  const actions = () => [
52
-    <Button key="add" type="primary" icon={<PlusOutlined />} onClick={showModel}>
53
-      导出
54
-    </Button>,
55
-  ];
49
+  const handleDelete = (id) => {
50
+    deleteInvoiceDetail(id).then(res => {
51
+      message.success('删除成功')
52
+      refrash()
53
+    }).catch((err) => {
54
+      message.error(err.message || err);
55
+    });
56
+  }
56 57
   const columns = [
57 58
     {
58 59
       title: '姓名',
59
-      dataIndex: 'person_name',
60
-      key: 'person_name',
60
+      dataIndex: 'personName',
61
+      key: 'personName',
61 62
     },
62 63
     {
63 64
       title: '开票单位',
64
-      dataIndex: 'org_name',
65
-      key: 'org_name',
65
+      dataIndex: 'orgName',
66
+      key: 'orgName',
66 67
     },
67 68
     {
68 69
       title: '纳税识别号',
69
-      dataIndex: 'tax_no',
70
-      key: 'tax_no',
70
+      dataIndex: 'taxNo',
71
+      key: 'taxNo',
71 72
     },
72 73
     {
73 74
       title: '地址',
74 75
       dataIndex: 'address',
75 76
       key: 'address',
76
-      search:false
77
+      search: false
77 78
     },
78 79
     {
79 80
       title: '电话',
@@ -82,36 +83,36 @@ export default forwardRef((props,ref) => {
82 83
     },
83 84
     {
84 85
       title: '开户银行',
85
-      dataIndex: 'bank_name',
86
-      key: 'bank_name',
87
-    },    
86
+      dataIndex: 'bankName',
87
+      key: 'bankName',
88
+    },
88 89
     {
89 90
       title: '开户行账户',
90
-      dataIndex: 'card_no',
91
-      key: 'card_no',
91
+      dataIndex: 'cardNo',
92
+      key: 'cardNo',
92 93
     },
93 94
     {
94 95
       title: '项目',
95
-      dataIndex: 'item_name',
96
-      key: 'item_name',
96
+      dataIndex: 'itemName',
97
+      key: 'itemName',
97 98
     },
98 99
     {
99 100
       title: '开票金额',
100 101
       dataIndex: 'charge',
101 102
       key: 'charge',
102
-      search:false
103
+      search: false
103 104
     },
104 105
     {
105 106
       title: '是否合开',
106
-      dataIndex: 'merge_remark',
107
-      key: 'merge_remark',
108
-      search:false
107
+      dataIndex: 'mergeRemark',
108
+      key: 'mergeRemark',
109
+      search: false
109 110
     },
110 111
     {
111 112
       title: '住宿清单',
112
-      dataIndex: 'stay_remark',
113
-      key: 'stay_remark',
114
-      search:false
113
+      dataIndex: 'stayRemark',
114
+      key: 'stayRemark',
115
+      search: false
115 116
     },
116 117
     {
117 118
       title: '操作',
@@ -121,10 +122,21 @@ export default forwardRef((props,ref) => {
121 122
           style={{ padding: 0 }}
122 123
           type="link"
123 124
           key={1}
124
-          onClick={() => showModel(record.detailId)}
125
+          onClick={() => showModel(record)}
125 126
         >
126 127
           编辑
127 128
         </Button>,
129
+        <Popconfirm
130
+          key={2}
131
+          title="您是否确认删除 ?"
132
+          onConfirm={() => handleDelete(record.detailId)}
133
+          okText="确定"
134
+          cancelText="取消"
135
+        >
136
+          <Button style={{ padding: 0 }} type="link">
137
+            删除
138
+          </Button>
139
+        </Popconfirm>,
128 140
       ],
129 141
     },
130 142
   ];
@@ -132,13 +144,14 @@ export default forwardRef((props,ref) => {
132 144
     <>
133 145
       <PageTable
134 146
         request={getInvoiceDetailList}
135
-        toolBarRender={actions}
136 147
         actionRef={actionRef}
137 148
         columns={columns}
138 149
         rowKey="detailId"
150
+        expfunc={getExport}
151
+        invoiceId={invoiceId}
139 152
         options={false}
140 153
         scroll={{ x: 2000 }}
141
-        params={{invoiceId}}
154
+        params={{ invoiceId }}
142 155
       />
143 156
 
144 157
       <Modal
@@ -151,14 +164,14 @@ export default forwardRef((props,ref) => {
151 164
         destroyOnClose={true}
152 165
         footer={null}
153 166
       >
154
-        <Form {...formItemLayout} onFinish={Submit} form={formModel}>
155
-          <FormItem label="姓名" name="person_name" rules={[{ required: true, message: '请输入' }]}>
167
+        <Form {...formItemLayout} onFinish={Submit} form={form}>
168
+          <FormItem label="姓名" name="personName" rules={[{ required: true, message: '请输入' }]}>
156 169
             <Input placeholder="请输入" />
157 170
           </FormItem>
158 171
           <FormItem label="开票(单位全称)" name="orgName" rules={[{ required: true, message: '请输入' }]}>
159 172
             <Input placeholder="请输入" />
160 173
           </FormItem>
161
-          <FormItem label="纳税识别号" name="tax_no" rules={[{ required: true, message: '请输入' }]}>
174
+          <FormItem label="纳税识别号" name="taxNo" rules={[{ required: true, message: '请输入' }]}>
162 175
             <Input placeholder="请输入" />
163 176
           </FormItem>
164 177
           <FormItem label="地址" name="address" rules={[{ required: true, message: '请输入' }]}>
@@ -167,19 +180,22 @@ export default forwardRef((props,ref) => {
167 180
           <FormItem label="电话" name="phone" rules={[{ required: true, message: '请输入' }]}>
168 181
             <Input placeholder="请输入" />
169 182
           </FormItem>
170
-          <FormItem label="开户银行" name="bank_name" rules={[{ required: true, message: '请输入' }]}>
183
+          <FormItem label="开户银行" name="bankName" rules={[{ required: true, message: '请输入' }]}>
184
+            <Input placeholder="请输入" />
185
+          </FormItem>
186
+          <FormItem label="开户行账户" name="cardNo" rules={[{ required: true, message: '请输入' }]}>
171 187
             <Input placeholder="请输入" />
172 188
           </FormItem>
173
-          <FormItem label="开户行账户" name="card_no" rules={[{ required: true, message: '请输入' }]}>
189
+          <FormItem label="项目" name="itemName" rules={[{ required: true, message: '请输入' }]}>
174 190
             <Input placeholder="请输入" />
175 191
           </FormItem>
176 192
           <FormItem label="开票金额" name="charge" rules={[{ required: true, message: '请输入' }]}>
177 193
             <Input placeholder="请输入" />
178 194
           </FormItem>
179
-          <FormItem label="是否合开" name="merge_remark" rules={[{ required: true, message: '请输入' }]}>
195
+          <FormItem label="是否合开" name="mergeRemark" rules={[{ required: true, message: '请输入' }]}>
180 196
             <Input placeholder="请输入" />
181 197
           </FormItem>
182
-          <FormItem label="住宿清单" name="stay_remark" rules={[{ required: true, message: '请输入' }]}>
198
+          <FormItem label="住宿清单" name="stayRemark" rules={[{ required: true, message: '请输入' }]}>
183 199
             <Input placeholder="请输入" />
184 200
           </FormItem>
185 201
           <FormItem label=" " colon={false}>

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

@@ -1,7 +1,7 @@
1 1
 import React, { useState, useRef } from 'react';
2
-import { Form, Input, Popconfirm, Select, Button, Modal, Upload, message } from 'antd';
3
-import { PlusOutlined,DownloadOutlined } from '@ant-design/icons';
4
-import { getInvoicePersonList,getInvoicePersonDetail,saveInvoicePerson,updateInvoicePerson,deleteInvoicePerson } from '@/services/invoicePerson'
2
+import { Form, Input, Popconfirm, Button, Modal, message } from 'antd';
3
+import { PlusOutlined, DownloadOutlined } from '@ant-design/icons';
4
+import { getInvoicePersonList, saveInvoicePerson, deleteInvoicePerson } from '@/services/invoicePerson'
5 5
 import PageTable from '@/components/PageTable';
6 6
 import { UploadExcel } from '@/components/Upload';
7 7
 
@@ -10,62 +10,42 @@ const formItemLayout = { labelCol: { span: 6 }, wrapperCol: { span: 14 } };
10 10
 
11 11
 export default (props) => {
12 12
   const { invoiceId } = props
13
-  const [formModel] = Form.useForm();
13
+  const [form] = Form.useForm();
14 14
   const [editModal, setEditModal] = useState(false);
15 15
   const [modelLoading, setModelLoading] = useState(false);
16
-  const [person,setPerson]=useState()
17 16
   const actionRef = useRef();
18 17
 
19 18
   //弹窗保存
20 19
   const Submit = (val) => {
21 20
     setModelLoading(true);
22
-    if (person) {
23
-      updateInvoicePerson(person.invoicePersonId,{...person,...val,invoiceId:invoiceId}).then((res)=>{
24
-        message.success('修改成功')
25
-        setModelLoading(false)
26
-        actionRef.current.reload()
27
-        onCancel()
28
-      }).catch((err) => {
29
-        setModelLoading(false);
30
-        message.error(err.message || err);
31
-      });
32
-    } else{
33
-      saveInvoicePerson({...val,invoiceId:invoiceId}).then(res=>{
34
-        message.success('添加成功')
35
-        setModelLoading(false)
36
-        actionRef.current.reload()
37
-        onCancel();
38
-      }).catch((err) => {
39
-        setModelLoading(false);
40
-        message.error(err.message || err);
41
-      });
42
-    }
21
+    saveInvoicePerson(val, invoiceId).then(res => {
22
+      message.success('添加成功')
23
+      setModelLoading(false)
24
+      refrash()
25
+      onCancel();
26
+    }).catch((err) => {
27
+      setModelLoading(false);
28
+      message.error(err.message || err);
29
+    });
43 30
   }
44 31
   // 弹窗关闭
45 32
   const onCancel = () => {
46 33
     setEditModal(false);
47
-    setPerson();
34
+    form.resetFields();
48 35
   }
49 36
 
50
-  const showModel = (id) => {
51
-    console.info('------------------',id)
52
-    if (id) {
53
-      getInvoicePersonDetail(id).then((res) => {
54
-        formModel.setFieldsValue(res)
55
-        setPerson(res)
56
-        setEditModal(true);
57
-      }).catch((err) => {
58
-        message.error(err.message || err);
59
-      });
60
-    } else {
61
-      setEditModal(true);
62
-    }
37
+  const showModel = () => {
38
+    setEditModal(true);
39
+  }
40
+  const refrash=()=>{
41
+    console.log(666);
42
+    actionRef.current.reload()
63 43
   }
64 44
   //删除人员
65 45
   const handleDelete = (id) => {
66
-    deleteInvoicePerson(id).then(res=>{
46
+    deleteInvoicePerson(id).then(res => {
67 47
       message.success('删除成功')
68
-      actionRef.current.reload()
48
+      refrash()
69 49
     }).catch((err) => {
70 50
       message.error(err.message || err);
71 51
     });
@@ -74,8 +54,8 @@ export default (props) => {
74 54
     <Button key="dowload" icon={<DownloadOutlined />} >
75 55
       下载模板
76 56
     </Button>,
77
-    <UploadExcel key='upload' />,
78
-    <Button key="add" icon={<PlusOutlined />} onClick={()=>showModel()}>
57
+    <UploadExcel key='upload' id={invoiceId} refrash={refrash}/>,
58
+    <Button key="add" icon={<PlusOutlined />} onClick={showModel}>
79 59
       新增报销人员
80 60
     </Button>,
81 61
   ];
@@ -94,14 +74,6 @@ export default (props) => {
94 74
       title: '操作',
95 75
       valueType: 'option',
96 76
       render: (_, record) => [
97
-        <Button
98
-          style={{ padding: 0 }}
99
-          type="link"
100
-          key={1}
101
-          onClick={() => showModel(record.invoicePersonId)}
102
-        >
103
-          编辑
104
-        </Button>,
105 77
         <Popconfirm
106 78
           key={2}
107 79
           title="您是否确认删除 ?"
@@ -126,11 +98,11 @@ export default (props) => {
126 98
         rowKey="invoicePersonId"
127 99
         options={false}
128 100
         search={false}
129
-        params={{invoiceId}}
101
+        params={{ invoiceId }}
130 102
       />
131 103
       <Modal
132 104
         forceRender
133
-        title={person ? '报销人员编辑' : '报销人员新增'}
105
+        title='报销人员新增'
134 106
         visible={editModal}
135 107
         onCancel={onCancel}
136 108
         keyboard={false}
@@ -138,7 +110,7 @@ export default (props) => {
138 110
         destroyOnClose={true}
139 111
         footer={null}
140 112
       >
141
-        <Form {...formItemLayout} onFinish={Submit} form={formModel}>
113
+        <Form {...formItemLayout} onFinish={Submit} form={form}>
142 114
           <FormItem label="所属公司" name="orgName" rules={[{ required: true, message: '请输入' }]}>
143 115
             <Input placeholder="请输入" />
144 116
           </FormItem>

+ 33
- 3
src/pages/invoiceFill/edit.jsx View File

@@ -3,18 +3,48 @@ import { PageHeaderWrapper } from '@ant-design/pro-layout';
3 3
 import BasicInfo from './components/BasicInfo.jsx';
4 4
 import ReimbursementPerson from './components/ReimbursementPerson';
5 5
 import InvoiceDetail from './components/InvoiceDetail.jsx';
6
-import { Button } from 'antd';
6
+import { Button, message } from 'antd';
7 7
 import { useRef } from 'react';
8
+import { saveInvoiceDetail } from '@/services/invoiceDetail'
9
+import { getInvoicePersonList } from '@/services/invoicePerson'
10
+import { getInvoiceItemTplList } from '@/services/invoiceItemTpl'
8 11
 
9 12
 export default (props) => {
10 13
   const { location } = props;
11 14
   const { id } = location.query;
12 15
   const detailRef = useRef();
13 16
   const addDetail = () => {
14
-    detailRef.current.refrash();
17
+    getInvoiceItemTplList({ invoiceId: id }).then(res => {
18
+      if (res.records.length == 0) {
19
+        message.info('清先添加报销项目信息')
20
+        return
21
+      } else {
22
+        getInvoicePersonList({ invoiceId: id }).then(personRes => {
23
+          if (personRes.records.length == 0) {
24
+            message.info('清先添加报销人员信息')
25
+            return
26
+          } else {
27
+            saveInvoiceDetail(id).then(detail => {
28
+              message.success('生成成功')
29
+              detailRef.current.refrash();
30
+            }).catch(err => {
31
+              message.info(err);
32
+              console.log(err);
33
+            })
34
+          }
35
+        }).catch(err => {
36
+          message.info(err);
37
+          console.log(err);
38
+        })
39
+      }
40
+    }).catch(err => {
41
+      message.info(err);
42
+      console.log(err);
43
+    })
44
+
15 45
   }
16 46
   return (
17
-    <PageHeaderWrapper extra={[id&&<Button key='addDetail' onClick={addDetail}>生成明细</Button>]}>
47
+    <PageHeaderWrapper extra={[id && <Button key='addDetail' type='primary' onClick={addDetail}>生成明细</Button>]}>
18 48
       <ProCard tabs={{ type: 'card' }} style={{ minHeight: '700px' }}>
19 49
         <ProCard.TabPane key={1} tab="基本信息">
20 50
           <BasicInfo invoiceId={id} />

+ 9
- 8
src/services/invoiceDetail.js View File

@@ -1,20 +1,21 @@
1 1
 import request from '@/utils/request';
2 2
 
3 3
 // 获取列表
4
-export const getInvoiceDetailList = (params) => request('/taInvoiceDetail', { params });
4
+export const getInvoiceDetailList = (params) =>
5
+  request(`/invoice/${params.invoiceId}/detail`, { params });
5 6
 
6
-// 获取详情
7
-export const getInvoiceDetailDetail = (id) => request(`/taInvoiceDetail/${id}`);
8
-
9
-// 新增保存
10
-export const saveInvoiceDetail = (data) => request('/taInvoiceDetail', { data, method: 'post' });
7
+// 生成明细
8
+export const saveInvoiceDetail = (invoiceId) =>
9
+  request(`/invoice/${invoiceId}/detail`, { method: 'post' });
11 10
 
12 11
 // 更新信息
13
-export const updateInvoiceDetail = (id, data) => request(`/taInvoiceDetail/${id}`, { data, method: 'put' });
12
+export const updateInvoiceDetail = (id, invoiceId, data) =>
13
+  request(`/invoice/${invoiceId}/detail/${id}`, { data, method: 'put' });
14 14
 
15 15
 /**
16 16
  * 删除报销明细
17 17
  * @param {*} data
18 18
  * @returns
19 19
  */
20
- export const deleteInvoiceDetail = (id) => request(`/taInvoiceDetail/${id}`, { method: 'delete' });
20
+export const deleteInvoiceDetail = (id) =>
21
+  request(`/invoice/detail/${id}`, { method: 'delete' });

+ 8
- 5
src/services/invoiceFill.js View File

@@ -1,20 +1,23 @@
1 1
 import request from '@/utils/request';
2 2
 
3 3
 // 获取列表
4
-export const getInvoiceFillList = (params) => request('/taInvoiceFill', { params });
4
+export const getInvoiceFillList = (params) => request('/invoice', { params });
5 5
 
6 6
 // 获取详情
7
-export const getInvoiceFillDetail = (id) => request(`/taInvoiceFill/${id}`);
7
+export const getInvoiceFillDetail = (id) => request(`/invoice/${id}`);
8 8
 
9 9
 // 新增保存
10
-export const saveInvoiceFill = (data) => request('/taInvoiceFill', { data, method: 'post' });
10
+export const saveInvoiceFill = (data) => request('/invoice', { data, method: 'post' });
11 11
 
12 12
 // 更新信息
13
-export const updateInvoiceFill = (id, data) => request(`/taInvoiceFill/${id}`, { data, method: 'put' });
13
+export const updateInvoiceFill = (id, data) => request(`/invoice/${id}`, { data, method: 'put' });
14 14
 
15 15
 /**
16 16
  * 删除班级
17 17
  * @param {*} data
18 18
  * @returns
19 19
  */
20
- export const deleteInvoiceFill = (id) => request(`/taInvoiceFill/${id}`, { method: 'delete' });
20
+ export const deleteInvoiceFill = (id) => request(`/invoice/${id}`, { method: 'delete' });
21
+
22
+ // 导出
23
+export const getExport = (params) => request(`/invoice/${params.invoiceId}/export`, { params, method: 'post' });

+ 6
- 9
src/services/invoiceItemTpl.js View File

@@ -1,20 +1,17 @@
1 1
 import request from '@/utils/request';
2 2
 
3 3
 // 获取列表
4
-export const getInvoiceItemTplList = (params) => request('/taInvoiceItemTpl', { params });
5
-
6
-// 获取详情
7
-export const getInvoiceItemTplDetail = (id) => request(`/taInvoiceItemTpl/${id}`);
4
+export const getInvoiceItemTplList = (params) =>
5
+  request(`/invoice/${params.invoiceId}/item`, { params });
8 6
 
9 7
 // 新增保存
10
-export const saveInvoiceItemTpl = (data) => request('/taInvoiceItemTpl', { data, method: 'post' });
11
-
12
-// 更新信息
13
-export const updateInvoiceItemTpl = (id, data) => request(`/taInvoiceItemTpl/${id}`, { data, method: 'put' });
8
+export const saveInvoiceItemTpl = (data, invoiceId) =>
9
+  request(`/invoice/${invoiceId}/item`, { data, method: 'post' });
14 10
 
15 11
 /**
16 12
  * 删除报销项目
17 13
  * @param {*} data
18 14
  * @returns
19 15
  */
20
- export const deleteInvoiceItemTpl = (id) => request(`/taInvoiceItemTpl/${id}`, { method: 'delete' });
16
+export const deleteInvoiceItemTpl = (id, invoiceId) =>
17
+  request(`/invoice/${invoiceId}/item/${id}`, { method: 'delete' });

+ 11
- 10
src/services/invoicePerson.js View File

@@ -1,20 +1,21 @@
1 1
 import request from '@/utils/request';
2 2
 
3 3
 // 获取列表
4
-export const getInvoicePersonList = (params) => request('/taInvoicePerson', { params });
5
-
6
-// 获取详情
7
-export const getInvoicePersonDetail = (id) => request(`/taInvoicePerson/${id}`);
4
+export const getInvoicePersonList = (params) =>
5
+  request(`/invoice/${params.invoiceId}/person`, { params });
8 6
 
9 7
 // 新增保存
10
-export const saveInvoicePerson = (data) => request('/taInvoicePerson', { data, method: 'post' });
11
-
12
-// 更新信息
13
-export const updateInvoicePerson = (id, data) => request(`/taInvoicePerson/${id}`, { data, method: 'put' });
8
+export const saveInvoicePerson = (data, invoiceId) =>
9
+  request(`/invoice/${invoiceId}/person`, { data, method: 'post' });
14 10
 
15 11
 /**
16
- * 删除报销项目
12
+ * 删除报销人员
17 13
  * @param {*} data
18 14
  * @returns
19 15
  */
20
- export const deleteInvoicePerson = (id) => request(`/taInvoicePerson/${id}`, { method: 'delete' });
16
+export const deleteInvoicePerson = (id, invoiceId) =>
17
+  request(`/invoice/${invoiceId}/person/${id}`, { method: 'delete' });
18
+
19
+// 批量新增保存
20
+export const saveImportPerson = (data, invoiceId) =>
21
+request(`/invoice/${invoiceId}/person/import`, { data, method: 'post' });

+ 6
- 2
src/utils/request.js View File

@@ -25,11 +25,15 @@ function requestInterceptor(url, options) {
25 25
     : {};
26 26
 
27 27
   const prefix = `${API_BASE}/api/admin`;
28
-
28
+  let requestType='json'
29
+  if (options.data instanceof FormData) {
30
+    requestType='form'
31
+  }
29 32
   return {
30 33
     url: `${prefix}${url}`,
31 34
     options: {
32 35
       ...options,
36
+      requestType,
33 37
       headers: {
34 38
         ...headers,
35 39
         ...token,
@@ -65,7 +69,7 @@ export const requestConfig = {
65 69
         // 可能是 excel 导出
66 70
         return {
67 71
           success: true,
68
-        }
72
+        };
69 73
       }
70 74
 
71 75
       const showError = ctx.req.options?.showType;