ParentPlatformList.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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="名称" 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="200" 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="通道数" width="120" align="center"></el-table-column>
  44. <el-table-column label="订阅信息" width="240" align="center" fixed="right">
  45. <template slot-scope="scope">
  46. <i v-if="scope.row.alarmSubscribe" style="font-size: 1.5rem;" title="报警订阅" class="subscribe-on iconfont icon-gbaojings" ></i>
  47. <i v-if="!scope.row.alarmSubscribe" style="font-size: 1.5rem;" title="报警订阅" class="subscribe-off iconfont icon-gbaojings" ></i>
  48. <i v-if="scope.row.catalogSubscribe" title="目录订阅" class="subscribe-on iconfont icon-gjichus" ></i>
  49. <i v-if="!scope.row.catalogSubscribe" title="目录订阅" class="subscribe-off iconfont icon-gjichus" ></i>
  50. <i v-if="scope.row.gpsSubscribe" title="位置订阅" class="subscribe-on iconfont icon-gxunjians" ></i>
  51. <i v-if="!scope.row.gpsSubscribe" title="位置订阅" class="subscribe-off iconfont icon-gxunjians" ></i>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="操作" width="300" align="center" fixed="right">
  55. <template slot-scope="scope">
  56. <el-button size="mini" icon="el-icon-edit" @click="editPlatform(scope.row)">编辑</el-button>
  57. <el-button size="mini" icon="el-icon-share" type="primary" @click="chooseChannel(scope.row)">选择通道</el-button>
  58. <el-button size="mini" icon="el-icon-delete" type="danger" @click="deletePlatform(scope.row)">删除</el-button>
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. <el-pagination
  63. style="float: right"
  64. @size-change="handleSizeChange"
  65. @current-change="currentChange"
  66. :current-page="currentPage"
  67. :page-size="count"
  68. :page-sizes="[15, 25, 35, 50]"
  69. layout="total, sizes, prev, pager, next"
  70. :total="total">
  71. </el-pagination>
  72. <platformEdit ref="platformEdit" ></platformEdit>
  73. <chooseChannelDialog ref="chooseChannelDialog" ></chooseChannelDialog>
  74. </el-main>
  75. </el-container>
  76. </div>
  77. </template>
  78. <script>
  79. import platformEdit from './dialog/platformEdit.vue'
  80. import uiHeader from './UiHeader.vue'
  81. import chooseChannelDialog from './dialog/chooseChannel.vue'
  82. export default {
  83. name: 'app',
  84. components: {
  85. platformEdit,
  86. uiHeader,
  87. chooseChannelDialog
  88. },
  89. data() {
  90. return {
  91. platformList: [], //设备列表
  92. winHeight: window.innerHeight - 260,
  93. currentPage:1,
  94. count:15,
  95. total:0
  96. };
  97. },
  98. computed: {
  99. getcurrentDeviceChannels: function() {
  100. }
  101. },
  102. mounted() {
  103. this.initData();
  104. this.updateLooper = setInterval(this.initData, 10000);
  105. },
  106. destroyed() {
  107. clearTimeout(this.updateLooper);
  108. },
  109. methods: {
  110. addParentPlatform: function() {
  111. this.$refs.platformEdit.openDialog(null, this.initData)
  112. },
  113. editPlatform: function(platform) {
  114. console.log(platform)
  115. this.$refs.platformEdit.openDialog(platform, this.initData)
  116. },
  117. deletePlatform: function(platform) {
  118. var that = this;
  119. that.$confirm('确认删除?', '提示', {
  120. confirmButtonText: '确定',
  121. cancelButtonText: '取消',
  122. type: 'warning'
  123. }).then(() => {
  124. that.deletePlatformCommit(platform)
  125. })
  126. },
  127. deletePlatformCommit: function(platform) {
  128. var that = this;
  129. that.$axios({
  130. method: 'delete',
  131. url:`/api/platform/delete/${platform.serverGBId}`
  132. }).then(function (res) {
  133. if (res.data == "success") {
  134. that.$message({
  135. showClose: true,
  136. message: '删除成功',
  137. type: 'success'
  138. });
  139. that.initData()
  140. }
  141. }).catch(function (error) {
  142. console.log(error);
  143. });
  144. },
  145. chooseChannel: function(platform) {
  146. this.$refs.chooseChannelDialog.openDialog(platform.serverGBId, platform.name, platform.catalogId, this.initData)
  147. },
  148. initData: function() {
  149. this.getPlatformList();
  150. },
  151. currentChange: function(val){
  152. this.currentPage = val;
  153. this.getPlatformList();
  154. },
  155. handleSizeChange: function(val){
  156. this.count = val;
  157. this.getPlatformList();
  158. },
  159. getPlatformList: function() {
  160. let that = this;
  161. this.$axios({
  162. method: 'get',
  163. url:`/api/platform/query/${that.count}/${that.currentPage}`
  164. }).then(function (res) {
  165. that.total = res.data.total;
  166. that.platformList = res.data.list;
  167. }).catch(function (error) {
  168. console.log(error);
  169. });
  170. }
  171. }
  172. };
  173. </script>
  174. <style>
  175. .subscribe-on{
  176. color: #409EFF;
  177. font-size: 1.3rem;
  178. }
  179. .subscribe-off{
  180. color: #afafb3;
  181. font-size: 1.3rem;
  182. }
  183. </style>