fb71514ea5065e1608e4f57daf389cd7e66fc2f7.svn-base 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <template>
  2. <el-row>
  3. <el-col :span="24">
  4. <el-card :body-style="{'padding-top':'10px'}">
  5. <div class="block">
  6. <span class="demonstration" style="margin-right: 5px">选择时间段</span>
  7. <el-date-picker
  8. v-model="findTime"
  9. type="daterange"
  10. value-format="yyyy-MM-dd"
  11. range-separator="至"
  12. start-placeholder="开始日期"
  13. end-placeholder="结束日期">
  14. </el-date-picker>
  15. <el-button type="primary" icon="el-icon-download"
  16. style="float: right;margin:0 5px"
  17. @click="exportExecl">导出</el-button>
  18. <el-button type="primary" icon="el-icon-search" style="float: right;margin:0 5px" @click="searchExecl">查询</el-button>
  19. </div>
  20. </el-card>
  21. <el-card :body-style="{'height':dxdcMainHeight + 'px','padding':'0'}">
  22. <form ref="formMain11" id="formMain11" target="frameMain11" :action="reportSrc" method="post">
  23. <input type="hidden" name="width" v-model="windowWidth">
  24. <input type="hidden" name="height" v-model="windowHeight">
  25. <input type="hidden" name="excelName" v-model="excelName">
  26. <input type="hidden" id="sttm" name="sttm" v-model="sttm">
  27. <input type="hidden" id="ettm" name="ettm" v-model="ettm">
  28. <input type="hidden" name="year" v-model="newYear">
  29. <input type="hidden" name="adcode" v-model="adCode">
  30. <input type="hidden" name="level" v-model="level">
  31. </form>
  32. <div style="width: 100%;height: 100%;" v-loading="loading">
  33. <iframe ref="frameMain11" id="frameMain11" name="frameMain11" src="" frameborder="0" width="100%" height="100%" style="overflow: auto"></iframe>
  34. </div>
  35. </el-card>
  36. </el-col>
  37. </el-row>
  38. </template>
  39. <script>
  40. import {dateFormat,getFirstDayOfMonth} from '../../utils/gw_date.js';
  41. export default {
  42. props: ['newYear','table','adCode','adGrad'],
  43. data() {
  44. return {
  45. pid:'000',
  46. pidNodes:[],
  47. type:'111',
  48. dxdcMainHeight: window.innerHeight-200,
  49. dxdcAsideHeight: window.innerHeight-180,
  50. windowHeight:window.innerHeight - 200,
  51. windowWidth:window.innerWidth - 350,
  52. reportSrc:'/demo/reportJsp/showReport.jsp?rpx=dx_total_shi_fj03&scroll=yes',
  53. radioTable:1,
  54. loading:false,
  55. leftCol:4,
  56. rightCol:20,
  57. excelName:"2024年度汛安全综合检查问题情况表",
  58. findTime: [getFirstDayOfMonth(new Date(), 'yyyy-MM-dd'), dateFormat(new Date(), 'yyyy-MM-dd')],
  59. sttm: getFirstDayOfMonth(new Date(), 'yyyy-MM-dd'),
  60. ettm: dateFormat(new Date(), 'yyyy-MM-dd'),
  61. treeWidth: 250,
  62. dcType: ["0","1","2"],
  63. level:null,
  64. }
  65. },
  66. computed: {
  67. userId: function () {
  68. return localStorage.getItem("userid")
  69. ? localStorage.getItem("userid")
  70. : "1098101939614724096";
  71. },
  72. currentRlcode() {
  73. return localStorage.getItem('currentRlcode') ? localStorage.getItem('currentRlcode') : ''
  74. }
  75. },
  76. mounted() {
  77. this.searchExecl();
  78. },
  79. methods: {
  80. // 获取Excel数据
  81. searchExecl(){
  82. if(!this.adGrad || !this.adCode){
  83. return;
  84. }
  85. this.loading = true;
  86. this.level = this.adGrad=='3'?4:this.adGrad=='2'?2:6
  87. this.$nextTick(()=>{
  88. // 使用form表单post提交,彻底解决参数值过长的问题
  89. this.$refs.formMain11.submit();
  90. // 使用_this
  91. let _this = this;
  92. this.$refs.frameMain11.onload = function(){
  93. _this.loading = false;
  94. };
  95. })
  96. },
  97. // 导出Excel数据
  98. exportExecl(){
  99. v = window.frames["frameMain11"];
  100. // v.contentWindow.report1_saveAsExcel();
  101. v.report1_saveAsExcel();
  102. },
  103. },
  104. watch:{
  105. findTime(n,o){
  106. if(!n){
  107. this.sttm = "";
  108. this.ettm = "";
  109. }else{
  110. this.sttm = n[0];
  111. this.ettm = n[1];
  112. }
  113. },
  114. adCode: {
  115. immediate: true, // immediate选项可以开启首次赋值监听
  116. async handler(newVal, oldVal) {
  117. this.$nextTick(()=>{
  118. this.searchExecl();
  119. })
  120. }
  121. },
  122. adGrad: {
  123. immediate: true,
  124. async handler(newVal, oldVal) {
  125. this.$nextTick(()=>{
  126. this.searchExecl();
  127. })
  128. }
  129. }
  130. }
  131. }
  132. </script>
  133. <style scoped>
  134. </style>