|
@@ -12,6 +12,7 @@ type FormState = {
|
|
|
storageIsNotDisable: string;
|
|
|
storageWarehouse: string;
|
|
|
storageMaterialType: string[];
|
|
|
+ storageIsProduct: string;
|
|
|
};
|
|
|
|
|
|
const validate = object({
|
|
@@ -19,6 +20,7 @@ const validate = object({
|
|
|
storageLocationName: string().required('请输入库位名称'),
|
|
|
storageIsNotDisable: string().required('请选择是否是混合库位'),
|
|
|
storageWarehouse: string().required('请选择所在仓库'),
|
|
|
+ storageIsProduct: string().required('请选择是否是产成品库位'),
|
|
|
});
|
|
|
|
|
|
export function useFormState({
|
|
@@ -39,6 +41,7 @@ export function useFormState({
|
|
|
storageIsNotDisable: '0',
|
|
|
storageWarehouse: '',
|
|
|
storageMaterialType: [],
|
|
|
+ storageIsProduct: '',
|
|
|
},
|
|
|
resolver: yupResolver(validate),
|
|
|
});
|
|
@@ -65,6 +68,7 @@ export function useFormState({
|
|
|
storageIsNotDisable,
|
|
|
storageWarehouse,
|
|
|
storageMaterialType,
|
|
|
+ storageIsProduct,
|
|
|
}) {
|
|
|
const params: AddStorageParams = {
|
|
|
storageLocationName,
|
|
@@ -72,6 +76,7 @@ export function useFormState({
|
|
|
isNotDisable: storageIsNotDisable,
|
|
|
warehouseWhere: storageWarehouse,
|
|
|
storageLocationType: storageMaterialType.join(','),
|
|
|
+ isProduct: storageIsProduct,
|
|
|
};
|
|
|
|
|
|
id ? editMutate({...params, id}) : addMutate(params);
|
|
@@ -102,6 +107,7 @@ export function useFormInfoValue(id: string) {
|
|
|
setValue('storageIsNotDisable', data?.isNotDisable ?? '0');
|
|
|
setValue('storageWarehouse', data?.warehouseWhere ?? '');
|
|
|
setValue('storageMaterialType', data?.storageLocationType?.split(',').filter(Boolean) ?? []);
|
|
|
+ setValue('storageIsProduct', data?.isProduct ?? '');
|
|
|
},
|
|
|
[data, setValue],
|
|
|
);
|