소스 검색

修改现货品种

huangbin 4 년 전
부모
커밋
c6bc98d324

+ 2 - 2
src/services/bus/index.ts

@@ -9,7 +9,7 @@ import { setServiceURL } from '@/services/request/serviceURL';
 import ProtobufCtr from '@/services/socket/protobuf/index';
 import { localStorageUtil } from '@/utils/storage';
 import { message } from 'ant-design-vue';
-import { GetErmcpGoods } from '../go/ermcp/goodsInfo';
+import { GetErmcpGoods, QueryDeliveryGoodsDetail } from '../go/ermcp/goodsInfo';
 
 /**
  * 全局数据刷新
@@ -34,7 +34,7 @@ export async function globalDataRefresh(): Promise<string> {
             } else {
                 // token校验成功 马上轮询
                 checkTokenLoop();
-                await Promise.all([GetErmcpGoods(), GetPCMenus(), QueryTableDefine(), LoginQuery()])
+                await Promise.all([GetErmcpGoods(), GetPCMenus(), QueryTableDefine(), LoginQuery(), QueryDeliveryGoodsDetail()])
             }
         } else {
             // 重置数据中心数据

+ 2 - 2
src/services/bus/login.ts

@@ -2,7 +2,7 @@ import APP from '@/services';
 import { isAllEnum } from '@/services/bus/allEnum';
 import { checkTokenLoop } from '@/services/bus/token';
 import { getAllEnums, GetPCMenus, getServerTime, queryErrorInfos, QueryTableDefine } from '@/services/go/commonService/index';
-import { GetErmcpGoods } from '@/services/go/ermcp/goodsInfo';
+import { GetErmcpGoods, QueryDeliveryGoodsDetail } from '@/services/go/ermcp/goodsInfo';
 import { GetLoginID, LoginQuery } from '@/services/go/useInfo/index';
 import { localStorageUtil } from '@/utils/storage';
 import { sessionStorageUtil } from '@/utils/storage/index';
@@ -25,7 +25,7 @@ export const login = async (logidCode: string, password: String, byteArr: Uint8A
 
         // localstorage 缓存登录信息,处理页面刷新
         setLoginData(loginData);
-        await Promise.all([GetErmcpGoods(), GetPCMenus(), QueryTableDefine(), getServerTime(), LoginQuery()])
+        await Promise.all([GetErmcpGoods(), GetPCMenus(), QueryTableDefine(), getServerTime(), LoginQuery(), QueryDeliveryGoodsDetail()])
         // await GetPCMenus();
         // await QueryTableDefine();
         // 获取服务时间

+ 1 - 0
src/services/dataCenter/index.ts

@@ -18,6 +18,7 @@ const needClearSourceData: NeedClearSourceDataType = {
     menus: [],
     tableHead: [],
     Goods: [],
+    DeliveryGoodsList: [],
 
     queryClientFixedADConfigs: [],
     checkTokenTimeDiff: Math.floor(Math.random() * 6 + 5) * 60 * 1000,

+ 2 - 1
src/services/dataCenter/interface.ts

@@ -1,5 +1,5 @@
 import { OperationTabMenu, TableDefineRsp } from '@/services/go/commonService/interface';
-import { Goods } from '@/services/go/ermcp/goodsInfo/interface';
+import { ErmcpDeliveryGoodsDetailEx, Goods } from '@/services/go/ermcp/goodsInfo/interface';
 import * as useInfo from '@/services/go/useInfo/interface';
 import * as mineType from '@/services/http/mine/interface';
 import * as Type from '@/services/http/notice/interface';
@@ -36,6 +36,7 @@ export interface NeedClearSourceDataType {
     menus: OperationTabMenu[]; // 交易端菜单
     tableHead: TableDefineRsp[]; // 动态表头
     Goods: Goods[],
+    DeliveryGoodsList: ErmcpDeliveryGoodsDetailEx[], // 现货品种
 
     queryClientFixedADConfigs: advert.fixedADConfigs[]; //首页图片广告
     checkTokenTimeDiff: number; // 轮休校验token时间差

+ 5 - 3
src/services/go/ermcp/goodsInfo/index.ts

@@ -55,9 +55,11 @@ export function QueryGoodsbrand(): Promise<Ermcp3Brand[]> {
  * @param deliverygoodsid 现货商品id
  * @constructor
  */
-export function QueryDeliveryGoodsDetail(deliverygoodsid?: number): Promise<ErmcpDeliveryGoodsDetailEx[]> {
-    const req = deliverygoodsid ? { deliverygoodsid, userid: getUserId() } : { userid: getUserId() }
-    return commonSearch_go('/Ermcp3/QueryDeliveryGoodsDetail', req).catch((err) => {
+export function QueryDeliveryGoodsDetail(): Promise<ErmcpDeliveryGoodsDetailEx[]> {
+    return commonSearch_go('/Ermcp3/QueryDeliveryGoodsDetail', { userid: getUserId() }).then(res => {
+        APP.set('DeliveryGoodsList', res)
+        return res
+    }).catch((err) => {
         throw new Error(`查询现货商品详情: ${err.message}`);
     });
 }

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

@@ -1,8 +1,8 @@
 import { commonResultInfo, getRequestResultInfo } from "@/common/methods/request";
 import { validateCommon } from "@/common/setup/validate";
+import APP from '@/services';
 import { QueryAccMgrLoginUser } from "@/services/go/ermcp/account";
 import { ErmcpLoginUserEx } from "@/services/go/ermcp/account/interface";
-import { QueryDeliveryGoodsDetail } from '@/services/go/ermcp/goodsInfo';
 import { Ermcp3Wrstandard, ErmcpDeliveryGoodsDetailEx } from "@/services/go/ermcp/goodsInfo/interface";
 import { hedgePlanReq, oldHedgePlanReq } from "@/services/proto/hedgeplan";
 import { ErmcpHedgePlanReq, HedgePlanOperateReq } from "@/services/proto/hedgeplan/interface";
@@ -83,9 +83,7 @@ export function getMiddleGoodsD() {
     const gmlist = ref<Ermcp3Wrstandard[]>([])
     // 获取品种数据
     function getDG() {
-        QueryDeliveryGoodsDetail().then(res => {
-            DGList.value = res.filter(e => e.data.isvalid === 1)
-        }).catch(err => message.error(err))
+        DGList.value = APP.get('DeliveryGoodsList').filter((e: ErmcpDeliveryGoodsDetailEx) => e.data.isvalid === 1)
     }
     // 选中品种数据
     function chooseMG(id: number) {

+ 25 - 30
src/views/information/goods/list/spot-variety/setup.ts

@@ -1,7 +1,6 @@
-import { QueryDeliveryGoodsDetail } from '@/services/go/ermcp/goodsInfo';
+import APP from '@/services';
 import { ErmcpDeliveryGoodsDetailEx, MenuList } from '@/services/go/ermcp/goodsInfo/interface';
 import { mergeObj } from '@/utils/objHandle';
-import { message } from 'ant-design-vue';
 import { reactive, Ref, ref } from 'vue';
 import { getInitMenuData } from '../../setup';
 
@@ -55,37 +54,33 @@ export function handleDG() {
     const selctedDeliveryGoods = reactive<ErmcpDeliveryGoodsDetailEx>(initDG())
     const isNormal = ref<boolean>(true) // true => 正常; false => 停用
     // 获取现货品种数据
-    function queryDG(param?: number) {
-        loading.value = true;
-        QueryDeliveryGoodsDetail(param).then(res => {
-            deliveryGoodsList.value = res;
-            res.forEach(e => {
-                const { dgstatus, isvalid, deliverygoodsname, deliverygoodsid } = e.data
-                if (isvalid) { // 有效 
-                    const normal = 'goods_info_spot_normal', disable = 'goods_info_spot_disable';
-                    const result = { key: deliverygoodsid.toString(), title: deliverygoodsname }
-                    if (dgstatus) { //1:正常
-                        if (menuMap.has(normal)) {
-                            const index = menuMap.get(normal) as number;
-                            menuList.value[index].children?.push(result)
-                        }
-                    } else {    // 0:未激活 
-                        if (menuMap.has(disable)) {
-                            const index = menuMap.get(disable) as number;
-                            menuList.value[index].children?.push(result)
-                        }
+    function queryDG() {
+        const res = APP.get('DeliveryGoodsList') as ErmcpDeliveryGoodsDetailEx[]
+        deliveryGoodsList.value = res;
+        res.forEach(e => {
+            const { dgstatus, isvalid, deliverygoodsname, deliverygoodsid } = e.data
+            if (isvalid) { // 有效 
+                const normal = 'goods_info_spot_normal', disable = 'goods_info_spot_disable';
+                const result = { key: deliverygoodsid.toString(), title: deliverygoodsname }
+                if (dgstatus) { //1:正常
+                    if (menuMap.has(normal)) {
+                        const index = menuMap.get(normal) as number;
+                        menuList.value[index].children?.push(result)
+                    }
+                } else {    // 0:未激活 
+                    if (menuMap.has(disable)) {
+                        const index = menuMap.get(disable) as number;
+                        menuList.value[index].children?.push(result)
                     }
                 }
-            })
-            // 获取默认第一条数据
-            if (menuList.value[0].children?.length) {
-                chooseDG({ key: menuList.value[0].children[0].key, is: true })
-            } else if (menuList.value[1].children?.length) {
-                chooseDG({ key: menuList.value[1].children[0].key, is: false })
             }
-        }).catch(err => {
-            message.error(err)
-        }).finally(() => loading.value = false)
+        })
+        // 获取默认第一条数据
+        if (menuList.value[0].children?.length) {
+            chooseDG({ key: menuList.value[0].children[0].key, is: true })
+        } else if (menuList.value[1].children?.length) {
+            chooseDG({ key: menuList.value[1].children[0].key, is: false })
+        }
     }
     interface Value {
         key: string;

+ 8 - 12
src/views/information/spot-contract/components/setup.ts

@@ -2,12 +2,13 @@ import { getPayCurrencyTypeEnumList } from "@/common/constants/enumsList";
 import { getGoodsUnitEnumItemName } from "@/common/constants/enumsName";
 import { commonResultInfo, getRequestResultInfo } from "@/common/methods/request";
 import { validateCommon } from "@/common/setup/validate";
+import APP from '@/services';
 import { QueryAccMgrLoginUser } from "@/services/go/ermcp/account";
 import { ErmcpLoginUser } from "@/services/go/ermcp/account/interface";
 import { QueryCustomInfo } from "@/services/go/ermcp/customInfo";
 import { QueryCustomInfoType } from "@/services/go/ermcp/customInfo/interface";
-import { QueryDeliveryGoods, QueryDeliveryGoodsDetail } from "@/services/go/ermcp/goodsInfo";
-import { Ermcp3Brand, Ermcp3Wrstandard, ErmcpDeliveryGoodsRsp } from "@/services/go/ermcp/goodsInfo/interface";
+import { QueryDeliveryGoods } from "@/services/go/ermcp/goodsInfo";
+import { Ermcp3Brand, Ermcp3Wrstandard, ErmcpDeliveryGoodsDetailEx, ErmcpDeliveryGoodsRsp } from "@/services/go/ermcp/goodsInfo/interface";
 import { orderContract, spotContractStatus } from "@/services/proto/spotcontract";
 import {
     GldErmcpSpotContractOperateReq,
@@ -23,7 +24,6 @@ import { Value } from "./check/interface";
 import { FormState } from './interface';
 
 
-
 /**
  * 合同操作相关 针对操作类型 1: 保存草稿  2: 提交申请 3: 删除成功 4:审核通过
  * @param reqs GldErmcpSpotContractOperateReq
@@ -319,15 +319,11 @@ export function handleDeliveryGoods(formState: UnwrapRef<FormState>) {
 
     // 查询现货商品详情
     function getDeliveryGoodsDetail(deliverygoodsid: number) {
-        QueryDeliveryGoodsDetail(deliverygoodsid).then(res => {
-            if (res.length) {
-                gblist.value = res[0].gblist
-                gmlist.value = res[0].gmlist
-            }
-            console.log('查询品类', res);
-        }).catch(err => {
-            message.error(err)
-        })
+        const temp = APP.get('DeliveryGoodsList').find((e: ErmcpDeliveryGoodsDetailEx) => e.data.deliverygoodsid === deliverygoodsid)
+        if (temp) {
+            gblist.value = temp.gblist
+            gmlist.value = temp.gmlist
+        }
     }
 
     const numberUnit = ref<string>('')