Bladeren bron

增加环路的导出功能

yanglzh 2 jaren geleden
bovenliggende
commit
e4b4cd71a7

+ 1 - 0
src/api/heatStation/index.ts

@@ -4,6 +4,7 @@ export default {
   loop: {
     getList: (params: object) => get('/region/loop/list', params),
     add: (data: object) => post('/region/loop/add', data),
+    export: (params: object) => file('/region/loop/export', params), // 环路列表导出
     edit: (data: object) => put('/region/loop/edit', data),
     del: (id: number) => del('/region/loop/del', { id }),
     detail: (id: number) => get('/region/loop/getInfoById', { id }),

+ 7 - 6
src/views/heating/heatStation/heatStation/index.vue

@@ -28,7 +28,10 @@
 							</el-icon>
 							新增
 						</el-button>
-						<el-button @click="exportExcel">数据导出</el-button>
+						<el-button @click="exportExcel">
+							<el-icon> <ele-Download /> </el-icon>
+							数据导出
+						</el-button>
 						<!-- <el-button size="default" type="danger" class="ml10" @click="onRowDel(null)">
               <el-icon>
                 <ele-Delete />
@@ -204,11 +207,9 @@ export default defineComponent({
 		};
 		// 后端导出
 		const exportExcel = () => {
-			api.heatStation
-				.heatStationExport(state.tableData.param)
-				.then((res: any) => {
-					downloadFile(res, '换热站列表数据导出.xlsx');
-				});
+			api.heatStation.heatStationExport(state.tableData.param).then((res: any) => {
+				downloadFile(res, '换热站列表数据导出.xlsx');
+			});
 		};
 		return {
 			addDicRef,

+ 12 - 0
src/views/heating/heatStation/loop/index.vue

@@ -40,6 +40,10 @@
               </el-icon>
               新增
             </el-button>
+						<el-button @click="exportExcel">
+							<el-icon> <ele-Download /> </el-icon>
+							数据导出
+						</el-button>
             <!-- <el-button size="default" type="danger" class="ml10" @click="onRowDel(null)">
               <el-icon>
                 <ele-Delete />
@@ -113,6 +117,7 @@ import { ElMessageBox, ElMessage, FormInstance } from 'element-plus';
 import EditDic from './component/edit.vue';
 import Detail from './component/detail.vue';
 import api from '/@/api/heatStation';
+import downloadFile from '/@/utils/download';
 
 // 定义接口来定义对象的类型
 interface Point {
@@ -245,6 +250,12 @@ export default defineComponent({
 		const handleSelectionChange = (selection: TableDataRow[]) => {
 			state.ids = selection.map((item) => item.id);
 		};
+		// 后端导出
+		const exportExcel = () => {
+			api.loop.export(state.tableData.param).then((res: any) => {
+				downloadFile(res, '环路列表数据导出.xlsx');
+			});
+		};
 		return {
 			addDicRef,
 			editDicRef,
@@ -257,6 +268,7 @@ export default defineComponent({
 			queryList,
 			resetQuery,
 			handleSelectionChange,
+			exportExcel,
 			...toRefs(state),
 		};
 	},