|
|
@@ -8,9 +8,11 @@ import { Taaccount } from "@/services/go/TaAccount/interface";
|
|
|
import { geLoginID_number } from '@/services/bus/login';
|
|
|
import { Systemparam } from '@/services/go/useInfo/interface';
|
|
|
import { getSelectedAccountId, setSelectedAccount } from '@/services/bus/account'; // 为了兼容以前代码,待优化后期废除
|
|
|
+import { subcriteGoodsQuote } from '@/common/setup/table/tableQuote';
|
|
|
import { TradeAccount, TradePosition } from './interface'
|
|
|
import APP from '@/services';
|
|
|
|
|
|
+let stopSubcribe: () => void;
|
|
|
// 加载状态
|
|
|
const loading = ref<boolean>(false);
|
|
|
// 资金账户列表
|
|
|
@@ -63,12 +65,18 @@ export function useTradeAccount() {
|
|
|
|
|
|
// 切换资金账户
|
|
|
const tradeAccountChange = (accountId: number) => {
|
|
|
+ // 停止上次订阅
|
|
|
+ stopSubcribe && stopSubcribe();
|
|
|
+
|
|
|
const account = tradeAccountList.find((account) => account.accountid === accountId);
|
|
|
if (account) {
|
|
|
tradePositionList.length = 0;
|
|
|
tradeAccount.value = account;
|
|
|
tradePositionList.push(...account.positionList);
|
|
|
setSelectedAccount(account); // 为了兼容以前代码,待优化后期废除
|
|
|
+
|
|
|
+ // 开始行情订阅
|
|
|
+ stopSubcribe = subcriteGoodsQuote(account.positionList.map((e) => e.goodscode));
|
|
|
}
|
|
|
}
|
|
|
|