ParentPlatformList.vue 6.7 KB

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