源码:
<template>
<div class="page_search">
<el-button type="primary" size="small">新增</el-button>
<div class="search">
<el-input
v-model="search"
placeholder="请输入名称"
size="small"
class="input-with-select"
>
<template #append>
<el-button icon="el-icon-search"></el-button>
</template>
</el-input>
</div>
<el-button type="primary" class="search" icon="el-icon-share" @click="exportExcel">导出</el-button>
</div>
</template>
<script>
import { defineComponent, ref } from "vue";
import Excel from "exceljs";
export default {
setup() {
const search = ref("");
const downloadBlob=(arrayList,type,fileName)=>{
var blob=new Blob(arrayList,{type:type});
var a = document.createElement('a'); //创建a标签用于下载
a.download = fileName;
a.href = URL.createObjectURL(blob);
document.getElementsByTagName("body")[0].appendChild(a);
a.click();
document.getElementsByTagName("body")[0].removeChild(a);
};
const exportExcel=async()=>{
let workbook = new Excel.Workbook();
let worksheet = workbook.addWorksheet('报表-威尔森',{views: [{showGridLines: true}]});
let alignObj={alignment:{vertical:'middle',horizontal:'center'}};
let columns=[{header:"",key:"A",style:alignObj},
{header:"",key:"B",width:12,style:alignObj},
{header:"",key:"C",style:alignObj},
{header:"",key:"D",style:alignObj}];
worksheet.columns = columns;
// 开始添加数据
let data=[
{A:"COD",B:'',C:"氨氮",D:''},
{A:"进水",B:"出水",C:"进水",D:"出水"},
{A:1,B:2,C:3,D:4},
{A:11,B:2,C:3,D:4},
{A:1,B:22,C:3,D:4}
];
for(let i in data) {
worksheet.addRow(data[i]).commit();
}
worksheet.mergeCells('A2:B2');
worksheet.mergeCells('C2:D2');
worksheet.getRow(2).border={top: {style:'thin'},left: {style:'thin'},bottom: {style:'thin'},right: {style:'thin'}}
//await worksheet.commit();
// write to a new buffer
const buffer = await workbook.xlsx.writeBuffer();
//console.log(buffer);
downloadBlob([buffer],"application/octet-stream","data.xlsx");
};
return {
search,exportExcel,
};
},
};
</script>
<style scoped>
.page_search {
margin: 10px;
display: flex;
align-items: center;
}
.search {
margin-left: 10px;
width: 200px;
}
</style>
至于表格的border还不知道怎么设置好一些。
《传热学》相关小程序演示动画如下(其中下图1D非稳态导热计算发散,调小时间步长后重新计算,结果收敛!):
黑体单色辐射力如下图,可见温度越高,同频率辐射力越大:
关于《(计算)流体力学》相关的几个小程序演示动画如下:
LBM(=Lattice Boltzmann Method)计算得到的圆柱绕流“卡门涡街”演示(由于网格较少,分辨率低,圆柱近乎正方形):
顺便,《(热工过程)自动控制》中关于PID控制器的仿真可点击此处体验:PID控制演示小程序,(PID控制相关视频见:基础/整定/重要补充)。动画如下:
本文分享自 传输过程数值模拟学习笔记 微信公众号,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文参与 腾讯云自媒体同步曝光计划 ,欢迎热爱写作的你一起参与!