|
|
@@ -1,70 +1,125 @@
|
|
|
<template>
|
|
|
- <!-- 库存报表(品类) -->
|
|
|
- <div class="spot-report"
|
|
|
+ <!-- 库存报表(仓库) -->
|
|
|
+ <div class="table-detail-container table-height"
|
|
|
:loading="loading">
|
|
|
- <Filter @update="update"></Filter>
|
|
|
- <contextMenu :contextMenuList="forDataBtn">
|
|
|
- <a-table :columns="columns"
|
|
|
- class="topOrderTable"
|
|
|
- :pagination="false"
|
|
|
- :expandedRowKeys="expandedRowKeys"
|
|
|
- :customRow="Rowclick"
|
|
|
- rowKey="key"
|
|
|
- :data-source="tableList"
|
|
|
- :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }">
|
|
|
- </a-table>
|
|
|
- </contextMenu>
|
|
|
+ <Filter @update="search"></Filter>
|
|
|
+ <a-table :columns="columns"
|
|
|
+ class="topOrderTable"
|
|
|
+ :scroll="{ x: '100%', y: 'calc(100vh - 163px)' }"
|
|
|
+ :pagination="false"
|
|
|
+ :expandedRowKeys="expandedRowKeys"
|
|
|
+ :customRow="Rowclick"
|
|
|
+ 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 Filter from '../../components/filterTable/index.vue';
|
|
|
-import { defineComponent, initData, getTableColumns, getTableEvent, getBtnList, contextMenu, BtnList } from '@/common/export/table';
|
|
|
-import { queryTableList } from '../../../setup';
|
|
|
+import { defineComponent, queryTableList } from '@/common/export/table';
|
|
|
+import { ComposeTableDetailParam, handleComposeTable_detail } from '@/common/setup/table/compose';
|
|
|
+import Description from '@/common/components/description/index.vue';
|
|
|
+import { watchEffect } from 'vue';
|
|
|
+import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
|
|
|
import { handleInitTypeAndTime } from '@/views/report/setup';
|
|
|
-import { qryAreaSpotplReport, qryAreaStockReport } from '@/services/go/ermcp/report';
|
|
|
-import { Ermcp3AreaSpotPLReport, Ermcp3AreaStockReport } from '@/services/go/ermcp/report/interface';
|
|
|
+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';
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'inventory_report_warehouse',
|
|
|
components: {
|
|
|
Filter,
|
|
|
- contextMenu,
|
|
|
- BtnList,
|
|
|
+ Description,
|
|
|
},
|
|
|
setup() {
|
|
|
- // 表头数据
|
|
|
- const { columns, registerColumn, updateColumn } = getTableColumns();
|
|
|
- // 表格事件
|
|
|
- const { expandedRowKeys, selectedRow, Rowclick, btnClick } = getTableEvent<any>({});
|
|
|
- // // 表格操作按钮列表
|
|
|
- // const { commonBtn, forDataBtn } = getBtnList('warehouse_info_normal', true);
|
|
|
+ let cycletime = '';
|
|
|
// 表格列表数据
|
|
|
- const { loading, tableList, queryTable } = queryTableList<Ermcp3AreaStockReport>(qryAreaStockReport);
|
|
|
- initData(() => {
|
|
|
+ const { loading, tableList, queryTable } = queryTableList<Ermcp3AreaStockReport>();
|
|
|
+ // 获取列表数据
|
|
|
+ const queryTableAction = () => {
|
|
|
const { getInitTime, getInitType } = handleInitTypeAndTime();
|
|
|
+ cycletime = getInitTime();
|
|
|
+ const param: AreaStockReportReq = {
|
|
|
+ cycletype: getInitType(),
|
|
|
+ cycletime,
|
|
|
+ querytype: 1,
|
|
|
+ sumfields: '1,2,4',
|
|
|
+ };
|
|
|
// 获取列表数据
|
|
|
- queryTable({ cycletype: getInitType(), cycletime: getInitTime() }, { sumfields: '1,2,4' });
|
|
|
- // 注册表头信息 过滤
|
|
|
- registerColumn('table_pcweb_warehouse_report', []);
|
|
|
- });
|
|
|
- function update(value: TypeAndTime) {
|
|
|
- queryTable(value, { sumfields: '1,2,4' });
|
|
|
- }
|
|
|
-
|
|
|
- return {
|
|
|
+ queryTable(qryAreaStockReport, param);
|
|
|
+ };
|
|
|
+ const param: ComposeTableDetailParam = {
|
|
|
+ queryFn: queryTableAction, // 查询表格数据
|
|
|
+ tableName: 'table_pcweb_warehouse_report', // 表头key
|
|
|
+ tableFilterKey: [], // 表格过滤字段
|
|
|
+ menuType: 'inventory_report_warehouse',
|
|
|
+ };
|
|
|
+ const {
|
|
|
+ visible,
|
|
|
+ closeDrawer, // 控制 drawer 组件是否显示
|
|
|
columns,
|
|
|
-
|
|
|
+ updateColumn, // 表头数据
|
|
|
+ columnsDetail,
|
|
|
+ registerColumnDetail,
|
|
|
+ detailTableList, // 明细表头数据
|
|
|
expandedRowKeys,
|
|
|
selectedRow,
|
|
|
- Rowclick,
|
|
|
- loading,
|
|
|
- tableList,
|
|
|
- queryTable,
|
|
|
- btnClick,
|
|
|
- update,
|
|
|
- };
|
|
|
+ Rowclick, // 表格事件
|
|
|
+ tabList,
|
|
|
+ } = handleComposeTable_detail<Ermcp3AreaStockReport>(param);
|
|
|
+ // 切换明细
|
|
|
+ function changeTab(index: number, current: TabList) {
|
|
|
+ const { code, lable } = current;
|
|
|
+ const data = selectedRow.value as Ermcp3AreaStockReport;
|
|
|
+ const { cycletype, deliverygoodsid, wrstandardid, spotgoodsbrandid, warehouseinfoid } = data;
|
|
|
+
|
|
|
+ const param: AreaStockReportReq = {
|
|
|
+ querytype: 2,
|
|
|
+ cycletype,
|
|
|
+ cycletime,
|
|
|
+ sumfields: '1,2,4',
|
|
|
+ deliverygoodsid,
|
|
|
+ wrstandardid,
|
|
|
+ spotgoodsbrandid,
|
|
|
+ warehouseinfoid,
|
|
|
+ };
|
|
|
+ if (code === 'inventory_report_warehouse_inventory_detail') {
|
|
|
+ // 库存明细
|
|
|
+ // 注册表头
|
|
|
+ registerColumnDetail('table_pcweb_inventory_warehouse_report_warehouse_details', []);
|
|
|
+ } else {
|
|
|
+ console.error(`${lable}没有配置对应的code: ${code},`);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 查询明细数据
|
|
|
+ queryResultLoadingAndInfo(qryAreaStockReport, loading, param).then((res) => {
|
|
|
+ detailTableList.value = res;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ watchEffect(() => {
|
|
|
+ if (visible.value) {
|
|
|
+ if (tabList.value.length) {
|
|
|
+ changeTab(0, tabList.value[0]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ function search(value: TypeAndTime) {
|
|
|
+ cycletime = value.cycletime;
|
|
|
+ const obj = Object.assign(value, { querytype: 1, sumfields: '1,2,4' });
|
|
|
+ queryTable(qryAreaStockReport, obj);
|
|
|
+ }
|
|
|
+
|
|
|
+ return { loading, tableList, visible, closeDrawer, columns, updateColumn, search, columnsDetail, detailTableList, expandedRowKeys, selectedRow, Rowclick, tabList, changeTab };
|
|
|
},
|
|
|
});
|
|
|
</script>
|