|
|
|
@ -103,7 +103,7 @@
|
|
|
|
<template #export>
|
|
|
|
<template #export>
|
|
|
|
<Button
|
|
|
|
<Button
|
|
|
|
type="primary"
|
|
|
|
type="primary"
|
|
|
|
@click="download('/api/admin/base-form/index','get',Object.assign(select,{ page: 1,page_size: 9999,is_export: 1 }),`${new Date().getTime()}.xlsx`)"
|
|
|
|
@click="exportExcel(new Date().getTime().toString())"
|
|
|
|
>导出</Button
|
|
|
|
>导出</Button
|
|
|
|
>
|
|
|
|
>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
@ -148,6 +148,8 @@ import { op } from "@/const/op";
|
|
|
|
import { download } from "@/utils/downloadRequest";
|
|
|
|
import { download } from "@/utils/downloadRequest";
|
|
|
|
import { getparameter } from "@/api/system/dictionary";
|
|
|
|
import { getparameter } from "@/api/system/dictionary";
|
|
|
|
import { show } from "@/api/system/customForm";
|
|
|
|
import { show } from "@/api/system/customForm";
|
|
|
|
|
|
|
|
import * as XLSX from "xlsx";
|
|
|
|
|
|
|
|
import { saveAs } from "file-saver";
|
|
|
|
|
|
|
|
|
|
|
|
import dialoger from './dialog.vue';
|
|
|
|
import dialoger from './dialog.vue';
|
|
|
|
import LxHeader from "@/components/LxHeader/index.vue";
|
|
|
|
import LxHeader from "@/components/LxHeader/index.vue";
|
|
|
|
@ -197,6 +199,27 @@ export default {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async exportExcel(sheetName) {
|
|
|
|
|
|
|
|
const res = await index(Object.assign(this.select,{ page: 1,page_size: 9999}))
|
|
|
|
|
|
|
|
if(res.data){
|
|
|
|
|
|
|
|
let headers = this.form.map(i => {
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
|
|
|
key: i.field,
|
|
|
|
|
|
|
|
title: i.name
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
const data = res.data.map(row => headers.map(header => row[header.key]));
|
|
|
|
|
|
|
|
data.unshift(headers.map(header => header.title));
|
|
|
|
|
|
|
|
const wb = XLSX.utils.book_new();
|
|
|
|
|
|
|
|
const ws = XLSX.utils.aoa_to_sheet(data);
|
|
|
|
|
|
|
|
XLSX.utils.book_append_sheet(wb, ws, sheetName);
|
|
|
|
|
|
|
|
const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' });
|
|
|
|
|
|
|
|
saveAs(new Blob([wbout], { type: 'application/octet-stream' }), `${sheetName}.xlsx`);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// download('/api/admin/base-form/index','get',Object.assign(select,{ page: 1,page_size: 9999,is_export: 1 }),`${new Date().getTime()}.xlsx`)
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//target要为内存地址引用类型
|
|
|
|
//target要为内存地址引用类型
|
|
|
|
inputStartHandler(e,target) {
|
|
|
|
inputStartHandler(e,target) {
|
|
|
|
let temp = target?.value.split(',')[1]
|
|
|
|
let temp = target?.value.split(',')[1]
|
|
|
|
|