ParentPlatformList.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <div id="app">
  3. <el-container>
  4. <el-header>
  5. <uiHeader></uiHeader>
  6. </el-header>
  7. <el-main>
  8. <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;">
  9. <span style="font-size: 1rem; font-weight: bold;">上级平台列表</span>
  10. </div>
  11. <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;">
  12. <el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" @click="addParentPlatform">添加</el-button>
  13. </div>
  14. <!--设备列表-->
  15. <el-table :data="platformList" border style="width: 100%" :height="winHeight">
  16. <el-table-column prop="name" label="名称" width="240" align="center"></el-table-column>
  17. <el-table-column prop="serverGBId" label="平台编号" width="180" align="center"></el-table-column>
  18. <el-table-column label="是否启用" width="120" align="center">
  19. <template slot-scope="scope">
  20. <div slot="reference" class="name-wrapper">
  21. <el-tag size="medium" v-if="scope.row.enable">已启用</el-tag>
  22. <el-tag size="medium" type="info" v-if="!scope.row.enable">未启用</el-tag>
  23. </div>
  24. </template>
  25. </el-table-column>
  26. <el-table-column label="状态" width="120" align="center">
  27. <template slot-scope="scope">
  28. <div slot="reference" class="name-wrapper">
  29. <el-tag size="medium" v-if="scope.row.status">在线</el-tag>
  30. <el-tag size="medium" type="info" v-if="!scope.row.status">离线</el-tag>
  31. </div>
  32. </template>
  33. </el-table-column>
  34. <el-table-column label="地址" width="180" align="center">
  35. <template slot-scope="scope">
  36. <div slot="reference" class="name-wrapper">
  37. <el-tag size="medium">{{ scope.row.serverIP}}:{{scope.row.serverPort }}</el-tag>
  38. </div>
  39. </template>
  40. </el-table-column>
  41. <el-table-column prop="deviceGBId" label="设备国标编号" width="240" align="center"></el-table-column>
  42. <el-table-column prop="transport" label="信令传输模式" width="120" align="center"></el-table-column>
  43. <el-table-column prop="channelCount" label="通道数" align="center"></el-table-column>
  44. <el-table-column label="操作" width="300" align="center" fixed="right">
  45. <template slot-scope="scope">
  46. <el-button size="mini" icon="el-icon-edit" @click="editPlatform(scope.row)">编辑</el-button>
  47. <el-button size="mini" icon="el-icon-share" type="primary" @click="chooseChannel(scope.row)">选择通道</el-button>
  48. <el-button size="mini" icon="el-icon-delete" type="danger" @click="deletePlatform(scope.row)">删除</el-button>
  49. </template>
  50. </el-table-column>
  51. </el-table>
  52. <el-pagination
  53. style="float: right"
  54. @size-change="handleSizeChange"
  55. @current-change="currentChange"
  56. :current-page="currentPage"
  57. :page-size="count"
  58. :page-sizes="[15, 25, 35, 50]"
  59. layout="total, sizes, prev, pager, next"
  60. :total="total">
  61. </el-pagination>
  62. <platformEdit ref="platformEdit" ></platformEdit>
  63. <chooseChannelDialog ref="chooseChannelDialog" ></chooseChannelDialog>
  64. </el-main>
  65. </el-container>
  66. </div>
  67. </template>
  68. <script>
  69. import platformEdit from './dialog/platformEdit.vue'
  70. import uiHeader from './UiHeader.vue'
  71. import chooseChannelDialog from './dialog/chooseChannel.vue'
  72. export default {
  73. name: 'app',
  74. components: {
  75. platformEdit,
  76. uiHeader,
  77. chooseChannelDialog
  78. },
  79. data() {
  80. return {
  81. platformList: [], //设备列表
  82. winHeight: window.innerHeight - 260,
  83. currentPage:1,
  84. count:15,
  85. total:0
  86. };
  87. },
  88. computed: {
  89. getcurrentDeviceChannels: function() {
  90. }
  91. },
  92. mounted() {
  93. this.initData();
  94. this.updateLooper = setInterval(this.initData, 10000);
  95. },
  96. destroyed() {
  97. clearTimeout(this.updateLooper);
  98. },
  99. methods: {
  100. addParentPlatform: function() {
  101. this.$refs.platformEdit.openDialog(null, this.initData)
  102. },
  103. editPlatform: function(platform) {
  104. console.log(platform)
  105. this.$refs.platformEdit.openDialog(platform, this.initData)
  106. },
  107. deletePlatform: function(platform) {
  108. var that = this;
  109. that.$confirm('确认删除?', '提示', {
  110. confirmButtonText: '确定',
  111. cancelButtonText: '取消',
  112. type: 'warning'
  113. }).then(() => {
  114. that.deletePlatformCommit(platform)
  115. })
  116. },
  117. deletePlatformCommit: function(platform) {
  118. var that = this;
  119. that.$axios({
  120. method: 'delete',
  121. url:`/api/platform/delete/${platform.serverGBId}`
  122. }).then(function (res) {
  123. if (res.data == "success") {
  124. that.$message({
  125. showClose: true,
  126. message: '删除成功',
  127. type: 'success'
  128. });
  129. that.initData()
  130. }
  131. }).catch(function (error) {
  132. console.log(error);
  133. });
  134. },
  135. chooseChannel: function(platform) {
  136. this.$refs.chooseChannelDialog.openDialog(platform.serverGBId, ()=>{
  137. this.initData()
  138. })
  139. },
  140. initData: function() {
  141. this.getPlatformList();
  142. },
  143. currentChange: function(val){
  144. this.currentPage = val;
  145. this.getPlatformList();
  146. },
  147. handleSizeChange: function(val){
  148. this.count = val;
  149. this.getPlatformList();
  150. },
  151. getPlatformList: function() {
  152. let that = this;
  153. this.$axios({
  154. method: 'get',
  155. url:`/api/platform/query/${that.count}/${that.currentPage}`
  156. }).then(function (res) {
  157. that.total = res.data.total;
  158. that.platformList = res.data.list;
  159. }).catch(function (error) {
  160. console.log(error);
  161. });
  162. }
  163. }
  164. };
  165. </script>