main.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <el-dialog
  3. title="提报列表"
  4. :visible.sync="visible"
  5. width="60%"
  6. :before-close="onClose"
  7. append-to-body
  8. class="el-dialogDeep"
  9. v-dialog-drag
  10. >
  11. <avue-crud
  12. :option="option"
  13. :table-loading="loading"
  14. :data="data"
  15. ref="crud"
  16. :page.sync="page"
  17. @current-change="currentChange"
  18. @size-change="sizeChange"
  19. >
  20. <template slot-scope="{ row }" slot="name">
  21. <el-tag style="cursor:pointer" @click="goReport(row.name)">{{
  22. row.name | nameFormat
  23. }}</el-tag>
  24. </template>
  25. </avue-crud>
  26. <span slot="footer" class="dialog-footer">
  27. <el-button @click="onClose()">关 闭</el-button>
  28. </span>
  29. </el-dialog>
  30. </template>
  31. <script>
  32. import { getList } from "@/api/report/report";
  33. import { nameReportFormat } from "@/filters/report";
  34. export default {
  35. data() {
  36. return {
  37. visible: false,
  38. loading: true,
  39. query: {},
  40. page: {
  41. pageSize: 10,
  42. currentPage: 1,
  43. total: 0
  44. },
  45. option: {
  46. height: window.innerHeight - 500,
  47. addBtn: false,
  48. border: true,
  49. index: true,
  50. refreshBtn: false,
  51. menu: false,
  52. columnBtn: false,
  53. header: false,
  54. column: [
  55. {
  56. label: "文件名",
  57. prop: "name",
  58. overHidden: true
  59. },
  60. {
  61. label: "创建时间",
  62. prop: "createTime",
  63. overHidden: true
  64. },
  65. {
  66. label: "更新时间",
  67. prop: "updateTime",
  68. overHidden: true
  69. }
  70. ]
  71. },
  72. data: []
  73. };
  74. },
  75. props: {
  76. switchDialog: {
  77. type: Boolean,
  78. default: false
  79. },
  80. reportName: {
  81. type: String
  82. },
  83. reportId:{
  84. type:String
  85. }
  86. },
  87. filters: {
  88. nameFormat(name) {
  89. return nameReportFormat(name);
  90. }
  91. },
  92. methods: {
  93. onClose() {
  94. this.visible = false;
  95. Object.assign(this.$data, this.$options.data());
  96. this.$emit("onClose", false);
  97. },
  98. getList() {
  99. this.loading = true;
  100. getList(
  101. this.page.currentPage,
  102. this.page.pageSize,
  103. Object.assign(this.query)
  104. ).then(res => {
  105. const data = res.data.data;
  106. this.page.total = data.total;
  107. this.data = data.records;
  108. this.loading = false;
  109. });
  110. },
  111. goReport(name) {
  112. this.$router.push({
  113. path: `/myiframe/urlPath?name=preview-${name}&src=${this.website.reportUrl}/preview?_u=blade-${name}&id=${this.reportId}`
  114. });
  115. }
  116. },
  117. watch: {
  118. switchDialog: function(i) {
  119. this.visible = i;
  120. this.query = {
  121. name: this.reportName?this.reportName:this.$router.currentRoute.name
  122. };
  123. if (i) {
  124. this.getList();
  125. }
  126. }
  127. }
  128. };
  129. </script>
  130. <style lang="scss" scoped></style>