| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- <template>
- <el-container>
- <el-aside width="260px">
- <el-tree
- ref="trees"
- :data="nodeInfos"
- :props="defaultProps"
- node-key="id"
- @node-click="handleNodeClick">
- </el-tree>
- </el-aside>
- <!-- <el-row style="width:80%">-->
- <!-- <el-col :span="24">-->
- <!-- <el-card :body-style="{'padding-top':'10px'}">-->
- <el-container>
- <el-main id="dxdcListMain" style="padding:5px 0 0;">
- <h3>水库安全运行管理督查进度表</h3>
- <!-- <el-button
- type="primary"
- icon="el-icon-download"
- style="float:right;"
- @click="exportExecl"
- >导出
- </el-button> -->
- <div :style="{'width': '100%','height': iframeHeight + 'px'}">
- <iframe ref="frameMain" id="frameMain" name="frameMain" :src="tableSrc" frameborder="0" width="100%"
- height="100%" style="overflow: auto"></iframe>
- </div>
- </el-main>
- </el-container>
- </el-container>
- </template>
- <script>
- import request from "@util/gw_ajax_request.js";
- import {getTrees} from "@util/gw_formatTree.js"
- import {getRyNodeProvincial} from '@api/reportApi.js'
- import {reportHosturl} from '@util/global_variable.js'
- import {hasPriv} from '../../../utils/gw_hasPriv';
- import {dateFormat, getFirstDayOfMonth} from '../../../utils/gw_date.js';
- import {getRyNodeProvincialNogroup} from '@api/reportApi.js'
- export default {
- components: {},
- props: [],
- data() {
- return {
- iframeHeight: window.innerHeight - 230,
- nodeInfos: [],
- defaultProps: {
- children: 'children',
- label: 'pnm'
- },
- perstype: hasPriv('manage') ? 0 : 1,
- searchObj: {
- "engScal": '2'
- },
- tableSrc: '',
- };
- },
- computed: {
- persId() {
- return localStorage.getItem("userid")
- ? localStorage.getItem("userid")
- : "1098101939614724096";
- },
- },
- mounted() {
- this.tableSrc = `${reportHosturl}/demo/reportJsp/showReport.jsp?rpx=gcjstj.rpx&presid=${this.persId}&perstype=${this.perstype}&ids=${this.gcId}`
- this.getLeftTreeData();
- var _this = this
- const iframe = document.querySelector('#frameMain')
- // 处理兼容行问题
- if (iframe.attachEvent) {
- iframe.attachEvent('onload', function () {
- // iframe加载完毕以后执行操作
- this.title = document.getElementById('#frameMain').contentWindow.document.getElementById('#report1');
- console.log(this.title, 'title')
- console.log('iframe已加载完毕')
- })
- } else {
- iframe.onload = function () {
- this.title = iframe.contentWindow.document
- // iframe加载完毕以后执行操作
- console.log('iframe已加载完毕')
- }
- }
- },
- methods: {
- getLeftTreeData() {
- let params = {
- userId: this.persId,
- orgType: '004',
- level: '3'
- }
- getRyNodeProvincial(params).then(res => {
- if (res.success) {
- this.nodeInfos = getTrees(res.data)
- }
- })
- },
- handleNodeClick(data) {
- let paramObj = {
- type: "empwt",
- presId: this.persId,
- plnaId: data.id
- }
- Object.assign(this.searchObj, paramObj)
- this.loading = true;
- request.post(`/dc/insp/rsvrRgstr/list/tree`, this.searchObj)
- .then(res => {
- if (res.success) {
- if (res.data) {
- this.gcId = ''
- res.data.forEach(element => {
- this.gcId += element['id'] + ','
- });
- }
- this.tableSrc = `${reportHosturl}/demo/reportJsp/showReport.jsp?rpx=gcjstj.rpx&presid=${this.persId}&perstype=${this.perstype}&ids=${this.gcId}`
- }
- this.loading = false;
- });
- },
- // 获取Excel数据
- searchExecl() {
- this.loading = true;
- this.tableSrc = `${reportHosturl}/demo/reportJsp/showReport.jsp?rpx=gcjstj.rpx&presid=${this.persId}&perstype=${this.perstype}&ids=${this.gcId}`
- this.loading = false;
- },
- // 导出Excel数据
- exportExecl() {
- v = window.frames["frameMain"];
- // 调用子页面的js方法
- // v.contentWindow.report1_saveAsExcel();
- v.report1_saveAsExcel();
- },
- },
- watch: {
- },
- activated() {
- this.searchExecl();
- },
- };
- </script>
- <style scoped>
- h3 {
- margin: 5px 0;
- text-align: center;
- }
- </style>
|