index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <!--期货-->
  3. <div class="topTableHeight">
  4. <a-table :columns="getColumnsList()" :class="['srcollYTable', isBottom ? 'condSecondTabTable' : 'condSecondTabTableNoBottom', tableList.length ? 'noPlaceHolder' : 'hasPlaceHolder']" :scroll="{ x: '100%', y: isBottom ? 'calc(100vh- 443px)' : 'calc(100vh - 196px)' }" :pagination="false" :loading="loading" :customRow="Rowclick" rowKey="goodscode" :data-source="tableList">
  5. <template #index="{ index }">
  6. <span>{{index + 1}}</span>
  7. </template>
  8. </a-table>
  9. <ThridMenu :list="tabList" :selectedKey="index" @selectMenu="changeTab" />
  10. <!-- 右键 -->
  11. <contextMenu :contextMenu="contextMenu" @cancel="closeContext" :list="buttons"></contextMenu>
  12. <component :is="componentId" v-if="componentId" :tableList="tableList" :selectedRow="selectedRow" @cancel="closeComponent"></component>
  13. </div>
  14. </template>
  15. <script lang="ts">
  16. import { TabList } from '@/common/components/description/interface';
  17. import ThridMenu from '@/common/components/thirdMenu/index.vue';
  18. import { getShowBottomValue } from '@/common/config/constrolBottom';
  19. import { handleModalComponent } from '@/common/setup/asyncComponent';
  20. import { handleSubcriteOnDemandQuote } from '@/common/setup/table/tableQuote';
  21. import { QueryQuoteDayRsp } from '@/services/go/quote/interface';
  22. import { getColumnsList, useExternalexchange } from './setup';
  23. import { getTableButton } from '@/common/setup/table/button';
  24. import { contextMenu, defineAsyncComponent, defineComponent } from '@/common/export/commonTable';
  25. import { handleContextMenu } from '@/common/components/contextMenu/setup';
  26. import { TableEventCB } from '@/common/setup/table/interface';
  27. import { getTableEvent } from '@/common/export/table';
  28. import { ContextMenuTemp } from '@/common/components/contextMenu/interface';
  29. import { BtnListType } from '@/common/components/btnList/interface';
  30. export default defineComponent({
  31. name: 'spot_trade_order_transaction_swap',
  32. components: {
  33. ThridMenu,
  34. contextMenu,
  35. trade: defineAsyncComponent(() => import('./compoments/futures-trade/index.vue')),
  36. },
  37. setup() {
  38. const isBottom = getShowBottomValue();
  39. const buttons = getTableButton();
  40. console.log('buttons', buttons);
  41. const { index, loading, tabList, tableList, quoteList, hanldeQuoteData, hanldeTableData } = useExternalexchange();
  42. // 行情按需订阅
  43. let stopSubcribe = handleSubcriteOnDemandQuote<QueryQuoteDayRsp>(quoteList);
  44. hanldeTableData();
  45. function changeTab(index: number, current: TabList) {
  46. hanldeQuoteData(index);
  47. console.log(index, current);
  48. // 停止上次订阅
  49. stopSubcribe();
  50. // 重新发起订阅
  51. stopSubcribe = handleSubcriteOnDemandQuote<QueryQuoteDayRsp>(quoteList);
  52. hanldeTableData();
  53. }
  54. // 右键逻辑
  55. const { contextMenu, closeContext: closeContextAction } = handleContextMenu();
  56. // 右键回调函数
  57. const eventsCB: TableEventCB = {
  58. contextmenuCB: (record: QueryQuoteDayRsp, value: ContextMenuTemp) => {
  59. // 控制打开右键
  60. contextMenu.value = value;
  61. },
  62. };
  63. // 表格事件
  64. const { selectedRow, Rowclick } = getTableEvent<QueryQuoteDayRsp>(eventsCB);
  65. // 控制异步组件
  66. const { componentId, closeComponent, openComponent } = handleModalComponent(() => {}, selectedRow);
  67. // 关闭右键
  68. function closeContext(value: BtnListType | null) {
  69. // 打开对应的弹窗组件
  70. if (value) openComponent(value, selectedRow.value);
  71. // 关闭右键
  72. closeContextAction();
  73. }
  74. return {
  75. index,
  76. loading,
  77. tabList,
  78. changeTab,
  79. tableList,
  80. isBottom,
  81. getColumnsList,
  82. buttons,
  83. contextMenu,
  84. closeContext,
  85. Rowclick,
  86. componentId,
  87. closeComponent,
  88. selectedRow,
  89. };
  90. },
  91. });
  92. </script>
  93. <style lang="less">
  94. .noData {
  95. .position(absolute, 28px, 0, 0, 0);
  96. }
  97. .filter-custom-table {
  98. display: inline-flex;
  99. padding-top: 4px;
  100. height: 34px;
  101. .conditionSelect:first-child {
  102. margin-right: 10px;
  103. }
  104. .btnDeafault.ant-btn,
  105. .operBtn.ant-btn {
  106. height: 26px !important;
  107. line-height: 26px !important;
  108. }
  109. .ant-select-single:not(.ant-select-customize-input) + .ant-select-single:not(.ant-select-customize-input),
  110. .ant-select + .ant-space.ant-space-vertical {
  111. margin-left: 10px;
  112. }
  113. .ant-select-single:not(.ant-select-customize-input) {
  114. height: 26px;
  115. line-height: 26px !important;
  116. .ant-select-selector {
  117. height: 26px;
  118. border-color: @m-grey46 !important;
  119. background: @m-grey47;
  120. .rounded-corners(3px);
  121. .ant-select-selection-item {
  122. line-height: 26px;
  123. }
  124. .ant-select-selection-search {
  125. height: 26px;
  126. .ant-select-selection-search-input {
  127. height: 26px;
  128. line-height: 27px !important;
  129. }
  130. }
  131. .ant-select-selection-placeholder {
  132. line-height: 26px;
  133. }
  134. }
  135. }
  136. .allDatePicker.ant-calendar-picker {
  137. height: 26px !important;
  138. border: 1px solid @m-grey46 !important;
  139. .ant-calendar-picker-input.ant-input {
  140. height: 26px;
  141. line-height: 26px;
  142. &::placeholder {
  143. color: @m-grey10 !important;
  144. }
  145. }
  146. }
  147. .conditionSelect + .conditionSelect {
  148. margin-left: 10px;
  149. }
  150. }
  151. </style>