01aaead6ec4fd6d51b4b9fd5f1b6a6778823b13a.svn-base 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <el-row>
  3. <el-col :span="24">
  4. <el-card :body-style="{'padding-top':'10px'}">
  5. <div class="block">
  6. <el-button type="primary" icon="el-icon-download"
  7. style="float: right;margin:0 5px"
  8. @click="exportExecl">导出</el-button>
  9. <el-button type="primary" icon="el-icon-search" style="float: right;margin:0 5px" @click="searchExecl">查询</el-button>
  10. </div>
  11. </el-card>
  12. <el-card :body-style="{'height':dxdcMainHeight + 'px','padding':'0'}">
  13. <form ref="formMain" id="formMain" target="frameMain" :action="reportUrl" method="post">
  14. <input type="hidden" name="width" v-model="windowWidth">
  15. <input type="hidden" name="height" v-model="windowHeight">
  16. <input type="hidden" name="ids" v-model="ids">
  17. <input type="hidden" name="excelName" v-model="excelName">
  18. <input type="hidden" name="dt" v-model="monthValue">
  19. <input type="hidden" name="sttm" v-model="sttm">
  20. <input type="hidden" name="ettm" v-model="ettm">
  21. </form>
  22. <div style="width: 100%;height: 100%;" v-loading="loading">
  23. <iframe ref="frameMain" id="frameMain" name="frameMain" :src="reportUrl" frameborder="0" width="100%" height="100%" style="overflow: auto"></iframe>
  24. </div>
  25. </el-card>
  26. </el-col>
  27. </el-row>
  28. </template>
  29. <script>
  30. import request from '@util/gw_ajax_request.js';
  31. import {dateFormat} from '@util/gw_date.js';
  32. import globalVariable from '@api/globalVariable';
  33. export default {
  34. components: {
  35. },
  36. props: ['ids','type','excelName','reportSrc'],
  37. data() {
  38. return {
  39. pid:'000',
  40. pidNodes:[],
  41. dxdcMainHeight: window.innerHeight-200,
  42. dxdcAsideHeight: window.innerHeight-180,
  43. windowHeight:window.innerHeight - 200,
  44. windowWidth:window.innerWidth - 350,
  45. radioTable:1,
  46. loading:false,
  47. leftCol:4,
  48. rightCol:20,
  49. monthValue:dateFormat(new Date(), 'yyyy-MM'),
  50. sttm:'',
  51. ettm:'',
  52. treeWidth: 250,
  53. reportUrl: ''
  54. }
  55. },
  56. mounted() {
  57. this.reportUrl = this.reportSrc
  58. },
  59. methods: {
  60. // 获取Excel数据
  61. searchExecl(){
  62. // 使用form表单post提交,彻底解决参数值过长的问题
  63. this.$refs.formMain.submit();
  64. // 使用_this
  65. let _this = this;
  66. this.$refs.frameMain.onload = function(){
  67. };
  68. },
  69. // 导出Excel数据
  70. exportExecl(){
  71. v = window.frames["frameMain"];
  72. // v.contentWindow.report1_saveAsExcel();
  73. v.report1_saveAsExcel();
  74. },
  75. },
  76. watch:{
  77. ids(val){
  78. if(val){
  79. this.reportUrl = this.reportSrc + val
  80. }else{
  81. this.reportUrl = this.reportSrc
  82. }
  83. },
  84. reportSrc(val){
  85. this.reportUrl = val
  86. },
  87. monthValue(n,o){
  88. if(n == null){
  89. this.monthValue = "";
  90. }
  91. },
  92. sttm(n,o){
  93. if(n == null){
  94. this.sttm = "";
  95. }
  96. },
  97. ettm(n,o){
  98. if(n == null){
  99. this.ettm = "";
  100. }
  101. }
  102. },
  103. activated() {
  104. this.searchExecl();
  105. }
  106. }
  107. </script>
  108. <style scoped>
  109. </style>