index.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="10">
  4. <el-col :span="4">
  5. <div style="background-color: #fff;border-radius: 10px;padding: 20px 20px;height: 95vh;">
  6. <p style="margin: 0;border-left: 6px solid #03BF8A;margin-left: -20px;padding-left: 10px;font-weight: 800;">盒子管理</p>
  7. <div class=" infinite-list" style="overflow:auto;height: 93vh" >
  8. <div class="head-container">
  9. <el-input
  10. v-model="equipmentName"
  11. placeholder="请输入设备名称"
  12. clearable
  13. size="small"
  14. @blur="nsdfse"
  15. prefix-icon="el-icon-search"
  16. style="margin-bottom: 20px"
  17. />
  18. </div>
  19. <div class="head-container">
  20. <el-tree
  21. :data="deptOptions"
  22. :props="defaultProps"
  23. :expand-on-click-node="false"
  24. :filter-node-method="filterNode"
  25. ref="tree"
  26. default-expand-all
  27. highlight-current
  28. @node-click="ishg"
  29. />
  30. </div>
  31. </div>
  32. <!-- <div :class="ishge == index ? 'anche' : ''" style=" height: 36px;;line-height: 36px;margin-top: 10px;padding: 0 10px;"v-for="(item,index) in channelNumberList" :key="index">
  33. <div @click="ishg(item,index)" style="display: flex;align-items: center;justify-content: space-between;">
  34. <el-tooltip class="item" effect="dark" :content="item.channelNum == null?'暂无数据' : item.channelNum" placement="top-start">
  35. <div style="font-size: 16px;
  36. color: #333333; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"> {{item.channelNum == null?'暂无数据' : item.channelNum}}</div>
  37. </el-tooltip>
  38. <img src="../../../assets/images/icon_htgl_zd.png" alt="" style="width: 10px;height: 12px;">
  39. </div>
  40. </div> -->
  41. </div>
  42. </el-col>
  43. <el-col :span="20">
  44. <div style="">
  45. <div style="background-color: #fff;padding: 20px;border-radius: 10px; padding-bottom: 0;">
  46. <p style="margin: 0; font-weight: 800;font-size: 16px;color: #343434;display: flex;align-items: center;margin-bottom: 20px;border-left: 6px solid #03BF8A;margin-left: -20px;">
  47. <!-- <img src="../../../assets/images/icon_htgl_btzs.png" alt="" style="width: 16px;height: 20px;"> -->
  48. <span style="margin-left: 10px;">搜索条件</span>
  49. </p>
  50. <div style="padding-bottom: 0;margin-bottom: 20px;">
  51. <el-form class="qucheu" :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
  52. <el-row>
  53. <el-col :span="6">
  54. <el-form-item label="告警类别" prop="algorithmType">
  55. <el-select style="width: 120px;" v-model="queryParams.algorithmType" placeholder="请选择告警类别" clearable>
  56. <el-option
  57. v-for="dict in dict.type.gaojing_typeshuju"
  58. :key="dict.value"
  59. :label="dict.label"
  60. :value="dict.value"
  61. />
  62. </el-select>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="6">
  66. <el-form-item label="告警时间" prop="warnTime">
  67. <el-date-picker style="width: 120px;" clearable
  68. v-model="queryParams.warnTime"
  69. type="date"
  70. value-format="yyyy-MM-dd"
  71. placeholder="请选择告警时间">
  72. </el-date-picker>
  73. </el-form-item>
  74. </el-col>
  75. <el-col :span="5">
  76. <el-form-item class="butt" style="border: 0;">
  77. <el-button style="background-color: #03BF8A; border-color: #03BF8A;" type="primary" size="mini" @click="handleQuery">查询 </el-button>
  78. <el-button size="mini" @click="resetQuery">重置</el-button>
  79. </el-form-item>
  80. </el-col>
  81. </el-row>
  82. </el-form>
  83. </div>
  84. </div>
  85. <div class="casr">
  86. <el-row :gutter="10" class="mb8">
  87. <el-col :span="1.5">
  88. <el-button
  89. type="success"
  90. plain
  91. size="mini"
  92. @click="handleAdd"
  93. v-hasPermi="['manage:warnManage:add']"
  94. >添加</el-button>
  95. </el-col>
  96. <!-- <el-col :span="1.5">
  97. <el-button
  98. type="success"
  99. plain
  100. size="mini"
  101. :disabled="singleg"
  102. @click="handleUpdateg"
  103. v-hasPermi="['manage:warnManage:edits']"
  104. >修改</el-button>
  105. </el-col> -->
  106. <el-col :span="1.5">
  107. <el-button
  108. type="danger"
  109. plain
  110. size="mini"
  111. @click="handleDeleteg"
  112. v-hasPermi="['manage:warnManage:remove']"
  113. >删除</el-button>
  114. </el-col>
  115. <el-col :span="1.5">
  116. <el-button
  117. type="warning"
  118. plain
  119. size="mini"
  120. @click="handleExport"
  121. v-hasPermi="['manage:warnManage:export']"
  122. >导出</el-button>
  123. </el-col>
  124. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  125. </el-row>
  126. <div class=" infinite-list" :style="dynamicStyle">
  127. <el-row :gutter="10" v-if="warnManageList.length !=0" style="width: 100%;margin-left: 0;">
  128. <el-col :span="6" v-for="(item,index) in warnManageList" :key="index" style="cursor: pointer;">
  129. <div v-if="isshoe" @click="isac(item)" :class=" item.isnum ==true ? 'ingwe' :'' " style="box-sizing: border-box; position: relative; background-color: #fff;box-shadow: 0px 0px 10px 0px #CDCDCD;border-radius: 10px;margin-bottom: 10px;padding-bottom: 10px;">
  130. <div class="quning">
  131. <div class="shipige">
  132. <div style="display: flex;align-items: center;">
  133. <img src="../../../assets/images/icon_gjgl_gx_normal.png" alt="" v-if="item.isnum == false">
  134. <img src="../../../assets/images/icon_gjgl_gx_selected.png" alt="" v-if="item.isnum == true">
  135. <p v-if="item.algorithmType == 0 || item.algorithmType == 1" style="font-size: 14px;color: #333;font-weight: 700; margin-left: 5px;">{{ item.rangName + (item.algorithmType == 0 ? '离岗' : '玩手机') + '告警'}}</p>
  136. <p v-if="item.algorithmType == 2" style="font-size: 14px;color: #333;font-weight: 700; margin-left: 5px;">{{ item.equipmentName + (item.algorithmType == 0 ? '离岗' : item.algorithmType == 1?'玩手机' : '人员聚集') + '告警'}}</p>
  137. </div>
  138. <!-- <p style="font-size: 14px; color: #aaa;font-weight: 500;" @click="tiahzo(item)">详情→</p> -->
  139. </div>
  140. <!-- <img :src="item.warnImage" alt="" style="width: 100%; height: 150px;"> -->
  141. <image-preview v-if="item.warnImage != null && item.warnImage != ''" :src="item.warnImage" :width="100 +'%'" :height="150" style=""/>
  142. <video
  143. :id="'myVideo' + (index+1)"
  144. data-setup="{}"
  145. loop="loop"
  146. :autoplay="false"
  147. muted
  148. controls
  149. @play="videoPlay(item)"
  150. poster=""
  151. style="width: 100%;height: 150px;"
  152. v-if=" item.videoAddress != null && item.videoAddress != ''"
  153. >
  154. <!-- + baseUrl -->
  155. <source :src="item.videoAddress " />
  156. </video>
  157. <!-- <h265-player url="http://192.168.9.240:5010/prod-api/profile/videoRecored/recording_20250627_092541_357_离岗.mp4" @error="handleError"></h265-player> -->
  158. </div>
  159. <div class="goe">
  160. <div style="display: flex;align-items: center;margin-top: 8px;">
  161. <p>设备名称:</p>
  162. <p>{{item.equipmentName == null?'暂无数据' : item.equipmentName}}</p>
  163. </div>
  164. <div style="display: flex;align-items: center;margin-top: 8px;">
  165. <p>算法参数:</p>
  166. <p>{{item.parameterSet == null?'暂无数据' : item.parameterSet}}</p>
  167. </div>
  168. <!-- <div style="display: flex;align-items: center;margin-top: 8px;">
  169. <p>视频通道:</p>
  170. <p>{{item.channelNum == null?'暂无数据' : item.channelNum}}</p>
  171. </div> -->
  172. <div style="display: flex;align-items: center;margin-top: 8px;">
  173. <p>告警日期:</p>
  174. <p>{{item.warnTime == null?'暂无数据' : item.warnTime}}</p>
  175. </div>
  176. <!-- <div style="display: flex;align-items: center;margin-top: 8px;">
  177. <p>上报地址:</p>
  178. <p>{{item.reportAddress == null?'暂无数据' : item.reportAddress}}</p>
  179. </div> -->
  180. <div style="display: flex;align-items: center;margin-top: 8px;">
  181. <p>上报状态:</p>
  182. <div><dict-tag :options="dict.type.shagnt" :value="item.reportStatus"/></div>
  183. </div>
  184. <!-- <div style="display: flex;align-items: center;margin-top: 8px;">
  185. <p>告警内容:</p>
  186. <div><dict-tag :options="dict.type.gaojing_typeshuju" :value="item.algorithmType"/></div>
  187. </div> -->
  188. </div>
  189. <!-- <img v-if="item.isnum == true" src="../../../assets/images/icon_htgl_kp_gx.png" alt="" style="width: 35px;height: 35px;position: absolute;bottom: 0;right: 0;"> -->
  190. </div>
  191. </el-col>
  192. </el-row>
  193. <div style="margin-top: 20px;display: flex;justify-content: center;align-items: center;" v-if="warnManageList.length ==0">
  194. <img src="../../../assets/images/zwshjbig.png" alt="" style="">
  195. </div>
  196. </div>
  197. </div>
  198. <paginations
  199. v-show="total>0"
  200. :total="total"
  201. :page.sync="queryParams.pageNum"
  202. :limit.sync="queryParams.pageSize"
  203. @pagination="getList"
  204. />
  205. </div>
  206. </el-col>
  207. </el-row>
  208. <!-- 添加或修改岗位对话框 -->
  209. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  210. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  211. <el-row>
  212. <el-col :span="12">
  213. <el-form-item label="告警类别" prop="warnType">
  214. <el-select style="width: 100%;" v-model="form.algorithmType" placeholder="请选择告警类别">
  215. <el-option
  216. v-for="dict in dict.type.gaojing_typeshuju"
  217. :key="dict.value"
  218. :label="dict.label"
  219. :value="dict.value"
  220. ></el-option>
  221. </el-select>
  222. </el-form-item>
  223. </el-col>
  224. <el-col :span="12" >
  225. <el-form-item label="告警标识" prop="warnSign">
  226. <el-input v-model="form.warnSign" placeholder="请输入告警标识" />
  227. </el-form-item>
  228. </el-col>
  229. <el-col :span="12" >
  230. <el-form-item label="通道Id" prop="channelId">
  231. <el-select style="width: 100%;" v-model="form.channelId" placeholder="请选择通道ID">
  232. <el-option
  233. v-for="dict in channelNumberList "
  234. :key="dict.channelId"
  235. :label="dict.channelNum"
  236. :value="dict.channelId"
  237. ></el-option>
  238. </el-select>
  239. </el-form-item>
  240. </el-col>
  241. <el-col :span="12" >
  242. <el-form-item label="视频地址" prop="videoAddress">
  243. <el-input v-model="form.videoAddress" placeholder="请输入视频地址" />
  244. </el-form-item>
  245. </el-col>
  246. <el-col :span="12" >
  247. <el-form-item label="上报地址" prop="reportAddress">
  248. <el-input v-model="form.reportAddress" placeholder="请输入上报地址" />
  249. </el-form-item>
  250. </el-col>
  251. <el-col :span="12" >
  252. <el-form-item label="上报状态" prop="reportStatus">
  253. <el-select style="width: 100%;" v-model="form.reportStatus" placeholder="请选择上报状态">
  254. <el-option
  255. v-for="dict in dict.type.shagnt"
  256. :key="dict.value"
  257. :label="dict.label"
  258. :value="dict.value"
  259. ></el-option>
  260. </el-select>
  261. </el-form-item>
  262. </el-col>
  263. <el-col :span="12">
  264. <el-form-item label="告警时间" prop="warnTime">
  265. <el-date-picker style="width: 100%;" clearable
  266. v-model="form.warnTime"
  267. type="date"
  268. value-format="yyyy-MM-dd"
  269. placeholder="请选择告警时间">
  270. </el-date-picker>
  271. </el-form-item>
  272. </el-col>
  273. <el-col :span="12">
  274. <el-form-item label="备注" prop="remark">
  275. <el-input v-model="form.remark" placeholder="请输入内容" />
  276. </el-form-item>
  277. </el-col>
  278. <el-col :span="24">
  279. <el-form-item label="告警预览图片" prop="warnImage">
  280. <image-upload v-model="form.warnImage"/>
  281. </el-form-item>
  282. </el-col>
  283. </el-row>
  284. </el-form>
  285. <div slot="footer" class="dialog-footer" v-if="isredw">
  286. <el-button type="primary" @click="submitForm">确 定</el-button>
  287. <el-button @click="cancel">取 消</el-button>
  288. </div>
  289. </el-dialog>
  290. </div>
  291. </template>
  292. <script>
  293. // import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice"
  294. import { listWarnManage, getWarnManage, delWarnManage, addWarnManage, updateWarnManage } from "@/api/manage/warnManage"
  295. // import 'videojs-flash'
  296. import { listChannelNumber, getChannelNumber, delChannelNumber, addChannelNumber, updateChannelNumber } from "@/api/system/channelNumber"
  297. const defaultSettings = require("@/settings.js");
  298. import { listEquipmentManageNoPage, } from "@/api/manage/equipmentManage"
  299. import videojs from 'video.js';
  300. import 'video.js/dist/video-js.css';
  301. import H265Player from 'vue-h265-player';
  302. import 'videojs-flash'
  303. import mqttHandle from "../../../utils/mqttHandler.js"
  304. import mqtt from 'mqtt';
  305. // import flvjs from 'flv.js/dist/flv.min.js'
  306. import flvjs from "flv.js";
  307. import { MqttClient } from 'mqtt'
  308. // 状态变量
  309. const client = mqtt.connect('ws://13.229.167.76:1884/mqtt')
  310. export default {
  311. name: "WarnManage",
  312. components: {
  313. H265Player
  314. },
  315. dicts: ['gaojing_typeshuju', 'source_type','alarm_task','shagnt'],
  316. data() {
  317. return {
  318. mqttThemeName:{
  319. url: 'ws://13.229.167.76:1884/mqtt',
  320. topic: 'test/topic'
  321. },
  322. defaultProps: {
  323. children: "children",
  324. label: "equipmentName",
  325. value:'equipmentId'
  326. },
  327. // 遮罩层
  328. loading: true,
  329. defaultSettings:defaultSettings,
  330. baseUrl: process.env.VUE_APP_BASE_API,
  331. // 部门树选项
  332. deptOptions: undefined,
  333. // 选中数组
  334. ids: [],
  335. // 非单个禁用
  336. single: true,
  337. // 非多个禁用
  338. multiple: true,
  339. // 显示搜索条件
  340. showSearch: true,
  341. // 总条数
  342. total: 0,
  343. // 告警管理表格数据
  344. warnManageList: [],
  345. channelNumberList:[],
  346. // 弹出层标题
  347. title: "",
  348. // 是否显示弹出层
  349. open: false,
  350. // 查询参数
  351. queryParams: {
  352. pageNum: 1,
  353. pageSize: 10,
  354. warnType: null,
  355. warnSign: null,
  356. channelId: null,
  357. videoAddress: null,
  358. reportAddress: null,
  359. reportStatus: null,
  360. warnTime: null,
  361. warnImage: null,
  362. algorithmType:null,
  363. params:{
  364. month:null
  365. }
  366. },
  367. // 表单参数
  368. form: {},
  369. // 表单校验
  370. rules: {
  371. videoAddress: [
  372. { required: true, message: "不能为空", trigger: "blur" }
  373. ],
  374. warnTime: [
  375. { required: true, message: "不能为空", trigger: "blur" }
  376. ],
  377. warnImage: [
  378. { required: true, message: "不能为空", trigger: "blur" }
  379. ],
  380. },
  381. activeName:'1',
  382. videoState: false, // 视频播放状态
  383. poster:true,
  384. controls:true,
  385. videoData:{},
  386. player: null,
  387. isshoe:true,
  388. isredw:true,
  389. singleg:true,
  390. manid:0,
  391. getreadList:[],
  392. startTime: 0,
  393. yutim:true,
  394. equipmentName:null,
  395. staffTrainTimeList:[],
  396. tableMaxHeight:'200',
  397. receiveNews: "",
  398. videoShow: false,
  399. flvPlayer:null,
  400. player: null,
  401. player: null,
  402. options: {
  403. // 视频源
  404. sources: [{
  405. src: '../../../assets/images/recording_20250626_210102_169_离岗.png',
  406. type: 'video/mp4'
  407. }],
  408. // 其他配置选项...
  409. }
  410. };
  411. },
  412. computed: {
  413. dynamicStyle() {
  414. return {
  415. overflowY:'auto',
  416. height: this.tableMaxHeight+ 'px',
  417. paddingTop:'10px'
  418. }
  419. }
  420. },
  421. created() {
  422. this.startTime = Date.now()
  423. if(this.$route.query.type != undefined){
  424. if(this.$route.query.type == 'zs'){
  425. this.queryParams.params.month = this.gettimeyer()
  426. }else {
  427. this.queryParams.algorithmType = this.$route.query.type
  428. }
  429. }else{
  430. this.queryParams.params.month = null
  431. this.queryParams.algorithmType = null
  432. }
  433. if(this.$route.query.deptId != undefined){
  434. this.queryParams.params.month = this.gettimeyer()
  435. this.queryParams.deptId = this.$route.query.deptId
  436. }else{
  437. this.queryParams.params.month = null
  438. this.queryParams.deptId = null
  439. }
  440. if(this.$route.query.rangName != undefined){
  441. this.queryParams.warnTime = this.gettime()
  442. this.queryParams.rangName = this.$route.query.rangName
  443. this.queryParams.algorithmType = this.$route.query.type
  444. }else{
  445. this.queryParams.warnTime = null
  446. this.queryParams.rangName = null
  447. }
  448. if(this.$route.query.year != undefined){
  449. this.queryParams.params.year = this.$route.query.year
  450. }else{
  451. this.queryParams.params.year = null
  452. }
  453. this.getList();
  454. this.getListt()
  455. this.getTreeselect()
  456. window.onresize = () => {
  457. this.changeTableMaxHeight()
  458. }
  459. this.changeTableMaxHeight()
  460. },
  461. mounted() {
  462. // this.init('../../../assets/images/recording_20250626_210102_169_离岗.mp4')
  463. // this.createMqtt() // 建立mqtt通信
  464. // this.fullScreen()
  465. window.onresize = () => {
  466. this.changeTableMaxHeight()
  467. }
  468. this.changeTableMaxHeight()
  469. // this.player = videojs(this.$refs.videoPlayer, this.options, () => {
  470. // console.log('player is ready');
  471. // });
  472. },
  473. beforeDestroy() {
  474. if (this.player) {
  475. this.player.dispose()
  476. }
  477. if (client) {
  478. console.log(4)
  479. client.end()
  480. }
  481. // this.disconnect()
  482. },
  483. methods: {
  484. handleError(error) {
  485. console.error('Video error:', error);
  486. },
  487. gettimeyer(){
  488. let nowDate = new Date()
  489. let date = {
  490. year: nowDate.getFullYear(),
  491. month: nowDate.getMonth() + 1,
  492. date: nowDate.getDate()
  493. }
  494. if (parseInt(date.month) < 10) {
  495. date.month = '0' + date.month
  496. }
  497. if (parseInt(date.date) < 10) {
  498. date.date = '0' + date.date
  499. }
  500. let nghe = date.year + '-' + date.month
  501. return nghe
  502. },
  503. minToHm(min) {
  504. let h = Math.floor(min / 60);
  505. let m = min % 60;
  506. let hDisplay = h ? `${h}小时` : '';
  507. let mDisplay = m ? `${m}分钟` : '';
  508. console.log(`${hDisplay}${mDisplay}`.trim())
  509. return `${hDisplay}${mDisplay}`.trim();
  510. },
  511. /** 查询岗位列表 */
  512. getList() {
  513. this.loading = true;
  514. this.isshoe = false
  515. listWarnManage(this.queryParams).then(response => {
  516. this.warnManageList = response.rows;
  517. this.warnManageList.filter(rou=>{
  518. rou.isnum = false
  519. })
  520. this.isshoe = true
  521. // this.getge(this.warnManageList)
  522. this.total = response.total;
  523. this.loading = false;
  524. });
  525. },
  526. // 筛选节点
  527. filterNode(value, data) {
  528. if (!value) return true;
  529. return data.label.indexOf(value) !== -1;
  530. },
  531. nsdfse(){
  532. this.getTreeselect()
  533. },
  534. /** 查询部门下拉树结构 */
  535. getTreeselect() {
  536. // this.queryParams
  537. let sngse={'equipmentName':this.equipmentName}
  538. console.log(sngse)
  539. listEquipmentManageNoPage(sngse).then(response => {
  540. this.deptOptions = response.rows
  541. this.deptOptions.filter(rou=>{
  542. rou.children.filter(rout=>{
  543. rout.equipmentName = rout.channelNum
  544. rout.equipmentId = rout.channelId
  545. })
  546. })
  547. this.loading = false
  548. })
  549. },
  550. // 节点单击事件
  551. handleNodeClick(data) {
  552. // this.queryParams.deptId = data.deptId;
  553. // this.ghwe.deptName = data.deptName
  554. // this.ghwe.deptId = data.deptId
  555. // this.handleQuery();
  556. },
  557. // 通道点击
  558. ishg(item,val){
  559. console.log(item,val)
  560. if(item.channelId != undefined){
  561. this.queryParams.channelId = item.channelId
  562. this.getList()
  563. }
  564. },
  565. isac(val){
  566. console.log(5,val)
  567. val.isnum = !val.isnum
  568. this.isshoe = false
  569. this.isshoe = true
  570. let nhde = []
  571. let nsg = ''
  572. this.warnManageList.filter(rou=>{
  573. if(rou.isnum == true){
  574. nhde.push(rou.manualId)
  575. }
  576. })
  577. if(nhde.length == 1){
  578. this.warnManageList.filter(rou=>{
  579. if(rou.isnum == true){
  580. console.log(rou.manualId)
  581. this.manid = rou.manualId
  582. console.log(this.manid)
  583. }
  584. })
  585. this.singleg = false
  586. }else{
  587. // this.manid = row.
  588. this.singleg = true
  589. }
  590. },
  591. init(val) { //这个val 就是一个地址,例如: http://192.168.2.201:85/live/9311272c49b845baa2b2810ad9bf3f68.flv 这是个服务器返回给我的一个监控视频流地址
  592. setTimeout(() => { //使用定时器是因为,在mounted声明周期里调用,可能会出现DOM没加载出来的原因
  593. var videoElement = this.$refs.videosmallone; // 获取到html中的video标签
  594. this.isshiwa = true
  595. if (flvjs.isSupported()) {
  596. //因为我这个是复用组件,进来先判断 player是否存在,如果存在,销毁掉它,不然会占用TCP名额
  597. if (this.player !== null) {
  598. this.player.pause();
  599. this.player.unload();
  600. this.player.detachMediaElement();
  601. this.player.destroy();
  602. this.player = null;
  603. }
  604. this.player = flvjs.createPlayer( //创建直播流,加载到DOM中去
  605. {
  606. type: "mp4",
  607. url: val, //你的url地址
  608. isLive: true, //数据源是否为直播流
  609. hasAudio: false, //数据源是否包含有音频
  610. hasVideo: true, //数据源是否包含有视频
  611. enableStashBuffer: true, //是否启用缓存区
  612. },
  613. {
  614. enableWorker: false, //不启用分离线程
  615. enableStashBuffer: false, //关闭IO隐藏缓冲区
  616. autoCleanupSourceBuffer: true, //自动清除缓存
  617. lazyLoad: false,
  618. }
  619. );
  620. this.isshoe = true
  621. this.player.attachMediaElement(videoElement); //放到dom中去
  622. //!!!!!!这里需要注意,有的时候load加载完成不一定可以播放,要是播放不成功,用settimeout 给下面的this.player.play() 延时几百毫秒再播放
  623. // setTimeout(this.player.play(), 48000);
  624. setTimeout(() =>{
  625. //到时间时只执行一次就停止
  626. this.player.load();//准备完成
  627. this.player.play()
  628. console.log('播放')
  629. },900)
  630. }
  631. }, 500);
  632. },
  633. /** 查询通道管理列表 */
  634. getListt() {
  635. this.loading = true
  636. let snge={
  637. pageNum: 1,
  638. pageSize: 200,
  639. }
  640. listChannelNumber(snge).then(response => {
  641. this.channelNumberList = response.rows
  642. this.loading = false
  643. })
  644. },
  645. getge(valy){
  646.   this.$nextTick(() => {
  647.        setTimeout(() => {
  648. for(var i =0; i < valy.length;i++){
  649. let du = document.getElementById("myVideo" + (i+1)) //获取组件下的video
  650.        var hour = parseInt((du.duration) / 3600);
  651.        var minute = parseInt((du.duration % 3600) / 60);
  652.        var second = parseInt(du.duration % 60);
  653.        let result = ''
  654.        if (hour > 0) {
  655.        result = this.formatTimeStr(hour) + ':' + this.formatTimeStr(minute) + ':' + this
  656.        .formatTimeStr(second)
  657.                  } else {
  658.                     result = this.formatTimeStr(minute) + ':' + 
  659.                   this.formatTimeStr(second)
  660.                   }
  661. this.isshoe = false
  662. valy[i].result = result
  663. this.isshoe = true
  664. console.log(valy[i],result,du)
  665. //                   return result //转化成分,秒
  666. }
  667.                 }, 1200)
  668.               })
  669. },
  670. formatTimeStr(val) {
  671.         if (val > 9) {
  672.           return val
  673.         } else {
  674.           return '0' + val
  675.         }
  676.       },
  677. // 取消按钮
  678. cancel() {
  679. this.open = false;
  680. this.reset();
  681. },
  682. // 获取当前时间
  683. gettime(){
  684. let nowDate = new Date()
  685. let date = {
  686. year: nowDate.getFullYear(),
  687. month: nowDate.getMonth() + 1,
  688. date: nowDate.getDate()
  689. }
  690. // console.log(parseInt(date.date),date.month,4)
  691. if (date.month < 10) {
  692. date.month = '0' + date.month
  693. }
  694. if (parseInt(date.date) < 10) {
  695. date.date = '0' + date.date
  696. }
  697. let nghe = date.year + '-' + date.month + '-' + date.date
  698. return nghe
  699. },
  700. // 表单重置
  701. reset() {
  702. this.form = {
  703. warnId: null,
  704. warnType: null,
  705. warnSign: null,
  706. channelId: null,
  707. videoAddress: null,
  708. reportAddress: null,
  709. reportStatus: null,
  710. warnTime: this.gettime(),
  711. warnImage: null,
  712. delFlag: null,
  713. createBy: null,
  714. createTime: null,
  715. updateBy: null,
  716. updateTime: null,
  717. remark: null
  718. }
  719. this.resetForm("form");
  720. },
  721. /** 搜索按钮操作 */
  722. handleQuery() {
  723. this.queryParams.pageNum = 1
  724. this.getList()
  725. },
  726. /** 重置按钮操作 */
  727. resetQuery() {
  728. this.queryParams.pageNum = 1
  729. this.queryParams.params.month = null
  730. this.queryParams.algorithmType = null
  731. this.queryParams.deptId = null
  732. this.queryParams.warnTime = null
  733. this.queryParams.rangName = null
  734. this.queryParams.params.year = null
  735. this.queryParams.channelId = undefined
  736. this.resetForm("queryForm")
  737. this.handleQuery()
  738. },
  739. // 多选框选中数据
  740. handleSelectionChange(selection) {
  741. this.ids = selection.map(item => item.warnId)
  742. this.single = selection.length!==1
  743. this.multiple = !selection.length
  744. },
  745. /** 新增按钮操作 */
  746. handleAdd() {
  747. this.reset()
  748. this.open = true
  749. this.title = "添加告警管理"
  750. },
  751. /** 修改按钮操作 */
  752. handleUpdate(row) {
  753. this.reset()
  754. const warnId = row.warnId || this.ids
  755. getWarnManage(warnId).then(response => {
  756. this.form = response.data
  757. this.open = true
  758. this.title = "修改告警管理"
  759. })
  760. },
  761. getImageSrc(val) {
  762. // 创建一个临时元素,将HTML内容插入其中
  763. const tempElement = document.createElement('div');
  764. tempElement.innerHTML = val;
  765. // 查找 <img> 标签并获取 src 属性值
  766. const imgElement = tempElement.querySelector('img');
  767. if (imgElement) {
  768. const srcValue = imgElement.getAttribute('src');
  769. // this.imagePath=srcValue
  770. console.log('Image src:', srcValue+"照片路径");
  771. } else {
  772. console.log('No <img> element found.');
  773. }
  774. },
  775. /** 提交按钮 */
  776. submitForm() {
  777. this.$refs["form"].validate(valid => {
  778. if (valid) {
  779. if (this.form.warnId != null) {
  780. updateWarnManage(this.form).then(response => {
  781. this.$modal.msgSuccess("修改成功")
  782. this.open = false
  783. this.getList()
  784. })
  785. } else {
  786. addWarnManage(this.form).then(response => {
  787. this.$modal.msgSuccess("新增成功")
  788. this.open = false
  789. this.getList()
  790. })
  791. }
  792. }
  793. })
  794. },
  795. handleDeleteg() {
  796. let nhde = []
  797. let nsg = ''
  798. this.warnManageList.filter(rou=>{
  799. if(rou.isnum == true){
  800. nhde.push(rou.warnId)
  801. }
  802. })
  803. console.log(nhde)
  804. nsg = nhde.join(',')
  805. // return
  806. delWarnManage(nsg).then(response => {
  807. this.$modal.msgSuccess("操作成功")
  808. this.getList()
  809. })
  810. // delManual(nsg)
  811. // this.$modal.confirm('是否确认删除数据项?').then(function() {
  812. // return delManual(nsg);
  813. // }).then(() => {
  814. // this.getList();
  815. // this.$modal.msgSuccess("删除成功");
  816. // }).catch(() => {});
  817. },
  818. /** 删除按钮操作 */
  819. handleDelete(row) {
  820. const warnIds = row.warnId || this.ids
  821. this.$modal.confirm('是否确认删除告警管理编号为"' + warnIds + '"的数据项?').then(function() {
  822. return delWarnManage(warnIds)
  823. }).then(() => {
  824. this.getList()
  825. this.$modal.msgSuccess("删除成功")
  826. }).catch(() => {})
  827. },
  828. /** 导出按钮操作 */
  829. handleExport() {
  830. this.download('manage/warnManage/export', {
  831. ...this.queryParams
  832. }, `warnManage_${new Date().getTime()}.xlsx`)
  833. },
  834. // 获取屏幕高度
  835. showFilterForm () {
  836. this.filterActive = !this.filterActive
  837. this.changeTableMaxHeight()
  838. },
  839. changeTableMaxHeight () {
  840. let height = document.body.offsetHeight // 网页可视区域高度
  841. // if (this.filterActive) {
  842. // this.tableMaxHeight = height - 320
  843. // } else {
  844. this.tableMaxHeight = height - 150
  845. // }
  846. console.log(height)
  847. },
  848. tiahzo(item){
  849. this.$router.push({
  850. path: '/shebe',
  851. query: {
  852. 'id':item.warnId,
  853. }
  854. })
  855. }
  856. }
  857. };
  858. </script>
  859. <style lang="scss">
  860. .ckilde{
  861. // color: #03BF8A;
  862. }
  863. .quning{
  864. .el-image{
  865. box-shadow:0;
  866. -webkit-box-shadow:0;
  867. }
  868. }
  869. .qucheu{
  870. .el-form-item--small.el-form-item{
  871. border: 1px solid #E6E6E6;
  872. }
  873. .el-input__inner{
  874. border:0;
  875. }
  876. }
  877. .nghsey{
  878. .el-dialog__body{
  879. padding: 0;
  880. background-color: #F2F3FD;
  881. }
  882. }
  883. .butt{
  884. .el-button--small{
  885. padding: 9px 23px !important;
  886. font-size: 14px;
  887. border: 0 !important;
  888. }
  889. }
  890. .casr{
  891. .el-tabs__item.is-active{
  892. color: #196CFF;
  893. }
  894. .el-tabs--card > .el-tabs__header .el-tabs__item{
  895. padding: 0 30px !important;
  896. }
  897. }
  898. .el-table .el-table__header-wrapper th{
  899. background-color:#F5F6F8;
  900. color:#343434;
  901. }
  902. .el-table{
  903. color:#343434;
  904. }
  905. </style>
  906. <style scoped lang="scss">
  907. .goe{
  908. padding: 0 15px;
  909. div{
  910. // margin-bottom: 12px;
  911. }
  912. p{
  913. margin: 0;
  914. font-weight: 500;
  915. font-size: 14px;
  916. color: #AAAAAA;
  917. // margin-top: 10px;
  918. // margin-bottom: 3px;
  919. // padding: 0 10px;
  920. overflow: hidden;
  921. text-overflow: ellipsis;
  922. display:-webkit-box; //作为弹性伸缩盒子模型显示。
  923. -webkit-box-orient:vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列
  924. -webkit-line-clamp:1; //显示的行
  925. width: 30%;
  926. }
  927. p:nth-child(2){
  928. // margin-bottom: 10px;
  929. margin-top: 0;
  930. font-weight: 400;
  931. width: 70%;
  932. font-size: 14px;
  933. color: #333333;
  934. display: flex;
  935. justify-content: space-between;
  936. align-items: center;
  937. overflow: hidden;
  938. text-overflow: ellipsis;
  939. display:-webkit-box; //作为弹性伸缩盒子模型显示。
  940. -webkit-box-orient:vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列
  941. -webkit-line-clamp:1; //显示的行
  942. // padding-bottom: 10px;
  943. }
  944. }
  945. .ingwe{
  946. border: 2px solid #03BF8A;
  947. height: 330px;
  948. }
  949. .shipige{
  950. padding: 15px;
  951. display: flex;
  952. justify-content: space-between;
  953. align-items: center;
  954. p{
  955. margin: 0;
  956. }
  957. }
  958. </style>