li.shaoyi il y a 3 ans
Parent
commit
7be7ac45ee

+ 1 - 1
src/common/components/capitalInfo/index.vue

@@ -43,7 +43,7 @@
           </tr>
           <tr>
             <td>风险率</td>
-            <td>{{showValue((tradeAccount.hazardRatio * 100).toFixed(2)+'%')}}</td>
+            <td>{{showValue(tradeAccount.hazardRatio > 0 ? (tradeAccount.hazardRatio * 100).toFixed(2)+'%' : 0)}}</td>
           </tr>
         </tbody>
       </table>

+ 27 - 29
src/hooks/account/index.ts

@@ -28,39 +28,37 @@ const tradeAccount = ref<TradeAccount>();
 export function useTradeAccount() {
     // 获取资金账户列表
     const getTradeAccountList = () => {
-        if (!loading.value) {
-            tradeAccountList.length = 0;
-            loading.value = true;
-
-            // 登录ID
-            const loginID = Number(geLoginID_number());
-
-            getTaAccounts({ loginID }).then(async (res) => {
-                for (let i = 0; i < res.length; i++) {
-                    const account = res[i];
-                    const positionList: TradePosition[] = [];
-
-                    // 获取账户下的期货持仓列表
-                    await queryErmcpTradePosition({ accountID: account.accountid }).then((res) => {
-                        res.forEach((item) => {
-                            positionList.push({
-                                ...item,
-                                ...calcPositionValue(item),
-                            })
+        tradeAccountList.length = 0;
+        loading.value = true;
+
+        // 登录ID
+        const loginID = Number(geLoginID_number());
+
+        getTaAccounts({ loginID }).then(async (res) => {
+            for (let i = 0; i < res.length; i++) {
+                const account = res[i];
+                const positionList: TradePosition[] = [];
+
+                // 获取账户下的期货持仓列表
+                await queryErmcpTradePosition({ accountID: account.accountid }).then((res) => {
+                    res.forEach((item) => {
+                        positionList.push({
+                            ...item,
+                            ...calcPositionValue(item),
                         })
                     })
+                })
 
-                    tradeAccountList.push({
-                        positionList,
-                        ...account,
-                        ...calcCapitalValue(account, positionList),
-                    })
-                }
+                tradeAccountList.push({
+                    positionList,
+                    ...account,
+                    ...calcCapitalValue(account, positionList),
+                })
+            }
 
-                tradeAccountChange(getSelectedAccountId());
-                loading.value = false;
-            })
-        }
+            tradeAccountChange(getSelectedAccountId());
+            loading.value = false;
+        })
     }
 
     // 切换资金账户

+ 18 - 0
src/main.ts

@@ -9,6 +9,24 @@ import { createApp } from 'vue';
 import App from './App.vue';
 import router from './router';
 
+// 解决缓存刷新问题
+(function () {
+    const lastTime = new Date().getTime();
+    const localVersion = localStorage.getItem('version');
+
+    if (localVersion) {
+        const diffTime = lastTime - Number(localVersion);
+        const millisecond = 12 * 60 * 60 * 1000; // 12小时毫秒数
+        // 判断上次加载时间是否超过12小时
+        if (diffTime > millisecond) {
+            localStorage.setItem('version', lastTime.toString());
+            location.reload(); // 页面强制刷新
+        }
+    } else {
+        localStorage.setItem('version', lastTime.toString());
+    }
+})()
+
 const app = createApp(App);
 app.use(router);
 app.use(Antd).mount('#app');

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

@@ -7,28 +7,23 @@ import eventBus from '@/utils/eventBus';
 export const notice = (logout: Function) => {
     // 注册账户离线通知;
     eventBus.$onOnly('custOfflineNtf', (msg: string) => {
-        console.warn(msg);
         logout(msg);
     });
     // 注册用户登出应答;
     eventBus.$onOnly('userLogout', (msg: string) => {
-        console.warn(msg);
         logout(msg);
     });
     // 注册头寸变化通知; => 请求头寸数据,计算持仓盈亏
     eventBus.$onOnly('posChangedNtf', (msg: string) => {
         eventBus.$emit('posChangedNtf_UI', msg);
-        console.warn(msg);
     });
     // 注册资金变化通知; => 请求资金账户信息,计算资金账户盈亏,可用,净值等
     eventBus.$onOnly('moneyChangedNtf', (msg: string) => {
         eventBus.$emit('moneyChangedNtf_UI', msg);
         // queryAccountInfo('');
-        console.warn(msg);
     });
     // 注册委托单撤单通知; => 刷委托单
     eventBus.$onOnly('orderCanceledNtf', (msg: string) => {
-        console.warn(msg);
     });
     // 注册实时行情推送通知; => 实时行情推送
     eventBus.$onOnly('quoteReceiveNtf', (msg: any) => {

+ 1 - 1
src/services/proto/delivery/index.ts

@@ -39,5 +39,5 @@ export const deliveryGoodsCancel = (param: DeliveryGoodsCancelReq): Promise<any>
  * @param param
  */
 export const ermcpSpotGoodsPrice = (param: ErmcpSpotGoodsPriceReq): Promise<any> => {
-    return protoMiddleware<ErmcpSpotGoodsPriceReq>(param, 'ErmcpSpotGoodsPriceReq', 'ErmcpSpotGoodsPriceReq', 2)
+    return protoMiddleware<ErmcpSpotGoodsPriceReq>(param, 'ErmcpSpotGoodsPriceReq', 'ErmcpSpotGoodsPriceRsp', 2)
 }

+ 7 - 5
src/services/socket/protobuf/buildReq.ts

@@ -246,12 +246,14 @@ function parseCommonProtoRsp(rspParam: any): ParseRsp {
 export const noticeParseRsp = (rspPackage: any, funCodeName: string) => {
     isErrer(rspPackage, funCodeName);
     const reqPackage = ProtobufCtr.generateProtoContent(funCodeName, rspPackage.content);
-    const { RetCode } = reqPackage;
-    let errMsg = getErrorInfoByCode(String(RetCode));
-    if (errMsg === '') {
-        errMsg = `未知错误:${RetCode}`;
+    console.log('接收到推送通知', reqPackage)
+    if (reqPackage.RetCode) {
+        let errMsg = getErrorInfoByCode(String(reqPackage.RetCode));
+        if (errMsg === '') {
+            errMsg = `未知错误:${reqPackage.RetCode}`;
+        }
+        return errMsg;
     }
-    return errMsg;
 };
 
 function lower(value: string): string {

+ 1 - 0
src/utils/websocket/index.ts

@@ -295,6 +295,7 @@ export class MTP2WebSocket<T extends Package40 | Package50> {
     private asyncTimeOut(key: string) {
         // 获取对应异步任务对象
         const asyncTask = this.asyncTaskMap.get(key);
+        console.log(asyncTask)
         if (asyncTask) {
             if (asyncTask.callback && asyncTask.callback.onFail) asyncTask.callback.onFail(new Error('业务超时'));
         }

+ 1 - 1
src/views/business/exposure/list/futures/index.vue

@@ -2,7 +2,7 @@
   <!-- 敞口: 期货头寸-->
   <mtp-table-scroll>
     <template #header>
-      <filterCustomTable @search="updateColumn"> </filterCustomTable>
+      <filterCustomTable @search="updateColumn"></filterCustomTable>
     </template>
     <template #default="{ scroll }">
       <a-table :columns="columns" class="srcollYTable" :scroll="scroll" :expandedRowKeys="expandedRowKeys" :customRow="Rowclick" :pagination="false" :rowKey="(record,index)=>index" :data-source="tableList">

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

@@ -1,6 +1,6 @@
 <template>
   <!-- 新增计划 -->
-  <a-modal class="commonModal" title="新增套保计划" v-model:visible="visible" centered @cancel="cancel" width="890px">
+  <a-modal class="commonModal" title="新增购销计划" v-model:visible="visible" centered @cancel="cancel" width="890px">
     <template #footer>
       <a-button key="submit" class="cancelBtn" @click="submit(1)">保存草稿
       </a-button>
@@ -41,15 +41,8 @@
           </a-form-item>
         </a-col>
         <a-col :span="12">
-          <a-form-item label="计划量"
-                       class="relative"
-                       name="PlanQty">
-            <a-input-number class="dialogInput"
-                            style="width: 200px"
-                            :min="0"
-                            :max="99999999999"
-                            v-model:value="formState.PlanQty"
-                            placeholder="请输入计划量"></a-input-number>
+          <a-form-item label="计划量" class="relative" name="PlanQty">
+            <a-input-number class="dialogInput" style="width: 200px" :min="0" :max="99999999999" v-model:value="formState.PlanQty" placeholder="请输入计划量"></a-input-number>
           </a-form-item>
         </a-col>
         <a-col :span="12">

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

@@ -8,7 +8,7 @@
     </template>
     <a-form class="inlineForm" @submit="handleSearch">
       <fieldset class="formFieldSet">
-        <legend>套保计划</legend>
+        <legend>购销计划</legend>
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="计划类型">

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

@@ -7,7 +7,7 @@
     </template>
     <a-form class="inlineForm" :form="form" @submit="handleSearch">
       <fieldset class="formFieldSet">
-        <legend>套保计划</legend>
+        <legend>购销计划</legend>
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="计划类型">

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

@@ -1,13 +1,13 @@
 <template>
-  <!-- 套保计划详情-->
-  <a-modal class="commonModal custom-detail" title="套保计划详情" v-model:visible="visible" centered @cancel="cancel" width="890px">
+  <!-- 购销计划详情-->
+  <a-modal class="commonModal custom-detail" title="购销计划详情" v-model:visible="visible" centered @cancel="cancel" width="890px">
     <template #footer>
       <a-button key="submit" type="primary" :loading="loading" @click="submit">关闭
       </a-button>
     </template>
     <a-form class="inlineForm" @submit="handleSearch">
       <fieldset class="formFieldSet">
-        <legend>套保计划</legend>
+        <legend>购销计划</legend>
         <a-row :gutter="24">
           <a-col :span="12">
             <a-form-item label="计划类型">

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

@@ -320,7 +320,7 @@ export default defineComponent({
     mergeTwoObj(formState, props.selectedRow);
     isSell.value = formState.ContractType === 1 ? false : true;
 
-    const { deliverygoodsid, goodsid, qty, price, wrstandardid, spotcontractid, spotgoodsbrandid, currencyid, attachment, deliverystartdate, deliveryenddate, startdate, enddate, meruserid, tradeuserid, convertfactor } = props.selectedRow;
+    const { deliverygoodsid, goodsid, qty, price, wrstandardid, spotcontractid, spotgoodsbrandid, currencyid, attachment, deliverystartdate, deliveryenddate, startdate, enddate, subjectid, meruserid, tradeuserid, convertfactor } = props.selectedRow;
     if (deliverygoodsid) {
       deliveryGoodsChange(deliverygoodsid).then(() => {
         formState.GoodsID = goodsid;
@@ -335,8 +335,8 @@ export default defineComponent({
     formState.Qty = qty.toString();
     formState.Price = price.toString();
     formState.CurrencyID = currencyid;
-    formState.ContractAttachment = attachment;
-    formState.MerUserID = meruserid;
+    formState.SubjectID = subjectid || undefined;
+    formState.MerUserID = meruserid || undefined;
     formState.TradeUserID = tradeuserid;
     formState.SpotContractID = spotcontractid;
     if (deliverystartdate && deliverystartdate !== '--') {
@@ -351,7 +351,8 @@ export default defineComponent({
     if (enddate && enddate !== '--') {
       priceDate.value.push(moment(enddate));
     }
-    if (attachment) {
+    if (attachment && attachment !== '--') {
+      formState.ContractAttachment = attachment;
       uploadImgList.value = handleImg(attachment);
     }
     function submit() {
@@ -379,10 +380,12 @@ export default defineComponent({
         }
 
         // 处理上传图片
-        if (imgs.value.length) {
-          param.ContractAttachment = imgs.value[0].replace('./', '/');
-        } else {
-          param.ContractAttachment = JSON.parse(param.ContractAttachment)
+        if (param.ContractAttachment) {
+          if (imgs.value.length) {
+            param.ContractAttachment = imgs.value[0].replace('./', '/');
+          } else {
+            param.ContractAttachment = JSON.parse(param.ContractAttachment)
+          }
         }
 
         sendReq(param, loading, 2)

+ 1 - 0
src/views/information/spot-contract/list/purchase/index.vue

@@ -116,6 +116,7 @@ export default defineComponent({
           case 3: // 正常完结
           case 5: // 异常完结
             return secondBtn.filter((e) => e.code !== 'delete');
+          case 4: // 审核拒绝
           case 6: // 已撤回
             return secondBtn.filter((e) => e.code !== 'cancel');
           default:

+ 1 - 1
src/views/market/futures/compoments/futures-trade/index.vue

@@ -199,7 +199,7 @@ export default defineComponent({
         }
         // 市价
         case 1: {
-          return direction === BuyOrSell.buy ? bid : ask;
+          return direction === BuyOrSell.buy ? ask : bid;
         }
         // 对手价
         case 2: {

+ 8 - 8
src/views/order/funding_information/components/funding_information_funding_summary/setup.tsx

@@ -49,14 +49,14 @@ export function getColumns() {
             customRender: ({ text }: { text: number }) => formatAmount(text)
         },
         {
-            title: '入金',
-            key: 'inamount',
-            customRender: ({ text }: { text: number }) => formatAmount(text)
-        },
-        {
-            title: '出金',
-            key: 'outamount',
-            customRender: ({ text }: { text: number }) => formatAmount(text)
+            title: '风险率',
+            key: 'hazardRatio',
+            customRender: ({ text }: { text: number }) => {
+                if (text > 0) {
+                    return (text * 100).toFixed(2) + '%';
+                }
+                return 0;
+            }
         },
         {
             title: '状态',

+ 1 - 1
src/views/order/futures_information/components/futures_information_position/index.vue

@@ -5,7 +5,7 @@
       <a-table :columns="getColumns()" class="srcollYTable" :scroll="scroll" :pagination="false" :loading="loading" :expandedRowKeys="expandedRowKeys" :customRow="Rowclick" :expandIcon="expandIcon" :expandIconAsCell="false" :rowKey="(record,index)=>index" :data-source="tradePositionList">
         <!-- 额外的展开行 -->
         <template v-if="btnList.length" #expandedRowRender="{ record }">
-          <BtnList :btnList="btnList" :record="record" class="btn-list-sticky" @click="openComponent" />
+          <BtnList class="btn-list-sticky" :btnList="btnList" :record="record" @click="openComponent" />
         </template>
       </a-table>
     </template>