|
@@ -5,21 +5,19 @@ import { DeliveryGoodsApplyReq } from '@/services/proto/delivery/interface';
|
|
|
import { message } from 'ant-design-vue';
|
|
import { message } from 'ant-design-vue';
|
|
|
import { reactive, ref, UnwrapRef } from 'vue';
|
|
import { reactive, ref, UnwrapRef } from 'vue';
|
|
|
import { FormState } from './interface';
|
|
import { FormState } from './interface';
|
|
|
|
|
+import {addDeliveryGoods, modifyDeliveryGoods} from "@/views/information/goods/components/setup";
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 处理新增
|
|
|
|
|
- * @returns
|
|
|
|
|
|
|
+ * 处理修改
|
|
|
*/
|
|
*/
|
|
|
export function handleAdd() {
|
|
export function handleAdd() {
|
|
|
const loading = ref<boolean>(false);
|
|
const loading = ref<boolean>(false);
|
|
|
- function addAction(param: FormState): Promise<void> {
|
|
|
|
|
|
|
+ function addAction(param: FormState): Promise<string> {
|
|
|
const unitid = param.unitid === undefined ? 0 : param.unitid
|
|
const unitid = param.unitid === undefined ? 0 : param.unitid
|
|
|
const reqParam: DeliveryGoodsApplyReq = {
|
|
const reqParam: DeliveryGoodsApplyReq = {
|
|
|
- deliverygoodscode: param.deliverygoodscode,
|
|
|
|
|
- deliverygoodsname: param.deliverygoodsname,
|
|
|
|
|
deliverygoodsid: param.deliverygoodsid,
|
|
deliverygoodsid: param.deliverygoodsid,
|
|
|
unitid: unitid,
|
|
unitid: unitid,
|
|
|
- type: 1,
|
|
|
|
|
|
|
+ type: 2,
|
|
|
remark: param.remark,
|
|
remark: param.remark,
|
|
|
gldwrstandards: param.gldwrstandards.map(value => {
|
|
gldwrstandards: param.gldwrstandards.map(value => {
|
|
|
const gldunitid = value.unitid === undefined ? 0 : value.unitid
|
|
const gldunitid = value.unitid === undefined ? 0 : value.unitid
|
|
@@ -44,10 +42,7 @@ export function handleAdd() {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
loading.value = true;
|
|
loading.value = true;
|
|
|
- return addDeliveryGoodsApply(reqParam).then(() => {
|
|
|
|
|
- message.success('新增现货品种成功!')
|
|
|
|
|
- Promise.resolve()
|
|
|
|
|
- }).catch(err => message.error(err.message)).finally(() => loading.value = false)
|
|
|
|
|
|
|
+ return modifyDeliveryGoods(reqParam, loading)
|
|
|
}
|
|
}
|
|
|
return { loading, addAction }
|
|
return { loading, addAction }
|
|
|
}
|
|
}
|