| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <template>
- <!--期货-->
- <div class="topTableHeight">
- <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">
- <template #index="{ index }">
- <span>{{index + 1}}</span>
- </template>
- </a-table>
- <ThridMenu :list="tabList" :selectedKey="index" @selectMenu="changeTab" />
- <!-- 右键 -->
- <contextMenu :contextMenu="contextMenu" @cancel="closeContext" :list="buttons"></contextMenu>
- <component :is="componentId" v-if="componentId" :tableList="tableList" :selectedRow="selectedRow" @cancel="closeComponent"></component>
- </div>
- </template>
- <script lang="ts">
- import { TabList } from '@/common/components/description/interface';
- import ThridMenu from '@/common/components/thirdMenu/index.vue';
- import { getShowBottomValue } from '@/common/config/constrolBottom';
- import { handleModalComponent } from '@/common/setup/asyncComponent';
- import { handleSubcriteOnDemandQuote } from '@/common/setup/table/tableQuote';
- import { QueryQuoteDayRsp } from '@/services/go/quote/interface';
- import { getColumnsList, useExternalexchange } from './setup';
- import { getTableButton } from '@/common/setup/table/button';
- import { contextMenu, defineAsyncComponent, defineComponent } from '@/common/export/commonTable';
- import { handleContextMenu } from '@/common/components/contextMenu/setup';
- import { TableEventCB } from '@/common/setup/table/interface';
- import { getTableEvent } from '@/common/export/table';
- import { ContextMenuTemp } from '@/common/components/contextMenu/interface';
- import { BtnListType } from '@/common/components/btnList/interface';
- export default defineComponent({
- name: 'spot_trade_order_transaction_swap',
- components: {
- ThridMenu,
- contextMenu,
- trade: defineAsyncComponent(() => import('./compoments/futures-trade/index.vue')),
- },
- setup() {
- const isBottom = getShowBottomValue();
- const buttons = getTableButton();
- console.log('buttons', buttons);
- const { index, loading, tabList, tableList, quoteList, hanldeQuoteData, hanldeTableData } = useExternalexchange();
- // 行情按需订阅
- let stopSubcribe = handleSubcriteOnDemandQuote<QueryQuoteDayRsp>(quoteList);
- hanldeTableData();
- function changeTab(index: number, current: TabList) {
- hanldeQuoteData(index);
- console.log(index, current);
- // 停止上次订阅
- stopSubcribe();
- // 重新发起订阅
- stopSubcribe = handleSubcriteOnDemandQuote<QueryQuoteDayRsp>(quoteList);
- hanldeTableData();
- }
- // 右键逻辑
- const { contextMenu, closeContext: closeContextAction } = handleContextMenu();
- // 右键回调函数
- const eventsCB: TableEventCB = {
- contextmenuCB: (record: QueryQuoteDayRsp, value: ContextMenuTemp) => {
- // 控制打开右键
- contextMenu.value = value;
- },
- };
- // 表格事件
- const { selectedRow, Rowclick } = getTableEvent<QueryQuoteDayRsp>(eventsCB);
- // 控制异步组件
- const { componentId, closeComponent, openComponent } = handleModalComponent(() => {}, selectedRow);
- // 关闭右键
- function closeContext(value: BtnListType | null) {
- // 打开对应的弹窗组件
- if (value) openComponent(value, selectedRow.value);
- // 关闭右键
- closeContextAction();
- }
- return {
- index,
- loading,
- tabList,
- changeTab,
- tableList,
- isBottom,
- getColumnsList,
- buttons,
- contextMenu,
- closeContext,
- Rowclick,
- componentId,
- closeComponent,
- selectedRow,
- };
- },
- });
- </script>
- <style lang="less">
- .noData {
- .position(absolute, 28px, 0, 0, 0);
- }
- .filter-custom-table {
- display: inline-flex;
- padding-top: 4px;
- height: 34px;
- .conditionSelect:first-child {
- margin-right: 10px;
- }
- .btnDeafault.ant-btn,
- .operBtn.ant-btn {
- height: 26px !important;
- line-height: 26px !important;
- }
- .ant-select-single:not(.ant-select-customize-input) + .ant-select-single:not(.ant-select-customize-input),
- .ant-select + .ant-space.ant-space-vertical {
- margin-left: 10px;
- }
- .ant-select-single:not(.ant-select-customize-input) {
- height: 26px;
- line-height: 26px !important;
- .ant-select-selector {
- height: 26px;
- border-color: @m-grey46 !important;
- background: @m-grey47;
- .rounded-corners(3px);
- .ant-select-selection-item {
- line-height: 26px;
- }
- .ant-select-selection-search {
- height: 26px;
- .ant-select-selection-search-input {
- height: 26px;
- line-height: 27px !important;
- }
- }
- .ant-select-selection-placeholder {
- line-height: 26px;
- }
- }
- }
- .allDatePicker.ant-calendar-picker {
- height: 26px !important;
- border: 1px solid @m-grey46 !important;
- .ant-calendar-picker-input.ant-input {
- height: 26px;
- line-height: 26px;
- &::placeholder {
- color: @m-grey10 !important;
- }
- }
- }
- .conditionSelect + .conditionSelect {
- margin-left: 10px;
- }
- }
- </style>
|