|
|
@@ -2,7 +2,7 @@ import { getItemEnum } from '@/services/bus/allEnum';
|
|
|
import { QueryGoodsfGroup } from '@/services/go/ermcp/goodsInfo';
|
|
|
import { Ermcp3GoodsGroup } from '@/services/go/ermcp/goodsInfo/interface';
|
|
|
import { addDeliveryGoodsApply } from '@/services/proto/delivery';
|
|
|
-import {DeliveryGoodsApplyReq, GLDWRStandardEx} from '@/services/proto/delivery/interface';
|
|
|
+import { DeliveryGoodsApplyReq } from '@/services/proto/delivery/interface';
|
|
|
import { message } from 'ant-design-vue';
|
|
|
import { reactive, ref, UnwrapRef } from 'vue';
|
|
|
import { FormState } from './interface';
|
|
|
@@ -13,18 +13,18 @@ import { FormState } from './interface';
|
|
|
*/
|
|
|
export function handleAdd() {
|
|
|
const loading = ref<boolean>(false);
|
|
|
- function addAction(param: FormState) {
|
|
|
+ function addAction(param: FormState): Promise<void> {
|
|
|
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,
|
|
|
type: 1,
|
|
|
remark: param.remark,
|
|
|
gldwrstandards: param.gldwrstandards.map(value => {
|
|
|
- let gldunitid = value.unitid === undefined ? 0 : value.unitid
|
|
|
- let convertfactors: any = value.convertfactor === null ? 0 : value.convertfactor
|
|
|
+ const gldunitid = value.unitid === undefined ? 0 : value.unitid
|
|
|
+ const convertfactors: any = value.convertfactor === null ? 0 : value.convertfactor
|
|
|
return {
|
|
|
wrstandardid: value.wrstandardid,
|
|
|
wrstandardname: value.wrstandardname,
|
|
|
@@ -34,22 +34,21 @@ export function handleAdd() {
|
|
|
}),
|
|
|
glddgfactoryItems: param.glddgfactoryItems,
|
|
|
wrsconvertdetails: param.wrsconvertdetails.map(value => {
|
|
|
- let middlegoodsid = value.middlegoodsid === undefined ? 0 : value.middlegoodsid
|
|
|
- let convertratio: any = value.convertratio === null ? 0 : value.convertratio
|
|
|
- let wrsunitid = value.unitid === null ? 0 : value.unitid
|
|
|
+ const middlegoodsid = value.middlegoodsid === undefined ? 0 : value.middlegoodsid
|
|
|
+ const convertratio: any = value.convertratio === null ? 0 : value.convertratio
|
|
|
+ const wrsunitid = value.unitid === null ? 0 : value.unitid
|
|
|
return {
|
|
|
middlegoodsid: middlegoodsid,
|
|
|
- convertratio: (convertratio as string) ? Number(convertratio) : convertratio,
|
|
|
+ convertratio: (convertratio as string) ? Number(convertratio) : convertratio,
|
|
|
unitid: wrsunitid
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
loading.value = true;
|
|
|
- addDeliveryGoodsApply(reqParam).then(() => {
|
|
|
+ return addDeliveryGoodsApply(reqParam).then(() => {
|
|
|
message.success('新增现货品种成功!')
|
|
|
- }).catch(err => {
|
|
|
- message.error(err.message)
|
|
|
- }).finally(() => loading.value = false)
|
|
|
+ Promise.resolve()
|
|
|
+ }).catch(err => message.error(err.message)).finally(() => loading.value = false)
|
|
|
}
|
|
|
return { loading, addAction }
|
|
|
}
|