li.shaoyi 3 роки тому
батько
коміт
8f92ab7da4

+ 7 - 5
src/@next/components/base/echarts/setup.ts

@@ -52,13 +52,15 @@ export function useEcharts() {
             }, 50);
 
             // 监听元素变化
-            new ResizeObserver(resize).observe(el);
+            const resizeObserver = new ResizeObserver(resize);
+            resizeObserver.observe(el);
             context?.emit('ready', chart);
-        }
-    })
 
-    onUnmounted(() => {
-        chart?.dispose();
+            onUnmounted(() => {
+                resizeObserver.unobserve(el);
+                chart.dispose();
+            })
+        }
     })
 
     return {

+ 35 - 0
src/@next/constants/enum/channelOperateType.ts

@@ -0,0 +1,35 @@
+import { getEnumTypeList, getEnumTypeName } from './index'
+
+/**
+ * 委托类型
+ */
+export enum ChannelOperateType {
+    Normal = 1, // 正常委托
+}
+
+/**
+ * 获取类型列表
+ * @returns 
+ */
+export function getChannelOperateTypeList() {
+    return getEnumTypeList('channeloperatetype');
+}
+
+/**
+ * 获取枚举名称
+ * @param value 
+ * @returns 
+ */
+export function getChannelOperateTypeName(value: number) {
+    return getEnumTypeName(getChannelOperateTypeList(), value);
+}
+
+/**
+ * 判断类型是否相同
+ * @param key 
+ * @param value 
+ * @returns 
+ */
+export function isEqualChannelOperateType(key: keyof typeof ChannelOperateType, value: number) {
+    return ChannelOperateType[key] === value;
+}

+ 12 - 14
src/hooks/account/index.ts

@@ -38,23 +38,21 @@ export function useTradeAccount() {
                 const account = res[i];
                 const positionList: TradePosition[] = [];
 
-                if (account.tradestatus === 1) {
-                    // 获取账户下的期货持仓列表
-                    await queryErmcpTradePosition({ accountID: account.accountid }).then((res) => {
-                        res.forEach((item) => {
-                            positionList.push({
-                                ...item,
-                                ...calcPositionValue(item),
-                            })
+                // 获取账户下的期货持仓列表
+                await queryErmcpTradePosition({ accountID: account.accountid }).then((res) => {
+                    res.forEach((item) => {
+                        positionList.push({
+                            ...item,
+                            ...calcPositionValue(item),
                         })
                     })
+                })
 
-                    tmpAccountList.push({
-                        positionList,
-                        ...account,
-                        ...calcCapitalValue(account, positionList),
-                    })
-                }
+                tmpAccountList.push({
+                    positionList,
+                    ...account,
+                    ...calcCapitalValue(account, positionList),
+                })
             }
 
             tradeAccountList.length = 0;

+ 3 - 2
src/views/order/futures_information/components/futures_information_entrust/columns.tsx

@@ -1,5 +1,6 @@
 import { QueryErmcpOrderDetailsRsp } from '@/services/go/ermcp/futures/interface';
-import { getChannelBuildName, getBuyOrSellTypeName, getChannelOperateName, getChannelInnerOrderStatusName } from '@/common/constants/enumsName';
+import { getChannelBuildName, getBuyOrSellTypeName, getChannelInnerOrderStatusName } from '@/common/constants/enumsName';
+import { getChannelOperateTypeName } from '@/@next/constants/enum/channelOperateType'
 import { formatTime } from '@/common/methods';
 
 export function getColumns() {
@@ -31,7 +32,7 @@ export function getColumns() {
             title: '委托类型',
             key: 'channeloperatetype',
             customRender: ({ record }: { record: QueryErmcpOrderDetailsRsp }) => {
-                return getChannelOperateName(record.channeloperatetype)
+                return getChannelOperateTypeName(record.channeloperatetype)
             }
         },
         {