瀏覽代碼

commit 错误95468 解决bug

yu.jie 4 年之前
父節點
當前提交
0b6d96bc51
共有 2 個文件被更改,包括 16 次插入3 次删除
  1. 3 1
      src/views/business/plan/components/add/index.vue
  2. 13 2
      src/views/business/plan/components/setup.ts

+ 3 - 1
src/views/business/plan/components/add/index.vue

@@ -94,6 +94,7 @@
             <a-input class="dialogInput"
                      style="width: 200px"
                      v-model:value="formState.PlanQty"
+                     :suffix="numberUnit"
                      placeholder="请输入计划量" />
           </a-form-item>
         </a-col>
@@ -169,7 +170,7 @@ export default defineComponent({
         // 表单
         const { formRef, formState, rules } = handleForm();
         // 品种、品类
-        const { DGList, getDG, gmlist, chooseMG, chooseWR } = getMiddleGoodsD(formState);
+        const { DGList, getDG, gmlist, chooseMG, chooseWR, numberUnit } = getMiddleGoodsD(formState);
         // 交易用户
         const { tableList, queryTable } = handlerManagerList(loading, 2);
         // 币种
@@ -219,6 +220,7 @@ export default defineComponent({
             priceTyep,
             formRef,
             formState,
+            numberUnit,
             rules,
             chooseWR,
         };

+ 13 - 2
src/views/business/plan/components/setup.ts

@@ -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 }
 }