index.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. <template>
  2. <div>
  3. <div v-show="hasRegister">
  4. <el-dialog :visible.sync="showCalling" :modal="false" :show-close="false" style="margin-top: 40vh;">
  5. <div class="new-in">
  6. <div class="text-lg text-center padding light" :class="callingShowClass" style="border-radius: 10px">{{ callingText }}</div>
  7. </div>
  8. </el-dialog>
  9. <div
  10. v-for="(floor,i) in screenConfig " :key="'screen'+i" v-show="stayIndex===(i+1)">
  11. <template v-if="i===0&&hasPatientInFirst">
  12. <transition-group tag="div" name="list">
  13. <div v-for="(item,index) in boardBedsInfo" :key="'subscreen'+index" v-show="bedInfoArrayIndex===index">
  14. <nest-component :tasks="floor" :bind-data="item" :show="true"
  15. />
  16. </div>
  17. </transition-group>
  18. </template>
  19. <template v-else>
  20. <nest-component :tasks="floor" :bind-data="boardBedsInfoRaw" :show="true"></nest-component>
  21. </template>
  22. </div>
  23. </div>
  24. <div v-show="!hasRegister" class="bg-gradual-purple light" style="height: 100vh">
  25. <el-empty :image-size="350" style="padding-top: 0" description="">
  26. <template slot="image">
  27. <svg height="300" node-id="1" sillyvg="true" template-height="300" template-width="300" version="1.1" viewBox="0 0 400 300" width="400" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><defs node-id="46"></defs><path d="M 282.50 294.41 C 282.50 295.83 245.56 296.98 200.00 296.98 C 154.44 296.98 117.50 295.83 117.50 294.41 C 117.50 292.99 154.44 291.84 200.00 291.84 C 245.56 291.84 282.50 292.99 282.50 294.41 Z" fill="#cddcff" fill-rule="nonzero" node-id="48" stroke="none" target-height="5.1400146" target-width="165" target-x="117.5" target-y="291.84"></path><path d="M 187.73 263.31 L 183.06 289.47 L 212.95 289.47 L 208.28 262.38 L 187.73 263.31 Z" fill="#cddcff" fill-rule="nonzero" node-id="50" stroke="none" target-height="27.089996" target-width="29.89" target-x="183.06" target-y="262.38"></path><path d="M 187.73 263.31 L 186.04 272.79 L 209.97 272.74 L 208.28 262.38 L 187.73 263.31 Z" fill="#9ca3b5" fill-rule="nonzero" node-id="52" stroke="none" target-height="10.410004" target-width="23.930008" target-x="186.04" target-y="262.38"></path><path d="M 172.78 286.20 L 223.23 286.20 C 225.55 286.20 227.43 288.08 227.43 290.40 L 227.43 290.41 C 227.43 292.73 225.55 294.61 223.23 294.61 L 172.78 294.61 C 170.46 294.61 168.58 292.73 168.58 290.41 L 168.58 290.40 C 168.58 288.08 170.46 286.20 172.78 286.20 Z" fill="#313849" fill-rule="nonzero" node-id="54" stroke="none" target-height="8.409973" target-width="58.84999" target-x="168.58" target-y="286.2"></path><path d="M 305.31 266.73 L 94.69 266.73 C 92.38 266.73 90.16 265.81 88.53 264.17 C 86.90 262.53 85.99 260.31 86.00 258.00 L 86.00 124.42 C 86.00 119.62 89.89 115.73 94.69 115.73 L 305.31 115.73 C 310.11 115.73 314.00 119.62 314.00 124.42 L 314.00 258.00 C 314.01 260.31 313.10 262.53 311.47 264.17 C 309.84 265.81 307.62 266.73 305.31 266.73 Z" fill="#f2f7ff" fill-rule="nonzero" node-id="56" stroke="none" target-height="151" target-width="228.02002" target-x="85.99" target-y="115.73"></path><path d="M 305.31 123.73 C 305.69 123.73 306.00 124.04 306.00 124.42 L 306.00 258.00 C 306.00 258.38 305.69 258.69 305.31 258.69 L 94.69 258.69 C 94.31 258.69 94.00 258.38 94.00 258.00 L 94.00 124.42 C 94.00 124.04 94.31 123.73 94.69 123.73 L 305.31 123.73 M 305.31 115.73 L 94.69 115.73 C 89.89 115.73 86.00 119.62 86.00 124.42 L 86.00 258.00 C 86.00 262.80 89.89 266.69 94.69 266.69 L 305.31 266.69 C 310.11 266.69 314.00 262.80 314.00 258.00 L 314.00 124.42 C 314.00 119.62 310.11 115.73 305.31 115.73 Z" fill="#30384a" fill-rule="nonzero" node-id="58" stroke="none" target-height="150.95999" target-width="228" target-x="86" target-y="115.73"></path><path d="M 183.61 135.51 L 295.27 135.51 L 295.27 172.84 L 183.61 172.84 Z" fill="#cddcff" fill-rule="nonzero" node-id="60" stroke="none" target-height="37.33" target-width="111.65999" target-x="183.61" target-y="135.51"></path><path d="M 183.61 181.34 L 295.27 181.34 L 295.27 245.73 L 183.61 245.73 Z" fill="#cddcff" fill-rule="nonzero" node-id="62" stroke="none" target-height="64.39" target-width="111.65999" target-x="183.61" target-y="181.34"></path><path d="M 108.24 197.27 L 164.07 197.27 L 164.07 203.06 L 108.24 203.06 Z" fill="#cddcff" fill-rule="nonzero" node-id="64" stroke="none" target-height="5.7899933" target-width="55.83001" target-x="108.24" target-y="197.27"></path><path d="M 108.24 207.47 L 164.07 207.47 L 164.07 213.26 L 108.24 213.26 Z" fill="#cddcff" fill-rule="nonzero" node-id="66" stroke="none" target-height="5.7899933" target-width="55.83001" target-x="108.24" target-y="207.47"></path><path d="M 108.24 217.66 L 164.07 217.66 L 164.07 223.45 L 108.24 223.45 Z" fill="#cddcff" fill-rule="nonzero" node-id="68" stroke="none" target-height="5.7899933" target-width="55.83001" target-x="108.24" target-y="217.66"></path><path d="M 108.24 227.86 L 144.67 227.86 L 144.67 233.65 L 108.24 233.65 Z" fill="#cddcff" fill-rule="nonzero" node-id="70" stroke="none" target-height="5.7899933" target-width="36.43" target-x="108.24" target-y="227.86"></path><path d="M 108.24 238.06 L 133.88 238.06 L 133.88 243.85 L 108.24 243.85 Z" fill="#cddcff" fill-rule="nonzero" node-id="72" stroke="none" target-height="5.7900085" target-width="25.640007" target-x="108.24" target-y="238.06"></path><path d="M 140.11 159.75 L 157.31 153.33 C 154.62 148.19 150.19 144.17 144.81 142.00 C 143.16 148.24 141.18 155.73 140.11 159.75 Z" fill="#cddcff" fill-rule="nonzero" node-id="74" stroke="none" target-height="17.75" target-width="17.199997" target-x="140.11" target-y="142"></path><path d="M 135.64 164.68 L 136.40 161.83 C 137.91 156.15 140.15 147.67 141.91 141.04 C 130.99 138.14 119.51 143.09 114.12 153.01 C 108.73 162.93 110.82 175.26 119.19 182.84 C 127.56 190.42 140.03 191.30 149.37 184.96 C 158.72 178.62 162.51 166.71 158.56 156.13 Z" fill="#3e5ccd" fill-rule="nonzero" node-id="76" stroke="none" target-height="53.160004" target-width="53.77999" target-x="108.73" target-y="138.14"></path><path d="M 192.04 165.15 L 191.68 164.22 L 218.82 153.64 L 240.76 161.77 L 279.27 142.89 L 290.59 139.74 L 290.85 140.70 L 279.62 143.82 L 240.82 162.85 L 218.83 154.71 L 192.04 165.15 Z" fill="#f2f7ff" fill-rule="nonzero" node-id="78" stroke="none" target-height="25.409988" target-width="99.17001" target-x="191.68" target-y="139.74"></path><g node-id="125"><path d="M 322.79 266.73 L 214.26 266.73 L 214.26 179.20 L 322.79 179.20 Z" fill="#313849" fill-opacity="0.1" fill-rule="nonzero" group-id="1" node-id="82" stroke="none" target-height="87.530014" target-width="108.530014" target-x="214.26" target-y="179.2"></path></g><path d="M 329.18 272.39 L 220.65 272.39 L 220.65 172.07 L 329.18 172.07 Z" fill="#f1f4ff" fill-rule="nonzero" node-id="85" stroke="none" target-height="100.32001" target-width="108.53" target-x="220.65" target-y="172.07"></path><path d="M 329.59 272.80 L 220.24 272.80 L 220.24 171.66 L 329.59 171.66 Z M 221.06 272.00 L 328.77 272.00 L 328.77 172.50 L 221.06 172.50 Z" fill="#30384a" fill-rule="nonzero" node-id="87" stroke="none" target-height="101.139984" target-width="109.34999" target-x="220.24" target-y="171.66"></path><path d="M 220.65 172.07 L 329.18 172.07 L 329.18 186.03 L 220.65 186.03 Z" fill="#ffffff" fill-rule="nonzero" node-id="89" stroke="none" target-height="13.959991" target-width="108.53" target-x="220.65" target-y="172.07"></path><path d="M 329.59 272.80 L 220.24 272.80 L 220.24 171.66 L 329.59 171.66 Z M 221.06 272.00 L 328.77 272.00 L 328.77 172.50 L 221.06 172.50 Z" fill="#30384a" fill-rule="nonzero" node-id="91" stroke="none" target-height="101.139984" target-width="109.34999" target-x="220.24" target-y="171.66"></path><path d="M 236.34 230.19 L 243.17 230.19 L 243.17 251.21 L 236.34 251.21 Z" fill="#cddcff" fill-rule="nonzero" node-id="93" stroke="none" target-height="21.020004" target-width="6.830002" target-x="236.34" target-y="230.19"></path><path d="M 250.72 215.01 L 257.55 215.01 L 257.55 251.21 L 250.72 251.21 Z" fill="#cddcff" fill-rule="nonzero" node-id="95" stroke="none" target-height="36.200012" target-width="6.8299866" target-x="250.72" target-y="215.01"></path><path d="M 265.11 209.18 L 271.94 209.18 L 271.94 251.21 L 265.11 251.21 Z" fill="#cddcff" fill-rule="nonzero" node-id="97" stroke="none" target-height="42.030014" target-width="6.830017" target-x="265.11" target-y="209.18"></path><path d="M 279.50 200.17 L 286.33 200.17 L 286.33 251.21 L 279.50 251.21 Z" fill="#cddcff" fill-rule="nonzero" node-id="99" stroke="none" target-height="51.04001" target-width="6.8299866" target-x="279.5" target-y="200.17"></path><path d="M 293.89 205.85 L 300.72 205.85 L 300.72 251.20 L 293.89 251.20 Z" fill="#cddcff" fill-rule="nonzero" node-id="101" stroke="none" target-height="45.34999" target-width="6.8299866" target-x="293.89" target-y="205.85"></path><path d="M 308.27 205.85 L 315.10 205.85 L 315.10 251.20 L 308.27 251.20 Z" fill="#cddcff" fill-rule="nonzero" node-id="103" stroke="none" target-height="45.34999" target-width="6.830017" target-x="308.27" target-y="205.85"></path><path d="M 239.77 240.44 L 239.17 239.65 L 254.09 228.45 L 268.47 235.87 L 297.08 214.11 L 297.19 214.09 L 311.58 210.84 L 311.80 211.82 L 297.52 215.04 L 268.57 237.05 L 254.19 229.62 L 239.77 240.44 Z" fill="#eb5068" fill-rule="nonzero" node-id="105" stroke="none" target-height="29.600006" target-width="72.62999" target-x="239.17" target-y="210.84"></path><path d="M 241.49 240.04 C 241.49 241.00 240.71 241.78 239.75 241.78 C 238.79 241.78 238.01 241.00 238.01 240.04 C 238.01 239.08 238.79 238.30 239.75 238.30 C 240.71 238.30 241.49 239.08 241.49 240.04 Z" fill="#eb5068" fill-rule="nonzero" node-id="107" stroke="none" target-height="3.4799957" target-width="3.480011" target-x="238.01" target-y="238.3"></path><path d="M 255.88 229.35 C 255.88 230.31 255.10 231.09 254.14 231.09 C 253.18 231.09 252.40 230.31 252.40 229.35 C 252.40 228.39 253.18 227.61 254.14 227.61 C 255.10 227.61 255.88 228.39 255.88 229.35 Z" fill="#eb5068" fill-rule="nonzero" node-id="109" stroke="none" target-height="3.4799957" target-width="3.480011" target-x="252.4" target-y="227.61"></path><path d="M 270.26 236.56 C 270.26 237.52 269.48 238.30 268.52 238.30 C 267.56 238.30 266.78 237.52 266.78 236.56 C 266.78 235.60 267.56 234.82 268.52 234.82 C 269.48 234.82 270.26 235.60 270.26 236.56 Z" fill="#eb5068" fill-rule="nonzero" node-id="111" stroke="none" target-height="3.4799957" target-width="3.480011" target-x="266.78" target-y="234.82"></path><path d="M 284.65 225.69 C 284.65 226.65 283.87 227.43 282.91 227.43 C 281.95 227.43 281.17 226.65 281.17 225.69 C 281.17 224.73 281.95 223.95 282.91 223.95 C 283.87 223.95 284.65 224.73 284.65 225.69 Z" fill="#eb5068" fill-rule="nonzero" node-id="113" stroke="none" target-height="3.4799957" target-width="3.4799805" target-x="281.17" target-y="223.95"></path><path d="M 299.04 214.53 C 299.04 215.49 298.26 216.27 297.30 216.27 C 296.34 216.27 295.56 215.49 295.56 214.53 C 295.56 213.57 296.34 212.79 297.30 212.79 C 298.26 212.79 299.04 213.57 299.04 214.53 Z" fill="#eb5068" fill-rule="nonzero" node-id="115" stroke="none" target-height="3.480011" target-width="3.480011" target-x="295.56" target-y="212.79"></path><path d="M 313.43 211.33 C 313.43 212.29 312.65 213.07 311.69 213.07 C 310.73 213.07 309.95 212.29 309.95 211.33 C 309.95 210.37 310.73 209.59 311.69 209.59 C 312.65 209.59 313.43 210.37 313.43 211.33 Z" fill="#eb5068" fill-rule="nonzero" node-id="117" stroke="none" target-height="3.480011" target-width="3.4799805" target-x="309.95" target-y="209.59"></path><path d="M 230.47 179.05 C 230.47 180.43 229.35 181.55 227.97 181.55 C 226.59 181.55 225.47 180.43 225.47 179.05 C 225.47 177.67 226.59 176.55 227.97 176.55 C 229.35 176.55 230.47 177.67 230.47 179.05 Z" fill="#eb5068" fill-rule="nonzero" node-id="119" stroke="none" target-height="5" target-width="5" target-x="225.47" target-y="176.55"></path><path d="M 239.47 179.05 C 239.47 180.43 238.35 181.55 236.97 181.55 C 235.59 181.55 234.47 180.43 234.47 179.05 C 234.47 177.67 235.59 176.55 236.97 176.55 C 238.35 176.55 239.47 177.67 239.47 179.05 Z" fill="#f7cc5c" fill-rule="nonzero" node-id="121" stroke="none" target-height="5" target-width="5" target-x="234.47" target-y="176.55"></path><path d="M 248.47 179.05 C 248.47 180.43 247.35 181.55 245.97 181.55 C 244.59 181.55 243.47 180.43 243.47 179.05 C 243.47 177.67 244.59 176.55 245.97 176.55 C 247.35 176.55 248.47 177.67 248.47 179.05 Z" fill="#58c398" fill-rule="nonzero" node-id="123" stroke="none" target-height="5" target-width="5" target-x="243.47" target-y="176.55"></path></svg>
  28. </template>
  29. <template slot="description">
  30. <div class="bullshit">
  31. <div class="text-lg text-blue ">这是一台新的看板设备,请在系统后台设置该设备所属的科室。</div>
  32. <div class="text-lg text-blue margin-top-sm">
  33. 该设备识别号:<span class="text-red">{{ deviceMAC }}</span> ,设备ID号:<span class="text-red">{{ deviceId }}</span>
  34. </div>
  35. <div class="bullshit__info text-lg text-cyan margin-top-sm">如有其他疑问,请联系呼叫系统管理员。谢谢!</div>
  36. </div>
  37. </template>
  38. </el-empty>
  39. </div>
  40. </div>
  41. </template>
  42. <script>
  43. import * as API_Board from '@/api/board'
  44. import Storage from '@/utils/storage'
  45. import { mapActions } from 'vuex'
  46. const deviceUrl = process.env.deviceUrl
  47. /** 树形结构中查找指定Id节点 */
  48. import {findNodeById} from "../../utils/Foundation";
  49. import {getHospitalStatisticsCascader} from "@/api/board";
  50. export default {
  51. name: "index",
  52. beforeMount() {
  53. if (this.$route.query.mac !== undefined && this.$route.query.mac !== '') {
  54. // 保存mac地址
  55. this.$store.dispatch('saveDeviceMac', this.$route.query.mac)
  56. // 初始化websocket
  57. // await this.initWebSocket()
  58. this.initWebSocket()
  59. }
  60. this.$nextTick(() => {
  61. this.$nuxt.$loading.start()
  62. })
  63. },
  64. mounted(){
  65. const _this = this
  66. // 驱动动画
  67. setTimeout(_this.timeOutFun, 1000)
  68. // 检查socket连接
  69. setTimeout(_this.socketReconnect, 60000)
  70. },
  71. beforeUpdate(){
  72. this.$nuxt.$loading.finish()
  73. },
  74. async asyncData({app, params,store,route}) {
  75. store.dispatch('saveDeviceMac', route.query.mac)
  76. const deviceInfo = await API_Board.getDeviceInfo(route.query.mac)
  77. if(deviceInfo&&deviceInfo.part_id>0) {
  78. store.dispatch('savePartId', deviceInfo.part_id)
  79. store.dispatch('saveRegisterStatus', true)
  80. const datas = await Promise.all([
  81. API_Board.getAllTitles(store.state.partId),
  82. API_Board.getBedInfo(store.state.partId),
  83. API_Board.getPartStatisticSummary(store.state.partId),
  84. API_Board.getPartList(store.state.partId),
  85. API_Board.getHospitalStatisticsCascader(store.state.partId),
  86. API_Board.getPartManualInputList(store.state.partId)
  87. ])
  88. store.dispatch('savePartStatistics',{...datas[2]})
  89. store.dispatch('saveCustomBoardItems',[...datas[3]])
  90. store.dispatch('savePartStatisticSummary',[...datas[4]])
  91. store.dispatch('saveManualInputBoardItems',[...datas[5]])
  92. const boardTitles = [...datas[0]]
  93. let hasPatientInFirst=false
  94. let screenConfig = []
  95. let floorList = []
  96. let gridItemCount = 20
  97. if (boardTitles.length > 0) { // 渲染首屏
  98. for (let j = 0; j < boardTitles.length; j++) {
  99. const floorConfig = JSON.parse(boardTitles[j].content_config)
  100. screenConfig.push(floorConfig)
  101. }
  102. floorList = JSON.parse(boardTitles[0].content_config)
  103. for (let i = 0; i < boardTitles.length; i++) {
  104. const gridConfig = findNodeById(JSON.parse(boardTitles[i].content_config), 5)
  105. if (gridConfig) {
  106. gridItemCount = parseInt(gridConfig.moduleConfig.gridCloumns) * parseInt(gridConfig.moduleConfig.gridRows)
  107. hasPatientInFirst=true
  108. break
  109. }else{
  110. hasPatientInFirst=false
  111. }
  112. }
  113. }
  114. const boardBedsInfoRaw = {...datas[1]}
  115. // let bedInfoArray = []
  116. let boardBedsInfo = []
  117. const screens = Math.ceil(datas[1]['items'].length / gridItemCount)
  118. for (var i = 1; i <= screens; i++) {
  119. const beds = boardBedsInfoRaw.items.slice((i - 1) * gridItemCount, i * gridItemCount >= boardBedsInfoRaw.items.length
  120. ? boardBedsInfoRaw.items.length : i * gridItemCount)
  121. // bedInfoArray.push(beds)
  122. boardBedsInfo.push({...boardBedsInfoRaw, items: beds})
  123. }
  124. return {boardTitles, screenConfig,boardBedsInfoRaw, floorList, gridItemCount, boardBedsInfo,hasPatientInFirst,hasRegister:true}
  125. }else{
  126. store.dispatch('savePartId', 0)
  127. store.dispatch('saveRegisterStatus', false)
  128. return {hasRegister:false}
  129. }
  130. },
  131. data(){
  132. return{
  133. hasRegister:this.$store.state.hasRegister==='true',
  134. deviceMAC: this.$route.query.mac,
  135. deviceId:'',
  136. showCalling:false,
  137. callingText:'123',
  138. intervalObj:null,
  139. callingShowClass:'',
  140. boardBedsInfoRaw:{},
  141. screenConfig:[],
  142. stayIndex: 1,
  143. // 当前显示的床位数据
  144. boardBedsInfo: [],
  145. hasPatientInFirst:false,
  146. // 自定义显示条目
  147. // boardItems: [],
  148. // 科室统计数据对象
  149. // partStatistic: {},//通过vuex传递
  150. // 每屏床位数
  151. gridItemCount: 28,
  152. // 床位二维数组
  153. bedInfoArray: [],
  154. floorList:[],
  155. // 首屏显示数据索引
  156. bedInfoArrayIndex: 0,
  157. staySeconds:[]
  158. }
  159. },
  160. methods:{
  161. timeOutFun() {
  162. this.swiperChange()
  163. setTimeout(this.timeOutFun, 1000)
  164. },
  165. socketReconnect() {
  166. if (this.websock === null || this.websock.readyState !== 1) {
  167. this.initWebSocket()
  168. }
  169. setTimeout(this.socketReconnect, 60000)
  170. },
  171. getBoardTitles() {
  172. API_Board.getAllTitles(this.$store.state.partId).then(res => {
  173. if(JSON.stringify([...res])!==JSON.stringify(this.boardTitles)){
  174. this.boardTitles = [...res]
  175. if (this.boardTitles.length > 0) { // 渲染首屏
  176. for (let j = 0; j < this.boardTitles.length; j++) {
  177. const floorConfig = JSON.parse(this.boardTitles[j].content_config)
  178. this.screenConfig.push(floorConfig)
  179. }
  180. // this.floorList = JSON.parse(this.boardTitles[0].content_config)
  181. for (let i = 0; i < this.boardTitles.length; i++) {
  182. const gridConfig = findNodeById(JSON.parse(this.boardTitles[i].content_config), 5)
  183. if (gridConfig) {
  184. this.gridItemCount = parseInt(gridConfig.moduleConfig.gridCloumns) * parseInt(gridConfig.moduleConfig.gridRows)
  185. break
  186. }
  187. }
  188. }
  189. }
  190. })
  191. },
  192. getPartStatisticSummary() {
  193. API_Board.getPartStatisticSummary(this.$store.state.partId).then(res => {
  194. if(JSON.stringify({...res})!==JSON.stringify(this.partStatistic)){
  195. // this.partStatistic = { ...res }
  196. this.$store.dispatch('savePartStatistics',{...res})
  197. }
  198. })
  199. },
  200. // 获取所有自定义看板项
  201. getCustomBoardItems() {
  202. API_Board.getPartList(this.$store.state.partId).then(res => {
  203. if(JSON.stringify([...res])!==JSON.stringify(this.boardItems)){
  204. // this.boardItems = [...res]
  205. this.$store.dispatch('saveCustomBoardItems',[...res])
  206. }
  207. })
  208. },
  209. // 获取所有手动输入看板项
  210. getPartManualInputlist() {
  211. API_Board.getPartManualInputList(this.$store.state.partId).then(res => {
  212. if(JSON.stringify([...res])!==JSON.stringify(this.boardItems)){
  213. // this.boardItems = [...res]
  214. this.$store.dispatch('saveManualInputBoardItems',[...res])
  215. }
  216. })
  217. },
  218. // 获取医院级科室级联统计数据
  219. getHospitalStatisticsCascader() {
  220. API_Board.getHospitalStatisticsCascader(this.$store.state.partId).then(res => {
  221. if(JSON.stringify([...res])!==JSON.stringify(this.hospitalStatisticsCascader)){
  222. // this.hospitalStatisticsCascader = [...res]
  223. this.$store.dispatch('savePartStatisticSummary',[...res])
  224. }
  225. })
  226. },
  227. // 切换屏幕
  228. swiperChange() {
  229. this.countTimes++
  230. let stayTimes = this.staySeconds[this.stayIndex - 1]
  231. // console.log('stayTimes',this.staySeconds)
  232. // console.log('count', this.countTimes)
  233. if (this.stayIndex === 1) {
  234. stayTimes = this.staySeconds[this.stayIndex - 1] * this.boardBedsInfo.length
  235. }
  236. if (this.countTimes >= stayTimes) { // 切换屏幕
  237. if (!this.fixedScreen) {
  238. if (this.stayIndex === this.boardTitles.length) { // 到最后一屏了
  239. this.bedInfoArrayIndex=0
  240. this.stayIndex = 1
  241. this.countTimes=0
  242. } else {
  243. this.stayIndex++
  244. }
  245. // if (this.boardTitles.length > 0) {
  246. // this.floorList = JSON.parse(this.boardTitles[this.stayIndex - 1]['content_config'])
  247. // }
  248. }
  249. this.countTimes = 0
  250. }
  251. if (this.stayIndex === 1) { // 切换子项
  252. if (this.countTimes % this.staySeconds[this.stayIndex - 1] === 0 && this.boardBedsInfo.length > 1) { // 子项页数大余1时才切换
  253. // console.log('change', Math.floor(this.countTimes / this.staySeconds[this.stayIndex - 1]))
  254. const mod = Math.floor(this.countTimes / this.staySeconds[this.stayIndex - 1])
  255. this.bedInfoArrayIndex = mod >= this.boardBedsInfo.length ? 0 : mod
  256. this.show = false
  257. // this.boardBedsInfo = { ...this.boardBedsInfo, items: this.bedInfoArray[this.bedInfoArrayIndex] }
  258. const _this = this
  259. setTimeout(function() {
  260. _this.show = true
  261. }, 200)
  262. }
  263. }
  264. },
  265. // 显示呼叫
  266. showCall(interactionVo) {
  267. // console.log('action', interactionVo)
  268. if (interactionVo.actionType === 'SOS') {
  269. this.callingText = interactionVo.fromFrameFullName + '紧急呼叫'
  270. this.callingShowClass = 'bg-red'
  271. } else if (interactionVo.actionType === 'EVENT') {
  272. this.callingText = interactionVo.fromFrameFullName + '发送' + interactionVo.data + '事件'
  273. this.callingShowClass = 'bg-blue'
  274. } else if (interactionVo.actionType === 'REINFORCE') {
  275. this.callingText = interactionVo.fromFrameFullName + '请求增援'
  276. this.callingShowClass = 'bg-blue'
  277. } else {
  278. this.callingText = interactionVo.fromFrameFullName + '呼叫'
  279. this.callingShowClass = 'bg-blue'
  280. }
  281. this.showCalling = true
  282. const _this = this
  283. clearTimeout(this.intervalObj)
  284. this.intervalObj = setTimeout(function() {
  285. _this.showCalling = false
  286. }, 30000)
  287. },
  288. // 获取床位信息
  289. getBedInfo() {
  290. API_Board.getBedInfo(this.$store.state.partId).then(res => {
  291. if(JSON.stringify({...res})!==JSON.stringify(this.boardBedsInfoRaw)){
  292. let boardBedsInfoTmp=[]
  293. this.boardBedsInfoRaw = { ...res }
  294. const screens = Math.ceil(res['items'].length / this.gridItemCount)
  295. for (var i = 1; i <= screens; i++) {
  296. const beds = this.boardBedsInfoRaw.items.slice((i - 1) * this.gridItemCount, i * this.gridItemCount >= this.boardBedsInfoRaw.items.length
  297. ? this.boardBedsInfoRaw.items.length : i * this.gridItemCount)
  298. // this.bedInfoArray.push(beds)
  299. boardBedsInfoTmp.push({ ...res, items: beds })
  300. }
  301. for (var i=0;i<boardBedsInfoTmp.length;i++){
  302. if(!this.boardBedsInfo[i]||this.boardBedsInfo[i]&&JSON.stringify(this.boardBedsInfo[i])!==JSON.stringify(boardBedsInfoTmp[i])){
  303. this.$set(this.boardBedsInfo,i,boardBedsInfoTmp[i])
  304. }
  305. }
  306. // this.bedInfoArray = []
  307. // this.boardBedsInfo = []
  308. }
  309. // this.boardBedsInfo = { ...res, items: this.bedInfoArray[0] }
  310. })
  311. },
  312. initWebSocket: function() {
  313. var stockbase = deviceUrl.replace('http', 'ws')
  314. this.websock = new WebSocket(stockbase + '/boardinfo/1/' + this.$store.state.mac)
  315. this.websock.onopen = this.websocketonopen
  316. this.websock.onerror = this.websocketonerror
  317. this.websock.onmessage = this.websocketonmessage
  318. this.websock.onclose = this.websocketclose
  319. },
  320. websocketonopen: function() {
  321. // console.log('WebSocket连接成功')
  322. },
  323. websocketonerror: function(e) {
  324. // console.log('WebSocket连接发生错误')
  325. },
  326. websocketonmessage: function(e) {
  327. const boardObj = JSON.parse(e.data)
  328. if (boardObj.partId !== undefined && boardObj.partId > 0) { // 返回了partid,说明设备已注册
  329. if(this.$store.state.partId===0){ //后台首次设置科室,重载页面,让服务端渲染
  330. location.reload()
  331. }
  332. if (boardObj.code !== undefined) {
  333. // 把科室Id设置到store
  334. this.hasRegister = true
  335. this.$store.dispatch('saveRegisterStatus', true)
  336. this.$store.dispatch('savePartId', boardObj.partId)
  337. this.deviceId = boardObj.id
  338. // this.getBoardTitles()
  339. this.getBedInfo()
  340. this.getPartStatisticSummary()
  341. this.getCustomBoardItems()
  342. this.getHospitalStatisticsCascader()
  343. this.getPartManualInputlist()
  344. if (boardObj.config !== null && boardObj.config !== '') {
  345. const boardconfig = JSON.parse(boardObj.config)
  346. this.staySeconds = boardconfig.staySeconds // 轮换时间间隔
  347. if ('itemCountPerScreen' in boardconfig) {
  348. this.itemCountPerScreen = boardconfig.itemCountPerScreen
  349. }
  350. // 是否固定屏幕
  351. this.fixedScreen = boardconfig.stayIndex !== 0
  352. if (this.fixedScreen) {
  353. this.stayIndex = boardconfig.stayIndex
  354. } else {
  355. // 不是固定屏幕定时任务中计算 stayIndex 的值,这里判断 this.stayIndex === 0 说明还没有初始化。把this.stayIndex 设置为第一屏
  356. if (this.stayIndex === 0) {
  357. this.stayIndex = 1
  358. }
  359. }
  360. this.countTimes = 0
  361. // if (Object.keys(this.boardData).length === 0) {
  362. // const _this = this
  363. // setTimeout(function() {
  364. // _this.$forceUpdate()
  365. // }, 2000)
  366. // }
  367. // console.log('stayIndex', this.stayIndex)
  368. } else {
  369. this.autoplay = true
  370. }
  371. } else if (boardObj.actionType !== undefined) { // 呼叫显示
  372. this.showCall(boardObj)
  373. this.getBoardTitles()
  374. this.getBedInfo()
  375. this.getPartStatisticSummary()
  376. this.getCustomBoardItems()
  377. this.getPartManualInputlist()
  378. }
  379. } else if ('action' in boardObj) {
  380. // console.log('register',this.hasRegister)
  381. if(boardObj.action !== 'refresh'){
  382. this.showCall(boardObj)
  383. }
  384. } else if ('hidden_call' in boardObj) {
  385. this.showCalling = false
  386. } else {
  387. this.deviceId = boardObj.id
  388. this.$store.dispatch('saveRegisterStatus', false)
  389. this.hasRegister = false
  390. }
  391. },
  392. websocketclose: function(e) {
  393. // console.log('connection closed (' + e.code + ')')
  394. }
  395. }
  396. }
  397. </script>
  398. <style scoped>
  399. /deep/ .el-dialog__body{padding:0}
  400. .el-aside {
  401. text-align: center;
  402. color: #333;
  403. border-right: 2px solid #e6e6e6;
  404. }
  405. .new-in{}
  406. .new-in .text-gray{color:#777!important}
  407. .call-item {
  408. text-align: left;
  409. padding: 0 10px;
  410. }
  411. .padding-top-8 {
  412. padding-top: 8px;
  413. }
  414. .padding-bottom-8 {
  415. padding-bottom: 8px;
  416. }
  417. /deep/ .el-dialog{
  418. margin-top: 48vh;
  419. border-radius: 10px
  420. }
  421. /deep/ .el-dialog__header{
  422. display: none;
  423. }
  424. /deep/ .van-empty__description{
  425. line-height: 32px;
  426. }
  427. .list-move, /* 对移动中的元素应用的过渡 */
  428. .list-leave-active {
  429. /*transition: all 1s ease;*/
  430. animation:fadeout 0.2s ease
  431. }
  432. .list-enter-active{
  433. animation:fadein 1s ease
  434. }
  435. @keyframes fadeout{
  436. 0%{opacity:1;}
  437. 100%{opacity:0;}
  438. }
  439. @keyframes fadein{
  440. 0%{opacity:0.5;}
  441. 100%{opacity:1;}
  442. }
  443. </style>