<template>
|
<div class="FX_box">
|
<div class="FX_title">分析报告</div>
|
<div class="form_box">
|
<div class="time_box">
|
<el-date-picker
|
size="large"
|
v-model="selectform.start"
|
type="datetime"
|
value-format="YYYY-MM-DD HH"
|
format="YYYY-MM-DD HH"
|
/>
|
<span>-</span>
|
<el-date-picker
|
size="large"
|
v-model="selectform.end"
|
type="datetime"
|
value-format="YYYY-MM-DD HH"
|
format="YYYY-MM-DD HH"
|
/>
|
</div>
|
<div class="button_box">
|
<el-button @click="selectList" class="button">确认</el-button>
|
</div>
|
</div>
|
<div class="list_box">
|
<el-table :data="data.tableData" style="width: 100%">
|
<el-table-column
|
prop="createTime"
|
label="时间"
|
:formatter="dateFormatter"
|
align="center "
|
/>
|
<el-table-column label="操作" align="center ">
|
<template #default="scope">
|
<el-button
|
link
|
type="primary"
|
size="small"
|
@click="download(scope.row)"
|
>下载</el-button
|
>
|
</template>
|
</el-table-column>
|
</el-table>
|
<div class="page">
|
<el-pagination
|
layout="prev, pager, next"
|
:page-count="data.total"
|
:current-page="listData.pageIndex"
|
@current-change="handleCurrentChange"
|
/>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
import { reactive, onMounted, watch, ref } from "vue";
|
import { useStore } from "vuex";
|
import { selectByPage, downloadByld } from "@/api/api.js";
|
import docxtemplater from "docxtemplater";
|
import PizZip from "pizzip";
|
import JSZipUtils from "jszip-utils";
|
import { saveAs } from "file-saver";
|
import { exportMethod } from "@/utils/export";
|
export default {
|
//import引入的组件需要注入到对象中才能使用
|
components: {},
|
props: ["menusId"],
|
setup(props, { emit }) {
|
const store = useStore();
|
let data = reactive({
|
tableData: [],
|
total: 0,
|
});
|
let selectform = reactive({
|
start: "",
|
end: "",
|
});
|
let listData = reactive({
|
type: "",
|
start: "",
|
end: "",
|
pageSize: 10,
|
pageIndex: 1,
|
});
|
const selectList = async () => {
|
switch (props.menusId) {
|
case "a4":
|
listData.type = "day";
|
break;
|
case "a5":
|
listData.type = "week";
|
break;
|
case "a6":
|
listData.type = "month";
|
break;
|
}
|
|
listData.start =
|
selectform.start == "" ? "" : `${selectform.start}:00:00`;
|
listData.end = selectform.end == "" ? "" : `${selectform.end}:00:00`;
|
const dt = await selectByPage(listData);
|
data.total = Math.ceil(dt.count / listData.pageSize);
|
data.tableData = dt.result;
|
|
// console.log(dt);
|
};
|
const download = async (res) => {
|
let downloadObj = {
|
url: downloadByld(),
|
fileName: res.name,
|
params: { id: res.id },
|
};
|
exportMethod(downloadObj);
|
};
|
const handleCurrentChange = (res) => {
|
listData.pageIndex = res;
|
selectList();
|
};
|
const dateFormatter = (row) => {
|
const date = new Date(row.createTime);
|
const year = date.getFullYear();
|
const month = date.getMonth() + 1;
|
const day = date.getDate();
|
const hours = date.getHours();
|
const minutes = date.getMinutes();
|
|
// let formattedDatetime = `${year}-${month}-${day} ${hours}`;
|
let formattedDatetime = `${year}-${month}-${day}`;
|
if (props.menusId == "a6") {
|
formattedDatetime = `${year}-${month}-${day}`;
|
}
|
return formattedDatetime;
|
};
|
watch(
|
() => props.menusId,
|
(nVal, oVal) => {
|
selectList();
|
},
|
{ deep: true }
|
);
|
onMounted(() => {
|
selectList();
|
});
|
return {
|
data,
|
selectform,
|
selectList,
|
download,
|
listData,
|
handleCurrentChange,
|
dateFormatter,
|
};
|
},
|
};
|
</script>
|
<style lang="less" scoped>
|
//@import url(); 引入公共css类
|
.FX_box {
|
width: 763px;
|
|
background: url("../assets/img/xgzs/gjfx.png") no-repeat center;
|
background-size: 100% 100%;
|
padding: 40px;
|
padding-bottom: 80px;
|
box-sizing: border-box;
|
.FX_title {
|
font-size: 30px;
|
font-weight: bold;
|
color: #ffffff;
|
padding-bottom: 10px;
|
}
|
.form_box {
|
display: flex;
|
align-items: center;
|
.time_box {
|
display: flex;
|
align-items: center;
|
span {
|
padding: 0 10px;
|
color: #fff;
|
}
|
/deep/.el-date-editor.el-input {
|
width: auto;
|
}
|
/deep/ .el-input__wrapper {
|
background: rgba(0, 0, 0, 0.2);
|
border: 2px solid #2e58cc;
|
border-radius: 10px;
|
color: #ffffff;
|
padding: 0;
|
padding-left: 3px;
|
}
|
/deep/ .el-input__inner,
|
/deep/ .el-textarea__inner {
|
// background-color: rgba(134, 132, 132, 0.5);
|
color: #ffffff;
|
font-size: 24px;
|
}
|
/deep/.el-range-input {
|
color: white;
|
}
|
/deep/ .el-range-separator {
|
color: white;
|
}
|
.el-select {
|
// width: 180px;
|
}
|
.el-select /deep/ .el-input__wrapper {
|
background: rgba(0, 0, 0, 0.2);
|
border: 2px solid #2e58cc;
|
border-radius: 10px;
|
color: #ffffff;
|
padding: 0;
|
padding-left: 6px;
|
}
|
.el-select /deep/ .el-input__inner {
|
color: #ffffff;
|
font-size: 24px;
|
}
|
}
|
}
|
.el-table {
|
// height: 370px;
|
width: 100%;
|
overflow: auto;
|
background-color: transparent;
|
}
|
.el-table::before {
|
height: 0;
|
}
|
.el-table /deep/ .el-tooltip {
|
padding: 0;
|
}
|
.el-table /deep/ th,
|
.el-table /deep/ tr {
|
background-color: transparent;
|
color: white;
|
}
|
.el-table /deep/ tr:hover > td {
|
background-color: rgba(0, 0, 0, 1) !important;
|
}
|
/deep/ .el-table__body {
|
width: 100% !important;
|
}
|
|
/deep/ .el-table__header {
|
width: 100% !important;
|
}
|
.page {
|
display: flex;
|
justify-content: center;
|
padding-top: 20px;
|
.el-pagination {
|
background: transparent !important;
|
|
/deep/ .btn-prev,
|
/deep/ .btn-next,
|
/deep/ .number {
|
background: transparent !important;
|
color: #fff;
|
}
|
/deep/ .is-active {
|
color: rgb(64 158 255);
|
}
|
}
|
}
|
}
|
.button_box {
|
padding-left: 20px;
|
}
|
.button {
|
background: rgba(0, 0, 0, 0.2);
|
border: 4px solid #2e58cc !important;
|
border-radius: 20px !important;
|
color: #ffffff;
|
height: 64px !important;
|
font-size: 28px !important;
|
padding: 16px 30px !important;
|
}
|
</style>
|