PortalParamView.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div>
  3. <!-- 参数区域 -->
  4. <template v-if="pms.length > 0 ">
  5. <el-form :model="reportParam" ref="paramForm" size="small" label-position="left" >
  6. <div class="ibox reportParams" style="margin:5px;">
  7. <div class="row">
  8. <div class="ibox-content" style="padding:5px;border:none;">
  9. <template v-for="item in pms.filter(m=>m.type != 'hidden')">
  10. <div class="col-sm-3" :key="item.id">
  11. <el-form-item :label="item.desc" label-width="80px">
  12. <template v-if="item.inputType==='text'">
  13. <el-input v-model="reportParam[item.id]" placeholder="请录入"></el-input>
  14. </template>
  15. <template v-if="item.inputType==='select'">
  16. <el-select v-model="reportParam[item.id]" clearable placeholder="请选择" style="width:100%">
  17. <el-option v-for="item in item.options" :key="item.value" :label="item.text" :value="item.value">
  18. </el-option>
  19. </el-select>
  20. </template>
  21. <template v-if="item.inputType==='mselect'">
  22. <el-select v-model="reportParam[item.id]" multiple clearable placeholder="请选择" style="width:100%">
  23. <el-option v-for="item in item.options" :key="item.value" :label="item.text" :value="item.value">
  24. </el-option>
  25. </el-select>
  26. </template>
  27. <template v-if="item.inputType === 'dateSelect'">
  28. <el-date-picker v-model="reportParam[item.id]" :format="item.dateFormat"
  29. style="width:100%" :type="item.dateType" placeholder="选择日期" :value-format="item.dateFormat"></el-date-picker>
  30. </template>
  31. </el-form-item>
  32. </div>
  33. </template>
  34. <div class="col-sm-3">
  35. <button type="button" class="btn btn-info btn-sm" @click="search">查询</button>
  36. <button type="button" class="btn btn-success btn-sm" @click="cleardata">清除</button>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </el-form>
  42. </template>
  43. </div>
  44. </template>
  45. <script>
  46. import {baseUrl, ajax} from '@/common/biConfig'
  47. import LayoutView from './LayoutView.vue'
  48. import { Loading } from 'element-ui'
  49. import $ from 'jquery'
  50. export default {
  51. name: "portalParamView",
  52. components: {
  53. LayoutView
  54. },
  55. props: {
  56. pms:{
  57. type:Array,
  58. required:true,
  59. default:[]
  60. }
  61. },
  62. data() {
  63. return {
  64. reportParam:{
  65. }
  66. }
  67. },
  68. methods: {
  69. cleardata(){
  70. $(this.pms).each((a, b)=>{
  71. this.reportParam[b.id] = null;
  72. });
  73. },
  74. /**
  75. * 获取参数值
  76. */
  77. getParamValues(){
  78. let dt = JSON.parse(JSON.stringify(this.reportParam));
  79. //处理多选参数
  80. $(this.pms).each((a, b)=>{
  81. if(b.inputType === 'mselect' && dt[b.id]){
  82. dt[b.id] = dt[b.id].join(",");
  83. }
  84. });
  85. return dt;
  86. },
  87. search(){
  88. let dt = this.getParamValues();
  89. let reportId = this.$parent.reportId;
  90. dt['serviceid'] = "ext.sys.tab.ajax";
  91. dt['t_from_id'] = "mv_" + reportId;
  92. dt['mvid'] = "mv_" + reportId;
  93. let loadingInstance = Loading.service({fullscreen:false, target:document.querySelector('.wrapper-content-nomargin')});
  94. ajax({
  95. url:"control/extControl",
  96. data:dt,
  97. type:"POST",
  98. success:(resp)=>{
  99. //重新渲染报表
  100. this.$parent.$refs['optarea'].setCompData(resp.rows);
  101. }
  102. }, this, loadingInstance);
  103. },
  104. //初始化参数字段
  105. initReportParam(reportParam){
  106. let ts = this;
  107. }
  108. },
  109. mounted(){
  110. },
  111. watch: {
  112. }
  113. }
  114. </script>
  115. <style lang="less" scoped>
  116. </style>