index.vue 62 KB

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