li.shaoyi 2 gadi atpakaļ
vecāks
revīzija
c769fd73a3

+ 21 - 5
src/hooks/echarts/candlestick/index.ts

@@ -1,5 +1,5 @@
 import { ref, computed, watch } from 'vue'
-//import { timerInterceptor } from '@/utils/timer'
+import { timerInterceptor } from '@/utils/timer'
 import { ChartCycleType } from '@/constants/chart'
 import { queryHistoryDatas } from '@/services/api/quote'
 import { useFuturesStore } from '@/stores'
@@ -37,7 +37,7 @@ export function useCandlestickChart(goodscode: string) {
             cci: '--'
         }
 
-        if (dataIndex.value > -1) {
+        if (dataIndex.value > -1 && dataset.candlestick.source.length > dataIndex.value) {
             const { open, close, highest, lowest, ma5, ma10, ma15 } = dataset.candlestick.source[dataIndex.value];
             const { macd, dif, dea } = dataset.macd.source[dataIndex.value];
             const { vol } = dataset.vol.source[dataIndex.value];
@@ -126,8 +126,24 @@ export function useCandlestickChart(goodscode: string) {
             const diffTime = moment(lasttime).valueOf() - oldTime.valueOf(); // 计算时间差
 
             if (diffTime > cycleMilliseconds * 2) {
-                // 时间间隔超过两个周期,重新请求历史数据
-                //timerInterceptor.debounce(() => initData(cycleType.value), 1000, 'updateChart');
+                // 时间间隔超过两个周期,重新请求历史数据,待优化
+                timerInterceptor.debounce(() => {
+                    queryHistoryDatas({
+                        data: {
+                            cycleType: options.cycleType,
+                            goodsCode: goodscode,
+                            count: 1440,
+                        }
+                    }).then((res) => {
+                        // 日期升序排序
+                        const data = res.data.sort((a, b) => moment(a.ts).valueOf() - moment(b.ts).valueOf());
+                        if (data.length) {
+                            dataIndex.value = data.length - 1
+                            clearData()
+                            handleData(data, updateOptions)
+                        }
+                    })
+                }, 1000, 'updateChart')
             } else {
                 // 判断时间差是否大于周期时间
                 if (lastIndex === -1 || diffTime > cycleMilliseconds) {
@@ -195,7 +211,7 @@ export function useCandlestickChart(goodscode: string) {
     }
 
     // 监听行情推送
-    watch(() => quote.value?.last, () => {
+    watch(() => quote.value, () => {
         if (!loading.value && !isEmpty.value) {
             updateChart();
         }

+ 1 - 1
src/hooks/echarts/candlestick/types.ts

@@ -77,7 +77,7 @@ export type CCI = {
  * 图表配置项
  */
 export interface EchartsOptions {
-    cycleType: Number; // 周期类型
+    cycleType: number; // 周期类型
     colors: Colors;
     candlestick: ECOption;
     macd: ECOption;

+ 17 - 4
src/hooks/echarts/timeline/index.ts

@@ -1,5 +1,5 @@
 import { ref, computed, watch } from 'vue'
-//import { timerInterceptor } from '@/utils/timer'
+import { timerInterceptor } from '@/utils/timer'
 import { queryTSData } from '@/services/api/quote'
 import { useFuturesStore } from '@/stores'
 import { useDataset } from './dataset'
@@ -65,8 +65,21 @@ export function useTimelineChart(goodscode: string) {
             const diffTime = moment(lasttime).valueOf() - oldTime.valueOf() // 计算时间差
 
             if (diffTime > cycleMilliseconds * 2) {
-                // 时间间隔超过两个周期,重新请求历史数据
-                //timerInterceptor.debounce(() => initData(), 1000, 'updateChart')
+                // 时间间隔超过两个周期,重新请求历史数据,待优化
+                timerInterceptor.debounce(() => {
+                    queryTSData({
+                        data: {
+                            goodsCode: goodscode
+                        }
+                    }).then((res) => {
+                        const { historyDatas } = res.data
+                        if (historyDatas.length) {
+                            dataIndex.value = historyDatas.length - 1
+                            clearData()
+                            handleData(res.data, updateOptions)
+                        }
+                    })
+                }, 1000, 'updateChart')
             } else {
                 // 判断时间差是否大于周期时间
                 if (lastIndex === -1 || diffTime > cycleMilliseconds) {
@@ -89,7 +102,7 @@ export function useTimelineChart(goodscode: string) {
     }
 
     // 监听行情推送
-    watch(() => quote.value?.last, () => {
+    watch(() => quote.value, () => {
         if (!loading.value && !isEmpty.value) {
             updateChart()
         }

+ 2 - 2
src/packages/pc/views/auth/components/layout/index.vue

@@ -15,9 +15,9 @@
         </div>
       </div>
     </div>
-    <div class="sign-layout__footer">
+    <!-- <div class="sign-layout__footer">
       <span>Copyright ©{{ year }} 深圳市多元世纪信息技术股份有限公司 版权所有 粤ICP备00000000号</span>
-    </div>
+    </div> -->
   </div>
 </template>
 

+ 14 - 4
src/packages/pc/views/footer/goods/order/index.vue

@@ -1,6 +1,7 @@
 <!-- 商品订单- 委托 -->
 <template>
-    <app-table :data="dataList" v-model:columns="tableColumns" :loading="loading" :row-key="rowKey" :expand-row-keys="expandKeys"  @row-click="rowClick">
+    <app-table :data="dataList" v-model:columns="tableColumns" :loading="loading" :row-key="rowKey"
+        :expand-row-keys="expandKeys" @row-click="rowClick">
         <!-- 类型' -->
         <template #buyorsell="{ value }">
             {{ getBuyOrSellName(value) }}
@@ -16,16 +17,17 @@
         <!-- 展开行 -->
         <template #expand="{ row }">
             <div class="buttonbar">
-                <el-button type="danger" v-if="[3, 7, 12].includes(row.orderstatus)" size="small" @click="showComponent('cancel', row)">撤销</el-button>
+                <el-button type="danger" v-if="[3, 7, 12].includes(row.orderstatus)" size="small"
+                    @click="showComponent('cancel', row)">撤销</el-button>
             </div>
         </template>
     </app-table>
     <component ref="componentRef" v-bind="{ selectedRow }" :is="componentMap.get(componentId)" @closed="closeComponent"
-            v-if="componentId" />
+        v-if="componentId" />
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, defineAsyncComponent } from 'vue'
+import { shallowRef, defineAsyncComponent, onUnmounted } from 'vue'
 import { useRequest } from '@/hooks/request'
 import { getBuyOrSellName, getWRTradeOrderStatusName } from '@/constants/order'
 import { queryTradeOrderDetail } from '@/services/api/order'
@@ -33,6 +35,7 @@ import AppTable from '@pc/components/base/table/index.vue'
 import { formatDate } from '@/filters'
 import { useComponent } from '@/hooks/component'
 import { useComposeTable } from '@pc/components/base/table'
+import eventBus from '@/services/bus'
 
 const componentMap = new Map<string, unknown>([
     ['cancel', defineAsyncComponent(() => import('./cancel/index.vue'))],
@@ -71,4 +74,11 @@ const showComponent = (componentName: string, row: Model.TradeOrderDetailRsp) =>
     selectedRow.value = row
     openComponent(componentName)
 }
+
+// 接收资金变动通知
+const moneyChangedNotify = eventBus.$on('MoneyChangedNotify', () => {
+    run()
+})
+
+onUnmounted(() => moneyChangedNotify.cancel())
 </script>

+ 13 - 5
src/packages/pc/views/footer/goods/position/index.vue

@@ -1,6 +1,7 @@
 <!-- 商品订单-合约汇总 -->
 <template>
-    <app-table :data="dataList" v-model:columns="tableColumns" :loading="loading" :row-key="rowKey" :expand-row-keys="expandKeys"  @row-click="rowClick">
+    <app-table :data="dataList" v-model:columns="tableColumns" :loading="loading" :row-key="rowKey"
+        :expand-row-keys="expandKeys" @row-click="rowClick">
         <!-- 挂牌类型 -->
         <template #buyorsell="{ value }">
             {{ getBuyOrSellName(value) }}
@@ -15,8 +16,8 @@
         <template #closepl="{ row }">
             <span :class="handlePriceColor(closepl(row), 0.0)">{{ closepl(row).toFixed(2) }}</span>
         </template>
-         <!-- 展开行 -->
-         <template #expand>
+        <!-- 展开行 -->
+        <template #expand>
             <div class="buttonbar">
                 <el-button type="primary" size="small" @click="openComponent('delivery')">交收</el-button>
                 <el-button type="danger" size="small" @click="openComponent('transfer')">转让</el-button>
@@ -24,11 +25,11 @@
         </template>
     </app-table>
     <component ref="componentRef" v-bind="{ selectedRow }" :is="componentMap.get(componentId)" @closed="closeComponent"
-            v-if="componentId" />
+        v-if="componentId" />
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, defineAsyncComponent } from 'vue'
+import { shallowRef, defineAsyncComponent, onUnmounted } from 'vue'
 import { useRequest } from '@/hooks/request'
 import { getBuyOrSellName, BuyOrSell } from '@/constants/order'
 import { useComponent } from '@/hooks/component'
@@ -37,6 +38,7 @@ import { queryTradePosition } from '@/services/api/order'
 import { useFuturesStore } from '@/stores'
 import AppTable from '@pc/components/base/table/index.vue'
 import { handlePriceColor } from '@/filters'
+import eventBus from '@/services/bus'
 
 const futuresStore = useFuturesStore()
 
@@ -90,4 +92,10 @@ const tableColumns = shallowRef<Model.TableColumn[]>([
     { prop: 'closepl', label: '浮动盈亏' },
 ])
 
+// 接收资金变动通知
+const moneyChangedNotify = eventBus.$on('MoneyChangedNotify', () => {
+    run()
+})
+
+onUnmounted(() => moneyChangedNotify.cancel())
 </script>

+ 10 - 2
src/packages/pc/views/footer/goods/trade/index.vue

@@ -17,14 +17,15 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef } from 'vue'
+import { shallowRef, onUnmounted } from 'vue'
 import { useRequest } from '@/hooks/request'
 import { getBuyOrSellName, getBuildTypeName } from '@/constants/order'
 import { queryTradeDetail } from '@/services/api/order'
 import AppTable from '@pc/components/base/table/index.vue'
 import { formatDate } from '@/filters'
+import eventBus from '@/services/bus'
 
-const { loading, dataList } = useRequest(queryTradeDetail, {
+const { loading, dataList, run } = useRequest(queryTradeDetail, {
     params: {
         tradeMode: '50'
     },
@@ -42,4 +43,11 @@ const tableColumns = shallowRef<Model.TableColumn[]>([
     { prop: 'matchaccountid', label: '成交对手' },
     { prop: 'tradetime', label: '成交时间' }
 ])
+
+// 接收资金变动通知
+const moneyChangedNotify = eventBus.$on('MoneyChangedNotify', () => {
+    run()
+})
+
+onUnmounted(() => moneyChangedNotify.cancel())
 </script>

+ 15 - 9
src/packages/pc/views/market/trade/goods/detail/components/order/index.vue

@@ -7,7 +7,7 @@
             <template #expand="{ row }">
                 <div class="buttonbar">
                     <el-button type="primary" size="small" :disabled="row.userid === loginStore.userId"
-                        @click="openComponent('delisting')">摘牌</el-button>
+                        @click="showComponent('delisting', row)">摘牌</el-button>
                 </div>
             </template>
         </app-table>
@@ -17,7 +17,7 @@
             <template #expand="{ row }">
                 <div class="buttonbar">
                     <el-button type="primary" size="small" :disabled="row.userid === loginStore.userId"
-                        @click="openComponent('delisting')">摘牌</el-button>
+                        @click="showComponent('delisting', row)">摘牌</el-button>
                 </div>
             </template>
         </app-table>
@@ -27,14 +27,13 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, defineAsyncComponent, onUnmounted } from 'vue'
+import { shallowRef, defineAsyncComponent, watch } from 'vue'
 import { useRequest } from '@/hooks/request'
 import { BuyOrSell } from '@/constants/order'
 import { useComponent } from '@/hooks/component'
 import { useComposeTable } from '@pc/components/base/table'
 import { queryWrTradeOrderDetail } from '@/services/api/transfer'
-import { useLoginStore } from '@/stores'
-import eventBus from '@/services/bus'
+import { useLoginStore, useFuturesStore } from '@/stores'
 import AppTable from '@pc/components/base/table/index.vue'
 
 const props = defineProps({
@@ -49,6 +48,9 @@ const componentMap = new Map<string, unknown>([
 ])
 
 const loginStore = useLoginStore()
+const futuresStore = useFuturesStore()
+const quote = futuresStore.getQuoteInfo(props.goodsId)
+
 const { rowKey, expandKeys, selectedRow, rowClick } = useComposeTable<Model.WrTradeOrderDetailRsp>({ rowKey: 'orderid' })
 const { componentRef, componentId, openComponent, closeComponent } = useComponent()
 
@@ -78,14 +80,18 @@ const sellColumns = shallowRef<Model.TableColumn[]>([
     { prop: 'username', label: '购买方' },
 ])
 
-// 接收资金变动通知
-const moneyChangedNotify = eventBus.$on('MoneyChangedNotify', () => {
+const showComponent = (componentName: string, row: Model.WrTradeOrderDetailRsp) => {
+    selectedRow.value = row
+    openComponent(componentName)
+}
+
+// 监听行情变动
+watch(() => quote.value, () => {
     getBuyList()
     getSellList()
 })
-
-onUnmounted(() => moneyChangedNotify.cancel())
 </script>
+
 <style lang="less">
 @import './index.less';
 </style>

+ 7 - 2
src/packages/pc/views/market/trade/spot/order/index.vue

@@ -48,7 +48,7 @@
                     <template #expand="{ row }">
                         <div class="buttonbar">
                             <el-button type="primary" size="small" :disabled="row.userid === loginStore.userId"
-                                @click="openComponent('delisting')">摘牌</el-button>
+                                @click="showComponent('delisting', row)">摘牌</el-button>
                         </div>
                     </template>
                 </app-table>
@@ -58,7 +58,7 @@
                     <template #expand="{ row }">
                         <div class="buttonbar">
                             <el-button type="primary" size="small" :disabled="row.userid === loginStore.userId"
-                                @click="openComponent('delisting')">摘牌</el-button>
+                                @click="showComponent('delisting', row)">摘牌</el-button>
                         </div>
                     </template>
                 </app-table>
@@ -140,6 +140,11 @@ const sellColumns = shallowRef<Model.TableColumn[]>([
     { prop: 'username', label: '购买方' },
 ])
 
+const showComponent = (componentName: string, row: Model.OrderQuoteDetailRsp) => {
+    quoteDetail.value = row
+    openComponent(componentName)
+}
+
 // 挂牌委托变更广播通知
 const listingOrderChangeNtf = eventBus.$on('ListingOrderChangeNtf', () => {
     getOrderQuote()