|
|
@@ -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 } from '@/services/proto/delivery/interface';
|
|
|
+import {DeliveryGoodsApplyReq, GLDWRStandardEx} from '@/services/proto/delivery/interface';
|
|
|
import { message } from 'ant-design-vue';
|
|
|
import { reactive, ref, UnwrapRef } from 'vue';
|
|
|
import { FormState } from './interface';
|
|
|
@@ -13,9 +13,39 @@ import { FormState } from './interface';
|
|
|
*/
|
|
|
export function handleAdd() {
|
|
|
const loading = ref<boolean>(false);
|
|
|
- function addAction(param: DeliveryGoodsApplyReq) {
|
|
|
+ function addAction(param: FormState) {
|
|
|
+ const unitid = param.unitid === undefined ? 0 : param.unitid
|
|
|
+ const reqParam :DeliveryGoodsApplyReq = {
|
|
|
+ deliverygoodscode: param.deliverygoodscode,
|
|
|
+ deliverygoodsname: param.deliverygoodsname,
|
|
|
+ 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
|
|
|
+ return {
|
|
|
+ wrstandardid: value.wrstandardid,
|
|
|
+ wrstandardname: value.wrstandardname,
|
|
|
+ unitid: gldunitid,
|
|
|
+ convertfactor: (convertfactors as string) ? Number(convertfactors) : convertfactors
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ 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
|
|
|
+ return {
|
|
|
+ middlegoodsid: middlegoodsid,
|
|
|
+ convertratio: (convertratio as string) ? Number(convertratio) : convertratio,
|
|
|
+ unitid: wrsunitid
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
loading.value = true;
|
|
|
- addDeliveryGoodsApply(param).then(() => {
|
|
|
+ addDeliveryGoodsApply(reqParam).then(() => {
|
|
|
message.success('新增现货品种成功!')
|
|
|
}).catch(err => {
|
|
|
message.error(err.message)
|
|
|
@@ -31,7 +61,7 @@ export function handleAdd() {
|
|
|
export function handleFromState() {
|
|
|
const formState: UnwrapRef<FormState> = reactive({
|
|
|
deliverygoodscode: '', // string 交割商品代码(新增时有值)
|
|
|
- deliverygoodsname: '', // string 交割商品名称(新增时有值)
|
|
|
+ deliverygoodsname: '', // string 交割商品名称(新增时有值) // 可能没值 有值不能为中文
|
|
|
deliverygoodsid: 0,// uint64 交割商品id(修改时有值)
|
|
|
unitid: undefined, // uint64 单位ID
|
|
|
type: 1,// int32 类型 1 新增 2 修改
|
|
|
@@ -96,4 +126,4 @@ export function handleGoodsGroup() {
|
|
|
export function getGoodsUnit(unit: number): string {
|
|
|
const obj = getItemEnum('goodsunit').find(e => e.enumitemname === unit);
|
|
|
return obj ? obj.enumdicname : '--'
|
|
|
-}
|
|
|
+}
|