|
|
@@ -4,6 +4,7 @@ import { Ermcp3Wrstandard, ErmcpDeliveryGoodsDetailEx } from "@/services/go/ermc
|
|
|
import { RuleObject } from "ant-design-vue/lib/form/interface";
|
|
|
import { reactive, ref, UnwrapRef } from "vue";
|
|
|
import { FormState } from "./interface";
|
|
|
+import {getGoodsUnitEnumItemName} from "@/common/constants/enumsName";
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -50,6 +51,9 @@ export function getMiddleGoodsD(formState: UnwrapRef<FormState>) {
|
|
|
const DGList = ref<ErmcpDeliveryGoodsDetailEx[]>([])
|
|
|
// 品类
|
|
|
const gmlist = ref<Ermcp3Wrstandard[]>([])
|
|
|
+ // 品类更变后的单位
|
|
|
+ const numberUnit = ref<string>('')
|
|
|
+
|
|
|
// 获取品种数据
|
|
|
function getDG() {
|
|
|
DGList.value = APP.get('DeliveryGoodsList').filter((e: ErmcpDeliveryGoodsDetailEx) => e.data.isvalid === 1)
|
|
|
@@ -64,7 +68,12 @@ export function getMiddleGoodsD(formState: UnwrapRef<FormState>) {
|
|
|
// 选中品类
|
|
|
function chooseWR(id: number | undefined) {
|
|
|
if (id) {
|
|
|
- const temp = gmlist.value.find(e => e.wrstandardid === id)
|
|
|
+ const temp = gmlist.value.find(e => e.wrstandardid === id) as Ermcp3Wrstandard
|
|
|
+ if(temp.enumdicname !== null && temp.enumdicname !== ''){ // 如果有单位
|
|
|
+ numberUnit.value = temp.enumdicname
|
|
|
+ }else{
|
|
|
+ numberUnit.value = getGoodsUnitEnumItemName(temp.unitid) // 没有则去枚举找
|
|
|
+ }
|
|
|
if (temp) {
|
|
|
formState.ConvertFactor = temp.convertfactor
|
|
|
} else {
|
|
|
@@ -74,5 +83,7 @@ export function getMiddleGoodsD(formState: UnwrapRef<FormState>) {
|
|
|
formState.ConvertFactor = undefined
|
|
|
}
|
|
|
}
|
|
|
- return { DGList, getDG, gmlist, chooseMG, chooseWR }
|
|
|
+
|
|
|
+
|
|
|
+ return { DGList, getDG, gmlist, chooseMG, chooseWR, numberUnit }
|
|
|
}
|