index.vue 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738
  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,
  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 self=this;
  694. let switchData = {
  695. id:row.id,
  696. switchVal:row.state.code==3?'close':(row.state.code==4?'open':'')
  697. };
  698. hardWareControl(switchData).then(response => {
  699. if(response.code==200){
  700. this.msgSuccess("操作成功")
  701. }
  702. });
  703. },
  704. //切换实验室展示数据
  705. rightButtonClick(type){
  706. let self = this;
  707. if(this.rightButtonType != type){
  708. this.rightButtonType = type;
  709. this.videoOff();
  710. if(type == 3){
  711. let self = this;
  712. let list = [];
  713. if(self.checkedSubject.labHardwareVOList){
  714. for(let i=0;i<self.checkedSubject.labHardwareVOList.length;i++){
  715. if(self.checkedSubject.labHardwareVOList[i].hardwareTypeEnum.enumName == 'VIDEO_MONITOR'){
  716. list.push(self.checkedSubject.labHardwareVOList[i].hardwareNUM);
  717. }
  718. }
  719. if(list[0]){
  720. let obj = {
  721. count:"100",
  722. deviceIds:list+'',
  723. page:"1",
  724. };
  725. let urlText = window.location.href;
  726. if(urlText.indexOf(localStorage.getItem('ipIdentify')) != -1){
  727. startUrl(obj).then(res => {
  728. if(res.code == 200){
  729. if(!res.data[0]){
  730. this.msgError("视频配置异常请联系管理员")
  731. return
  732. }
  733. let newData = res.data;
  734. let videoList = [];
  735. for(let i=0;i<newData.length;i++){
  736. let obj = {
  737. name:self.checkedSubject.name + self.checkedSubject.subAddrr.room,
  738. videoType:"flv",
  739. divId:'divId'+i,
  740. url:newData[i].ws_flv,
  741. }
  742. videoList.push(obj)
  743. }
  744. this.$set(this.checkedSubject,'videoData',videoList);
  745. if(this.rightButtonType == 3){
  746. setTimeout(function(){
  747. self.videoFunction();
  748. },1000);
  749. }
  750. }
  751. });
  752. }else{
  753. startUrl(obj).then(res => {
  754. if(res.code == 200){
  755. if(!res.data[0]){
  756. this.msgError("视频配置异常请联系管理员")
  757. return
  758. }
  759. let newData = res.data;
  760. let videoList = [];
  761. for(let i=0;i<newData.length;i++){
  762. let text = localStorage.getItem('cameraUrl');
  763. let url = newData[i].ws_flv;
  764. url = url.split("rtp/");
  765. let newUrl = text+'rtp/'+url[1];
  766. let obj = {
  767. name:self.checkedSubject.name + self.checkedSubject.subAddrr.room,
  768. videoType:"flv",
  769. divId:'divId'+i,
  770. url:newUrl,
  771. }
  772. videoList.push(obj)
  773. }
  774. this.$set(this.checkedSubject,'videoData',videoList);
  775. if(this.rightButtonType == 3){
  776. setTimeout(function(){
  777. self.videoFunction();
  778. },1000);
  779. }
  780. }
  781. });
  782. }
  783. }else{
  784. this.$set(this.checkedSubject,'videoData',[]);
  785. }
  786. }else{
  787. this.$set(this.checkedSubject,'videoData',[]);
  788. }
  789. }else if(type==2){
  790. for(let i=0;i<self.checkedSubject.VOlist.length;i++){
  791. if(self.checkedSubject.VOlist[i].hardwareTypeEnum.hardwareTypeCode == '2'){
  792. for(let b=0;b<self.fanList.length;b++){
  793. if(self.fanList[b].dictValue==self.checkedSubject.VOlist[i].triggerModes){
  794. self.checkedSubject.VOlist[i].dictLabel=self.fanList[b].dictLabel
  795. }
  796. }
  797. }
  798. }
  799. }else if(type==5){
  800. this.queryHardByTypeList();
  801. }
  802. }
  803. },
  804. //选中实验室
  805. handleCurrentChange(val){
  806. let self = this;
  807. if(val.id != this.checkedSubject.id){
  808. this.videoOff();
  809. this.offMQTT();
  810. this.subjectInfo(val.id);
  811. this.subId = val.id;
  812. this.$set(this,'queryParamsTwo',{
  813. pageNum:1,
  814. pageSize:20,
  815. });
  816. this.getEnablelist();
  817. this.getHxpAlarmRecordNoAuthList();
  818. this.subscriptionMQTT();
  819. }
  820. },
  821. //获取实验室详情
  822. subjectInfo(id){
  823. let type = 1; //硬件 //0全部
  824. subjectInfo(id,type).then(response => {
  825. let obj = JSON.parse(JSON.stringify(response.data));
  826. obj.VOlist = [];
  827. if(response.data.labHardwareVOList){
  828. for(let i=0;i<response.data.labHardwareVOList.length;i++){
  829. if(response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'SWITCH'||
  830. response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'AI_VENTILATION'){
  831. obj.VOlist.push(response.data.labHardwareVOList[i]);
  832. }
  833. }
  834. }
  835. //判断传感器是否在线如果不在线type为2
  836. if(response.data.sensorFunctionStatusList){
  837. obj.sensorFunctionStatusList.forEach(function(item) {
  838. if(item.formatVal.indexOf("--") != -1){
  839. item.type=2
  840. }
  841. })
  842. obj.sensorFunctionStatusList=this.selectTriggerFun(obj.sensorFunctionStatusList)
  843. }
  844. this.$set(this,'checkedSubject',obj);
  845. this.$set(this.checkedSubject,'videoData',[]);
  846. this.rightButtonType = 1;
  847. })
  848. },
  849. //编辑按钮
  850. handleCommand(command, row){
  851. switch (command) {
  852. case "1":
  853. console.log('关联配置');
  854. this.clickPage(6,row);
  855. break;
  856. case "2":
  857. console.log('物联配置');
  858. this.clickPage(4,row);
  859. break;
  860. case "3":
  861. console.log('准入配置');
  862. this.clickPage(5,row);
  863. break;
  864. case "4":
  865. console.log('编辑');
  866. this.clickPage(3,row);
  867. break;
  868. case "5":
  869. console.log('删除');
  870. break;
  871. default:
  872. break;
  873. }
  874. },
  875. //保存当前排序
  876. liveSort(row){
  877. let obj = {
  878. sort:row.diyOrder
  879. }
  880. this.sort = JSON.parse(JSON.stringify(obj));
  881. },
  882. //编辑排序
  883. editSort(row){
  884. let self = this;
  885. if(row.diyOrder != this.sort.sort){
  886. self.$confirm('是否确认修改排序?', "", {
  887. confirmButtonText: "确定",
  888. cancelButtonText: "取消",
  889. type: "warning"
  890. }).then(function() {
  891. let obj = {
  892. id:row.id,
  893. diyOrder:row.diyOrder,
  894. };
  895. updateSubject(obj).then(response => {
  896. self.msgSuccess("修改成功");
  897. self.getList();
  898. });
  899. }).then(() => {}).catch(() => {
  900. let obj = JSON.parse(JSON.stringify(self.sort));
  901. row.diyOrder = obj.sort
  902. });
  903. }
  904. },
  905. /** 搜索按钮操作 */
  906. handleQuery() {
  907. this.queryParams.pageNum = 1;
  908. this.getList();
  909. },
  910. /** 重置按钮操作 */
  911. resetQuery() {
  912. this.$set(this,'queryParams',{
  913. pageNum: 1,
  914. pageSize:20,
  915. deptId:"",
  916. name: '',
  917. });
  918. // this.resetForm("queryForm");
  919. this.handleQuery();
  920. },
  921. /** 查询实验室列表 */
  922. getList() {
  923. this.loading = true;
  924. // this.offMQTT();
  925. authListSubject(this.queryParams).then(response => {
  926. this.subjectList = response.rows;
  927. this.total = response.total;
  928. this.loading = false;
  929. if(response.rows[0]){
  930. this.$refs.multipleTable.setCurrentRow(response.rows[0]);
  931. this.subjectInfo(response.rows[0].id);
  932. }
  933. let idList = [];
  934. for(let i=0;i<response.rows.length;i++){
  935. idList.push(response.rows[i].id)
  936. }
  937. this.$set(this,'mqttIdList',idList);
  938. // this.subscriptionMQTT();
  939. });
  940. },
  941. /** 查询学院列表 */
  942. getDeptList() {
  943. filterDept().then(response => {
  944. this.$set(this, 'deptOptions', response.data)
  945. });
  946. },
  947. //MQTT订阅
  948. subscriptionMQTT(){
  949. let self = this;
  950. this.client = mqtt.connect(localStorage.getItem('mqttUrl'), {
  951. username: localStorage.getItem('mqttUser'),
  952. password:localStorage.getItem('mqttPassword')
  953. });
  954. this.client.on("connect", e =>{
  955. console.log("连接成功");
  956. this.client.subscribe(this.mtopic+self.subId, (err) => {
  957. if (!err) {
  958. console.log("订阅成功:" + this.mtopic+self.subId);
  959. }
  960. });
  961. this.client.subscribe(this.mtopicOne+self.subId, (err) => {
  962. if (!err) {
  963. console.log("订阅成功:" + this.mtopicOne+self.subId);
  964. }
  965. });
  966. // for(let i = 0; i< self.mqttIdList.length;i++){
  967. // this.client.subscribe(this.mtopic+self.mqttIdList[i], (err) => {
  968. // if (!err) {
  969. // console.log("订阅成功:" + this.mtopic+self.mqttIdList[i]);
  970. // }
  971. // });
  972. // this.client.subscribe(this.mtopicOne+self.mqttIdList[i], (err) => {
  973. // if (!err) {
  974. // console.log("订阅成功:" + this.mtopicOne+self.mqttIdList[i]);
  975. // }
  976. // });
  977. // }
  978. });
  979. this.client.on("message", (topic, message) => {
  980. // console.log('message',message)
  981. if (message){
  982. let data = JSON.parse(message)
  983. //console.log("MQTT----message",data)
  984. if(data.data.subId){
  985. //传感器
  986. // console.log("传感器",data.data.subId,'---------',data);
  987. if(self.checkedSubject.id){
  988. if(data.data.subId&&data.data.subId == self.checkedSubject.id){
  989. self.$set(self.checkedSubject,'sensorFunctionStatusList',data.data.functionStatuses);
  990. self.$set(self.checkedSubject.sensorFunctionStatusList[0],'sendDate',data.sendDate);
  991. //判断传感器是否在线如果不在线type为2
  992. self.checkedSubject.sensorFunctionStatusList.forEach(function(item) {
  993. if(item.formatVal.indexOf("--") != -1){
  994. item.type=2
  995. }
  996. })
  997. self.checkedSubject.sensorFunctionStatusList=self.selectTriggerFun(self.checkedSubject.sensorFunctionStatusList)
  998. }
  999. }
  1000. if(self.newData.id){
  1001. if(data.data.subId&&data.data.subId == self.newData.id){
  1002. self.$set(self.newData,'sensorFunctionStatusList',data.data.functionStatuses);
  1003. self.$set(self.newData.sensorFunctionStatusList[0],'sendDate',data.sendDate);
  1004. }
  1005. }
  1006. }else{
  1007. //硬件
  1008. //console.log("硬件",data);
  1009. for (let i = 0; i < data.data.length; i++) {
  1010. if (self.checkedSubject.VOlist) {
  1011. for (let k = 0; k < self.checkedSubject.VOlist.length; k++) {
  1012. if (self.checkedSubject.VOlist[k].id == data.data[i].num) {
  1013. if (data.data[i].hardwareOperate == 'CLOSE') {
  1014. self.checkedSubject.VOlist[k].state.code = 4;
  1015. } else if (data.data[i].hardwareOperate == 'OPEN') {
  1016. self.checkedSubject.VOlist[k].state.code = 3;
  1017. } else if (data.data[i].hardwareOperate == 'OFFLINE') {
  1018. self.checkedSubject.VOlist[k].state.code = 0;
  1019. }
  1020. }
  1021. if(self.checkedSubject.VOlist[k].hardwareTypeEnum.hardwareTypeCode == '2'){
  1022. for(let b=0;b<self.fanList.length;b++){
  1023. if(self.fanList[b].dictValue==self.checkedSubject.VOlist[k].triggerModes){
  1024. self.checkedSubject.VOlist[k].dictLabel=self.fanList[b].dictLabel
  1025. }
  1026. }
  1027. }
  1028. }
  1029. }
  1030. if(self.newData.labHardwareVOList){
  1031. for(let k=0;k<self.newData.labHardwareVOList.length;k++){
  1032. if(self.newData.labHardwareVOList[k].id == data.data[i].num){
  1033. if(data.data[i].hardwareOperate == 'CLOSE'){
  1034. self.newData.labHardwareVOList[k].state.code = 4;
  1035. }else if(data.data[i].hardwareOperate == 'OPEN'){
  1036. self.newData.labHardwareVOList[k].state.code = 3;
  1037. }else if(data.data[i].hardwareOperate == 'OFFLINE'){
  1038. self.newData.labHardwareVOList[k].state.code = 0;
  1039. }
  1040. }
  1041. }
  1042. }
  1043. }
  1044. }
  1045. }
  1046. });
  1047. },
  1048. //取消订阅关闭MQTT连接
  1049. offMQTT(){
  1050. let self = this;
  1051. if (self.mqttIdList[0]){
  1052. // for(let i=0;i<self.mqttIdList.length;i++){
  1053. // self.client.unsubscribe(self.mtopic+self.mqttIdList[i], error => {
  1054. // if (error) {
  1055. // console.log('Unsubscribe error', error)
  1056. // }
  1057. // })
  1058. // self.client.unsubscribe(self.mtopicOne+self.mqttIdList[i], error => {
  1059. // if (error) {
  1060. // console.log('Unsubscribe error', error)
  1061. // }
  1062. // })
  1063. // }
  1064. self.client.unsubscribe(self.mtopic+self.subId, error => {
  1065. if (error) {
  1066. console.log('Unsubscribe error', error)
  1067. }
  1068. })
  1069. self.client.unsubscribe(self.mtopicOne+self.subId, error => {
  1070. if (error) {
  1071. console.log('Unsubscribe error', error)
  1072. }
  1073. })
  1074. self.client.end();
  1075. self.client = {};
  1076. }
  1077. },
  1078. //视频方法
  1079. videoFunction(){
  1080. let self = this;
  1081. // self.videoList = [];
  1082. for(let i=0;i<self.checkedSubject.videoData.length;i++){
  1083. let obj = {
  1084. player :{},
  1085. flvPlayer:{}
  1086. };
  1087. obj.player = document.getElementById(self.checkedSubject.videoData[i].divId);
  1088. // if (flvjs.isSupported()) {
  1089. obj.flvPlayer = flvjs.createPlayer(
  1090. {
  1091. // isLive: true, //=> 是否为直播流
  1092. // hasAudio: false, //=> 是否开启声音
  1093. type: self.checkedSubject.videoData[i].videoType, //媒体类型 flv 或 mp4
  1094. url: self.checkedSubject.videoData[i].url //视频流地址
  1095. },
  1096. {
  1097. enableStashBuffer: true,//启用 IO 存储缓冲区。 如果您需要实时流播放(最小延迟),请设置为 false,但如果存在网络抖动,则可能会停止。
  1098. stashInitialSize: 128,//IO 存储缓冲区初始大小。 默认值为 384KB。 指示合适的大小可以改善视频加载/搜索时间。
  1099. isLive: true,//是否是直播
  1100. lazyLoadRecoverDuration: 30,//指示以秒为单位的lazyLoad 恢复时间边界。
  1101. autoCleanupSourceBuffer: true,//进行自动清理
  1102. autoCleanupMaxBackwardDuration: 3 * 60,//3 * 60 当向后缓冲持续时间超过这个值(以秒为单位)时,对 SourceBuffer 进行自动清理
  1103. autoCleanupMinBackwardDuration: 2 * 60,//2 * 60 指示在执行自动清理时为后向缓冲区保留的持续时间(以秒为单位)。
  1104. }
  1105. );
  1106. self.videoList.push(obj);
  1107. // }
  1108. console.log("i",i)
  1109. }
  1110. for(let i=0;i<self.videoList.length;i++){
  1111. self.videoList[i].flvPlayer.attachMediaElement(self.videoList[i].player);
  1112. self.videoList[i].flvPlayer.load(); //加载
  1113. self.videoList[i].flvPlayer.play(); //加载
  1114. }
  1115. },
  1116. //视屏全屏方法
  1117. videoFullScreen(index){
  1118. this.$refs.videoRef[index].webkitRequestFullScreen();
  1119. },
  1120. //断开视频流
  1121. videoOff(){
  1122. let self = this;
  1123. if(self.videoList[0]){
  1124. for(let i=0;i<self.videoList.length;i++){
  1125. self.videoList[i].flvPlayer.pause();
  1126. self.videoList[i].flvPlayer.unload();
  1127. self.videoList[i].flvPlayer.detachMediaElement();
  1128. self.videoList[i].flvPlayer.destroy();
  1129. self.videoList[i].flvPlayer = null;
  1130. }
  1131. self.videoList = [];
  1132. }
  1133. },
  1134. },
  1135. beforeDestroy() {
  1136. //清除定时器
  1137. let self = this;
  1138. self.videoOff();
  1139. self.offMQTT();
  1140. },
  1141. }
  1142. </script>
  1143. <style scoped lang="scss">
  1144. .subject{
  1145. flex:1;
  1146. display: flex!important;
  1147. flex-direction: column;
  1148. overflow: hidden;
  1149. *{
  1150. margin:0;
  1151. }
  1152. .subject-page{
  1153. flex:1;
  1154. display: flex;
  1155. flex-direction: column;
  1156. overflow: hidden;
  1157. border-radius:10px;
  1158. margin:5px 0 0 0;
  1159. //box-shadow: 0 0 8px 1px rgba(0, 0, 0, 0.1);
  1160. .subject-page-min{
  1161. flex:1;
  1162. display: flex;
  1163. overflow: hidden;
  1164. padding: 2px 0 10px 10px;
  1165. box-sizing: border-box;
  1166. }
  1167. .left-subject-list{
  1168. /*flex:1;*/
  1169. width:1143px;
  1170. display: flex;
  1171. flex-direction: column;
  1172. margin-right:6px;
  1173. overflow: hidden ;
  1174. box-shadow: 0px 2px 6px 0px rgba(0,0,0,0.2);
  1175. border-radius: 20px 20px 20px 20px;
  1176. padding-top: 24px;
  1177. margin-bottom:10px;
  1178. .table_border{
  1179. flex:1;
  1180. display: flex;
  1181. flex-direction: column;
  1182. padding: 20px 20px 10px;
  1183. box-sizing: border-box;
  1184. overflow: hidden;
  1185. }
  1186. }
  1187. .overflow-box{
  1188. overflow: hidden;
  1189. }
  1190. .right-subject-box{
  1191. /*width:440px;*/
  1192. flex:1;
  1193. display: flex;
  1194. flex-direction: column;
  1195. .top-button-box{
  1196. display: flex;
  1197. margin-left:6px;
  1198. div{
  1199. padding:0 10px;
  1200. height:40px;
  1201. line-height:40px;
  1202. font-size:14px;
  1203. text-align: center;
  1204. border-top-right-radius: 10px;
  1205. border-top-left-radius: 10px;
  1206. margin-right:1px;
  1207. cursor: pointer;
  1208. font-weight: 500;
  1209. }
  1210. .buttonColorA{
  1211. color:#0045AF;
  1212. background:#fff ;
  1213. border: 1px solid #E0E0E0;
  1214. border-bottom: 1px solid rgba(224,224,224,0.3);
  1215. }
  1216. .buttonColorB{
  1217. color:#333;
  1218. background:#E0E0E0 ;
  1219. border: 1px solid #E0E0E0;
  1220. border-bottom:none;
  1221. }
  1222. }
  1223. .bottom-max-box{
  1224. width:428px;
  1225. box-shadow: 0px 2px 6px 0px rgba(0,0,0,0.2);
  1226. border-radius: 0px 0px 20px 20px;
  1227. font-weight:500;
  1228. flex:1;
  1229. display: flex;
  1230. flex-direction: column;
  1231. margin-left:6px;
  1232. overflow: hidden;
  1233. margin-bottom:10px;
  1234. .bottom-sensor-box{
  1235. overflow: hidden;
  1236. display: flex;
  1237. flex-direction: column;
  1238. background: #fff;
  1239. width:424px;
  1240. flex:1;
  1241. position: relative;
  1242. // border: 1px solid #E0E0E0;
  1243. //border-radius: 0 10px 10px 10px;
  1244. .top-title{
  1245. margin:16px 26px;
  1246. display: flex;
  1247. justify-content: space-between;
  1248. >i{
  1249. font-style: normal;
  1250. line-height:18px;
  1251. font-size:16px;
  1252. color: #333;
  1253. }
  1254. }
  1255. .null-text-p{
  1256. text-align: center;
  1257. font-size:16px;
  1258. color:#999;
  1259. line-height:50px;
  1260. margin:0 30px;
  1261. }
  1262. .sensor-for-max-box{
  1263. .sensor-for-big-box{
  1264. display: inline-block;
  1265. width:180px;
  1266. height:60px;
  1267. margin:0 0 11px 22px;
  1268. border-radius: 10px;
  1269. .sensor-for-min-box{
  1270. display: flex;
  1271. img{
  1272. width:26px;
  1273. height:26px;
  1274. margin:17px 11px;
  1275. }
  1276. div{
  1277. margin:9px 0;
  1278. p{
  1279. color:#fff;
  1280. }
  1281. p:nth-child(1){
  1282. font-size:14px;
  1283. line-height:20px;
  1284. }
  1285. p:nth-child(2){
  1286. font-size:16px;
  1287. line-height:22px;
  1288. }
  1289. }
  1290. }
  1291. }
  1292. .sensor-color-a{
  1293. background: #FF7272;
  1294. color:#fff;
  1295. }
  1296. .sensor-color-b{
  1297. background: #E0E0E0;
  1298. color:#999999;
  1299. }
  1300. .sensor-color-c{
  1301. background: #80D164;
  1302. color:#fff;
  1303. }
  1304. }
  1305. .bottom-text{
  1306. line-height:18px;
  1307. font-size:14px;
  1308. color:#999999;
  1309. margin:0 0px 0px 26px;
  1310. position: absolute;
  1311. bottom: 22px;
  1312. }
  1313. }
  1314. .bottom-switch-box{
  1315. background: #fff;
  1316. width:424px;
  1317. flex: 1;
  1318. .top-title{
  1319. margin:16px 26px;
  1320. display: flex;
  1321. justify-content: space-between;
  1322. >i{
  1323. font-style: normal;
  1324. line-height:18px;
  1325. font-size:16px;
  1326. color: #333;
  1327. }
  1328. }
  1329. .null-text-p{
  1330. text-align: center;
  1331. font-size:16px;
  1332. color:#999;
  1333. line-height:50px;
  1334. margin:0 30px;
  1335. }
  1336. .switch-for-max-box{
  1337. width: 424px;
  1338. display: flex;
  1339. justify-content: flex-start;
  1340. flex-wrap: wrap;
  1341. .switch-for-big-box{
  1342. .switch-for-min-box{
  1343. width:180px;
  1344. height:70px;
  1345. margin:0 0 14px 20px;
  1346. background: rgba(1,131,250,0.1);
  1347. border-radius: 10px 10px 10px 10px;
  1348. padding: 10px;
  1349. box-sizing: border-box;
  1350. .switch-for-min-box_t{
  1351. width: 100%;
  1352. display: flex;
  1353. justify-content: space-between;
  1354. .switch-for-min-title{
  1355. font-size:14px;
  1356. line-height:24px;
  1357. width: 84px;
  1358. color: #333333;
  1359. display:block;
  1360. overflow:hidden;
  1361. text-overflow:ellipsis;
  1362. white-space:nowrap;
  1363. }
  1364. .switch-null-p{
  1365. font-size:14px;
  1366. line-height:24px;
  1367. color:#999;
  1368. }
  1369. }
  1370. .switch-for-min-box_b{
  1371. margin-top: 10px;
  1372. .switch-null-ventilate{
  1373. width: 62px;
  1374. height: 18px;
  1375. border-radius: 10px 10px 10px 10px;
  1376. opacity: 1;
  1377. border: 1px solid #0183FA;
  1378. font-size: 12px;
  1379. font-weight: 400;
  1380. color: #0183FA;
  1381. line-height: 15px;
  1382. text-align: center;
  1383. float: left;
  1384. }
  1385. .switch{
  1386. float: right;
  1387. }
  1388. }
  1389. .switch-for-min-button{
  1390. width:70px;
  1391. height:30px;
  1392. line-height:30px;
  1393. font-size:14px;
  1394. color:#0045AF;
  1395. border-radius:6px;
  1396. border: 1px solid #0045AF;
  1397. margin-top:14px;
  1398. text-align: center;
  1399. cursor: pointer;
  1400. }
  1401. }
  1402. }
  1403. }
  1404. }
  1405. .bottom-video-box{
  1406. background: #fff;
  1407. width:424px;
  1408. border-radius: 0 10px 10px 10px;
  1409. flex: 1;
  1410. .top-title{
  1411. margin:16px 26px;
  1412. display: flex;
  1413. justify-content: space-between;
  1414. >i{
  1415. font-style: normal;
  1416. line-height:18px;
  1417. font-size:16px;
  1418. color: #333;
  1419. }
  1420. }
  1421. .null-text-p{
  1422. text-align: center;
  1423. font-size:16px;
  1424. color:#999;
  1425. line-height:50px;
  1426. margin:0 30px;
  1427. }
  1428. .video-for-max-box{
  1429. .switch-for-big-box{
  1430. width:374px;
  1431. height:262px;
  1432. margin:0 auto 14px;
  1433. position: relative;
  1434. .position-p{
  1435. width:42px;
  1436. height:42px;
  1437. text-align: center;
  1438. line-height:42px;
  1439. font-size:18px;
  1440. position: absolute;
  1441. top:0;
  1442. right:0;
  1443. color:#fff;
  1444. cursor: pointer;
  1445. }
  1446. }
  1447. }
  1448. }
  1449. .bottom-alarm-box{
  1450. flex:1;
  1451. display: flex;
  1452. flex-direction: column;
  1453. background: #fff;
  1454. width:424px;
  1455. overflow-x: hidden;
  1456. padding: 0 27px 0 23px;
  1457. box-sizing: border-box;
  1458. .top-title{
  1459. margin:16px 0px;
  1460. display: flex;
  1461. justify-content: space-between;
  1462. >i{
  1463. font-style: normal;
  1464. line-height:18px;
  1465. font-size:16px;
  1466. color: #333;
  1467. }
  1468. }
  1469. .alarm-max-box{
  1470. width:374px;
  1471. height:60px;
  1472. display: flex;
  1473. position:relative;
  1474. background: #f5f5f5;
  1475. border-radius: 10px 10px 10px 10px;
  1476. margin: 10px 0 0 0;
  1477. .alarm-img{
  1478. width:30px;
  1479. height:30px;
  1480. margin:14px;
  1481. }
  1482. .alarm-big-box{
  1483. p:nth-of-type(1){
  1484. position:absolute;
  1485. top:18px;
  1486. left:64px;
  1487. font-size: 14px;
  1488. font-weight: 400;
  1489. color: #333333;
  1490. }
  1491. .alarm-position-box{
  1492. position:absolute;
  1493. top:8px;
  1494. left:260px;
  1495. }
  1496. p:nth-of-type(2){
  1497. position:absolute;
  1498. top:0px;
  1499. right:0px;
  1500. width: 50px;
  1501. height: 20px;
  1502. font-size:12px;
  1503. font-weight:700;
  1504. line-height:20px;
  1505. border-radius: 0px 10px 0px 10px;
  1506. text-align: center;
  1507. }
  1508. .colorTypeA{
  1509. background: rgba(1,131,250,0.2);
  1510. color:#0183FA;
  1511. }
  1512. .colorTypeB{
  1513. background: #ECECEC;
  1514. color:#A2A2A2;
  1515. }
  1516. }
  1517. }
  1518. .BGcolorTypeA{
  1519. width:374px;
  1520. height:60px;
  1521. display: flex;
  1522. position:relative;
  1523. background: rgba(1,131,250,0.1);
  1524. border-radius: 10px 10px 10px 10px;
  1525. margin: 10px 0 0 0;
  1526. }
  1527. .BGcolorTypeB{
  1528. width:374px;
  1529. height:60px;
  1530. display: flex;
  1531. position:relative;
  1532. background: #F5F5F5;
  1533. border-radius: 10px 10px 10px 10px;
  1534. margin: 10px 0 0 0;
  1535. }
  1536. .alarm-title-box{
  1537. display: flex;
  1538. p{
  1539. line-height:60px;
  1540. font-size:14px;
  1541. }
  1542. p:nth-child(1){
  1543. flex:1;
  1544. }
  1545. p:nth-child(2){
  1546. cursor: pointer;
  1547. }
  1548. }
  1549. }
  1550. /*智能门禁*/
  1551. .bottom-entrance-box{
  1552. flex: 1;
  1553. background: #fff;
  1554. width:424px;
  1555. border-radius: 0 10px 10px 10px;
  1556. .top-title{
  1557. margin:16px 26px;
  1558. display: flex;
  1559. justify-content: space-between;
  1560. >i{
  1561. font-style: normal;
  1562. line-height:18px;
  1563. font-size:16px;
  1564. color: #333;
  1565. }
  1566. }
  1567. .entrance{
  1568. width: 374px;
  1569. height: 60px;
  1570. display: flex;
  1571. justify-content: flex-start;
  1572. border-radius: 10px 10px 10px 10px;
  1573. margin: 10px 0 0 26px;
  1574. position: relative;
  1575. .entrance_c{
  1576. width: 30px;
  1577. height: 30px;
  1578. margin: 14px 20px 0px 14px;
  1579. }
  1580. .entrance_r{
  1581. font-size: 14px;
  1582. font-family: Microsoft YaHei-Regular, Microsoft YaHei;
  1583. font-weight: 400;
  1584. color: #333333;
  1585. line-height: 60px;
  1586. }
  1587. .entrance_l_yes{
  1588. width: 60px;
  1589. height: 30px;
  1590. background: #0183FA;
  1591. border-radius: 0px 10px 0px 10px;
  1592. font-size: 14px;
  1593. font-weight: 400;
  1594. color: #fff;
  1595. line-height: 30px;
  1596. text-align: center;
  1597. position: absolute;
  1598. top: 0;
  1599. right: 0;
  1600. }
  1601. .entrance_l_no{
  1602. width: 60px;
  1603. height: 30px;
  1604. background: #A2A2A2;
  1605. border-radius: 0px 10px 0px 10px;
  1606. font-size: 14px;
  1607. font-weight: 400;
  1608. color: #fff;
  1609. line-height: 30px;
  1610. text-align: center;
  1611. position: absolute;
  1612. top: 0;
  1613. right: 0;
  1614. }
  1615. }
  1616. .BGentrance_l_yes{
  1617. background: rgba(1,131,250,0.1);
  1618. }
  1619. .BGentrance_l_no{
  1620. background: #F5F5F5;
  1621. }
  1622. }
  1623. .null-data-img{
  1624. width:137px;
  1625. height:137px;
  1626. display: block;
  1627. margin:10px auto;
  1628. }
  1629. .null-text-p{
  1630. text-align: center;
  1631. font-size:16px;
  1632. color:#999;
  1633. line-height:50px;
  1634. margin:0 30px;
  1635. }
  1636. }
  1637. }
  1638. }
  1639. }
  1640. </style>
  1641. <style lang="scss">
  1642. .alarm-position-box{
  1643. .switch .el-switch__label {
  1644. position: absolute;
  1645. display: none;
  1646. color: #fff !important;
  1647. }
  1648. .switch .el-switch__label--right {
  1649. z-index: 1;
  1650. }
  1651. .switch .el-switch__label--right span{
  1652. margin-right: 9px;
  1653. }
  1654. .switch .el-switch__label--left {
  1655. z-index: 1;
  1656. }
  1657. .switch .el-switch__label--left span{
  1658. margin-left: 9px;
  1659. }
  1660. .switch .el-switch__label.is-active {
  1661. display: block;
  1662. }
  1663. .switch.el-switch .el-switch__core{
  1664. background-color: rgba(255,196,124)!important;
  1665. border-color: rgba(255,196,124)!important;
  1666. }
  1667. .switch.el-switch .el-switch__core,
  1668. .el-switch .el-switch__label {
  1669. width: 68px !important;
  1670. height:20px!important;
  1671. line-height:30px!important;
  1672. -webkit-border-radius: 20px!important;
  1673. -moz-border-radius: 20px!important;
  1674. border-radius: 20px!important;
  1675. margin: 0;
  1676. position: absolute;
  1677. top: 0;
  1678. }
  1679. .switch .el-switch__label--left span{
  1680. margin-left:22px!important;
  1681. font-size: 12px;
  1682. color: #fff;
  1683. line-height: 20px;
  1684. position: relative;
  1685. top: -5px;
  1686. }
  1687. .switch .el-switch__label--right span{
  1688. margin-left:5px!important;
  1689. font-size: 12px;
  1690. position: relative;
  1691. top: -5px;
  1692. }
  1693. .el-switch__core:after{
  1694. background: #FA8A01 !important;
  1695. height:16px!important;
  1696. width:16px!important;
  1697. top:1px!important;
  1698. }
  1699. .el-switch.is-checked .el-switch__core::after{
  1700. margin-left: -20px!important;
  1701. }
  1702. .el-switch{
  1703. margin:10px auto 0;
  1704. display: block;
  1705. width:80px!important;
  1706. height:4px!important;
  1707. }
  1708. }
  1709. .subject-alarm-time{
  1710. .el-table__empty-text{
  1711. background-size: 45%;
  1712. }
  1713. }
  1714. </style>