Browse Source

修改查询现货商品

huangbin 4 years ago
parent
commit
5af21cc4a2

+ 5 - 0
src/services/bus/goods.ts

@@ -0,0 +1,5 @@
+import APP from '@/services';
+
+export function getGoodsList() {
+    return APP.get('Goods')
+}

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

@@ -9,6 +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';
 
 /**
  * 全局数据刷新
@@ -21,10 +22,8 @@ export async function globalDataRefresh(): Promise<string> {
         if (isLogin()) {
             // 获取服务时间,token校验需要用到
             await getServerTime();
-            await LoginQuery();
             // 建立行情交易长链x
             await APP.connectTrading();
-
             // token 校验处理
             const res = await handleTokenCheck()
                 .then(() => true)
@@ -35,8 +34,7 @@ export async function globalDataRefresh(): Promise<string> {
             } else {
                 // token校验成功 马上轮询
                 checkTokenLoop();
-                await GetPCMenus();
-                await QueryTableDefine();
+                Promise.all([GetErmcpGoods(), GetPCMenus(), QueryTableDefine(), LoginQuery()])
             }
         } else {
             // 重置数据中心数据

+ 7 - 4
src/services/bus/login.ts

@@ -2,6 +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 { GetLoginID, LoginQuery } from '@/services/go/useInfo/index';
 import { localStorageUtil } from '@/utils/storage';
 import { sessionStorageUtil } from '@/utils/storage/index';
@@ -24,10 +25,11 @@ export const login = async (logidCode: string, password: String, byteArr: Uint8A
 
         // localstorage 缓存登录信息,处理页面刷新
         setLoginData(loginData);
-        await GetPCMenus();
-        await QueryTableDefine();
+        Promise.all([GetErmcpGoods(), GetPCMenus(), QueryTableDefine(), getServerTime(), LoginQuery()])
+        // await GetPCMenus();
+        // await QueryTableDefine();
         // 获取服务时间
-        await getServerTime();
+        // await getServerTime();
         // 获取错误信息
         if (!localStorageUtil.getItem('errorCodeInfos')) {
             await queryErrorInfos();
@@ -36,9 +38,10 @@ export const login = async (logidCode: string, password: String, byteArr: Uint8A
         if (!isAllEnum()) {
             await getAllEnums();
         }
+
         // 校验token
         checkTokenLoop();
-        await LoginQuery();
+        // await LoginQuery();
         return loginData;
     } catch (err) {
         return Promise.reject('登录失败:' + err);

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

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

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

@@ -1,4 +1,5 @@
 import { OperationTabMenu, TableDefineRsp } from '@/services/go/commonService/interface';
+import { 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';
@@ -34,6 +35,7 @@ export interface NeedClearSourceDataType {
     username: string;
     menus: OperationTabMenu[]; // 交易端菜单
     tableHead: TableDefineRsp[]; // 动态表头
+    Goods: Goods[],
 
     queryClientFixedADConfigs: advert.fixedADConfigs[]; //首页图片广告
     checkTokenTimeDiff: number; // 轮休校验token时间差

+ 10 - 4
src/services/go/ermcp/goodsInfo/index.ts

@@ -1,5 +1,6 @@
 /** ================================= 信息 - 现货商品信息 ================================**/
 
+import APP from '@/services';
 import { getUserId } from "@/services/bus/account";
 import { getUserAccountType } from "@/services/bus/user";
 import { commonSearch_go } from '@/services/go/index';
@@ -8,7 +9,7 @@ import {
     Ermcp3Wrstandard,
     ErmcpDeliveryGoodsDetailEx,
     ErmcpDeliveryGoodsReq,
-    ErmcpDeliveryGoodsRsp, ErmcpMiddleGoodsModel, Goods
+    ErmcpDeliveryGoodsRsp, ErmcpMiddleGoodsModel
 } from './interface';
 
 /**
@@ -102,12 +103,17 @@ export function QueryMiddleGoodsDetail(middlegoodsid: number): Promise<Ermcp3Mid
 }
 
 /**
- * 查询企业风管期货商品信息 /Ermcp/GetErmcpGoods
+ * 查询企业风管期货商品信息 /Ermcp/GetErmcpGoods (此接口需要优化,需要前端存入本地,目前项目赶,有时间优化)
  * @param lastUpdateTime 最后修改时间 - 闭区间,格式:yyyy-MM-dd HH:mm:ss
  * @constructor
  */
-export function GetErmcpGoods(lastUpdateTime?: string): Promise<Goods[]> {
-    return commonSearch_go('/Ermcp3/QueryMiddleGoodsDetail', { lastUpdateTime }).catch((err) => {
+export function GetErmcpGoods(lastUpdateTime?: string): Promise<string> {
+    const param = lastUpdateTime ? { lastUpdateTime } : {}
+    return commonSearch_go('/Ermcp/GetErmcpGoods', param).then(res => {
+        console.log('查询企业风管期货商品信息', res);
+        APP.set('Goods', res)
+        return 'ok'
+    }).catch((err) => {
         throw new Error(`查询企业风管期货商品信息: ${err.message}`);
     });
 }

+ 11 - 8
src/views/information/spot-contract/components/add/index.vue

@@ -249,15 +249,16 @@
           <!-- 以下是点价的价格信息 start -->
           <template v-if="formState.PriceType === 2 || formState.PriceType === 3">
             <a-col :span="12">
-              <a-form-item label="点价合约">
+              <a-form-item label="点价合约"
+                           name="GoodsID">
                 <a-select class="inlineFormSelect"
+                          v-model:value="formState.GoodsID"
                           style="width: 200px"
                           placeholder="请选择点价合约">
-                  <a-select-option value="1">
-                    合约一
-                  </a-select-option>
-                  <a-select-option value="2">
-                    合约二
+                  <a-select-option v-for="item in goodsList"
+                                   :key="item.goodsid"
+                                   :value="item.goodsid">
+                    {{item.goodsname}}
                   </a-select-option>
                 </a-select>
               </a-form-item>
@@ -432,6 +433,7 @@ import { closeModal } from '@/common/setup/modal/index';
 import { initData } from '@/common/methods';
 import { handleFromState, handleContract, handlevalidate, handleDeliveryGoods, handlePrice, handleDate } from './setup';
 import { getUserName } from '@/services/bus/user';
+import { getGoodsList } from '@/services/bus/goods';
 
 export default defineComponent({
     name: 'add-spot-contract',
@@ -469,6 +471,8 @@ export default defineComponent({
         const { priceType, payCurrency, payCurrencyUnit, parCurrencyChange } = handlePrice(formState);
         // 日期
         const { deliveryDate, disabledDate } = handleDate();
+        // 现货商品列表
+        const goodsList = getGoodsList();
         function submit() {
             loading.value = true;
             setTimeout(() => {
@@ -506,6 +510,7 @@ export default defineComponent({
             getUserName,
             deliveryDate,
             disabledDate,
+            goodsList,
         };
     },
 });
@@ -513,7 +518,5 @@ export default defineComponent({
 
 <style lang="less">
 .add-spot-contract {
- 
-
 }
 </style>;

+ 1 - 1
src/views/information/spot-contract/components/add/interface.ts

@@ -19,7 +19,7 @@ export interface FormState {
     Amount: number | null// double 金额[1:一口价、3:暂定价]
     DeliveryStartDate: string// string 交收期(开始)
     DeliveryEndDate: string // string 交收期(结束)
-    // GoodsID: number // uint64 点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
+    GoodsID: number // uint64 点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
     // PriceMove: number// double 升贴水[2:点价3:暂定价]
     // StartDate: string // string 点价开始日期[2:点价3:暂定价]
     // EndDate: string // string 点价结束日期[2:点价3:暂定价]

+ 1 - 0
src/views/information/spot-contract/components/add/setup.ts

@@ -35,6 +35,7 @@ export function handleFromState() {
         AccountID: undefined, // uint64 期货账户ID
         Remark: '', // string 合同备注
         CurrencyID: undefined, // 结算币种ID
+        GoodsID: undefined, // uint64 点价合约ID-0:为现货,其它为期货商品合约ID[2:点价3:暂定价]
     })
     // 业务类型
     const businessType = [