Commit 14be4f5ed48acdf771277932446cfed0d28168d6
Merge remote-tracking branch 'origin/master' into capital2
Showing
12 changed files
with
95 additions
and
102 deletions
src/pages/contract/BearCostSetting/components/SaveModal/index.tsx
@@ -122,7 +122,7 @@ const SaveModal = ({visible, onCancel, onRefresh}:Props) => { | @@ -122,7 +122,7 @@ const SaveModal = ({visible, onCancel, onRefresh}:Props) => { | ||
122 | onSelect={(it:any) => { | 122 | onSelect={(it:any) => { |
123 | const item = feetypeList.filter(i => it.value === i.typeValue); | 123 | const item = feetypeList.filter(i => it.value === i.typeValue); |
124 | const {compTypes, roleCodes} = item[0]; | 124 | const {compTypes, roleCodes} = item[0]; |
125 | - setData({...data, compTypes, roleCodes}); | 125 | + setData({...data, compTypes, roleCodes, typeValue: it.value}); |
126 | setDisabled(false); | 126 | setDisabled(false); |
127 | }} | 127 | }} |
128 | filterOption={(input, option: any) => option?.children.indexOf(input) >= 0} | 128 | filterOption={(input, option: any) => option?.children.indexOf(input) >= 0} |
@@ -210,7 +210,7 @@ const SaveModal = ({visible, onCancel, onRefresh}:Props) => { | @@ -210,7 +210,7 @@ const SaveModal = ({visible, onCancel, onRefresh}:Props) => { | ||
210 | </Select> | 210 | </Select> |
211 | </Form.Item> | 211 | </Form.Item> |
212 | { | 212 | { |
213 | - paymentMode == 2 && ( | 213 | + paymentMode == 2 && ['RP00000053', 'RP00000066', 'RP00000067'].includes(data.typeValue || '') && ( |
214 | <Form.Item | 214 | <Form.Item |
215 | label="计量单位:" | 215 | label="计量单位:" |
216 | name="unit" | 216 | name="unit" |
src/pages/contract/BearCostSetting/interface.d.ts
@@ -3,6 +3,7 @@ declare namespace BearCostSetting { | @@ -3,6 +3,7 @@ declare namespace BearCostSetting { | ||
3 | compTypes?:number[];// | 3 | compTypes?:number[];// |
4 | roleCodes?:string[];//角色编码 | 4 | roleCodes?:string[];//角色编码 |
5 | type?:number;//1门店 2往来单位 | 5 | type?:number;//1门店 2往来单位 |
6 | + typeValue?:string;//费用类型值 | ||
6 | } | 7 | } |
7 | 8 | ||
8 | interface QueryParams{ | 9 | interface QueryParams{ |
src/pages/coupon/CouponConfig/components/UsesceneItems/PreDecoration/Components/WorkItemLimit.tsx
@@ -6,9 +6,9 @@ import * as API from '../api'; | @@ -6,9 +6,9 @@ import * as API from '../api'; | ||
6 | import * as IF from '../interface'; | 6 | import * as IF from '../interface'; |
7 | import usePagination from '@/hooks/usePagination'; | 7 | import usePagination from '@/hooks/usePagination'; |
8 | import { deRepetition } from '@/components/Condition/SeriesSelector/components/utils'; | 8 | import { deRepetition } from '@/components/Condition/SeriesSelector/components/utils'; |
9 | -import useDebounce from '@/hooks/useDebounce'; | ||
10 | import useInitial from '@/hooks/useInitail'; | 9 | import useInitial from '@/hooks/useInitail'; |
11 | -import { getBrandFilterApi } from '@/common/api'; | 10 | +import { getBrandFilterApi, getSeriesApi } from '@/common/api'; |
11 | +import { debounce } from 'lodash'; | ||
12 | 12 | ||
13 | const st = require('@/pages/coupon/CouponConfig/style.less'); | 13 | const st = require('@/pages/coupon/CouponConfig/style.less'); |
14 | 14 | ||
@@ -30,19 +30,23 @@ function PartItem(props: Props, ref?: Ref<any>) { | @@ -30,19 +30,23 @@ function PartItem(props: Props, ref?: Ref<any>) { | ||
30 | const params = useScene === 1 ? { workTypes: "1,2,5,9" } : { workType: useScene }; | 30 | const params = useScene === 1 ? { workTypes: "1,2,5,9" } : { workType: useScene }; |
31 | const { loading, setLoading, list, setParams, paginationConfig, innerParams } = usePagination(API.fetchListApi, params); | 31 | const { loading, setLoading, list, setParams, paginationConfig, innerParams } = usePagination(API.fetchListApi, params); |
32 | const { data: brandList } = useInitial(getBrandFilterApi, [], {}); | 32 | const { data: brandList } = useInitial(getBrandFilterApi, [], {}); |
33 | + const [seriesList, setSeriesList] = useState<CommonApi.OptionVO[]>([]); | ||
33 | const [visible, setVisible] = useState(false); | 34 | const [visible, setVisible] = useState(false); |
34 | const [listData, setListData] = useState<IF.ListVO[]>([]); | 35 | const [listData, setListData] = useState<IF.ListVO[]>([]); |
35 | - const [keyWords, setKeyWords] = useState<string>(''); | ||
36 | - const keyWordsTerm = useDebounce<string>(keyWords, 800); | ||
37 | 36 | ||
38 | useEffect(() => { | 37 | useEffect(() => { |
39 | value && setListData(value.map((v: any) => ({ itemCode: v.applyValue, itemName: v.applyName }))); | 38 | value && setListData(value.map((v: any) => ({ itemCode: v.applyValue, itemName: v.applyName }))); |
40 | }, []); | 39 | }, []); |
41 | 40 | ||
42 | - useEffect(() => { | ||
43 | - setParams({ keywords: keyWordsTerm || undefined, current: 1 }, true); | ||
44 | - }, [keyWordsTerm]); | 41 | + function getSeries(brandId: number) { |
42 | + getSeriesApi(brandId).then((res) => { | ||
43 | + setSeriesList(res.data || []); | ||
44 | + }).catch((err) => { | ||
45 | + message.error(err.message); | ||
46 | + }); | ||
47 | + } | ||
45 | 48 | ||
49 | + const onFilter = debounce((params) => setParams({ ...innerParams, ...params }, true), 600); | ||
46 | function selectedItems(value: any[]) { | 50 | function selectedItems(value: any[]) { |
47 | const partIds = value.length && value.map((i: any) => i.applyValue).toString(); | 51 | const partIds = value.length && value.map((i: any) => i.applyValue).toString(); |
48 | API.fetItemsApi({ partIds }).then(res => { | 52 | API.fetItemsApi({ partIds }).then(res => { |
@@ -93,7 +97,7 @@ function PartItem(props: Props, ref?: Ref<any>) { | @@ -93,7 +97,7 @@ function PartItem(props: Props, ref?: Ref<any>) { | ||
93 | width="20%" | 97 | width="20%" |
94 | render={(text, record: IF.ListVO) => { | 98 | render={(text, record: IF.ListVO) => { |
95 | return ( | 99 | return ( |
96 | - <a onClick={() => remove(record.itemCode)}>删除</a> | 100 | + <a onClick={() => remove(record.itemCode!)}>删除</a> |
97 | ); | 101 | ); |
98 | }} | 102 | }} |
99 | /> | 103 | /> |
@@ -120,16 +124,38 @@ function PartItem(props: Props, ref?: Ref<any>) { | @@ -120,16 +124,38 @@ function PartItem(props: Props, ref?: Ref<any>) { | ||
120 | showSearch | 124 | showSearch |
121 | allowClear | 125 | allowClear |
122 | placeholder="搜索品牌" | 126 | placeholder="搜索品牌" |
123 | - style={{ width: 200, marginRight: 15 }} | ||
124 | - onChange={(value) => setParams({ ...innerParams, brandId: value }, true)} | 127 | + style={{ width: 200, margin: 5 }} |
128 | + onChange={(value) => { | ||
129 | + setParams({ ...innerParams, brandId: value }, true); | ||
130 | + getSeries(value); | ||
131 | + }} | ||
125 | > | 132 | > |
126 | {brandList.map((item) => <Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>)} | 133 | {brandList.map((item) => <Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>)} |
127 | </Select>, | 134 | </Select>, |
135 | + <Select | ||
136 | + optionFilterProp="children" | ||
137 | + mode="multiple" | ||
138 | + showSearch | ||
139 | + allowClear | ||
140 | + placeholder="搜索车系" | ||
141 | + style={{ width: 200, margin: 5 }} | ||
142 | + onChange={(v) => { console.log(v); setParams({ ...innerParams, seriesIds: v.join(',') }, true); }} | ||
143 | + > | ||
144 | + {seriesList.map((item) => <Select.Option key={item.id} value={item.id}>{item.name}</Select.Option>)} | ||
145 | + </Select>, | ||
128 | <Search | 146 | <Search |
129 | allowClear | 147 | allowClear |
130 | - value={keyWords} | 148 | + value={innerParams.keywords} |
149 | + style={{ margin: 5 }} | ||
131 | placeholder="搜索作业名称/代码" | 150 | placeholder="搜索作业名称/代码" |
132 | - onChange={(e) => setKeyWords(e.target.value)} | 151 | + onChange={(e) => onFilter({ keywords: e.target.value })} |
152 | + />, | ||
153 | + <Search | ||
154 | + allowClear | ||
155 | + value={innerParams.specCode} | ||
156 | + style={{ margin: 5 }} | ||
157 | + placeholder="搜索整车代码" | ||
158 | + onChange={(e) => onFilter({ specCode: e.target.value })} | ||
133 | /> | 159 | /> |
134 | ]} | 160 | ]} |
135 | /> | 161 | /> |
src/pages/coupon/CouponConfig/components/UsesceneItems/PreDecoration/interface.d.ts
@@ -3,7 +3,8 @@ export interface QueryList { | @@ -3,7 +3,8 @@ export interface QueryList { | ||
3 | workType?: number, //作业项类型 1:机修 2:电器 3:钣喷 4:装潢 5:基础保养 6:贴膜 | 3 | workType?: number, //作业项类型 1:机修 2:电器 3:钣喷 4:装潢 5:基础保养 6:贴膜 |
4 | workTypes?: string, //多个作业项组合参数 | 4 | workTypes?: string, //多个作业项组合参数 |
5 | keywords?: string, //关键词 | 5 | keywords?: string, //关键词 |
6 | - specGroupCode?: string, //车型分组代码 | 6 | + seriesIds?:string, //车系id集合,查询多个车系 |
7 | + specCode?: string, //整车代码 | ||
7 | current?: number, | 8 | current?: number, |
8 | pageSize?: number, | 9 | pageSize?: number, |
9 | seriesId?: number, | 10 | seriesId?: number, |
@@ -48,51 +49,51 @@ export interface PartListVO { | @@ -48,51 +49,51 @@ export interface PartListVO { | ||
48 | 49 | ||
49 | /**查询保养套餐卡列表通用接口 */ | 50 | /**查询保养套餐卡列表通用接口 */ |
50 | export interface MpList { | 51 | export interface MpList { |
51 | - id: number, //null | ||
52 | - maintainId: number, //套餐卡配置ID | ||
53 | - name: string, //套餐卡名称 | ||
54 | - remark: string, // 备注 | ||
55 | - times: number, // 套餐次数 | ||
56 | - validity: number, // 有效期(年) | ||
57 | - mainItemCode: string, //机油项编码 | ||
58 | - mainItemName: string, // 机油项名称 | ||
59 | - groupId: number, //集团id | ||
60 | - brandName: string, //品牌名称 | ||
61 | - seriesName: string, //车系名称 | ||
62 | - status: number, //状态 1待发布 2已发布 3已下架 | 52 | + id: number, //null |
53 | + maintainId: number, //套餐卡配置ID | ||
54 | + name: string, //套餐卡名称 | ||
55 | + remark: string, // 备注 | ||
56 | + times: number, // 套餐次数 | ||
57 | + validity: number, // 有效期(年) | ||
58 | + mainItemCode: string, //机油项编码 | ||
59 | + mainItemName: string, // 机油项名称 | ||
60 | + groupId: number, //集团id | ||
61 | + brandName: string, //品牌名称 | ||
62 | + seriesName: string, //车系名称 | ||
63 | + status: number, //状态 1待发布 2已发布 3已下架 | ||
63 | } | 64 | } |
64 | 65 | ||
65 | /**保养套餐卡查询条件 */ | 66 | /**保养套餐卡查询条件 */ |
66 | export interface Params { | 67 | export interface Params { |
67 | - mpName?: string, // 套餐名称 | ||
68 | - startDate?: number, // 创建日期开始 | ||
69 | - endDate?: number, // 创建日期结束 | 68 | + mpName?: string, // 套餐名称 |
69 | + startDate?: number, // 创建日期开始 | ||
70 | + endDate?: number, // 创建日期结束 | ||
70 | brandId?: string, //品牌ID | 71 | brandId?: string, //品牌ID |
71 | - status?: number, // 状态 1:待发布 4:已发 | 72 | + status?: number, // 状态 1:待发布 4:已发 |
72 | current?: number, | 73 | current?: number, |
73 | pageSize?: number, | 74 | pageSize?: number, |
74 | } | 75 | } |
75 | 76 | ||
76 | /**查询集团VIP卡列表 */ | 77 | /**查询集团VIP卡列表 */ |
77 | export interface VipList { | 78 | export interface VipList { |
78 | - id: number, //null | ||
79 | - warrantyId: number, // 质保卡id | ||
80 | - name: string, // 质保卡名称 | ||
81 | - price: number, // 价格 | ||
82 | - remark: string, //备注 | ||
83 | - groupId: number, //集团id | ||
84 | - brandId: number, //品牌id | ||
85 | - brandName: string, //品牌名称 | ||
86 | - seriesId: number, //车系id | ||
87 | - seriesName: string, // 车系名称 | ||
88 | - status: number, //状态 1 待上架 2 已上架 2 已下架 | 79 | + id: number, //null |
80 | + warrantyId: number, // 质保卡id | ||
81 | + name: string, // 质保卡名称 | ||
82 | + price: number, // 价格 | ||
83 | + remark: string, //备注 | ||
84 | + groupId: number, //集团id | ||
85 | + brandId: number, //品牌id | ||
86 | + brandName: string, //品牌名称 | ||
87 | + seriesId: number, //车系id | ||
88 | + seriesName: string, // 车系名称 | ||
89 | + status: number, //状态 1 待上架 2 已上架 2 已下架 | ||
89 | } | 90 | } |
90 | 91 | ||
91 | /**vip卡查询条件 */ | 92 | /**vip卡查询条件 */ |
92 | export interface VipParams { | 93 | export interface VipParams { |
93 | - brandId?: number, // 品牌ID | ||
94 | - status?: number, // 状态 1:待发布 4:已发 | 94 | + brandId?: number, // 品牌ID |
95 | + status?: number, // 状态 1:待发布 4:已发 | ||
95 | current?: number, | 96 | current?: number, |
96 | pageSize?: number, | 97 | pageSize?: number, |
97 | - name?: number, //质保卡名称 | 98 | + name?: number, //质保卡名称 |
98 | } | 99 | } |
src/pages/pms/partPlan/AmountPlan/subpages/Second/components/AreaTable.tsx
@@ -32,7 +32,7 @@ export default function Index(props: Props = {}) { | @@ -32,7 +32,7 @@ export default function Index(props: Props = {}) { | ||
32 | <Column title="本次计划金额(元)" dataIndex="thisTimeAmount" /> | 32 | <Column title="本次计划金额(元)" dataIndex="thisTimeAmount" /> |
33 | <Column title="动态库销比" dataIndex="ratio" render={t => (t || 0).toFixed(2)} /> | 33 | <Column title="动态库销比" dataIndex="ratio" render={t => (t || 0).toFixed(2)} /> |
34 | <Column title="库存金额" dataIndex="stockAmount" render={t => (t || 0).toFixed(2)} /> | 34 | <Column title="库存金额" dataIndex="stockAmount" render={t => (t || 0).toFixed(2)} /> |
35 | - <Column title="滚动90天出库金额" dataIndex="outAmount" render={t => (t || 0).toFixed(2)} /> | 35 | + <Column title="滚动90天月均出库金额" dataIndex="outAmount" render={t => (t || 0).toFixed(2)} /> |
36 | {showAnalyse && ( | 36 | {showAnalyse && ( |
37 | <> | 37 | <> |
38 | <Column | 38 | <Column |
src/pages/pms/partPlan/AmountPlan/subpages/Second/components/PartTable.tsx
@@ -32,12 +32,9 @@ export default function Index(props: Props = {}) { | @@ -32,12 +32,9 @@ export default function Index(props: Props = {}) { | ||
32 | <Column title="配件名称" dataIndex="name" /> | 32 | <Column title="配件名称" dataIndex="name" /> |
33 | <Column title="采购单价" dataIndex="price" /> | 33 | <Column title="采购单价" dataIndex="price" /> |
34 | <Column title="采购数量" dataIndex="cnt" /> | 34 | <Column title="采购数量" dataIndex="cnt" /> |
35 | - <Column title="采购规格" dataIndex="unit" /> | ||
36 | - <Column title="拆分件规格" dataIndex="splitUnit" /> | ||
37 | - <Column title="拆分件数量" dataIndex="splitCnt" /> | ||
38 | <Column title="动态库销比" dataIndex="ratio" render={t => (t || 0).toFixed(2)} /> | 35 | <Column title="动态库销比" dataIndex="ratio" render={t => (t || 0).toFixed(2)} /> |
39 | <Column title="库存数量" dataIndex="stockCnt" render={t => (t || 0).toFixed(2)} /> | 36 | <Column title="库存数量" dataIndex="stockCnt" render={t => (t || 0).toFixed(2)} /> |
40 | - <Column title="滚动90天出库数量" dataIndex="outCnt" render={t => (t || 0).toFixed(2)} /> | 37 | + <Column title="滚动90天月均出库数" dataIndex="outCnt" render={t => (t || 0)} /> |
41 | {showAnalyse && ( | 38 | {showAnalyse && ( |
42 | <> | 39 | <> |
43 | <Column | 40 | <Column |
src/pages/pms/partPlan/AmountPlan/subpages/Second/components/SeriesTable.tsx
@@ -32,7 +32,7 @@ export default function Index(props: Props = {}) { | @@ -32,7 +32,7 @@ export default function Index(props: Props = {}) { | ||
32 | <Column title="本次计划金额(元)" dataIndex="thisTimeAmount" /> | 32 | <Column title="本次计划金额(元)" dataIndex="thisTimeAmount" /> |
33 | <Column title="动态库销比" dataIndex="ratio" render={t => (t || 0).toFixed(2)} /> | 33 | <Column title="动态库销比" dataIndex="ratio" render={t => (t || 0).toFixed(2)} /> |
34 | <Column title="库存金额" dataIndex="stockAmount" render={t => (t || 0).toFixed(2)} /> | 34 | <Column title="库存金额" dataIndex="stockAmount" render={t => (t || 0).toFixed(2)} /> |
35 | - <Column title="滚动90天出库金额" dataIndex="outAmount" render={t => (t || 0).toFixed(2)} /> | 35 | + <Column title="滚动90天月均出库金额" dataIndex="outAmount" render={t => (t || 0).toFixed(2)} /> |
36 | {showAnalyse && ( | 36 | {showAnalyse && ( |
37 | <> | 37 | <> |
38 | <Column | 38 | <Column |
src/pages/pms/partPlan/AmountPlan/subpages/Second/components/StorageTable.tsx
@@ -32,7 +32,7 @@ export default function Index(props: Props = {}) { | @@ -32,7 +32,7 @@ export default function Index(props: Props = {}) { | ||
32 | <Column title="本次计划金额(元)" dataIndex="thisTimeAmount" /> | 32 | <Column title="本次计划金额(元)" dataIndex="thisTimeAmount" /> |
33 | <Column title="动态库销比" dataIndex="ratio" render={t => (t || 0).toFixed(2)} /> | 33 | <Column title="动态库销比" dataIndex="ratio" render={t => (t || 0).toFixed(2)} /> |
34 | <Column title="库存金额" dataIndex="stockAmount" render={t => (t || 0).toFixed(2)} /> | 34 | <Column title="库存金额" dataIndex="stockAmount" render={t => (t || 0).toFixed(2)} /> |
35 | - <Column title="滚动90天出库金额" dataIndex="outAmount" render={t => (t || 0).toFixed(2)} /> | 35 | + <Column title="滚动90天月均出库金额" dataIndex="outAmount" render={t => (t || 0).toFixed(2)} /> |
36 | {showAnalyse && ( | 36 | {showAnalyse && ( |
37 | <> | 37 | <> |
38 | <Column | 38 | <Column |
src/pages/pms/partPlan/AmountPlan/subpages/Third/index.tsx
@@ -41,20 +41,8 @@ export default function Index() { | @@ -41,20 +41,8 @@ export default function Index() { | ||
41 | <Column title="配件名称" dataIndex="name" /> | 41 | <Column title="配件名称" dataIndex="name" /> |
42 | <Column title="库房名称" dataIndex="storageName" /> | 42 | <Column title="库房名称" dataIndex="storageName" /> |
43 | <Column title="门店名称" dataIndex="shopName" /> | 43 | <Column title="门店名称" dataIndex="shopName" /> |
44 | - <Column title="拆分件规格" dataIndex="splitUnit" render={t => t || '--'} /> | ||
45 | - <Column title="拆分件系统数量" dataIndex="splitCnt" /> | ||
46 | - <Column title="采购规格" dataIndex="unit" render={t => t || '--'} /> | ||
47 | - <Column title="系统生成采购数量" dataIndex="count" /> | ||
48 | - <Column | ||
49 | - title="增减数" | ||
50 | - dataIndex="diffCount" | ||
51 | - render={(t, _: ListVO) => { | ||
52 | - const c = (_.cnt || 0) - (_.count || 0); | ||
53 | - return c == 0 ? '' : `${c > 0 ? '增' : '减'}${Math.abs(c)}`; | ||
54 | - }} | ||
55 | - /> | ||
56 | <Column title="在库数量" dataIndex="stockCnt" /> | 44 | <Column title="在库数量" dataIndex="stockCnt" /> |
57 | - <Column title="滚动90天出库" dataIndex="outCnt" /> | 45 | + <Column title="滚动90天月均出库数" dataIndex="outCnt" /> |
58 | <Column | 46 | <Column |
59 | title="采购单价" | 47 | title="采购单价" |
60 | dataIndex="price" | 48 | dataIndex="price" |
src/pages/pms/purchase/PurchaseRecord/comonents/ChoosePartModal.tsx
@@ -56,9 +56,9 @@ export default function Index({ onCancel, visible, onOk, partParams }: Props) { | @@ -56,9 +56,9 @@ export default function Index({ onCancel, visible, onOk, partParams }: Props) { | ||
56 | <Item label="配件名称" name="part" required rules={[{ required: true, message: '请选择配件' }]}> | 56 | <Item label="配件名称" name="part" required rules={[{ required: true, message: '请选择配件' }]}> |
57 | <PartModal isclear={isclear} setIsclear={setIsclear} partParams={partParams} onChange={(p: { partId?: number | undefined; partName?: string | undefined; partCode?: string | undefined; price?: number | undefined; }) => getPart(p)} /> | 57 | <PartModal isclear={isclear} setIsclear={setIsclear} partParams={partParams} onChange={(p: { partId?: number | undefined; partName?: string | undefined; partCode?: string | undefined; price?: number | undefined; }) => getPart(p)} /> |
58 | </Item> | 58 | </Item> |
59 | - <Item | ||
60 | - label="配件单价" | ||
61 | - name="price" | 59 | + <Item |
60 | + label="配件单价" | ||
61 | + name="price" | ||
62 | rules={[ | 62 | rules={[ |
63 | { required: true, message: '请输入配件价格' }, | 63 | { required: true, message: '请输入配件价格' }, |
64 | ({ getFieldValue }) => ({ | 64 | ({ getFieldValue }) => ({ |
@@ -74,7 +74,7 @@ export default function Index({ onCancel, visible, onOk, partParams }: Props) { | @@ -74,7 +74,7 @@ export default function Index({ onCancel, visible, onOk, partParams }: Props) { | ||
74 | <InputNumber style={{ width: 250 }} /> | 74 | <InputNumber style={{ width: 250 }} /> |
75 | </Item> | 75 | </Item> |
76 | <Item label="配件数量" name="partCnt" required rules={[{ required: true, message: '请输入配件数量' }]}> | 76 | <Item label="配件数量" name="partCnt" required rules={[{ required: true, message: '请输入配件数量' }]}> |
77 | - <InputNumber min={1} max={1000} placeholder="请输入配件数量" style={{ width: 250 }} /> | 77 | + <InputNumber min={1} max={90000} placeholder="请输入配件数量" style={{ width: 250 }} /> |
78 | </Item> | 78 | </Item> |
79 | </Form> | 79 | </Form> |
80 | </Modal> | 80 | </Modal> |
src/pages/pms/storage/partShop/components/PartShopModal.tsx
@@ -18,31 +18,10 @@ export default function PartShopModal() { | @@ -18,31 +18,10 @@ export default function PartShopModal() { | ||
18 | } else { | 18 | } else { |
19 | setIsadd(false); | 19 | setIsadd(false); |
20 | setIsprice(false); | 20 | setIsprice(false); |
21 | - form.setFieldsValue({ | ||
22 | - costPrice: "", | ||
23 | - stock: 0, | ||
24 | - lockStock: 0, | ||
25 | - shopId: "", | ||
26 | - part: "", | ||
27 | - user: "", | ||
28 | - fixRemark: "" | ||
29 | - }); | ||
30 | - } | ||
31 | - }, [visible]); | ||
32 | - | ||
33 | - useEffect(() => { | ||
34 | - if (isadd) { | ||
35 | setItem({}); | 21 | setItem({}); |
36 | - console.log(isadd, item); | ||
37 | - form.setFieldsValue({ | ||
38 | - costPrice: "", | ||
39 | - stock: 0, | ||
40 | - lockStock: 0, | ||
41 | - shopId: "", | ||
42 | - part: "" | ||
43 | - }); | 22 | + form.resetFields(); |
44 | } | 23 | } |
45 | - }, [isadd]); | 24 | + }, [visible]); |
46 | 25 | ||
47 | const handleSubmit = () => { | 26 | const handleSubmit = () => { |
48 | form.validateFields().then(values => { | 27 | form.validateFields().then(values => { |
@@ -50,11 +29,12 @@ export default function PartShopModal() { | @@ -50,11 +29,12 @@ export default function PartShopModal() { | ||
50 | ...item, | 29 | ...item, |
51 | partId: values.part.partId, | 30 | partId: values.part.partId, |
52 | costPrice: values.costPrice, | 31 | costPrice: values.costPrice, |
53 | - stock: values.stock, | ||
54 | - lockStock: values.lockStock, | 32 | + stock: values.stock || 0, |
33 | + lockStock: values.lockStock || 0, | ||
55 | shopId: values.shopId, | 34 | shopId: values.shopId, |
56 | user: values.user, | 35 | user: values.user, |
57 | - fixRemark: values.fixRemark | 36 | + fixRemark: values.fixRemark, |
37 | + type: isadd ? 1 : isprice ? 3 : 2 | ||
58 | }; | 38 | }; |
59 | setConfirmLoading(true); | 39 | setConfirmLoading(true); |
60 | savePartShopApi(params).then(res => { | 40 | savePartShopApi(params).then(res => { |
@@ -76,8 +56,7 @@ export default function PartShopModal() { | @@ -76,8 +56,7 @@ export default function PartShopModal() { | ||
76 | 56 | ||
77 | const validatorLockStock = (rule: any, value: number) => { | 57 | const validatorLockStock = (rule: any, value: number) => { |
78 | if (value > form.getFieldsValue(['stock']).stock) { | 58 | if (value > form.getFieldsValue(['stock']).stock) { |
79 | - // eslint-disable-next-line prefer-promise-reject-errors | ||
80 | - return Promise.reject('锁定库存不能超过总库存数量!'); | 59 | + return Promise.reject(new Error('锁定库存不能超过总库存数量!')); |
81 | } else return Promise.resolve(); | 60 | } else return Promise.resolve(); |
82 | }; | 61 | }; |
83 | 62 | ||
@@ -113,13 +92,13 @@ export default function PartShopModal() { | @@ -113,13 +92,13 @@ export default function PartShopModal() { | ||
113 | <ChoosePart disabled={!!item.id} /> | 92 | <ChoosePart disabled={!!item.id} /> |
114 | </Item> | 93 | </Item> |
115 | <Item label="加权成本价(元)" name="costPrice" rules={[{ required: true, message: "请输入加权成本价" }]}> | 94 | <Item label="加权成本价(元)" name="costPrice" rules={[{ required: true, message: "请输入加权成本价" }]}> |
116 | - <InputNumber style={{ width: "100%" }} min={0} step={0.1} placeholder="加权成本价(元)" /> | 95 | + <InputNumber style={{ width: "100%" }} min={0} step={0.1} placeholder="加权成本价(元)" disabled={!(isadd || isprice)} /> |
117 | </Item> | 96 | </Item> |
118 | - <Item label="总库存数量" name="stock" rules={[{ required: true, message: "请输入总库存数量" }]}> | ||
119 | - <InputNumber style={{ width: "100%" }} min={0} step={1} placeholder="总库存数量" disabled={isprice || isadd} /> | 97 | + <Item label="总库存数量" name="stock"> |
98 | + <InputNumber style={{ width: "100%" }} min={0} step={1} placeholder="总库存数量" disabled={isprice || isadd} defaultValue={0} /> | ||
120 | </Item> | 99 | </Item> |
121 | - <Item label="锁定库存" name="lockStock" rules={[{ required: true, message: "请输入锁定库存" }, { validator: validatorLockStock }]}> | ||
122 | - <InputNumber style={{ width: "100%" }} min={0} step={1} placeholder="锁定库存" disabled /> | 100 | + <Item label="锁定库存" name="lockStock" rules={[{ validator: validatorLockStock }]}> |
101 | + <InputNumber style={{ width: "100%" }} min={0} step={1} placeholder="锁定库存" disabled defaultValue={0} /> | ||
123 | </Item> | 102 | </Item> |
124 | {!!fw && !isprice && !isadd && ( | 103 | {!!fw && !isprice && !isadd && ( |
125 | <Item label="修改人" name="user" rules={[{ required: true, message: "请输入修改人" }]}> | 104 | <Item label="修改人" name="user" rules={[{ required: true, message: "请输入修改人" }]}> |
src/pages/pms/storage/partShop/interface.d.ts
@@ -34,6 +34,7 @@ declare namespace PmsStoragePartShop { | @@ -34,6 +34,7 @@ declare namespace PmsStoragePartShop { | ||
34 | shopId?: number, // 服务站ID | 34 | shopId?: number, // 服务站ID |
35 | user?: string //修改人名称 | 35 | user?: string //修改人名称 |
36 | fixRemark?: string //修改原因 | 36 | fixRemark?: string //修改原因 |
37 | + type?: number //类型1新增2修改库存3修改价格 | ||
37 | } | 38 | } |
38 | 39 | ||
39 | interface Option { | 40 | interface Option { |