index.vue 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255
  1. <template>
  2. <div class="app-container">
  3. <!-- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="摄像头名称" prop="cname">
  5. <el-input
  6. v-model="queryParams.cname"
  7. placeholder="请输入摄像头名称"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="访问地址" prop="caddr">
  14. <el-input
  15. v-model="queryParams.caddr"
  16. placeholder="请输入访问地址"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="状态" prop="cstatus">
  23. <el-select v-model="queryParams.cstatus" placeholder="请选择状态" clearable size="small">
  24. <el-option label="请选择字典生成" value="" />
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item label="创建时间" prop="createtime">
  28. <el-date-picker clearable size="small"
  29. v-model="queryParams.createtime"
  30. type="date"
  31. value-format="yyyy-MM-dd"
  32. placeholder="选择创建时间">
  33. </el-date-picker>
  34. </el-form-item>
  35. <el-form-item label="单位id" prop="unitid">
  36. <el-input
  37. v-model="queryParams.unitid"
  38. placeholder="请输入单位id"
  39. clearable
  40. size="small"
  41. @keyup.enter.native="handleQuery"
  42. />
  43. </el-form-item>
  44. <el-form-item label="单位名称" prop="unitname">
  45. <el-input
  46. v-model="queryParams.unitname"
  47. placeholder="请输入单位名称"
  48. clearable
  49. size="small"
  50. @keyup.enter.native="handleQuery"
  51. />
  52. </el-form-item>
  53. <el-form-item label="存入菜单ID" prop="powerArea">
  54. <el-input
  55. v-model="queryParams.powerArea"
  56. placeholder="请输入存入菜单ID"
  57. clearable
  58. size="small"
  59. @keyup.enter.native="handleQuery"
  60. />
  61. </el-form-item>
  62. <el-form-item>
  63. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  64. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  65. </el-form-item>
  66. </el-form> -->
  67. <!-- <el-row :gutter="10" class="mb8">
  68. <el-col :span="1.5">
  69. <el-button
  70. type="primary"
  71. plain
  72. icon="el-icon-plus"
  73. size="mini"
  74. @click="handleAdd"
  75. v-hasPermi="['monitoring:camera:add']"
  76. >新增</el-button>
  77. </el-col>
  78. <el-col :span="1.5">
  79. <el-button
  80. type="success"
  81. plain
  82. icon="el-icon-edit"
  83. size="mini"
  84. :disabled="single"
  85. @click="handleUpdate"
  86. v-hasPermi="['monitoring:camera:edit']"
  87. >修改</el-button>
  88. </el-col>
  89. <el-col :span="1.5">
  90. <el-button
  91. type="danger"
  92. plain
  93. icon="el-icon-delete"
  94. size="mini"
  95. :disabled="multiple"
  96. @click="handleDelete"
  97. v-hasPermi="['monitoring:camera:remove']"
  98. >删除</el-button>
  99. </el-col>
  100. <el-col :span="1.5">
  101. <el-button
  102. type="warning"
  103. plain
  104. icon="el-icon-download"
  105. size="mini"
  106. :loading="exportLoading"
  107. @click="handleExport"
  108. v-hasPermi="['monitoring:camera:export']"
  109. >导出</el-button>
  110. </el-col>
  111. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  112. </el-row> -->
  113. <!--
  114. <el-table v-loading="loading" :data="cameraList" @selection-change="handleSelectionChange">
  115. <el-table-column type="selection" width="55" align="center" />
  116. <el-table-column label="存入菜单ID" align="center" prop="id" />
  117. <el-table-column label="摄像头名称" align="center" prop="cname" />
  118. <el-table-column label="访问地址" align="center" prop="caddr" />
  119. <el-table-column label="状态" align="center" prop="cstatus" />
  120. <el-table-column label="创建时间" align="center" prop="createtime" width="180">
  121. <template slot-scope="scope">
  122. <span>{{ parseTime(scope.row.createtime, '{y}-{m}-{d}') }}</span>
  123. </template>
  124. </el-table-column>
  125. <el-table-column label="单位id" align="center" prop="unitid" />
  126. <el-table-column label="单位名称" align="center" prop="unitname" />
  127. <el-table-column label="存入菜单ID" align="center" prop="powerArea" />
  128. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  129. <template slot-scope="scope">
  130. <el-button
  131. size="mini"
  132. type="text"
  133. icon="el-icon-edit"
  134. @click="handleUpdate(scope.row)"
  135. v-hasPermi="['monitoring:camera:edit']"
  136. >修改</el-button>
  137. <el-button
  138. size="mini"
  139. type="text"
  140. icon="el-icon-delete"
  141. @click="handleDelete(scope.row)"
  142. v-hasPermi="['monitoring:camera:remove']"
  143. >删除</el-button>
  144. </template>
  145. </el-table-column>
  146. </el-table> -->
  147. <!-- <pagination
  148. v-show="total>0"
  149. :total="total"
  150. :page.sync="queryParams.pageNum"
  151. :limit.sync="queryParams.pageSize"
  152. @pagination="getList"
  153. /> -->
  154. <!-- 添加或修改安防监控对话框 -->
  155. <el-dialog
  156. :title="title"
  157. :visible.sync="open"
  158. width="800px"
  159. append-to-body
  160. :close-on-click-modal="false"
  161. >
  162. <el-form
  163. ref="form"
  164. :model="form"
  165. :rules="rules"
  166. label-width="100px"
  167. :inline="true"
  168. >
  169. <el-form-item label="摄像头名称" prop="cname">
  170. <el-input v-model="form.cname" placeholder="请输入摄像头名称" />
  171. </el-form-item>
  172. <el-form-item label="访问地址" prop="caddr">
  173. <el-input v-model="form.caddr" placeholder="请输入访问地址" />
  174. </el-form-item>
  175. <!-- <el-form-item label="单位id" prop="unitid">
  176. <el-input v-model="form.unitid" placeholder="请输入单位id" />
  177. </el-form-item> -->
  178. <el-form-item label="单位名称" prop="unitname">
  179. <!-- <el-input v-model="form.unitname" placeholder="请输入单位名称" /> -->
  180. <treeselect
  181. v-model="form.unitid"
  182. :options="users"
  183. placeholder="请选择单位"
  184. class="threeselects"
  185. @select="selectPeo"
  186. />
  187. </el-form-item>
  188. <el-form-item label="状态" prop="cstatus">
  189. <!-- <el-radio-group v-model="form.cstatus">
  190. <el-radio label="1">请选择字典生成</el-radio>
  191. </el-radio-group> -->
  192. <el-switch
  193. v-model="form.cstatus"
  194. active-color="#13ce66"
  195. inactive-color="#ccc"
  196. active-value="1"
  197. inactive-value="0"
  198. >
  199. </el-switch>
  200. <span class="greed" v-if="form.cstatus == '1'"></span>
  201. <span class="CCC" v-if="form.cstatus == '0'"></span>
  202. </el-form-item>
  203. <!-- <el-form-item label="存入菜单ID" prop="powerArea">
  204. <el-input v-model="form.powerArea" placeholder="请输入存入菜单ID" />
  205. </el-form-item> -->
  206. </el-form>
  207. <div slot="footer" class="dialog-footer">
  208. <el-button type="primary" @click="submitForm">确 定</el-button>
  209. <el-button @click="cancel">取 消</el-button>
  210. </div>
  211. </el-dialog>
  212. <!-- 视频播放窗口 -->
  213. <el-row>
  214. <el-col :span="1.5">
  215. <el-button
  216. type="primary"
  217. plain
  218. icon="el-icon-plus"
  219. size="mini"
  220. @click="handleAdd"
  221. v-hasPermi="['monitoring:camera:add']"
  222. >新增</el-button
  223. >
  224. </el-col>
  225. <el-col :span="1.5" class="isSubmit">
  226. <!-- <el-radio-group v-model="queryParams.type" @change="caoZuoTypefun"> -->
  227. <button
  228. @click="one"
  229. id="onevideos"
  230. class="single"
  231. :class="this.btn == 0 ? 'bg' : ''"
  232. >
  233. 单屏
  234. </button>
  235. <!-- <button
  236. class="singles"
  237. :class="this.btn == 1 ? 'bg' : ''"
  238. >
  239. 四分屏
  240. </button> -->
  241. <!-- <el-radio-button label="2">九分屏</el-radio-button> -->
  242. <!-- <el-radio-button label="3" class="allFlv1">十六分屏</el-radio-button> -->
  243. <button
  244. @click="four"
  245. id="allvideos"
  246. class="allFlv"
  247. :class="this.btn == 1 ? 'bg' : ''"
  248. >
  249. 全通道FLV
  250. </button>
  251. <!-- <el-radio-button label="5" class="fullscreen">全屏</el-radio-button> -->
  252. <!-- </el-radio-group> -->
  253. </el-col>
  254. </el-row>
  255. <hr />
  256. <el-row :gutter="20">
  257. <el-col :span="4" :xs="24">
  258. <div class="dadui">
  259. <img
  260. style="padding-top: 3px; margin-left: 15px"
  261. src="../../../images/摄像头icon.png"
  262. alt
  263. />
  264. 摄像头
  265. </div>
  266. <div class="tree">
  267. <!-- <el-tree
  268. class="userAgrees"
  269. style="height: calc(100vh - 240px); overflow: auto"
  270. :data="rtsplist"
  271. :props="defaultProps"
  272. @node-click="clickhandleitem(item,index)"
  273. default-expand-all
  274. highlight-current
  275. :expand-on-click-node="false"
  276. ></el-tree> -->
  277. <!-- 左侧 -->
  278. <div class="videolist">
  279. <div class="userAgrees">
  280. <ul
  281. style="height: calc(100vh - 240px); overflow: auto"
  282. v-if="this.as == true"
  283. >
  284. <li
  285. style="margin-left: -40px; padding-left: 40px"
  286. v-for="(item, index) in cameraList"
  287. :key="item.id"
  288. @click="clickhandleitem(item, index)"
  289. >
  290. <i class="el-icon-video-camera-solid"></i>
  291. {{ item.cname }}
  292. </li>
  293. </ul>
  294. <!-- <div id="aa">
  295. {{cameraList.query}}
  296. </div> -->
  297. </div>
  298. </div>
  299. </div>
  300. </el-col>
  301. <!-- </el-row> -->
  302. <el-col :span="19" :xs="24">
  303. <!-- 单屏播放 -->
  304. <div style="position: relative" v-if="this.btn == 0">
  305. <div
  306. v-for="(i, index) in 1"
  307. :key="index"
  308. style="
  309. width: 100%;
  310. height: calc(100vh - 200px);
  311. margin-left: 5px;
  312. margin-bottom: 5px;
  313. position: relative;
  314. "
  315. >
  316. <!-- <button
  317. style="position: absolute; left: 5px; z-index: 999"
  318. class="choose"
  319. @click="chooselu"
  320. >
  321. 选择通道
  322. </button> -->
  323. <!-- :id="'videoElement' + i" -->
  324. <video
  325. autoplay
  326. controls
  327. style="
  328. width: 100%;
  329. height: 100%;
  330. margin-left: 5px;
  331. margin-bottom: 5px;
  332. position: relative;
  333. "
  334. id="singleplay"
  335. ></video>
  336. </div>
  337. </div>
  338. <!-- 四屏播放 -->
  339. <!-- <keep-alive> -->
  340. <div class="video1" v-if="this.btn == 1 && this.dan == false">
  341. <div
  342. v-for="(i, index) in this.fourvideo"
  343. :key="index"
  344. class="fourscreen"
  345. >
  346. <video
  347. autoplay
  348. controls
  349. style="
  350. width: 100%;
  351. height: 100%;
  352. margin-left: 5px;
  353. margin-bottom: 5px;
  354. position: relative;
  355. "
  356. :id="'singleplay' + index"
  357. ></video>
  358. </div>
  359. </div>
  360. <div class="video1" v-if="this.btn == 1 && this.dan == true">
  361. <div v-for="(i, index) in 1" :key="index" class="fullscreen">
  362. <video
  363. autoplay
  364. controls
  365. style="width: 100%; height: 100%; position: relative"
  366. :id="'singleplay' + index"
  367. ></video>
  368. </div>
  369. </div>
  370. </el-col>
  371. </el-row>
  372. </div>
  373. </template>
  374. <script>
  375. import Treeselect from "@riophae/vue-treeselect";
  376. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  377. import { getDept2 } from "@/api/grassrootsregistration/bdglmeeting";
  378. import flvjs from "flv.js";
  379. import {
  380. listCamera,
  381. getCamera,
  382. delCamera,
  383. addCamera,
  384. updateCamera,
  385. exportCamera,
  386. } from "@/api/monitoring/camera";
  387. export default {
  388. name: "Camera",
  389. components: {
  390. Treeselect,
  391. },
  392. data() {
  393. return {
  394. // 树形配置
  395. defaultProps: {
  396. children: "children",
  397. label: "rtsp",
  398. },
  399. // 遮罩层
  400. loading: true,
  401. // 导出遮罩层
  402. exportLoading: false,
  403. // 选中数组
  404. ids: [],
  405. // 非单个禁用
  406. single: true,
  407. // 非多个禁用
  408. multiple: true,
  409. // 显示搜索条件
  410. showSearch: true,
  411. // 总条数
  412. total: 0,
  413. // 安防监控表格数据
  414. cameraList: [],
  415. // 弹出层标题
  416. title: "",
  417. // 是否显示弹出层
  418. open: false,
  419. // 查询参数
  420. queryParams: {
  421. pageNum: 1,
  422. pageSize: 20,
  423. cname: null,
  424. caddr: null,
  425. cstatus: null,
  426. createtime: null,
  427. unitid: null,
  428. unitname: null,
  429. powerArea: null,
  430. },
  431. // 表单参数
  432. form: {},
  433. // 表单校验
  434. rules: {},
  435. rtsplist: [
  436. {
  437. rtsp: "http://192.168.5.187/hdl/live/stream0.flv",
  438. player: null,
  439. },
  440. {
  441. rtsp: "http://192.168.5.187/hdl/live/stream1.flv",
  442. player: null,
  443. },
  444. {
  445. rtsp: "http://192.168.5.187/hdl/live/stream0.flv",
  446. player: null,
  447. },
  448. {
  449. rtsp: "http://192.168.5.187/hdl/live/stream1.flv",
  450. player: null,
  451. },
  452. {
  453. rtsp: "http://192.168.5.187/hdl/live/stream0.flv",
  454. player: null,
  455. },
  456. {
  457. rtsp: "http://192.168.5.187/hdl/live/stream1.flv",
  458. player: null,
  459. },
  460. {
  461. rtsp: "http://192.168.5.187/hdl/live/stream1.flv",
  462. player: null,
  463. },
  464. {
  465. rtsp: "http://192.168.5.187/hdl/live/stream1.flv",
  466. player: null,
  467. },
  468. ],
  469. // 单视频
  470. flvPlayer1: null,
  471. flvPlayer: null,
  472. inputvalue: "",
  473. devicename: "60",
  474. url: "",
  475. list: [],
  476. count: 1, // 当前点击标识
  477. flvPlayerList: [],
  478. datalist: [],
  479. screen: 1,
  480. // 单个视频播放
  481. url1: "http://192.168.5.187/hdl/live/stream0.flv",
  482. // 获取单位
  483. users: [],
  484. flvPlayerList1: [],
  485. fourvideo: 4,
  486. videourl: [
  487. "http://192.168.5.187/hdl/live/stream0.flv",
  488. "http://192.168.5.187/hdl/live/stream1.flv",
  489. "http://192.168.5.187/hdl/live/stream0.flv",
  490. "http://192.168.5.187/hdl/live/stream1.flv",
  491. ],
  492. btn: 0,
  493. clickindex: "",
  494. sixvideo: 6,
  495. dan: false,
  496. as: true,
  497. belongLocal: "",
  498. ad: 0,
  499. };
  500. },
  501. mounted() {
  502. listCamera(this.queryParams).then((response) => {
  503. this.url1 = response.rows[0].caddr;
  504. });
  505. // 单个视频播放
  506. // this.singleplayvideo();
  507. this.oneVideo();
  508. // 点击
  509. this.$bus.$on("Click", (cameraList) => {
  510. listCamera({ belongLocal: cameraList.query }).then((response) => {
  511. this.cameraList = response.rows;
  512. this.ad = 1;
  513. this.getList(cameraList.query);
  514. });
  515. });
  516. },
  517. created() {
  518. this.queryParams.type = 0;
  519. // debugger
  520. this.aa();
  521. // 获取执行单位列表
  522. getDept2().then((res) => {
  523. this.users = res.data;
  524. });
  525. },
  526. methods: {
  527. // 调用List接口
  528. aa() {
  529. if (this.$route.path == "/monitoring/camera") {
  530. this.getList(1);
  531. } else {
  532. var index = this.$route.path.lastIndexOf("/");
  533. let str = this.$route.path.substring(
  534. index + 1,
  535. this.$route.path.length
  536. );
  537. console.log(str);
  538. // const a = this.$route.path.substring(this.$route.path.lastIndexOf("/"));
  539. this.getList(str);
  540. }
  541. },
  542. // 初始化视频
  543. singleplayvideo(name, url, num) {
  544. // console.log(name);
  545. if (flvjs.isSupported()) {
  546. // debugger;
  547. name = flvjs.createPlayer(
  548. {
  549. type: "flv",
  550. url: url, //你的url地址
  551. },
  552. {
  553. enableWorker: false, //不启用分离线程
  554. enableStashBuffer: false, //关闭IO隐藏缓冲区
  555. reuseRedirectedURL: true, //重用301/302重定向url,用于随后的请求,如查找、重新连接等。
  556. autoCleanupSourceBuffer: true, //自动清除缓存
  557. fixAudioTimestampGap: false,
  558. }
  559. );
  560. this.$nextTick(() => {
  561. // 可以使用回调函数的写法
  562. // 这个函数中DOM必定渲染完成
  563. let videoElement1 = document.getElementById("singleplay" + num);
  564. // debugger;
  565. name.attachMediaElement(videoElement1);
  566. // name.load();
  567. // name.play();
  568. if (url !== "" && url !== null) {
  569. name.load();
  570. name.play();
  571. }
  572. //定时方法是为了用户离开页面视频是实时播放的,暂停按钮无用
  573. setInterval(function () {
  574. if (videoElement1.buffered.length > 0) {
  575. const end = videoElement1.buffered.end(0); // 视频结尾时间
  576. const current = videoElement1.currentTime; // 视频当前时间
  577. const diff = end - current; // 相差时间
  578. // console.log(diff);
  579. const diffCritical = 4; // 这里设定了超过4秒以上就进行跳转
  580. const diffSpeedUp = 1; // 这里设置了超过1秒以上则进行视频加速播放
  581. const maxPlaybackRate = 4; // 自定义设置允许的最大播放速度
  582. let playbackRate = 1.0; // 播放速度
  583. if (diff > diffCritical) {
  584. // this.flvPlayer.load();
  585. // console.log("相差超过4秒,进行跳转");
  586. videoElement1.currentTime = end - 1.5;
  587. playbackRate = Math.max(1, Math.min(diffCritical, 16));
  588. } else if (diff > diffSpeedUp) {
  589. // console.log("相差超过1秒,进行加速");
  590. playbackRate = Math.max(1, Math.min(diff, maxPlaybackRate, 16));
  591. }
  592. videoElement1.playbackRate = playbackRate;
  593. if (videoElement1.paused) {
  594. setTimeout(() => {
  595. videoElement1.play();
  596. }, 10);
  597. }
  598. }
  599. }, 1000);
  600. name.on(flvjs.Events.ERROR, (errType, errDetail) => {
  601. // alert("网络波动,正在尝试连接中...");
  602. if (name) {
  603. this.reloadVideo(name);
  604. }
  605. });
  606. this.flvPlayerList1.push(name);
  607. });
  608. }
  609. // this.destoryVideo(this.flvPlayerList1[0])
  610. },
  611. // 单视屏
  612. oneVideo() {
  613. this.singleplayvideo("flvPlayer1", this.url1, "");
  614. },
  615. // 单分屏点击事件。
  616. clickhandleitem(data, index) {
  617. if (this.btn == 0) {
  618. for (var j of this.flvPlayerList1) {
  619. this.destoryVideo(this.flvPlayerList1[0]);
  620. this.flvPlayerList1.shift();
  621. }
  622. console.log(this.flvPlayerList1, 123456);
  623. this.url1 = this.cameraList[index].caddr;
  624. this.singleplayvideo("flvPlayer1", this.url1, "");
  625. } else if (this.btn == 1) {
  626. console.log(this.flvPlayerList1, 123456);
  627. for (var j of this.flvPlayerList1) {
  628. this.destoryVideo(this.flvPlayerList1[0]);
  629. this.flvPlayerList1.shift();
  630. }
  631. this.fourvideo = 1;
  632. this.clickindex = index;
  633. for (var i of this.flvPlayerList1) {
  634. this.destoryVideo(this.flvPlayerList1[0]);
  635. this.flvPlayerList1.shift();
  636. }
  637. // if (this.flvPlayerList1.length > 3) {
  638. // this.destoryVideo(this.flvPlayerList1[0]);
  639. // this.flvPlayerList1.shift();
  640. // }
  641. this.url1 = this.cameraList[index].caddr;
  642. this.dan = true;
  643. this.singleplayvideo("flvPlayer1", this.url1, 0);
  644. }
  645. },
  646. // 播放
  647. play(flvPlayer) {
  648. flvPlayer.play();
  649. },
  650. // 单分屏播放
  651. one() {
  652. this.btn = 0;
  653. $("#allvideos").removeAttr("disabled");
  654. $("#onevideos").attr({ disabled: "disabled" });
  655. for (var i of this.flvPlayerList1) {
  656. this.destoryVideo(this.flvPlayerList1[0]);
  657. this.flvPlayerList1.shift();
  658. }
  659. this.oneVideo();
  660. // console.log(this.flvPlayerList1)
  661. },
  662. // 四分屏播放
  663. four() {
  664. this.fourvideo = 4;
  665. this.btn = 1;
  666. this.dan = false;
  667. $("#allvideos").attr({ disabled: "disabled" });
  668. $("#onevideos").removeAttr("disabled");
  669. // console.log("######111######");
  670. for (var i of this.flvPlayerList1) {
  671. this.destoryVideo(this.flvPlayerList1[0]);
  672. this.flvPlayerList1.shift();
  673. }
  674. console.log(this.cameraList);
  675. if (this.cameraList.length < this.fourvideo) {
  676. for (var i = 0; i < this.cameraList.length; i++) {
  677. this.url1 = this.cameraList[i].caddr;
  678. // 报错原因是这个地址没有视频
  679. console.log(this.url1);
  680. this.singleplayvideo("flvPlayer" + i, this.url1, i);
  681. }
  682. } else {
  683. for (var i = 0; i < this.fourvideo; i++) {
  684. this.url1 = this.cameraList[i].caddr;
  685. // 报错原因是这个地址没有视频
  686. // console.log(this.url1);
  687. this.singleplayvideo("flvPlayer" + i, this.url1, i);
  688. }
  689. }
  690. },
  691. /** 查询安防监控列表 */
  692. getList(a) {
  693. // debugger
  694. this.loading = true;
  695. listCamera({ belongLocal: a }).then((response) => {
  696. this.cameraList = response.rows;
  697. this.url1 = this.cameraList[0].caddr;
  698. // console.log(this.url1);
  699. this.total = response.total;
  700. this.loading = false;
  701. // this.queryParams.type==""
  702. });
  703. },
  704. // 操作类型
  705. caoZuoTypefun() {
  706. this.getList();
  707. },
  708. reloadVideo(flvPlayer) {
  709. this.destoryVideo(flvPlayer);
  710. try {
  711. this.createVideo();
  712. } finally {
  713. this.algain();
  714. }
  715. },
  716. algain() {
  717. if (this.createVideo() !== error) {
  718. return;
  719. } else {
  720. try {
  721. this.createVideo();
  722. } catch (e) {
  723. console.log(e);
  724. }
  725. }
  726. },
  727. // 全通道
  728. // all() {
  729. // this.sixvideo = 6;
  730. // this.btn = 1;
  731. // this.dan=false
  732. // for (var i of this.flvPlayerList1) {
  733. // this.destoryVideo(this.flvPlayerList1[0]);
  734. // this.flvPlayerList1.shift();
  735. // }
  736. // console.log(this.flvPlayerList1);
  737. // for (var i = 0; i < this.sixvideo; i++) {
  738. // this.url1 = this.cameraList[i].caddr;
  739. // this.singleplayvideo("flvPlayer" + i, this.url1, i);
  740. // }
  741. // },
  742. // reloadVideo(flvPlayer) {
  743. // this.destoryVideo(flvPlayer);
  744. // this.createVideo();
  745. // // this.singleplayvideo();
  746. // },
  747. destoryVideo(flvPlayer) {
  748. flvPlayer.pause();
  749. flvPlayer.unload();
  750. flvPlayer.detachMediaElement();
  751. flvPlayer.destroy();
  752. flvPlayer = null;
  753. },
  754. // 取消按钮
  755. cancel() {
  756. this.open = false;
  757. this.reset();
  758. },
  759. // 表单重置
  760. reset() {
  761. this.form = {
  762. id: null,
  763. cname: null,
  764. caddr: null,
  765. cstatus: "0",
  766. createtime: null,
  767. unitid: null,
  768. unitname: null,
  769. powerArea: null,
  770. };
  771. this.resetForm("form");
  772. },
  773. /** 搜索按钮操作 */
  774. handleQuery() {
  775. this.queryParams.pageNum = 1;
  776. this.getList();
  777. },
  778. /** 重置按钮操作 */
  779. resetQuery() {
  780. this.resetForm("queryForm");
  781. this.handleQuery();
  782. },
  783. // 多选框选中数据
  784. handleSelectionChange(selection) {
  785. this.ids = selection.map((item) => item.id);
  786. this.single = selection.length !== 1;
  787. this.multiple = !selection.length;
  788. },
  789. selectPeo(item) {
  790. this.form.unitname = item.label;
  791. },
  792. /** 新增按钮操作 */
  793. handleAdd() {
  794. this.reset();
  795. this.open = true;
  796. this.title = "添加安防监控";
  797. },
  798. /** 修改按钮操作 */
  799. handleUpdate(row) {
  800. this.reset();
  801. const id = row.id || this.ids;
  802. getCamera(id).then((response) => {
  803. this.form = response.data;
  804. this.open = true;
  805. this.title = "修改安防监控";
  806. });
  807. },
  808. /** 提交按钮 */
  809. submitForm() {
  810. this.$refs["form"].validate((valid) => {
  811. if (valid) {
  812. if (this.form.id != null) {
  813. updateCamera(this.form).then((response) => {
  814. this.$modal.msgSuccess("修改成功");
  815. this.open = false;
  816. this.aa();
  817. });
  818. } else {
  819. addCamera(this.form).then((response) => {
  820. this.$modal.msgSuccess("新增成功");
  821. this.open = false;
  822. this.aa();
  823. });
  824. }
  825. }
  826. });
  827. },
  828. /** 删除按钮操作 */
  829. handleDelete(row) {
  830. const ids = row.id || this.ids;
  831. this.$modal
  832. .confirm('是否确认删除安防监控编号为"' + ids + '"的数据项?')
  833. .then(function () {
  834. return delCamera(ids);
  835. })
  836. .then(() => {
  837. this.getList();
  838. this.$modal.msgSuccess("删除成功");
  839. })
  840. .catch(() => {});
  841. },
  842. /** 导出按钮操作 */
  843. handleExport() {
  844. const queryParams = this.queryParams;
  845. this.$modal
  846. .confirm("是否确认导出所有安防监控数据项?")
  847. .then(() => {
  848. this.exportLoading = true;
  849. return exportCamera(queryParams);
  850. })
  851. .then((response) => {
  852. this.$download.name(response.msg);
  853. this.exportLoading = false;
  854. })
  855. .catch(() => {});
  856. },
  857. },
  858. };
  859. </script>
  860. <style scoped>
  861. .bg {
  862. background: #1d96ff;
  863. color: white;
  864. }
  865. .greed {
  866. position: absolute;
  867. top: 26px;
  868. right: -10px;
  869. color: #13ce66;
  870. }
  871. .CCC {
  872. position: absolute;
  873. top: 26px;
  874. right: 118px;
  875. color: #cccccc;
  876. }
  877. .isSubmit {
  878. margin-left: 37% !important;
  879. margin-right: 20%;
  880. margin-bottom: 5px;
  881. padding-bottom: 5px;
  882. }
  883. /* 按钮样式 */
  884. ::v-deep .el-radio-button:first-child .el-radio-button__inner {
  885. width: 82px;
  886. height: 36px;
  887. background: #196299;
  888. border-radius: 8px 0px 0px 8px;
  889. color: white;
  890. border: none;
  891. margin-right: 2px;
  892. font-size: 14px;
  893. font-family: Source Han Sans CN;
  894. font-weight: 400;
  895. color: #ffffff;
  896. }
  897. ::v-deep .el-radio-button__orig-radio:checked + .el-radio-button__inner {
  898. background: #006cff;
  899. }
  900. ::v-deep .el-radio-button--medium .el-radio-button__inner {
  901. width: 82px;
  902. height: 36px;
  903. background: #196299;
  904. /* border-radius: 8px 0px 0px 8px; */
  905. color: white;
  906. border: none;
  907. margin-right: 2px;
  908. font-size: 14px;
  909. font-family: Source Han Sans CN;
  910. font-weight: 400;
  911. color: #ffffff;
  912. }
  913. ::v-deep .allFlv {
  914. width: 100px;
  915. height: 36px;
  916. color: white;
  917. margin-left: 5px;
  918. background: #196299;
  919. /* padding-left: 10px !important; */
  920. font-size: 14px;
  921. border: none;
  922. border-radius: 0px 8px 8px 0px;
  923. }
  924. ::v-deep .allFlv1 {
  925. width: 82px;
  926. height: 36px;
  927. background: #196299;
  928. padding-left: 13px !important;
  929. font-size: 14px;
  930. }
  931. /* 全屏按钮 */
  932. ::v-deep .fullscreen .el-radio-button__inner {
  933. margin-left: 10px;
  934. background-image: url("../../../images/全屏 (1) 拷贝.png") !important;
  935. background-repeat: no-repeat !important;
  936. background-position: 17px 10px !important;
  937. padding-left: 38px;
  938. border-radius: 8px;
  939. }
  940. /* 水平线颜色 */
  941. hr {
  942. background-color: #718a9d !important;
  943. }
  944. ::v-deep .data .el-date-editor.el-input {
  945. width: 100%;
  946. border: none !important;
  947. }
  948. ::v-deep .data .el-input__inner {
  949. width: 100% !important;
  950. border: none !important;
  951. }
  952. ::v-deep .data .el-input--medium .el-input__icon {
  953. line-height: 36px;
  954. position: absolute;
  955. right: -223px;
  956. top: 2px;
  957. }
  958. ::v-deep .data .el-input__inner {
  959. background-color: transparent !important;
  960. color: #fff;
  961. text-align: center;
  962. margin-top: 2px;
  963. }
  964. ::v-deep .data .el-input__suffix {
  965. position: absolute;
  966. right: 281px;
  967. }
  968. .app-container .box-lfet .data {
  969. height: 40px;
  970. background: #003156;
  971. margin-bottom: 12px;
  972. color: #fff;
  973. display: flex;
  974. font-size: 13px;
  975. line-height: 25px;
  976. position: relative;
  977. }
  978. .box-lfet .data p {
  979. position: absolute;
  980. top: -5px;
  981. left: 15px;
  982. }
  983. .box-lfet .data .a1 {
  984. width: 128px;
  985. height: 26px;
  986. background: rgba(23, 74, 112, 0.4);
  987. border-radius: 13px;
  988. position: absolute;
  989. top: 7px;
  990. left: 60px;
  991. }
  992. ::v-deep .data .el-date-editor.el-input {
  993. width: 100%;
  994. border: none;
  995. }
  996. ::v-deep .data .el-input__inner {
  997. width: 100% !important;
  998. border: none;
  999. }
  1000. ::v-deep .data .el-input--medium .el-input__icon {
  1001. line-height: 36px;
  1002. position: absolute;
  1003. right: -223px;
  1004. top: 2px;
  1005. }
  1006. ::v-deep .data .el-input__inner {
  1007. background-color: transparent;
  1008. color: #fff;
  1009. text-align: center;
  1010. margin-top: 2px;
  1011. }
  1012. ::v-deep .data .el-input__suffix {
  1013. position: absolute;
  1014. right: 281px;
  1015. }
  1016. /* 头部样式 */
  1017. .dadui {
  1018. height: 40px;
  1019. background: #003156;
  1020. /* border-bottom: 1px solid #718A9D ; */
  1021. background-image: url(../../../images/矩形底部边框.png);
  1022. background-repeat: no-repeat;
  1023. background-position: 0px 39px;
  1024. font-size: 16px;
  1025. color: #1d96ff;
  1026. }
  1027. .dadui img {
  1028. margin: 10px 10px 0px 10px;
  1029. }
  1030. .box-lfet .data p {
  1031. position: absolute;
  1032. top: -5px;
  1033. left: 15px;
  1034. }
  1035. .box-lfet .data .a1 {
  1036. width: 128px;
  1037. height: 26px;
  1038. background: rgba(23, 74, 112, 0.4);
  1039. border-radius: 13px;
  1040. position: absolute;
  1041. top: 7px;
  1042. left: 60px;
  1043. }
  1044. /* 输入框 */
  1045. ::v-deep .el-dialog .el-input__inner {
  1046. background-color: #004d86 !important;
  1047. width: 216px;
  1048. color: white;
  1049. margin-right: 20px;
  1050. border: 1px solid white !important;
  1051. }
  1052. ::v-deep .el-input__inner {
  1053. border: 1px solid white !important;
  1054. }
  1055. /* 划过效果 */
  1056. ::v-deep .el-tree-node__content:hover {
  1057. /* color: #fff; */
  1058. background-color: #003156;
  1059. background-image: url("../../../assets/images/选中.png");
  1060. background-size: 100% 100%;
  1061. background-repeat: no-repeat;
  1062. }
  1063. /* 左侧树状盒子 */
  1064. .app-container .box-lfet {
  1065. width: 15%;
  1066. min-height: 740px;
  1067. /* background: #003156; */
  1068. /* padding: 10px; */
  1069. margin-right: 10px;
  1070. /* border: 1px solid white; */
  1071. }
  1072. /* 右侧内容盒子 */
  1073. .app-container .box-right {
  1074. flex: 1;
  1075. }
  1076. .app-container .box-lfet .data {
  1077. height: 40px;
  1078. background: #003156;
  1079. margin-bottom: 12px;
  1080. color: #fff;
  1081. display: flex;
  1082. font-size: 13px;
  1083. line-height: 25px;
  1084. position: relative;
  1085. }
  1086. .el-tree {
  1087. background: #003156;
  1088. color: #fff;
  1089. margin-right: 2px;
  1090. padding-top: 7px;
  1091. }
  1092. ::v-deep
  1093. .el-tree--highlight-current
  1094. .el-tree-node.is-current
  1095. > .el-tree-node__content {
  1096. background-color: #003156;
  1097. height: 32px;
  1098. }
  1099. ::v-deep .el-tree-node__content {
  1100. height: 32px;
  1101. }
  1102. li {
  1103. list-style: none;
  1104. }
  1105. ::v-deep ul {
  1106. /* height: 32px; */
  1107. background: #003156;
  1108. }
  1109. ::v-deep li {
  1110. height: 32px;
  1111. color: white;
  1112. line-height: 32px;
  1113. }
  1114. .tree {
  1115. margin-top: -15px;
  1116. }
  1117. video {
  1118. background-color: rgba(0, 160, 233, 0.11);
  1119. }
  1120. .video1 {
  1121. width: 100%;
  1122. height: 100%;
  1123. display: flex;
  1124. flex-wrap: wrap;
  1125. }
  1126. .app-container {
  1127. padding: 15px 15px 0px 15px !important;
  1128. }
  1129. /* 选择通道按钮 */
  1130. .choose {
  1131. width: 86px;
  1132. height: 36px;
  1133. color: white;
  1134. background: #1d96ff;
  1135. border-radius: 4px;
  1136. border: none;
  1137. display: none;
  1138. }
  1139. .choose:focus {
  1140. outline: none;
  1141. }
  1142. /* 表格样式 */
  1143. ::v-deep .el-table .el-table__header-wrapper th {
  1144. background-color: #004d86 !important;
  1145. color: white;
  1146. }
  1147. /* 标题弹框 */
  1148. ::v-deep .el-dialog__title {
  1149. color: white;
  1150. /* border-bottom: 1px solid white; */
  1151. }
  1152. /* 标题下划线 */
  1153. ::v-deep .el-dialog__header {
  1154. border-bottom: 1px solid white;
  1155. }
  1156. ::v-deep .el-dialog {
  1157. background-color: #004d86 !important;
  1158. }
  1159. /* 树形样式 */
  1160. ::v-deep .vue-treeselect__control {
  1161. background-color: #004d86;
  1162. width: 216px;
  1163. margin-right: 25px;
  1164. color: white;
  1165. }
  1166. .threeselects {
  1167. width: 216px;
  1168. margin-right: 22px;
  1169. }
  1170. ::v-deep .vue-treeselect__single-value {
  1171. color: white;
  1172. }
  1173. /* 划过效果 */
  1174. ::v-deep li:hover {
  1175. /* color: #fff; */
  1176. background-color: #003156;
  1177. background-image: url("../../../assets/images/选中.png");
  1178. background-size: 100% 100%;
  1179. background-repeat: no-repeat;
  1180. }
  1181. ::v-deep .single {
  1182. width: 82px;
  1183. height: 36px;
  1184. background: #196299;
  1185. border: none;
  1186. margin-left: 5px;
  1187. color: white;
  1188. font-size: 14px;
  1189. font-family: Source Han Sans CN;
  1190. font-weight: 400;
  1191. color: #ffffff;
  1192. border-radius: 8px 0px 0px 8px;
  1193. }
  1194. ::v-deep .singles {
  1195. width: 82px;
  1196. height: 36px;
  1197. background: #196299;
  1198. border: none;
  1199. margin-left: 5px;
  1200. color: white;
  1201. font-size: 14px;
  1202. font-family: Source Han Sans CN;
  1203. font-weight: 400;
  1204. color: #ffffff;
  1205. /* border-radius: 8px 0px 0px 8px; */
  1206. }
  1207. .single:focus {
  1208. outline: none;
  1209. }
  1210. .singles:focus {
  1211. outline: none;
  1212. }
  1213. .allFlv:focus {
  1214. outline: none;
  1215. }
  1216. .bg {
  1217. background: #006cff;
  1218. }
  1219. .fullscreen {
  1220. width: 100%;
  1221. height: calc(100vh - 200px);
  1222. }
  1223. .fourscreen {
  1224. width: 49.5%;
  1225. height: calc(50vh - 106px);
  1226. margin-left: 5px;
  1227. margin-bottom: 5px;
  1228. position: relative;
  1229. }
  1230. </style>