Browse Source

销售订单/采购订单-增加行导出

jingbb 3 months ago
parent
commit
ed3ab5addd

+ 25 - 1
src/views/purchase/purchaseOrder/PurchaseOrderFormList.vue

@@ -189,6 +189,7 @@
     bacthConfirm,
     cancelBatchConfirm,
     supplierOption,
+    getExportUrlRow
   } from './PurchaseOrderyForm.api';
   import { cloneDeep } from 'lodash-es';
   import { defHttp } from '/@/utils/http/axios';
@@ -216,7 +217,7 @@
       canResize: false,
       useSearchForm: false,
       actionColumn: {
-        width: 200,
+        width: 300,
         fixed: 'right',
       },
       scroll: {
@@ -331,6 +332,10 @@
    */
   function getTableAction(record) {
     return [
+      {
+        label: '导出(export)',
+        onClick: handleRowExport.bind(null, record),
+      },
       {
         label: '编辑(edit)',
         onClick: handleEdit.bind(null, record),
@@ -450,6 +455,25 @@
       isCopy: true,
     });
   }
+  async function handleRowExport(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.billCode,
+        url: getExportUrlRow,
+        params: obj,
+      },
+    });
+    await onExportXls();
+  }
 
   /* ----------------------以下为原生查询需要添加的-------------------------- */
   const toggleSearchStatus = ref<boolean>(false);

+ 6 - 0
src/views/purchase/purchaseOrder/PurchaseOrderyForm.api.ts

@@ -12,6 +12,7 @@ enum Api {
   deleteBatch = '/purCode/purOrder/deleteBatch',
   importExcel = '/purCode/purOrder/importExcel',
   exportXls = '/purCode/purOrder/exportXls',
+  exportXlsRow = 'saleCode/saleOrder/exportBillXls',
   queryDataById = '/purCode/purOrder/queryById',
   queryVersonHistoryById='/purCode/purOrderHis/queryById',
   PurOrderFormShipList = '/purCode/purOrder/queryPurOrderShipByMainId',
@@ -32,6 +33,11 @@ enum Api {
  * @param params
  */
 export const getExportUrl = Api.exportXls;
+/**
+ * 行导出api
+ * @param params
+ */
+export const getExportUrlRow = Api.exportXlsRow;
 
 /**
  * 导入api

+ 25 - 1
src/views/saleCode/salesOrder/SaleOrderFormList.vue

@@ -199,6 +199,7 @@
     ProjectOption,
     CustomerOption,
     ClassList,
+    getExportUrlRow
   } from './SaleOrderyForm.api';
   import { cloneDeep } from 'lodash-es';
   import { defHttp } from '/@/utils/http/axios';
@@ -226,7 +227,7 @@
       canResize: false,
       useSearchForm: false,
       actionColumn: {
-        width: 200,
+        width: 300,
         fixed: 'right',
       },
       scroll: {
@@ -337,11 +338,34 @@
   function handleSuccess() {
     (selectedRowKeys.value = []) && reload();
   }
+  async function handleRowExport(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.billCode,
+        url: getExportUrlRow,
+        params: obj,
+      },
+    });
+    await onExportXls();
+  }
   /**
    * 操作栏
    */
   function getTableAction(record) {
     return [
+      {
+        label: '导出(export)',
+        onClick: handleRowExport.bind(null, record),
+      },
       {
         label: '编辑(edit)',
         onClick: handleEdit.bind(null, record),

+ 6 - 0
src/views/saleCode/salesOrder/SaleOrderyForm.api.ts

@@ -12,6 +12,7 @@ enum Api {
   deleteBatch = '/saleCode/saleOrder/deleteBatch',
   importExcel = '/saleCode/saleOrder/importExcel',
   exportXls = '/saleCode/saleOrder/exportXls',
+  exportXlsRow = 'saleCode/saleOrder/exportBillXls',
   queryDataById = '/saleCode/saleOrder/queryById',
   queryVersonHistoryById='/saleCode/saleOrderHis/queryById',
   saleOrderFormShipList = '/saleCode/saleOrder/querySaleOrderShipByMainId',
@@ -33,6 +34,11 @@ enum Api {
  * @param params
  */
 export const getExportUrl = Api.exportXls;
+/**
+ * 行导出api
+ * @param params
+ */
+export const getExportUrlRow = Api.exportXlsRow;
 
 /**
  * 导入api