Browse Source

feat: 报工单增加导出功能

xyh 2 years ago
parent
commit
d9fc6d707b

+ 10 - 0
packages/app/src/apis/semiManufactures.ts

@@ -175,3 +175,13 @@ export function exportSemiManufacturesDrawStream(
     skipError: true,
   });
 }
+
+/** 半成品报工单导出  */
+export function exportNoticeList(data: GetNoticeListParams): any {
+  return request({
+    method: 'GET',
+    url: `${BASE_URL}/exportNotice`,
+    data,
+    skipError: true,
+  });
+}

+ 2 - 0
packages/app/src/pages/product-report/table/hooks.tsx

@@ -9,6 +9,7 @@ import {
   MATERIAL_NAME_COL_WIDTH,
   ENTYR_NUMBER_COL_WIDTH,
   COMPANY_COL_WIDTH,
+  WBS_COL_WIDTH,
 } from '@utils';
 import {Button} from 'antd';
 import {ColumnsType} from 'antd/es/table';
@@ -29,6 +30,7 @@ const columns: ColumnsType<NoticeListData> = [
   },
   {title: '数量', dataIndex: 'num', width: SMALL_TABLE_WIDTH, align: 'right'},
   {title: '报工时间', dataIndex: 'noticeTime', width: NORMAL_TABLE_WIDTH},
+  {title: 'WBS编号', dataIndex: 'wbs', width: WBS_COL_WIDTH},
   {title: '分录号', dataIndex: 'entryNumber', width: ENTYR_NUMBER_COL_WIDTH},
   {title: '所属公司', dataIndex: 'companyName', width: COMPANY_COL_WIDTH},
   {title: '公司编号', dataIndex: 'companyNumber', width: SMALL_TABLE_WIDTH},

+ 14 - 2
packages/app/src/pages/product-report/table/index.tsx

@@ -3,8 +3,13 @@ import {Card} from 'antd';
 import {Table, TableTools} from '@components';
 import {context, pageContext, searchContext} from '../context';
 
-import {getNoticeList} from '@apis';
-import {useContextSection, useQueryTableList, useSupertube} from '@hooks';
+import {exportNoticeList, getNoticeList} from '@apis';
+import {
+  useContextSection,
+  useQueryTableList,
+  useSupertube,
+  useTableExportEvent,
+} from '@hooks';
 import {useColumns} from './hooks';
 import {useBoolean} from 'ahooks';
 import AddModal from './modal';
@@ -20,6 +25,11 @@ const TableList: FC = function () {
   const columns = useColumns(refetch);
   const [visible, {setFalse, setTrue}] = useBoolean();
   const isSuper = useSupertube();
+  const [isExporting, onExport] = useTableExportEvent({
+    pageContext,
+    context,
+    fn: exportNoticeList,
+  });
 
   return (
     <>
@@ -28,6 +38,8 @@ const TableList: FC = function () {
           onAdd={isSuper ? setTrue : void 0}
           pageContext={pageContext}
           searchContext={searchContext}
+          isExporting={isExporting}
+          onExport={onExport}
         />
 
         <Table

+ 2 - 0
packages/app/src/pages/semi-report/table/hooks.tsx

@@ -11,6 +11,7 @@ import {
   MATERIAL_NAME_COL_WIDTH,
   NORMAL_TABLE_WIDTH,
   SMALL_TABLE_WIDTH,
+  WBS_COL_WIDTH,
 } from '@utils';
 import {useSupertube, useTableDeleteEvent, useTableModalEvent} from '@hooks';
 
@@ -29,6 +30,7 @@ const tableColumns: ColumnsType<NoticeListData> = [
     width: MATERIAL_NAME_COL_WIDTH,
   },
   {title: '数量', dataIndex: 'num', width: SMALL_TABLE_WIDTH, align: 'right'},
+  {title: 'WBS编号', dataIndex: 'wbs', width: WBS_COL_WIDTH},
   {title: '报工时间', dataIndex: 'noticeTime', width: NORMAL_TABLE_WIDTH},
   {title: '分录号', dataIndex: 'entryNumber', width: ENTYR_NUMBER_COL_WIDTH},
   {title: '所属公司', dataIndex: 'companyName', width: COMPANY_COL_WIDTH},

+ 14 - 2
packages/app/src/pages/semi-report/table/index.tsx

@@ -3,8 +3,13 @@ import {useHandle} from './hooks';
 import {Card} from 'antd';
 import {Table, TableTools} from '@components';
 import {context, pageContext, searchContext} from '../context';
-import {getNoticeList} from '@apis';
-import {useContextSection, useQueryTableList, useSupertube} from '@hooks';
+import {exportNoticeList, getNoticeList} from '@apis';
+import {
+  useContextSection,
+  useQueryTableList,
+  useSupertube,
+  useTableExportEvent,
+} from '@hooks';
 import {useBoolean} from 'ahooks';
 import AddModal from './modal';
 import PutInModal from './put-in-modal';
@@ -21,6 +26,11 @@ const TableList: FC = function () {
     useHandle(refetch);
   const [visible, {setTrue, setFalse}] = useBoolean();
   const isSuper = useSupertube();
+  const [isExporting, onExport] = useTableExportEvent({
+    pageContext,
+    context,
+    fn: exportNoticeList,
+  });
 
   return (
     <>
@@ -29,6 +39,8 @@ const TableList: FC = function () {
           onAdd={isSuper ? setTrue : void 0}
           pageContext={pageContext}
           searchContext={searchContext}
+          isExporting={isExporting}
+          onExport={onExport}
         />
 
         <Table