Browse Source

销售发票-增加行导出

jingbb 3 months ago
parent
commit
30c50ec7bc

+ 7 - 0
src/views/saleCode/salesInvoice/salesInvoiceForm.api.ts

@@ -11,6 +11,7 @@ enum Api {
   deleteBatch = '/saleCode/saleInvoice/deleteBatch',
   importExcel = '/saleCode/saleInvoice/importExcel',
   exportXls = '/saleCode/saleInvoice/exportXls',
+  exportXlsRow = '/saleCode/saleInvoice/exportBillXls',
   queryDataById = '/saleCode/saleInvoice/queryById',
   saleInvoiceFormShipList = '/saleCode/saleInvoice/querySaleInvoiceShipByMainId',
   saleInvoiceDetailList = '/saleCode/saleInvoice/querySaleInvoiceProductByMainId',
@@ -30,6 +31,12 @@ enum Api {
  * @param params
  */
 export const getExportUrl = Api.exportXls;
+/**
+ * 行导出api
+ * @param params
+ */
+export const getExportUrlRow = Api.exportXlsRow;
+
 
 /**
  * 导入api

+ 25 - 1
src/views/saleCode/salesInvoice/salesInvoiceList.vue

@@ -152,6 +152,7 @@
     getListDetail,
     ProjectOption,
     CustomerOption,
+    getExportUrlRow
   } from './salesInvoiceForm.api';
   import { cloneDeep } from 'lodash-es';
   import { defHttp } from '/@/utils/http/axios';
@@ -182,7 +183,7 @@
       canResize: false,
       useSearchForm: false,
       actionColumn: {
-        width: 200,
+        width: 300,
         fixed: 'right',
       },
       scroll: {
@@ -285,6 +286,10 @@
    */
   function getTableAction(record) {
     return [
+    {
+        label: '导出(export)',
+        onClick: handleExportRow.bind(null, record),
+      },
       {
         label: '编辑(edit)',
         onClick: handleEdit.bind(null, record),
@@ -331,6 +336,25 @@
       },
     ];
   }
+  async function handleExportRow(record){
+    var obj={
+      id : record.id
+    }
+    const {onExportXls} = useListPage({
+      tableProps: {
+        beforeFetch: async (params) => {
+          // let rangerQuery = await setRangeQuery();
+          // return Object.assign(params, rangerQuery);
+        },
+      },
+      exportConfig: {
+        name: record.invoiceCode,
+        url: getExportUrlRow,
+        params: obj,
+      },
+    });      
+    await onExportXls();
+  }
   function submit() {
     if (selectedRowKeys.value.length == 0) {
       message.warning('请选择数据');