taskScreen.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845
  1. <template>
  2. <v-scale-screen width="2200" height="1080">
  3. <div class="task_screen_cotainer">
  4. <div class="task_header">「{{ currentTaskName }}」任务态势大屏
  5. <el-button @click="changeVideo"></el-button>
  6. </div>
  7. <div class="content_cotainer">
  8. <div class="center_chart_cotainer_task" id="taskItem">
  9. <div class="task_detail_cotainer_task" style="width: 100%">
  10. <div v-if="false" class="header_line_style">
  11. <div class="headerTitle"></div>
  12. </div>
  13. <div v-if="false" class="task_name_header">「{{ currentTaskName }}」任务态势大屏</div>
  14. <!-- 任务屏幕 -->
  15. <div class="task_item_header">
  16. <el-select
  17. v-model="wholeOutTaskId"
  18. placeholder="「切换任务」"
  19. style="width: 270px"
  20. @change="changeTask"
  21. filterable
  22. >
  23. <el-option
  24. v-for="item in taskOPtion"
  25. :key="item.value"
  26. :label="item.label"
  27. :value="item.value"
  28. ></el-option>
  29. </el-select>
  30. <el-image
  31. @click="showMoreInfo('more')"
  32. class="showLessStyle"
  33. style="width: 30px; height: 22px; margin-right: 6px; margin-left: 10px"
  34. :src="require('../assets/img/small.svg')"
  35. fit="contain"
  36. ></el-image>
  37. <el-image
  38. v-if="false"
  39. @click="showMoreInfo('less')"
  40. :src="require('../assets/img/iconMore.svg')"
  41. fit="contain"
  42. class="showLessStyle"
  43. style="width: 30px; height: 22px; margin-right: 6px; margin-left: 10px"
  44. ></el-image>
  45. </div>
  46. <div class="task_header_top">
  47. <div class="subject_task_item_task">
  48. <div class="task_outer_cotnainer_status">
  49. <div class="map_more_box">
  50. <div class="task_list_header" style="font-size: 16px; margin: 0 24px 8px 0; white-space: nowrap">
  51. <el-image
  52. style="width: 30px; height: 22px; margin-right: 6px"
  53. :src="require('../assets/img/rightIcon.svg')"
  54. fit="contain"
  55. ></el-image>
  56. 课目分布
  57. </div>
  58. <div class="select_lsit_box">
  59. <el-select
  60. v-model="systemSubjectId"
  61. placeholder="切换系统名称"
  62. style="width: 55%; margin-right: 5px"
  63. @change="changeTaskAndSystem"
  64. clearable
  65. filterable
  66. >
  67. <el-option
  68. v-for="item in systemOption"
  69. :key="item.value"
  70. :label="item.label"
  71. :value="item.value"
  72. ></el-option>
  73. </el-select>
  74. <el-select
  75. v-model="unitSubjectValue"
  76. placeholder="切换单位名称"
  77. style="width: 55%"
  78. clearable
  79. @change="changeTaskAndUnit"
  80. filterable
  81. >
  82. <el-option
  83. v-for="item in unitOption"
  84. :key="item.value"
  85. :label="item.label"
  86. :value="item.value"
  87. ></el-option>
  88. </el-select>
  89. </div>
  90. </div>
  91. <div class="subject_list_container" id="subjectList">
  92. <template v-for="(item, index) in subjectDatas">
  93. <div class="subject_list_item_new" :key="index" @click="changeVideo(item.subjectName)">
  94. <div class="subject_list_header">
  95. <div>
  96. <div class="subject_list_name">
  97. {{ item.subjectName || "-" }}
  98. </div>
  99. <div class="orgainzers">
  100. 参与人员:{{ (item.participatingPeople && item.participatingPeople.join(",")) || "-" }}
  101. </div>
  102. </div>
  103. <el-image
  104. style="width: 36px; height: 36px"
  105. :src="subjectMap[item.status]"
  106. fit="contain"
  107. ></el-image>
  108. </div>
  109. <div class="system_task_style">
  110. <div>
  111. 参加系统:{{ (item.participatingSystems && item.participatingSystems.join(",")) || "-" }}
  112. </div>
  113. <div v-if="item.status == '已完成'" class="view_table_style" @click="viewManData(item)">
  114. 表格查看
  115. </div>
  116. </div>
  117. </div>
  118. </template>
  119. </div>
  120. </div>
  121. </div>
  122. <div class="unit_map_box_task_new">
  123. <div class="map_more_box">
  124. <div class="task_list_header" style="font-size: 16px; margin-bottom: 8px">
  125. <el-image
  126. style="width: 30px; height: 22px; margin-right: 6px"
  127. :src="require('../assets/img/rightIcon.svg')"
  128. fit="contain"
  129. ></el-image>
  130. 流程图
  131. </div>
  132. </div>
  133. <form-task-process-viewer
  134. :processInstanceId="processInstanceId"
  135. :processDefinitionId="processDefinitionId"
  136. v-if="isReady"
  137. ></form-task-process-viewer>
  138. </div>
  139. </div>
  140. <div class="task_header_footer_task_new">
  141. <div class="subject_task_item_task" style="width: 28.2%">
  142. <div class="task_outer_cotnainer_status">
  143. <div class="task_outer_cotnainer_status">
  144. <div class="map_more_box">
  145. <div class="task_list_header" style="font-size: 16px; margin-bottom: 8px">
  146. <el-image
  147. style="width: 30px; height: 22px; margin-right: 6px"
  148. :src="require('../assets/img/rightIcon.svg')"
  149. fit="contain"
  150. ></el-image>
  151. 指令监控
  152. </div>
  153. </div>
  154. <div class="subject_list_container_int" id="moninter">
  155. <div class="task_other_cotainer_scrool">
  156. <myscrollBoard :key="updatekey" :config="scrollTableConfig" style="width: 100%; height: 100%" />
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. <div class="unit_map_box_task">
  163. <!-- <div class="task_outer_cotnainer_status"> -->
  164. <div class="map_more_box">
  165. <div class="task_list_header" style="font-size: 16px; margin-bottom: 8px">
  166. <el-image
  167. style="width: 30px; height: 22px; margin-right: 6px"
  168. :src="require('../assets/img/rightIcon.svg')"
  169. fit="contain"
  170. ></el-image>
  171. 训练态势监控
  172. </div>
  173. <el-image
  174. @click="showFull('allVideo')"
  175. style="width: 20px; height: 20px; margin-right: 6px; margin-top: -10px"
  176. :src="require('../assets/img/iconMore.svg')"
  177. fit="contain"
  178. class="moreBtn_style"
  179. ></el-image>
  180. </div>
  181. <div class="video_title">{{ videoPlayerName[0] }}</div>
  182. <!-- <div class="video_body1"><HKVideo :companyVideoData="mainVideoData" :videoType="1"></HKVideo></div> -->
  183. <video id="videoPlayerTask" class="video-js" muted></video>
  184. <!-- <div><HKVideo :companyVideoData="mainVideoData"></HKVideo></div> -->
  185. <!-- <div class="center_no_data">
  186. <el-image
  187. style="width: 100px; height: 100px; margin-right:6px;"
  188. :src="require('../assets/img/build.png')"
  189. fit="contain"
  190. >
  191. </el-image>
  192. <div>
  193. </div>
  194. </div> -->
  195. <!-- </div> -->
  196. </div>
  197. <div class="commandMonitoring_task">
  198. <div class="map_more_box">
  199. <div class="task_list_header" style="font-size: 16px; margin-bottom: 8px">
  200. <el-image
  201. style="width: 30px; height: 22px; margin-right: 6px"
  202. :src="require('../assets/img/rightIcon.svg')"
  203. fit="contain"
  204. ></el-image>
  205. 训练态势监控
  206. </div>
  207. <el-image
  208. @click="showFull('allVideo')"
  209. style="width: 20px; height: 20px; margin-right: 6px; margin-top: -10px"
  210. :src="require('../assets/img/iconMore.svg')"
  211. fit="contain"
  212. class="moreBtn_style"
  213. ></el-image>
  214. </div>
  215. <!-- <div class="video_body2"><HKVideo2 :companyVideoData="mainVideoData" :videoType="2"></HKVideo2></div> -->
  216. <div class="task_outer_cotnainer_status">
  217. <div class="video_flex_style" style="padding-top: 12px">
  218. <div>
  219. <div class="video_title">{{ videoPlayerName[1] }}</div>
  220. <video id="videoPlayer_first" class="video-js" muted></video>
  221. </div>
  222. <div>
  223. <div class="video_title">{{ videoPlayerName[2] }}</div>
  224. <video id="videoPlayer_second" class="video-js" muted></video>
  225. </div>
  226. <div>
  227. <div class="video_title">{{ videoPlayerName[3] }}</div>
  228. <video id="videoPlayer_third" class="video-js" muted></video>
  229. </div>
  230. <div>
  231. <div class="video_title">{{ videoPlayerName[4] }}</div>
  232. <video id="videoPlayer_fourth" class="video-js" muted></video>
  233. </div>
  234. </div>
  235. <div class="center_no_data" v-if="false">
  236. <el-image
  237. style="width: 100px; height: 100px; margin-right: 6px"
  238. :src="require('../assets/img/build.png')"
  239. fit="contain"
  240. ></el-image>
  241. <div>系统正在建设中,敬请期待~</div>
  242. </div>
  243. </div>
  244. </div>
  245. </div>
  246. </div>
  247. </div>
  248. <!-- 任务详情弹窗 -->
  249. <el-dialog
  250. title=""
  251. :show-close="false"
  252. :destroy-on-close="true"
  253. :visible.sync="dialogVisible"
  254. width="650px"
  255. top="300px"
  256. >
  257. <div>
  258. <div class="task_detail_dialog">
  259. <div class="header_line_style"></div>
  260. <div class="task_dialog_box_other" v-if="dialogType == 2">
  261. <el-table
  262. :data="gridData"
  263. :header-cell-style="changeHeaderCellStyle"
  264. :cell-style="changeCellStyle"
  265. stripe
  266. :border="true"
  267. >
  268. <el-table-column
  269. align="center"
  270. property="participantName"
  271. label="姓名"
  272. max-width="350"
  273. ></el-table-column>
  274. <el-table-column align="center" property="score" label="成绩" max-width="300"></el-table-column>
  275. </el-table>
  276. </div>
  277. <div class="dialog_footer_box">
  278. <div class="view_more" @click="dialogVisible = false" style="color: #fff; padding: 3px 30px">关闭</div>
  279. </div>
  280. </div>
  281. </div>
  282. </el-dialog>
  283. </div>
  284. </div>
  285. </v-scale-screen>
  286. </template>
  287. <script>
  288. import * as echarts from "echarts";
  289. import myFlylineChartEnhanced from "../components/my-flyline-chart-enhanced/index";
  290. import formTaskProcessViewer from "@/components/workflow/formTaskProcessViewer";
  291. import myscrollBoard from "../components/myscroll-board/src/main";
  292. import sacleBox from "../components/sacle-box/index";
  293. import { request } from "../utils/request";
  294. var uploadedDataURL = require("../../public/json/taiyuan.json");
  295. import "./taskScreen.css";
  296. import Videojs from "video.js"; // 引入Videojs
  297. import FormTaskProcessViewer from "../components/workflow/formTaskProcessViewer.vue";
  298. import HKVideo from "../components/HKVS/hkv.vue";
  299. import HKVideo2 from "../components/HKVS/hkv2.vue"
  300. export default {
  301. components: {
  302. myFlylineChartEnhanced,
  303. sacleBox,
  304. myscrollBoard,
  305. HKVideo,
  306. HKVideo2,
  307. FormTaskProcessViewer
  308. },
  309. data() {
  310. return {
  311. systemFinshedValue: "",
  312. unitFinshedValue: "",
  313. wholeOutTaskId: "",
  314. systemSubjectId: "",
  315. unitSubjectValue: "",
  316. subjectItem: {},
  317. processDefinitionId: "",
  318. processInstanceId: "",
  319. moreFlag: true,
  320. dialogVisible: false,
  321. taskList: [],
  322. websocket: null, //建立的连接
  323. websocketOrder: null, //建立的连接
  324. updatekey: "1",
  325. scrollTableConfig: {
  326. header: ["指令名称", "指令内容", "指令时间"],
  327. waitTime: 1500,
  328. data: [],
  329. columnWidth: [80],
  330. oddRowBGC: "#072347",
  331. evenRowBGC: "#021736"
  332. },
  333. dialogType: 1,
  334. subjectDatas: [],
  335. subjectMap: {
  336. 待执行: require("../assets/img/waite.png"),
  337. 执行中: require("../assets/img/doing.png"),
  338. 已完成: require("../assets/img/finshed.png")
  339. },
  340. instructList: [],
  341. unitOption: [],
  342. systemOption: [],
  343. taskOPtion: [],
  344. isReady: false,
  345. currentTaskName: "",
  346. currentTaskGrade: "",
  347. unitSubGradeValue: "",
  348. gridData: [],
  349. dataSrc: ["rtsp://admin:sgw123456@192.168.0.64:554/h265/ch01/main/av_stream", "", "", "", ""],
  350. completionRate: false,
  351. playerList: [],
  352. videoPlayerName: ["监控名称", "监控名称", "监控名称", "监控名称", "监控名称"],
  353. videoList: [
  354. "videoPlayerTask",
  355. "videoPlayer_first",
  356. "videoPlayer_second",
  357. "videoPlayer_third",
  358. "videoPlayer_fourth"
  359. ],
  360. mainVideoData: {}
  361. };
  362. },
  363. methods: {
  364. // 表格样式修改
  365. changeHeaderCellStyle(row, column, rowIndex, columnIndex) {
  366. if (row.columnIndex === 0) {
  367. return "background: #004279 ; color:#fff;"; // 修改的样式
  368. } else {
  369. return "background: #004279 ;color:#fff; ";
  370. }
  371. },
  372. changeCellStyle(row, column, rowIndex, columnIndex) {
  373. if (row.columnIndex === 0) {
  374. return "background: #0A427C ; color:#fff;"; // 修改的样式
  375. } else {
  376. return "background: #0A427C ; color:#fff;";
  377. }
  378. },
  379. // 获取全部系统
  380. async getAllSystems() {
  381. let params = {};
  382. const res = await request("/dt_screen/rest/v1/screen/listSystem/", "get", params, false);
  383. const { errorCode, errorMessage, success, data } = res.data;
  384. if (success) {
  385. console.log("获取全部系统", data);
  386. this.systemOption = data.map((item) => {
  387. return {
  388. label: item.systemName,
  389. value: item.systemId
  390. };
  391. });
  392. this.systemFinshedValue = this.systemOption[0].value;
  393. } else {
  394. this.$message.error(errorMessage);
  395. }
  396. },
  397. // 获取全部单位
  398. async getAllUnits() {
  399. let params = {};
  400. const res = await request("/dt_screen/rest/v1/screen/listUnit/", "get", params, false);
  401. const { errorCode, errorMessage, success, data } = res.data;
  402. if (success) {
  403. console.log("获取全部单位", data);
  404. // 获取任务数据
  405. this.getTaskList();
  406. this.unitOption = data.map((item) => {
  407. return {
  408. label: item.unitName,
  409. value: item.unitId
  410. };
  411. });
  412. this.unitFinshedValue = this.unitOption[0].value;
  413. this.unitSubGradeValue = this.unitOption[0].value;
  414. } else {
  415. this.$message.error(errorMessage);
  416. }
  417. },
  418. // 获取任务列表
  419. async getTaskList() {
  420. let params = {};
  421. const res = await request("/dt_screen/rest/v2/task/listCurrentTask/", "post", params, false);
  422. const { errorCode, errorMessage, success, data } = res.data;
  423. if (success) {
  424. console.log("获取任务列表", data);
  425. this.taskList = data;
  426. this.taskOPtion = data.map((item) => {
  427. return {
  428. label: item.taskName,
  429. value: item.taskId
  430. };
  431. });
  432. this.wholeOutTaskId = data[0].taskId;
  433. this.processInstanceId = this.wholeOutTaskId;
  434. let param = {taskId: this.processInstanceId};
  435. const res1 = await request("/dt_screen/rest/v2/task/getDefId/", "post", param, false);
  436. this.processDefinitionId = res1.data;
  437. this.isReady = true;
  438. this.currentTaskName = data[0].taskName;
  439. this.currentTaskGrade = data[0].syntheticTaskScore;
  440. // 获取地图的信息
  441. if (data.length) {
  442. // 获取任务的课目信息
  443. this.getSubjectList(data[0].taskId);
  444. // 获取任务的指令信息
  445. this.getinstructList(data[0].taskId);
  446. // 建立指令websocket 链接
  447. this.initInstructWebsoket();
  448. }
  449. } else {
  450. this.$message.error(errorMessage);
  451. }
  452. },
  453. // 切换任务
  454. async changeTask() {
  455. this.systemSubjectId = "";
  456. this.unitSubjectValue = "";
  457. this.isReady = false;
  458. this.currentTaskName = this.taskOPtion.find((item) => item.value == this.wholeOutTaskId).label;
  459. this.currentTaskGrade = this.taskList.find((item) => item.taskId == this.wholeOutTaskId).syntheticTaskScore;
  460. // 获取任务的课目信息
  461. this.processInstanceId = this.wholeOutTaskId;
  462. let param = {taskId: this.processInstanceId};
  463. const res2 = await request("/dt_screen/rest/v2/task/getDefId/", "post", param, false);
  464. console.log('res2 :>> ', res2.data);
  465. this.processDefinitionId = res2.data;
  466. this.isReady = true;
  467. this.getSubjectList(this.wholeOutTaskId);
  468. // 获取任务的指令信息
  469. this.getinstructList(this.wholeOutTaskId);
  470. // 建立指令websocket 链接
  471. this.initInstructWebsoket();
  472. },
  473. changeTaskAndUnit() {
  474. this.systemSubjectId = "";
  475. if (this.unitSubjectValue) {
  476. this.getUnitSubjectList(this.wholeOutTaskId, this.unitSubjectValue);
  477. } else {
  478. this.getSubjectList(this.wholeOutTaskId);
  479. }
  480. },
  481. changeTaskAndSystem() {
  482. this.unitSubjectValue = "";
  483. if (this.systemSubjectId) {
  484. this.getSystemSubjectList(this.wholeOutTaskId, this.systemSubjectId);
  485. } else {
  486. this.getSubjectList(this.wholeOutTaskId);
  487. }
  488. },
  489. // 获取任务的课目信息
  490. async getSubjectList(taskId) {
  491. let params = {};
  492. const res = await request(`/dt_screen/rest/v1/subject/list/${taskId}`, "get", params, false);
  493. const { errorCode, errorMessage, success, data } = res.data;
  494. if (success) {
  495. console.log("获取任务的课目信息", data);
  496. this.subjectDatas = data;
  497. } else {
  498. this.$message.error(errorMessage);
  499. }
  500. },
  501. // 获取任务的指令
  502. async getinstructList(taskId) {
  503. let params = {};
  504. const res = await request(`/dt_screen/rest/v1/order/list/${taskId}`, "get", params, false);
  505. const { errorCode, errorMessage, success, data } = res.data;
  506. if (success) {
  507. console.log("获取任务的指令", data);
  508. this.instructList = data;
  509. let tempData = [];
  510. data.forEach((item) => {
  511. tempData.push([item.subjectName, item.content, item.time]);
  512. });
  513. this.scrollTableConfig.data = tempData;
  514. this.updatekey = new Date().getTime();
  515. } else {
  516. this.$message.error(errorMessage);
  517. }
  518. },
  519. // 切换单位再结合任务id 获取课目课目列表
  520. async getUnitSubjectList(taskId, unitId) {
  521. let params = {};
  522. const res = await request(`/dt_screen/rest/v1/subject/list/task/${taskId}/unit/${unitId}`, "get", params, false);
  523. const { errorCode, errorMessage, success, data } = res.data;
  524. if (success) {
  525. this.subjectDatas = data;
  526. } else {
  527. this.$message.error(errorMessage);
  528. }
  529. },
  530. // 切换系统再结合任务id 获取课目课目列表
  531. async getSystemSubjectList(taskId, systemId) {
  532. let params = {};
  533. const res = await request(
  534. `/dt_screen/rest/v1/subject/list/task/${taskId}/system/${systemId}`,
  535. "get",
  536. params,
  537. false
  538. );
  539. const { errorCode, errorMessage, success, data } = res.data;
  540. if (success) {
  541. this.subjectDatas = data;
  542. } else {
  543. this.$message.error(errorMessage);
  544. }
  545. },
  546. // 建立websocket 链接 任务
  547. initWebsoket() {
  548. this.websocket = new WebSocket("ws://43.143.221.128:8084/websocket/task"); //这里将http替换成ws
  549. switch (this.websocket.readyState) {
  550. case 0:
  551. console.log("正在连接");
  552. break;
  553. case 1:
  554. console.log("已经链接并且可以通讯");
  555. break;
  556. case 2:
  557. console.log("连接正在关闭");
  558. break;
  559. case 3:
  560. console.log("连接已关闭或者没有链接成功");
  561. break;
  562. }
  563. this.websocket.onopen = this.websocketsend; //websoket连接成功
  564. this.websocket.onmessage = this.websocketonmessage; //websoket收到信息
  565. this.websocket.onclose = this.websocketclose; //websoket连接关闭
  566. },
  567. websocketsend() {
  568. console.log("ws 连接成功");
  569. },
  570. websocketonmessage(msg) {
  571. // 获取全部单位
  572. this.getAllUnits();
  573. // 获取全部系统
  574. this.getAllSystems();
  575. console.log("收到任务信息", msg);
  576. },
  577. websocketclose() {
  578. console.log("ws 连接关闭");
  579. this.initWebsoket(); //重新建立连接
  580. },
  581. initInstructWebsoket() {
  582. // 指令的ws
  583. this.websocketOrder = new WebSocket(`ws://43.143.221.128:8084/websocket/order/${this.wholeOutTaskId}`); //这里将http替换成ws
  584. switch (this.websocketOrder.readyState) {
  585. case 0:
  586. console.log("正在连接");
  587. break;
  588. case 1:
  589. console.log("已经链接并且可以通讯");
  590. break;
  591. case 2:
  592. console.log("连接正在关闭");
  593. break;
  594. case 3:
  595. console.log("连接已关闭或者没有链接成功");
  596. break;
  597. }
  598. this.websocketOrder.onopen = this.orderWebsocketsend; //websoket连接成功
  599. this.websocketOrder.onmessage = this.orderWebsocketonmessage; //websoket收到信息
  600. this.websocketOrder.onclose = this.orderWebsocketclose; //websoket连接关闭
  601. },
  602. orderWebsocketsend() {
  603. console.log("ws 连接成功");
  604. },
  605. orderWebsocketonmessage(msg) {
  606. // 获取任务的指令信息
  607. this.getinstructList(this.wholeOutTaskId);
  608. console.log("收到指令信息", msg);
  609. },
  610. orderWebsocketclose() {
  611. console.log("ws 连接关闭");
  612. this.initInstructWebsoket(); //重新建立连接
  613. },
  614. // 查看成绩表格
  615. viewManData(item) {
  616. this.dialogType = 2;
  617. this.dialogVisible = true;
  618. console.log("item", item);
  619. const { subjectScore } = item;
  620. this.gridData = subjectScore;
  621. },
  622. // 全屏事件
  623. showFull(id) {
  624. console.log("ckx debug 监控大屏");
  625. this.$router.push("/monitorScreen");
  626. },
  627. // 退出全屏
  628. exitFull() {
  629. let exitFullScreen =
  630. document.exitFullScreen ||
  631. document.mozCancelFullScreen ||
  632. document.webkitExitFullscreen ||
  633. document.msExitFullscreen;
  634. if (exitFullScreen) {
  635. exitFullScreen.call(document);
  636. }
  637. this.updatekey = new Date().getTime();
  638. },
  639. // 展开全屏
  640. requestFullScreen(elem) {
  641. console.log("ckx debug ");
  642. // #兼容不同的浏览器
  643. var requestMethod =
  644. elem.requestFullScreen || elem.webkitRequestFullScreen || elem.mozRequestFullScreen || elem.msRequestFullScreen;
  645. if (requestMethod) {
  646. requestMethod.call(elem);
  647. } else if (typeof window.ActiveXObject !== "undefined") {
  648. // #模拟F11 实现全屏
  649. var wscript = new ActiveXObject("WScript.Shell");
  650. if (wscript !== null) {
  651. wscript.SendKeys("{F11}");
  652. }
  653. }
  654. let that = this;
  655. window.addEventListener("resize", function () {
  656. //执行
  657. let isFull =
  658. document.mozFullScreen ||
  659. document.fullScreen ||
  660. //谷歌浏览器及Webkit内核浏览器
  661. document.webkitIsFullScreen ||
  662. document.webkitRequestFullScreen ||
  663. document.mozRequestFullScreen ||
  664. document.msFullscreenEnabled;
  665. if (isFull === undefined) {
  666. that.exitFull();
  667. } else {
  668. }
  669. });
  670. },
  671. checkFull() {
  672. //判断浏览器是否处于全屏状态 (需要考虑兼容问题)
  673. //火狐浏览器
  674. let isFull =
  675. document.mozFullScreen ||
  676. document.fullScreen ||
  677. //谷歌浏览器及Webkit内核浏览器
  678. document.webkitIsFullScreen ||
  679. document.webkitRequestFullScreen ||
  680. document.mozRequestFullScreen ||
  681. document.msFullscreenEnabled;
  682. if (isFull === undefined) {
  683. isFull = false;
  684. }
  685. return isFull;
  686. },
  687. showMoreInfo(type) {
  688. if (type == "more") {
  689. this.$router.push("/situationScreen");
  690. } else {
  691. this.$router.push("/taskScreen");
  692. }
  693. },
  694. // 初始化视频
  695. initVideo(nowPlayVideoUrl, id) {
  696. let that = this;
  697. // 这些options属性也可直接设置在video标签上,见 muted
  698. let options = {
  699. autoplay: true, // 设置自动播放
  700. controls: true, // 显示播放的控件
  701. sources: [
  702. // 注意,如果是以option方式设置的src,是不能实现 换台的 (即使监听了nowPlayVideoUrl也没实现)
  703. {
  704. src: nowPlayVideoUrl,
  705. type: "application/x-mpegURL" // 告诉videojs,这是一个hls流
  706. }
  707. ]
  708. };
  709. // videojs的第一个参数表示的是,文档中video的id
  710. const myPlyer = Videojs(id, options, function onPlayerReady() {
  711. console.log("onPlayerReady 中的this指的是:", this); // 这里的this是指Player,是由Videojs创建出来的实例
  712. console.log(myPlyer === this); // 这里返回的是true
  713. });
  714. this.playerList.push(myPlyer);
  715. },
  716. async initUrl(subjectName = "电子干扰课目") {
  717. // if(this.playerList.length){
  718. // this.playerList.forEach((item)=>{
  719. // item.dispose()
  720. // })
  721. // }
  722. let params = {
  723. subjectName: subjectName
  724. };
  725. const res = await request("/dt_screen/video/videos/getUnitUrl", "post", params, false);
  726. let index = 0;
  727. this.dataSrc = ["", "", "", "", ""];
  728. this.videoPlayerName = ["监控名称", "监控名称", "监控名称", "监控名称", "监控名称"];
  729. for (let item in res.data) {
  730. this.dataSrc[index] = res.data[item].url;
  731. this.videoPlayerName[index++] = res.data[item].name;
  732. }
  733. },
  734. changeVideo(subjectName) {
  735. // if(this.playerList.length){
  736. // this.playerList.forEach((item)=>{
  737. // item.dispose()
  738. // })
  739. // }
  740. let params = {};
  741. request("/dt_screen/video/videos/videoClose", "get", params, false);
  742. // const res = request("/dt_screen/video/videos/videoClose", "get", params, false);
  743. // this.initUrl(subjectName + "课目");
  744. // setTimeout(() => {
  745. // let index = 0;
  746. // this.playerList.forEach((item) => {
  747. // item.src([{ type: "application/x-mpegURL", src: this.dataSrc[index++] }]);
  748. // item.load();
  749. // item.play();
  750. // });
  751. // }, 35000);
  752. }
  753. },
  754. mounted() {
  755. // this.initUrl()
  756. let url = "rtsp://admin:sgw123456@192.168.0.64:554/h265/ch01/main/av_stream";
  757. url = url.split("/");
  758. url = url[2];
  759. url = url.split(":");
  760. this.mainVideoData.Username = url[0];
  761. this.mainVideoData.Port = url[2];
  762. url = url[1];
  763. url = url.split("@");
  764. this.mainVideoData.IP = url[1];
  765. this.mainVideoData.Password = url[0];
  766. console.log("this.mainVideoData :>> ", this.mainVideoData);
  767. // 获取全部单位
  768. this.getAllUnits();
  769. // 获取全部系统
  770. this.getAllSystems();
  771. // 建立任务的weksocket链接
  772. this.initWebsoket();
  773. // // 过14秒调用
  774. // setTimeout(() => {
  775. // for (let index = 0; index < this.dataSrc.length; index++) {
  776. // this.initVideo(this.dataSrc[index], this.videoList[index]);
  777. // }
  778. // }, 5500);
  779. },
  780. beforeDestroy() {
  781. if (this.playerList.length) {
  782. this.playerList.forEach((item) => {
  783. item.dispose();
  784. });
  785. }
  786. const res = request("/dt_screen/video/videos/videoClose", "get", params, false);
  787. }
  788. };
  789. </script>
  790. <style scoped>
  791. #videoPlayerTask {
  792. width: 906px;
  793. height: 350px;
  794. }
  795. #videoPlayer_first {
  796. width: 278px;
  797. height: 164px;
  798. margin-right: 10px;
  799. margin-bottom: 10px;
  800. }
  801. #videoPlayer_second {
  802. width: 278px;
  803. height: 164px;
  804. margin-bottom: 10px;
  805. }
  806. #videoPlayer_third {
  807. width: 278px;
  808. height: 164px;
  809. margin-right: 10px;
  810. }
  811. #videoPlayer_fourth {
  812. width: 278px;
  813. height: 164px;
  814. }
  815. .video_flex_style {
  816. display: flex;
  817. align-items: center;
  818. flex-wrap: wrap;
  819. padding: 10px 0;
  820. box-sizing: border-box;
  821. }
  822. </style>