index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <template>
  2. <div class="safetyList">
  3. <customHeader>安全监控分站管理</customHeader>
  4. <div class="content">
  5. <div class="left-box">
  6. <div class="left-title">
  7. <div class="title-fz">
  8. <span>分站:</span>
  9. <span>
  10. [通讯正常]
  11. <span class="zd-open">{{ openNum || 0 }}</span>
  12. </span>
  13. <span>
  14. [通讯中断]
  15. <span class="zd-close">{{ clsoeNum || 0 }}</span>
  16. </span>
  17. </div>
  18. <!-- <div class="title-cd">
  19. <span>测点:</span>
  20. <span>
  21. [通讯正常]
  22. <span class="zd-open">407</span>
  23. </span>
  24. <span>
  25. [通讯中断]
  26. <span class="zd-close">0</span>
  27. </span>
  28. </div> -->
  29. </div>
  30. <div class="left-content">
  31. <div class="card-box" v-for="(item, index) in cardList" :key="index">
  32. <div :class="item.isNewAccess ? 'card-itemN' : item.linkstatus ? 'card-itemL' : 'card-itemD'"
  33. @click="cardClick(item, index)">
  34. <div class="card-item-label">{{ item.strname }}</div>
  35. </div>
  36. <div :class="activeIndex % 4 == 3 ? 'card-modal1' : 'card-modal'" v-if="activeIndex==index && isShow" >
  37. <div class="modal-name">站点名称:</div>
  38. <a-input v-model:value="stationName" size="small" placeholder="请输入" @blur="changeName" />
  39. <div class="modal-lj">连接状态:</div>
  40. <a-radio-group v-model:value="stationStatus" size="small" :options="ljList" @change="changeStatus" />
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="right-box">
  46. <div class="right-title">详细信息:</div>
  47. <a-table size="small" :scroll="{ y: 680 }" :columns="columns" :data-source="tableData" :pagination="pagination" @change="pageChange" />
  48. </div>
  49. </div>
  50. </div>
  51. </template>
  52. <script setup lang="ts">
  53. import { ref, nextTick, reactive, onMounted } from 'vue';
  54. import customHeader from '/@/components/vent/customHeader.vue';
  55. import { subStationList, getList,getEdit } from './safetyList.api';
  56. import { columns } from './safetyList.data'
  57. let isShow=ref(false)
  58. let stationName = ref('')
  59. let stationStatus = ref(null)
  60. let stationId=ref(null)
  61. let ljList = reactive<any[]>([
  62. { value: 0, label: '断开' },
  63. { value: 1, label: '连接' }
  64. ])
  65. let activeIndex = ref(null)
  66. let cardList = ref<any[]>()
  67. let openNum = ref(0)
  68. let clsoeNum = ref(0)
  69. //分页参数配置
  70. let pagination = reactive({
  71. current: 1, // 当前页码
  72. pageSize: 20, // 每页显示条数
  73. total: 0, // 总条目数,后端返回
  74. // showTotal: (total, range) => `${range[0]}-${range[1]} 条,总共 ${total} 条`, // 分页右下角显示信息
  75. showSizeChanger: true, // 是否可改变每页显示条数
  76. pageSizeOptions: ['10', '20', '30', '40', '50', '100'], // 可选的每页显示条数
  77. });
  78. let tableData = ref<any[]>([])
  79. //获取分站信息
  80. async function getSubStationList() {
  81. let res = await subStationList({})
  82. console.log(res, '分站-----------')
  83. if (res.length != 0) {
  84. cardList.value = res
  85. openNum.value = cardList.value?.filter(v => v.linkstatus == 1)['length']
  86. clsoeNum.value = cardList.value?.filter(v => v.linkstatus == 0)['length']
  87. } else {
  88. cardList.value = []
  89. }
  90. }
  91. //站点选项点击
  92. function cardClick(item, index) {
  93. console.log(item, '站点选项------------')
  94. activeIndex.value = item.isNewAccess ? index : null
  95. stationName.value = item.strname
  96. stationStatus.value=item.linkstatus
  97. stationId.value=item.id
  98. isShow.value=true
  99. }
  100. //站点名称编辑
  101. function changeName(val){
  102. getChangeStation()
  103. }
  104. //站点连接状态修改
  105. function changeStatus(val){
  106. getChangeStation()
  107. }
  108. async function getChangeStation(){
  109. let res=await getEdit({id:stationId.value,strname:stationName.value,linkstatus:stationStatus.value})
  110. console.log(res,'站点编辑')
  111. getSubStationList()
  112. isShow.value=false
  113. }
  114. //获取详细信息列表
  115. async function getStationList() {
  116. let res = await getList({ pageNo: pagination.current, pageSize: pagination.pageSize, })
  117. console.log(res, '详细信息列表--------')
  118. let data = res.records
  119. data.forEach(el => {
  120. el.linkstatusC = el.linkstatus ? '连接' : '未连接'
  121. el.children = el.devInfoList
  122. el.children.forEach(v => {
  123. v.linkstatus = v.netStatus
  124. v.linkstatusC = v.linkstatus ? '连接' : '未连接'
  125. v.updateTime = v.time
  126. })
  127. })
  128. tableData.value = data
  129. pagination.total = res.total
  130. }
  131. //分页切换
  132. function pageChange(val) {
  133. pagination.current = val.current;
  134. pagination.pageSize = val.pageSize;
  135. getStationList();
  136. }
  137. onMounted(() => {
  138. getSubStationList()
  139. getStationList()
  140. })
  141. </script>
  142. <style lang="less" scoped>
  143. .safetyList {
  144. width: calc(100% - 20px);
  145. height: calc(100% - 90px);
  146. position: relative;
  147. margin: 80px 10px 10px 10px;
  148. .content {
  149. position: relative;
  150. width: 100%;
  151. height: 100%;
  152. display: flex;
  153. justify-content: space-between;
  154. align-items: center;
  155. .left-box {
  156. width: 40%;
  157. height: 100%;
  158. margin-right: 15px;
  159. padding: 10px;
  160. box-sizing: border-box;
  161. background: url('@/assets/images/fire/bj1.png') no-repeat center;
  162. background-size: 100% 100%;
  163. .left-title {
  164. display: flex;
  165. height: 30px;
  166. align-items: center;
  167. font-size: 14px;
  168. margin-bottom: 10px;
  169. span {
  170. color: #fff;
  171. }
  172. .zd-open {
  173. color: rgb(0, 242, 255);
  174. }
  175. .zd-close {
  176. color: #ff0000;
  177. }
  178. .title-fz {
  179. margin-right: 25px;
  180. }
  181. }
  182. .left-content {
  183. display: flex;
  184. justify-content: flex-start;
  185. align-items: flex-start;
  186. flex-wrap: wrap;
  187. height: calc(100% - 40px);
  188. overflow-y: auto;
  189. .card-box {
  190. position: relative;
  191. // width: 242px;
  192. width: 182px;
  193. height: 110px;
  194. margin-bottom: 15px;
  195. display: flex;
  196. justify-content: center;
  197. .card-itemN {
  198. position: relative;
  199. width: 85px;
  200. height: 110px;
  201. background: url('../../../assets/images/zd-2.png') no-repeat center;
  202. background-size: 100% 100%;
  203. cursor: pointer;
  204. .card-item-label {
  205. width: 100%;
  206. position: absolute;
  207. bottom: 5px;
  208. font-size: 12px;
  209. color: #fff;
  210. text-align: center;
  211. }
  212. }
  213. .card-itemL {
  214. position: relative;
  215. width: 85px;
  216. height: 110px;
  217. background: url('../../../assets/images/zd-3.png') no-repeat center;
  218. background-size: 100% 100%;
  219. cursor: pointer;
  220. .card-item-label {
  221. width: 100%;
  222. position: absolute;
  223. bottom: 5px;
  224. font-size: 12px;
  225. color: #fff;
  226. text-align: center;
  227. }
  228. }
  229. .card-itemD {
  230. position: relative;
  231. width: 85px;
  232. height: 110px;
  233. background: url('../../../assets/images/zd-1.png') no-repeat center;
  234. background-size: 100% 100%;
  235. cursor: pointer;
  236. .card-item-label {
  237. width: 100%;
  238. position: absolute;
  239. bottom: 5px;
  240. font-size: 12px;
  241. color: #fff;
  242. text-align: center;
  243. }
  244. }
  245. .card-modal {
  246. width: 86px;
  247. position: absolute;
  248. left: 140px;
  249. color: #FFF;
  250. top: 50%;
  251. transform: translate(0, -50%);
  252. font-size: 12px;
  253. }
  254. .card-modal1 {
  255. width: 86px;
  256. position: absolute;
  257. left: -42px;
  258. color: #FFF;
  259. top: 50%;
  260. transform: translate(0, -50%);
  261. font-size: 12px;
  262. }
  263. }
  264. }
  265. }
  266. .right-box {
  267. width: calc(60% - 15px);
  268. height: 100%;
  269. padding: 10px;
  270. box-sizing: border-box;
  271. background: url('@/assets/images/fire/bj1.png') no-repeat center;
  272. background-size: 100% 100%;
  273. .right-title {
  274. display: flex;
  275. height: 30px;
  276. align-items: center;
  277. font-size: 14px;
  278. color: #fff;
  279. margin-bottom: 10px;
  280. }
  281. }
  282. }
  283. }
  284. ::v-deep(.zxm-radio-wrapper) {
  285. font-size: 12px;
  286. }
  287. ::v-deep(.zxm-input) {
  288. font-size: 12px;
  289. }
  290. </style>