|
|
@@ -3,150 +3,39 @@
|
|
|
<div class="exposure-real-time table-height"
|
|
|
:loading="loading">
|
|
|
<filterCustomTable @search="updateColumn">
|
|
|
- <BtnList :btnList="commonBtn" />
|
|
|
</filterCustomTable>
|
|
|
- <contextMenu :contextMenuList="forDataBtn">
|
|
|
- <a-table :columns="columns"
|
|
|
- class="topTable"
|
|
|
- :expandedRowKeys="expandedRowKeys"
|
|
|
- :customRow="Rowclick"
|
|
|
- :pagination="false"
|
|
|
- rowKey="key"
|
|
|
- :data-source="tableList">
|
|
|
- </a-table>
|
|
|
- </contextMenu>
|
|
|
- <Description v-if="visibleComponent"
|
|
|
- @close="closeComponent"
|
|
|
- :tabList="tabList" />
|
|
|
- <!-- <a-drawer placement="bottom"
|
|
|
- :closable="false"
|
|
|
- :visible="true"
|
|
|
- :get-container="false"
|
|
|
- :wrap-style="{ position: 'absolute' }"
|
|
|
- @close="closeDrawer">
|
|
|
- <div class="bottomTable">
|
|
|
- <a-table :columns="detailColumns"
|
|
|
- class="topTable"
|
|
|
- :pagination="false"
|
|
|
- rowKey="key"
|
|
|
- :data-source="detailTableList">
|
|
|
- </a-table>
|
|
|
- <ThridMenu :list="tabList"
|
|
|
- @selectMenu="selectMenu" />
|
|
|
- </div>
|
|
|
- </a-drawer> -->
|
|
|
+ <a-table :columns="columns"
|
|
|
+ class="topTable"
|
|
|
+ :expandedRowKeys="expandedRowKeys"
|
|
|
+ :customRow="Rowclick"
|
|
|
+ :pagination="false"
|
|
|
+ rowKey="key"
|
|
|
+ :data-source="tableList">
|
|
|
+ </a-table>
|
|
|
+ <!-- 明细 -->
|
|
|
+ <Description v-if="visible"
|
|
|
+ @close="closeDrawer"
|
|
|
+ @changeTab="changeTab"
|
|
|
+ :columns="columnsDetail"
|
|
|
+ :tabList="tabList"
|
|
|
+ :tableList="detailTableList" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
-import { defineComponent, Ref, ref, unref } from 'vue';
|
|
|
-import { initData } from '@/common/methods';
|
|
|
+import { defineComponent, watchEffect } from 'vue';
|
|
|
import filterCustomTable from '../../components/filterTable/index.vue';
|
|
|
-import { getBtnList } from '@/common/setup/contextMenu/index';
|
|
|
import contextMenu from '@/common/components/contextMenu/index.vue';
|
|
|
-import { getColumsAndSearch } from '../setup';
|
|
|
import { QueryActualExposure, QueryActualExposureDetail, QueryAutualExposurePosition } from '@/services/go/ermcp/exposure/index';
|
|
|
-import { ErmcpRealExposureModel, Ermcp3ExposureDetail, ErmcpExposurePostion, ErmcpExposurePostionReq, Ermcp3ExposureReq } from '@/services/go/ermcp/exposure/interface';
|
|
|
-import { message } from 'ant-design-vue';
|
|
|
-import { handleTableEvent } from '@/common/setup/event/index';
|
|
|
+import { ErmcpRealExposureModel } from '@/services/go/ermcp/exposure/interface';
|
|
|
import ThridMenu from '@/common/components/thirdMenu/index.vue';
|
|
|
-import { ColumnType } from '@/common/methods/table';
|
|
|
-import { TableKey } from '@/common/methods/table/interface';
|
|
|
import BtnList from '@/common/components/buttonList/index.vue';
|
|
|
import Description from '@/common/components/description/index.vue';
|
|
|
-import { handleControlComponentsIsShow } from '@/common/setup/control';
|
|
|
-import { getTableColumns, getTableEvent, queryTableList } from '@/common/setup/table';
|
|
|
-import { TableEventCB } from '@/common/setup/table/interface';
|
|
|
+import { queryTableList } from '@/common/setup/table';
|
|
|
+import { ComposeTableDetailParam } from '@/common/setup/table/interface';
|
|
|
+import { handleComposeTable_detail } from '@/common/setup/table/compose';
|
|
|
+import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
|
|
|
|
|
|
-// 获取表格数据
|
|
|
-function getExposure() {
|
|
|
- const loading = ref<boolean>(false);
|
|
|
- const tableList = ref<ErmcpRealExposureModel[]>([]);
|
|
|
- function queryList() {
|
|
|
- QueryActualExposure()
|
|
|
- .then((res) => {
|
|
|
- tableList.value = res.map((e, i) => {
|
|
|
- return { ...e, key: String(i) };
|
|
|
- });
|
|
|
- loading.value = false;
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- message.error(err);
|
|
|
- loading.value = false;
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- return { loading, tableList, queryList };
|
|
|
-}
|
|
|
-
|
|
|
-// 控制是否打开明细
|
|
|
-function handleDrawer() {
|
|
|
- const visible = ref<boolean>(true);
|
|
|
- function closeDrawer() {
|
|
|
- visible.value = !visible.value;
|
|
|
- }
|
|
|
- return { visible, closeDrawer };
|
|
|
-}
|
|
|
-
|
|
|
-// 明细
|
|
|
-function handleDeatil(loading: Ref<boolean>, selectedRow: ErmcpRealExposureModel) {
|
|
|
- const tabList = [{ lable: '现货明细' }, { lable: '期货明细' }];
|
|
|
- const detailTableList = ref<Ermcp3ExposureDetail[] | ErmcpExposurePostion[]>([]);
|
|
|
- const detailColumns = ref<ColumnType[]>([]);
|
|
|
- // 切换明细
|
|
|
- function selectMenu(index: number) {
|
|
|
- let tableKey: keyof TableKey = 'table_pcweb_exposure_detail';
|
|
|
- if (index) {
|
|
|
- AutualExposurePosition(); // 现货明细
|
|
|
- } else {
|
|
|
- ActualExposureDetail(); // 期货明细
|
|
|
- tableKey = 'table_pcweb_exposure_futures_detail';
|
|
|
- }
|
|
|
- const { columns, getColumns } = getColumsAndSearch(tableKey, false);
|
|
|
- getColumns();
|
|
|
- detailColumns.value = columns.value;
|
|
|
- }
|
|
|
- selectMenu(0);
|
|
|
- // 现货明细信息
|
|
|
- function ActualExposureDetail() {
|
|
|
- loading.value = true;
|
|
|
- let param: Ermcp3ExposureReq = {
|
|
|
- middlegoodsid: unref(selectedRow).MiddleGoodsID,
|
|
|
- };
|
|
|
- if (undefined !== unref(selectedRow).MiddleGoodsID) {
|
|
|
- QueryActualExposureDetail(param)
|
|
|
- .then((res) => {
|
|
|
- detailTableList.value = res.map((e, i) => {
|
|
|
- return { ...e, key: String(i) };
|
|
|
- });
|
|
|
- loading.value = false;
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- message.error(err);
|
|
|
- loading.value = false;
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- // 期货头寸明细
|
|
|
- function AutualExposurePosition() {
|
|
|
- loading.value = true;
|
|
|
- let param: ErmcpExposurePostionReq = {
|
|
|
- middlegoodsid: unref(selectedRow).MiddleGoodsID,
|
|
|
- };
|
|
|
- if (undefined !== unref(selectedRow).MiddleGoodsID) {
|
|
|
- QueryAutualExposurePosition(param).then((res) => {
|
|
|
- detailTableList.value = res.map((e, i) => {
|
|
|
- return { ...e, key: String(i) };
|
|
|
- });
|
|
|
- loading.value = false;
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- return { tabList, selectMenu, detailTableList, detailColumns };
|
|
|
-}
|
|
|
-interface Value extends ErmcpRealExposureModel {
|
|
|
- key: string;
|
|
|
-}
|
|
|
export default defineComponent({
|
|
|
name: 'exposure-real-time',
|
|
|
components: {
|
|
|
@@ -157,31 +46,62 @@ export default defineComponent({
|
|
|
BtnList,
|
|
|
},
|
|
|
setup() {
|
|
|
- // 控制是否加载组件
|
|
|
- const { visibleComponent, openComponent, closeComponent } = handleControlComponentsIsShow();
|
|
|
- const { visible, closeDrawer } = handleDrawer();
|
|
|
- // 表头数据
|
|
|
- const { columns, registerColumn, updateColumn } = getTableColumns();
|
|
|
- // const { columns, search, getColumns } = getColumsAndSearch('table_pcweb_exposure', true);
|
|
|
-
|
|
|
- // const { expandedRowKeys, selectedRow, Rowclick } = handleTableEvent<ErmcpRealExposureModel>(closeDrawer);
|
|
|
- const events: TableEventCB = {
|
|
|
- clickCB: (value: Value) => {
|
|
|
- openComponent();
|
|
|
- },
|
|
|
- };
|
|
|
- const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<ErmcpRealExposureModel>(events);
|
|
|
// 表格列表数据
|
|
|
const { loading, tableList, queryTable } = queryTableList<ErmcpRealExposureModel>();
|
|
|
- // const { loading, tableList, queryList } = getExposure();
|
|
|
- const { commonBtn, forDataBtn } = getBtnList('exposure_realtime', false);
|
|
|
+ // 获取列表数据
|
|
|
+ const queryTableAction = () => queryTable(QueryActualExposure);
|
|
|
+ const param: ComposeTableDetailParam = {
|
|
|
+ queryFn: queryTableAction, // 查询表格数据
|
|
|
+ tableName: 'table_pcweb_exposure', // 表头key
|
|
|
+ tableFilterKey: [], // 表格过滤字段
|
|
|
+ };
|
|
|
+ const {
|
|
|
+ visible,
|
|
|
+ closeDrawer, // 控制 drawer 组件是否显示
|
|
|
+ columns,
|
|
|
+ updateColumn, // 表头数据
|
|
|
+ columnsDetail,
|
|
|
+ registerColumnDetail,
|
|
|
+ detailTableList, // 明细表头数据
|
|
|
+ expandedRowKeys,
|
|
|
+ selectedRow,
|
|
|
+ Rowclick, // 表格事件
|
|
|
+ } = handleComposeTable_detail<ErmcpRealExposureModel>(param);
|
|
|
+ const tabList = [{ lable: '现货明细' }, { lable: '期货明细' }];
|
|
|
|
|
|
- initData(() => {
|
|
|
- queryTable(QueryActualExposure);
|
|
|
- registerColumn('table_pcweb_exposure', []);
|
|
|
- // getColumns();
|
|
|
+ // 现货明细信息
|
|
|
+ function AEDetail() {
|
|
|
+ // 注册表头
|
|
|
+ registerColumnDetail('table_pcweb_exposure_detail', []);
|
|
|
+ const middlegoodsid = selectedRow.value?.MiddleGoodsID;
|
|
|
+ if (middlegoodsid) {
|
|
|
+ queryResultLoadingAndInfo(QueryActualExposureDetail, loading, { middlegoodsid }).then((res) => {
|
|
|
+ detailTableList.value = res;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 期货头寸明细
|
|
|
+ function AEPostion() {
|
|
|
+ // 注册表头
|
|
|
+ registerColumnDetail('table_pcweb_exposure_futures_detail', []);
|
|
|
+ const middlegoodsid = selectedRow.value?.MiddleGoodsID;
|
|
|
+ if (middlegoodsid) {
|
|
|
+ queryResultLoadingAndInfo(QueryAutualExposurePosition, loading, { middlegoodsid }).then((res) => {
|
|
|
+ detailTableList.value = res;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 切换明细
|
|
|
+ function changeTab(index: number) {
|
|
|
+ index ? AEPostion() : AEDetail();
|
|
|
+ }
|
|
|
+ watchEffect(() => {
|
|
|
+ if (visible.value) {
|
|
|
+ AEDetail();
|
|
|
+ }
|
|
|
});
|
|
|
- return { commonBtn, forDataBtn, loading, tableList, visible, closeDrawer, columns, updateColumn, closeComponent, expandedRowKeys, visibleComponent, selectedRow, Rowclick, ...handleDeatil(loading, (selectedRow as unknown) as ErmcpRealExposureModel) };
|
|
|
+
|
|
|
+ return { loading, tableList, visible, closeDrawer, columns, updateColumn, columnsDetail, detailTableList, expandedRowKeys, selectedRow, Rowclick, tabList, changeTab };
|
|
|
},
|
|
|
});
|
|
|
</script>
|