dialog.info.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <div class="edu-training-edit">
  3. <DialogCom :title="this.title" :visible.sync="isShow" width="1000px" append-to-body>
  4. <div class="page-body">
  5. <div class="extend_mod">
  6. <el-table :data="logList" border style="width: 100%;height: auto" row-key="id" :default-expand-all="false" :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
  7. <el-table-column
  8. prop="fileName"
  9. label="文件名称"
  10. align="left"
  11. ></el-table-column>
  12. <el-table-column
  13. prop="fileType"
  14. label="文件类型"
  15. align="center"
  16. >
  17. <template slot-scope="scope">
  18. {{ scope.row.fileType == 1 ? '文件' : '目录' }}
  19. </template>
  20. </el-table-column>
  21. <el-table-column
  22. prop="fileSize"
  23. label="文件大小"
  24. align="center"
  25. >
  26. </el-table-column>
  27. <el-table-column
  28. label="操作"
  29. align="center"
  30. width="200"
  31. class-name="small-padding fixed-width"
  32. >
  33. <template slot-scope="scope">
  34. <el-button
  35. size="mini"
  36. type="text"
  37. icon="el-icon-edit-outline"
  38. v-if="scope.row.fileType ==1 "
  39. @click="transferLog(scope.row)"
  40. >获取日志
  41. </el-button>
  42. <el-button
  43. size="mini"
  44. type="text"
  45. icon="el-icon-delete"
  46. v-if="scope.row.exit == 1"
  47. @click="downloadLog(scope.row)"
  48. >下载
  49. </el-button>
  50. </template>
  51. </el-table-column>
  52. </el-table>
  53. </div>
  54. </div>
  55. <div slot="footer" class="dialog-footer">
  56. <el-button @click="onHide">关闭</el-button>
  57. </div>
  58. </DialogCom>
  59. </div>
  60. </template>
  61. <script>
  62. import {mapMutations, mapState} from "vuex";
  63. import {getLogList, transferLogData} from "@/api/system/logManagement";
  64. import {getLabel} from "@/views/commonOption";
  65. export default {
  66. components: {},
  67. dicts: [],
  68. data() {
  69. const params = this.$route.params;
  70. return {
  71. id: params ? params.id : null,
  72. isShow: false,
  73. formData: this.reset(),
  74. title: '',
  75. logList: [],
  76. serverId: null,
  77. serviceId: null,
  78. };
  79. },
  80. props: {},
  81. watch: {},
  82. computed: {
  83. ...mapState(["loginUser"]),
  84. },
  85. methods: {
  86. ...mapMutations([]),
  87. getLabel,
  88. reset(other = {}) {
  89. return {
  90. fileName: null,
  91. fileSize: null,
  92. fileType: null,
  93. ...other,
  94. };
  95. },
  96. async refresh(serverId, serviceId) {
  97. if (!serverId || !serviceId) {
  98. this.reset(serverId);
  99. } else {
  100. getLogList(serverId, serviceId).then((response) => {
  101. this.logList = response.data;
  102. this.loading = false;
  103. });
  104. }
  105. },
  106. async show(server, service, other = {}) {
  107. this.serverId = server.id;
  108. this.serviceId = service.id;
  109. this.title = service.checkName + "日志详情页";
  110. await this.refresh(server.id, service.id);
  111. this.isShow = true;
  112. },
  113. transferLog(row) {
  114. console.log(row)
  115. let data = {
  116. serverId: this.serverId,
  117. parentPath: row.parentPath,
  118. path: row.path,
  119. rootDir: row.path,
  120. };
  121. transferLogData(data).then((response) => {
  122. this.$message.success("获取成功,正在重新加载页面!");
  123. this.refresh(this.serverId, this.serviceId);
  124. });
  125. },
  126. downloadLog(row){
  127. let data = {
  128. serverId: this.serverId,
  129. parentPath: row.parentPath,
  130. path: row.path,
  131. rootDir: row.path,
  132. };
  133. this.download(
  134. "/system/server/downloadLogData",
  135. {
  136. ...data,
  137. },
  138. row.fileName
  139. );
  140. },
  141. // 事件
  142. onHide() {
  143. this.isShow = false;
  144. },
  145. },
  146. mounted() {
  147. },
  148. };
  149. </script>
  150. <style lang="scss" scoped>
  151. .page-body {
  152. max-height: 500px;
  153. overflow: auto;
  154. }
  155. </style>