main.vue 3.0 KB

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