index.vue 31 KB

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