taskScreen.vue 32 KB

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