index.vue 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774
  1. <template>
  2. <div class="subject">
  3. <div class="subject-page" v-if="pageType == 1">
  4. <div class="subject-page-min">
  5. <div class="left-subject-list" >
  6. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" style="border-bottom:1px solid #D8D8D8">
  7. <el-form-item label="学院" prop="deptId" label-width="60px">
  8. <el-select v-model="queryParams.deptId" placeholder="请选择学院" clearable size="small">
  9. <el-option
  10. v-for="dict in deptOptions"
  11. :key="dict.deptId"
  12. :label="dict.deptName"
  13. :value="dict.deptId"
  14. ></el-option>
  15. </el-select>
  16. </el-form-item>
  17. <el-form-item label="实验室名称" prop="name" label-width="100px">
  18. <el-input
  19. v-model="queryParams.name"
  20. placeholder="请输入实验室名称"
  21. clearable
  22. size="small"
  23. />
  24. </el-form-item>
  25. <el-form-item style="float: right;">
  26. <el-col :span="1.5" style="margin-bottom:26px;margin-right: 20px">
  27. <p class="add-button-one-120"
  28. @click="clickPage(2)"
  29. v-hasPermi="['laboratory:subject:add']"
  30. ><i class="el-icon-plus"></i>新增实验室</p>
  31. </el-col>
  32. </el-form-item>
  33. <el-form-item style="margin-right: 20px;">
  34. <p class="inquire-button-one" style="margin-left:20px;" @click="handleQuery">查询</p>
  35. <p class="reset-button-one" style="margin-left:20px;" @click="resetQuery">重置</p>
  36. </el-form-item>
  37. </el-form>
  38. <div class="table_border">
  39. <el-table ref="multipleTable" border :data="subjectList" highlight-current-row @current-change="handleCurrentChange" style="cursor: pointer;">
  40. <el-table-column label="排序" align="left" prop="id" width="80">
  41. <template slot-scope="scope">
  42. <el-input maxlength="4" type="text" oninput ="value=value.replace(/[^0-9.]/g,'')" v-model="scope.row.diyOrder" @focus="liveSort(scope.row)" @blur="editSort(scope.row)"></el-input>
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="实验室名称" align="left" prop="name" show-overflow-tooltip/>
  46. <el-table-column label="房间号" align="left" prop="room" width="120" show-overflow-tooltip/>
  47. <el-table-column label="分类/分级" align="left" prop="levelName" width="150" show-overflow-tooltip>
  48. <template slot-scope="scope">
  49. <span >{{scope.row.typeName}}/</span>
  50. <span :style="'color:'+scope.row.fiedColor+';'">{{scope.row.levelName}}</span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="实验室责任人" align="left" prop="adminName" width="130" show-overflow-tooltip/>
  54. <el-table-column label="安全责任人" align="left" prop="safeUserName" width="200" show-overflow-tooltip/>
  55. <el-table-column label="操作" align="left" width="160">
  56. <template slot-scope="scope">
  57. <div style="display: flex;height:30px;">
  58. <p class="table-min-button" style="margin-right:10px;" v-hasPermi="['laboratory:subject:query']" @click="clickPage(7,scope.row)">详情</p>
  59. <el-dropdown trigger="click" size="mini" @command="(command) => handleCommand(command, scope.row)">
  60. <p class="table-min-button">更多<i class="el-icon-d-arrow-right"></i></p>
  61. <el-dropdown-menu slot="dropdown" style="margin:0!important;">
  62. <el-dropdown-item style="height:36px;line-height:36px;width:90px;text-align: center" command="1" v-hasPermiAnd="['laboratory:subject:query','laboratory:subject:edit']">关联配置</el-dropdown-item>
  63. <el-dropdown-item style="height:36px;line-height:36px;width:90px;text-align: center" command="2">物联配置</el-dropdown-item>
  64. <el-dropdown-item style="height:36px;line-height:36px;width:90px;text-align: center" command="3" v-hasPermi="['laboratory:subjectmaterial:add']">准入配置</el-dropdown-item>
  65. <el-dropdown-item style="height:36px;line-height:36px;width:90px;text-align: center" command="4" v-hasPermiAnd="['laboratory:subject:query','laboratory:subject:edit']">编辑</el-dropdown-item>
  66. <!--<el-dropdown-item style="height:36px;line-height:36px;width:90px;text-align: center" command="5"-->
  67. <!--v-hasPermi="['laboratory:subject:remove']">删除</el-dropdown-item>-->
  68. </el-dropdown-menu>
  69. </el-dropdown>
  70. </div>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <pagination
  75. style="margin-top:10px;"
  76. v-show="total>0"
  77. :total="total"
  78. :page.sync="queryParams.pageNum"
  79. :limit.sync="queryParams.pageSize"
  80. @pagination="getList"
  81. />
  82. </div>
  83. </div>
  84. <div class="right-subject-box scrollbar-box" :class="rightButtonType == 4?'overflow-box':''" v-if="checkedSubject.id">
  85. <div class="top-button-box">
  86. <div :class="rightButtonType == 1 ? 'buttonColorA' : 'buttonColorB'" @click="rightButtonClick(1)">传感器监测</div>
  87. <div :class="rightButtonType == 2 ? 'buttonColorA' : 'buttonColorB'" @click="rightButtonClick(2)">物联控制</div>
  88. <div :class="rightButtonType == 3 ? 'buttonColorA' : 'buttonColorB'" @click="rightButtonClick(3)">视频监控</div>
  89. <div :class="rightButtonType == 4 ? 'buttonColorA' : 'buttonColorB'" @click="rightButtonClick(4)">声光报警</div>
  90. <div :class="rightButtonType == 5 ? 'buttonColorA' : 'buttonColorB'" @click="rightButtonClick(5)">智能门禁</div>
  91. </div>
  92. <!--传感器-->
  93. <div class="bottom-max-box" :class="rightButtonType == 4?'overflow-box':''">
  94. <div class="bottom-sensor-box" v-if="rightButtonType == 1">
  95. <p class="top-title"><i>{{checkedSubject.deptName}}</i><i>当前位置:{{checkedSubject.subAddrr.buildName}}{{checkedSubject.subAddrr.floorName}}</i></p>
  96. <div class="sensor-for-max-box scrollbar-box" v-if="checkedSubject.sensorFunctionStatusList[0]">
  97. <div class="sensor-for-big-box"
  98. :class="item.type == 1 ? 'sensor-color-a' : (item.type == 2 ? 'sensor-color-b' : 'sensor-color-c')"
  99. v-for="(item,index) in checkedSubject.sensorFunctionStatusList" :key="index">
  100. <div class="sensor-for-min-box">
  101. <img src="@/assets/ZDimages/subject/icon_bj_wd.png" v-if="item.funNum == 'wendu'">
  102. <img src="@/assets/ZDimages/subject/icon_bj_wd.png" v-if="item.funNum == 'fbwendu'">
  103. <img src="@/assets/ZDimages/subject/icon_bj_sd.png" v-if="item.funNum == 'shidu'">
  104. <img src="@/assets/ZDimages/subject/icon_bj_sd.png" v-if="item.funNum == 'fbshidu'">
  105. <img src="@/assets/ZDimages/subject/icon_bj_eyht.png" v-if="item.funNum == 'co'">
  106. <img src="@/assets/ZDimages/subject/icon_bj_eyht.png" v-if="item.funNum == 'fbco'">
  107. <img src="@/assets/ZDimages/subject/icon_bj_jwnd.png" v-if="item.funNum == 'jiawan'">
  108. <img src="@/assets/ZDimages/subject/icon_sy_yqnd.png" v-if="item.funNum == 'o2'">
  109. <img src="@/assets/ZDimages/subject/icon_sy_yqnd.png" v-if="item.funNum == 'fbo2'">
  110. <img src="@/assets/ZDimages/subject/icon_bj_yg.png" v-if="item.funNum == 'yanwu'">
  111. <img src="@/assets/ZDimages/subject/icon_sy_dqy.png" v-if="item.funNum == 'daqiya'">
  112. <img src="@/assets/ZDimages/subject/icon_syspz_voc.png" v-if="item.funNum == 'voc'">
  113. <img src="@/assets/ZDimages/subject/icon_syspz_voc.png" v-if="item.funNum == 'fbvoc'">
  114. <img src="@/assets/ZDimages/subject/icon_syspz_tvoc.png" v-if="item.funNum == 'tvoc'">
  115. <img src="@/assets/ZDimages/subject/icon_sy_mcnd.png" v-if="item.funNum == 'so2'">
  116. <img src="@/assets/ZDimages/subject/icon_bj_yyhd.png" v-if="item.funNum == 'no1'">
  117. <img src="@/assets/ZDimages/subject/icon_bj_dqy.png" v-if="item.funNum == 'fenchen'">
  118. <img src="@/assets/ZDimages/subject/icon_bj_qq.png" v-if="item.funNum == 'H2'">
  119. <img src="@/assets/ZDimages/subject/guangqi.png" v-if="item.funNum == 'guangqi'">
  120. <img src="@/assets/ZDimages/subject/lvqi.png" v-if="item.funNum == 'lvqi'">
  121. <img src="@/assets/ZDimages/subject/icon_syspz_jiaquan.png" v-if="item.funNum == 'jiaquan'">
  122. <img src="@/assets/ZDimages/subject/icon_syspz_hwcw.png" v-if="item.funNum == 'hwcwy'">
  123. <div>
  124. <el-tooltip class="item" effect="dark" :content="item.describe" placement="bottom">
  125. <p>{{item.describe|ellipsis}}</p>
  126. </el-tooltip>
  127. <p>{{item.formatVal}}</p>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. <img class="null-data-img" src="@/assets/ZDimages/null-data.png" v-if="!checkedSubject.sensorFunctionStatusList[0]">
  133. <p class="null-text-p" v-if="!checkedSubject.sensorFunctionStatusList[0]">暂无环境监测信息,请在更多操作-物联设备配置中进行添加</p>
  134. <p class="bottom-text" v-if="checkedSubject.sensorFunctionStatusList[0]">数据上报时间:{{checkedSubject.sensorFunctionStatusList[0].sendDate}}</p>
  135. </div>
  136. <div class="bottom-switch-box" v-if="rightButtonType == 2">
  137. <p class="top-title"><i>{{checkedSubject.deptName}}</i><i>当前位置:{{checkedSubject.subAddrr.buildName}}{{checkedSubject.subAddrr.floorName}}</i></p>
  138. <div class="switch-for-max-box" v-show="checkedSubject.VOlist[0]" v-hasPermi="['laboratory:subcontrol:set']">
  139. <div class="switch-for-big-box" v-for="(item,index) in checkedSubject.VOlist" :key="index">
  140. <div class="switch-for-min-box" v-if="item.hardwareTypeEnum.enumName == 'SWITCH'">
  141. <div class="switch-for-min-box_t">
  142. <p class="switch-for-min-title">{{item.hardwareName}}</p>
  143. <p class="switch-null-p" v-if="item.state.code != 3 && item.state.code != 4" >{{item.state.name}}</p>
  144. </div>
  145. <div class="switch-for-min-box_b">
  146. <p class="switch-null-ventilate" v-if="item.hardwareTypeEnum.hardwareTypeCode==2 && item.state.code==3">{{item.dictLabel}}</p>
  147. <el-switch
  148. v-if="item.state.code == 3||item.state.code == 4"
  149. class="switch"
  150. @click.native="changeIsNeedCaptcha(item)"
  151. v-model="item.state.code"
  152. :active-value="3"
  153. :inactive-value="4"
  154. active-text="开启"
  155. inactive-text="关闭"
  156. disabled>
  157. </el-switch>
  158. </div>
  159. </div>
  160. <div class="switch-for-min-box" v-if="item.hardwareTypeEnum.enumName == 'AI_VENTILATION'">
  161. <div class="switch-for-min-box_t">
  162. <p class="switch-for-min-title">{{item.hardwareName}}</p>
  163. <p class="switch-null-p" v-if="item.state.code != 3 && item.state.code != 4">{{item.state.name}}</p>
  164. </div>
  165. <div class="switch-for-min-box_b">
  166. <p class="switch-null-ventilate" v-if="item.hardwareTypeEnum.hardwareTypeCode==2 && item.state.code==3">{{item.dictLabel}}</p>
  167. <el-switch
  168. v-if="item.state.code == 3||item.state.code == 4"
  169. class="switch"
  170. @click.native="changeIsNeedCaptcha(item)"
  171. v-model="item.state.code"
  172. :active-value="3"
  173. :inactive-value="4"
  174. active-text="开启"
  175. inactive-text="关闭"
  176. disabled>
  177. </el-switch>
  178. </div>
  179. </div>
  180. <div class="switch-for-min-box" v-if="item.hardwareTypeEnum.enumName == 'ONE_MACHINE'">
  181. <p class="switch-for-min-title">广播系统</p>
  182. <p class="switch-for-min-button" @click="handleAdd(item.subId)">播放文字</p>
  183. </div>
  184. </div>
  185. </div>
  186. <img class="null-data-img" src="@/assets/ZDimages/null-data.png" v-show="!checkedSubject.VOlist[0]">
  187. <p class="null-text-p" v-show="!checkedSubject.VOlist[0]">暂无物联控制信息,请在更多操作-物联设备配置中进行添加</p>
  188. </div>
  189. <div class="bottom-video-box" v-if="rightButtonType == 3">
  190. <p class="top-title"><i>{{checkedSubject.deptName}}</i><i>当前位置:{{checkedSubject.subAddrr.buildName}}{{checkedSubject.subAddrr.floorName}}</i></p>
  191. <div class="video-for-max-box" v-if="checkedSubject.videoData[0]">
  192. <div class="switch-for-big-box" v-for="(item,index) in checkedSubject.videoData" :key="index">
  193. <video :id="item.divId" ref="videoRef" autoplay controls muted width="490px" height="262px"></video>
  194. <p class="el-icon-full-screen position-p" @click="videoFullScreen(index)"></p>
  195. </div>
  196. </div>
  197. <img class="null-data-img" src="@/assets/ZDimages/null-data.png" v-if="!checkedSubject.videoData[0]">
  198. <p class="null-text-p" v-if="!checkedSubject.videoData[0]">暂无视频监控信息,请在更多操作-物联设备配置中进行添加</p>
  199. </div>
  200. <div class="bottom-alarm-box" v-if="rightButtonType == 4">
  201. <p class="top-title"><i>{{checkedSubject.deptName}}</i><i>当前位置:{{checkedSubject.subAddrr.buildName}}{{checkedSubject.subAddrr.floorName}}</i></p>
  202. <div class="alarm-max-box" :class="hardwareData[0]?hardwareData[0].status==3||hardwareData[0].status==4?'BGcolorTypeA':'BGcolorTypeB':''">
  203. <img v-if="hardwareData[0]?hardwareData[0].status == 3:''" src="@/assets/ZDimages/medicUniversity-3_1/img_syslb_znsgbjzx.png" class="alarm-img">
  204. <div class="alarm-big-box" v-if="hardwareData[0]">
  205. <p>报警器编号:{{hardwareData[0].hardwareNum}}</p>
  206. <div class="alarm-position-box" >
  207. <el-switch
  208. v-if="hardwareData[0].status == 3"
  209. @click.native="changeIsNeedCaptchaAlarm(hardwareData[0])"
  210. class="switch captcha-img"
  211. :active-value="3"
  212. :inactive-value="4"
  213. active-color="#FF9900"
  214. inactive-color="#999"
  215. v-model="hardwareData[0].status"
  216. active-text="报警中"
  217. inactive-text="未报警"
  218. disabled
  219. ></el-switch>
  220. </div>
  221. <p :class="hardwareData[0].status==3||hardwareData[0].status==4?'colorTypeA':'colorTypeB'">{{hardwareData[0].status==3||hardwareData[0].status==4?'在线':'离线'}}</p>
  222. </div>
  223. <div class="alarm-big-box" v-if="!hardwareData[0]">
  224. <p>未绑定报警器</p>
  225. </div>
  226. </div>
  227. <div class="alarm-title-box">
  228. <p>报警记录</p>
  229. <p v-hasPermi="['chemical:hxpAlarmRecord:list']" @click="goAlarmRecord">更多>></p>
  230. </div>
  231. <el-table class="subject-alarm-time" style="margin-bottom:10px;" border :data="tableList" ref="multipleTable">
  232. <el-table-column label="报警时间" align="center" prop="alarmTime"/>
  233. <el-table-column label="处理状态" align="center" prop="operate" width="100"/>
  234. <el-table-column label="处理人" align="center" prop="handlingUserName" width="90"/>
  235. </el-table>
  236. <pagination
  237. v-show="totalTwo>0"
  238. :total="totalTwo"
  239. :page.sync="queryParamsTwo.pageNum"
  240. :limit.sync="queryParamsTwo.pageSize"
  241. @pagination="getHxpAlarmRecordNoAuthList"
  242. />
  243. </div>
  244. <div class="bottom-entrance-box" v-if="rightButtonType == 5">
  245. <p class="top-title"><i>{{checkedSubject.deptName}}</i><i>当前位置:{{checkedSubject.subAddrr.buildName}}{{checkedSubject.subAddrr.floorName}}</i></p>
  246. <div class="entrance" :class="item.operate.code==2?'BGentrance_l_yes':'BGentrance_l_no'" v-for="(item,index) in entranceList" v-if="item.operate">
  247. <img class="entrance_c" v-if="item.operate.code==2" src="@/assets/ZDimages/icon_znmj_zx.png">
  248. <img class="entrance_c" v-if="item.operate.code!=2" src="@/assets/ZDimages/icon_znmj_lx.png">
  249. <div class="entrance_r">门禁编号:{{item.hardwareNum}}</div>
  250. <p :class="item.operate.code==2?'entrance_l_yes':'entrance_l_no'">{{item.operate.code==2?'在线':'离线'}}</p>
  251. </div>
  252. <img class="null-data-img" src="@/assets/ZDimages/null-data.png" v-if="entranceList.length<=0">
  253. <p class="null-text-p" v-if="entranceList.length<=0">暂无智能门禁信息,请在更多操作-物联设备配置中进行添加</p>
  254. </div>
  255. </div>
  256. </div>
  257. </div>
  258. </div>
  259. <add-subject v-if="pageType == 2" :subjectData="subjectData"></add-subject>
  260. <device-list v-if="pageType == 3" :subjectData="subjectData"></device-list>
  261. <admission-configuration v-if="pageType == 4" :subjectData="subjectData"></admission-configuration>
  262. <association-configuration v-if="pageType == 5" :subjectData="subjectData"></association-configuration>
  263. <info-page v-if="pageType == 6" :newData="newData"></info-page>
  264. <!--播放文字窗口-->
  265. <el-dialog title="广播系统" :visible.sync="open" width="500px" append-to-body>
  266. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  267. <el-form-item label="播放文字" prop="txt">
  268. <el-input v-model="form.txt" placeholder="请输入播放文字" />
  269. </el-form-item>
  270. <el-form-item label="播报方式" prop="type">
  271. <el-radio-group v-model="form.type">
  272. <el-radio :label="1">文字</el-radio>
  273. <el-radio :label="2">音频</el-radio>
  274. </el-radio-group>
  275. </el-form-item>
  276. </el-form>
  277. <div slot="footer" class="dialog-footer">
  278. <el-button @click="cancel">取 消</el-button>
  279. <el-button type="primary" @click="submitFormOne">确 定</el-button>
  280. </div>
  281. </el-dialog>
  282. </div>
  283. </template>
  284. <script>
  285. import mqtt from 'mqtt'
  286. import flvjs from 'flv.js'
  287. import { hardWareControl,alarmControl } from "@/api/laboratory/hardware";
  288. import {
  289. authListSubject,
  290. subjectInfo,
  291. updateSubject,
  292. mangerVoice,
  293. startUrl,
  294. queryHardByTypeList, getHaikangUserList, subjectTriggerModes, subjectEditSort, laboratorySubjectEditSort
  295. } from '@/api/laboratory/subject'
  296. import { listData} from "@/api/system/dict/data";
  297. import { filterDept } from "@/api/medicUniversity-3_1/index";
  298. import addSubject from "./addSubject.vue";
  299. import deviceList from "./deviceList.vue";
  300. import admissionConfiguration from "./admissionConfiguration.vue";
  301. import associationConfiguration from "./associationConfiguration.vue";
  302. import infoPage from "./infoPage.vue";
  303. import { getHxpAlarmRecordNoAuthList,getEnablelist} from "@/api/medicUniversity-3_1/index";
  304. import store from '@/store'
  305. export default {
  306. filters:{
  307. ellipsis(value){
  308. if (!value) return '';
  309. if (value.length > 6) {
  310. return value.slice(0,6) + '...'
  311. }
  312. return value
  313. }
  314. },
  315. name: "subject",
  316. components: {
  317. addSubject,
  318. deviceList,
  319. admissionConfiguration,
  320. associationConfiguration,
  321. infoPage
  322. },
  323. data(){
  324. return{
  325. pageType:1,
  326. // 遮罩层
  327. loading: true,
  328. // 显示搜索条件
  329. showSearch: true,
  330. // 总条数
  331. total: 0,
  332. // 查询参数
  333. queryParams: {
  334. pageNum: 1,
  335. pageSize:20,
  336. name: null,
  337. floorId: null,
  338. room: null,
  339. deptId: null,
  340. deptName: null,
  341. adminId: null,
  342. isDel: null,
  343. userId: null,
  344. diyOrder: null
  345. },
  346. // 实验室表格数据
  347. subjectList: [],
  348. //学院列表
  349. deptOptions:[],
  350. //当前选中实验室
  351. checkedSubject:{},
  352. //当前选中右侧按钮
  353. rightButtonType:1,
  354. //编辑实验室数据
  355. subjectData:{},
  356. // 临时保存排序
  357. sort:"",
  358. //播放文字的实验室id
  359. subId:"",
  360. open:false,
  361. form:{},
  362. //智能门禁
  363. entranceList:[
  364. {
  365. status:1,
  366. name:'门禁名称',
  367. num:'XD12345678912'
  368. },
  369. {
  370. status:0,
  371. name:'门禁名称',
  372. num:'XD12345678912'
  373. }
  374. ],
  375. rules:{
  376. txt:[
  377. {required: true, message: '请输入播放文字', trigger: 'blur'},
  378. { required: true, message: "请输入播放文字", validator: this.spaceJudgment, trigger: "blur" }
  379. ],
  380. type:[
  381. {required: true, message: '请选择播报方式', trigger: 'blur'}
  382. ],
  383. },
  384. newData:{
  385. },
  386. //MQTT请求参数-传感器
  387. mtopic:"lab/function/data",
  388. //MQTT请求参数-硬件
  389. mtopicOne:"lab/hardware/data",
  390. //MQTT请求参数-传感器-预案
  391. mtopicTow:"lab/riskPlan/trigger/notice",
  392. msg:"",
  393. client:{},
  394. videoList:[],
  395. //警报数据
  396. totalTwo:0,
  397. tableList:[],
  398. queryParamsTwo:{
  399. pageNum:1,
  400. pageSize:20,
  401. },
  402. hardwareData:[],
  403. //mqtt实验室id
  404. mqttIdList:[],
  405. //字典排风扇数组
  406. fanList:[],
  407. selectTriggerList:[],//预案触发下,预案数据存储
  408. hardwareTypeCode:'',
  409. triggerModes:'',
  410. }
  411. },
  412. created() {
  413. },
  414. mounted(){
  415. this.getDeptList();
  416. // this.subscriptionMQTT();
  417. this.getList();
  418. this.getlistData();
  419. // this.queryHardByTypeList();
  420. },
  421. methods:{
  422. //查询当前用户下的预案触发数据
  423. selectTriggerFun(data){
  424. let self = this;
  425. let dataArr=data;
  426. let list=JSON.parse(localStorage.getItem('selectTriggerList'));
  427. for(let i=0;i<list.length;i++){
  428. if(self.subId==list[i].subId){//如果当前选中的实验室和预案触发的实验室id
  429. for(let b=0;b<dataArr.length;b++){
  430. if(list[i].funNum==dataArr[b].funNum){
  431. if(list[i].minMonitor<dataArr[b].roundVlue<list[i].maxMonitor){//传感器值正常
  432. dataArr[b].type=1
  433. }else{//传感器值异常
  434. }
  435. }
  436. }
  437. }
  438. }
  439. return dataArr;
  440. },
  441. /** 查询字典数据列表 */
  442. getlistData() {
  443. this.loading = true;
  444. listData({pageNum:1,pageSize:20,dictType:'trigger_modes'}).then(response => {
  445. this.fanList=response.rows
  446. });
  447. },
  448. goAlarmRecord(){
  449. this.$router.push({
  450. path: `/chemicalLibrary/alarmRecord`,
  451. })
  452. },
  453. //智能门禁
  454. queryHardByTypeList(){
  455. let _this=this;
  456. let obj={
  457. subjectId:this.subId,
  458. type:'HK_DOOR',
  459. }
  460. queryHardByTypeList(obj).then( response => {
  461. let res=response.data;
  462. _this.entranceList=res;
  463. });
  464. },
  465. //报警器开启关闭方法
  466. changeIsNeedCaptchaAlarm(row){
  467. let self = this;
  468. console.log(row.status)
  469. if(row.status!=3 && row.status!=4){
  470. return
  471. }
  472. let text = row.status==3?'关闭':(row.status==4?'开启':'')
  473. this.$confirm(`是否`+text+`此设备`, "提示", {
  474. confirmButtonText: "确定",
  475. cancelButtonText: "取消",
  476. type: "warning"
  477. }).then(async () => {
  478. self.alarmControl(row)
  479. }).catch(() => {
  480. })
  481. },
  482. //开关按钮
  483. alarmControl(row){
  484. let switchData = {
  485. id:row.id,
  486. switchVal:row.status==3?'close':(row.status==4?'open':'')
  487. };
  488. alarmControl(switchData).then(response => {
  489. if(response.code==200){
  490. row.status = row.status==3?4:(row.status==4?3:'')
  491. }
  492. });
  493. },
  494. //获取实验室绑定报警器设备数据
  495. getEnablelist(){
  496. let obj = {
  497. subjectId:this.subId,
  498. type:"AI_ALARM"
  499. }
  500. getEnablelist(obj).then(response => {
  501. this.hardwareData = response.rows;
  502. });
  503. },
  504. //获取实验室报警列表数据
  505. getHxpAlarmRecordNoAuthList(){
  506. this.queryParamsTwo.subId = this.subId;
  507. getHxpAlarmRecordNoAuthList(this.queryParamsTwo).then(response => {
  508. this.totalTwo = response.total;
  509. this.tableList = response.rows;
  510. });
  511. },
  512. //播放文字
  513. handleAdd(id) {
  514. this.open = true;
  515. this.subId = id;
  516. },
  517. // 取消按钮
  518. cancel() {
  519. this.form = {};
  520. this.open = false;
  521. },
  522. /*播放文字*/
  523. submitFormOne(){
  524. this.$refs["form"].validate(valid => {
  525. if (valid) {
  526. let id = this.subId;
  527. mangerVoice(this.form,id).then(response => {
  528. this.msgSuccess("播放成功");
  529. this.open = false;
  530. this.getList();
  531. });
  532. }
  533. });
  534. },
  535. // 页面切换
  536. clickPage(type,row){
  537. if(this.pageType != type){
  538. if(type == 1){
  539. //列表页面
  540. this.pageType = type;
  541. this.getList();
  542. this.$set(this,'subjectData',{})
  543. }else if(type == 2){
  544. //新增页面
  545. this.pageType = type;
  546. }else if(type == 3){
  547. //编辑页面
  548. //this.pageType = 2;
  549. this.editFun(row);
  550. //this.$set(this,'subjectData',row)
  551. }else if(type == 4){
  552. this.pageType = 3;
  553. this.$set(this,'subjectData',row)
  554. }else if(type == 5){
  555. this.pageType = 4;
  556. this.$set(this,'subjectData',row)
  557. }else if(type == 6){
  558. this.pageType = 5;
  559. this.$set(this,'subjectData',row)
  560. }else if(type == 7){
  561. this.subjectInfoTwo(row);
  562. // this.$set(this,'subjectData',row)
  563. }
  564. }
  565. },
  566. //实验室编辑
  567. editFun(row){
  568. let self = this;
  569. let type = 0; //硬件 //0全部
  570. subjectInfo(row.id,type).then(response => {
  571. console.log(response.data)
  572. this.$set(this,'subjectData',response.data)
  573. this.pageType = 2;
  574. })
  575. },
  576. //获取实验室详情
  577. subjectInfoTwo(row){
  578. let self = this;
  579. let type = 0; //硬件 //0全部
  580. subjectInfo(row.id,type).then(response => {
  581. // console.log("获取实验室详情",response.data)
  582. this.$set(this,'newData',response.data);
  583. if(response.data.safeUserName){
  584. this.$set(this.newData,'safeUserName',response.data.safeUserName.split(','));
  585. }
  586. if(response.data.safeUserPhone){
  587. this.$set(this.newData,'safeUserPhone',response.data.safeUserPhone.split(','));
  588. }
  589. if(response.data.safeSigns){
  590. this.$set(this.newData,'safeSigns',response.data.safeSigns.split(','));
  591. }
  592. if(response.data.hazardCategory){
  593. this.$set(this.newData,'hazardCategory',response.data.hazardCategory.split(','));
  594. }
  595. if(response.data.outfire){
  596. this.$set(this.newData,'outfire',response.data.outfire.split(','));
  597. }
  598. if(response.data.riskMeasure){
  599. this.$set(this.newData,'riskMeasure',response.data.riskMeasure.split(','));
  600. }
  601. let list = [];
  602. let listTwo = [];
  603. if (response.data.labHardwareVOList){
  604. for(let i=0;i<response.data.labHardwareVOList.length;i++){
  605. if(response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'VIDEO_MONITOR'){
  606. list.push(response.data.labHardwareVOList[i].hardwareNUM);
  607. }
  608. // if(response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'SWITCH' || response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'AI_VENTILATION' || response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'ONE_MACHINE'){
  609. if(response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'SWITCH' || response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'AI_VENTILATION'){
  610. listTwo.push(response.data.labHardwareVOList[i])
  611. }
  612. }
  613. }
  614. this.$set(this.newData,'labHardwareVOListTwo',listTwo);
  615. if(list[0]){
  616. let obj = {
  617. count:"100",
  618. deviceIds:list.join(),
  619. page:"1",
  620. };
  621. let urlText = window.location.href;
  622. if(urlText.indexOf(localStorage.getItem('ipIdentify')) != -1){
  623. startUrl(obj).then(res => {
  624. if(res.code == 200){
  625. if(!res.data[0]){
  626. this.msgError("视频配置异常请联系管理员")
  627. this.newData.videoData = [];
  628. this.pageType = 6;
  629. }else{
  630. let newData = res.data;
  631. let videoList = [];
  632. for(let i=0;i<newData.length;i++){
  633. let obj = {
  634. name:response.data.name + response.data.subAddrr.room,
  635. videoType:"flv",
  636. divId:'divId'+i,
  637. url:newData[i].ws_flv,
  638. }
  639. videoList.push(obj)
  640. }
  641. this.$set(this.newData,'videoData',videoList);
  642. this.pageType = 6;
  643. }
  644. }
  645. });
  646. }else{
  647. startUrl(obj).then(res => {
  648. if(res.code == 200){
  649. if(!res.data[0]){
  650. this.msgError("视频配置异常请联系管理员")
  651. this.newData.videoData = [];
  652. this.pageType = 6;
  653. }else{
  654. let newData = res.data;
  655. let videoList = [];
  656. for(let i=0;i<newData.length;i++){
  657. let text = localStorage.getItem('cameraUrl');
  658. let url = newData[i].ws_flv;
  659. url = url.split("rtp/");
  660. let newUrl = text+'rtp/'+url[1];
  661. let obj = {
  662. name:response.data.name + response.data.subAddrr.room,
  663. videoType:"flv",
  664. divId:'divId'+i,
  665. url:newUrl,
  666. }
  667. videoList.push(obj)
  668. }
  669. this.$set(this.newData,'videoData',videoList);
  670. this.pageType = 6;
  671. }
  672. }
  673. });
  674. }
  675. }else{
  676. this.$set(this.newData,'videoData',[]);
  677. this.pageType = 6;
  678. }
  679. })
  680. },
  681. // 开启关闭验证
  682. async changeIsNeedCaptcha (row) {
  683. let self = this;
  684. console.log(row)
  685. if(row.state.code!=3 && row.state.code!=4){
  686. return
  687. }
  688. let text = row.state.code==3?'关闭':(row.state.code==4?'开启':'')
  689. this.$confirm(`是否`+text+`此设备`, "提示", {
  690. confirmButtonText: "确定",
  691. cancelButtonText: "取消",
  692. type: "warning"
  693. }).then(async () => {
  694. //如果是开启的时候调用
  695. if(row.state.code==4 && row.hardwareTypeEnum.hardwareTypeCode==2){
  696. self.subjectTriggerModes(row)
  697. }else{
  698. self.switchChange(row)
  699. }
  700. }).catch(() => {
  701. })
  702. },
  703. //点击开关按钮开启的时候充电调用硬件状态
  704. subjectTriggerModes(row){
  705. let self=this;
  706. subjectTriggerModes(row.id).then(response => {
  707. if(response.code==200){
  708. self.hardwareTypeCode=response.data.hardwareType.hardwareTypeCode
  709. self.triggerModes=response.data.triggerModes
  710. self.switchChange(row)
  711. }
  712. });
  713. },
  714. //开关按钮
  715. switchChange(row){
  716. let self=this;
  717. let switchData = {
  718. id:row.id,
  719. switchVal:row.state.code==3?'close':(row.state.code==4?'open':'')
  720. };
  721. hardWareControl(switchData).then(response => {
  722. if(response.code==200){
  723. row.state.code = row.state.code==3?4:(row.state.code==4?3:'')
  724. if(self.hardwareTypeCode){
  725. row.hardwareTypeEnum.hardwareTypeCode=self.hardwareTypeCode
  726. row.triggerModes=self.triggerModes
  727. for(let b=0;b<self.fanList.length;b++){
  728. if(self.fanList[b].dictValue==row.triggerModes){
  729. row.dictLabel=self.fanList[b].dictLabel
  730. }
  731. }
  732. }
  733. this.msgSuccess("操作成功")
  734. }
  735. });
  736. },
  737. //切换实验室展示数据
  738. rightButtonClick(type){
  739. let self = this;
  740. if(this.rightButtonType != type){
  741. this.rightButtonType = type;
  742. this.videoOff();
  743. if(type == 3){
  744. let self = this;
  745. let list = [];
  746. if(self.checkedSubject.labHardwareVOList){
  747. for(let i=0;i<self.checkedSubject.labHardwareVOList.length;i++){
  748. if(self.checkedSubject.labHardwareVOList[i].hardwareTypeEnum.enumName == 'VIDEO_MONITOR'){
  749. list.push(self.checkedSubject.labHardwareVOList[i].hardwareNUM);
  750. }
  751. }
  752. if(list[0]){
  753. let obj = {
  754. count:"100",
  755. deviceIds:list+'',
  756. page:"1",
  757. };
  758. let urlText = window.location.href;
  759. if(urlText.indexOf(localStorage.getItem('ipIdentify')) != -1){
  760. startUrl(obj).then(res => {
  761. if(res.code == 200){
  762. if(!res.data[0]){
  763. this.msgError("视频配置异常请联系管理员")
  764. return
  765. }
  766. let newData = res.data;
  767. let videoList = [];
  768. for(let i=0;i<newData.length;i++){
  769. let obj = {
  770. name:self.checkedSubject.name + self.checkedSubject.subAddrr.room,
  771. videoType:"flv",
  772. divId:'divId'+i,
  773. url:newData[i].ws_flv,
  774. }
  775. videoList.push(obj)
  776. }
  777. this.$set(this.checkedSubject,'videoData',videoList);
  778. if(this.rightButtonType == 3){
  779. setTimeout(function(){
  780. self.videoFunction();
  781. },1000);
  782. }
  783. }
  784. });
  785. }else{
  786. startUrl(obj).then(res => {
  787. if(res.code == 200){
  788. if(!res.data[0]){
  789. this.msgError("视频配置异常请联系管理员")
  790. return
  791. }
  792. let newData = res.data;
  793. let videoList = [];
  794. for(let i=0;i<newData.length;i++){
  795. let text = localStorage.getItem('cameraUrl');
  796. let url = newData[i].ws_flv;
  797. url = url.split("rtp/");
  798. let newUrl = text+'rtp/'+url[1];
  799. let obj = {
  800. name:self.checkedSubject.name + self.checkedSubject.subAddrr.room,
  801. videoType:"flv",
  802. divId:'divId'+i,
  803. url:newUrl,
  804. }
  805. videoList.push(obj)
  806. }
  807. this.$set(this.checkedSubject,'videoData',videoList);
  808. if(this.rightButtonType == 3){
  809. setTimeout(function(){
  810. self.videoFunction();
  811. },1000);
  812. }
  813. }
  814. });
  815. }
  816. }else{
  817. this.$set(this.checkedSubject,'videoData',[]);
  818. }
  819. }else{
  820. this.$set(this.checkedSubject,'videoData',[]);
  821. }
  822. }else if(type==2){
  823. for(let i=0;i<self.checkedSubject.VOlist.length;i++){
  824. if(self.checkedSubject.VOlist[i].hardwareTypeEnum.hardwareTypeCode == '2'){
  825. for(let b=0;b<self.fanList.length;b++){
  826. if(self.fanList[b].dictValue==self.checkedSubject.VOlist[i].triggerModes){
  827. self.checkedSubject.VOlist[i].dictLabel=self.fanList[b].dictLabel
  828. }
  829. }
  830. }
  831. }
  832. }else if(type==5){
  833. this.queryHardByTypeList();
  834. }
  835. }
  836. },
  837. //选中实验室
  838. handleCurrentChange(val){
  839. let self = this;
  840. if(val.id != this.checkedSubject.id){
  841. this.videoOff();
  842. this.offMQTT();
  843. this.subjectInfo(val.id);
  844. this.subId = val.id;
  845. this.$set(this,'queryParamsTwo',{
  846. pageNum:1,
  847. pageSize:20,
  848. });
  849. this.getEnablelist();
  850. this.getHxpAlarmRecordNoAuthList();
  851. this.subscriptionMQTT();
  852. }
  853. },
  854. //获取实验室详情
  855. subjectInfo(id){
  856. let type = 1; //硬件 //0全部
  857. subjectInfo(id,type).then(response => {
  858. let obj = JSON.parse(JSON.stringify(response.data));
  859. obj.VOlist = [];
  860. if(response.data.labHardwareVOList){
  861. for(let i=0;i<response.data.labHardwareVOList.length;i++){
  862. if(response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'SWITCH'||
  863. response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'AI_VENTILATION'){
  864. if( response.data.labHardwareVOList[i].isPcfire == 0 ){
  865. obj.VOlist.push(response.data.labHardwareVOList[i]);
  866. }
  867. }
  868. }
  869. }
  870. //判断传感器是否在线如果不在线type为2
  871. if(response.data.sensorFunctionStatusList){
  872. obj.sensorFunctionStatusList.forEach(function(item) {
  873. if(item.formatVal.indexOf("--") != -1){
  874. item.type=2
  875. }
  876. })
  877. obj.sensorFunctionStatusList=this.selectTriggerFun(obj.sensorFunctionStatusList)
  878. }
  879. this.$set(this,'checkedSubject',obj);
  880. this.$set(this.checkedSubject,'videoData',[]);
  881. this.rightButtonType = 1;
  882. })
  883. },
  884. //编辑按钮
  885. handleCommand(command, row){
  886. switch (command) {
  887. case "1":
  888. console.log('关联配置');
  889. this.clickPage(6,row);
  890. break;
  891. case "2":
  892. console.log('物联配置');
  893. this.clickPage(4,row);
  894. break;
  895. case "3":
  896. console.log('准入配置');
  897. this.clickPage(5,row);
  898. break;
  899. case "4":
  900. console.log('编辑');
  901. this.clickPage(3,row);
  902. break;
  903. case "5":
  904. console.log('删除');
  905. break;
  906. default:
  907. break;
  908. }
  909. },
  910. //保存当前排序
  911. liveSort(row){
  912. let obj = {
  913. sort:row.diyOrder
  914. }
  915. this.sort = JSON.parse(JSON.stringify(obj));
  916. },
  917. //编辑排序
  918. editSort(row){
  919. let self = this;
  920. if(row.diyOrder != this.sort.sort){
  921. self.$confirm('是否确认修改排序?', "", {
  922. confirmButtonText: "确定",
  923. cancelButtonText: "取消",
  924. type: "warning"
  925. }).then(function() {
  926. let obj = {
  927. id:row.id,
  928. diyOrder:row.diyOrder,
  929. };
  930. laboratorySubjectEditSort(obj).then(response => {
  931. self.msgSuccess("修改成功");
  932. self.getList();
  933. });
  934. }).then(() => {}).catch(() => {
  935. let obj = JSON.parse(JSON.stringify(self.sort));
  936. row.diyOrder = obj.sort
  937. });
  938. }
  939. },
  940. /** 搜索按钮操作 */
  941. handleQuery() {
  942. this.queryParams.pageNum = 1;
  943. this.getList();
  944. },
  945. /** 重置按钮操作 */
  946. resetQuery() {
  947. this.$set(this,'queryParams',{
  948. pageNum: 1,
  949. pageSize:20,
  950. deptId:"",
  951. name: '',
  952. });
  953. // this.resetForm("queryForm");
  954. this.handleQuery();
  955. },
  956. /** 查询实验室列表 */
  957. getList() {
  958. this.loading = true;
  959. // this.offMQTT();
  960. authListSubject(this.queryParams).then(response => {
  961. this.subjectList = response.rows;
  962. this.total = response.total;
  963. this.loading = false;
  964. if(response.rows[0]){
  965. this.$refs.multipleTable.setCurrentRow(response.rows[0]);
  966. this.subjectInfo(response.rows[0].id);
  967. }
  968. let idList = [];
  969. for(let i=0;i<response.rows.length;i++){
  970. idList.push(response.rows[i].id)
  971. }
  972. this.$set(this,'mqttIdList',idList);
  973. // this.subscriptionMQTT();
  974. });
  975. },
  976. /** 查询学院列表 */
  977. getDeptList() {
  978. filterDept().then(response => {
  979. this.$set(this, 'deptOptions', response.data)
  980. });
  981. },
  982. //MQTT订阅
  983. subscriptionMQTT(){
  984. let self = this;
  985. this.client = mqtt.connect(localStorage.getItem('mqttUrl'), {
  986. username: localStorage.getItem('mqttUser'),
  987. password:localStorage.getItem('mqttPassword')
  988. });
  989. this.client.on("connect", e =>{
  990. console.log("连接成功");
  991. this.client.subscribe(this.mtopic+self.subId, (err) => {
  992. if (!err) {
  993. console.log("订阅成功:" + this.mtopic+self.subId);
  994. }
  995. });
  996. this.client.subscribe(this.mtopicOne+self.subId, (err) => {
  997. if (!err) {
  998. console.log("订阅成功:" + this.mtopicOne+self.subId);
  999. }
  1000. });
  1001. // for(let i = 0; i< self.mqttIdList.length;i++){
  1002. // this.client.subscribe(this.mtopic+self.mqttIdList[i], (err) => {
  1003. // if (!err) {
  1004. // console.log("订阅成功:" + this.mtopic+self.mqttIdList[i]);
  1005. // }
  1006. // });
  1007. // this.client.subscribe(this.mtopicOne+self.mqttIdList[i], (err) => {
  1008. // if (!err) {
  1009. // console.log("订阅成功:" + this.mtopicOne+self.mqttIdList[i]);
  1010. // }
  1011. // });
  1012. // }
  1013. });
  1014. this.client.on("message", (topic, message) => {
  1015. // console.log('message',message)
  1016. if (message){
  1017. let data = JSON.parse(message)
  1018. //console.log("MQTT----message",data)
  1019. if(data.data.subId){
  1020. //传感器
  1021. // console.log("传感器",data.data.subId,'---------',data);
  1022. if(self.checkedSubject.id){
  1023. if(data.data.subId&&data.data.subId == self.checkedSubject.id){
  1024. self.$set(self.checkedSubject,'sensorFunctionStatusList',data.data.functionStatuses);
  1025. self.$set(self.checkedSubject.sensorFunctionStatusList[0],'sendDate',data.sendDate);
  1026. //判断传感器是否在线如果不在线type为2
  1027. self.checkedSubject.sensorFunctionStatusList.forEach(function(item) {
  1028. if(item.formatVal.indexOf("--") != -1){
  1029. item.type=2
  1030. }
  1031. })
  1032. self.checkedSubject.sensorFunctionStatusList=self.selectTriggerFun(self.checkedSubject.sensorFunctionStatusList)
  1033. }
  1034. }
  1035. if(self.newData.id){
  1036. if(data.data.subId&&data.data.subId == self.newData.id){
  1037. self.$set(self.newData,'sensorFunctionStatusList',data.data.functionStatuses);
  1038. self.$set(self.newData.sensorFunctionStatusList[0],'sendDate',data.sendDate);
  1039. }
  1040. }
  1041. }else{
  1042. //硬件
  1043. //console.log("硬件",data);
  1044. for (let i = 0; i < data.data.length; i++) {
  1045. if (self.checkedSubject.VOlist) {
  1046. for (let k = 0; k < self.checkedSubject.VOlist.length; k++) {
  1047. if (self.checkedSubject.VOlist[k].id == data.data[i].num) {
  1048. if (data.data[i].hardwareOperate == 'CLOSE') {
  1049. self.checkedSubject.VOlist[k].state.code = 4;
  1050. } else if (data.data[i].hardwareOperate == 'OPEN') {
  1051. self.checkedSubject.VOlist[k].state.code = 3;
  1052. } else if (data.data[i].hardwareOperate == 'OFFLINE') {
  1053. self.checkedSubject.VOlist[k].state.code = 0;
  1054. }
  1055. }
  1056. if(self.checkedSubject.VOlist[k].hardwareTypeEnum.hardwareTypeCode == '2'){
  1057. for(let b=0;b<self.fanList.length;b++){
  1058. if(self.fanList[b].dictValue==self.checkedSubject.VOlist[k].triggerModes){
  1059. self.checkedSubject.VOlist[k].dictLabel=self.fanList[b].dictLabel
  1060. }
  1061. }
  1062. }
  1063. }
  1064. }
  1065. if(self.newData.labHardwareVOList){
  1066. for(let k=0;k<self.newData.labHardwareVOList.length;k++){
  1067. if(self.newData.labHardwareVOList[k].id == data.data[i].num){
  1068. if(data.data[i].hardwareOperate == 'CLOSE'){
  1069. self.newData.labHardwareVOList[k].state.code = 4;
  1070. }else if(data.data[i].hardwareOperate == 'OPEN'){
  1071. self.newData.labHardwareVOList[k].state.code = 3;
  1072. }else if(data.data[i].hardwareOperate == 'OFFLINE'){
  1073. self.newData.labHardwareVOList[k].state.code = 0;
  1074. }
  1075. }
  1076. }
  1077. }
  1078. }
  1079. }
  1080. }
  1081. });
  1082. },
  1083. //取消订阅关闭MQTT连接
  1084. offMQTT(){
  1085. let self = this;
  1086. if (self.mqttIdList[0]){
  1087. // for(let i=0;i<self.mqttIdList.length;i++){
  1088. // self.client.unsubscribe(self.mtopic+self.mqttIdList[i], error => {
  1089. // if (error) {
  1090. // console.log('Unsubscribe error', error)
  1091. // }
  1092. // })
  1093. // self.client.unsubscribe(self.mtopicOne+self.mqttIdList[i], error => {
  1094. // if (error) {
  1095. // console.log('Unsubscribe error', error)
  1096. // }
  1097. // })
  1098. // }
  1099. self.client.unsubscribe(self.mtopic+self.subId, error => {
  1100. if (error) {
  1101. console.log('Unsubscribe error', error)
  1102. }
  1103. })
  1104. self.client.unsubscribe(self.mtopicOne+self.subId, error => {
  1105. if (error) {
  1106. console.log('Unsubscribe error', error)
  1107. }
  1108. })
  1109. self.client.end();
  1110. self.client = {};
  1111. }
  1112. },
  1113. //视频方法
  1114. videoFunction(){
  1115. let self = this;
  1116. // self.videoList = [];
  1117. for(let i=0;i<self.checkedSubject.videoData.length;i++){
  1118. let obj = {
  1119. player :{},
  1120. flvPlayer:{}
  1121. };
  1122. obj.player = document.getElementById(self.checkedSubject.videoData[i].divId);
  1123. // if (flvjs.isSupported()) {
  1124. obj.flvPlayer = flvjs.createPlayer(
  1125. {
  1126. // isLive: true, //=> 是否为直播流
  1127. // hasAudio: false, //=> 是否开启声音
  1128. type: self.checkedSubject.videoData[i].videoType, //媒体类型 flv 或 mp4
  1129. url: self.checkedSubject.videoData[i].url //视频流地址
  1130. },
  1131. {
  1132. enableStashBuffer: true,//启用 IO 存储缓冲区。 如果您需要实时流播放(最小延迟),请设置为 false,但如果存在网络抖动,则可能会停止。
  1133. stashInitialSize: 128,//IO 存储缓冲区初始大小。 默认值为 384KB。 指示合适的大小可以改善视频加载/搜索时间。
  1134. isLive: true,//是否是直播
  1135. lazyLoadRecoverDuration: 30,//指示以秒为单位的lazyLoad 恢复时间边界。
  1136. autoCleanupSourceBuffer: true,//进行自动清理
  1137. autoCleanupMaxBackwardDuration: 3 * 60,//3 * 60 当向后缓冲持续时间超过这个值(以秒为单位)时,对 SourceBuffer 进行自动清理
  1138. autoCleanupMinBackwardDuration: 2 * 60,//2 * 60 指示在执行自动清理时为后向缓冲区保留的持续时间(以秒为单位)。
  1139. }
  1140. );
  1141. self.videoList.push(obj);
  1142. // }
  1143. console.log("i",i)
  1144. }
  1145. for(let i=0;i<self.videoList.length;i++){
  1146. self.videoList[i].flvPlayer.attachMediaElement(self.videoList[i].player);
  1147. self.videoList[i].flvPlayer.load(); //加载
  1148. self.videoList[i].flvPlayer.play(); //加载
  1149. }
  1150. },
  1151. //视屏全屏方法
  1152. videoFullScreen(index){
  1153. this.$refs.videoRef[index].webkitRequestFullScreen();
  1154. },
  1155. //断开视频流
  1156. videoOff(){
  1157. let self = this;
  1158. if(self.videoList[0]){
  1159. for(let i=0;i<self.videoList.length;i++){
  1160. self.videoList[i].flvPlayer.pause();
  1161. self.videoList[i].flvPlayer.unload();
  1162. self.videoList[i].flvPlayer.detachMediaElement();
  1163. self.videoList[i].flvPlayer.destroy();
  1164. self.videoList[i].flvPlayer = null;
  1165. }
  1166. self.videoList = [];
  1167. }
  1168. },
  1169. },
  1170. beforeDestroy() {
  1171. //清除定时器
  1172. let self = this;
  1173. self.videoOff();
  1174. self.offMQTT();
  1175. },
  1176. }
  1177. </script>
  1178. <style scoped lang="scss">
  1179. .subject{
  1180. flex:1;
  1181. display: flex!important;
  1182. flex-direction: column;
  1183. overflow: hidden;
  1184. *{
  1185. margin:0;
  1186. }
  1187. .subject-page{
  1188. flex:1;
  1189. display: flex;
  1190. flex-direction: column;
  1191. overflow: hidden;
  1192. border-radius:10px;
  1193. margin:5px 0 0 0;
  1194. //box-shadow: 0 0 8px 1px rgba(0, 0, 0, 0.1);
  1195. .subject-page-min{
  1196. flex:1;
  1197. display: flex;
  1198. overflow: hidden;
  1199. padding: 2px 0 10px 10px;
  1200. box-sizing: border-box;
  1201. }
  1202. .left-subject-list{
  1203. /*flex:1;*/
  1204. width:1143px;
  1205. display: flex;
  1206. flex-direction: column;
  1207. margin-right:6px;
  1208. overflow: hidden ;
  1209. box-shadow: 0px 2px 6px 0px rgba(0,0,0,0.2);
  1210. border-radius: 20px 20px 20px 20px;
  1211. padding-top: 24px;
  1212. margin-bottom:10px;
  1213. .table_border{
  1214. flex:1;
  1215. display: flex;
  1216. flex-direction: column;
  1217. padding: 20px 20px 10px;
  1218. box-sizing: border-box;
  1219. overflow: hidden;
  1220. }
  1221. }
  1222. .overflow-box{
  1223. overflow: hidden;
  1224. }
  1225. .right-subject-box{
  1226. /*width:440px;*/
  1227. flex:1;
  1228. display: flex;
  1229. flex-direction: column;
  1230. .top-button-box{
  1231. display: flex;
  1232. margin-left:6px;
  1233. div{
  1234. padding:0 10px;
  1235. height:40px;
  1236. line-height:40px;
  1237. font-size:14px;
  1238. text-align: center;
  1239. border-top-right-radius: 10px;
  1240. border-top-left-radius: 10px;
  1241. margin-right:1px;
  1242. cursor: pointer;
  1243. font-weight: 500;
  1244. }
  1245. .buttonColorA{
  1246. color:#0045AF;
  1247. background:#fff ;
  1248. border: 1px solid #E0E0E0;
  1249. border-bottom: 1px solid rgba(224,224,224,0.3);
  1250. }
  1251. .buttonColorB{
  1252. color:#333;
  1253. background:#E0E0E0 ;
  1254. border: 1px solid #E0E0E0;
  1255. border-bottom:none;
  1256. }
  1257. }
  1258. .bottom-max-box{
  1259. width:428px;
  1260. box-shadow: 0px 2px 6px 0px rgba(0,0,0,0.2);
  1261. border-radius: 0px 0px 20px 20px;
  1262. font-weight:500;
  1263. flex:1;
  1264. display: flex;
  1265. flex-direction: column;
  1266. margin-left:6px;
  1267. overflow: hidden;
  1268. margin-bottom:10px;
  1269. .bottom-sensor-box{
  1270. overflow: hidden;
  1271. display: flex;
  1272. flex-direction: column;
  1273. background: #fff;
  1274. width:424px;
  1275. flex:1;
  1276. position: relative;
  1277. // border: 1px solid #E0E0E0;
  1278. //border-radius: 0 10px 10px 10px;
  1279. .top-title{
  1280. margin:16px 26px;
  1281. display: flex;
  1282. justify-content: space-between;
  1283. >i{
  1284. font-style: normal;
  1285. line-height:18px;
  1286. font-size:16px;
  1287. color: #333;
  1288. }
  1289. }
  1290. .null-text-p{
  1291. text-align: center;
  1292. font-size:16px;
  1293. color:#999;
  1294. line-height:50px;
  1295. margin:0 30px;
  1296. }
  1297. .sensor-for-max-box{
  1298. .sensor-for-big-box{
  1299. display: inline-block;
  1300. width:180px;
  1301. height:60px;
  1302. margin:0 0 11px 22px;
  1303. border-radius: 10px;
  1304. .sensor-for-min-box{
  1305. display: flex;
  1306. img{
  1307. width:26px;
  1308. height:26px;
  1309. margin:17px 11px;
  1310. }
  1311. div{
  1312. margin:9px 0;
  1313. p{
  1314. color:#fff;
  1315. }
  1316. p:nth-child(1){
  1317. font-size:14px;
  1318. line-height:20px;
  1319. }
  1320. p:nth-child(2){
  1321. font-size:16px;
  1322. line-height:22px;
  1323. }
  1324. }
  1325. }
  1326. }
  1327. .sensor-color-a{
  1328. background: #FF7272;
  1329. color:#fff;
  1330. }
  1331. .sensor-color-b{
  1332. background: #E0E0E0;
  1333. color:#999999;
  1334. }
  1335. .sensor-color-c{
  1336. background: #80D164;
  1337. color:#fff;
  1338. }
  1339. }
  1340. .bottom-text{
  1341. line-height:18px;
  1342. font-size:14px;
  1343. color:#999999;
  1344. margin:0 0px 0px 26px;
  1345. position: absolute;
  1346. bottom: 22px;
  1347. }
  1348. }
  1349. .bottom-switch-box{
  1350. background: #fff;
  1351. width:424px;
  1352. flex: 1;
  1353. .top-title{
  1354. margin:16px 26px;
  1355. display: flex;
  1356. justify-content: space-between;
  1357. >i{
  1358. font-style: normal;
  1359. line-height:18px;
  1360. font-size:16px;
  1361. color: #333;
  1362. }
  1363. }
  1364. .null-text-p{
  1365. text-align: center;
  1366. font-size:16px;
  1367. color:#999;
  1368. line-height:50px;
  1369. margin:0 30px;
  1370. }
  1371. .switch-for-max-box{
  1372. width: 424px;
  1373. display: flex;
  1374. justify-content: flex-start;
  1375. flex-wrap: wrap;
  1376. .switch-for-big-box{
  1377. .switch-for-min-box{
  1378. width:180px;
  1379. height:70px;
  1380. margin:0 0 14px 20px;
  1381. background: rgba(1,131,250,0.1);
  1382. border-radius: 10px 10px 10px 10px;
  1383. padding: 10px;
  1384. box-sizing: border-box;
  1385. .switch-for-min-box_t{
  1386. width: 100%;
  1387. display: flex;
  1388. justify-content: space-between;
  1389. .switch-for-min-title{
  1390. font-size:14px;
  1391. line-height:24px;
  1392. width: 84px;
  1393. color: #333333;
  1394. display:block;
  1395. overflow:hidden;
  1396. text-overflow:ellipsis;
  1397. white-space:nowrap;
  1398. }
  1399. .switch-null-p{
  1400. font-size:14px;
  1401. line-height:24px;
  1402. color:#999;
  1403. }
  1404. }
  1405. .switch-for-min-box_b{
  1406. margin-top: 10px;
  1407. .switch-null-ventilate{
  1408. width: 62px;
  1409. height: 18px;
  1410. border-radius: 10px 10px 10px 10px;
  1411. opacity: 1;
  1412. border: 1px solid #0183FA;
  1413. font-size: 12px;
  1414. font-weight: 400;
  1415. color: #0183FA;
  1416. line-height: 15px;
  1417. text-align: center;
  1418. float: left;
  1419. }
  1420. .switch{
  1421. float: right;
  1422. }
  1423. }
  1424. .switch-for-min-button{
  1425. width:70px;
  1426. height:30px;
  1427. line-height:30px;
  1428. font-size:14px;
  1429. color:#0045AF;
  1430. border-radius:6px;
  1431. border: 1px solid #0045AF;
  1432. margin-top:14px;
  1433. text-align: center;
  1434. cursor: pointer;
  1435. }
  1436. }
  1437. }
  1438. }
  1439. }
  1440. .bottom-video-box{
  1441. background: #fff;
  1442. width:424px;
  1443. border-radius: 0 10px 10px 10px;
  1444. flex: 1;
  1445. .top-title{
  1446. margin:16px 26px;
  1447. display: flex;
  1448. justify-content: space-between;
  1449. >i{
  1450. font-style: normal;
  1451. line-height:18px;
  1452. font-size:16px;
  1453. color: #333;
  1454. }
  1455. }
  1456. .null-text-p{
  1457. text-align: center;
  1458. font-size:16px;
  1459. color:#999;
  1460. line-height:50px;
  1461. margin:0 30px;
  1462. }
  1463. .video-for-max-box{
  1464. .switch-for-big-box{
  1465. width:374px;
  1466. height:262px;
  1467. margin:0 auto 14px;
  1468. position: relative;
  1469. .position-p{
  1470. width:42px;
  1471. height:42px;
  1472. text-align: center;
  1473. line-height:42px;
  1474. font-size:18px;
  1475. position: absolute;
  1476. top:0;
  1477. right:0;
  1478. color:#fff;
  1479. cursor: pointer;
  1480. }
  1481. }
  1482. }
  1483. }
  1484. .bottom-alarm-box{
  1485. flex:1;
  1486. display: flex;
  1487. flex-direction: column;
  1488. background: #fff;
  1489. width:424px;
  1490. overflow-x: hidden;
  1491. padding: 0 27px 0 23px;
  1492. box-sizing: border-box;
  1493. .top-title{
  1494. margin:16px 0px;
  1495. display: flex;
  1496. justify-content: space-between;
  1497. >i{
  1498. font-style: normal;
  1499. line-height:18px;
  1500. font-size:16px;
  1501. color: #333;
  1502. }
  1503. }
  1504. .alarm-max-box{
  1505. width:374px;
  1506. height:60px;
  1507. display: flex;
  1508. position:relative;
  1509. background: #f5f5f5;
  1510. border-radius: 10px 10px 10px 10px;
  1511. margin: 10px 0 0 0;
  1512. .alarm-img{
  1513. width:30px;
  1514. height:30px;
  1515. margin:14px;
  1516. }
  1517. .alarm-big-box{
  1518. p:nth-of-type(1){
  1519. position:absolute;
  1520. top:18px;
  1521. left:64px;
  1522. font-size: 14px;
  1523. font-weight: 400;
  1524. color: #333333;
  1525. }
  1526. .alarm-position-box{
  1527. position:absolute;
  1528. top:8px;
  1529. left:260px;
  1530. }
  1531. p:nth-of-type(2){
  1532. position:absolute;
  1533. top:0px;
  1534. right:0px;
  1535. width: 50px;
  1536. height: 20px;
  1537. font-size:12px;
  1538. font-weight:700;
  1539. line-height:20px;
  1540. border-radius: 0px 10px 0px 10px;
  1541. text-align: center;
  1542. }
  1543. .colorTypeA{
  1544. background: rgba(1,131,250,0.2);
  1545. color:#0183FA;
  1546. }
  1547. .colorTypeB{
  1548. background: #ECECEC;
  1549. color:#A2A2A2;
  1550. }
  1551. }
  1552. }
  1553. .BGcolorTypeA{
  1554. width:374px;
  1555. height:60px;
  1556. display: flex;
  1557. position:relative;
  1558. background: rgba(1,131,250,0.1);
  1559. border-radius: 10px 10px 10px 10px;
  1560. margin: 10px 0 0 0;
  1561. }
  1562. .BGcolorTypeB{
  1563. width:374px;
  1564. height:60px;
  1565. display: flex;
  1566. position:relative;
  1567. background: #F5F5F5;
  1568. border-radius: 10px 10px 10px 10px;
  1569. margin: 10px 0 0 0;
  1570. }
  1571. .alarm-title-box{
  1572. display: flex;
  1573. p{
  1574. line-height:60px;
  1575. font-size:14px;
  1576. }
  1577. p:nth-child(1){
  1578. flex:1;
  1579. }
  1580. p:nth-child(2){
  1581. cursor: pointer;
  1582. }
  1583. }
  1584. }
  1585. /*智能门禁*/
  1586. .bottom-entrance-box{
  1587. flex: 1;
  1588. background: #fff;
  1589. width:424px;
  1590. border-radius: 0 10px 10px 10px;
  1591. .top-title{
  1592. margin:16px 26px;
  1593. display: flex;
  1594. justify-content: space-between;
  1595. >i{
  1596. font-style: normal;
  1597. line-height:18px;
  1598. font-size:16px;
  1599. color: #333;
  1600. }
  1601. }
  1602. .entrance{
  1603. width: 374px;
  1604. height: 60px;
  1605. display: flex;
  1606. justify-content: flex-start;
  1607. border-radius: 10px 10px 10px 10px;
  1608. margin: 10px 0 0 26px;
  1609. position: relative;
  1610. .entrance_c{
  1611. width: 30px;
  1612. height: 30px;
  1613. margin: 14px 20px 0px 14px;
  1614. }
  1615. .entrance_r{
  1616. font-size: 14px;
  1617. font-family: Microsoft YaHei-Regular, Microsoft YaHei;
  1618. font-weight: 400;
  1619. color: #333333;
  1620. line-height: 60px;
  1621. }
  1622. .entrance_l_yes{
  1623. width: 60px;
  1624. height: 30px;
  1625. background: #0183FA;
  1626. border-radius: 0px 10px 0px 10px;
  1627. font-size: 14px;
  1628. font-weight: 400;
  1629. color: #fff;
  1630. line-height: 30px;
  1631. text-align: center;
  1632. position: absolute;
  1633. top: 0;
  1634. right: 0;
  1635. }
  1636. .entrance_l_no{
  1637. width: 60px;
  1638. height: 30px;
  1639. background: #A2A2A2;
  1640. border-radius: 0px 10px 0px 10px;
  1641. font-size: 14px;
  1642. font-weight: 400;
  1643. color: #fff;
  1644. line-height: 30px;
  1645. text-align: center;
  1646. position: absolute;
  1647. top: 0;
  1648. right: 0;
  1649. }
  1650. }
  1651. .BGentrance_l_yes{
  1652. background: rgba(1,131,250,0.1);
  1653. }
  1654. .BGentrance_l_no{
  1655. background: #F5F5F5;
  1656. }
  1657. }
  1658. .null-data-img{
  1659. width:137px;
  1660. height:137px;
  1661. display: block;
  1662. margin:10px auto;
  1663. }
  1664. .null-text-p{
  1665. text-align: center;
  1666. font-size:16px;
  1667. color:#999;
  1668. line-height:50px;
  1669. margin:0 30px;
  1670. }
  1671. }
  1672. }
  1673. }
  1674. }
  1675. </style>
  1676. <style lang="scss">
  1677. .alarm-position-box{
  1678. .switch .el-switch__label {
  1679. position: absolute;
  1680. display: none;
  1681. color: #fff !important;
  1682. }
  1683. .switch .el-switch__label--right {
  1684. z-index: 1;
  1685. }
  1686. .switch .el-switch__label--right span{
  1687. margin-right: 9px;
  1688. }
  1689. .switch .el-switch__label--left {
  1690. z-index: 1;
  1691. }
  1692. .switch .el-switch__label--left span{
  1693. margin-left: 9px;
  1694. }
  1695. .switch .el-switch__label.is-active {
  1696. display: block;
  1697. }
  1698. .switch.el-switch .el-switch__core{
  1699. background-color: rgba(255,196,124)!important;
  1700. border-color: rgba(255,196,124)!important;
  1701. }
  1702. .switch.el-switch .el-switch__core,
  1703. .el-switch .el-switch__label {
  1704. width: 68px !important;
  1705. height:20px!important;
  1706. line-height:30px!important;
  1707. -webkit-border-radius: 20px!important;
  1708. -moz-border-radius: 20px!important;
  1709. border-radius: 20px!important;
  1710. margin: 0;
  1711. position: absolute;
  1712. top: 0;
  1713. }
  1714. .switch .el-switch__label--left span{
  1715. margin-left:22px!important;
  1716. font-size: 12px;
  1717. color: #fff;
  1718. line-height: 20px;
  1719. position: relative;
  1720. top: -5px;
  1721. }
  1722. .switch .el-switch__label--right span{
  1723. margin-left:5px!important;
  1724. font-size: 12px;
  1725. position: relative;
  1726. top: -5px;
  1727. }
  1728. .el-switch__core:after{
  1729. background: #FA8A01 !important;
  1730. height:16px!important;
  1731. width:16px!important;
  1732. top:1px!important;
  1733. }
  1734. .el-switch.is-checked .el-switch__core::after{
  1735. margin-left: -20px!important;
  1736. }
  1737. .el-switch{
  1738. margin:10px auto 0;
  1739. display: block;
  1740. width:80px!important;
  1741. height:4px!important;
  1742. }
  1743. }
  1744. .subject-alarm-time{
  1745. .el-table__empty-text{
  1746. background-size: 45%;
  1747. }
  1748. }
  1749. </style>