8e2434f026474e64ca4aea8dada735866778c8bb.svn-base 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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="formMain10" id="formMain10" target="frameMain10" :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. </form>
  31. <div style="width: 100%;height: 100%;" v-loading="loading">
  32. <iframe ref="frameMain10" id="frameMain10" name="frameMain10" src="" frameborder="0" width="100%" height="100%" style="overflow: auto"></iframe>
  33. </div>
  34. </el-card>
  35. </el-col>
  36. </el-row>
  37. </template>
  38. <script>
  39. import {dateFormat,getFirstDayOfMonth} from '../../utils/gw_date.js';
  40. export default {
  41. props: ['newYear','table','adCode','adGrad'],
  42. data() {
  43. return {
  44. pid:'000',
  45. pidNodes:[],
  46. type:'111',
  47. dxdcMainHeight: window.innerHeight-200,
  48. dxdcAsideHeight: window.innerHeight-180,
  49. windowHeight:window.innerHeight - 200,
  50. windowWidth:window.innerWidth - 350,
  51. reportSrc:'',
  52. reportSrc1:'/demo/reportJsp/showReport.jsp?rpx=dx_total_shi_fj&scroll=yes',
  53. reportSrc2:'/demo/reportJsp/showReport.jsp?rpx=dx_total_xian_fj&scroll=yes',
  54. radioTable:1,
  55. loading:false,
  56. leftCol:4,
  57. rightCol:20,
  58. excelName:"",
  59. findTime: [getFirstDayOfMonth(new Date(), 'yyyy-MM-dd'), dateFormat(new Date(), 'yyyy-MM-dd')],
  60. sttm: getFirstDayOfMonth(new Date(), 'yyyy-MM-dd'),
  61. ettm: dateFormat(new Date(), 'yyyy-MM-dd'),
  62. treeWidth: 250,
  63. dcType: ["0","1","2"],
  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.$nextTick(()=>{
  78. // this.searchExecl();
  79. // })
  80. },
  81. methods: {
  82. // 获取Excel数据
  83. searchExecl(){
  84. if(!this.adGrad || !this.adCode){
  85. return;
  86. }
  87. this.reportSrc = this.adGrad=='3'?this.reportSrc1:this.reportSrc2;
  88. this.excelName = this.adGrad=='3'?'市级汇总统计表':'县级汇总统计表'
  89. this.loading = true;
  90. this.$nextTick(()=>{
  91. // 使用form表单post提交,彻底解决参数值过长的问题
  92. this.$refs.formMain10.submit();
  93. // 使用_this
  94. let _this = this;
  95. this.$refs.frameMain10.onload = function(){
  96. _this.loading = false;
  97. };
  98. })
  99. },
  100. // 导出Excel数据
  101. exportExecl(){
  102. v = window.frames["frameMain10"];
  103. // v.contentWindow.report1_saveAsExcel();
  104. v.report1_saveAsExcel();
  105. },
  106. },
  107. watch:{
  108. findTime(n,o){
  109. if(!n){
  110. this.sttm = "";
  111. this.ettm = "";
  112. }else{
  113. this.sttm = n[0];
  114. this.ettm = n[1];
  115. }
  116. },
  117. adGrad: {
  118. async handler(newVal, oldVal) {
  119. this.$nextTick(()=>{
  120. this.searchExecl();
  121. })
  122. }
  123. },
  124. adCode: {
  125. async handler(newVal, oldVal) {
  126. this.$nextTick(()=>{
  127. this.searchExecl();
  128. })
  129. }
  130. }
  131. }
  132. }
  133. </script>
  134. <style scoped>
  135. </style>