Commit 59db6e3113b9708a8464931c8cc34e2d0e073dbf
1 parent
26a8b0f9
feat: update 去除商品在金蝶新建的功能
Showing
3 changed files
with
1275 additions
and
64 deletions
src/pages/Order/components/OrderDrawer copy.tsx
0 → 100644
1 | +import { RESPONSE_CODE } from '@/constants/enum'; | |
2 | +import { | |
3 | + postKingdeeRepCustomer, | |
4 | + postKingdeeRepCustomerDetail, | |
5 | + postKingdeeRepMaterial, | |
6 | + postKingdeeRepMaterialUnit, | |
7 | + postKingdeeRepMeasureUnit, | |
8 | + postServiceOrderAddOrder, | |
9 | + postServiceOrderQuerySalesCode, | |
10 | + postServiceOrderUpdateOrder, | |
11 | +} from '@/services'; | |
12 | +import { | |
13 | + enumToSelect, | |
14 | + getAliYunOSSFileNameFromUrl, | |
15 | + getUserInfo, | |
16 | +} from '@/utils'; | |
17 | +import { getTeacherCustomFieldNumber } from '@/utils/kingdee'; | |
18 | +import { | |
19 | + DrawerForm, | |
20 | + FormListActionType, | |
21 | + ProCard, | |
22 | + ProFormDateTimePicker, | |
23 | + ProFormDigit, | |
24 | + ProFormList, | |
25 | + ProFormSelect, | |
26 | + ProFormText, | |
27 | + ProFormTextArea, | |
28 | + ProFormUploadDragger, | |
29 | +} from '@ant-design/pro-components'; | |
30 | +import { Button, Form, message } from 'antd'; | |
31 | +import { cloneDeep } from 'lodash'; | |
32 | +import { useEffect, useRef, useState } from 'react'; | |
33 | +import { | |
34 | + INVOCING_STATUS_OPTIONS, | |
35 | + INVOCING_STATUS_OPTIONS_OLD, | |
36 | + PAYMENT_CHANNEL_OPTIONS, | |
37 | + PAYMENT_METHOD_OPTIONS, | |
38 | + PRODUCT_BELONG_DEPARTMENT_OPTIONS, | |
39 | +} from '../constant'; | |
40 | +import KingdeeCustomerModal from './KingdeeCustomerModal'; | |
41 | + | |
42 | +export default ({ onClose, data, subOrders, orderOptType }) => { | |
43 | + const [invoicingStatus, setInvoicingStatus] = useState(''); | |
44 | + const [salesCodeOptions, setSalesCodeOptions] = useState([]); | |
45 | + const [customer, setCustomer] = useState({}); | |
46 | + const [kingdeeCstomerModalVisible, setKingdeeCstomerModalVisible] = | |
47 | + useState(false); | |
48 | + const [ | |
49 | + productParametersDisabledFlagList, | |
50 | + setProductParametersDisabledFlagList, | |
51 | + ] = useState([]); | |
52 | + // const [productInvStockOptionsList, setProductInvStockOptionsList] = useState( | |
53 | + // [], | |
54 | + // ); //商品的仓库选项 | |
55 | + const [productUnitOptionsList, setProductUnitOptionsList] = useState([]); //商品的单位选项 | |
56 | + const [productCustomerContactOptions, setProductCustomerContactOptions] = | |
57 | + useState([]); //客户的收货人选项 | |
58 | + const [form] = Form.useForm<{ | |
59 | + salesCode: ''; | |
60 | + customerName: ''; | |
61 | + customerContactNumber: ''; | |
62 | + institution: ''; | |
63 | + institutionContactName: ''; | |
64 | + customerShippingAddress: ''; | |
65 | + totalPayment: ''; | |
66 | + paymentChannel: ''; | |
67 | + paymentMethod: ''; | |
68 | + productBelongBusiness: ''; | |
69 | + invoicingStatus: ''; | |
70 | + invoiceIdentificationNumber: ''; | |
71 | + invoicingTime: ''; | |
72 | + bank: ''; | |
73 | + bankAccountNumber: ''; | |
74 | + deleteSubOrderLists: []; | |
75 | + notes: ''; | |
76 | + list: [ | |
77 | + { | |
78 | + productCode: ''; | |
79 | + productName: ''; | |
80 | + quantity: ''; | |
81 | + productPrice: ''; | |
82 | + parameters: ''; | |
83 | + subOrderPayment: ''; | |
84 | + unit: ''; | |
85 | + serialNumber: ''; | |
86 | + notes: ''; | |
87 | + }, | |
88 | + ]; | |
89 | + }>(); | |
90 | + | |
91 | + let originSubOrders = cloneDeep(subOrders); | |
92 | + /** | |
93 | + * 获取当前的操作类型boolean值 | |
94 | + * @param type 操作类型,如果与当前匹配返回true | |
95 | + */ | |
96 | + function optType(type: string) { | |
97 | + return orderOptType === type; | |
98 | + } | |
99 | + | |
100 | + /** | |
101 | + * | |
102 | + * @returns 获取开票选项 | |
103 | + */ | |
104 | + function getInvoicingSelect() { | |
105 | + if (optType('edit')) { | |
106 | + return enumToSelect(INVOCING_STATUS_OPTIONS_OLD); | |
107 | + } | |
108 | + return enumToSelect(INVOCING_STATUS_OPTIONS); | |
109 | + } | |
110 | + | |
111 | + const fileList: any = []; | |
112 | + | |
113 | + const getSalesCodeOptions = async () => { | |
114 | + const res = await postServiceOrderQuerySalesCode(); | |
115 | + let options = res.data?.map((item) => { | |
116 | + return { | |
117 | + label: item.userName, | |
118 | + value: item.userName, | |
119 | + number: item.number, | |
120 | + }; | |
121 | + }); | |
122 | + setSalesCodeOptions(options); | |
123 | + | |
124 | + if (optType('copy') || optType('edit')) { | |
125 | + let includeFlag = false; | |
126 | + //销售代码校验,如果是旧的销售代码,则提示并清空 | |
127 | + for (let option of options) { | |
128 | + if (option.value === data.salesCode) { | |
129 | + includeFlag = true; | |
130 | + } | |
131 | + } | |
132 | + if (!includeFlag) { | |
133 | + form.resetFields(['salesCode']); | |
134 | + message.warning('检测到销售代码为旧的,已清空,请重新选择'); | |
135 | + } | |
136 | + } | |
137 | + }; | |
138 | + | |
139 | + //复制的时候,如果是不需要开票,要把开票信息清空 | |
140 | + if (optType('copy') && data.invoicingStatus === 'UN_INVOICE') { | |
141 | + data.invoiceIdentificationNumber = undefined; | |
142 | + } | |
143 | + | |
144 | + if (subOrders !== undefined && subOrders.length > 0) { | |
145 | + data.list = subOrders; | |
146 | + } | |
147 | + | |
148 | + const actionRef = useRef< | |
149 | + FormListActionType<{ | |
150 | + name: string; | |
151 | + }> | |
152 | + >(); | |
153 | + | |
154 | + useEffect(() => { | |
155 | + form.setFieldsValue({ ...data }); | |
156 | + //如果是新建,需要清空list | |
157 | + if (optType('add')) { | |
158 | + form.resetFields(['list']); | |
159 | + } | |
160 | + }, [data]); | |
161 | + | |
162 | + /** | |
163 | + * 选择客户后自动为收货人Select添加选项,填充课题组和单位信息 | |
164 | + * @param option 客户选项 | |
165 | + */ | |
166 | + async function autoFillCustomerContactSelectOptions(customerId: any) { | |
167 | + //查询单位详细信息 | |
168 | + let res = await postKingdeeRepCustomerDetail({ | |
169 | + data: { | |
170 | + id: customerId, | |
171 | + }, | |
172 | + }); | |
173 | + | |
174 | + //erp客户名称 | |
175 | + form.setFieldValue('erpCustomerName', res?.name); | |
176 | + | |
177 | + //重新设置当前option | |
178 | + form.setFieldValue('erpCustomerId', { | |
179 | + label: res?.name, | |
180 | + value: res?.id, | |
181 | + id: res?.id, | |
182 | + }); | |
183 | + | |
184 | + //查询客户自定义字段,课题组 | |
185 | + let entity_number = await getTeacherCustomFieldNumber(); | |
186 | + | |
187 | + //在单位详细信息中拿到自定义字段的值 | |
188 | + let customField = res?.custom_field; | |
189 | + if (customField) { | |
190 | + let teacherName = customField[entity_number]; | |
191 | + //填充到课题组老师表单字段中 | |
192 | + form.setFieldValue('institutionContactName', teacherName); | |
193 | + } | |
194 | + | |
195 | + //单位名称,从客户名称中获取,客户名称规则<单位名称>-<联系人名称和电话> | |
196 | + let namePortions = res?.name?.split('-'); | |
197 | + if (namePortions && namePortions.length >= 2) { | |
198 | + form.setFieldValue('institution', namePortions[0]); | |
199 | + } | |
200 | + | |
201 | + //如果原来的收货信息没有包含在这次查询出来的收货人选项中,那么清除原来的收货人信息 | |
202 | + let existFlag = false; | |
203 | + | |
204 | + //填充收货人选项 | |
205 | + let newProductCustomerContactOptions = res?.bomentity?.map((item) => { | |
206 | + let address = | |
207 | + item.contact_person + ',' + item.mobile + ',' + item.contact_address; | |
208 | + if (address === data.contactAddress) { | |
209 | + existFlag = true; | |
210 | + } | |
211 | + return { ...item, label: address, value: address }; | |
212 | + }); | |
213 | + | |
214 | + setProductCustomerContactOptions(newProductCustomerContactOptions); | |
215 | + | |
216 | + if (!existFlag) { | |
217 | + //清空原来的收货人信息 | |
218 | + form.setFieldValue('customerShippingAddress', undefined); | |
219 | + form.setFieldValue('customerContactNumber', undefined); | |
220 | + form.setFieldValue('customerName', undefined); | |
221 | + form.setFieldValue('erpCustomerAddress', undefined); | |
222 | + } | |
223 | + } | |
224 | + | |
225 | + /** | |
226 | + * 回显金蝶信息 | |
227 | + */ | |
228 | + async function showKindeeInfo() { | |
229 | + //客户信息 | |
230 | + if (data.customerId) { | |
231 | + //客户回显 | |
232 | + autoFillCustomerContactSelectOptions(data.customerId); | |
233 | + } | |
234 | + | |
235 | + //商品单位回显 | |
236 | + let list = data?.subOrderInformationLists; | |
237 | + if (list) { | |
238 | + let newProductUnitOptionsList = [...productUnitOptionsList]; | |
239 | + for (let i = 0; i < list.length; i++) { | |
240 | + newProductUnitOptionsList[i] = [ | |
241 | + { label: list[i].unit, value: list[i].unitId }, | |
242 | + ]; | |
243 | + } | |
244 | + setProductUnitOptionsList(newProductUnitOptionsList); | |
245 | + } | |
246 | + } | |
247 | + | |
248 | + /** | |
249 | + * | |
250 | + * @param option 商品名称所对应的商品数据 | |
251 | + * @param currentRowData list中当前行的数据 | |
252 | + */ | |
253 | + async function autoFillProductInfo( | |
254 | + option: any, | |
255 | + currentRowData: any, | |
256 | + index: any, | |
257 | + ) { | |
258 | + let newProductParametersDisabledFlagList = [ | |
259 | + ...productParametersDisabledFlagList, | |
260 | + ]; | |
261 | + let newProductUnitOptionsList = [...productUnitOptionsList]; | |
262 | + newProductUnitOptionsList[index] = []; | |
263 | + | |
264 | + //是新增商品 | |
265 | + if (option.type === 'add') { | |
266 | + //商品参数开放权限可以编辑 | |
267 | + newProductParametersDisabledFlagList[index] = false; | |
268 | + | |
269 | + //清空商品信息 | |
270 | + let copyList = form.getFieldValue('list'); | |
271 | + let currentData = copyList[index]; | |
272 | + currentData.productCode = undefined; | |
273 | + currentData.parameters = undefined; | |
274 | + currentData.unit = undefined; | |
275 | + currentData.subOrderPayment = undefined; | |
276 | + currentData.quantity = undefined; | |
277 | + currentData.notes = undefined; | |
278 | + currentData.productPrice = undefined; | |
279 | + form.setFieldValue('list', copyList); | |
280 | + | |
281 | + //查询计量单价列表 | |
282 | + let res = await postKingdeeRepMeasureUnit({ data: {} }); | |
283 | + if (res && res?.rows) { | |
284 | + for (let row of res?.rows) { | |
285 | + newProductUnitOptionsList[index].push({ | |
286 | + label: row.name, | |
287 | + value: row.id, | |
288 | + }); | |
289 | + } | |
290 | + } | |
291 | + } else { | |
292 | + //选择的是已有的商品,进行内容自动填充 | |
293 | + let copyList = form.getFieldValue('list'); | |
294 | + let currentData = copyList[index]; | |
295 | + currentData.productCode = option?.number; | |
296 | + currentData.parameters = option?.model; | |
297 | + currentData.unit = option?.base_unit_name; | |
298 | + | |
299 | + //商品id | |
300 | + currentData.materialId = option?.id; | |
301 | + | |
302 | + //单位 | |
303 | + currentData.unit = option.base_unit_name; | |
304 | + currentData.unitId = option.base_unit_id; | |
305 | + | |
306 | + form.setFieldValue('list', copyList); | |
307 | + | |
308 | + //商品所在的仓库选项填充 | |
309 | + // let res = await postKingdeeRepMaterialStock({ | |
310 | + // data: { | |
311 | + // material_id: option.id, | |
312 | + // }, | |
313 | + // }); | |
314 | + // let newProductInvStockOptionsList = [...productInvStockOptionsList]; | |
315 | + // newProductInvStockOptionsList[index] = res?.rows?.map((item) => { | |
316 | + // return { label: item.inv_stock, value: item.inv_stock_id }; | |
317 | + // }); | |
318 | + // setProductInvStockOptionsList(newProductInvStockOptionsList); | |
319 | + | |
320 | + //商品单位填充,查询商品单位列表 | |
321 | + let res = await postKingdeeRepMaterialUnit({ | |
322 | + data: { material_id: option.id }, | |
323 | + }); | |
324 | + if (res && res.rows) { | |
325 | + for (let row of res.rows) { | |
326 | + newProductUnitOptionsList[index].push({ | |
327 | + label: row.unit_name, | |
328 | + value: row.unit_id, | |
329 | + }); | |
330 | + } | |
331 | + } | |
332 | + //商品参数不允许编辑 | |
333 | + newProductParametersDisabledFlagList[index] = true; | |
334 | + } | |
335 | + | |
336 | + setProductParametersDisabledFlagList(newProductParametersDisabledFlagList); | |
337 | + setProductUnitOptionsList(newProductUnitOptionsList); | |
338 | + } | |
339 | + | |
340 | + /** | |
341 | + * 选择收货人后自动填充信息 | |
342 | + * @param option 收货人信息 | |
343 | + */ | |
344 | + async function autoFillCustomerInfo(option: any) { | |
345 | + form.setFieldValue('customerShippingAddress', option.contact_address); | |
346 | + form.setFieldValue('customerContactNumber', option.mobile); | |
347 | + form.setFieldValue('customerName', option.contact_person); | |
348 | + | |
349 | + //erp收货地址:需要与客户联系人中的地址一样:姓名,手机号,地址 | |
350 | + form.setFieldValue('contactAddress', option.value); | |
351 | + } | |
352 | + | |
353 | + /** | |
354 | + * 填充销售代表的信息 | |
355 | + * @param option | |
356 | + */ | |
357 | + function autoFillSalesInfo(option: any) { | |
358 | + console.log(option); | |
359 | + //销售代表对应职员编码填充 | |
360 | + form.setFieldValue('empNumber', option.number); | |
361 | + } | |
362 | + | |
363 | + /** | |
364 | + * 选择商品单位后自动填充 | |
365 | + * @param option | |
366 | + * @param index | |
367 | + */ | |
368 | + function autoFillUnit(option: any, index: any) { | |
369 | + let copyList = form.getFieldValue('list'); | |
370 | + let currentData = copyList[index]; | |
371 | + currentData.unit = option?.label; | |
372 | + form.setFieldValue('list', copyList); | |
373 | + } | |
374 | + | |
375 | + /** | |
376 | + * 计算子订单金额 | |
377 | + * @param listMeta 当前商品信息 | |
378 | + */ | |
379 | + function computeSubOrderPayment(listMeta: any) { | |
380 | + let quantity = listMeta?.record?.quantity; | |
381 | + let productPrice = listMeta?.record?.productPrice; | |
382 | + quantity = quantity === '' || quantity === undefined ? 0 : quantity; | |
383 | + productPrice = | |
384 | + productPrice === '' || productPrice === undefined ? 0 : productPrice; | |
385 | + | |
386 | + listMeta.subOrderPayment = quantity * productPrice; | |
387 | + let list = form.getFieldValue('list'); | |
388 | + list[listMeta?.index].subOrderPayment = quantity * productPrice; | |
389 | + form.setFieldValue('list', list); | |
390 | + } | |
391 | + | |
392 | + /** | |
393 | + * 计算支付总额 | |
394 | + */ | |
395 | + function computeTotalPayment() { | |
396 | + let list = form.getFieldValue('list'); | |
397 | + let totalPayment = 0; | |
398 | + list?.forEach((subOrder: any) => { | |
399 | + let subOrderPayment = subOrder?.subOrderPayment; | |
400 | + if (subOrderPayment === '' || subOrderPayment === undefined) { | |
401 | + totalPayment += 0; | |
402 | + } else { | |
403 | + totalPayment += subOrderPayment; | |
404 | + } | |
405 | + }); | |
406 | + form.setFieldValue('totalPayment', totalPayment); | |
407 | + } | |
408 | + | |
409 | + useEffect(() => { | |
410 | + getSalesCodeOptions(); | |
411 | + showKindeeInfo(); | |
412 | + }, []); | |
413 | + | |
414 | + useEffect(() => { | |
415 | + // 在组件挂载或数据变化时,更新组件状态 | |
416 | + if (data) { | |
417 | + setInvoicingStatus(data.invoicingStatus); | |
418 | + } | |
419 | + }, [data]); | |
420 | + | |
421 | + // let mainInfoDisbled = optType('edit'); | |
422 | + if (optType('edit') || optType('copy')) { | |
423 | + //如果是复制,需要开票,不回显是否需要开票字段 | |
424 | + if (optType('copy')) { | |
425 | + if (data.invoicingStatus === 'INVOICED') { | |
426 | + data.invoicingStatus = undefined; | |
427 | + } | |
428 | + } | |
429 | + //订单修改和新增的子订单列表命名是list | |
430 | + data.list = data.subOrderInformationLists; | |
431 | + //主订单事业部默认显示子订单第一条的事业部 | |
432 | + data.productBelongBusiness = data.list[0].productBelongBusiness; | |
433 | + data.paymentMethod = data.list[0].paymentMethod; | |
434 | + data.paymentChannel = data.list[0].paymentChannel; | |
435 | + data.invoicingStatus = data.list[0].invoicingStatus; | |
436 | + | |
437 | + data.list = data.list?.map((item) => { | |
438 | + item.filePaths = item.listAnnex?.map((path) => { | |
439 | + let i = 0; | |
440 | + return { | |
441 | + uid: i++, | |
442 | + name: getAliYunOSSFileNameFromUrl(path), | |
443 | + status: 'uploaded', | |
444 | + url: path, | |
445 | + response: { data: [path] }, | |
446 | + }; | |
447 | + }); | |
448 | + return item; | |
449 | + }); | |
450 | + } | |
451 | + | |
452 | + return ( | |
453 | + <> | |
454 | + <DrawerForm<{ | |
455 | + deleteSubOrderLists: any; | |
456 | + name: string; | |
457 | + company: string; | |
458 | + }> | |
459 | + open | |
460 | + width="35%" | |
461 | + title={optType('add') || optType('copy') ? '新建订单' : '修改订单'} | |
462 | + resize={{ | |
463 | + onResize() { | |
464 | + console.log('resize!'); | |
465 | + }, | |
466 | + maxWidth: window.innerWidth * 0.8, | |
467 | + minWidth: 400, | |
468 | + }} | |
469 | + // layout="horizontal" | |
470 | + // labelCol={{ span: 8 }} | |
471 | + form={form} | |
472 | + autoFocusFirstInput | |
473 | + drawerProps={{ | |
474 | + destroyOnClose: true, | |
475 | + maskClosable: false, | |
476 | + }} | |
477 | + submitTimeout={2000} | |
478 | + onFinish={async (values) => { | |
479 | + let res = {}; | |
480 | + //附件处理 | |
481 | + let list = values.list; | |
482 | + // console.log(list); | |
483 | + list = list.map((item) => { | |
484 | + item.filePaths = item.filePaths?.map((file) => { | |
485 | + console.log(file); | |
486 | + return { url: file.response.data[0] }; | |
487 | + }); | |
488 | + return item; | |
489 | + }); | |
490 | + | |
491 | + values.list = list; | |
492 | + values.institution = values.institution?.trim(); | |
493 | + values.institutionContactName = values.institutionContactName?.trim(); | |
494 | + | |
495 | + if (typeof values.erpCustomerId !== 'string') { | |
496 | + values.erpCustomerId = values.erpCustomerId?.id; | |
497 | + } | |
498 | + | |
499 | + if (optType('add') || optType('copy')) { | |
500 | + res = await postServiceOrderAddOrder({ data: values }); | |
501 | + } else { | |
502 | + //计算已删除的子订单id | |
503 | + const originIds = originSubOrders.map((item) => { | |
504 | + return item.id; | |
505 | + }); | |
506 | + const curIds = form.getFieldValue('list')?.map((item) => { | |
507 | + return item.id; | |
508 | + }); | |
509 | + let diff = originIds.filter((item) => !curIds.includes(item)); | |
510 | + values.deleteSubOrderLists = diff; | |
511 | + res = await postServiceOrderUpdateOrder({ data: values }); | |
512 | + } | |
513 | + | |
514 | + if (res.result === RESPONSE_CODE.SUCCESS) { | |
515 | + message.success(res.message); | |
516 | + // 不返回不会关闭弹框 | |
517 | + onClose(true); | |
518 | + return true; | |
519 | + } | |
520 | + }} | |
521 | + onOpenChange={(val) => { | |
522 | + return !val && onClose(); | |
523 | + }} | |
524 | + > | |
525 | + <h2>订单基本信息</h2> | |
526 | + <ProFormText | |
527 | + key="id" | |
528 | + name="id" | |
529 | + width="lg" | |
530 | + disabled | |
531 | + label="id" | |
532 | + placeholder="id" | |
533 | + hidden | |
534 | + /> | |
535 | + | |
536 | + <ProFormText | |
537 | + key="empNumber" | |
538 | + name="empNumber" | |
539 | + width="lg" | |
540 | + label="销售职员编码" | |
541 | + placeholder="销售职员编码" | |
542 | + hidden | |
543 | + /> | |
544 | + | |
545 | + <ProFormSelect | |
546 | + name="salesCode" | |
547 | + key="salesCode" | |
548 | + width="lg" | |
549 | + showSearch | |
550 | + label="销售代表" | |
551 | + placeholder="请输入销售代表" | |
552 | + rules={[{ required: true, message: '销售代表必填' }]} | |
553 | + options={salesCodeOptions} | |
554 | + onChange={(_, option) => { | |
555 | + autoFillSalesInfo(option); | |
556 | + }} | |
557 | + // disabled={mainInfoDisbled} | |
558 | + /> | |
559 | + <ProFormText | |
560 | + key="erpCustomerName" | |
561 | + name="erpCustomerName" | |
562 | + hidden | |
563 | + ></ProFormText> | |
564 | + | |
565 | + <ProFormText | |
566 | + key="contactAddress" | |
567 | + name="contactAddress" | |
568 | + hidden | |
569 | + ></ProFormText> | |
570 | + | |
571 | + <ProFormSelect | |
572 | + name="erpCustomerId" | |
573 | + key="erpCustomerId" | |
574 | + width="lg" | |
575 | + showSearch | |
576 | + label={ | |
577 | + <> | |
578 | + <span>客户</span> | |
579 | + <span | |
580 | + className="pl-2 text-xs text-[#1677ff] cursor-pointer" | |
581 | + onClick={() => { | |
582 | + let customerId = form.getFieldValue('erpCustomerId'); | |
583 | + if (typeof customerId === 'string') { | |
584 | + setCustomer({ ...customer, id: customerId }); | |
585 | + } else { | |
586 | + setCustomer({ ...customer, id: customerId.id }); | |
587 | + } | |
588 | + setKingdeeCstomerModalVisible(true); | |
589 | + }} | |
590 | + > | |
591 | + 编辑客户信息 | |
592 | + </span> | |
593 | + </> | |
594 | + } | |
595 | + placeholder="请选择客户" | |
596 | + rules={[{ required: true, message: '客户必填' }]} | |
597 | + onChange={(_, option) => { | |
598 | + //新增客户 | |
599 | + if (option.type === 'add') { | |
600 | + setCustomer({ name: option.name }); | |
601 | + setKingdeeCstomerModalVisible(true); | |
602 | + return; | |
603 | + } | |
604 | + autoFillCustomerContactSelectOptions(option.id); | |
605 | + }} | |
606 | + initialValue={{ | |
607 | + label: data?.erpCustomerName, | |
608 | + value: data?.customerId, | |
609 | + id: data?.customerId, | |
610 | + }} | |
611 | + fieldProps={{ | |
612 | + optionItemRender(item) { | |
613 | + if (item.type === 'add') { | |
614 | + return ( | |
615 | + <div title={item.name + '(新增客户)'}> | |
616 | + <span style={{ color: '#333333' }}>{item.name}</span> | |
617 | + {' | '} | |
618 | + <span style={{ color: 'orange' }}>自定义</span> | |
619 | + </div> | |
620 | + ); | |
621 | + } | |
622 | + return ( | |
623 | + <div | |
624 | + title={ | |
625 | + item.name + | |
626 | + ' | ' + | |
627 | + item.customerContactNumber + | |
628 | + ' | ' + | |
629 | + (item.customerShippingAddress === undefined | |
630 | + ? '无地址' | |
631 | + : item.customerShippingAddress) + | |
632 | + ' | ' + | |
633 | + item.institutionContactName + | |
634 | + ' | ' + | |
635 | + item.institution | |
636 | + } | |
637 | + > | |
638 | + <span style={{ color: '#333333' }}>{item.name}</span> | |
639 | + </div> | |
640 | + ); | |
641 | + }, | |
642 | + }} | |
643 | + debounceTime={1000} | |
644 | + request={async (value, {}) => { | |
645 | + const keywords = value.keyWords; | |
646 | + const res = await postKingdeeRepCustomer({ | |
647 | + data: { search: keywords }, | |
648 | + }); | |
649 | + let options = res?.rows?.map((c: any) => { | |
650 | + return { | |
651 | + ...c, | |
652 | + label: c.name, | |
653 | + value: c.id, | |
654 | + key: c.id, | |
655 | + }; | |
656 | + }); | |
657 | + | |
658 | + //第一个商品默认为要新增客户 | |
659 | + if (keywords.trim() !== '') { | |
660 | + options.unshift({ | |
661 | + name: keywords, | |
662 | + type: 'add', | |
663 | + label: keywords, | |
664 | + value: 3.1415926, | |
665 | + key: keywords, | |
666 | + }); | |
667 | + } | |
668 | + return options; | |
669 | + }} | |
670 | + /> | |
671 | + <ProFormSelect | |
672 | + key="customerName" | |
673 | + label="收货人" | |
674 | + width="lg" | |
675 | + showSearch | |
676 | + name="customerName" | |
677 | + placeholder="请选择收货人" | |
678 | + rules={[{ required: true, message: '收货人必填' }]} | |
679 | + onChange={(_, option) => { | |
680 | + autoFillCustomerInfo(option); | |
681 | + }} | |
682 | + initialValue={data.contactAddress} | |
683 | + options={productCustomerContactOptions} | |
684 | + /> | |
685 | + <ProFormText | |
686 | + width="lg" | |
687 | + key="customerContactNumber" | |
688 | + name="customerContactNumber" | |
689 | + label="联系方式" | |
690 | + placeholder="请输入联系方式" | |
691 | + rules={[{ required: true, message: '联系方式必填' }]} | |
692 | + disabled | |
693 | + /> | |
694 | + <ProFormText | |
695 | + width="lg" | |
696 | + key="institution" | |
697 | + name="institution" | |
698 | + label="单位" | |
699 | + placeholder="请输入单位" | |
700 | + rules={[{ required: true, message: '单位必填' }]} | |
701 | + disabled | |
702 | + /> | |
703 | + <ProFormText | |
704 | + width="lg" | |
705 | + key="institutionContactName" | |
706 | + name="institutionContactName" | |
707 | + label="课题组" | |
708 | + placeholder="请输入课题组" | |
709 | + rules={[{ required: true, message: '课题组必填' }]} | |
710 | + disabled | |
711 | + /> | |
712 | + <ProFormTextArea | |
713 | + width="lg" | |
714 | + key="customerShippingAddress" | |
715 | + name="customerShippingAddress" | |
716 | + label="收货地址" | |
717 | + placeholder="请输入收货地址" | |
718 | + rules={[{ required: true, message: '收货地址必填' }]} | |
719 | + disabled | |
720 | + /> | |
721 | + <div id="total-payment"> | |
722 | + <ProFormDigit | |
723 | + name="totalPayment" | |
724 | + width="lg" | |
725 | + key="totalPayment" | |
726 | + label="支付总额(¥)" | |
727 | + rules={[{ required: true, message: '支付总额必填' }]} | |
728 | + tooltip="点击计算,合计所有子订单金额" | |
729 | + fieldProps={{ | |
730 | + addonAfter: ( | |
731 | + <Button | |
732 | + className="rounded-l-none" | |
733 | + type="primary" | |
734 | + onClick={computeTotalPayment} | |
735 | + > | |
736 | + 计算 | |
737 | + </Button> | |
738 | + ), | |
739 | + }} | |
740 | + // disabled={mainInfoDisbled} | |
741 | + /> | |
742 | + </div> | |
743 | + | |
744 | + <ProFormSelect | |
745 | + placeholder="请输入支付渠道" | |
746 | + name="paymentChannel" | |
747 | + width="lg" | |
748 | + key="paymentChannel" | |
749 | + label="支付渠道" | |
750 | + options={enumToSelect(PAYMENT_CHANNEL_OPTIONS)} | |
751 | + rules={[{ required: true, message: '支付渠道必填' }]} | |
752 | + // disabled={mainInfoDisbled} | |
753 | + /> | |
754 | + <ProFormSelect | |
755 | + placeholder="请输入支付方式" | |
756 | + name="paymentMethod" | |
757 | + width="lg" | |
758 | + key="paymentMethod" | |
759 | + label="支付方式" | |
760 | + options={enumToSelect(PAYMENT_METHOD_OPTIONS)} | |
761 | + rules={[{ required: true, message: '支付方式必填' }]} | |
762 | + // disabled={mainInfoDisbled} | |
763 | + /> | |
764 | + <ProFormSelect | |
765 | + placeholder="选择是否需要开票" | |
766 | + name="invoicingStatus" | |
767 | + width="lg" | |
768 | + key="invoicingStatus" | |
769 | + label="是否需要开票" | |
770 | + options={getInvoicingSelect()} | |
771 | + // disabled={mainInfoDisbled} | |
772 | + onChange={(_, option) => { | |
773 | + setInvoicingStatus(option.value); | |
774 | + if (option.value === 'UN_INVOICE') { | |
775 | + form.setFieldValue('invoiceIdentificationNumber', undefined); | |
776 | + form.setFieldValue('bank', undefined); | |
777 | + form.setFieldValue('bankAccountNumber', undefined); | |
778 | + } | |
779 | + }} | |
780 | + rules={[{ required: true, message: '是否需要开票必填' }]} | |
781 | + /> | |
782 | + <ProFormText | |
783 | + width="lg" | |
784 | + name="invoiceIdentificationNumber" | |
785 | + label="开票信息" | |
786 | + key="invoiceIdentificationNumber" | |
787 | + // disabled={mainInfoDisbled} | |
788 | + hidden={invoicingStatus === 'UN_INVOICE'} | |
789 | + placeholder="请输入开票信息" | |
790 | + rules={[ | |
791 | + { | |
792 | + required: invoicingStatus === 'UN_INVOICE' ? false : true, | |
793 | + message: '开票信息必填', | |
794 | + }, | |
795 | + ]} | |
796 | + /> | |
797 | + | |
798 | + {getUserInfo().roleSmallVO?.code === 'admin' ? ( | |
799 | + <ProFormDateTimePicker | |
800 | + width="lg" | |
801 | + key="invoicingTime" | |
802 | + name="invoicingTime" | |
803 | + // disabled={mainInfoDisbled} | |
804 | + hidden={invoicingStatus === 'UN_INVOICE'} | |
805 | + label="开票时间" | |
806 | + placeholder="请输入开票时间" | |
807 | + /> | |
808 | + ) : ( | |
809 | + '' | |
810 | + )} | |
811 | + <ProFormText | |
812 | + width="lg" | |
813 | + name="bank" | |
814 | + key="bank" | |
815 | + label="开户银行" | |
816 | + // disabled={mainInfoDisbled} | |
817 | + hidden={invoicingStatus === 'UN_INVOICE'} | |
818 | + placeholder="请输入开户银行" | |
819 | + /> | |
820 | + <ProFormText | |
821 | + width="lg" | |
822 | + key="bankAccountNumber" | |
823 | + name="bankAccountNumber" | |
824 | + hidden={invoicingStatus === 'UN_INVOICE'} | |
825 | + label="银行账号" | |
826 | + // disabled={mainInfoDisbled} | |
827 | + placeholder="请输入银行账号" | |
828 | + /> | |
829 | + <ProFormTextArea | |
830 | + width="lg" | |
831 | + name="notes" | |
832 | + label="备注" | |
833 | + key="notes" | |
834 | + // disabled={mainInfoDisbled} | |
835 | + placeholder="请输入备注" | |
836 | + rules={[ | |
837 | + { | |
838 | + max: 120, // 最大长度为120个字符 | |
839 | + message: '备注不能超过120个字符', | |
840 | + }, | |
841 | + ]} | |
842 | + /> | |
843 | + | |
844 | + <h2>商品信息</h2> | |
845 | + <ProFormList | |
846 | + creatorButtonProps={{ disabled: false }} | |
847 | + name="list" | |
848 | + label="" | |
849 | + copyIconProps={false} //复制按钮不显示 | |
850 | + initialValue={[ | |
851 | + { | |
852 | + productCode: '', | |
853 | + productName: '', | |
854 | + quantity: '', | |
855 | + productPrice: '', | |
856 | + parameters: '', | |
857 | + subOrderPayment: '', | |
858 | + }, | |
859 | + ]} | |
860 | + actionGuard={{ | |
861 | + beforeRemoveRow: async (index) => { | |
862 | + return new Promise((resolve) => { | |
863 | + if (index === 0) { | |
864 | + message.error('第一行数据不能删除'); | |
865 | + resolve(false); | |
866 | + return; | |
867 | + } | |
868 | + resolve(true); | |
869 | + }); | |
870 | + }, | |
871 | + }} | |
872 | + itemRender={(doms, listMeta) => { | |
873 | + if (optType('edit')) { | |
874 | + let i = 0; | |
875 | + let defaultFileList = listMeta.record?.listAnnex?.map((annex) => { | |
876 | + return { | |
877 | + uid: i++, | |
878 | + name: annex, | |
879 | + status: 'uploaded', | |
880 | + url: annex, | |
881 | + response: { data: [annex] }, | |
882 | + }; | |
883 | + }); | |
884 | + fileList[listMeta.index] = defaultFileList; | |
885 | + } | |
886 | + let itemFileList = fileList[listMeta.index]; | |
887 | + return ( | |
888 | + <ProCard | |
889 | + bordered | |
890 | + extra={doms.action} | |
891 | + title={'商品' + (listMeta.index + 1)} | |
892 | + style={{ | |
893 | + marginBlockEnd: 8, | |
894 | + }} | |
895 | + > | |
896 | + {[ | |
897 | + <ProFormText | |
898 | + key={'material' + listMeta.index} | |
899 | + name="materialId" | |
900 | + hidden | |
901 | + ></ProFormText>, | |
902 | + <ProFormSelect | |
903 | + key="key" | |
904 | + label="商品名称" | |
905 | + width="lg" | |
906 | + showSearch | |
907 | + name="productName" | |
908 | + // options={options} | |
909 | + placeholder="请搜索商品" | |
910 | + rules={[{ required: true, message: '商品名称必填' }]} | |
911 | + onChange={(_, option) => { | |
912 | + autoFillProductInfo(option, listMeta, listMeta.index); | |
913 | + }} | |
914 | + initialValue={{ | |
915 | + label: listMeta?.record?.productName, | |
916 | + value: listMeta?.record?.materialId, | |
917 | + }} | |
918 | + fieldProps={{ | |
919 | + optionItemRender(item) { | |
920 | + if (item.type === 'add') { | |
921 | + return ( | |
922 | + <div title={item.name + '(新增商品信息)'}> | |
923 | + <span style={{ color: '#333333' }}> | |
924 | + {item.label} | |
925 | + </span> | |
926 | + {' | '} | |
927 | + <span style={{ color: 'orange' }}>新增商品</span> | |
928 | + </div> | |
929 | + ); | |
930 | + } | |
931 | + return ( | |
932 | + <div | |
933 | + title={ | |
934 | + item.label + | |
935 | + ' | ' + | |
936 | + (item.model === undefined | |
937 | + ? '无参数' | |
938 | + : item.model) + | |
939 | + ' | ' + | |
940 | + item.base_unit_name | |
941 | + } | |
942 | + > | |
943 | + <span style={{ color: '#333333' }}> | |
944 | + {item.label} | |
945 | + </span> | |
946 | + {' | '} | |
947 | + <span style={{ color: '#339999' }}> | |
948 | + {item.model === undefined ? '无参数' : item.model} | |
949 | + </span> | |
950 | + {' | '} | |
951 | + <span style={{ color: '#666666' }}> | |
952 | + {item.base_unit_name === undefined | |
953 | + ? '无单位' | |
954 | + : item.base_unit_name} | |
955 | + </span> | |
956 | + </div> | |
957 | + ); | |
958 | + }, | |
959 | + }} | |
960 | + debounceTime={1000} | |
961 | + request={async (value) => { | |
962 | + const keywords = value.keyWords; | |
963 | + const res = await postKingdeeRepMaterial({ | |
964 | + data: { search: keywords }, | |
965 | + }); | |
966 | + let options = res?.rows?.map((p: any) => { | |
967 | + return { | |
968 | + ...p, | |
969 | + label: p.name, | |
970 | + value: p.id + '|' + p.name, | |
971 | + key: p.id, | |
972 | + }; | |
973 | + }); | |
974 | + | |
975 | + //第一个商品默认为要新增的商品 | |
976 | + if (keywords.trim() !== '') { | |
977 | + options.unshift({ | |
978 | + productName: keywords, | |
979 | + type: 'add', | |
980 | + label: keywords, | |
981 | + value: 13 + '|' + keywords, | |
982 | + key: keywords, | |
983 | + }); | |
984 | + } | |
985 | + return options; | |
986 | + }} | |
987 | + />, | |
988 | + <ProFormText | |
989 | + key={'productCode' + listMeta.index} | |
990 | + width="lg" | |
991 | + name="productCode" | |
992 | + disabled | |
993 | + label={ | |
994 | + <> | |
995 | + <span>商品编码</span> | |
996 | + <span className="pl-2 text-xs text-gray-400"> | |
997 | + 新增商品时,商品编码由系统自动生成 | |
998 | + </span> | |
999 | + </> | |
1000 | + } | |
1001 | + placeholder="商品编码" | |
1002 | + />, | |
1003 | + // <ProFormSelect | |
1004 | + // key="inv_stock" | |
1005 | + // placeholder="请选择仓库" | |
1006 | + // name="invStockId" | |
1007 | + // width="lg" | |
1008 | + // label="仓库" | |
1009 | + // options={productInvStockOptionsList[listMeta.index]} | |
1010 | + // />, | |
1011 | + <ProFormText | |
1012 | + key={'parameters' + listMeta.index} | |
1013 | + width="lg" | |
1014 | + name="parameters" | |
1015 | + label="商品参数" | |
1016 | + placeholder="请输入商品参数" | |
1017 | + rules={[{ required: true, message: '商品参数必填' }]} | |
1018 | + disabled={ | |
1019 | + productParametersDisabledFlagList[listMeta.index] !== | |
1020 | + false | |
1021 | + } | |
1022 | + />, | |
1023 | + <ProFormDigit | |
1024 | + key={'quantity' + listMeta.index} | |
1025 | + width="lg" | |
1026 | + name="quantity" | |
1027 | + label="商品数量" | |
1028 | + fieldProps={{ | |
1029 | + onChange: (value) => { | |
1030 | + listMeta.record.quantity = value; | |
1031 | + computeSubOrderPayment(listMeta); | |
1032 | + }, | |
1033 | + }} | |
1034 | + placeholder="请输入商品数量" | |
1035 | + rules={[{ required: true, message: '商品数量必填' }]} | |
1036 | + />, | |
1037 | + | |
1038 | + <ProFormDigit | |
1039 | + key={'productPrice' + listMeta.index} | |
1040 | + width="lg" | |
1041 | + name="productPrice" | |
1042 | + label="商品单价" | |
1043 | + fieldProps={{ | |
1044 | + onChange: (value) => { | |
1045 | + listMeta.record.productPrice = value; | |
1046 | + computeSubOrderPayment(listMeta); | |
1047 | + }, | |
1048 | + }} | |
1049 | + placeholder="请输入商品单价" | |
1050 | + rules={[{ required: true, message: '商品单价必填' }]} | |
1051 | + />, | |
1052 | + | |
1053 | + <ProFormSelect | |
1054 | + key="unitId" | |
1055 | + placeholder="请选择单位" | |
1056 | + name="unitId" | |
1057 | + width="lg" | |
1058 | + label="单位" | |
1059 | + showSearch | |
1060 | + onChange={(_, option) => { | |
1061 | + autoFillUnit(option, listMeta.index); | |
1062 | + }} | |
1063 | + options={productUnitOptionsList[listMeta.index]} | |
1064 | + rules={[{ required: true, message: '商品单位必填' }]} | |
1065 | + />, | |
1066 | + <ProFormText | |
1067 | + key={'unit' + listMeta.index} | |
1068 | + width="lg" | |
1069 | + name="unit" | |
1070 | + label="商品单位" | |
1071 | + placeholder="请输入商品单位" | |
1072 | + rules={[{ required: true, message: '商品单位必填' }]} | |
1073 | + hidden | |
1074 | + />, | |
1075 | + | |
1076 | + <ProFormDigit | |
1077 | + width="lg" | |
1078 | + key={'subOrderPayment' + listMeta.index} | |
1079 | + name="subOrderPayment" | |
1080 | + label="子订单金额" | |
1081 | + placeholder="请输入子订单金额" | |
1082 | + tooltip="商品数量和单价变化后会自动计算子订单金额" | |
1083 | + rules={[{ required: true, message: '子订单金额必填' }]} | |
1084 | + />, | |
1085 | + <ProFormSelect | |
1086 | + key={'productBelongBusiness' + listMeta.index} | |
1087 | + placeholder="请输入所属事业部" | |
1088 | + name="productBelongBusiness" | |
1089 | + width="lg" | |
1090 | + label="所属事业部" | |
1091 | + options={enumToSelect(PRODUCT_BELONG_DEPARTMENT_OPTIONS)} | |
1092 | + initialValue={'EXPERIMENTAL_CONSUMABLES'} | |
1093 | + rules={[{ required: true, message: '所属事业部必填' }]} | |
1094 | + // disabled={mainInfoDisbled} | |
1095 | + />, | |
1096 | + <ProFormTextArea | |
1097 | + key={'notes' + listMeta.index} | |
1098 | + width="lg" | |
1099 | + name="notes" | |
1100 | + label={ | |
1101 | + <div> | |
1102 | + <span>备注</span> | |
1103 | + <span className="pl-2 text-xs text-gray-400"> | |
1104 | + 备注将体现在出货单上,请将需要仓管看见的信息写在备注上,例如需要开收据等信息。 | |
1105 | + </span> | |
1106 | + </div> | |
1107 | + } | |
1108 | + placeholder="请输入备注" | |
1109 | + rules={[ | |
1110 | + { | |
1111 | + max: 120, // 最大长度为120个字符 | |
1112 | + message: '备注不能超过120个字符', | |
1113 | + }, | |
1114 | + ]} | |
1115 | + />, | |
1116 | + <> | |
1117 | + <ProFormUploadDragger | |
1118 | + key={'filePaths' + listMeta.index} | |
1119 | + label="附件" | |
1120 | + name="filePaths" | |
1121 | + action="/api/service/order/fileProcess" | |
1122 | + fieldProps={{ | |
1123 | + headers: { | |
1124 | + Authorization: localStorage.getItem('token'), | |
1125 | + }, | |
1126 | + itemFileList, | |
1127 | + }} | |
1128 | + /> | |
1129 | + </>, | |
1130 | + ]} | |
1131 | + </ProCard> | |
1132 | + ); | |
1133 | + }} | |
1134 | + actionRef={actionRef} | |
1135 | + ></ProFormList> | |
1136 | + </DrawerForm> | |
1137 | + | |
1138 | + {kingdeeCstomerModalVisible && ( | |
1139 | + <KingdeeCustomerModal | |
1140 | + setVisible={setKingdeeCstomerModalVisible} | |
1141 | + data={customer} | |
1142 | + onClose={(customerId: any) => { | |
1143 | + setKingdeeCstomerModalVisible(false); | |
1144 | + //回显已经新建好的客户 | |
1145 | + autoFillCustomerContactSelectOptions(customerId); | |
1146 | + }} | |
1147 | + /> | |
1148 | + )} | |
1149 | + </> | |
1150 | + ); | |
1151 | +}; | ... | ... |
src/pages/Order/components/OrderDrawer.tsx
... | ... | @@ -278,14 +278,16 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
278 | 278 | currentData.productPrice = undefined; |
279 | 279 | form.setFieldValue('list', copyList); |
280 | 280 | |
281 | - //查询计量单价列表 | |
282 | - let res = await postKingdeeRepMeasureUnit({ data: {} }); | |
283 | - if (res && res?.rows) { | |
284 | - for (let row of res?.rows) { | |
285 | - newProductUnitOptionsList[index].push({ | |
286 | - label: row.name, | |
287 | - value: row.id, | |
288 | - }); | |
281 | + //todo 查询计量单价列表 | |
282 | + if (false) { | |
283 | + let res = await postKingdeeRepMeasureUnit({ data: {} }); | |
284 | + if (res && res?.rows) { | |
285 | + for (let row of res?.rows) { | |
286 | + newProductUnitOptionsList[index].push({ | |
287 | + label: row.name, | |
288 | + value: row.id, | |
289 | + }); | |
290 | + } | |
289 | 291 | } |
290 | 292 | } |
291 | 293 | } else { |
... | ... | @@ -361,16 +363,16 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
361 | 363 | } |
362 | 364 | |
363 | 365 | /** |
364 | - * 选择商品单位后自动填充 | |
366 | + * todo 选择商品单位后自动填充 | |
365 | 367 | * @param option |
366 | 368 | * @param index |
367 | 369 | */ |
368 | - function autoFillUnit(option: any, index: any) { | |
369 | - let copyList = form.getFieldValue('list'); | |
370 | - let currentData = copyList[index]; | |
371 | - currentData.unit = option?.label; | |
372 | - form.setFieldValue('list', copyList); | |
373 | - } | |
370 | + // function autoFillUnit(option: any, index: any) { | |
371 | + // let copyList = form.getFieldValue('list'); | |
372 | + // let currentData = copyList[index]; | |
373 | + // currentData.unit = option?.label; | |
374 | + // form.setFieldValue('list', copyList); | |
375 | + // } | |
374 | 376 | |
375 | 377 | /** |
376 | 378 | * 计算子订单金额 |
... | ... | @@ -1050,27 +1052,29 @@ export default ({ onClose, data, subOrders, orderOptType }) => { |
1050 | 1052 | rules={[{ required: true, message: '商品单价必填' }]} |
1051 | 1053 | />, |
1052 | 1054 | |
1053 | - <ProFormSelect | |
1054 | - key="unitId" | |
1055 | - placeholder="请选择单位" | |
1056 | - name="unitId" | |
1057 | - width="lg" | |
1058 | - label="单位" | |
1059 | - showSearch | |
1060 | - onChange={(_, option) => { | |
1061 | - autoFillUnit(option, listMeta.index); | |
1062 | - }} | |
1063 | - options={productUnitOptionsList[listMeta.index]} | |
1064 | - rules={[{ required: true, message: '商品单位必填' }]} | |
1065 | - />, | |
1055 | + //todo 金蝶商品计量单位 | |
1056 | + // <ProFormSelect | |
1057 | + // key="unitId" | |
1058 | + // placeholder="请选择单位" | |
1059 | + // name="unitId" | |
1060 | + // width="lg" | |
1061 | + // label="单位" | |
1062 | + // showSearch | |
1063 | + // onChange={(_, option) => { | |
1064 | + // autoFillUnit(option, listMeta.index); | |
1065 | + // }} | |
1066 | + // options={productUnitOptionsList[listMeta.index]} | |
1067 | + // rules={[{ required: true, message: '商品单位必填' }]} | |
1068 | + // />, | |
1069 | + | |
1066 | 1070 | <ProFormText |
1067 | 1071 | key={'unit' + listMeta.index} |
1068 | 1072 | width="lg" |
1069 | 1073 | name="unit" |
1070 | 1074 | label="商品单位" |
1071 | 1075 | placeholder="请输入商品单位" |
1076 | + disabled={optType('after-sales-check')} | |
1072 | 1077 | rules={[{ required: true, message: '商品单位必填' }]} |
1073 | - hidden | |
1074 | 1078 | />, |
1075 | 1079 | |
1076 | 1080 | <ProFormDigit | ... | ... |
src/services/request.ts
... | ... | @@ -38,6 +38,7 @@ import type { |
38 | 38 | MaterialStockRes, |
39 | 39 | MaterialUnitListRes, |
40 | 40 | MeasureUnitListRes, |
41 | + ModelAndView, | |
41 | 42 | OrderAddVO, |
42 | 43 | OrderAuditLogQueryVO, |
43 | 44 | OrderBaseInfoQueryVO, |
... | ... | @@ -246,9 +247,7 @@ export interface GetErrorResponse { |
246 | 247 | * @description |
247 | 248 | * OK |
248 | 249 | */ |
249 | - 200: { | |
250 | - [propertyName: string]: any; | |
251 | - }; | |
250 | + 200: ModelAndView; | |
252 | 251 | /** |
253 | 252 | * @description |
254 | 253 | * Unauthorized |
... | ... | @@ -269,9 +268,9 @@ export interface GetErrorResponse { |
269 | 268 | export type GetErrorResponseSuccess = GetErrorResponse[200]; |
270 | 269 | /** |
271 | 270 | * @description |
272 | - * error | |
271 | + * errorHtml | |
273 | 272 | * @tags basic-error-controller |
274 | - * @produces * | |
273 | + * @produces text/html | |
275 | 274 | */ |
276 | 275 | export const getError = /* #__PURE__ */ (() => { |
277 | 276 | const method = 'get'; |
... | ... | @@ -295,9 +294,7 @@ export interface PutErrorResponse { |
295 | 294 | * @description |
296 | 295 | * OK |
297 | 296 | */ |
298 | - 200: { | |
299 | - [propertyName: string]: any; | |
300 | - }; | |
297 | + 200: ModelAndView; | |
301 | 298 | /** |
302 | 299 | * @description |
303 | 300 | * Created |
... | ... | @@ -323,9 +320,9 @@ export interface PutErrorResponse { |
323 | 320 | export type PutErrorResponseSuccess = PutErrorResponse[200]; |
324 | 321 | /** |
325 | 322 | * @description |
326 | - * error | |
323 | + * errorHtml | |
327 | 324 | * @tags basic-error-controller |
328 | - * @produces * | |
325 | + * @produces text/html | |
329 | 326 | * @consumes application/json |
330 | 327 | */ |
331 | 328 | export const putError = /* #__PURE__ */ (() => { |
... | ... | @@ -350,9 +347,7 @@ export interface PostErrorResponse { |
350 | 347 | * @description |
351 | 348 | * OK |
352 | 349 | */ |
353 | - 200: { | |
354 | - [propertyName: string]: any; | |
355 | - }; | |
350 | + 200: ModelAndView; | |
356 | 351 | /** |
357 | 352 | * @description |
358 | 353 | * Created |
... | ... | @@ -378,9 +373,9 @@ export interface PostErrorResponse { |
378 | 373 | export type PostErrorResponseSuccess = PostErrorResponse[200]; |
379 | 374 | /** |
380 | 375 | * @description |
381 | - * error | |
376 | + * errorHtml | |
382 | 377 | * @tags basic-error-controller |
383 | - * @produces * | |
378 | + * @produces text/html | |
384 | 379 | * @consumes application/json |
385 | 380 | */ |
386 | 381 | export const postError = /* #__PURE__ */ (() => { |
... | ... | @@ -405,9 +400,7 @@ export interface DeleteErrorResponse { |
405 | 400 | * @description |
406 | 401 | * OK |
407 | 402 | */ |
408 | - 200: { | |
409 | - [propertyName: string]: any; | |
410 | - }; | |
403 | + 200: ModelAndView; | |
411 | 404 | /** |
412 | 405 | * @description |
413 | 406 | * No Content |
... | ... | @@ -428,9 +421,9 @@ export interface DeleteErrorResponse { |
428 | 421 | export type DeleteErrorResponseSuccess = DeleteErrorResponse[200]; |
429 | 422 | /** |
430 | 423 | * @description |
431 | - * error | |
424 | + * errorHtml | |
432 | 425 | * @tags basic-error-controller |
433 | - * @produces * | |
426 | + * @produces text/html | |
434 | 427 | */ |
435 | 428 | export const deleteError = /* #__PURE__ */ (() => { |
436 | 429 | const method = 'delete'; |
... | ... | @@ -454,9 +447,7 @@ export interface OptionsErrorResponse { |
454 | 447 | * @description |
455 | 448 | * OK |
456 | 449 | */ |
457 | - 200: { | |
458 | - [propertyName: string]: any; | |
459 | - }; | |
450 | + 200: ModelAndView; | |
460 | 451 | /** |
461 | 452 | * @description |
462 | 453 | * No Content |
... | ... | @@ -477,9 +468,9 @@ export interface OptionsErrorResponse { |
477 | 468 | export type OptionsErrorResponseSuccess = OptionsErrorResponse[200]; |
478 | 469 | /** |
479 | 470 | * @description |
480 | - * error | |
471 | + * errorHtml | |
481 | 472 | * @tags basic-error-controller |
482 | - * @produces * | |
473 | + * @produces text/html | |
483 | 474 | * @consumes application/json |
484 | 475 | */ |
485 | 476 | export const optionsError = /* #__PURE__ */ (() => { |
... | ... | @@ -504,9 +495,7 @@ export interface HeadErrorResponse { |
504 | 495 | * @description |
505 | 496 | * OK |
506 | 497 | */ |
507 | - 200: { | |
508 | - [propertyName: string]: any; | |
509 | - }; | |
498 | + 200: ModelAndView; | |
510 | 499 | /** |
511 | 500 | * @description |
512 | 501 | * No Content |
... | ... | @@ -527,9 +516,9 @@ export interface HeadErrorResponse { |
527 | 516 | export type HeadErrorResponseSuccess = HeadErrorResponse[200]; |
528 | 517 | /** |
529 | 518 | * @description |
530 | - * error | |
519 | + * errorHtml | |
531 | 520 | * @tags basic-error-controller |
532 | - * @produces * | |
521 | + * @produces text/html | |
533 | 522 | * @consumes application/json |
534 | 523 | */ |
535 | 524 | export const headError = /* #__PURE__ */ (() => { |
... | ... | @@ -554,9 +543,7 @@ export interface PatchErrorResponse { |
554 | 543 | * @description |
555 | 544 | * OK |
556 | 545 | */ |
557 | - 200: { | |
558 | - [propertyName: string]: any; | |
559 | - }; | |
546 | + 200: ModelAndView; | |
560 | 547 | /** |
561 | 548 | * @description |
562 | 549 | * No Content |
... | ... | @@ -577,9 +564,9 @@ export interface PatchErrorResponse { |
577 | 564 | export type PatchErrorResponseSuccess = PatchErrorResponse[200]; |
578 | 565 | /** |
579 | 566 | * @description |
580 | - * error | |
567 | + * errorHtml | |
581 | 568 | * @tags basic-error-controller |
582 | - * @produces * | |
569 | + * @produces text/html | |
583 | 570 | * @consumes application/json |
584 | 571 | */ |
585 | 572 | export const patchError = /* #__PURE__ */ (() => { |
... | ... | @@ -9103,3 +9090,72 @@ export const postServiceOrderViewImages = /* #__PURE__ */ (() => { |
9103 | 9090 | request.url = url; |
9104 | 9091 | return request; |
9105 | 9092 | })(); |
9093 | + | |
9094 | +/** @description request parameter type for getServiceToggles */ | |
9095 | +export interface GetServiceTogglesOption { | |
9096 | + /** @format date-time */ | |
9097 | + query?: { | |
9098 | + /** | |
9099 | + @format date-time */ | |
9100 | + createdAt?: string; | |
9101 | + description?: string; | |
9102 | + featureName?: string; | |
9103 | + /** | |
9104 | + @format int32 */ | |
9105 | + id?: number; | |
9106 | + isEnabled?: boolean; | |
9107 | + /** | |
9108 | + @format date-time */ | |
9109 | + updatedAt?: string; | |
9110 | + }; | |
9111 | +} | |
9112 | + | |
9113 | +/** @description response type for getServiceToggles */ | |
9114 | +export interface GetServiceTogglesResponse { | |
9115 | + /** | |
9116 | + * @description | |
9117 | + * OK | |
9118 | + */ | |
9119 | + 200: ServerResult; | |
9120 | + /** | |
9121 | + * @description | |
9122 | + * Unauthorized | |
9123 | + */ | |
9124 | + 401: any; | |
9125 | + /** | |
9126 | + * @description | |
9127 | + * Forbidden | |
9128 | + */ | |
9129 | + 403: any; | |
9130 | + /** | |
9131 | + * @description | |
9132 | + * Not Found | |
9133 | + */ | |
9134 | + 404: any; | |
9135 | +} | |
9136 | + | |
9137 | +export type GetServiceTogglesResponseSuccess = GetServiceTogglesResponse[200]; | |
9138 | +/** | |
9139 | + * @description | |
9140 | + * getEnabledFlag | |
9141 | + * @tags feature-toggles-controller | |
9142 | + * @produces * | |
9143 | + */ | |
9144 | +export const getServiceToggles = /* #__PURE__ */ (() => { | |
9145 | + const method = 'get'; | |
9146 | + const url = '/service/toggles'; | |
9147 | + function request( | |
9148 | + option?: GetServiceTogglesOption, | |
9149 | + ): Promise<GetServiceTogglesResponseSuccess> { | |
9150 | + return requester(request.url, { | |
9151 | + method: request.method, | |
9152 | + ...option, | |
9153 | + }) as unknown as Promise<GetServiceTogglesResponseSuccess>; | |
9154 | + } | |
9155 | + | |
9156 | + /** http method */ | |
9157 | + request.method = method; | |
9158 | + /** request url */ | |
9159 | + request.url = url; | |
9160 | + return request; | |
9161 | +})(); | ... | ... |