Commit 24ba7c06 authored by wzy's avatar wzy

feat: 进销存-仓库管理接口修改

parent 05aa57c7
......@@ -10,7 +10,7 @@ import { warehouseDetailSchema } from './schema';
import { useLinkEnumEffect } from '@/components/NiceForm/linkages/linkEnum';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { getManageAreaAll, getManageCountryAreaGetTelCode } from '@/services/ManageV2Api';
import { getProductWarehouseDetails, postProductWarehouseAdd, postProductWarehouseUpdate } from '@/services/ProductV2Api';
import { getProductWarehouseDetails, postProductWarehouseAddOrUpdate } from '@/services/ProductV2Api';
import styles from './index.less';
const intl = getIntl();
......@@ -87,38 +87,19 @@ const WarehouseForm: React.FC<WarehouseFormProps> = ({
};
const handleSubmit = value => {
if (!id) {
if (isEdit) {
return;
}
setSubmitLoading(true);
postProductWarehouseAdd({ ...value }).then(res => {
if (res.code === 1000) {
setTimeout(() => {
history.goBack();
}, 800);
};
}).finally(() => {
setSubmitLoading(false);
});
} else {
if (!isEdit) {
return;
}
setSubmitLoading(true);
postProductWarehouseUpdate({
id: id,
...value,
}).then(res => {
if (res.code === 1000) {
setTimeout(() => {
history.goBack();
}, 800);
};
}).finally(() => {
setSubmitLoading(false);
});
}
setSubmitLoading(true);
postProductWarehouseAddOrUpdate({
id: id,
...value,
}).then(res => {
if (res.code === 1000) {
setTimeout(() => {
history.goBack();
}, 800);
};
}).finally(() => {
setSubmitLoading(false);
});
setUnsaved(false);
};
......
......@@ -11,7 +11,7 @@ import StandardTable from '@/components/StandardTable';
import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions } from '@formily/antd';
import { PlusOutlined } from '@ant-design/icons';
import { getProductWarehouseList, postProductWarehouseStartRoStop, postProductWarehouseDelete } from '@/services/ProductV2Api';
import { getProductWarehouseList, postProductWarehouseStartOrStop, getProductWarehouseDelete } from '@/services/ProductV2Api';
import EyePreview from '@/components/EyePreview';
import StatusSwitch from '@/components/StatusSwitch';
import NiceForm from '@/components/NiceForm';
......@@ -135,7 +135,7 @@ const WareHouse: React.FC<{}> = () => {
};
const handleModify = record => {
postProductWarehouseStartRoStop({
postProductWarehouseStartOrStop({
id: record.id,
state: record.state === POSITION_STATUS_EFFECTIVE ? POSITION_STATUS_INVALID : POSITION_STATUS_EFFECTIVE,
}).then(res => {
......@@ -146,7 +146,7 @@ const WareHouse: React.FC<{}> = () => {
};
const handleDelete = record => {
postProductWarehouseDelete({
getProductWarehouseDelete({
id: record.id,
}).then(res => {
if (res.code === 1000) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment