From 4c1a81e4f7493f9e583812e7bac9e097250d3072 Mon Sep 17 00:00:00 2001 From: 廖井涛 <2265517004@qq.com> Date: 星期四, 30 五月 2024 09:47:05 +0800 Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override --- north-glass-erp/northglass-erp/src/components/BasicTable.vue | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 46 insertions(+), 1 deletions(-) diff --git a/north-glass-erp/northglass-erp/src/components/BasicTable.vue b/north-glass-erp/northglass-erp/src/components/BasicTable.vue index 9f881a3..0f72e3e 100644 --- a/north-glass-erp/northglass-erp/src/components/BasicTable.vue +++ b/north-glass-erp/northglass-erp/src/components/BasicTable.vue @@ -4,8 +4,10 @@ import {changeFilterEvent} from "@/hook" import request from "@/utils/request" import exportExcel from "@/hook/exportExcel" +import {addListener,exportData} from "@/hook/mouseMove" import deepClone from "@/utils/deepClone"; import {ElMessage} from "element-plus"; +import * as XLSX from "xlsx"; const xGrid = ref() let filterData = ref({}) const gridOptions = reactive({ @@ -37,8 +39,17 @@ mode: 'row', showStatus: true },//琛ㄥご鍙傛暟 - columns:[ + menuConfig: { + body: { + options: [ + [ + { code: 'exportExcelChecked', name: '瀵煎嚭閫変腑', prefixIcon: 'vxe-icon-download', visible: true } + ] + ] + } + }, + columns:[ ],//琛ㄥご鎸夐挳 toolbarConfig: { @@ -69,6 +80,26 @@ } }) +const gridEvents = { + menuClick ({ menu, row, column }) { + const $grid = xGrid.value + if ($grid) { + switch (menu.code) { + case 'exportExcelChecked': { + let result = exportData() + if(result){ + // 灏嗘暟鎹浆鎹负 worksheet 瀵硅薄 + const worksheet = XLSX.utils.aoa_to_sheet(result); + const workbook = XLSX.utils.book_new(); + XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1'); + XLSX.writeFile(workbook, 'data.xlsx'); + } + break + } + } + } + } +} const props = defineProps({ @@ -101,6 +132,7 @@ onMounted(() => { gridOptions.columns = props.childrenData.columns getReportData() + addListener(xGrid.value,gridOptions) }) @@ -174,6 +206,7 @@ class="mytable-scrollbar" ref="xGrid" v-bind="gridOptions" + v-on="gridEvents" > <!-- 涓嬫媺鏄剧ず鎵�鏈変俊鎭彃妲�--> <template #content="{ row }"> @@ -242,4 +275,16 @@ height: calc(100% - 30px); } + +.vxe-grid { + /* 绂佺敤娴忚鍣ㄩ粯璁ら�変腑 */ + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} +:deep(#product .el-dialog__body){ + height: 90%; + width: 100%; +} </style> \ No newline at end of file -- Gitblit v1.8.0