main.vue 2.8 KB

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