AdminStoreNode.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <el-container>
  3. <el-header height="220">
  4. <h3>存储节点</h3>
  5. </el-header>
  6. <el-main>
  7. <el-table
  8. :data="dataList"
  9. border
  10. height="480"
  11. style="width: 100%"
  12. >
  13. <el-table-column
  14. fixed="left"
  15. label="No"
  16. type="index"
  17. />
  18. <el-table-column
  19. prop="nodeAddr"
  20. label="地址"
  21. />
  22. <el-table-column
  23. prop="httpPort"
  24. label="HTTP 端口"
  25. />
  26. <el-table-column
  27. prop="rpcPort"
  28. label="RPC 端口"
  29. />
  30. <el-table-column
  31. prop="total"
  32. label="存储空间"
  33. >
  34. <template slot-scope="scope">
  35. <el-progress :percentage="scope.row.percent"></el-progress>
  36. </template>
  37. </el-table-column>
  38. <el-table-column
  39. prop="status"
  40. label="状态"
  41. />
  42. <el-table-column
  43. fixed="right"
  44. label="操作"
  45. width="280"
  46. >
  47. <template slot-scope="scope">
  48. <el-button
  49. size="mini"
  50. @click="handleEdit(scope.$index, scope.row)"
  51. >磁盘详情</el-button>
  52. <el-button
  53. size="mini"
  54. @click="handleEdit(scope.$index, scope.row)"
  55. >禁用</el-button>
  56. <el-button
  57. size="mini"
  58. type="danger"
  59. @click="handleDelete(scope.$index, scope.row)"
  60. >删除</el-button>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. </el-main>
  65. <!-- 修改视频可见范围对话框 -->
  66. <el-dialog
  67. append-to-body
  68. :visible.sync="showEditScopeDialog"
  69. center
  70. >
  71. <div>
  72. <h3>存储节点磁盘详情</h3>
  73. <el-table
  74. :data="tableList"
  75. border
  76. height="480"
  77. style="width: 100%"
  78. >
  79. <el-table-column
  80. fixed="left"
  81. label="No"
  82. type="index"
  83. />
  84. <el-table-column
  85. prop="fsType"
  86. label="文件系统"
  87. />
  88. <el-table-column
  89. prop="volume"
  90. label="磁盘分区"
  91. />
  92. <el-table-column
  93. prop="storeDir"
  94. label="存储目录"
  95. />
  96. <el-table-column
  97. prop="total"
  98. label="分区容量"
  99. >
  100. <template slot-scope="scope">
  101. <el-progress :percentage="scope.row.percent"></el-progress>
  102. </template>
  103. </el-table-column>
  104. <el-table-column
  105. prop="totalInode"
  106. label="inode 容量"
  107. >
  108. <template slot-scope="scope">
  109. <el-progress :percentage="scope.row.percentInode"></el-progress>
  110. </template>
  111. </el-table-column>
  112. </el-table>
  113. </div>
  114. </el-dialog>
  115. </el-container>
  116. </template>
  117. <script>
  118. import { getStoreDisks, getStoreList } from '@/api/oss'
  119. export default {
  120. name: 'AdminStoreNode',
  121. data() {
  122. return {
  123. queryInfo: {
  124. path: null
  125. },
  126. // 屏幕宽度, 为了控制分页条的大小
  127. screenWidth: document.body.clientWidth,
  128. currentPage: 1,
  129. pageSize: 12,
  130. totalSize: 0,
  131. dataList: [],
  132. tableList: [],
  133. nextId: 0,
  134. // **********************************************************************
  135. showEditScopeDialog: false,
  136. form: {
  137. videoId: null,
  138. scope: 1
  139. }
  140. }
  141. },
  142. created() {
  143. document.title = '存储节点'
  144. this.getData()
  145. },
  146. methods: {
  147. getData() {
  148. this.dataList = []
  149. getStoreList().then(resp => {
  150. if (resp.code === 0) {
  151. this.dataList = resp.data
  152. }
  153. })
  154. },
  155. onRefresh() {
  156. this.getData()
  157. },
  158. handleCurrentChange(pageNumber) {
  159. this.currentPage = pageNumber
  160. this.getData()
  161. // 回到顶部
  162. scrollTo(0, 0)
  163. },
  164. handleEdit(index, row) {
  165. this.showEditScopeDialog = true
  166. getStoreDisks((row.id)).then(resp => {
  167. if (resp.code === 0) {
  168. this.tableList = resp.data
  169. }
  170. })
  171. },
  172. handleDelete(index, row) {
  173. this.$confirm('确定要删除 ' + row.title + '?', '提示', {
  174. confirmButtonText: '确定',
  175. cancelButtonText: '取消',
  176. type: 'warning'
  177. }).then(() => {
  178. this.$message.info('handleDelete')
  179. }).catch(() => {
  180. this.$message({
  181. type: 'info',
  182. message: '已取消'
  183. })
  184. })
  185. },
  186. onUpdateScope() {
  187. this.showEditScopeDialog = false
  188. },
  189. onSelectChange() {
  190. this.dataList = []
  191. },
  192. handleClose() {
  193. }
  194. }
  195. }
  196. </script>
  197. <style>
  198. </style>