Commit 65b3cb5a61b29d47acee4ce6a8f9820e9b92283d
1 parent
4fff2654
feat(product): 新增产品申领功能
- 添加产品申领页面和相关组件 - 实现产品申领的新增、修改和删除功能 - 添加产品申领的审核功能 - 优化产品申领列表的展示和搜索功能
Showing
7 changed files
with
703 additions
and
138 deletions
src/pages/product/procure/components/AddOrUpdate.tsx
1 | -import { postProcureBillAddOrModify } from '@/services'; | |
1 | +import { | |
2 | + postOrderErpTicketsUpload, | |
3 | + postProcureBillAddOrModify, | |
4 | +} from '@/services'; | |
2 | 5 | import { useModel } from '@@/exports'; |
6 | +import { UploadOutlined } from '@ant-design/icons'; | |
3 | 7 | import { |
8 | + ActionType, | |
4 | 9 | EditableProTable, |
5 | 10 | ModalForm, |
6 | 11 | ProCard, |
... | ... | @@ -11,7 +16,7 @@ import { |
11 | 16 | ProFormSwitch, |
12 | 17 | ProFormTextArea, |
13 | 18 | } from '@ant-design/pro-components'; |
14 | -import { Button, Form, message } from 'antd'; | |
19 | +import { Button, Form, Upload, message } from 'antd'; | |
15 | 20 | import React, { useEffect, useRef, useState } from 'react'; |
16 | 21 | |
17 | 22 | export default ({ record, onfinish }) => { |
... | ... | @@ -21,7 +26,7 @@ export default ({ record, onfinish }) => { |
21 | 26 | const formRef = useRef(null); |
22 | 27 | const editorFormRef = useRef(null); |
23 | 28 | const { getProducts } = useModel('enum'); |
24 | - | |
29 | + const actionRef = useRef<ActionType>(); | |
25 | 30 | // 使用 useEffect 为 procureBillDetailList 中的每个元素添加 key |
26 | 31 | useEffect(() => { |
27 | 32 | if (record?.procureBillDetailList) { |
... | ... | @@ -90,14 +95,133 @@ export default ({ record, onfinish }) => { |
90 | 95 | }, |
91 | 96 | { |
92 | 97 | title: '备注', |
93 | - dataIndex: 'created_at', | |
98 | + dataIndex: 'notes', | |
94 | 99 | valueType: 'textarea', |
95 | 100 | }, |
96 | 101 | { |
97 | 102 | title: '附件', |
98 | - dataIndex: 'annex', | |
99 | - render: () => {}, | |
100 | - renderFormItem: () => {}, | |
103 | + dataIndex: 'annexUpload', | |
104 | + renderFormItem: (_, { record }) => ( | |
105 | + <Upload | |
106 | + fileList={ | |
107 | + record.annexList?.map((url) => ({ | |
108 | + uid: url, | |
109 | + name: url.split('/').pop(), | |
110 | + status: 'done', | |
111 | + url, | |
112 | + })) || [] | |
113 | + } | |
114 | + onPreview={(file) => { | |
115 | + window.open(file.url || file.thumbUrl); // 打开文件预览 | |
116 | + }} | |
117 | + customRequest={async (options) => { | |
118 | + const { file, onSuccess, onError } = options; | |
119 | + | |
120 | + const formData = new FormData(); | |
121 | + formData.append('file', file); | |
122 | + | |
123 | + try { | |
124 | + const res = await postOrderErpTicketsUpload({ | |
125 | + data: formData, | |
126 | + headers: { 'Content-Type': 'multipart/form-data' }, | |
127 | + }); | |
128 | + | |
129 | + if (res.message === '成功') { | |
130 | + message.success(`${file.name} 上传成功`); | |
131 | + | |
132 | + // 更新文件列表 | |
133 | + const currentData = formRef.current?.getFieldValue( | |
134 | + 'procureBillDetailList', | |
135 | + ); | |
136 | + const currentRow = currentData.find( | |
137 | + (row) => row.key === record.key, | |
138 | + ); | |
139 | + const existingAnnex = currentRow?.annexList || []; // 取现有的 annex 数据 | |
140 | + | |
141 | + const updatedAnnex = [...existingAnnex, res.data]; // 合并新的文件 URL | |
142 | + | |
143 | + // 更新表单数据 | |
144 | + const updatedData = currentData.map((row) => | |
145 | + row.key === record.key | |
146 | + ? { ...row, annexList: updatedAnnex } | |
147 | + : row, | |
148 | + ); | |
149 | + formRef.current?.setFieldValue( | |
150 | + 'procureBillDetailList', | |
151 | + updatedData, | |
152 | + ); | |
153 | + | |
154 | + onSuccess?.('上传成功'); | |
155 | + } else { | |
156 | + message.error(`${file.name} 上传失败`); | |
157 | + onError?.(new Error('上传失败')); | |
158 | + } | |
159 | + } catch (error) { | |
160 | + message.error(`${file.name} 上传错误`); | |
161 | + onError?.(error); | |
162 | + } | |
163 | + }} | |
164 | + onRemove={(file) => { | |
165 | + const currentData = | |
166 | + formRef.current?.getFieldValue('procureBillDetailList') || []; | |
167 | + const updatedData = currentData.map((row) => { | |
168 | + if (row.key === record.key) { | |
169 | + return { | |
170 | + ...row, | |
171 | + annexList: row.annexList.filter((url) => url !== file.url), // 移除对应文件 URL | |
172 | + }; | |
173 | + } | |
174 | + return row; | |
175 | + }); | |
176 | + | |
177 | + formRef.current?.setFieldsValue({ | |
178 | + procureBillDetailList: updatedData, | |
179 | + }); | |
180 | + | |
181 | + // 触发状态更新 | |
182 | + setProcessedRecord((prevRecord) => ({ | |
183 | + ...prevRecord, | |
184 | + procureBillDetailList: updatedData, | |
185 | + })); | |
186 | + }} | |
187 | + > | |
188 | + <Button icon={<UploadOutlined />}>上传附件</Button> | |
189 | + </Upload> | |
190 | + ), | |
191 | + render: (_, record) => ( | |
192 | + <div> | |
193 | + {record.annexList?.map((url, index) => { | |
194 | + const shortName = | |
195 | + url.split('/').pop()?.slice(0, 15) || `附件 ${index + 1}`; | |
196 | + return ( | |
197 | + <a | |
198 | + key={index} | |
199 | + href={url} | |
200 | + target="_blank" | |
201 | + rel="noopener noreferrer" | |
202 | + title={url} // 悬停显示完整链接 | |
203 | + style={{ | |
204 | + display: 'block', | |
205 | + marginBottom: '4px', | |
206 | + whiteSpace: 'nowrap', | |
207 | + overflow: 'hidden', | |
208 | + textOverflow: 'ellipsis', | |
209 | + maxWidth: '200px', // 限制显示宽度 | |
210 | + }} | |
211 | + > | |
212 | + {shortName.length < url.split('/').pop()?.length | |
213 | + ? `${shortName}...` | |
214 | + : shortName} | |
215 | + </a> | |
216 | + ); | |
217 | + })} | |
218 | + </div> | |
219 | + ), | |
220 | + }, | |
221 | + { | |
222 | + title: '附件', | |
223 | + hideInTable: true, | |
224 | + dataIndex: 'annexList', | |
101 | 225 | }, |
102 | 226 | { |
103 | 227 | title: '操作', |
... | ... | @@ -144,6 +268,7 @@ export default ({ record, onfinish }) => { |
144 | 268 | } |
145 | 269 | form={form} |
146 | 270 | autoFocusFirstInput |
271 | + width={1500} | |
147 | 272 | modalProps={{ |
148 | 273 | destroyOnClose: true, |
149 | 274 | onCancel: () => console.log('run'), |
... | ... | @@ -179,6 +304,7 @@ export default ({ record, onfinish }) => { |
179 | 304 | key: `key-${Math.random().toString(36).substr(2, 9)}`, |
180 | 305 | }), |
181 | 306 | }} |
307 | + actionRef={actionRef} | |
182 | 308 | toolBarRender={() => [ |
183 | 309 | <ProFormSwitch |
184 | 310 | key="render" | ... | ... |
src/pages/product/procure/components/Audit.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { postProcureBillAudit } from '@/services'; | |
3 | +import { ModalForm, ProFormTextArea } from '@ant-design/pro-components'; | |
4 | +import { Button, Form, message } from 'antd'; | |
5 | + | |
6 | +export default ({ recordId, onClose }) => { | |
7 | + const [form] = Form.useForm<{ name: string; company: string }>(); | |
8 | + return ( | |
9 | + <ModalForm | |
10 | + title="审核" | |
11 | + trigger={<Button type="link">审核</Button>} | |
12 | + form={form} | |
13 | + autoFocusFirstInput | |
14 | + modalProps={{ | |
15 | + destroyOnClose: true, | |
16 | + onCancel: () => console.log('run'), | |
17 | + }} | |
18 | + submitTimeout={2000} | |
19 | + submitter={{ | |
20 | + searchConfig: { | |
21 | + submitText: '通过', | |
22 | + resetText: '取消', | |
23 | + }, | |
24 | + render: (props, defaultDoms) => { | |
25 | + return [ | |
26 | + defaultDoms[0], | |
27 | + <Button | |
28 | + type={'primary'} | |
29 | + key="ok" | |
30 | + onClick={async () => { | |
31 | + const res = await postProcureBillAudit({ | |
32 | + data: { | |
33 | + ...form.getFieldsValue(), | |
34 | + id: recordId, | |
35 | + passed: false, | |
36 | + }, | |
37 | + }); | |
38 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
39 | + message.success('提交成功'); | |
40 | + } | |
41 | + props.submit(); | |
42 | + }} | |
43 | + > | |
44 | + 驳回 | |
45 | + </Button>, | |
46 | + <Button | |
47 | + type={'primary'} | |
48 | + key="ok" | |
49 | + onClick={async () => { | |
50 | + const res = await postProcureBillAudit({ | |
51 | + data: { | |
52 | + ...form.getFieldsValue(), | |
53 | + id: recordId, | |
54 | + passed: true, | |
55 | + }, | |
56 | + }); | |
57 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
58 | + message.success('提交成功'); | |
59 | + } | |
60 | + props.submit(); | |
61 | + }} | |
62 | + > | |
63 | + 通过 | |
64 | + </Button>, | |
65 | + ]; | |
66 | + }, | |
67 | + }} | |
68 | + onFinish={async () => { | |
69 | + onClose(); | |
70 | + return true; | |
71 | + }} | |
72 | + > | |
73 | + <ProFormTextArea name="auditRemarks" label="备注" /> | |
74 | + </ModalForm> | |
75 | + ); | |
76 | +}; | ... | ... |
src/pages/product/product/index.tsx
... | ... | @@ -14,7 +14,6 @@ export default () => { |
14 | 14 | title: '编号', |
15 | 15 | dataIndex: 'id', |
16 | 16 | ellipsis: true, |
17 | - hideInSearch: true, | |
18 | 17 | }, |
19 | 18 | { |
20 | 19 | title: '商品名称', |
... | ... | @@ -23,6 +22,12 @@ export default () => { |
23 | 22 | hideInSearch: true, |
24 | 23 | }, |
25 | 24 | { |
25 | + title: '商品名称', | |
26 | + dataIndex: 'nameLike', | |
27 | + ellipsis: true, | |
28 | + hideInTable: true, | |
29 | + }, | |
30 | + { | |
26 | 31 | title: '单位', |
27 | 32 | dataIndex: 'baseUnitName', |
28 | 33 | ellipsis: true, |
... | ... | @@ -40,33 +45,38 @@ export default () => { |
40 | 45 | ellipsis: true, |
41 | 46 | hideInSearch: true, |
42 | 47 | }, |
48 | + | |
43 | 49 | { |
44 | 50 | title: '操作', |
45 | 51 | valueType: 'option', |
46 | 52 | key: 'option', |
47 | 53 | render: (text, record) => [ |
48 | - <AddOrUpdate | |
49 | - key={'addOrUpdate'} | |
50 | - record={record} | |
51 | - onFinish={() => { | |
52 | - actionRef.current?.reload(); | |
53 | - }} | |
54 | - />, | |
55 | - <ButtonConfirm | |
56 | - key="delete" | |
57 | - className="p-0" | |
58 | - title={'确认删除该记录?'} | |
59 | - text="删除" | |
60 | - onConfirm={async () => { | |
61 | - let res = await postProductDelete({ | |
62 | - query: { id: record.id }, | |
63 | - }); | |
64 | - if (res) { | |
65 | - message.success(res.message); | |
54 | + record.paths?.includes('UPDATE') && ( | |
55 | + <AddOrUpdate | |
56 | + key={'addOrUpdate'} | |
57 | + record={record} | |
58 | + onFinish={() => { | |
66 | 59 | actionRef.current?.reload(); |
67 | - } | |
68 | - }} | |
69 | - />, | |
60 | + }} | |
61 | + /> | |
62 | + ), | |
63 | + record.paths?.includes('UPDATE') && ( | |
64 | + <ButtonConfirm | |
65 | + key="delete" | |
66 | + className="p-0" | |
67 | + title={'确认删除该记录?'} | |
68 | + text="删除" | |
69 | + onConfirm={async () => { | |
70 | + let res = await postProductDelete({ | |
71 | + query: { id: record.id }, | |
72 | + }); | |
73 | + if (res) { | |
74 | + message.success(res.message); | |
75 | + actionRef.current?.reload(); | |
76 | + } | |
77 | + }} | |
78 | + /> | |
79 | + ), | |
70 | 80 | ], |
71 | 81 | }, |
72 | 82 | ]; | ... | ... |
src/pages/product/productCollect/index.tsx
1 | 1 | import ButtonConfirm from '@/components/ButtomConfirm'; |
2 | 2 | import { RESPONSE_CODE } from '@/constants/enum'; |
3 | 3 | import AddOrUpdate from '@/pages/product/productCollect/components/AddOrUpdate'; |
4 | -import Audit from '@/pages/product/productCollect/components/Audit'; | |
5 | 4 | import { |
6 | 5 | postProductCollectBillDelete, |
7 | 6 | postProductCollectBillPage, |
8 | 7 | postServiceConstProductCollectBillStatus, |
9 | - postServiceConstStores, | |
10 | 8 | } from '@/services'; |
11 | 9 | import { enumToSelect } from '@/utils'; |
12 | -import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |
13 | -import { ProTable } from '@ant-design/pro-components'; | |
10 | +import { | |
11 | + ProTable, | |
12 | + type ActionType, | |
13 | + type ProColumns, | |
14 | +} from '@ant-design/pro-components'; | |
14 | 15 | import { message } from 'antd'; |
15 | 16 | import { useRef } from 'react'; |
17 | +import Audit from './components/Audit'; | |
16 | 18 | |
17 | 19 | export default () => { |
18 | 20 | const actionRef = useRef<ActionType>(); |
... | ... | @@ -23,20 +25,6 @@ export default () => { |
23 | 25 | width: 48, |
24 | 26 | }, |
25 | 27 | { |
26 | - title: '商品名称', | |
27 | - dataIndex: 'productName', | |
28 | - ellipsis: true, | |
29 | - width: 180, | |
30 | - hideInSearch: true, | |
31 | - }, | |
32 | - { | |
33 | - title: '申领数量', | |
34 | - dataIndex: 'productNumber', | |
35 | - ellipsis: true, | |
36 | - width: 180, | |
37 | - hideInSearch: true, | |
38 | - }, | |
39 | - { | |
40 | 28 | title: '申领人', |
41 | 29 | dataIndex: 'createByName', |
42 | 30 | ellipsis: true, |
... | ... | @@ -51,13 +39,6 @@ export default () => { |
51 | 39 | hideInSearch: true, |
52 | 40 | }, |
53 | 41 | { |
54 | - title: '申领仓库', | |
55 | - dataIndex: 'warehouseText', | |
56 | - ellipsis: true, | |
57 | - width: 180, | |
58 | - hideInSearch: true, | |
59 | - }, | |
60 | - { | |
61 | 42 | title: '审核状态', |
62 | 43 | dataIndex: 'auditStatusText', |
63 | 44 | ellipsis: true, |
... | ... | @@ -82,24 +63,13 @@ export default () => { |
82 | 63 | }, |
83 | 64 | |
84 | 65 | { |
85 | - title: '商品名称', | |
66 | + title: '申领物品', | |
86 | 67 | dataIndex: 'productNameLike', |
68 | + ellipsis: true, | |
69 | + width: 180, | |
87 | 70 | hideInTable: true, |
88 | 71 | }, |
89 | 72 | { |
90 | - title: '申领仓库', | |
91 | - valueType: 'select', | |
92 | - key: 'warehouse', | |
93 | - dataIndex: 'warehouse', | |
94 | - filters: true, | |
95 | - onFilter: true, | |
96 | - hideInTable: true, | |
97 | - request: async () => { | |
98 | - const res = await postServiceConstStores(); | |
99 | - return enumToSelect(res.data); | |
100 | - }, | |
101 | - }, | |
102 | - { | |
103 | 73 | title: '申领人', |
104 | 74 | dataIndex: 'createByNameLike', |
105 | 75 | hideInTable: true, |
... | ... | @@ -129,8 +99,6 @@ export default () => { |
129 | 99 | hideInTable: true, |
130 | 100 | request: async () => { |
131 | 101 | const res = await postServiceConstProductCollectBillStatus(); |
132 | - console.log('auditStaus' + JSON.stringify(res)); | |
133 | - console.log('auditStaus' + JSON.stringify(res.data)); | |
134 | 102 | return enumToSelect(res.data); |
135 | 103 | }, |
136 | 104 | }, |
... | ... | @@ -142,7 +110,7 @@ export default () => { |
142 | 110 | record.paths?.includes('UPDATE') && ( |
143 | 111 | <AddOrUpdate |
144 | 112 | record={record} |
145 | - onFinish={() => { | |
113 | + onfinish={() => { | |
146 | 114 | actionRef.current?.reload(); |
147 | 115 | }} |
148 | 116 | /> |
... | ... | @@ -175,11 +143,11 @@ export default () => { |
175 | 143 | ], |
176 | 144 | }, |
177 | 145 | ]; |
146 | + | |
178 | 147 | return ( |
179 | 148 | <ProTable |
180 | - columns={columns} | |
181 | 149 | actionRef={actionRef} |
182 | - cardBordered | |
150 | + columns={columns} | |
183 | 151 | request={async (params) => { |
184 | 152 | const res = await postProductCollectBillPage({ |
185 | 153 | data: { |
... | ... | @@ -197,54 +165,38 @@ export default () => { |
197 | 165 | success: false, |
198 | 166 | }; |
199 | 167 | }} |
200 | - editable={{ | |
201 | - type: 'multiple', | |
202 | - }} | |
203 | - columnsState={{ | |
204 | - persistenceKey: 'pro-table-singe-demos', | |
205 | - persistenceType: 'localStorage', | |
206 | - defaultValue: { | |
207 | - option: { fixed: 'right', disable: true }, | |
208 | - }, | |
209 | - onChange(value) { | |
210 | - console.log('value: ', value); | |
211 | - }, | |
212 | - }} | |
213 | 168 | rowKey="id" |
214 | - search={{ | |
215 | - labelWidth: 'auto', | |
216 | - }} | |
217 | - options={{ | |
218 | - setting: { | |
219 | - listsHeight: 400, | |
220 | - }, | |
221 | - }} | |
222 | - form={{ | |
223 | - // 由于配置了 transform,提交的参数与定义的不同这里需要转化一下 | |
224 | - syncToUrl: (values, type) => { | |
225 | - if (type === 'get') { | |
226 | - return { | |
227 | - ...values, | |
228 | - created_at: [values.startTime, values.endTime], | |
229 | - }; | |
230 | - } | |
231 | - return values; | |
232 | - }, | |
233 | - }} | |
234 | 169 | pagination={{ |
235 | - pageSize: 5, | |
236 | - onChange: (page) => console.log(page), | |
170 | + showQuickJumper: true, | |
171 | + }} | |
172 | + expandable={{ | |
173 | + expandedRowRender: (record) => ( | |
174 | + <ProTable | |
175 | + columns={[ | |
176 | + { | |
177 | + title: '商品名称', | |
178 | + dataIndex: 'productName', | |
179 | + key: 'productName', | |
180 | + }, | |
181 | + { title: '数量', dataIndex: 'number', key: 'number' }, | |
182 | + { title: '备注', dataIndex: 'notes', key: 'notes' }, | |
183 | + ]} | |
184 | + headerTitle={false} | |
185 | + search={false} | |
186 | + options={false} | |
187 | + dataSource={record.details} | |
188 | + pagination={false} | |
189 | + /> | |
190 | + ), | |
237 | 191 | }} |
238 | 192 | dateFormatter="string" |
239 | - headerTitle="高级表格" | |
240 | - scroll={{ x: 'max-content' }} | |
193 | + headerTitle="采购管理" | |
194 | + options={false} | |
241 | 195 | toolBarRender={() => [ |
242 | 196 | <AddOrUpdate |
243 | - key="AddOrUpdate" | |
244 | - record={null} | |
245 | - onFinish={() => { | |
246 | - actionRef.current?.reload(); | |
247 | - }} | |
197 | + key="add" | |
198 | + record={undefined} | |
199 | + onfinish={() => actionRef.current?.reload()} | |
248 | 200 | />, |
249 | 201 | ]} |
250 | 202 | /> | ... | ... |
src/pages/product/productCollect/indexcopy.tsx
0 → 100644
1 | +import ButtonConfirm from '@/components/ButtomConfirm'; | |
2 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
3 | +import AddOrUpdate from '@/pages/product/productCollect/components/AddOrUpdate'; | |
4 | +import Audit from '@/pages/product/productCollect/components/Audit'; | |
5 | +import { | |
6 | + postProductCollectBillDelete, | |
7 | + postProductCollectBillPage, | |
8 | + postServiceConstProductCollectBillStatus, | |
9 | + postServiceConstStores, | |
10 | +} from '@/services'; | |
11 | +import { enumToSelect } from '@/utils'; | |
12 | +import type { ActionType, ProColumns } from '@ant-design/pro-components'; | |
13 | +import { ProTable } from '@ant-design/pro-components'; | |
14 | +import { message } from 'antd'; | |
15 | +import { useRef } from 'react'; | |
16 | + | |
17 | +export default () => { | |
18 | + const actionRef = useRef<ActionType>(); | |
19 | + const columns: ProColumns[] = [ | |
20 | + { | |
21 | + dataIndex: 'index', | |
22 | + valueType: 'indexBorder', | |
23 | + width: 48, | |
24 | + }, | |
25 | + { | |
26 | + title: '商品名称', | |
27 | + dataIndex: 'productName', | |
28 | + ellipsis: true, | |
29 | + width: 180, | |
30 | + hideInSearch: true, | |
31 | + }, | |
32 | + { | |
33 | + title: '申领数量', | |
34 | + dataIndex: 'productNumber', | |
35 | + ellipsis: true, | |
36 | + width: 180, | |
37 | + hideInSearch: true, | |
38 | + }, | |
39 | + { | |
40 | + title: '申领人', | |
41 | + dataIndex: 'createByName', | |
42 | + ellipsis: true, | |
43 | + width: 180, | |
44 | + hideInSearch: true, | |
45 | + }, | |
46 | + { | |
47 | + title: '申请时间', | |
48 | + dataIndex: 'createTime', | |
49 | + ellipsis: true, | |
50 | + width: 180, | |
51 | + hideInSearch: true, | |
52 | + }, | |
53 | + { | |
54 | + title: '申领仓库', | |
55 | + dataIndex: 'warehouseText', | |
56 | + ellipsis: true, | |
57 | + width: 180, | |
58 | + hideInSearch: true, | |
59 | + }, | |
60 | + { | |
61 | + title: '审核状态', | |
62 | + dataIndex: 'auditStatusText', | |
63 | + ellipsis: true, | |
64 | + width: 180, | |
65 | + hideInSearch: true, | |
66 | + }, | |
67 | + { | |
68 | + title: '申领备注', | |
69 | + dataIndex: 'applyRemarks', | |
70 | + valueType: 'textarea', | |
71 | + ellipsis: true, | |
72 | + width: 180, | |
73 | + hideInSearch: true, | |
74 | + }, | |
75 | + { | |
76 | + title: '审核备注', | |
77 | + dataIndex: 'auditRemarks', | |
78 | + valueType: 'textarea', | |
79 | + ellipsis: true, | |
80 | + width: 180, | |
81 | + hideInSearch: true, | |
82 | + }, | |
83 | + | |
84 | + { | |
85 | + title: '商品名称', | |
86 | + dataIndex: 'productNameLike', | |
87 | + hideInTable: true, | |
88 | + }, | |
89 | + { | |
90 | + title: '申领仓库', | |
91 | + valueType: 'select', | |
92 | + key: 'warehouse', | |
93 | + dataIndex: 'warehouse', | |
94 | + filters: true, | |
95 | + onFilter: true, | |
96 | + hideInTable: true, | |
97 | + request: async () => { | |
98 | + const res = await postServiceConstStores(); | |
99 | + return enumToSelect(res.data); | |
100 | + }, | |
101 | + }, | |
102 | + { | |
103 | + title: '申领人', | |
104 | + dataIndex: 'createByNameLike', | |
105 | + hideInTable: true, | |
106 | + }, | |
107 | + { | |
108 | + title: '申请时间', | |
109 | + valueType: 'dateTimeRange', | |
110 | + hideInTable: true, | |
111 | + search: { | |
112 | + transform: (value) => { | |
113 | + if (value) { | |
114 | + return { | |
115 | + createTimeGe: value[0], | |
116 | + createTimeLe: value[1], | |
117 | + }; | |
118 | + } | |
119 | + }, | |
120 | + }, | |
121 | + }, | |
122 | + { | |
123 | + title: '审核状态', | |
124 | + valueType: 'select', | |
125 | + key: 'auditStatus', | |
126 | + dataIndex: 'auditStatus', | |
127 | + filters: true, | |
128 | + onFilter: true, | |
129 | + hideInTable: true, | |
130 | + request: async () => { | |
131 | + const res = await postServiceConstProductCollectBillStatus(); | |
132 | + return enumToSelect(res.data); | |
133 | + }, | |
134 | + }, | |
135 | + { | |
136 | + title: '操作', | |
137 | + valueType: 'option', | |
138 | + key: 'option', | |
139 | + render: (text, record) => [ | |
140 | + record.paths?.includes('UPDATE') && ( | |
141 | + <AddOrUpdate | |
142 | + record={record} | |
143 | + onFinish={() => { | |
144 | + actionRef.current?.reload(); | |
145 | + }} | |
146 | + /> | |
147 | + ), | |
148 | + record.paths?.includes('UPDATE') && ( | |
149 | + <ButtonConfirm | |
150 | + key="delete" | |
151 | + className="p-0" | |
152 | + title={'确认删除该记录?'} | |
153 | + text="删除" | |
154 | + onConfirm={async () => { | |
155 | + let res = await postProductCollectBillDelete({ | |
156 | + query: { id: record.id }, | |
157 | + }); | |
158 | + if (res) { | |
159 | + message.success(res.message); | |
160 | + actionRef.current?.reload(); | |
161 | + } | |
162 | + }} | |
163 | + /> | |
164 | + ), | |
165 | + record.paths?.includes('AUDIT') && ( | |
166 | + <Audit | |
167 | + recordId={record.id} | |
168 | + onClose={() => { | |
169 | + actionRef.current?.reload(); | |
170 | + }} | |
171 | + /> | |
172 | + ), | |
173 | + ], | |
174 | + }, | |
175 | + ]; | |
176 | + return ( | |
177 | + <ProTable | |
178 | + columns={columns} | |
179 | + actionRef={actionRef} | |
180 | + cardBordered | |
181 | + request={async (params) => { | |
182 | + const res = await postProductCollectBillPage({ | |
183 | + data: { | |
184 | + ...params, | |
185 | + }, | |
186 | + }); | |
187 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
188 | + return { | |
189 | + data: res?.data?.data, | |
190 | + total: res?.data?.total || 0, | |
191 | + }; | |
192 | + } | |
193 | + return { | |
194 | + data: [], | |
195 | + success: false, | |
196 | + }; | |
197 | + }} | |
198 | + editable={{ | |
199 | + type: 'multiple', | |
200 | + }} | |
201 | + columnsState={{ | |
202 | + persistenceKey: 'pro-table-singe-demos', | |
203 | + persistenceType: 'localStorage', | |
204 | + defaultValue: { | |
205 | + option: { fixed: 'right', disable: true }, | |
206 | + }, | |
207 | + onChange(value) { | |
208 | + console.log('value: ', value); | |
209 | + }, | |
210 | + }} | |
211 | + rowKey="id" | |
212 | + search={{ | |
213 | + labelWidth: 'auto', | |
214 | + }} | |
215 | + options={{ | |
216 | + setting: { | |
217 | + listsHeight: 400, | |
218 | + }, | |
219 | + }} | |
220 | + form={{ | |
221 | + // 由于配置了 transform,提交的参数与定义的不同这里需要转化一下 | |
222 | + syncToUrl: (values, type) => { | |
223 | + if (type === 'get') { | |
224 | + return { | |
225 | + ...values, | |
226 | + created_at: [values.startTime, values.endTime], | |
227 | + }; | |
228 | + } | |
229 | + return values; | |
230 | + }, | |
231 | + }} | |
232 | + pagination={{ | |
233 | + pageSize: 5, | |
234 | + onChange: (page) => console.log(page), | |
235 | + }} | |
236 | + dateFormatter="string" | |
237 | + headerTitle="高级表格" | |
238 | + scroll={{ x: 'max-content' }} | |
239 | + toolBarRender={() => [ | |
240 | + <AddOrUpdate | |
241 | + key="AddOrUpdate" | |
242 | + record={null} | |
243 | + onFinish={() => { | |
244 | + actionRef.current?.reload(); | |
245 | + }} | |
246 | + />, | |
247 | + ]} | |
248 | + /> | |
249 | + ); | |
250 | +}; | ... | ... |
src/services/definition.ts
... | ... | @@ -2825,6 +2825,17 @@ export interface OrderZoNingProvinceUserDo { |
2825 | 2825 | zoning?: string; |
2826 | 2826 | } |
2827 | 2827 | |
2828 | +export interface ProcureBillAuditDto { | |
2829 | + /** | |
2830 | + * @description | |
2831 | + * 审核备注 | |
2832 | + */ | |
2833 | + auditRemarks?: string; | |
2834 | + /** @format int64 */ | |
2835 | + id?: number; | |
2836 | + passed?: boolean; | |
2837 | +} | |
2838 | + | |
2828 | 2839 | export interface ProcureConvertProcureDto { |
2829 | 2840 | /** |
2830 | 2841 | * @description |
... | ... | @@ -4894,7 +4905,8 @@ export interface InvoiceReissueRecord { |
4894 | 4905 | } |
4895 | 4906 | |
4896 | 4907 | export interface ProcureBillDetail { |
4897 | - annex?: string; | |
4908 | + annexList?: Array<string>; | |
4909 | + annexs?: string; | |
4898 | 4910 | createByName?: string; |
4899 | 4911 | /** @format date-time */ |
4900 | 4912 | createTime?: string; | ... | ... |
src/services/request.ts
... | ... | @@ -70,7 +70,6 @@ import type { |
70 | 70 | MeasureUnitListRes, |
71 | 71 | MergeIntegralDto, |
72 | 72 | MessageQueryDTO, |
73 | - ModelAndView, | |
74 | 73 | OrderAddVO, |
75 | 74 | OrderAuditLogQueryVO, |
76 | 75 | OrderBaseInfoQueryVO, |
... | ... | @@ -89,6 +88,7 @@ import type { |
89 | 88 | OrderUnlockFieldApplyVO, |
90 | 89 | OrderUpdateVO, |
91 | 90 | OrderZoNingProvinceUserDo, |
91 | + ProcureBillAuditDto, | |
92 | 92 | ProcureBillInfo, |
93 | 93 | ProcureConvertProcureDto, |
94 | 94 | ProcureOrderDto, |
... | ... | @@ -236,6 +236,77 @@ export const postProcureBillAddOrModify = /* #__PURE__ */ (() => { |
236 | 236 | return request; |
237 | 237 | })(); |
238 | 238 | |
239 | +/** @description request parameter type for postProcureBillAudit */ | |
240 | +export interface PostProcureBillAuditOption { | |
241 | + /** | |
242 | + * @description | |
243 | + * dto | |
244 | + */ | |
245 | + body: { | |
246 | + /** | |
247 | + @description | |
248 | + dto */ | |
249 | + dto: ProcureBillAuditDto; | |
250 | + }; | |
251 | +} | |
252 | + | |
253 | +/** @description response type for postProcureBillAudit */ | |
254 | +export interface PostProcureBillAuditResponse { | |
255 | + /** | |
256 | + * @description | |
257 | + * OK | |
258 | + */ | |
259 | + 200: ServerResult; | |
260 | + /** | |
261 | + * @description | |
262 | + * Created | |
263 | + */ | |
264 | + 201: any; | |
265 | + /** | |
266 | + * @description | |
267 | + * Unauthorized | |
268 | + */ | |
269 | + 401: any; | |
270 | + /** | |
271 | + * @description | |
272 | + * Forbidden | |
273 | + */ | |
274 | + 403: any; | |
275 | + /** | |
276 | + * @description | |
277 | + * Not Found | |
278 | + */ | |
279 | + 404: any; | |
280 | +} | |
281 | + | |
282 | +export type PostProcureBillAuditResponseSuccess = | |
283 | + PostProcureBillAuditResponse[200]; | |
284 | +/** | |
285 | + * @description | |
286 | + * 审核 | |
287 | + * @tags 采购管理 | |
288 | + * @produces * | |
289 | + * @consumes application/json | |
290 | + */ | |
291 | +export const postProcureBillAudit = /* #__PURE__ */ (() => { | |
292 | + const method = 'post'; | |
293 | + const url = '/ProcureBill/audit'; | |
294 | + function request( | |
295 | + option: PostProcureBillAuditOption, | |
296 | + ): Promise<PostProcureBillAuditResponseSuccess> { | |
297 | + return requester(request.url, { | |
298 | + method: request.method, | |
299 | + ...option, | |
300 | + }) as unknown as Promise<PostProcureBillAuditResponseSuccess>; | |
301 | + } | |
302 | + | |
303 | + /** http method */ | |
304 | + request.method = method; | |
305 | + /** request url */ | |
306 | + request.url = url; | |
307 | + return request; | |
308 | +})(); | |
309 | + | |
239 | 310 | /** @description request parameter type for postProcureBillDelete */ |
240 | 311 | export interface PostProcureBillDeleteOption { |
241 | 312 | /** |
... | ... | @@ -3757,7 +3828,9 @@ export interface GetErrorResponse { |
3757 | 3828 | * @description |
3758 | 3829 | * OK |
3759 | 3830 | */ |
3760 | - 200: ModelAndView; | |
3831 | + 200: { | |
3832 | + [propertyName: string]: any; | |
3833 | + }; | |
3761 | 3834 | /** |
3762 | 3835 | * @description |
3763 | 3836 | * Unauthorized |
... | ... | @@ -3778,9 +3851,9 @@ export interface GetErrorResponse { |
3778 | 3851 | export type GetErrorResponseSuccess = GetErrorResponse[200]; |
3779 | 3852 | /** |
3780 | 3853 | * @description |
3781 | - * errorHtml | |
3854 | + * error | |
3782 | 3855 | * @tags basic-error-controller |
3783 | - * @produces text/html | |
3856 | + * @produces * | |
3784 | 3857 | */ |
3785 | 3858 | export const getError = /* #__PURE__ */ (() => { |
3786 | 3859 | const method = 'get'; |
... | ... | @@ -3804,7 +3877,9 @@ export interface PutErrorResponse { |
3804 | 3877 | * @description |
3805 | 3878 | * OK |
3806 | 3879 | */ |
3807 | - 200: ModelAndView; | |
3880 | + 200: { | |
3881 | + [propertyName: string]: any; | |
3882 | + }; | |
3808 | 3883 | /** |
3809 | 3884 | * @description |
3810 | 3885 | * Created |
... | ... | @@ -3830,9 +3905,9 @@ export interface PutErrorResponse { |
3830 | 3905 | export type PutErrorResponseSuccess = PutErrorResponse[200]; |
3831 | 3906 | /** |
3832 | 3907 | * @description |
3833 | - * errorHtml | |
3908 | + * error | |
3834 | 3909 | * @tags basic-error-controller |
3835 | - * @produces text/html | |
3910 | + * @produces * | |
3836 | 3911 | * @consumes application/json |
3837 | 3912 | */ |
3838 | 3913 | export const putError = /* #__PURE__ */ (() => { |
... | ... | @@ -3857,7 +3932,9 @@ export interface PostErrorResponse { |
3857 | 3932 | * @description |
3858 | 3933 | * OK |
3859 | 3934 | */ |
3860 | - 200: ModelAndView; | |
3935 | + 200: { | |
3936 | + [propertyName: string]: any; | |
3937 | + }; | |
3861 | 3938 | /** |
3862 | 3939 | * @description |
3863 | 3940 | * Created |
... | ... | @@ -3883,9 +3960,9 @@ export interface PostErrorResponse { |
3883 | 3960 | export type PostErrorResponseSuccess = PostErrorResponse[200]; |
3884 | 3961 | /** |
3885 | 3962 | * @description |
3886 | - * errorHtml | |
3963 | + * error | |
3887 | 3964 | * @tags basic-error-controller |
3888 | - * @produces text/html | |
3965 | + * @produces * | |
3889 | 3966 | * @consumes application/json |
3890 | 3967 | */ |
3891 | 3968 | export const postError = /* #__PURE__ */ (() => { |
... | ... | @@ -3910,7 +3987,9 @@ export interface DeleteErrorResponse { |
3910 | 3987 | * @description |
3911 | 3988 | * OK |
3912 | 3989 | */ |
3913 | - 200: ModelAndView; | |
3990 | + 200: { | |
3991 | + [propertyName: string]: any; | |
3992 | + }; | |
3914 | 3993 | /** |
3915 | 3994 | * @description |
3916 | 3995 | * No Content |
... | ... | @@ -3931,9 +4010,9 @@ export interface DeleteErrorResponse { |
3931 | 4010 | export type DeleteErrorResponseSuccess = DeleteErrorResponse[200]; |
3932 | 4011 | /** |
3933 | 4012 | * @description |
3934 | - * errorHtml | |
4013 | + * error | |
3935 | 4014 | * @tags basic-error-controller |
3936 | - * @produces text/html | |
4015 | + * @produces * | |
3937 | 4016 | */ |
3938 | 4017 | export const deleteError = /* #__PURE__ */ (() => { |
3939 | 4018 | const method = 'delete'; |
... | ... | @@ -3957,7 +4036,9 @@ export interface OptionsErrorResponse { |
3957 | 4036 | * @description |
3958 | 4037 | * OK |
3959 | 4038 | */ |
3960 | - 200: ModelAndView; | |
4039 | + 200: { | |
4040 | + [propertyName: string]: any; | |
4041 | + }; | |
3961 | 4042 | /** |
3962 | 4043 | * @description |
3963 | 4044 | * No Content |
... | ... | @@ -3978,9 +4059,9 @@ export interface OptionsErrorResponse { |
3978 | 4059 | export type OptionsErrorResponseSuccess = OptionsErrorResponse[200]; |
3979 | 4060 | /** |
3980 | 4061 | * @description |
3981 | - * errorHtml | |
4062 | + * error | |
3982 | 4063 | * @tags basic-error-controller |
3983 | - * @produces text/html | |
4064 | + * @produces * | |
3984 | 4065 | * @consumes application/json |
3985 | 4066 | */ |
3986 | 4067 | export const optionsError = /* #__PURE__ */ (() => { |
... | ... | @@ -4005,7 +4086,9 @@ export interface HeadErrorResponse { |
4005 | 4086 | * @description |
4006 | 4087 | * OK |
4007 | 4088 | */ |
4008 | - 200: ModelAndView; | |
4089 | + 200: { | |
4090 | + [propertyName: string]: any; | |
4091 | + }; | |
4009 | 4092 | /** |
4010 | 4093 | * @description |
4011 | 4094 | * No Content |
... | ... | @@ -4026,9 +4109,9 @@ export interface HeadErrorResponse { |
4026 | 4109 | export type HeadErrorResponseSuccess = HeadErrorResponse[200]; |
4027 | 4110 | /** |
4028 | 4111 | * @description |
4029 | - * errorHtml | |
4112 | + * error | |
4030 | 4113 | * @tags basic-error-controller |
4031 | - * @produces text/html | |
4114 | + * @produces * | |
4032 | 4115 | * @consumes application/json |
4033 | 4116 | */ |
4034 | 4117 | export const headError = /* #__PURE__ */ (() => { |
... | ... | @@ -4053,7 +4136,9 @@ export interface PatchErrorResponse { |
4053 | 4136 | * @description |
4054 | 4137 | * OK |
4055 | 4138 | */ |
4056 | - 200: ModelAndView; | |
4139 | + 200: { | |
4140 | + [propertyName: string]: any; | |
4141 | + }; | |
4057 | 4142 | /** |
4058 | 4143 | * @description |
4059 | 4144 | * No Content |
... | ... | @@ -4074,9 +4159,9 @@ export interface PatchErrorResponse { |
4074 | 4159 | export type PatchErrorResponseSuccess = PatchErrorResponse[200]; |
4075 | 4160 | /** |
4076 | 4161 | * @description |
4077 | - * errorHtml | |
4162 | + * error | |
4078 | 4163 | * @tags basic-error-controller |
4079 | - * @produces text/html | |
4164 | + * @produces * | |
4080 | 4165 | * @consumes application/json |
4081 | 4166 | */ |
4082 | 4167 | export const patchError = /* #__PURE__ */ (() => { |
... | ... | @@ -16238,6 +16323,60 @@ export const postServiceConstPlatformType = /* #__PURE__ */ (() => { |
16238 | 16323 | return request; |
16239 | 16324 | })(); |
16240 | 16325 | |
16326 | +/** @description response type for postServiceConstProcureBillAuditStatus */ | |
16327 | +export interface PostServiceConstProcureBillAuditStatusResponse { | |
16328 | + /** | |
16329 | + * @description | |
16330 | + * OK | |
16331 | + */ | |
16332 | + 200: ServerResult; | |
16333 | + /** | |
16334 | + * @description | |
16335 | + * Created | |
16336 | + */ | |
16337 | + 201: any; | |
16338 | + /** | |
16339 | + * @description | |
16340 | + * Unauthorized | |
16341 | + */ | |
16342 | + 401: any; | |
16343 | + /** | |
16344 | + * @description | |
16345 | + * Forbidden | |
16346 | + */ | |
16347 | + 403: any; | |
16348 | + /** | |
16349 | + * @description | |
16350 | + * Not Found | |
16351 | + */ | |
16352 | + 404: any; | |
16353 | +} | |
16354 | + | |
16355 | +export type PostServiceConstProcureBillAuditStatusResponseSuccess = | |
16356 | + PostServiceConstProcureBillAuditStatusResponse[200]; | |
16357 | +/** | |
16358 | + * @description | |
16359 | + * 采购单审核状态 | |
16360 | + * @tags front-const-controller | |
16361 | + * @produces * | |
16362 | + * @consumes application/json | |
16363 | + */ | |
16364 | +export const postServiceConstProcureBillAuditStatus = /* #__PURE__ */ (() => { | |
16365 | + const method = 'post'; | |
16366 | + const url = '/service/const/procureBillAuditStatus'; | |
16367 | + function request(): Promise<PostServiceConstProcureBillAuditStatusResponseSuccess> { | |
16368 | + return requester(request.url, { | |
16369 | + method: request.method, | |
16370 | + }) as unknown as Promise<PostServiceConstProcureBillAuditStatusResponseSuccess>; | |
16371 | + } | |
16372 | + | |
16373 | + /** http method */ | |
16374 | + request.method = method; | |
16375 | + /** request url */ | |
16376 | + request.url = url; | |
16377 | + return request; | |
16378 | +})(); | |
16379 | + | |
16241 | 16380 | /** @description response type for postServiceConstProcureReturnBills */ |
16242 | 16381 | export interface PostServiceConstProcureReturnBillsResponse { |
16243 | 16382 | /** | ... | ... |