index.vue 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767
  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, subjectTriggerModes
  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. hardwareTypeCode:'',
  404. triggerModes:'',
  405. }
  406. },
  407. created() {
  408. },
  409. mounted(){
  410. this.getDeptList();
  411. // this.subscriptionMQTT();
  412. this.getList();
  413. this.getlistData();
  414. // this.queryHardByTypeList();
  415. },
  416. methods:{
  417. //查询当前用户下的预案触发数据
  418. selectTriggerFun(data){
  419. let self = this;
  420. let dataArr=data;
  421. let list=JSON.parse(localStorage.getItem('selectTriggerList'));
  422. for(let i=0;i<list.length;i++){
  423. if(self.subId==list[i].subId){//如果当前选中的实验室和预案触发的实验室id
  424. for(let b=0;b<dataArr.length;b++){
  425. if(list[i].funNum==dataArr[b].funNum){
  426. if(list[i].minMonitor<dataArr[b].roundVlue<list[i].maxMonitor){//传感器值正常
  427. dataArr[b].type=1
  428. }else{//传感器值异常
  429. }
  430. }
  431. }
  432. }
  433. }
  434. return dataArr;
  435. },
  436. /** 查询字典数据列表 */
  437. getlistData() {
  438. this.loading = true;
  439. listData({pageNum:1,pageSize:20,dictType:'trigger_modes'}).then(response => {
  440. this.fanList=response.rows
  441. });
  442. },
  443. goAlarmRecord(){
  444. this.$router.push({
  445. path: `/chemicalLibrary/alarmRecord`,
  446. })
  447. },
  448. //智能门禁
  449. queryHardByTypeList(){
  450. let _this=this;
  451. let obj={
  452. subjectId:this.subId,
  453. type:'HK_DOOR',
  454. }
  455. queryHardByTypeList(obj).then( response => {
  456. let res=response.data;
  457. _this.entranceList=res;
  458. });
  459. },
  460. //报警器开启关闭方法
  461. changeIsNeedCaptchaAlarm(row){
  462. let self = this;
  463. console.log(row.status)
  464. if(row.status!=3 && row.status!=4){
  465. return
  466. }
  467. let text = row.status==3?'关闭':(row.status==4?'开启':'')
  468. this.$confirm(`是否`+text+`此设备`, "提示", {
  469. confirmButtonText: "确定",
  470. cancelButtonText: "取消",
  471. type: "warning"
  472. }).then(async () => {
  473. self.alarmControl(row)
  474. }).catch(() => {
  475. })
  476. },
  477. //开关按钮
  478. alarmControl(row){
  479. let switchData = {
  480. id:row.id,
  481. switchVal:row.status==3?'close':(row.status==4?'open':'')
  482. };
  483. alarmControl(switchData).then(response => {
  484. if(response.code==200){
  485. row.status = row.status==3?4:(row.status==4?3:'')
  486. }
  487. });
  488. },
  489. //获取实验室绑定报警器设备数据
  490. getEnablelist(){
  491. let obj = {
  492. subjectId:this.subId,
  493. type:"AI_ALARM"
  494. }
  495. getEnablelist(obj).then(response => {
  496. this.hardwareData = response.rows;
  497. });
  498. },
  499. //获取实验室报警列表数据
  500. getHxpAlarmRecordNoAuthList(){
  501. this.queryParamsTwo.subId = this.subId;
  502. getHxpAlarmRecordNoAuthList(this.queryParamsTwo).then(response => {
  503. this.totalTwo = response.total;
  504. this.tableList = response.rows;
  505. });
  506. },
  507. //播放文字
  508. handleAdd(id) {
  509. this.open = true;
  510. this.subId = id;
  511. },
  512. // 取消按钮
  513. cancel() {
  514. this.form = {};
  515. this.open = false;
  516. },
  517. /*播放文字*/
  518. submitFormOne(){
  519. this.$refs["form"].validate(valid => {
  520. if (valid) {
  521. let id = this.subId;
  522. mangerVoice(this.form,id).then(response => {
  523. this.msgSuccess("播放成功");
  524. this.open = false;
  525. this.getList();
  526. });
  527. }
  528. });
  529. },
  530. // 页面切换
  531. clickPage(type,row){
  532. if(this.pageType != type){
  533. if(type == 1){
  534. //列表页面
  535. this.pageType = type;
  536. this.getList();
  537. this.$set(this,'subjectData',{})
  538. }else if(type == 2){
  539. //新增页面
  540. this.pageType = type;
  541. }else if(type == 3){
  542. //编辑页面
  543. //this.pageType = 2;
  544. this.editFun(row);
  545. //this.$set(this,'subjectData',row)
  546. }else if(type == 4){
  547. this.pageType = 3;
  548. this.$set(this,'subjectData',row)
  549. }else if(type == 5){
  550. this.pageType = 4;
  551. this.$set(this,'subjectData',row)
  552. }else if(type == 6){
  553. this.pageType = 5;
  554. this.$set(this,'subjectData',row)
  555. }else if(type == 7){
  556. this.subjectInfoTwo(row);
  557. // this.$set(this,'subjectData',row)
  558. }
  559. }
  560. },
  561. //实验室编辑
  562. editFun(row){
  563. let self = this;
  564. let type = 0; //硬件 //0全部
  565. subjectInfo(row.id,type).then(response => {
  566. console.log(response.data)
  567. this.$set(this,'subjectData',response.data)
  568. this.pageType = 2;
  569. })
  570. },
  571. //获取实验室详情
  572. subjectInfoTwo(row){
  573. let self = this;
  574. let type = 0; //硬件 //0全部
  575. subjectInfo(row.id,type).then(response => {
  576. // console.log("获取实验室详情",response.data)
  577. this.$set(this,'newData',response.data);
  578. if(response.data.safeUserName){
  579. this.$set(this.newData,'safeUserName',response.data.safeUserName.split(','));
  580. }
  581. if(response.data.safeUserPhone){
  582. this.$set(this.newData,'safeUserPhone',response.data.safeUserPhone.split(','));
  583. }
  584. if(response.data.safeSigns){
  585. this.$set(this.newData,'safeSigns',response.data.safeSigns.split(','));
  586. }
  587. if(response.data.hazardCategory){
  588. this.$set(this.newData,'hazardCategory',response.data.hazardCategory.split(','));
  589. }
  590. if(response.data.outfire){
  591. this.$set(this.newData,'outfire',response.data.outfire.split(','));
  592. }
  593. if(response.data.riskMeasure){
  594. this.$set(this.newData,'riskMeasure',response.data.riskMeasure.split(','));
  595. }
  596. let list = [];
  597. let listTwo = [];
  598. if (response.data.labHardwareVOList){
  599. for(let i=0;i<response.data.labHardwareVOList.length;i++){
  600. if(response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'VIDEO_MONITOR'){
  601. list.push(response.data.labHardwareVOList[i].hardwareNUM);
  602. }
  603. // if(response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'SWITCH' || response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'AI_VENTILATION' || response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'ONE_MACHINE'){
  604. if(response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'SWITCH' || response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'AI_VENTILATION'){
  605. listTwo.push(response.data.labHardwareVOList[i])
  606. }
  607. }
  608. }
  609. this.$set(this.newData,'labHardwareVOListTwo',listTwo);
  610. if(list[0]){
  611. let obj = {
  612. count:"100",
  613. deviceIds:list.join(),
  614. page:"1",
  615. };
  616. let urlText = window.location.href;
  617. if(urlText.indexOf(localStorage.getItem('ipIdentify')) != -1){
  618. startUrl(obj).then(res => {
  619. if(res.code == 200){
  620. if(!res.data[0]){
  621. this.msgError("视频配置异常请联系管理员")
  622. this.newData.videoData = [];
  623. this.pageType = 6;
  624. }else{
  625. let newData = res.data;
  626. let videoList = [];
  627. for(let i=0;i<newData.length;i++){
  628. let obj = {
  629. name:response.data.name + response.data.subAddrr.room,
  630. videoType:"flv",
  631. divId:'divId'+i,
  632. url:newData[i].ws_flv,
  633. }
  634. videoList.push(obj)
  635. }
  636. this.$set(this.newData,'videoData',videoList);
  637. this.pageType = 6;
  638. }
  639. }
  640. });
  641. }else{
  642. startUrl(obj).then(res => {
  643. if(res.code == 200){
  644. if(!res.data[0]){
  645. this.msgError("视频配置异常请联系管理员")
  646. this.newData.videoData = [];
  647. this.pageType = 6;
  648. }else{
  649. let newData = res.data;
  650. let videoList = [];
  651. for(let i=0;i<newData.length;i++){
  652. let text = localStorage.getItem('cameraUrl');
  653. let url = newData[i].ws_flv;
  654. url = url.split("rtp/");
  655. let newUrl = text+'rtp/'+url[1];
  656. let obj = {
  657. name:response.data.name + response.data.subAddrr.room,
  658. videoType:"flv",
  659. divId:'divId'+i,
  660. url:newUrl,
  661. }
  662. videoList.push(obj)
  663. }
  664. this.$set(this.newData,'videoData',videoList);
  665. this.pageType = 6;
  666. }
  667. }
  668. });
  669. }
  670. }else{
  671. this.$set(this.newData,'videoData',[]);
  672. this.pageType = 6;
  673. }
  674. })
  675. },
  676. // 开启关闭验证
  677. async changeIsNeedCaptcha (row) {
  678. let self = this;
  679. console.log(row)
  680. if(row.state.code!=3 && row.state.code!=4){
  681. return
  682. }
  683. let text = row.state.code==3?'关闭':(row.state.code==4?'开启':'')
  684. this.$confirm(`是否`+text+`此设备`, "提示", {
  685. confirmButtonText: "确定",
  686. cancelButtonText: "取消",
  687. type: "warning"
  688. }).then(async () => {
  689. //如果是开启的时候调用
  690. if(row.state.code==4 && row.hardwareTypeEnum.hardwareTypeCode==2){
  691. self.subjectTriggerModes(row)
  692. }else{
  693. self.switchChange(row)
  694. }
  695. }).catch(() => {
  696. })
  697. },
  698. //点击开关按钮开启的时候充电调用硬件状态
  699. subjectTriggerModes(row){
  700. let self=this;
  701. subjectTriggerModes(row.id).then(response => {
  702. if(response.code==200){
  703. self.hardwareTypeCode=response.data.hardwareType.hardwareTypeCode
  704. self.triggerModes=response.data.triggerModes
  705. self.switchChange(row)
  706. }
  707. });
  708. },
  709. //开关按钮
  710. switchChange(row){
  711. let self=this;
  712. let switchData = {
  713. id:row.id,
  714. switchVal:row.state.code==3?'close':(row.state.code==4?'open':'')
  715. };
  716. hardWareControl(switchData).then(response => {
  717. if(response.code==200){
  718. row.state.code = row.state.code==3?4:(row.state.code==4?3:'')
  719. if(self.hardwareTypeCode){
  720. row.hardwareTypeEnum.hardwareTypeCode=self.hardwareTypeCode
  721. row.triggerModes=self.triggerModes
  722. for(let b=0;b<self.fanList.length;b++){
  723. if(self.fanList[b].dictValue==row.triggerModes){
  724. row.dictLabel=self.fanList[b].dictLabel
  725. }
  726. }
  727. }
  728. this.msgSuccess("操作成功")
  729. }
  730. });
  731. },
  732. //切换实验室展示数据
  733. rightButtonClick(type){
  734. let self = this;
  735. if(this.rightButtonType != type){
  736. this.rightButtonType = type;
  737. this.videoOff();
  738. if(type == 3){
  739. let self = this;
  740. let list = [];
  741. if(self.checkedSubject.labHardwareVOList){
  742. for(let i=0;i<self.checkedSubject.labHardwareVOList.length;i++){
  743. if(self.checkedSubject.labHardwareVOList[i].hardwareTypeEnum.enumName == 'VIDEO_MONITOR'){
  744. list.push(self.checkedSubject.labHardwareVOList[i].hardwareNUM);
  745. }
  746. }
  747. if(list[0]){
  748. let obj = {
  749. count:"100",
  750. deviceIds:list+'',
  751. page:"1",
  752. };
  753. let urlText = window.location.href;
  754. if(urlText.indexOf(localStorage.getItem('ipIdentify')) != -1){
  755. startUrl(obj).then(res => {
  756. if(res.code == 200){
  757. if(!res.data[0]){
  758. this.msgError("视频配置异常请联系管理员")
  759. return
  760. }
  761. let newData = res.data;
  762. let videoList = [];
  763. for(let i=0;i<newData.length;i++){
  764. let obj = {
  765. name:self.checkedSubject.name + self.checkedSubject.subAddrr.room,
  766. videoType:"flv",
  767. divId:'divId'+i,
  768. url:newData[i].ws_flv,
  769. }
  770. videoList.push(obj)
  771. }
  772. this.$set(this.checkedSubject,'videoData',videoList);
  773. if(this.rightButtonType == 3){
  774. setTimeout(function(){
  775. self.videoFunction();
  776. },1000);
  777. }
  778. }
  779. });
  780. }else{
  781. startUrl(obj).then(res => {
  782. if(res.code == 200){
  783. if(!res.data[0]){
  784. this.msgError("视频配置异常请联系管理员")
  785. return
  786. }
  787. let newData = res.data;
  788. let videoList = [];
  789. for(let i=0;i<newData.length;i++){
  790. let text = localStorage.getItem('cameraUrl');
  791. let url = newData[i].ws_flv;
  792. url = url.split("rtp/");
  793. let newUrl = text+'rtp/'+url[1];
  794. let obj = {
  795. name:self.checkedSubject.name + self.checkedSubject.subAddrr.room,
  796. videoType:"flv",
  797. divId:'divId'+i,
  798. url:newUrl,
  799. }
  800. videoList.push(obj)
  801. }
  802. this.$set(this.checkedSubject,'videoData',videoList);
  803. if(this.rightButtonType == 3){
  804. setTimeout(function(){
  805. self.videoFunction();
  806. },1000);
  807. }
  808. }
  809. });
  810. }
  811. }else{
  812. this.$set(this.checkedSubject,'videoData',[]);
  813. }
  814. }else{
  815. this.$set(this.checkedSubject,'videoData',[]);
  816. }
  817. }else if(type==2){
  818. for(let i=0;i<self.checkedSubject.VOlist.length;i++){
  819. if(self.checkedSubject.VOlist[i].hardwareTypeEnum.hardwareTypeCode == '2'){
  820. for(let b=0;b<self.fanList.length;b++){
  821. if(self.fanList[b].dictValue==self.checkedSubject.VOlist[i].triggerModes){
  822. self.checkedSubject.VOlist[i].dictLabel=self.fanList[b].dictLabel
  823. }
  824. }
  825. }
  826. }
  827. }else if(type==5){
  828. this.queryHardByTypeList();
  829. }
  830. }
  831. },
  832. //选中实验室
  833. handleCurrentChange(val){
  834. let self = this;
  835. if(val.id != this.checkedSubject.id){
  836. this.videoOff();
  837. this.offMQTT();
  838. this.subjectInfo(val.id);
  839. this.subId = val.id;
  840. this.$set(this,'queryParamsTwo',{
  841. pageNum:1,
  842. pageSize:20,
  843. });
  844. this.getEnablelist();
  845. this.getHxpAlarmRecordNoAuthList();
  846. this.subscriptionMQTT();
  847. }
  848. },
  849. //获取实验室详情
  850. subjectInfo(id){
  851. let type = 1; //硬件 //0全部
  852. subjectInfo(id,type).then(response => {
  853. let obj = JSON.parse(JSON.stringify(response.data));
  854. obj.VOlist = [];
  855. if(response.data.labHardwareVOList){
  856. for(let i=0;i<response.data.labHardwareVOList.length;i++){
  857. if(response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'SWITCH'||
  858. response.data.labHardwareVOList[i].hardwareTypeEnum.enumName == 'AI_VENTILATION'){
  859. obj.VOlist.push(response.data.labHardwareVOList[i]);
  860. }
  861. }
  862. }
  863. //判断传感器是否在线如果不在线type为2
  864. if(response.data.sensorFunctionStatusList){
  865. obj.sensorFunctionStatusList.forEach(function(item) {
  866. if(item.formatVal.indexOf("--") != -1){
  867. item.type=2
  868. }
  869. })
  870. obj.sensorFunctionStatusList=this.selectTriggerFun(obj.sensorFunctionStatusList)
  871. }
  872. this.$set(this,'checkedSubject',obj);
  873. this.$set(this.checkedSubject,'videoData',[]);
  874. this.rightButtonType = 1;
  875. })
  876. },
  877. //编辑按钮
  878. handleCommand(command, row){
  879. switch (command) {
  880. case "1":
  881. console.log('关联配置');
  882. this.clickPage(6,row);
  883. break;
  884. case "2":
  885. console.log('物联配置');
  886. this.clickPage(4,row);
  887. break;
  888. case "3":
  889. console.log('准入配置');
  890. this.clickPage(5,row);
  891. break;
  892. case "4":
  893. console.log('编辑');
  894. this.clickPage(3,row);
  895. break;
  896. case "5":
  897. console.log('删除');
  898. break;
  899. default:
  900. break;
  901. }
  902. },
  903. //保存当前排序
  904. liveSort(row){
  905. let obj = {
  906. sort:row.diyOrder
  907. }
  908. this.sort = JSON.parse(JSON.stringify(obj));
  909. },
  910. //编辑排序
  911. editSort(row){
  912. let self = this;
  913. if(row.diyOrder != this.sort.sort){
  914. self.$confirm('是否确认修改排序?', "", {
  915. confirmButtonText: "确定",
  916. cancelButtonText: "取消",
  917. type: "warning"
  918. }).then(function() {
  919. let obj = {
  920. id:row.id,
  921. diyOrder:row.diyOrder,
  922. };
  923. updateSubject(obj).then(response => {
  924. self.msgSuccess("修改成功");
  925. self.getList();
  926. });
  927. }).then(() => {}).catch(() => {
  928. let obj = JSON.parse(JSON.stringify(self.sort));
  929. row.diyOrder = obj.sort
  930. });
  931. }
  932. },
  933. /** 搜索按钮操作 */
  934. handleQuery() {
  935. this.queryParams.pageNum = 1;
  936. this.getList();
  937. },
  938. /** 重置按钮操作 */
  939. resetQuery() {
  940. this.$set(this,'queryParams',{
  941. pageNum: 1,
  942. pageSize:20,
  943. deptId:"",
  944. name: '',
  945. });
  946. // this.resetForm("queryForm");
  947. this.handleQuery();
  948. },
  949. /** 查询实验室列表 */
  950. getList() {
  951. this.loading = true;
  952. // this.offMQTT();
  953. authListSubject(this.queryParams).then(response => {
  954. this.subjectList = response.rows;
  955. this.total = response.total;
  956. this.loading = false;
  957. if(response.rows[0]){
  958. this.$refs.multipleTable.setCurrentRow(response.rows[0]);
  959. this.subjectInfo(response.rows[0].id);
  960. }
  961. let idList = [];
  962. for(let i=0;i<response.rows.length;i++){
  963. idList.push(response.rows[i].id)
  964. }
  965. this.$set(this,'mqttIdList',idList);
  966. // this.subscriptionMQTT();
  967. });
  968. },
  969. /** 查询学院列表 */
  970. getDeptList() {
  971. filterDept().then(response => {
  972. this.$set(this, 'deptOptions', response.data)
  973. });
  974. },
  975. //MQTT订阅
  976. subscriptionMQTT(){
  977. let self = this;
  978. this.client = mqtt.connect(localStorage.getItem('mqttUrl'), {
  979. username: localStorage.getItem('mqttUser'),
  980. password:localStorage.getItem('mqttPassword')
  981. });
  982. this.client.on("connect", e =>{
  983. console.log("连接成功");
  984. this.client.subscribe(this.mtopic+self.subId, (err) => {
  985. if (!err) {
  986. console.log("订阅成功:" + this.mtopic+self.subId);
  987. }
  988. });
  989. this.client.subscribe(this.mtopicOne+self.subId, (err) => {
  990. if (!err) {
  991. console.log("订阅成功:" + this.mtopicOne+self.subId);
  992. }
  993. });
  994. // for(let i = 0; i< self.mqttIdList.length;i++){
  995. // this.client.subscribe(this.mtopic+self.mqttIdList[i], (err) => {
  996. // if (!err) {
  997. // console.log("订阅成功:" + this.mtopic+self.mqttIdList[i]);
  998. // }
  999. // });
  1000. // this.client.subscribe(this.mtopicOne+self.mqttIdList[i], (err) => {
  1001. // if (!err) {
  1002. // console.log("订阅成功:" + this.mtopicOne+self.mqttIdList[i]);
  1003. // }
  1004. // });
  1005. // }
  1006. });
  1007. this.client.on("message", (topic, message) => {
  1008. // console.log('message',message)
  1009. if (message){
  1010. let data = JSON.parse(message)
  1011. //console.log("MQTT----message",data)
  1012. if(data.data.subId){
  1013. //传感器
  1014. // console.log("传感器",data.data.subId,'---------',data);
  1015. if(self.checkedSubject.id){
  1016. if(data.data.subId&&data.data.subId == self.checkedSubject.id){
  1017. self.$set(self.checkedSubject,'sensorFunctionStatusList',data.data.functionStatuses);
  1018. self.$set(self.checkedSubject.sensorFunctionStatusList[0],'sendDate',data.sendDate);
  1019. //判断传感器是否在线如果不在线type为2
  1020. self.checkedSubject.sensorFunctionStatusList.forEach(function(item) {
  1021. if(item.formatVal.indexOf("--") != -1){
  1022. item.type=2
  1023. }
  1024. })
  1025. self.checkedSubject.sensorFunctionStatusList=self.selectTriggerFun(self.checkedSubject.sensorFunctionStatusList)
  1026. }
  1027. }
  1028. if(self.newData.id){
  1029. if(data.data.subId&&data.data.subId == self.newData.id){
  1030. self.$set(self.newData,'sensorFunctionStatusList',data.data.functionStatuses);
  1031. self.$set(self.newData.sensorFunctionStatusList[0],'sendDate',data.sendDate);
  1032. }
  1033. }
  1034. }else{
  1035. //硬件
  1036. //console.log("硬件",data);
  1037. for (let i = 0; i < data.data.length; i++) {
  1038. if (self.checkedSubject.VOlist) {
  1039. for (let k = 0; k < self.checkedSubject.VOlist.length; k++) {
  1040. if (self.checkedSubject.VOlist[k].id == data.data[i].num) {
  1041. if (data.data[i].hardwareOperate == 'CLOSE') {
  1042. self.checkedSubject.VOlist[k].state.code = 4;
  1043. } else if (data.data[i].hardwareOperate == 'OPEN') {
  1044. self.checkedSubject.VOlist[k].state.code = 3;
  1045. } else if (data.data[i].hardwareOperate == 'OFFLINE') {
  1046. self.checkedSubject.VOlist[k].state.code = 0;
  1047. }
  1048. }
  1049. if(self.checkedSubject.VOlist[k].hardwareTypeEnum.hardwareTypeCode == '2'){
  1050. for(let b=0;b<self.fanList.length;b++){
  1051. if(self.fanList[b].dictValue==self.checkedSubject.VOlist[k].triggerModes){
  1052. self.checkedSubject.VOlist[k].dictLabel=self.fanList[b].dictLabel
  1053. }
  1054. }
  1055. }
  1056. }
  1057. }
  1058. if(self.newData.labHardwareVOList){
  1059. for(let k=0;k<self.newData.labHardwareVOList.length;k++){
  1060. if(self.newData.labHardwareVOList[k].id == data.data[i].num){
  1061. if(data.data[i].hardwareOperate == 'CLOSE'){
  1062. self.newData.labHardwareVOList[k].state.code = 4;
  1063. }else if(data.data[i].hardwareOperate == 'OPEN'){
  1064. self.newData.labHardwareVOList[k].state.code = 3;
  1065. }else if(data.data[i].hardwareOperate == 'OFFLINE'){
  1066. self.newData.labHardwareVOList[k].state.code = 0;
  1067. }
  1068. }
  1069. }
  1070. }
  1071. }
  1072. }
  1073. }
  1074. });
  1075. },
  1076. //取消订阅关闭MQTT连接
  1077. offMQTT(){
  1078. let self = this;
  1079. if (self.mqttIdList[0]){
  1080. // for(let i=0;i<self.mqttIdList.length;i++){
  1081. // self.client.unsubscribe(self.mtopic+self.mqttIdList[i], error => {
  1082. // if (error) {
  1083. // console.log('Unsubscribe error', error)
  1084. // }
  1085. // })
  1086. // self.client.unsubscribe(self.mtopicOne+self.mqttIdList[i], error => {
  1087. // if (error) {
  1088. // console.log('Unsubscribe error', error)
  1089. // }
  1090. // })
  1091. // }
  1092. self.client.unsubscribe(self.mtopic+self.subId, error => {
  1093. if (error) {
  1094. console.log('Unsubscribe error', error)
  1095. }
  1096. })
  1097. self.client.unsubscribe(self.mtopicOne+self.subId, error => {
  1098. if (error) {
  1099. console.log('Unsubscribe error', error)
  1100. }
  1101. })
  1102. self.client.end();
  1103. self.client = {};
  1104. }
  1105. },
  1106. //视频方法
  1107. videoFunction(){
  1108. let self = this;
  1109. // self.videoList = [];
  1110. for(let i=0;i<self.checkedSubject.videoData.length;i++){
  1111. let obj = {
  1112. player :{},
  1113. flvPlayer:{}
  1114. };
  1115. obj.player = document.getElementById(self.checkedSubject.videoData[i].divId);
  1116. // if (flvjs.isSupported()) {
  1117. obj.flvPlayer = flvjs.createPlayer(
  1118. {
  1119. // isLive: true, //=> 是否为直播流
  1120. // hasAudio: false, //=> 是否开启声音
  1121. type: self.checkedSubject.videoData[i].videoType, //媒体类型 flv 或 mp4
  1122. url: self.checkedSubject.videoData[i].url //视频流地址
  1123. },
  1124. {
  1125. enableStashBuffer: true,//启用 IO 存储缓冲区。 如果您需要实时流播放(最小延迟),请设置为 false,但如果存在网络抖动,则可能会停止。
  1126. stashInitialSize: 128,//IO 存储缓冲区初始大小。 默认值为 384KB。 指示合适的大小可以改善视频加载/搜索时间。
  1127. isLive: true,//是否是直播
  1128. lazyLoadRecoverDuration: 30,//指示以秒为单位的lazyLoad 恢复时间边界。
  1129. autoCleanupSourceBuffer: true,//进行自动清理
  1130. autoCleanupMaxBackwardDuration: 3 * 60,//3 * 60 当向后缓冲持续时间超过这个值(以秒为单位)时,对 SourceBuffer 进行自动清理
  1131. autoCleanupMinBackwardDuration: 2 * 60,//2 * 60 指示在执行自动清理时为后向缓冲区保留的持续时间(以秒为单位)。
  1132. }
  1133. );
  1134. self.videoList.push(obj);
  1135. // }
  1136. console.log("i",i)
  1137. }
  1138. for(let i=0;i<self.videoList.length;i++){
  1139. self.videoList[i].flvPlayer.attachMediaElement(self.videoList[i].player);
  1140. self.videoList[i].flvPlayer.load(); //加载
  1141. self.videoList[i].flvPlayer.play(); //加载
  1142. }
  1143. },
  1144. //视屏全屏方法
  1145. videoFullScreen(index){
  1146. this.$refs.videoRef[index].webkitRequestFullScreen();
  1147. },
  1148. //断开视频流
  1149. videoOff(){
  1150. let self = this;
  1151. if(self.videoList[0]){
  1152. for(let i=0;i<self.videoList.length;i++){
  1153. self.videoList[i].flvPlayer.pause();
  1154. self.videoList[i].flvPlayer.unload();
  1155. self.videoList[i].flvPlayer.detachMediaElement();
  1156. self.videoList[i].flvPlayer.destroy();
  1157. self.videoList[i].flvPlayer = null;
  1158. }
  1159. self.videoList = [];
  1160. }
  1161. },
  1162. },
  1163. beforeDestroy() {
  1164. //清除定时器
  1165. let self = this;
  1166. self.videoOff();
  1167. self.offMQTT();
  1168. },
  1169. }
  1170. </script>
  1171. <style scoped lang="scss">
  1172. .subject{
  1173. flex:1;
  1174. display: flex!important;
  1175. flex-direction: column;
  1176. overflow: hidden;
  1177. *{
  1178. margin:0;
  1179. }
  1180. .subject-page{
  1181. flex:1;
  1182. display: flex;
  1183. flex-direction: column;
  1184. overflow: hidden;
  1185. border-radius:10px;
  1186. margin:5px 0 0 0;
  1187. //box-shadow: 0 0 8px 1px rgba(0, 0, 0, 0.1);
  1188. .subject-page-min{
  1189. flex:1;
  1190. display: flex;
  1191. overflow: hidden;
  1192. padding: 2px 0 10px 10px;
  1193. box-sizing: border-box;
  1194. }
  1195. .left-subject-list{
  1196. /*flex:1;*/
  1197. width:1143px;
  1198. display: flex;
  1199. flex-direction: column;
  1200. margin-right:6px;
  1201. overflow: hidden ;
  1202. box-shadow: 0px 2px 6px 0px rgba(0,0,0,0.2);
  1203. border-radius: 20px 20px 20px 20px;
  1204. padding-top: 24px;
  1205. margin-bottom:10px;
  1206. .table_border{
  1207. flex:1;
  1208. display: flex;
  1209. flex-direction: column;
  1210. padding: 20px 20px 10px;
  1211. box-sizing: border-box;
  1212. overflow: hidden;
  1213. }
  1214. }
  1215. .overflow-box{
  1216. overflow: hidden;
  1217. }
  1218. .right-subject-box{
  1219. /*width:440px;*/
  1220. flex:1;
  1221. display: flex;
  1222. flex-direction: column;
  1223. .top-button-box{
  1224. display: flex;
  1225. margin-left:6px;
  1226. div{
  1227. padding:0 10px;
  1228. height:40px;
  1229. line-height:40px;
  1230. font-size:14px;
  1231. text-align: center;
  1232. border-top-right-radius: 10px;
  1233. border-top-left-radius: 10px;
  1234. margin-right:1px;
  1235. cursor: pointer;
  1236. font-weight: 500;
  1237. }
  1238. .buttonColorA{
  1239. color:#0045AF;
  1240. background:#fff ;
  1241. border: 1px solid #E0E0E0;
  1242. border-bottom: 1px solid rgba(224,224,224,0.3);
  1243. }
  1244. .buttonColorB{
  1245. color:#333;
  1246. background:#E0E0E0 ;
  1247. border: 1px solid #E0E0E0;
  1248. border-bottom:none;
  1249. }
  1250. }
  1251. .bottom-max-box{
  1252. width:428px;
  1253. box-shadow: 0px 2px 6px 0px rgba(0,0,0,0.2);
  1254. border-radius: 0px 0px 20px 20px;
  1255. font-weight:500;
  1256. flex:1;
  1257. display: flex;
  1258. flex-direction: column;
  1259. margin-left:6px;
  1260. overflow: hidden;
  1261. margin-bottom:10px;
  1262. .bottom-sensor-box{
  1263. overflow: hidden;
  1264. display: flex;
  1265. flex-direction: column;
  1266. background: #fff;
  1267. width:424px;
  1268. flex:1;
  1269. position: relative;
  1270. // border: 1px solid #E0E0E0;
  1271. //border-radius: 0 10px 10px 10px;
  1272. .top-title{
  1273. margin:16px 26px;
  1274. display: flex;
  1275. justify-content: space-between;
  1276. >i{
  1277. font-style: normal;
  1278. line-height:18px;
  1279. font-size:16px;
  1280. color: #333;
  1281. }
  1282. }
  1283. .null-text-p{
  1284. text-align: center;
  1285. font-size:16px;
  1286. color:#999;
  1287. line-height:50px;
  1288. margin:0 30px;
  1289. }
  1290. .sensor-for-max-box{
  1291. .sensor-for-big-box{
  1292. display: inline-block;
  1293. width:180px;
  1294. height:60px;
  1295. margin:0 0 11px 22px;
  1296. border-radius: 10px;
  1297. .sensor-for-min-box{
  1298. display: flex;
  1299. img{
  1300. width:26px;
  1301. height:26px;
  1302. margin:17px 11px;
  1303. }
  1304. div{
  1305. margin:9px 0;
  1306. p{
  1307. color:#fff;
  1308. }
  1309. p:nth-child(1){
  1310. font-size:14px;
  1311. line-height:20px;
  1312. }
  1313. p:nth-child(2){
  1314. font-size:16px;
  1315. line-height:22px;
  1316. }
  1317. }
  1318. }
  1319. }
  1320. .sensor-color-a{
  1321. background: #FF7272;
  1322. color:#fff;
  1323. }
  1324. .sensor-color-b{
  1325. background: #E0E0E0;
  1326. color:#999999;
  1327. }
  1328. .sensor-color-c{
  1329. background: #80D164;
  1330. color:#fff;
  1331. }
  1332. }
  1333. .bottom-text{
  1334. line-height:18px;
  1335. font-size:14px;
  1336. color:#999999;
  1337. margin:0 0px 0px 26px;
  1338. position: absolute;
  1339. bottom: 22px;
  1340. }
  1341. }
  1342. .bottom-switch-box{
  1343. background: #fff;
  1344. width:424px;
  1345. flex: 1;
  1346. .top-title{
  1347. margin:16px 26px;
  1348. display: flex;
  1349. justify-content: space-between;
  1350. >i{
  1351. font-style: normal;
  1352. line-height:18px;
  1353. font-size:16px;
  1354. color: #333;
  1355. }
  1356. }
  1357. .null-text-p{
  1358. text-align: center;
  1359. font-size:16px;
  1360. color:#999;
  1361. line-height:50px;
  1362. margin:0 30px;
  1363. }
  1364. .switch-for-max-box{
  1365. width: 424px;
  1366. display: flex;
  1367. justify-content: flex-start;
  1368. flex-wrap: wrap;
  1369. .switch-for-big-box{
  1370. .switch-for-min-box{
  1371. width:180px;
  1372. height:70px;
  1373. margin:0 0 14px 20px;
  1374. background: rgba(1,131,250,0.1);
  1375. border-radius: 10px 10px 10px 10px;
  1376. padding: 10px;
  1377. box-sizing: border-box;
  1378. .switch-for-min-box_t{
  1379. width: 100%;
  1380. display: flex;
  1381. justify-content: space-between;
  1382. .switch-for-min-title{
  1383. font-size:14px;
  1384. line-height:24px;
  1385. width: 84px;
  1386. color: #333333;
  1387. display:block;
  1388. overflow:hidden;
  1389. text-overflow:ellipsis;
  1390. white-space:nowrap;
  1391. }
  1392. .switch-null-p{
  1393. font-size:14px;
  1394. line-height:24px;
  1395. color:#999;
  1396. }
  1397. }
  1398. .switch-for-min-box_b{
  1399. margin-top: 10px;
  1400. .switch-null-ventilate{
  1401. width: 62px;
  1402. height: 18px;
  1403. border-radius: 10px 10px 10px 10px;
  1404. opacity: 1;
  1405. border: 1px solid #0183FA;
  1406. font-size: 12px;
  1407. font-weight: 400;
  1408. color: #0183FA;
  1409. line-height: 15px;
  1410. text-align: center;
  1411. float: left;
  1412. }
  1413. .switch{
  1414. float: right;
  1415. }
  1416. }
  1417. .switch-for-min-button{
  1418. width:70px;
  1419. height:30px;
  1420. line-height:30px;
  1421. font-size:14px;
  1422. color:#0045AF;
  1423. border-radius:6px;
  1424. border: 1px solid #0045AF;
  1425. margin-top:14px;
  1426. text-align: center;
  1427. cursor: pointer;
  1428. }
  1429. }
  1430. }
  1431. }
  1432. }
  1433. .bottom-video-box{
  1434. background: #fff;
  1435. width:424px;
  1436. border-radius: 0 10px 10px 10px;
  1437. flex: 1;
  1438. .top-title{
  1439. margin:16px 26px;
  1440. display: flex;
  1441. justify-content: space-between;
  1442. >i{
  1443. font-style: normal;
  1444. line-height:18px;
  1445. font-size:16px;
  1446. color: #333;
  1447. }
  1448. }
  1449. .null-text-p{
  1450. text-align: center;
  1451. font-size:16px;
  1452. color:#999;
  1453. line-height:50px;
  1454. margin:0 30px;
  1455. }
  1456. .video-for-max-box{
  1457. .switch-for-big-box{
  1458. width:374px;
  1459. height:262px;
  1460. margin:0 auto 14px;
  1461. position: relative;
  1462. .position-p{
  1463. width:42px;
  1464. height:42px;
  1465. text-align: center;
  1466. line-height:42px;
  1467. font-size:18px;
  1468. position: absolute;
  1469. top:0;
  1470. right:0;
  1471. color:#fff;
  1472. cursor: pointer;
  1473. }
  1474. }
  1475. }
  1476. }
  1477. .bottom-alarm-box{
  1478. flex:1;
  1479. display: flex;
  1480. flex-direction: column;
  1481. background: #fff;
  1482. width:424px;
  1483. overflow-x: hidden;
  1484. padding: 0 27px 0 23px;
  1485. box-sizing: border-box;
  1486. .top-title{
  1487. margin:16px 0px;
  1488. display: flex;
  1489. justify-content: space-between;
  1490. >i{
  1491. font-style: normal;
  1492. line-height:18px;
  1493. font-size:16px;
  1494. color: #333;
  1495. }
  1496. }
  1497. .alarm-max-box{
  1498. width:374px;
  1499. height:60px;
  1500. display: flex;
  1501. position:relative;
  1502. background: #f5f5f5;
  1503. border-radius: 10px 10px 10px 10px;
  1504. margin: 10px 0 0 0;
  1505. .alarm-img{
  1506. width:30px;
  1507. height:30px;
  1508. margin:14px;
  1509. }
  1510. .alarm-big-box{
  1511. p:nth-of-type(1){
  1512. position:absolute;
  1513. top:18px;
  1514. left:64px;
  1515. font-size: 14px;
  1516. font-weight: 400;
  1517. color: #333333;
  1518. }
  1519. .alarm-position-box{
  1520. position:absolute;
  1521. top:8px;
  1522. left:260px;
  1523. }
  1524. p:nth-of-type(2){
  1525. position:absolute;
  1526. top:0px;
  1527. right:0px;
  1528. width: 50px;
  1529. height: 20px;
  1530. font-size:12px;
  1531. font-weight:700;
  1532. line-height:20px;
  1533. border-radius: 0px 10px 0px 10px;
  1534. text-align: center;
  1535. }
  1536. .colorTypeA{
  1537. background: rgba(1,131,250,0.2);
  1538. color:#0183FA;
  1539. }
  1540. .colorTypeB{
  1541. background: #ECECEC;
  1542. color:#A2A2A2;
  1543. }
  1544. }
  1545. }
  1546. .BGcolorTypeA{
  1547. width:374px;
  1548. height:60px;
  1549. display: flex;
  1550. position:relative;
  1551. background: rgba(1,131,250,0.1);
  1552. border-radius: 10px 10px 10px 10px;
  1553. margin: 10px 0 0 0;
  1554. }
  1555. .BGcolorTypeB{
  1556. width:374px;
  1557. height:60px;
  1558. display: flex;
  1559. position:relative;
  1560. background: #F5F5F5;
  1561. border-radius: 10px 10px 10px 10px;
  1562. margin: 10px 0 0 0;
  1563. }
  1564. .alarm-title-box{
  1565. display: flex;
  1566. p{
  1567. line-height:60px;
  1568. font-size:14px;
  1569. }
  1570. p:nth-child(1){
  1571. flex:1;
  1572. }
  1573. p:nth-child(2){
  1574. cursor: pointer;
  1575. }
  1576. }
  1577. }
  1578. /*智能门禁*/
  1579. .bottom-entrance-box{
  1580. flex: 1;
  1581. background: #fff;
  1582. width:424px;
  1583. border-radius: 0 10px 10px 10px;
  1584. .top-title{
  1585. margin:16px 26px;
  1586. display: flex;
  1587. justify-content: space-between;
  1588. >i{
  1589. font-style: normal;
  1590. line-height:18px;
  1591. font-size:16px;
  1592. color: #333;
  1593. }
  1594. }
  1595. .entrance{
  1596. width: 374px;
  1597. height: 60px;
  1598. display: flex;
  1599. justify-content: flex-start;
  1600. border-radius: 10px 10px 10px 10px;
  1601. margin: 10px 0 0 26px;
  1602. position: relative;
  1603. .entrance_c{
  1604. width: 30px;
  1605. height: 30px;
  1606. margin: 14px 20px 0px 14px;
  1607. }
  1608. .entrance_r{
  1609. font-size: 14px;
  1610. font-family: Microsoft YaHei-Regular, Microsoft YaHei;
  1611. font-weight: 400;
  1612. color: #333333;
  1613. line-height: 60px;
  1614. }
  1615. .entrance_l_yes{
  1616. width: 60px;
  1617. height: 30px;
  1618. background: #0183FA;
  1619. border-radius: 0px 10px 0px 10px;
  1620. font-size: 14px;
  1621. font-weight: 400;
  1622. color: #fff;
  1623. line-height: 30px;
  1624. text-align: center;
  1625. position: absolute;
  1626. top: 0;
  1627. right: 0;
  1628. }
  1629. .entrance_l_no{
  1630. width: 60px;
  1631. height: 30px;
  1632. background: #A2A2A2;
  1633. border-radius: 0px 10px 0px 10px;
  1634. font-size: 14px;
  1635. font-weight: 400;
  1636. color: #fff;
  1637. line-height: 30px;
  1638. text-align: center;
  1639. position: absolute;
  1640. top: 0;
  1641. right: 0;
  1642. }
  1643. }
  1644. .BGentrance_l_yes{
  1645. background: rgba(1,131,250,0.1);
  1646. }
  1647. .BGentrance_l_no{
  1648. background: #F5F5F5;
  1649. }
  1650. }
  1651. .null-data-img{
  1652. width:137px;
  1653. height:137px;
  1654. display: block;
  1655. margin:10px auto;
  1656. }
  1657. .null-text-p{
  1658. text-align: center;
  1659. font-size:16px;
  1660. color:#999;
  1661. line-height:50px;
  1662. margin:0 30px;
  1663. }
  1664. }
  1665. }
  1666. }
  1667. }
  1668. </style>
  1669. <style lang="scss">
  1670. .alarm-position-box{
  1671. .switch .el-switch__label {
  1672. position: absolute;
  1673. display: none;
  1674. color: #fff !important;
  1675. }
  1676. .switch .el-switch__label--right {
  1677. z-index: 1;
  1678. }
  1679. .switch .el-switch__label--right span{
  1680. margin-right: 9px;
  1681. }
  1682. .switch .el-switch__label--left {
  1683. z-index: 1;
  1684. }
  1685. .switch .el-switch__label--left span{
  1686. margin-left: 9px;
  1687. }
  1688. .switch .el-switch__label.is-active {
  1689. display: block;
  1690. }
  1691. .switch.el-switch .el-switch__core{
  1692. background-color: rgba(255,196,124)!important;
  1693. border-color: rgba(255,196,124)!important;
  1694. }
  1695. .switch.el-switch .el-switch__core,
  1696. .el-switch .el-switch__label {
  1697. width: 68px !important;
  1698. height:20px!important;
  1699. line-height:30px!important;
  1700. -webkit-border-radius: 20px!important;
  1701. -moz-border-radius: 20px!important;
  1702. border-radius: 20px!important;
  1703. margin: 0;
  1704. position: absolute;
  1705. top: 0;
  1706. }
  1707. .switch .el-switch__label--left span{
  1708. margin-left:22px!important;
  1709. font-size: 12px;
  1710. color: #fff;
  1711. line-height: 20px;
  1712. position: relative;
  1713. top: -5px;
  1714. }
  1715. .switch .el-switch__label--right span{
  1716. margin-left:5px!important;
  1717. font-size: 12px;
  1718. position: relative;
  1719. top: -5px;
  1720. }
  1721. .el-switch__core:after{
  1722. background: #FA8A01 !important;
  1723. height:16px!important;
  1724. width:16px!important;
  1725. top:1px!important;
  1726. }
  1727. .el-switch.is-checked .el-switch__core::after{
  1728. margin-left: -20px!important;
  1729. }
  1730. .el-switch{
  1731. margin:10px auto 0;
  1732. display: block;
  1733. width:80px!important;
  1734. height:4px!important;
  1735. }
  1736. }
  1737. .subject-alarm-time{
  1738. .el-table__empty-text{
  1739. background-size: 45%;
  1740. }
  1741. }
  1742. </style>