ParentPlatformList.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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" 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 './platformEdit.vue'
  70. import uiHeader from './UiHeader.vue'
  71. import chooseChannelDialog from './gb28181/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.$refs.chooseChannelDialog.openDialog()
  94. this.initData();
  95. this.updateLooper = setInterval(this.initData, 10000);
  96. },
  97. destroyed() {
  98. clearTimeout(this.updateLooper);
  99. },
  100. methods: {
  101. addParentPlatform: function() {
  102. this.$refs.platformEdit.openDialog(null, this.initData)
  103. },
  104. editPlatform: function(platform) {
  105. console.log(platform)
  106. this.$refs.platformEdit.openDialog(platform, this.initData)
  107. },
  108. deletePlatform: function(platform) {
  109. var that = this;
  110. that.$confirm('确认删除?', '提示', {
  111. confirmButtonText: '确定',
  112. cancelButtonText: '取消',
  113. type: 'warning'
  114. }).then(() => {
  115. that.deletePlatformCommit(platform)
  116. })
  117. },
  118. deletePlatformCommit: function(platform) {
  119. var that = this;
  120. that.$axios.post(`/api/platforms/delete`, platform)
  121. .then(function (res) {
  122. if (res.data == "success") {
  123. that.$message({
  124. showClose: true,
  125. message: '删除成功',
  126. type: 'success'
  127. });
  128. that.initData()
  129. }
  130. })
  131. .catch(function (error) {
  132. console.log(error);
  133. });
  134. },
  135. chooseChannel: function(platform) {
  136. this.$refs.chooseChannelDialog.openDialog()
  137. },
  138. initData: function() {
  139. this.getPlatformList();
  140. },
  141. currentChange: function(val){
  142. this.currentPage = val;
  143. this.getPlatformList();
  144. },
  145. handleSizeChange: function(val){
  146. this.count = val;
  147. this.getPlatformList();
  148. },
  149. getPlatformList: function() {
  150. let that = this;
  151. this.$axios.get(`/api/platforms/${that.count}/${that.currentPage - 1}`)
  152. .then(function (res) {
  153. that.total = res.data.total;
  154. that.platformList = res.data.list;
  155. })
  156. .catch(function (error) {
  157. console.log(error);
  158. });
  159. }
  160. }
  161. };
  162. </script>