增加折叠板

This commit is contained in:
simple321vip
2022-09-17 08:54:48 +08:00
parent 4320f35a52
commit c7aae62f43
3 changed files with 186 additions and 147 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
</el-icon>&nbsp 9:00-11:30 &nbsp </el-icon>&nbsp 9:00-11:30 &nbsp
<el-icon color="gold"> <el-icon color="gold">
<Sunny /> <Sunny />
</el-icon>&nbsp 13:00-15:00 &nbsp </el-icon>&nbsp 13:30-15:00 &nbsp
<el-icon color="blue"> <el-icon color="blue">
<Moon /> <Moon />
</el-icon>&nbsp 21:00-23:00 </el-icon>&nbsp 21:00-23:00
+64 -35
View File
@@ -1,56 +1,83 @@
<template> <template>
<div class="capital"> <div class="demo-collapse">
<el-descriptions title="Account Info"> <el-collapse v-model="activeNames">
<el-descriptions-item class="descriptionsclass"> <el-collapse-item title="Account Info" name="1">
<template #label> <el-row>
<el-col :span="1">
<div class="cell-item"> <div class="cell-item">
<el-icon style="iconStyle"> <el-icon style="iconStyle">
<user /> <user />
</el-icon> </el-icon>
</div> </div>
</template> </el-col>
<el-col :span="3">
<el-tag size="small"> {{account_data.account_id}}</el-tag> <el-tag size="small"> {{account_data.account_id}}</el-tag>
</el-descriptions-item> </el-col>
<el-descriptions-item label="gateway_name">{{account_data.geteway_name}}</el-descriptions-item> <el-col :span="1">
<el-descriptions-item label="frozen">{{account_data.frozen}}</el-descriptions-item>
<el-descriptions-item>
<template #label>
<div class="cell-item"> <div class="cell-item">
<el-icon style="iconStyle"> <el-icon style="iconStyle">
<Coin /> <Coin />
</el-icon> </el-icon>
</div> </div>
</template> </el-col>
<el-col :span="3">
<el-tag size="small"> {{account_data.balance}}</el-tag> <el-tag size="small"> {{account_data.balance}}</el-tag>
</el-descriptions-item> </el-col>
<el-descriptions-item label="Address">No.1188, Gaoxinyuan Avenue, Dalian District, Liaoning, Jiangsu <el-col :span="1">
Province</el-descriptions-item> <div class="cell-item">
</el-descriptions> <el-icon style="iconStyle">
<GobletFull />
<div class="operate"> </el-icon>
<div width="180px">
<el-select v-model="vt_symbol" placeholder="select a vt_symbol" @change="select_contract">
<el-option v-for="symbol in store.subscribe_vt_symbols" :value="symbol" />
</el-select>
<el-input-number v-model="volume" :min="1" :max="10" @change="handleChange" />
<el-input-number v-model="price" :min="1" :max="10000" @change="handleChange" />
<el-button type="primary" @click="on_order">下单</el-button>
</div> </div>
<div> </el-col>
<div style="margin-top: 20px"> <el-col :span="3">
<el-tag size="small"> {{account_data.frozen}}</el-tag>
</el-col>
<el-col :span="1">
<div class="cell-item">
<el-icon style="iconStyle">
<School />
</el-icon>
</div>
</el-col>
<el-col :span="3">
<el-tag size="small"> {{account_data.gateway_name}}</el-tag>
</el-col>
</el-row>
</el-collapse-item>
<el-collapse-item title="手动下单" name="2" style="display: flex;">
<el-row>
<el-col :span="2">
<el-radio-group v-model="direction"> <el-radio-group v-model="direction">
<el-radio-button label="多" /> <el-radio-button label="多" />
<el-radio-button label="空" /> <el-radio-button label="空" />
</el-radio-group> </el-radio-group>
</div> </el-col>
<div style="margin-top: 20px"> <el-col :span="2">
<el-radio-group v-model="offset"> <el-radio-group v-model="offset">
<el-radio-button label="开" /> <el-radio-button label="开" />
<el-radio-button label="平" /> <el-radio-button label="平" />
</el-radio-group> </el-radio-group>
</div> </el-col>
</div> <el-col :span="1"></el-col>
</div> <el-col :span="3">
<el-select v-model="vt_symbol" placeholder="select a vt_symbol" @change="select_contract">
<el-option v-for="symbol in store.subscribe_vt_symbols" :value="symbol" />
</el-select>
</el-col>
<el-col :span="1"></el-col>
<el-col :span="4">
<el-input-number v-model="volume" :min="1" :max="10" @change="handleChange" />
</el-col>
<el-col :span="4">
<el-input-number v-model="price" :min="1" :max="10000" @change="handleChange" />
</el-col>
<el-col :span="4">
<el-button type="primary" @click="on_order">下单</el-button>
</el-col>
</el-row>
</el-collapse-item>
<el-collapse-item title="持仓一览" name="3">
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick"> <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane label="持仓" name=1></el-tab-pane> <el-tab-pane label="持仓" name=1></el-tab-pane>
<el-tab-pane label="挂单" name=2></el-tab-pane> <el-tab-pane label="挂单" name=2></el-tab-pane>
@@ -97,6 +124,8 @@
<el-table-column prop="orderid" label="orderid" width="100" /> <el-table-column prop="orderid" label="orderid" width="100" />
<el-table-column prop="offset" label="offset" width="100" /> <el-table-column prop="offset" label="offset" width="100" />
</el-table> </el-table>
</el-collapse-item>
</el-collapse>
</div> </div>
</template> </template>
@@ -107,7 +136,7 @@ import { reactive, ref, h, onMounted, onUnmounted } from 'vue'
import { get_accounts, send_order, get_tick } from '../../api/capital' import { get_accounts, send_order, get_tick } from '../../api/capital'
import { strategyStore } from '../../store/strategy'; import { strategyStore } from '../../store/strategy';
type AccountData = { type AccountData = {
geteway_name: string gateway_name: string
account_id: string account_id: string
balance: number balance: number
frozen: number frozen: number
@@ -156,7 +185,7 @@ const volume = ref(1)
const price = ref(3000) const price = ref(3000)
const timer = ref(0) const timer = ref(0)
const account_data = reactive<AccountData>({ const account_data = reactive<AccountData>({
geteway_name: '', gateway_name: '',
account_id: '', account_id: '',
balance: 0.0, balance: 0.0,
frozen: 0.0 frozen: 0.0
@@ -164,7 +193,7 @@ const account_data = reactive<AccountData>({
const positions_data = reactive<PositionData[]>([]) const positions_data = reactive<PositionData[]>([])
const trades_data = reactive<TradeData[]>([]) const trades_data = reactive<TradeData[]>([])
const orders_data = reactive<OrderData[]>([]) const orders_data = reactive<OrderData[]>([])
const activeNames = ref(['1'])
const on_query_accounts = () => { const on_query_accounts = () => {
get_accounts().then(res => { get_accounts().then(res => {
@@ -172,7 +201,7 @@ const on_query_accounts = () => {
let account: any = accounts.pop() let account: any = accounts.pop()
account_data.account_id = account.account_id account_data.account_id = account.account_id
account_data.balance = account.balance account_data.balance = account.balance
account_data.geteway_name = account.geteway_name account_data.gateway_name = account.gateway_name
account_data.frozen = account.frozen account_data.frozen = account.frozen
positions_data.length = 0 positions_data.length = 0
+21 -11
View File
@@ -1,4 +1,7 @@
<template> <template>
<div class="demo-collapse">
<el-collapse v-model="activeNames">
<el-collapse-item title="订阅行情" name="2">
<el-row> <el-row>
<el-col :span="4"> <el-col :span="4">
<el-select v-model="exchange" placeholder="select a exchange"> <el-select v-model="exchange" placeholder="select a exchange">
@@ -22,7 +25,8 @@
</span> </span>
</el-col> </el-col>
</el-row> </el-row>
</el-collapse-item>
<el-collapse-item title="订阅一览" name="1">
<el-table :data="ticks_data" style="width: 100%"> <el-table :data="ticks_data" style="width: 100%">
<el-table-column fixed prop="symbol" label="symbol" width="80" /> <el-table-column fixed prop="symbol" label="symbol" width="80" />
<el-table-column fixed prop="exchange" label="exchange" width="100" /> <el-table-column fixed prop="exchange" label="exchange" width="100" />
@@ -33,6 +37,9 @@
<el-table-column fixed prop="high_price" label="high_price" width="120" /> <el-table-column fixed prop="high_price" label="high_price" width="120" />
<el-table-column fixed prop="low_price" label="low_price" width="120" /> <el-table-column fixed prop="low_price" label="low_price" width="120" />
</el-table> </el-table>
</el-collapse-item>
</el-collapse>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -41,16 +48,6 @@ import { ElMessage } from 'element-plus'
import { get_ticks, subscribe } from '../../api/capital' import { get_ticks, subscribe } from '../../api/capital'
import { strategyStore } from '../../store/strategy' import { strategyStore } from '../../store/strategy'
const store = strategyStore()
const vt_symbol = ref<string>()
const vt_symbols = reactive<string[]>([])
const exchange = ref<string>()
const exchanges = reactive<string[]>([])
store.exchanges.forEach(exchange => {
exchanges.push(exchange)
})
const timer = ref(0)
type TickData = { type TickData = {
symbol: string, symbol: string,
exchange: string, exchange: string,
@@ -61,7 +58,20 @@ type TickData = {
high_price: number, high_price: number,
low_price: number, low_price: number,
} }
const store = strategyStore()
const vt_symbol = ref<string>()
const vt_symbols = reactive<string[]>([])
const exchange = ref<string>()
const exchanges = reactive<string[]>([])
store.exchanges.forEach(exchange => {
exchanges.push(exchange)
})
const timer = ref(0)
const ticks_data = reactive<TickData[]>([]) const ticks_data = reactive<TickData[]>([])
const activeNames = ref(['1'])
const on_subscribe = () => { const on_subscribe = () => {
if (!vt_symbol.value) { if (!vt_symbol.value) {