Commit 011692f7c6b056f1612b1a1d94ca619bbef390cb
Merge remote-tracking branch 'origin/bug_fix' into cas
# Conflicts: # src/pages/pms/storage/partShop/interface.d.ts
Showing
11 changed files
with
116 additions
and
82 deletions
src/pages/pms/part/Repertory/api.ts
src/pages/pms/part/Repertory/components/AddepcModal.tsx
1 | 1 | import React, { useState, useEffect } from 'react'; |
2 | -import { Modal, Form, Input, message, InputNumber, Select } from 'antd'; | |
2 | +import { Modal, Form, Input, message, InputNumber, Select, Spin } from 'antd'; | |
3 | 3 | import { useStore } from '../index'; |
4 | 4 | import { saveEpcApi } from '../api'; |
5 | 5 | import debounce from 'lodash/debounce'; |
... | ... | @@ -18,24 +18,24 @@ interface Props { |
18 | 18 | export default function AddepcModal(props: Props) { |
19 | 19 | const { visible, onCancel, onFreshing } = props; |
20 | 20 | const [form] = Form.useForm(); |
21 | - const { currentItem, tabType, currentInfo, list, setParams } = useStore(); | |
21 | + const { currentItem, tabType, currentInfo, list, setParams, loading: partLoading } = useStore(); | |
22 | 22 | const [loading, setLoading] = useState(false); |
23 | 23 | const [pagesize, setPagsize] = useState<number>(10); |
24 | - | |
24 | + const [partCode, setPartCode] = useState<string>(); | |
25 | + | |
25 | 26 | useEffect(() => { |
26 | 27 | if (!visible) { |
27 | - form.setFieldsValue({ | |
28 | - specCode: '', | |
29 | - partCode: '', | |
30 | - partCount: '', | |
31 | - }); | |
28 | + form.resetFields(); | |
32 | 29 | } else { |
33 | 30 | form.setFieldsValue({ |
34 | 31 | ...currentInfo, |
35 | - defaultValue: currentInfo.partCode | |
32 | + partCode: currentInfo.partCode, | |
36 | 33 | }); |
34 | + setParams({keywords: currentInfo.partCode || undefined}, true); | |
35 | + setPartCode(currentInfo.partCode); | |
37 | 36 | } |
38 | 37 | }, [visible]); |
38 | + | |
39 | 39 | // 配件下拉列表滚动加载更多数据 |
40 | 40 | const handlePopupScroll = debounce(() => { |
41 | 41 | setPagsize(pagesize+10); |
... | ... | @@ -48,9 +48,11 @@ export default function AddepcModal(props: Props) { |
48 | 48 | id: currentInfo.id, |
49 | 49 | seriesId: currentItem.seriesId, |
50 | 50 | modelId: currentItem.specId || currentItem.id, |
51 | - specCode: currentItem.specCode, | |
52 | - brandId: currentItem.brandId | |
51 | + specCode: currentItem.specCode || fields.specCode, | |
52 | + brandId: currentItem.brandId, | |
53 | + partCode: fields.partCode || currentItem.partCode | |
53 | 54 | }; |
55 | + | |
54 | 56 | setLoading(true); |
55 | 57 | saveEpcApi(params).then(() => { |
56 | 58 | message.success('保存成功'); |
... | ... | @@ -64,52 +66,62 @@ export default function AddepcModal(props: Props) { |
64 | 66 | } |
65 | 67 | return ( |
66 | 68 | <Modal |
67 | - title={tabType == 1 ? '车型代码' : '配件代码'} | |
69 | + title={tabType == 1 ? '新增车型' : '新增配件'} | |
68 | 70 | visible={visible} |
69 | 71 | onOk={form.submit} |
70 | 72 | onCancel={onCancel} |
71 | 73 | confirmLoading={loading} |
74 | + maskClosable={false} | |
72 | 75 | > |
73 | - <Form | |
74 | - form={form} | |
75 | - onFinish={save} | |
76 | - initialValues={{ | |
77 | - // ...currentInfo | |
78 | - }} | |
79 | - > | |
80 | - {tabType == 1 && ( | |
76 | + <Spin spinning={partLoading}> | |
77 | + <Form | |
78 | + form={form} | |
79 | + onFinish={save} | |
80 | + > | |
81 | + {tabType == 1 && ( | |
81 | 82 | <Form.Item label="车型代码" name="specCode" {...maxFormProps} rules={[{ required: true, message: '该项为必填项' }]}> |
82 | 83 | <Input placeholder="输入车型代码" allowClear /> |
83 | 84 | </Form.Item> |
84 | 85 | )} |
85 | - {tabType == 2 && ( | |
86 | + {tabType == 2 && ( | |
87 | + <> | |
88 | + <Form.Item | |
89 | + label="配件名称" | |
90 | + name="partCode" | |
91 | + {...maxFormProps} | |
92 | + rules={[{ required: true, message: '该项为必填项' }]} | |
93 | + > | |
94 | + <Select | |
95 | + placeholder="选择配件或输入配件编码搜索" | |
96 | + allowClear | |
97 | + onPopupScroll={handlePopupScroll} | |
98 | + value={partCode} | |
99 | + showSearch | |
100 | + onChange={setPartCode} | |
101 | + onSearch={(v) => { setParams({keywords: v || undefined}, true); console.log(v, 'v'); }} | |
102 | + > | |
103 | + {list.map((item) => { return (<Option value={item.partCode} key={item.id}>{item.partName}</Option>); })} | |
104 | + </Select> | |
105 | + </Form.Item> | |
106 | + <Form.Item | |
107 | + label="配件编码" | |
108 | + {...maxFormProps} | |
109 | + > | |
110 | + <Input value={partCode} disabled /> | |
111 | + </Form.Item> | |
112 | + </> | |
113 | + )} | |
114 | + | |
86 | 115 | <Form.Item |
87 | - label="配件代码" | |
88 | - name="partCode" | |
89 | 116 | {...maxFormProps} |
90 | - rules={[{ required: true, message: '该项为必填项' }]} | |
117 | + label="使用数量" | |
118 | + name="partCount" | |
119 | + rules={[{ required: true, message: '该项为必选项' }]} | |
91 | 120 | > |
92 | - <Select | |
93 | - placeholder="请选择配件" | |
94 | - allowClear | |
95 | - onPopupScroll={handlePopupScroll} | |
96 | - defaultValue | |
97 | - showSearch | |
98 | - filterOption={(input: any, option: any) => option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} | |
99 | - > | |
100 | - {list.map((item) => { return (<Option value={item.partCode} key={item.id}>{item.partName}</Option>); })} | |
101 | - </Select> | |
121 | + <InputNumber precision={0} min={1} style={{ width: "100%" }} /> | |
102 | 122 | </Form.Item> |
103 | - )} | |
104 | - <Form.Item | |
105 | - {...maxFormProps} | |
106 | - label="使用数量" | |
107 | - name="partCount" | |
108 | - rules={[{ required: true, message: '该项为必选项' }]} | |
109 | - > | |
110 | - <InputNumber precision={0} min={1} style={{ width: "100%" }} /> | |
111 | - </Form.Item> | |
112 | - </Form> | |
123 | + </Form> | |
124 | + </Spin> | |
113 | 125 | </Modal> |
114 | 126 | ); |
115 | 127 | } |
116 | 128 | \ No newline at end of file | ... | ... |
src/pages/pms/part/Repertory/components/EPCModal.tsx
... | ... | @@ -15,7 +15,7 @@ export default function FactoryEpcDetailModal() { |
15 | 15 | const { list, loading, setLoading, setParams, paginationConfig } = usePagination(getEpcdetailApi, { partCode: currentItem.partCode }, { delay }); |
16 | 16 | |
17 | 17 | const _onChange = debounce((param: string) => { |
18 | - setParams({ specCode: param, current: 1 }, true) | |
18 | + setParams({ specCode: param, current: 1 }, true); | |
19 | 19 | }, 500); |
20 | 20 | useEffect(() => { |
21 | 21 | if (currentItem.partCode) { |
... | ... | @@ -33,7 +33,7 @@ export default function FactoryEpcDetailModal() { |
33 | 33 | setLoading(true); |
34 | 34 | }).catch(e => { |
35 | 35 | message.error(e.message); |
36 | - }) | |
36 | + }); | |
37 | 37 | } |
38 | 38 | |
39 | 39 | return ( |
... | ... | @@ -80,8 +80,9 @@ export default function FactoryEpcDetailModal() { |
80 | 80 | placeholder="搜索车型代码" |
81 | 81 | allowClear |
82 | 82 | style={{ width: 200 }} |
83 | - onChange={(e) => _onChange(e.target.value)} /> | |
84 | - <Button type="primary" onClick={() => { setAddVisible(true), setCurrentInfo({}) }}>新增</Button> | |
83 | + onChange={(e) => _onChange(e.target.value)} | |
84 | + /> | |
85 | + <Button type="primary" onClick={() => { setAddVisible(true); setCurrentInfo({}); }}>新增</Button> | |
85 | 86 | </div> |
86 | 87 | <Table |
87 | 88 | size="small" |
... | ... | @@ -96,10 +97,9 @@ export default function FactoryEpcDetailModal() { |
96 | 97 | <Column title="使用数量" dataIndex="partCount" /> |
97 | 98 | <Column |
98 | 99 | title="操作" |
99 | - | |
100 | 100 | render={(text, _item: PartRepertorySpace.PartEpc) => ( |
101 | - <React.Fragment> | |
102 | - <a onClick={() => { setAddVisible(true); setCurrentInfo(_item) }}> 编辑</a> | |
101 | + <> | |
102 | + <a onClick={() => { setAddVisible(true); setCurrentInfo(_item); }}> 编辑</a> | |
103 | 103 | <Divider type="vertical" /> |
104 | 104 | <Popconfirm |
105 | 105 | title={`是否删除${_item.partCode}?`} |
... | ... | @@ -107,10 +107,11 @@ export default function FactoryEpcDetailModal() { |
107 | 107 | okText="确定" |
108 | 108 | cancelText="取消" |
109 | 109 | > |
110 | - <a onClick={(e) => { e.preventDefault() }} >删除</a> | |
110 | + <a onClick={(e) => { e.preventDefault(); }}>删除</a> | |
111 | 111 | </Popconfirm> |
112 | - </React.Fragment> | |
113 | - )} /> | |
112 | + </> | |
113 | + )} | |
114 | + /> | |
114 | 115 | </Table> |
115 | 116 | </Card> |
116 | 117 | <AddepcModal | ... | ... |
src/pages/pms/part/Repertory/components/SpecEpcModal.tsx
... | ... | @@ -95,7 +95,7 @@ export default function specEcpModal() { |
95 | 95 | rowKey={record => `id ${record.id}`} |
96 | 96 | scroll={{ y: 400 }} |
97 | 97 | > |
98 | - <Column title="配件代码" dataIndex="partCode" /> | |
98 | + <Column title="配件编码" dataIndex="partCode" /> | |
99 | 99 | <Column title="配件名称" dataIndex="partName" /> |
100 | 100 | <Column title="标准类型" dataIndex="stdType" render={(text) => <span>{text == 1 ? '厂家标准' : '霏微标准'}</span>} /> |
101 | 101 | <Column title="使用数量" dataIndex="partCount" /> | ... | ... |
src/pages/pms/part/Repertory/store.ts
... | ... | @@ -20,7 +20,7 @@ function stopBodyScroll(isFixed: boolean) { |
20 | 20 | } |
21 | 21 | |
22 | 22 | export default function useStore() { |
23 | - const pagination = usePagination<PartRepertorySpace.Item>(getPageListApi, { brandId: 28 }); | |
23 | + const pagination = usePagination<PartRepertorySpace.Item>(getPageListApi, {current: 1, pageSize: 10}); | |
24 | 24 | const specPagination = usePagination<PartRepertorySpace.Item>(queryListApi, {}); |
25 | 25 | const cAspecPagination = usePagination<PartRepertorySpace.caSpecItem>(getSpecCode, { brandId: 28 }); |
26 | 26 | const { data: brands } = useInitail(getAllBrandApi, [], {}); | ... | ... |
src/pages/pms/partPlan/PlanPool/components/StoragePartTable.tsx
1 | -import {Table, Popconfirm, Divider, Modal, Input, Button, message} from 'antd'; | |
1 | +import {Table, Popconfirm, Divider, Modal, Input, Button, message, Form} from 'antd'; | |
2 | 2 | import React, {useEffect, useState} from 'react'; |
3 | 3 | import useInitial from "@/hooks/useInitail"; |
4 | 4 | import {getList, ListVO} from "@/pages/pms/partPlan/PlanPool/api"; |
... | ... | @@ -6,17 +6,17 @@ import {useStore} from "@/pages/pms/partPlan/PlanPool"; |
6 | 6 | import {deleteApi, editApi} from '../api'; |
7 | 7 | |
8 | 8 | const { Column } = Table; |
9 | +const {Item} = Form; | |
9 | 10 | interface Props { |
10 | 11 | // eslint-disable-next-line react/no-unused-prop-types |
11 | 12 | type?: number, // 类型1区域库2库房3车系4车型5配件 |
12 | 13 | } |
13 | 14 | export default function Index(props: Props = {}) { |
14 | 15 | const { dfParams, key } = useStore(); |
16 | + const [form] = Form.useForm(); | |
15 | 17 | const { data: parts, setParams } = useInitial(getList, [], dfParams); |
16 | 18 | const [visible, setVisible] = useState(false); |
17 | 19 | const [item, setItem] = useState<ListVO>(); |
18 | - const [cnt, setCnt] = useState<any>(); | |
19 | - const [defaultCnt, setDefaultCnt] = useState<any>(); | |
20 | 20 | |
21 | 21 | useEffect(() => { |
22 | 22 | if (key == props.type) { |
... | ... | @@ -26,7 +26,9 @@ export default function Index(props: Props = {}) { |
26 | 26 | |
27 | 27 | useEffect(() => { |
28 | 28 | if (visible && item?.poolId) { |
29 | - setDefaultCnt(item.cnt); | |
29 | + form.setFieldsValue({cnt: item.cnt}); | |
30 | + } else { | |
31 | + form.resetFields; | |
30 | 32 | } |
31 | 33 | }, [visible]); |
32 | 34 | |
... | ... | @@ -75,31 +77,46 @@ export default function Index(props: Props = {}) { |
75 | 77 | key="ok" |
76 | 78 | type="primary" |
77 | 79 | style={{marginLeft: 10}} |
80 | + htmlType="submit" | |
78 | 81 | onClick={() => { |
79 | - if (!cnt) { | |
80 | - message.error("请先输入配件采购数量"); | |
81 | - return; | |
82 | - } | |
83 | - editApi({poolId: item?.poolId, partCnt: cnt}).then(res => { | |
84 | - setVisible(false); | |
85 | - message.success("操作成功"); | |
86 | - setParams({}, true); | |
87 | - }).catch(e => { message.error(e.message); setVisible(false); }); | |
82 | + form.validateFields().then(fields => { | |
83 | + editApi({poolId: item?.poolId, partCnt: fields.cnt}).then(res => { | |
84 | + setVisible(false); | |
85 | + message.success("操作成功"); | |
86 | + setParams({}, true); | |
87 | + }).catch(e => { | |
88 | + message.error(e.message); | |
89 | + setVisible(false); | |
90 | + }); | |
91 | + }); | |
88 | 92 | }} |
89 | 93 | >保存 |
90 | 94 | </Button> |
91 | 95 | ]} |
92 | 96 | > |
93 | - <div style={{display: 'flex', alignItems: 'center'}}> | |
94 | - <span>配件采购数量:</span> | |
95 | - <Input | |
96 | - style={{width: 200, marginRight: 10}} | |
97 | - value={cnt} | |
98 | - onChange={e => setCnt(e.target.value)} | |
99 | - defaultValue={defaultCnt} | |
100 | - placeholder="请输入配件采购数量" | |
101 | - /> | |
102 | - </div> | |
97 | + <Form | |
98 | + form={form} | |
99 | + labelCol={{span: 7}} | |
100 | + wrapperCol={{span: 10}} | |
101 | + > | |
102 | + <Item | |
103 | + label="配件采购数量" | |
104 | + name="cnt" | |
105 | + rules={[ | |
106 | + {required: true}, | |
107 | + () => ({ | |
108 | + validator(_, value) { | |
109 | + if (value > 0) { | |
110 | + return Promise.resolve(); | |
111 | + } | |
112 | + return Promise.reject(new Error('配件采购数量不能低于0')); | |
113 | + }, | |
114 | + }), | |
115 | + ]} | |
116 | + > | |
117 | + <Input placeholder="请输入配件采购数量" /> | |
118 | + </Item> | |
119 | + </Form> | |
103 | 120 | </Modal> |
104 | 121 | </div> |
105 | 122 | ); | ... | ... |
src/pages/pms/storage/partShop/components/FlowDetailModal.tsx
... | ... | @@ -122,6 +122,8 @@ export default function Index({item = {}, visible, onCancel}: Props) { |
122 | 122 | {!!obj.userName && <div>{`操作账号: ${obj.userName}`}</div>} |
123 | 123 | {!!obj.user && <div>{`操作人: ${obj.user}`}</div>} |
124 | 124 | {!!obj.fixRemark && <div>{`操作原因: ${obj.fixRemark}`}</div>} |
125 | + {!!obj.user && <div>{`运维前${it.type?.includes("锁库") ? "锁库" : "库存"}数量: ${obj.oldStock}`}</div>} | |
126 | + {!!obj.fixRemark && <div>{`运维后${it.type?.includes("锁库") ? "锁库" : "库存"}数量: ${obj.stock}`}</div>} | |
125 | 127 | </div> |
126 | 128 | ); |
127 | 129 | }} | ... | ... |
src/pages/pms/storage/partShop/interface.d.ts
src/pages/pms/transfer/transferManage/api.ts
src/pages/pms/transfer/transferManage/comonents/List.tsx
... | ... | @@ -131,6 +131,7 @@ export default function Index() { |
131 | 131 | <Column title="调拨品种数" dataIndex="transferKind" /> |
132 | 132 | <Column title="调拨配件金额(元)" dataIndex="transferAmount" /> |
133 | 133 | <Column title="调拨申请时间" dataIndex="applyTime" /> |
134 | + <Column title="申请人员" dataIndex="applyUserName" /> | |
134 | 135 | <Column title="调运方式" dataIndex="method" /> |
135 | 136 | <Column title="状态" dataIndex="status" /> |
136 | 137 | <Column | ... | ... |
src/pages/pms/transfer/transferManage/comonents/TransferDetail.tsx
... | ... | @@ -17,7 +17,7 @@ return ( |
17 | 17 | |
18 | 18 | <Descriptions title="申请详情:" column={2} style={{marginBottom: 80}} size="small"> |
19 | 19 | <Item label="申请人">{transferDetailByApi?.applyUserName}</Item> |
20 | - <Item label="申请时间">{moment(transferDetailByApi?.applyTime).format('YYYY-MM-DD HH:MM:SS')}</Item> | |
20 | + <Item label="申请时间">{moment(transferDetailByApi?.applyTime).format('YYYY-MM-DD HH:mm:ss')}</Item> | |
21 | 21 | <Item label="调运方式">{transferDetailByApi?.method}</Item> |
22 | 22 | <Item label="调拨人员姓名">{transferDetailByApi?.transferUserName}</Item> |
23 | 23 | {transferDetailByApi?.payShopName && <Item label="结算门店">{transferDetailByApi?.payShopName}</Item>} | ... | ... |