|
@@ -0,0 +1,401 @@
|
|
|
+<template>
|
|
|
+ <div class="reportBox">
|
|
|
+ <div class="outlineBox">
|
|
|
+ <div class="btnBox">
|
|
|
+ <el-button type="success" size="mini" @click="exportPDF"
|
|
|
+ >导出PDF</el-button
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ <template v-if="reportTitle">
|
|
|
+ <p
|
|
|
+ class="songti font fw"
|
|
|
+ style="
|
|
|
+ width: 100%;
|
|
|
+ padding: 12px 24px;
|
|
|
+ color: #b3bdc0;
|
|
|
+ background: rgba(96, 103, 105, 0.2);
|
|
|
+ cursor: pointer;
|
|
|
+ margin: 0;
|
|
|
+ color: #05bb4c;
|
|
|
+ "
|
|
|
+ @click="
|
|
|
+ nodeClick({
|
|
|
+ label: `国家能源集团宁夏新能源开发有限公司${reportTitle}`,
|
|
|
+ })
|
|
|
+ "
|
|
|
+ >
|
|
|
+ 国家能源集团宁夏新能源开发有限公司{{ reportTitle }}
|
|
|
+ </p>
|
|
|
+ </template>
|
|
|
+ <el-tree
|
|
|
+ :data="treeData"
|
|
|
+ :props="{
|
|
|
+ children: 'children',
|
|
|
+ label: 'label',
|
|
|
+ }"
|
|
|
+ style="height: calc(100% - 62px - 40px); overflow-y: scroll"
|
|
|
+ @node-click="nodeClick"
|
|
|
+ >
|
|
|
+ <template #default="{ node, data }">
|
|
|
+ <span class="font songti fw">{{ data.index }}{{ node.label }}</span>
|
|
|
+ </template>
|
|
|
+ </el-tree>
|
|
|
+ </div>
|
|
|
+ <div class="resizeLine">
|
|
|
+ <el-divider direction="vertical" />
|
|
|
+ <el-icon :size="24" color="#eee"><DCaret /></el-icon>
|
|
|
+ </div>
|
|
|
+ <div class="contentBox">
|
|
|
+ <div class="pagePadding A4">
|
|
|
+ <div class="page">
|
|
|
+ <template v-if="reportTitle">
|
|
|
+ <h1
|
|
|
+ :id="`国家能源集团宁夏新能源开发有限公司${reportTitle}`"
|
|
|
+ class="songti mainTitle fw"
|
|
|
+ style="margin-bottom: 0"
|
|
|
+ >
|
|
|
+ 国家能源集团宁夏新能源开发有限公司
|
|
|
+ </h1>
|
|
|
+ <h1 :id="reportTitle" class="songti mainTitle fw">
|
|
|
+ {{ reportTitle }}
|
|
|
+ </h1>
|
|
|
+ </template>
|
|
|
+ <el-card
|
|
|
+ :id="pItem.label"
|
|
|
+ v-for="pItem in treeData"
|
|
|
+ :key="pItem.index"
|
|
|
+ >
|
|
|
+ <p class="songti title fw">
|
|
|
+ {{ pItem.index || "" }}{{ pItem.label }}
|
|
|
+ </p>
|
|
|
+ <p
|
|
|
+ class="fangsong indent"
|
|
|
+ style="margin-bottom: 5px"
|
|
|
+ v-for="(cItem, cIndex) in pItem.content"
|
|
|
+ :key="cIndex"
|
|
|
+ >
|
|
|
+ {{ cItem }}
|
|
|
+ </p>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import Get_PDF from "@tools/fixGetPDF";
|
|
|
+export default {
|
|
|
+ components: {},
|
|
|
+
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ locationHref: "",
|
|
|
+ reportTitle: "",
|
|
|
+ treeData: [
|
|
|
+ {
|
|
|
+ label: "发电量完成情况",
|
|
|
+ children: [],
|
|
|
+ content: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "资源及理论发电量平衡分析",
|
|
|
+ children: [],
|
|
|
+ content: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "电网调度因素损失分析",
|
|
|
+ children: [],
|
|
|
+ content: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "故障及损失分析",
|
|
|
+ children: [],
|
|
|
+ content: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "计划检修损失分析",
|
|
|
+ children: [],
|
|
|
+ content: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "性能损失分析",
|
|
|
+ children: [],
|
|
|
+ content: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "厂用电量分析",
|
|
|
+ children: [],
|
|
|
+ content: [],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "场站问题总结和建议",
|
|
|
+ children: [],
|
|
|
+ content: [],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ created() {
|
|
|
+ this.locationHref = location.href;
|
|
|
+ let treeData = this.initTreeData(this.BASE.deepCopy(this.treeData || []));
|
|
|
+ this.treeData = treeData;
|
|
|
+ },
|
|
|
+
|
|
|
+ mounted() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.initMouseEvent();
|
|
|
+ this.getContentData();
|
|
|
+ if (this.$route.hash) {
|
|
|
+ this.pageScroll(this.$route.hash.replace(/^\#/, ""));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ methods: {
|
|
|
+ // 初始化树形
|
|
|
+ initTreeData(treeData, parentIdx = "") {
|
|
|
+ treeData.forEach((ele, idx) => {
|
|
|
+ ele.index = `${parentIdx}${idx + 1}.`;
|
|
|
+ if (ele.children?.length) {
|
|
|
+ return this.initTreeData(ele.children, ele.index);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return treeData;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 初始化鼠标事件
|
|
|
+ initMouseEvent() {
|
|
|
+ const resize = document.querySelector(".resizeLine");
|
|
|
+ const left = document.querySelector(".outlineBox");
|
|
|
+ const right = document.querySelector(".contentBox");
|
|
|
+ const box = document.querySelector(".reportBox");
|
|
|
+ const svgPath = resize.querySelector(".el-icon path");
|
|
|
+
|
|
|
+ left.style.width = getComputedStyle(left, null).width;
|
|
|
+ right.style.width = getComputedStyle(right, null).width;
|
|
|
+ resize.onmousedown = (e) => {
|
|
|
+ const startX = e.clientX;
|
|
|
+ resize.left = resize.offsetLeft;
|
|
|
+ svgPath.style.fill = "#05bb4c";
|
|
|
+ svgPath.style.transform = "scale(1.5)";
|
|
|
+ svgPath.style.transformOrigin = "center center";
|
|
|
+ svgPath.style.transition = "0.2s";
|
|
|
+ document.onmousemove = (e) => {
|
|
|
+ var endX = e.clientX;
|
|
|
+ const maxT = box.clientWidth - resize.offsetWidth;
|
|
|
+ let moveLen = resize.left + (endX - startX);
|
|
|
+ if (moveLen < 250) moveLen = 250;
|
|
|
+ if (moveLen > maxT - 1000) moveLen = maxT - 1000;
|
|
|
+
|
|
|
+ resize.style.left = moveLen;
|
|
|
+ left.style.width = `${moveLen}px`;
|
|
|
+ right.style.width = `${box.clientWidth - moveLen - 8}px`;
|
|
|
+ };
|
|
|
+ document.onmouseup = () => {
|
|
|
+ svgPath.style.fill = "#eee";
|
|
|
+ svgPath.style.transform = "scale(1)";
|
|
|
+ svgPath.style.transformOrigin = "center center";
|
|
|
+ svgPath.style.transition = "0.2s";
|
|
|
+ document.onmousemove = null;
|
|
|
+ document.onmouseup = null;
|
|
|
+ resize.releaseCapture && resize.releaseCapture();
|
|
|
+ };
|
|
|
+ resize.setCapture && resize.setCapture();
|
|
|
+ return false;
|
|
|
+ };
|
|
|
+ },
|
|
|
+
|
|
|
+ // 树形点击
|
|
|
+ nodeClick(node) {
|
|
|
+ const label = node.label;
|
|
|
+ location.hash = `${this.$route.path}#${label}`;
|
|
|
+ this.pageScroll(label);
|
|
|
+ },
|
|
|
+
|
|
|
+ // 页面滚动至锚点
|
|
|
+ pageScroll(id) {
|
|
|
+ document.getElementById(id)?.scrollIntoView({ behavior: "smooth" });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 数据请求
|
|
|
+ getContentData() {
|
|
|
+ const that = this;
|
|
|
+ that.API.requestData({
|
|
|
+ isMust: false, // 请求是否携带 token ,默认为 true ,可缺省
|
|
|
+ showLoading: true, // 请求是否显示加载中遮罩层,默认 false ,可缺省
|
|
|
+ method: "GET", // 请求方式,默认为 GET ,可缺省
|
|
|
+ baseURL: "http://192.168.10.9:9001/", // 请求服务器地址 + 端口,可缺省
|
|
|
+ subUrl: "economy/analysis/2023/3", // 请求接口地址,必传项
|
|
|
+ timeout: 60000, // 请求超时时间,默认 3s ,可缺省
|
|
|
+ success({ data }) {
|
|
|
+ that.treeData.forEach((pEle) => {
|
|
|
+ const content = data[pEle.label] || [];
|
|
|
+ if (content.length) {
|
|
|
+ content.forEach((cEle) => {
|
|
|
+ pEle.content.push(cEle);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ that.reportTitle = data?.["标题"]?.[0] || "";
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 导出PDF
|
|
|
+ exportPDF() {
|
|
|
+ this.BASE.showLoading({
|
|
|
+ text: "正在导出...请稍后...",
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
+ Get_PDF.getPdf(
|
|
|
+ document.querySelector(".contentBox .page"),
|
|
|
+ "健康评价报告概述"
|
|
|
+ );
|
|
|
+ this.BASE.closeLoading();
|
|
|
+ }, 50);
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
+ watch: {},
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="less" scoped>
|
|
|
+.reportBox {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ .outlineBox {
|
|
|
+ width: calc(25% - 8px);
|
|
|
+ height: 100%;
|
|
|
+ float: left;
|
|
|
+
|
|
|
+ .btnBox {
|
|
|
+ width: 97%;
|
|
|
+ margin: 0 1.5% 12px 1.5%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .resizeLine {
|
|
|
+ width: 6px;
|
|
|
+ height: 100%;
|
|
|
+ cursor: w-resize;
|
|
|
+ float: left;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ .el-icon {
|
|
|
+ position: absolute;
|
|
|
+ left: calc(50% - 12px);
|
|
|
+ top: calc(50% - 12px);
|
|
|
+ transform: rotate(90deg);
|
|
|
+ transition: 0.2s;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-divider--vertical {
|
|
|
+ width: 2px;
|
|
|
+ margin: 0 2px;
|
|
|
+ height: 100%;
|
|
|
+ transition: 0.2s;
|
|
|
+ }
|
|
|
+
|
|
|
+ &:active .el-divider--vertical {
|
|
|
+ background: #05bb4c;
|
|
|
+ transition: 0.2s;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .contentBox {
|
|
|
+ float: right;
|
|
|
+ width: 75%;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: flex-start;
|
|
|
+ overflow-y: scroll;
|
|
|
+
|
|
|
+ .mainTitle {
|
|
|
+ font-size: 30px;
|
|
|
+ width: 90%;
|
|
|
+ margin: 0 5% 20px 5%;
|
|
|
+ text-align: center;
|
|
|
+ color: #000;
|
|
|
+ }
|
|
|
+
|
|
|
+ .page {
|
|
|
+ background: #fff;
|
|
|
+ }
|
|
|
+
|
|
|
+ .pagePadding {
|
|
|
+ padding: 20mm;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background: #fff;
|
|
|
+ }
|
|
|
+
|
|
|
+ .A4 {
|
|
|
+ width: 210mm;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-card {
|
|
|
+ border-color: transparent;
|
|
|
+ color: #000;
|
|
|
+
|
|
|
+ .el-card__body {
|
|
|
+ p {
|
|
|
+ margin: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.font {
|
|
|
+ width: 100%;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ white-space: nowrap;
|
|
|
+ line-height: 1.5;
|
|
|
+}
|
|
|
+
|
|
|
+.fw {
|
|
|
+ font-weight: 700;
|
|
|
+}
|
|
|
+
|
|
|
+.songti {
|
|
|
+ font-family: SimSun, 宋体;
|
|
|
+ font-size: 18.7px;
|
|
|
+ line-height: 2;
|
|
|
+}
|
|
|
+
|
|
|
+.fangsong {
|
|
|
+ font-family: FangSong, 仿宋;
|
|
|
+ font-size: 18.7px;
|
|
|
+ line-height: 2;
|
|
|
+}
|
|
|
+
|
|
|
+.indent {
|
|
|
+ text-indent: 2em;
|
|
|
+}
|
|
|
+
|
|
|
+.title {
|
|
|
+ font-size: 22px;
|
|
|
+ line-height: 2;
|
|
|
+}
|
|
|
+</style>
|
|
|
+
|
|
|
+<style lang="less">
|
|
|
+.contentBox {
|
|
|
+ .el-card {
|
|
|
+ .el-card__body {
|
|
|
+ padding: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .el-card.is-always-shadow {
|
|
|
+ box-shadow: none;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|