ParentPlatformList.vue 6.6 KB

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