huangbin 4 年之前
父节点
当前提交
8fcf1cfcad

+ 2 - 1
src/common/setup/table/compose.ts

@@ -1,12 +1,13 @@
 import { BtnList } from '@/common/components/btnList/interface';
 import { ContextMenuTemp } from "@/common/components/contextMenu/interface";
 import { handleContextMenu } from "@/common/components/contextMenu/setup";
+import { TabList } from '@/common/components/description/interface';
 import { getTableColumns, getTableEvent, initData } from "@/common/export/table";
 import { handleModalComponent } from '@/common/setup/asyncComponent';
 import { onUnmounted, ref, Ref } from "vue";
 import { getBtnList_, getThirdMenuData } from "./button";
 import { handleTableDrawer } from "./drawer";
-import { ComposeTableDetailParam, ComposeTableParam, TableEventCB, TabList } from "./interface";
+import { ComposeTableDetailParam, ComposeTableParam, TableEventCB } from "./interface";
 
 export type { ComposeTableParam, ComposeTableDetailParam };
 

+ 1 - 5
src/common/setup/table/interface.ts

@@ -31,13 +31,9 @@ export interface ComposeTableDetailParam {
     queryFn: Function,  // 查询表格数据
     tableName: keyof TableKey, // 表头key
     tableFilterKey: string[], // 表格过滤字段
-    menuType?: keyof ButtonListKey
+    menuType: keyof ButtonListKey
 }
 
-export interface TabList {
-    lable: string,
-    code: string
-}
 export interface ButtonListKey {
     custom_info_normal: string; // 客户资料 正常
     custom_info_disabled: string; // 客户资料 停用

+ 20 - 10
src/views/business/exposure/list/futures/index.vue

@@ -29,6 +29,7 @@ import { ErmcpHedgePosition } from '@/services/go/ermcp/exposure/interface';
 import { queryTableList } from '@/common/setup/table';
 import { ComposeTableDetailParam } from '@/common/setup/table/interface';
 import { handleComposeTable_detail } from '@/common/setup/table/compose';
+import { TabList } from '@/common/components/description/interface';
 import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import Description from '@/common/components/description/index.vue';
 
@@ -47,6 +48,7 @@ export default defineComponent({
             queryFn: queryTableAction, // 查询表格数据
             tableName: 'table_pcweb_exposure_futuresposition', // 表头key
             tableFilterKey: ['MiddleGoodsName'], // 表格过滤字段
+            menuType: 'exposure_futures', // 当前tab页对应的code
         };
         const {
             visible,
@@ -59,24 +61,32 @@ export default defineComponent({
             expandedRowKeys,
             selectedRow,
             Rowclick, // 表格事件
+            tabList,
         } = handleComposeTable_detail<ErmcpHedgePosition>(param);
 
-        // 明细
-        const tabList = [{ lable: '期货明细' }];
-        // 期货明细信息
-        function AEDetail() {
-            // 注册表头
-            registerColumnDetail('table_pcweb_exposure_futuresposition', []);
-            const goodsId = selectedRow.value?.goodsid;
-            if (goodsId) {
-                queryResultLoadingAndInfo(QueryExposureHedgePositionDetail, loading, { goodsId }).then((res) => {
+        // 切换明细
+        function changeTab(index: number, current: TabList) {
+            const { code, lable } = current;
+            if (code === 'exposure_futures_details') {
+                // 现货明细
+                // 注册表头
+                registerColumnDetail('table_pcweb_exposure_futuresposition', []);
+            } else {
+                console.error(`${lable}没有配置对应的code: ${code},`);
+                return;
+            }
+            const goodsid = selectedRow.value?.goodsid;
+            if (goodsid) {
+                queryResultLoadingAndInfo(QueryExposureHedgePositionDetail, loading, { goodsid }).then((res) => {
                     detailTableList.value = res;
                 });
             }
         }
         watchEffect(() => {
             if (visible.value) {
-                AEDetail();
+                if (tabList.value.length) {
+                    changeTab(0, tabList.value[0]);
+                }
             }
         });
         return { loading, tableList, visible, closeDrawer, columns, updateColumn, columnsDetail, detailTableList, expandedRowKeys, selectedRow, Rowclick, tabList };

+ 24 - 22
src/views/business/exposure/list/realTime/index.vue

@@ -28,10 +28,10 @@ import { defineComponent, watchEffect } from 'vue';
 import filterCustomTable from '../../components/filterTable/index.vue';
 import { QueryActualExposure, QueryActualExposureDetail, QueryAutualExposurePosition } from '@/services/go/ermcp/exposure/index';
 import { ErmcpRealExposureModel } from '@/services/go/ermcp/exposure/interface';
-import BtnList from '@/common/components/buttonList/index.vue';
 import Description from '@/common/components/description/index.vue';
 import { queryTableList } from '@/common/setup/table';
 import { ComposeTableDetailParam } from '@/common/setup/table/interface';
+import { TabList } from '@/common/components/description/interface';
 import { handleComposeTable_detail } from '@/common/setup/table/compose';
 import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 
@@ -50,6 +50,7 @@ export default defineComponent({
             queryFn: queryTableAction, // 查询表格数据
             tableName: 'table_pcweb_exposure', // 表头key
             tableFilterKey: ['MiddleGoodsName'], // 表格过滤字段
+            menuType: 'exposure_realtime', // 当前tab页对应的code
         };
         const {
             visible,
@@ -62,38 +63,39 @@ export default defineComponent({
             expandedRowKeys,
             selectedRow,
             Rowclick, // 表格事件
+            tabList,
         } = handleComposeTable_detail<ErmcpRealExposureModel>(param);
-        const tabList = [{ lable: '现货明细' }, { lable: '期货明细' }];
 
-        // 现货明细信息
-        function AEDetail() {
-            // 注册表头
-            registerColumnDetail('table_pcweb_exposure_detail', []);
-            const middlegoodsid = selectedRow.value?.MiddleGoodsID;
-            if (middlegoodsid) {
-                queryResultLoadingAndInfo(QueryActualExposureDetail, loading, { middlegoodsid }).then((res) => {
-                    detailTableList.value = res;
-                });
+        // 切换明细
+        function changeTab(index: number, current: TabList) {
+            const { code, lable } = current;
+            let fn = null;
+            if (code === 'exposure_realtime_spot_details') {
+                // 现货明细信息
+                // 注册表头
+                registerColumnDetail('table_pcweb_exposure_detail', []);
+                fn = QueryActualExposureDetail;
+            } else if (code === 'exposure_realtime_futures_details') {
+                // 期货明细
+                // 注册表头
+                registerColumnDetail('table_pcweb_exposure_futures_detail', []);
+                fn = QueryAutualExposurePosition;
+            } else {
+                console.error(`${lable}没有配置对应的code: ${code},`);
+                return;
             }
-        }
-        // 期货头寸明细
-        function AEPostion() {
-            // 注册表头
-            registerColumnDetail('table_pcweb_exposure_futures_detail', []);
             const middlegoodsid = selectedRow.value?.MiddleGoodsID;
             if (middlegoodsid) {
-                queryResultLoadingAndInfo(QueryAutualExposurePosition, loading, { middlegoodsid }).then((res) => {
+                queryResultLoadingAndInfo(fn, loading, { middlegoodsid }).then((res) => {
                     detailTableList.value = res;
                 });
             }
         }
-        // 切换明细
-        function changeTab(index: number) {
-            index ? AEPostion() : AEDetail();
-        }
         watchEffect(() => {
             if (visible.value) {
-                AEDetail();
+                if (tabList.value.length) {
+                    changeTab(0, tabList.value[0]);
+                }
             }
         });
 

+ 20 - 8
src/views/business/exposure/list/spot/index.vue

@@ -15,6 +15,7 @@
     <!-- 明细 -->
     <Description v-if="visible"
                  @close="closeDrawer"
+                 @changeTab="changeTab"
                  :columns="columnsDetail"
                  :tabList="tabList"
                  :tableList="detailTableList" />
@@ -30,6 +31,7 @@ import { ComposeTableDetailParam, handleComposeTable_detail } from '@/common/set
 import { queryTableList } from '@/common/setup/table';
 import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import Description from '@/common/components/description/index.vue';
+import { TabList } from '@/common/components/description/interface';
 
 export default defineComponent({
     name: 'exposure-spot',
@@ -46,6 +48,7 @@ export default defineComponent({
             queryFn: queryTableAction, // 查询表格数据
             tableName: 'table_pcweb_exposure_spotposition', // 表头key
             tableFilterKey: ['MiddleGoodsName'], // 表格过滤字段
+            menuType: 'exposure_spot', // 当前tab页对应的code
         };
         const {
             visible,
@@ -58,13 +61,20 @@ export default defineComponent({
             expandedRowKeys,
             selectedRow,
             Rowclick, // 表格事件
+            tabList,
         } = handleComposeTable_detail<Ermcp3AreaSpot>(param);
-        // 明细
-        const tabList = [{ lable: '现货明细' }];
-        // 现货明细信息
-        function AEDetail() {
-            // 注册表头
-            registerColumnDetail('table_pcweb_exposure_spotposition', []);
+
+        // 切换明细
+        function changeTab(index: number, current: TabList) {
+            const { code, lable } = current;
+            if (code === 'exposure_spot_details') {
+                // 现货明细
+                // 注册表头
+                registerColumnDetail('table_pcweb_exposure_spotposition', []);
+            } else {
+                console.error(`${lable}没有配置对应的code: ${code},`);
+                return;
+            }
             const deliverygoodsid = selectedRow.value?.deliverygoodsid;
             if (deliverygoodsid) {
                 queryResultLoadingAndInfo(QuerySpotPositionDetail, loading, { deliverygoodsid }).then((res) => {
@@ -74,10 +84,12 @@ export default defineComponent({
         }
         watchEffect(() => {
             if (visible.value) {
-                AEDetail();
+                if (tabList.value.length) {
+                    changeTab(0, tabList.value[0]);
+                }
             }
         });
-        return { loading, tableList, visible, closeDrawer, columns, updateColumn, columnsDetail, detailTableList, expandedRowKeys, selectedRow, Rowclick, tabList };
+        return { loading, tableList, visible, closeDrawer, columns, changeTab, updateColumn, columnsDetail, detailTableList, expandedRowKeys, selectedRow, Rowclick, tabList };
     },
 });
 </script>

+ 1 - 1
src/views/report/exposure-report/list/exposure_report/index.vue

@@ -33,7 +33,7 @@ import { ComposeTableDetailParam, handleComposeTable_detail } from '@/common/set
 import Description from '@/common/components/description/index.vue';
 import { watchEffect } from 'vue';
 import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
-import { TabList } from '@/common/setup/table/interface';
+import { TabList } from '@/common/components/description/interface';
 
 export default defineComponent({
     name: 'exposure-report',

+ 1 - 1
src/views/report/finance-report/list/finance_report_finance/index.vue

@@ -31,7 +31,7 @@ import { Ermcp3FinanceReport, FinanceReportReq } from '@/services/go/ermcp/repor
 import { qryFinanceReport } from '@/services/go/ermcp/report';
 import { ComposeTableDetailParam, handleComposeTable_detail } from '@/common/setup/table/compose';
 import Description from '@/common/components/description/index.vue';
-import { TabList } from '@/common/setup/table/interface';
+import { TabList } from '@/common/components/description/interface';
 import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { watchEffect } from 'vue';
 

+ 1 - 1
src/views/report/future_report/list/future_report/index.vue

@@ -33,7 +33,7 @@ import { handleInitTypeAndTime } from '@/views/report/setup';
 import { qryTaFutureDataReport } from '@/services/go/ermcp/report';
 import { Ermcp3TaFutuReDataReport, QryTaFutureDataReportReq } from '@/services/go/ermcp/report/interface';
 import { TypeAndTime } from '@/views/report/interface';
-import { TabList } from '@/common/setup/table/interface';
+import { TabList } from '@/common/components/description/interface';
 
 export default defineComponent({
     name: 'inventory_report_inventory_category',

+ 1 - 1
src/views/report/inventory-report/list/category/index.vue

@@ -33,7 +33,7 @@ import { handleInitTypeAndTime } from '@/views/report/setup';
 import { qryAreaStockReport } from '@/services/go/ermcp/report';
 import { AreaStockReportReq, Ermcp3AreaStockReport } from '@/services/go/ermcp/report/interface';
 import { TypeAndTime } from '@/views/report/interface';
-import { TabList } from '@/common/setup/table/interface';
+import { TabList } from '@/common/components/description/interface';
 
 export default defineComponent({
     name: 'inventory_report_inventory_category',

+ 1 - 1
src/views/report/inventory-report/list/warehouse/index.vue

@@ -33,7 +33,7 @@ import { handleInitTypeAndTime } from '@/views/report/setup';
 import { qryAreaStockReport } from '@/services/go/ermcp/report';
 import { AreaStockReportReq, Ermcp3AreaStockReport } from '@/services/go/ermcp/report/interface';
 import { TypeAndTime } from '@/views/report/interface';
-import { TabList } from '@/common/setup/table/interface';
+import { TabList } from '@/common/components/description/interface';
 
 export default defineComponent({
     name: 'inventory_report_warehouse',

+ 1 - 1
src/views/report/spot-report/list/spot_report/index.vue

@@ -33,7 +33,7 @@ import { ComposeTableDetailParam, handleComposeTable_detail } from '@/common/set
 import Description from '@/common/components/description/index.vue';
 import { watchEffect } from 'vue';
 import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
-import { TabList } from '@/common/setup/table/interface';
+import { TabList } from '@/common/components/description/interface';
 
 export default defineComponent({
     name: 'spot-report',

+ 1 - 1
src/views/report/sum_pl_report/list/sum_pl_report/index.vue

@@ -33,7 +33,7 @@ import { TypeAndTime } from '@/views/report/interface';
 import { handleInitTypeAndTime } from '@/views/report/setup';
 import { Ermcp3ArealSumPL, QryAreaSumPLReq } from '@/services/go/ermcp/report/interface';
 import { qryAreaSumPL } from '@/services/go/ermcp/report';
-import { TabList } from '@/common/setup/table/interface';
+import { TabList } from '@/common/components/description/interface';
 export default defineComponent({
     name: 'sum_pl_report',
     components: {