index.vue 4.8 KB

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