bc975c5e7318062d85893ae1b6907642dd1c9b87.svn-base 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <el-row>
  3. <el-col :span="leftCol" ref="elw">
  4. <el-card :body-style="{'padding':'0'}">
  5. <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">工程信息</p>
  6. <export-tree-list-slgc
  7. @provTreeSelectChange="provTreeSelectChange"
  8. :height="dxdcAsideHeight"
  9. :width="treeWidth"
  10. ></export-tree-list-slgc>
  11. </el-card>
  12. </el-col>
  13. <el-col :span="rightCol">
  14. <el-card :body-style="{'padding-top':'10px'}">
  15. <div class="block">
  16. <span class="demonstration" style="margin-right: 5px">选择时间段</span>
  17. <el-date-picker
  18. v-model="findTime"
  19. type="daterange"
  20. value-format="yyyy-MM-dd"
  21. range-separator="至"
  22. start-placeholder="开始日期"
  23. end-placeholder="结束日期">
  24. </el-date-picker>
  25. <el-button type="primary" icon="el-icon-download"
  26. style="float: right;margin:0 5px"
  27. @click="exportExecl">导出</el-button>
  28. <el-button type="primary" icon="el-icon-search" style="float: right;margin:0 5px" @click="searchExecl">查询</el-button>
  29. </div>
  30. </el-card>
  31. <el-card :body-style="{'height':dxdcMainHeight + 'px','padding':'0'}">
  32. <form ref="myForm" id="myForm" target="myIframe" :action="reportSrc" method="post">
  33. <input type="hidden" name="width" v-model="windowWidth">
  34. <input type="hidden" name="height" v-model="windowHeight">
  35. <input type="hidden" name="objId" ref="objId" id="objId">
  36. <input type="hidden" name="excelName" v-model="excelName">
  37. <input type="hidden" name="stm" v-model="stm" ref="stm" id="stm">
  38. <input type="hidden" name="etm" v-model="etm" ref="etm" kd="etm">
  39. </form>
  40. <div style="width: 100%;height: 100%;" v-loading="loading">
  41. <iframe ref="myIframe" id="myIframe" name="myIframe" src="" frameborder="0" width="100%" height="100%" style="overflow: auto"></iframe>
  42. </div>
  43. </el-card>
  44. </el-col>
  45. </el-row>
  46. </template>
  47. <script>
  48. import request from '../../../utils/gw_ajax_request.js';
  49. import exportTreeListSlgc from '../exportTreeList_slgc.vue';
  50. import {dateFormat,formatDateTime11} from '../../../utils/gw_date.js';
  51. import globalVariable from "@api/globalVariable.js";
  52. export default {
  53. components: {
  54. exportTreeListSlgc:exportTreeListSlgc,
  55. },
  56. data() {
  57. return {
  58. dxdcMainHeight: window.innerHeight-180,
  59. dxdcAsideHeight: window.innerHeight-130,
  60. windowHeight:window.innerHeight - 160,
  61. windowWidth:window.innerWidth - 250,
  62. reportSrc:'/JsReport/reportFiles/reportjsp/showReport_doc.jsp?raq=dc_zdslgc_word.raq',
  63. loading:true,
  64. leftCol:4,
  65. rightCol:20,
  66. excelName:'水利工程建设督查报告',
  67. findTime: [
  68. new Date(formatDateTime11(15,new Date())),
  69. new Date()
  70. ],
  71. objId:'',
  72. stm: dateFormat(new Date(formatDateTime11(15,new Date())),'yyyy-MM-dd'),
  73. etm: dateFormat(new Date(),'yyyy-MM-dd'),
  74. treeWidth: 200,
  75. }
  76. },
  77. mounted() {
  78. this.treeWidth = this.$refs.elw.$el.clientWidth;
  79. },
  80. computed: {
  81. userId: function () {
  82. return localStorage.getItem("userid")
  83. ? localStorage.getItem("userid")
  84. : "1098101939614724096";
  85. }
  86. },
  87. methods: {
  88. provTreeSelectChange(data){
  89. //
  90. document.getElementById("id").value = data.objId;
  91. this.searchExecl();
  92. // console.log(globalVariable)
  93. // console.log(globalVariable)
  94. },
  95. // 获取Excel数据
  96. searchExecl(){
  97. //
  98. let findTime = this.findTime;
  99. if(!(findTime[0] instanceof Date)){
  100. this.stm = findTime[0];
  101. this.etm = findTime[1];
  102. }
  103. this.loading = true;
  104. // 有一个问题v-model绑定滞后一个节点
  105. this.$refs.stm = this.etm;
  106. this.$refs.etm = this.etm;
  107. // 使用form表单post提交,彻底解决参数值过长的问题
  108. this.$refs.myForm.submit();
  109. // 使用_this
  110. let _this = this;
  111. this.$refs.myIframe.onload = function(){
  112. _this.loading = false;
  113. };
  114. },
  115. // 导出word数据
  116. exportExecl(){
  117. v = window.frames["myIframe"];
  118. // v.contentWindow.report1_saveAsWord();
  119. v.report1_saveAsWord();
  120. },
  121. },
  122. watch:{
  123. },
  124. activated() {
  125. this.searchExecl();
  126. }
  127. }
  128. </script>
  129. <style scoped>
  130. </style>