index.vue 5.2 KB

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