huangbin 4 vuotta sitten
vanhempi
commit
b6ce1c1881
1 muutettua tiedostoa jossa 100 lisäystä ja 29 poistoa
  1. 100 29
      src/views/search/inventory/list/inventory_current/index.vue

+ 100 - 29
src/views/search/inventory/list/inventory_current/index.vue

@@ -3,24 +3,32 @@
   <div class="inventory_current"
        :loading="loading">
     <Filter @search="updateColumn">
-      <BtnList :btnList="firstBtn" />
     </Filter>
-    <contextMenu :contextMenuList="secondBtn">
-      <a-table :columns="columns"
+    <a-table :columns="columns"
+             class="topTable"
+             :pagination="false"
+             rowKey="key"
+             :expandedRowKeys="expandedRowKeys"
+             :customRow="Rowclick"
+             :data-source="tableList">
+    </a-table>
+    <!-- 明细 -->
+    <Description v-if="visible"
+                 @close="closeDrawer"
+                 @changeTab="changeTab"
+                 :tabList="tabList">
+      <a-table :columns="columnsDetail"
                class="topTable"
                :pagination="false"
                rowKey="key"
-               :expandedRowKeys="expandedRowKeys"
-               :customRow="Rowclick"
-               :data-source="tableList">
-        <!-- 额外的展开行 -->
-        <!-- <template #expandedRowRender="{  }">
-          <BtnList :btnList="secondBtn" />
+               :data-source="detailTableList"
+               :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }">
+        <!-- 类型 -->
+        <!-- <template #logtype="{ record }">
+          <span>{{ getLogType(record.logtype) }}</span>
         </template> -->
       </a-table>
-    </contextMenu>
-    <Add :selectedRow="selectedRow"
-         @refresh="queryTable" />
+    </Description>
   </div>
 </template>
 
@@ -31,6 +39,12 @@ import Add from '../../components/add/index.vue';
 
 import { getBizTypeName, getContractStatusName, getContractTypeName, getPriceTypeName } from '@/common/constants/enumsName';
 import { Ermcp3AreaStock, queryTableList } from './setup';
+import Description from '@/common/components/description/index.vue';
+import { ComposeTableDetailParam } from '@/common/setup/table/interface';
+import { EnumRouterName } from '@/common/constants/enumRouterName';
+import { handleComposeTable_detail } from '@/common/setup/table/compose';
+import { TabList } from '@/common/components/description/interface';
+import { watchEffect } from 'vue';
 
 export default defineComponent({
     name: 'inventory_current',
@@ -41,32 +55,89 @@ export default defineComponent({
         BtnList,
     },
     setup() {
-        // 表头数据
-        const { columns, registerColumn, updateColumn } = getTableColumns();
-        // 表格事件
-        const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3AreaStock>({});
-        // 表格操作按钮列表
-        const [firstBtn, secondBtn] = _getBtnList('inventory_current', false).value;
+        // // 表头数据
+        // const { columns, registerColumn, updateColumn } = getTableColumns();
+        // // 表格事件
+        // const { expandedRowKeys, selectedRow, Rowclick } = getTableEvent<Ermcp3AreaStock>({});
+        // // 表格操作按钮列表
+        // const [firstBtn, secondBtn] = _getBtnList('inventory_current', false).value;
+
         // 表格列表数据
         const { loading, tableList, queryTable } = queryTableList();
+        const param: ComposeTableDetailParam = {
+            queryFn: queryTable, // 查询表格数据
+            tableName: 'table_pcweb_current_inventory', // 表头key
+            tableFilterKey: ['deliverygoodsid', 'wrstandardid', 'spotgoodsbrandid', 'warehouseinfoid'], // 表格过滤字段
+            menuType: EnumRouterName.exposure_realtime, // 当前tab页对应的code
+        };
 
-        initData(() => {
-            // 获取列表数据
-            queryTable();
-            // 注册表头信息 过滤
-            registerColumn('table_pcweb_current_inventory', ['deliverygoodsid', 'wrstandardid', 'spotgoodsbrandid', 'warehouseinfoid']);
-        });
-        return {
+        const {
+            visible,
+            closeDrawer, // 控制 drawer 组件是否显示
             columns,
-
+            updateColumn, //  表头数据
+            columnsDetail,
+            registerColumnDetail,
+            detailTableList, // 明细表头数据
             expandedRowKeys,
             selectedRow,
-            Rowclick,
-            firstBtn,
-            secondBtn,
+            Rowclick, // 表格事件
+            tabList,
+        } = handleComposeTable_detail<Ermcp3AreaStock>(param);
+
+        // 切换明细
+        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;
+
+            //     queryResultLoadingAndInfo(fn, loading, { middlegoodsid: selectedRow.value?.MiddleGoodsID }).then((res) => {
+            //         detailTableList.value = res;
+            //     });
+            // } else if (code === 'exposure_realtime_futures_details') {
+            //     // 期货明细
+            //     // 注册表头
+            //     registerColumnDetail('table_pcweb_exposure_futures_detail', []);
+            //     fn = QueryAutualExposurePosition;
+            //     queryResultLoadingAndInfo(fn, loading, { middleGoodsId: selectedRow.value?.MiddleGoodsID }).then((res) => {
+            //         detailTableList.value = res;
+            //     });
+            // } else {
+            //     console.error(`${lable}没有配置对应的code: ${code},`);
+            //     return;
+            // }
+        }
+        watchEffect(() => {
+            if (visible.value) {
+                if (tabList.value.length) {
+                    changeTab(0, tabList.value[0]);
+                }
+            }
+        });
+        // initData(() => {
+        //     // 获取列表数据
+        //     queryTable();
+        //     // 注册表头信息 过滤
+        //     registerColumn('table_pcweb_current_inventory', ['deliverygoodsid', 'wrstandardid', 'spotgoodsbrandid', 'warehouseinfoid']);
+        // });
+        return {
             loading,
             tableList,
+            visible,
+            closeDrawer,
+            columns,
             updateColumn,
+            columnsDetail,
+            detailTableList,
+            expandedRowKeys,
+            selectedRow,
+            Rowclick,
+            tabList,
+            changeTab,
             queryTable,
             getBizTypeName,
             getPriceTypeName,