<template>
|
<div class="system-gas-container">
|
<el-card shadow="hover">
|
<div class="system-menu-search mb15">
|
<el-form :inline="true" >
|
<el-form-item label="日期:" >
|
<el-date-picker
|
v-model="state.tableData.listQuery.searchParams.time"
|
type="month"
|
format="YYYY-MM"
|
value-format="YYYY-MM"
|
/>
|
</el-form-item>
|
<el-button size="default" type="primary" class="ml10" @click="search">
|
<el-icon>
|
<ele-Search />
|
</el-icon>
|
查询
|
</el-button>
|
<el-button size="default" class="ml10" @click="reset()">
|
<el-icon>
|
<RefreshLeft />
|
</el-icon>
|
重置
|
</el-button>
|
</el-form>
|
</div>
|
<el-table :data="state.tableData.data" style="width: 100%">
|
<el-table-column align="center" prop="date" label="日期"/>
|
<el-table-column align="center" label="文件名称">
|
<template #default="scope">
|
<div v-for="(item, index) in scope.row.file" :key="index">
|
{{ item.filename}}
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" show-overflow-tooltip width="140">
|
<template #default="scope">
|
<el-button size="small" text type="primary" @click="downLoad(scope.row)">下载</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<br />
|
<el-pagination
|
@size-change="onHandleSizeChange"
|
@current-change="onHandleCurrentChange"
|
class="page-position"
|
:pager-count="5"
|
:page-sizes="[10, 20, 30]"
|
v-model:current-page="state.tableData.listQuery.pageIndex"
|
background
|
v-model:page-size="state.tableData.listQuery.pageSize"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="state.tableData.total">
|
</el-pagination>
|
<br />
|
<br />
|
</el-card>
|
</div>
|
</template>
|
|
<script setup lang="ts">
|
import {reactive, ref} from "vue";
|
import { TableDailytState } from "/@/types/monitorData";
|
import axios from "axios";
|
import Cookies from "js-cookie";
|
import { ElMessage } from 'element-plus'
|
|
const state = reactive<TableDailytState>({
|
tableData: {
|
data: [
|
// {
|
// id:'1',
|
// date: '2023年9月1号',
|
// file: [
|
// {
|
// filename: '富城能源气体监测日报2023_09_01.docx',
|
// url: 'xxx'
|
// }
|
//
|
// ]
|
// }
|
],
|
total: 0,
|
loading: false,
|
listQuery: {
|
pageIndex: 1,
|
pageSize: 10,
|
searchParams:{
|
time: ''
|
}
|
}
|
}
|
});
|
|
const initDailyData = () => {
|
console.log("数据列表")
|
};
|
const onHandleSizeChange = (val: number) => {
|
state.tableData.listQuery.pageSize = val;
|
initDailyData();
|
};
|
// 分页改变
|
const onHandleCurrentChange = (val: number) => {
|
state.tableData.listQuery.pageIndex = val;
|
initDailyData();
|
};
|
const downLoad = (file: any) => {
|
// axios.get(process.env.VITE_API_URL + file.fileUrl, {
|
// headers: {
|
// 'Content-Type': 'application/json',
|
// 'Authorization': Cookies.get('token'),
|
// },
|
// responseType: 'blob'
|
// }).then(res => {
|
// if (res) {
|
// const link = document.createElement('a')
|
// let blob = new Blob([res.data], {
|
// type: res.data.type
|
// })
|
// link.style.display = "none";
|
// link.href = URL.createObjectURL(blob); // 创建URL
|
// link.setAttribute("download", file.fileName);
|
// document.body.appendChild(link);
|
// link.click();
|
// document.body.removeChild(link);
|
// } else {
|
// ElMessage({
|
// message: '获取文件失败',
|
// type: 'error',
|
// })
|
// }
|
// })
|
}
|
const search = () => {
|
console.log("xxxx",state.tableData.listQuery.searchParams)
|
}
|
const reset = () => {
|
state.tableData.listQuery.searchParams.time = '';
|
}
|
</script>
|
<style scoped lang="scss">
|
|
</style>
|