main.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. :cell-style="cellStyle"
  20. >
  21. <template slot-scope="{ row }" slot="name">
  22. <el-tag style="cursor:pointer" @click="goReport(row.name)">{{
  23. row.name | nameFormat
  24. }}</el-tag>
  25. </template>
  26. </avue-crud>
  27. <span slot="footer" class="dialog-footer">
  28. <el-button @click="onClose()">关 闭</el-button>
  29. </span>
  30. </el-dialog>
  31. </template>
  32. <script>
  33. import { getList } from "@/api/report/report";
  34. import { nameReportFormat } from "@/filters/report";
  35. export default {
  36. data() {
  37. return {
  38. visible: false,
  39. loading: true,
  40. query: {},
  41. page: {
  42. pageSize: 10,
  43. currentPage: 1,
  44. total: 0
  45. },
  46. option: {
  47. height: window.innerHeight - 500,
  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. });
  114. },
  115. goReport(name) {
  116. this.$router.push({
  117. path: `/myiframe/urlPath?name=preview-${name}&src=${this.website.reportUrl}/preview?_u=blade-${name}&id=${this.reportId}`
  118. });
  119. this.$emit("onClose", false);
  120. }
  121. },
  122. watch: {
  123. switchDialog: function(i) {
  124. this.visible = i;
  125. this.query = {
  126. name: this.reportName ? this.reportName : this.$router.currentRoute.name
  127. };
  128. if (i) {
  129. this.getList();
  130. }
  131. }
  132. }
  133. };
  134. </script>
  135. <style lang="scss" scoped></style>