taskScreen.vue 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185
  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="tag1" @click="jumpToHistory">
  6. 历史态势
  7. </div>
  8. <div class="tag2" @click="jumpToDangqian">
  9. 当前态势列表
  10. </div>
  11. <div class="content_cotainer">
  12. <div class="center_chart_cotainer_task" id="taskItem">
  13. <div class="task_detail_cotainer_task" style="width:100%;">
  14. <div v-if="false" class="header_line_style">
  15. <div class="headerTitle"></div>
  16. </div>
  17. <div v-if="false" class="task_name_header">「{{ currentTaskName }}」任务态势大屏</div>
  18. <!-- 任务屏幕 -->
  19. <div class="task_item_header">
  20. <el-select
  21. v-model="wholeOutTaskId"
  22. placeholder="「切换任务」"
  23. style="width:270px;"
  24. @change="changeTask"
  25. filterable
  26. >
  27. <el-option
  28. v-for="item in taskOPtion"
  29. :key="item.value"
  30. :label="item.label"
  31. :value="item.value"
  32. >
  33. </el-option>
  34. </el-select>
  35. <el-image
  36. @click="showMoreInfo('more')"
  37. class="showLessStyle"
  38. style="width: 30px; height: 22px; margin-right:6px; margin-left: 10px;"
  39. :src="require('../assets/img/small.svg')"
  40. fit="contain"
  41. >
  42. </el-image>
  43. <el-image
  44. v-if="false"
  45. @click="showMoreInfo('less')"
  46. :src="require('../assets/img/iconMore.svg')"
  47. fit="contain"
  48. class="showLessStyle"
  49. style="width: 30px; height: 22px; margin-right:6px; margin-left: 10px;"
  50. >
  51. </el-image>
  52. </div>
  53. <div class="task_header_top">
  54. <div class="subject_task_item_task">
  55. <div class="task_outer_cotnainer_status">
  56. <div class="map_more_box">
  57. <div class="task_list_header" style="font-size:16px; margin: 0 24px 8px 0; white-space: nowrap; ">
  58. <el-image
  59. style="width: 30px; height: 22px; margin-right:6px;"
  60. :src="require('../assets/img/rightIcon.svg')"
  61. fit="contain"
  62. >
  63. </el-image>
  64. 课目分布
  65. </div>
  66. <div class="select_lsit_box">
  67. <el-select
  68. v-model="systemSubjectId"
  69. placeholder="切换系统名称"
  70. style="width:55%; margin-right:5px;"
  71. @change="changeTaskAndSystem"
  72. clearable
  73. filterable
  74. >
  75. <el-option
  76. v-for="item in systemOption"
  77. :key="item.value"
  78. :label="item.label"
  79. :value="item.value"
  80. >
  81. </el-option>
  82. </el-select>
  83. <el-select
  84. v-model="unitSubjectValue"
  85. placeholder="切换单位名称"
  86. style="width:55%;"
  87. clearable
  88. @change="changeTaskAndUnit"
  89. filterable
  90. >
  91. <el-option
  92. v-for="item in unitOption"
  93. :key="item.value"
  94. :label="item.label"
  95. :value="item.value"
  96. >
  97. </el-option>
  98. </el-select>
  99. </div>
  100. </div>
  101. <div class="subject_list_container" id="subjectList">
  102. <template v-for="(item,index) in subjectDatas">
  103. <div class="subject_list_item_new" :key="index" @click="changeVideo(item.subjectName)">
  104. <div class="subject_list_header">
  105. <div>
  106. <div class="subject_list_name">
  107. {{ item.subjectName ||'-' }}
  108. </div>
  109. <div class="orgainzers">
  110. 参与人员:{{ item.participatingPeople && item.participatingPeople.join(',') || '-' }}
  111. </div>
  112. </div>
  113. <el-image
  114. style="width: 36px; height: 36px; "
  115. :src="subjectMap[item.status]"
  116. fit="contain"
  117. >
  118. </el-image>
  119. </div>
  120. <div class="system_task_style">
  121. <div>参加系统:{{ item.participatingSystems && item.participatingSystems.join(',') || '-'}}</div>
  122. <div
  123. v-if="item.status=='已完成'"
  124. class="view_table_style"
  125. @click="viewManData(item)">
  126. 表格查看
  127. </div>
  128. </div>
  129. </div>
  130. </template>
  131. </div>
  132. </div>
  133. </div>
  134. <div class="unit_map_box_task_new">
  135. <div class="map_more_box">
  136. <div class="task_list_header" style="font-size:16px; margin-bottom:8px;">
  137. <el-image
  138. style="width: 30px; height: 22px; margin-right:6px;"
  139. :src="require('../assets/img/rightIcon.svg')"
  140. fit="contain"
  141. >
  142. </el-image>
  143. 流程图
  144. </div>
  145. </div>
  146. <form-task-process-viewer
  147. :processInstanceId="processInstanceId"
  148. :processDefinitionId="processDefinitionId"
  149. v-if="isReady"
  150. ref="FormTaskProcessViewer"
  151. ></form-task-process-viewer>
  152. </div>
  153. </div>
  154. <div class="task_header_footer_task_new">
  155. <div class="subject_task_item_task" style="width:28.2%;">
  156. <div class="task_outer_cotnainer_status">
  157. <div class="task_outer_cotnainer_status">
  158. <div class="map_more_box">
  159. <div class="task_list_header" style="font-size:16px; margin-bottom:8px;">
  160. <el-image
  161. style="width: 30px; height: 22px; margin-right:6px;"
  162. :src="require('../assets/img/rightIcon.svg')"
  163. fit="contain"
  164. >
  165. </el-image>
  166. 课目成绩
  167. </div>
  168. </div>
  169. <div class="subject_list_container_int" id="moninter">
  170. <div class="task_other_cotainer_scrool">
  171. <!-- <myscrollBoard :key="updatekey1" :config="subjectScoreTableConfig" style="width: 100%; height: 100%" />-->
  172. <div class="subject_list_container" id="subjectList">
  173. <template v-for="(item,index) in subjectDatas">
  174. <div class="subject_list_item" :key="index">
  175. <div class="subject_list_header">
  176. <div>
  177. <div class="subject_list_name">
  178. {{ item.subjectName ||'-' }}
  179. </div>
  180. <div class="SubjectNumber_style" style="font-size: 16px; color: #F1D73A;">
  181. {{ item.overallScore || '暂无课目成绩' }}
  182. </div>
  183. </div>
  184. </div>
  185. <div class="system_task_style">
  186. <div
  187. class="view_table_style"
  188. @click="viewManData(item)">
  189. 参与人员成绩
  190. </div>
  191. </div>
  192. </div>
  193. </template>
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. </div>
  199. </div>
  200. <div class="unit_map_box_task">
  201. <div class="map_more_box">
  202. <div class="task_list_header" style="font-size:16px; margin-bottom:8px;">
  203. <el-image
  204. style="width: 30px; height: 22px; margin-right:6px;"
  205. :src="require('../assets/img/rightIcon.svg')"
  206. fit="contain"
  207. >
  208. </el-image>
  209. 指令监控
  210. </div>
  211. </div>
  212. <div class="subject_list_container_int" id="moninter">
  213. <div class="task_other_cotainer_scrool">
  214. <myscrollBoard :key="updatekey" :config="scrollTableConfig" style="width: 100%; height: 100%" />
  215. </div>
  216. </div>
  217. </div>
  218. <div class="commandMonitoring_task">
  219. <div class="map_more_box">
  220. <div class="task_list_header" style="font-size: 16px; margin-bottom: 8px">
  221. <el-image
  222. style="width: 30px; height: 22px; margin-right: 6px"
  223. :src="require('../assets/img/rightIcon.svg')"
  224. fit="contain"
  225. ></el-image>
  226. 训练态势监控
  227. </div>
  228. <el-image
  229. @click="showFull1('allVideo')"
  230. style="width: 20px; height: 20px; margin-right: 6px; margin-top: -10px"
  231. :src="require('../assets/img/iconMore.svg')"
  232. fit="contain"
  233. class="moreBtn_style"
  234. ></el-image>
  235. </div>
  236. <div class="task_outer_cotnainer_status">
  237. <hkv v-if="HKCardShow" :companyVideoData="hebingjiankongData" ref="hkv"/>
  238. <div class="center_no_data" v-if="false">
  239. <el-image
  240. style="width: 100px; height: 100px; margin-right: 6px"
  241. :src="require('../assets/img/build.png')"
  242. fit="contain"
  243. ></el-image>
  244. <div>系统正在建设中,敬请期待~</div>
  245. </div>
  246. </div>
  247. </div>
  248. </div>
  249. </div>
  250. </div>
  251. <!-- 任务详情弹窗 -->
  252. <el-dialog
  253. title=""
  254. :show-close="false"
  255. :destroy-on-close="true"
  256. :visible.sync="dialogVisible"
  257. width="650px"
  258. top="300px"
  259. >
  260. <div>
  261. <div class="task_detail_dialog">
  262. <div class="header_line_style"></div>
  263. <div class="task_dialog_box_other" v-if="dialogType == 2">
  264. <el-table :data="pagedData" :header-cell-style="changeHeaderCellStyle" :cell-style="changeCellStyle" stripe:border="true">
  265. <el-table-column align="center" label="序号" header-align="center" type="index" width="55px" :index="getTableIndex" />
  266. <el-table-column align="center" property="participantName" label="姓名" max-width="350"></el-table-column>
  267. <!-- <el-table-column align="center" property="score" label="成绩" max-width="300"></el-table-column>-->
  268. <el-table-column align="center" label="成绩" max-width="300">
  269. <template slot-scope="scope">
  270. {{ formatScore(parseFloat(scope.row.score)) }}
  271. </template>
  272. </el-table-column>
  273. <el-table-column align="center" property="uploadTime" label="上报时间" max-width="300"></el-table-column>
  274. </el-table>
  275. <el-row type="flex" justify="end" style="margin-top: 10px;">
  276. <el-pagination
  277. :total="this.gridData.length"
  278. :current-page="this.gridData.currentPage"
  279. :page-size="this.gridData.pageSize"
  280. :page-sizes="[5,10,15, 20]"
  281. layout="total, prev, pager, next, sizes"
  282. @current-change="onCurrentPageChange"
  283. @size-change="onPageSizeChange">
  284. </el-pagination>
  285. </el-row>
  286. </div>
  287. <div class="dialog_footer_box">
  288. <div class="view_more" @click="dialogVisible = false" style="color: #fff; padding: 3px 30px">关闭</div>
  289. </div>
  290. </div>
  291. </div>
  292. </el-dialog>
  293. </div>
  294. </div>
  295. </v-scale-screen>
  296. </template>
  297. <script>
  298. import myFlylineChartEnhanced from '../components/my-flyline-chart-enhanced/index'
  299. import myscrollBoard from '../components/myscroll-board/src/main'
  300. import sacleBox from '../components/sacle-box/index'
  301. import { request } from '../utils/request';
  302. var uploadedDataURL = require('../../public/json/taiyuan.json')
  303. import './taskScreen.css'
  304. import Videojs from "video.js"; // 引入Videojs
  305. import FormTaskProcessViewer from '../components/workflow/formTaskProcessViewer.vue';
  306. import hkv from '../components/hk/hkv.vue'
  307. import hkCamara from '../components/hk/hkCamara.vue'
  308. export default {
  309. components:{
  310. myFlylineChartEnhanced,
  311. sacleBox,
  312. myscrollBoard,
  313. hkv,
  314. hkCamara,
  315. FormTaskProcessViewer,
  316. },
  317. data() {
  318. return {
  319. SubjectInfo1:'',
  320. SubjectInfo2:'',
  321. SubjectInfoList: ["所有课目"],
  322. HKCardShow: false,
  323. HKCamaraShow: false,
  324. systemFinshedValue:'',
  325. unitFinshedValue:'',
  326. wholeOutTaskId:'',
  327. systemSubjectId:'',
  328. unitSubjectValue:'',
  329. subjectItem:{},
  330. processDefinitionId: "",
  331. processInstanceId:"",
  332. moreFlag:true,
  333. dialogVisible:false,
  334. taskList:[],
  335. websocket: null, //建立的连接
  336. websocketOrder: null, //建立的连接
  337. websocketBpmn: null, //建立的连接
  338. updatekey:'1',
  339. updatekey1: '2',
  340. scrollTableConfig:{
  341. header: ['课目名称', '指令名称', '特情注入', '指令内容', '模训系统', '时间'],
  342. waitTime:1500,
  343. data: [],
  344. columnWidth: [150, 150, 150, 150, 150, 150],
  345. oddRowBGC:'#072347',
  346. evenRowBGC:'#021736'
  347. },
  348. subjectScoreTableConfig:{
  349. header: ['课目名称', '课目成绩', '人员成绩'],
  350. waitTime:1500,
  351. data: [],
  352. columnWidth: [200, 200, 200],
  353. align: ['center', 'center', 'center'],
  354. oddRowBGC:'#072347',
  355. evenRowBGC:'#021736'
  356. },
  357. dialogType:1,
  358. subjectDatas:[],
  359. subjectMap:{
  360. '待执行':require('../assets/img/waite.png'),
  361. '执行中':require('../assets/img/doing.png'),
  362. '已完成':require('../assets/img/finshed.png') ,
  363. },
  364. instructList: [],
  365. unitOption: [],
  366. systemOption: [],
  367. taskOPtion: [],
  368. isReady: false,
  369. currentTaskName: "",
  370. currentTaskGrade: "",
  371. unitSubGradeValue: "",
  372. gridData:{
  373. data: [],
  374. length:0,
  375. currentPage:1,
  376. pageSize:10,
  377. paged:true,
  378. },
  379. camaraSrc: ["", "", "", "", ""],
  380. completionRate: false,
  381. playerList: [],
  382. camaraName: ["监控名称", "监控名称", "监控名称", "监控名称", "监控名称"],
  383. videoList: [
  384. "videoPlayerTask",
  385. "videoPlayer_first",
  386. "videoPlayer_second",
  387. "videoPlayer_third",
  388. "videoPlayer_fourth"
  389. ],
  390. mainVideoData: {},
  391. currentSubject: '',
  392. camaraData:[],
  393. cardData:[],
  394. hebingjiankongData:[],
  395. cardName:[],
  396. cardSrc:[]
  397. };
  398. },
  399. computed:{
  400. pagedData() { // 动态计算当前页的数据
  401. const start = (this.gridData.currentPage - 1) * this.gridData.pageSize
  402. const end = start + this.gridData.pageSize
  403. if(this.gridData.data.length!=0){
  404. return this.gridData.data.slice(start, end)
  405. }else{
  406. return null
  407. }
  408. }
  409. },
  410. methods:{
  411. /**
  412. * 保留两位小数
  413. */
  414. formatScore(score) {
  415. if (isNaN(score)) {
  416. return score;
  417. }
  418. return Number(score).toFixed(2);
  419. },
  420. /**
  421. * 获取每一行的index信息
  422. * @param {Integer} index 表格在本页位置
  423. */
  424. getTableIndex (index) {
  425. let a
  426. a=((this.gridData.currentPage - 1) * this.gridData.pageSize + (index + 1))
  427. return a;
  428. },
  429. onCurrentPageChange (newCurrentPage) {
  430. this.loadTableDataImpl2(newCurrentPage, this.gridData.pageSize).then(() => {//数据加载成功
  431. this.gridData.currentPage = newCurrentPage;
  432. this.oldPage = this.gridData.currentPage-1
  433. if(this.gridData.data.length <= newCurrentPage*this.gridData.pageSize ){
  434. this.gridData.paged=true
  435. }else{
  436. this.gridData.paged=false
  437. }
  438. }).catch(() => {//数据加载失败
  439. this.gridData.currentPage = this.oldPage;
  440. });
  441. },
  442. /**
  443. * 表格分页每页显示数量变化
  444. * @param {Integer} newPageSize 变化后的每页显示数量
  445. */
  446. onPageSizeChange (newPageSize) {
  447. this.gridData.pageSize = newPageSize;
  448. this.gridData.currentPage = 1
  449. this.loadTableDataImpl2(1, newPageSize).then(() => {
  450. this.oldPage = this.gridData.currentPage;
  451. this.oldPageSize = this.gridData.pageSize;
  452. }).catch(e => {
  453. this.gridData.currentPage = this.oldPage;
  454. this.gridData.pageSize = this.oldPageSize;
  455. });
  456. },
  457. /**
  458. * 获取表格数据
  459. * @param {Integer} pageNum 当前分页
  460. * @param {Integer} pageSize 每页数量
  461. * @param {Boolean} reload 是否重新获取数据
  462. */
  463. loadTableDataImpl2 (pageNum, pageSize, reload = false) {
  464. // 判断是否需要重新加载数据
  465. if (this.gridData.data.length == 0 || this.gridData.length == 0) {
  466. return Promise.resolve([])
  467. }
  468. if (reload || !this.gridData.data || this.gridData.data.length === 0) {
  469. // 调用后端接口或其他数据来源获取数据
  470. // 这里省略具体实现
  471. // 模拟一个返回结果的 Promise 对象
  472. const mockData = new Promise(resolve => {
  473. const data = [];
  474. for (let i = 1; i <= pageSize; i++) {
  475. data.push({
  476. id: pageNum * pageSize + i,
  477. name: `任务${pageNum * pageSize + i}`,
  478. status: Math.floor(Math.random() * 4)
  479. });
  480. }
  481. resolve(data);
  482. });
  483. // 返回 Promise 对象,以便分页组件可以在数据加载完成后进行下一步处理。
  484. return mockData.then(data => {
  485. // 更新任务列表数据
  486. this.gridData.data = data;
  487. // 返回新的任务列表数据
  488. return this.gridData.data.slice((pageNum - 1) * pageSize, pageNum * pageSize);
  489. });
  490. } else {// 直接返回已有的任务列表数据
  491. return Promise.resolve(this.gridData.data.slice((pageNum - 1) * pageSize, pageNum * pageSize));
  492. }
  493. },
  494. HKCardInit(){
  495. this.HKCardShow = true;
  496. },
  497. jumpToHistory() {
  498. // this.$refs.hk.$destroy();
  499. // this.HKshow = false;
  500. this.$router.push("/situationScreen")
  501. },
  502. jumpToDangqian() {
  503. this.$router.push("/mainScreen")
  504. },
  505. // 表格样式修改
  506. changeHeaderCellStyle(row,column, rowIndex, columnIndex){
  507. if(row.columnIndex === 0){
  508. return 'background: #004279 ; color:#fff;'; // 修改的样式
  509. }else {
  510. return 'background: #004279 ;color:#fff; ';
  511. }
  512. },
  513. changeCellStyle(row,column, rowIndex, columnIndex){
  514. if(row.columnIndex === 0){
  515. return 'background: #0A427C ; color:#fff;'; // 修改的样式
  516. }else {
  517. return 'background: #0A427C ; color:#fff;';
  518. }
  519. },
  520. // 获取全部系统
  521. async getAllSystems(){
  522. let params={}
  523. const res = await request('/dt_screen/rest/v1/screen/listSystem/', 'get', params, false)
  524. const { errorCode, errorMessage, success,data } = res.data;
  525. if (success) {
  526. console.log('获取全部系统', data);
  527. this.systemOption = data.map((item)=>{
  528. return {
  529. label:item.systemName,
  530. value: item.systemId
  531. }
  532. })
  533. this.systemFinshedValue=this.systemOption[0].value
  534. } else {
  535. this.$message.error(errorMessage)
  536. }
  537. },
  538. // 获取全部单位
  539. async getAllUnits (){
  540. let params={}
  541. const res = await request('/dt_screen/rest/v1/screen/listUnit/', 'get', params, false)
  542. const { errorCode, errorMessage, success,data } = res.data;
  543. if (success) {
  544. console.log('获取全部单位', data);
  545. // 获取任务数据
  546. this.getTaskList()
  547. this.unitOption = data.map((item)=>{
  548. return {
  549. label:item.unitName,
  550. value: item.unitId
  551. }
  552. })
  553. this.unitFinshedValue=this.unitOption[0].value
  554. this.unitSubGradeValue=this.unitOption[0].value
  555. } else {
  556. this.$message.error(errorMessage)
  557. }
  558. },
  559. // 获取任务列表
  560. async getTaskList() {
  561. let params = {};
  562. // const res = await request("/dt_screen/rest/v2/task/listCurrentTask/", "post", params, false);
  563. const res = await request("/dt_screen/rest/v2/task/listRunningTasks/", "post", params, false);
  564. const { errorCode, errorMessage, success, data } = res.data;
  565. if (success) {
  566. console.log("获取任务列表", data);
  567. this.taskList = data;
  568. if(this.$route.query.key1){
  569. this.wholeOutTaskId = this.$route.query.key1;
  570. this.currentTaskName = this.$route.query.taskName;
  571. // currentTaskName
  572. // if(location.href.indexOf('#reloaded')==-1){
  573. // location.href=location.href+"#reloaded";
  574. // location.reload();
  575. // }
  576. }else{
  577. this.wholeOutTaskId = data[0].taskId;
  578. this.currentTaskName = data[0].taskName;
  579. this.currentTaskGrade = data[0].syntheticTaskScore;
  580. }
  581. this.processInstanceId = this.wholeOutTaskId;
  582. this.taskOPtion = data.map((item) => {
  583. return {
  584. label: item.taskName,
  585. value: item.taskId
  586. };
  587. });
  588. let param = {taskId: this.processInstanceId};
  589. const res1 = await request("/dt_screen/rest/v2/task/getDefId/", "post", param, false);
  590. this.processDefinitionId = res1.data;
  591. this.initWebsoketBpmn();
  592. this.isReady = true;
  593. // 获取地图的信息
  594. if (data.length) {
  595. // 获取任务的课目信息
  596. this.getSubjectList(this.wholeOutTaskId);
  597. // 获取任务的指令信息
  598. this.getinstructList(this.wholeOutTaskId);
  599. this.getSubjectAndMemberScore(this.wholeOutTaskId);
  600. // 建立指令websocket 链接
  601. this.initInstructWebsoket();
  602. }
  603. } else {
  604. this.$message.error(errorMessage);
  605. }
  606. },
  607. // 切换任务
  608. async changeTask() {
  609. this.$refs.hkv.stopAll()
  610. this.camaraData = []
  611. this.cardData = []
  612. this.systemSubjectId = "";
  613. this.unitSubjectValue = "";
  614. this.isReady = false;
  615. this.currentTaskName = this.taskOPtion.find((item) => item.value == this.wholeOutTaskId).label;
  616. this.currentTaskGrade = this.taskList.find((item) => item.taskId == this.wholeOutTaskId).syntheticTaskScore;
  617. // 获取任务的课目信息
  618. this.processInstanceId = this.wholeOutTaskId;
  619. let param = {taskId: this.processInstanceId};
  620. const res2 = await request("/dt_screen/rest/v2/task/getDefId/", "post", param, false);
  621. // console.log('res2 :>> ', res2.data);
  622. this.processDefinitionId = res2.data;
  623. this.isReady = true;
  624. this.getSubjectList(this.wholeOutTaskId);
  625. // 获取任务的指令信息
  626. this.getinstructList(this.wholeOutTaskId);
  627. this.getSubjectAndMemberScore(this.wholeOutTaskId);
  628. // 建立指令websocket 链接
  629. this.initInstructWebsoket();
  630. this.initWebsoketBpmn();
  631. },
  632. changeTaskAndUnit() {
  633. this.systemSubjectId=''
  634. if(this.unitSubjectValue){
  635. this.getUnitSubjectList(this.wholeOutTaskId, this.unitSubjectValue)
  636. }else {
  637. this.getSubjectList(this.wholeOutTaskId)
  638. }
  639. },
  640. changeTaskAndSystem() {
  641. this.unitSubjectValue=''
  642. if(this.systemSubjectId){
  643. this.getSystemSubjectList(this.wholeOutTaskId, this.systemSubjectId)
  644. }else {
  645. this.getSubjectList(this.wholeOutTaskId)
  646. }
  647. },
  648. // 获取任务的课目信息
  649. async getSubjectList(taskId){
  650. let params={}
  651. let that=this
  652. // console.log('获取任务的课目信息param taskId', params,taskId);
  653. const res = await request(`/dt_screen/rest/v2/subject/list/${taskId}`, 'get', params, false)
  654. const { errorCode, errorMessage, success,data } = res.data;
  655. if (success) {
  656. // console.log('获取任务的课目信息', data);
  657. if(data.length !== 0){
  658. this.subjectDatas = data
  659. data.forEach(function(obj) {
  660. let name = obj.subjectName
  661. that.SubjectInfoList.push(name.toString())
  662. });
  663. // console.log("that.SubjectInfoList1",that.SubjectInfoList)
  664. this.SubjectInfo1=this.subjectDatas[0].subjectName
  665. this.SubjectInfo2=taskId
  666. }else{
  667. this.subjectDatas = []
  668. }
  669. // console.log("this.SubjectInfo1",this.SubjectInfo1, this.SubjectInfo2)
  670. this.getSubjectAndMemberScore(taskId)
  671. this.initUrl(this.subjectDatas[0].subjectName)
  672. } else {
  673. this.$message.error(errorMessage)
  674. }
  675. },
  676. // 获取任务的指令
  677. async getinstructList (taskId) {
  678. let params={}
  679. const res = await request(`/dt_screen/rest/v2/order/list/${taskId}`, 'get', params, false)
  680. const { errorCode, errorMessage, success,data } = res.data;
  681. if (success) {
  682. console.log('获取任务的指令', data);
  683. this.instructList=data
  684. let tempData=[]
  685. data.forEach((item)=>{
  686. tempData.push([item.subjectName, item.name, item.situation, item.content, item.system,item.time])
  687. })
  688. this.scrollTableConfig.data=tempData
  689. console.log("🚀 data >> ", this.scrollTableConfig.data);
  690. this.updatekey=new Date().getTime()
  691. } else {
  692. this.$message.error(errorMessage)
  693. }
  694. },
  695. // 获取课目成绩和人员成绩
  696. async getSubjectAndMemberScore (taskId) {
  697. this.subjectScoreTableConfig.data = []
  698. this.subjectDatas.forEach((data) => {
  699. console.log("🚀 data >> ", data)
  700. let subjectScoreData = {
  701. "subjectName": data.subjectName,
  702. "subjectScore": data.overallScore === undefined ? "暂无成绩" : data.overallScore,
  703. "button": `<button @click="viewMemberTable()">查看人员成绩</button>`,
  704. // "memberScore": data.subjectScore,
  705. };
  706. this.subjectScoreTableConfig.data.push(subjectScoreData);
  707. })
  708. this.updatekey1=new Date().getTime()
  709. },
  710. // 切换单位再结合任务id 获取课目课目列表
  711. async getUnitSubjectList(taskId,unitId){
  712. let params={}
  713. params["taskId"] = taskId
  714. params["unitId"] = unitId
  715. // const res = await request(`/dt_screen/rest/v1/subject/list/task/${taskId}/unit/${unitId}`, 'get', params, false)
  716. const res = await request(`/dt_screen/rest/v2/subject/listByCondition`, 'post', params, false)
  717. const { errorCode, errorMessage, success,data } = res.data;
  718. if (success) {
  719. this.subjectDatas=data
  720. } else {
  721. this.$message.error(errorMessage)
  722. }
  723. },
  724. // 切换系统再结合任务id 获取课目课目列表
  725. async getSystemSubjectList(taskId,systemId){
  726. let params={}
  727. params["taskId"] = taskId
  728. params["systemId"] = systemId
  729. // const res = await request(`/dt_screen/rest/v1/subject/list/task/${taskId}/system/${systemId}`, 'get', params, false)
  730. const res = await request(`/dt_screen/rest/v2/subject/listByCondition`, 'post', params, false)
  731. const { errorCode, errorMessage, success,data } = res.data;
  732. if (success) {
  733. this.subjectDatas=data
  734. } else {
  735. this.$message.error(errorMessage)
  736. }
  737. },
  738. // 建立websocket 链接 任务
  739. initWebsoket(){
  740. this.websocket = new WebSocket(`ws://${this.$store.state.webSocketIp}:${this.$store.state.webSocketPort}/websocket/task`);//这里将http替换成ws
  741. switch (this.websocket.readyState) {
  742. case 0:
  743. console.log("正在连接");
  744. break;
  745. case 1:
  746. console.log("已经链接并且可以通讯");
  747. break;
  748. case 2:
  749. console.log("连接正在关闭");
  750. break;
  751. case 3:
  752. console.log("连接已关闭或者没有链接成功");
  753. break;
  754. };
  755. this.websocket.onopen = this.websocketsend;//websoket连接成功
  756. this.websocket.onmessage =this. websocketonmessage;//websoket收到信息
  757. this.websocket.onclose = this.websocketclose;//websoket连接关闭
  758. },
  759. websocketsend(){
  760. console.log('ws 连接成功');
  761. },
  762. websocketonmessage(msg){
  763. // 获取全部单位
  764. this.getAllUnits()
  765. // 获取全部系统
  766. this.getAllSystems()
  767. console.log('收到任务信息',msg);
  768. },
  769. websocketclose(){
  770. console.log('ws 连接关闭');
  771. this.initWebsoket();//重新建立连接
  772. },
  773. // 建立websocket 链接 任务
  774. initWebsoketBpmn(){
  775. this.websocketBpmn = new WebSocket(`ws://${this.$store.state.webSocketIp}:${this.$store.state.webSocketPort}/websocket/bpmn`);//这里将http替换成ws
  776. switch (this.websocketBpmn.readyState) {
  777. case 0:
  778. console.log("正在连接");
  779. break;
  780. case 1:
  781. console.log("已经链接并且可以通讯");
  782. break;
  783. case 2:
  784. console.log("连接正在关闭");
  785. break;
  786. case 3:
  787. console.log("连接已关闭或者没有链接成功");
  788. break;
  789. };
  790. this.websocketBpmn.onopen = this.bpmnWebsocketsend;//websoket连接成功
  791. this.websocketBpmn.onmessage =this.bpmnWebsocketonmessage;//websoket收到信息
  792. this.websocketBpmn.onclose = this.bpmnWebsocketclose;//websoket连接关闭
  793. },
  794. bpmnWebsocketsend(){
  795. console.log('ws 连接成功');
  796. },
  797. bpmnWebsocketonmessage(msg){
  798. // 更新流程图
  799. this.$refs.FormTaskProcessViewer.getTaskHighlightData();
  800. this.$refs.FormTaskProcessViewer.getTaskProcessXml();
  801. console.log('收到指令信息',msg);
  802. },
  803. bpmnWebsocketclose(){
  804. console.log('ws 连接关闭');
  805. this.initWebsoketBpmn();//重新建立连接
  806. },
  807. initInstructWebsoket(){
  808. // 指令的ws
  809. this.websocketOrder = new WebSocket(`ws://${this.$store.state.webSocketIp}:${this.$store.state.webSocketPort}/websocket/order/${this.wholeOutTaskId}`);//这里将http替换成ws
  810. switch (this.websocketOrder.readyState) {
  811. case 0:
  812. console.log("正在连接");
  813. break;
  814. case 1:
  815. console.log("已经链接并且可以通讯");
  816. break;
  817. case 2:
  818. console.log("连接正在关闭");
  819. break;
  820. case 3:
  821. console.log("连接已关闭或者没有链接成功");
  822. break;
  823. };
  824. this.websocketOrder.onopen = this.orderWebsocketsend;//websoket连接成功
  825. this.websocketOrder.onmessage =this. orderWebsocketonmessage;//websoket收到信息
  826. this.websocketOrder.onclose = this.orderWebsocketclose;//websoket连接关闭
  827. },
  828. orderWebsocketsend(){
  829. console.log('ws 连接成功');
  830. },
  831. orderWebsocketonmessage(msg){
  832. // 获取任务的指令信息
  833. this.getinstructList(this.wholeOutTaskId)
  834. console.log('收到指令信息',msg);
  835. },
  836. orderWebsocketclose(){
  837. console.log('ws 连接关闭');
  838. this.initInstructWebsoket();//重新建立连接
  839. },
  840. // 查看成绩表格
  841. viewManData(item){
  842. this.dialogType=2
  843. this.dialogVisible=true
  844. const { subjectScore } = item
  845. if(subjectScore==null){
  846. this.gridData.data = []
  847. this.gridData.length = this.gridData.data.length
  848. }else{
  849. this.gridData.data = subjectScore
  850. this.gridData.length = this.gridData.data.length
  851. }
  852. },
  853. // 全屏事件
  854. showFull(id){
  855. // console.log('this.camaraData :>> ', this.camaraData);
  856. console.log('ckx debug 监控大屏' )
  857. this.$router.push(
  858. {
  859. path: './monitorScreen',
  860. query: {
  861. subjectInfo1:this.SubjectInfo1,
  862. subjectInfo2:this.SubjectInfo2,
  863. subjectInfoList: this.SubjectInfoList,
  864. // camaraData: JSON.stringify(this.camaraData),
  865. // cardData: JSON.stringify(this.cardData)
  866. }
  867. }
  868. )
  869. },
  870. showFull1(id){
  871. // console.log('this.camaraData :>> ', this.cardData);
  872. console.log('ckx debug 监控大屏' )
  873. this.$router.push(
  874. {
  875. path: './monitorScreen',
  876. // query: {
  877. // camaraData: JSON.stringify(this.cardData)
  878. // }
  879. query: {
  880. subjectInfo1:this.SubjectInfo1,
  881. subjectInfo2:this.SubjectInfo2,
  882. subjectInfoList:this.SubjectInfoList,
  883. // camaraData: JSON.stringify(this.camaraData),
  884. // cardData: JSON.stringify(this.cardData)
  885. }
  886. }
  887. )
  888. },
  889. // 退出全屏
  890. exitFull(){
  891. let exitFullScreen =
  892. document.exitFullScreen ||
  893. document.mozCancelFullScreen ||
  894. document.webkitExitFullscreen ||
  895. document.msExitFullscreen;
  896. if (exitFullScreen) {
  897. exitFullScreen.call(document);
  898. }
  899. this.updatekey=new Date().getTime()
  900. },
  901. // 展开全屏
  902. requestFullScreen(elem){
  903. console.log('ckx debug ', )
  904. // #兼容不同的浏览器
  905. var requestMethod =
  906. elem.requestFullScreen ||
  907. elem.webkitRequestFullScreen ||
  908. elem.mozRequestFullScreen ||
  909. elem.msRequestFullScreen;
  910. if (requestMethod) {
  911. requestMethod.call(elem);
  912. } else if (typeof window.ActiveXObject !== "undefined") {
  913. // #模拟F11 实现全屏
  914. var wscript = new ActiveXObject("WScript.Shell");
  915. if (wscript !== null) {
  916. wscript.SendKeys("{F11}");
  917. }
  918. }
  919. let that =this
  920. window.addEventListener('resize',function () {//执行
  921. let isFull = document.mozFullScreen ||
  922. document.fullScreen ||
  923. //谷歌浏览器及Webkit内核浏览器
  924. document.webkitIsFullScreen ||
  925. document.webkitRequestFullScreen ||
  926. document.mozRequestFullScreen ||
  927. document.msFullscreenEnabled
  928. if (isFull === undefined) {
  929. that.exitFull()
  930. }else {
  931. }
  932. })
  933. },
  934. checkFull() {
  935. //判断浏览器是否处于全屏状态 (需要考虑兼容问题)
  936. //火狐浏览器
  937. let isFull = document.mozFullScreen ||
  938. document.fullScreen ||
  939. //谷歌浏览器及Webkit内核浏览器
  940. document.webkitIsFullScreen ||
  941. document.webkitRequestFullScreen ||
  942. document.mozRequestFullScreen ||
  943. document.msFullscreenEnabled
  944. if (isFull === undefined) {
  945. isFull = false
  946. }
  947. return isFull;
  948. },
  949. showMoreInfo(type){
  950. if(type=='more'){
  951. this.$router.push('/situationScreen')
  952. }else {
  953. this.$router.push('/taskScreen')
  954. }
  955. },
  956. // 初始化视频
  957. initVideo(nowPlayVideoUrl,id) {
  958. let that =this
  959. // 这些options属性也可直接设置在video标签上,见 muted
  960. let options = {
  961. autoplay: true, // 设置自动播放
  962. controls: true, // 显示播放的控件
  963. sources: [
  964. // 注意,如果是以option方式设置的src,是不能实现 换台的 (即使监听了nowPlayVideoUrl也没实现)
  965. {
  966. src: nowPlayVideoUrl,
  967. type: "application/x-mpegURL" // 告诉videojs,这是一个hls流
  968. }
  969. ]
  970. };
  971. // videojs的第一个参数表示的是,文档中video的id
  972. const myPlyer= Videojs(id, options, function onPlayerReady() {
  973. console.log("onPlayerReady 中的this指的是:", this); // 这里的this是指Player,是由Videojs创建出来的实例
  974. console.log(myPlyer === this); // 这里返回的是true
  975. });
  976. this.playerList.push(myPlyer)
  977. },
  978. async initUrl(subjectName) {
  979. if (subjectName == '')
  980. return;
  981. let params = {
  982. subjectName: subjectName,
  983. taskId: this.wholeOutTaskId
  984. };
  985. this.currentSubject = subjectName;
  986. this.camaraData = [];
  987. this.cardData = [];
  988. this.hebingjiankongData = [];
  989. const res = await request("/dt_screen/rest/v2/video/videos/getSubjectUrls", "post", params, false);
  990. let index = 0;
  991. // this.SubjectInfo1=params.subjectName
  992. // this.SubjectInfo2=params.taskId
  993. // console.log("cansgu",params.subjectName,params.taskId)
  994. // console.log("res",res.data.data)
  995. this.camaraSrc = ["", "", "", "", ""];
  996. this.camaraName = ["监控名称", "监控名称", "监控名称", "监控名称", "监控名称"];
  997. for (let item in res.data.data) {
  998. // this.camaraSrc[index] = res.data.data[item].url;
  999. // this.camaraName[index++] = res.data.data[item].name;
  1000. let data = {
  1001. ip: res.data.data[item].ip,
  1002. Port: res.data.data[item].port,
  1003. Username: res.data.data[item].username,
  1004. Password: res.data.data[item].password,
  1005. channelName: res.data.data[item].channelName
  1006. };
  1007. this.camaraData.push(data);
  1008. this.hebingjiankongData.push(data);
  1009. }
  1010. setTimeout(() => {
  1011. this.HKCardShow = true
  1012. }, 800);
  1013. let params1 = {
  1014. subjectName: subjectName,
  1015. taskId: this.wholeOutTaskId
  1016. };
  1017. this.currentSubject = subjectName;
  1018. const res1 = await request("/dt_screen/rest/v2/video/videos/getSubjectCardUrls", "post", params1, false);
  1019. console.log('res1 :>> ', res1);
  1020. let index1 = 0;
  1021. this.cardSrc = ["", "", "", "", ""];
  1022. this.cardName = ["监控名称", "监控名称", "监控名称", "监控名称", "监控名称"];
  1023. for (let item in res1.data.data) {
  1024. // this.cardSrc[index1] = res1.data.data[item].url;
  1025. // this.cardName[index1++] = res1.data.data[item].name;
  1026. let data = {
  1027. ip: res1.data.data[item].ip,
  1028. Port: res1.data.data[item].port,
  1029. Username: res1.data.data[item].username,
  1030. Password: res1.data.data[item].password,
  1031. channelName: res1.data.data[item].channelName
  1032. };
  1033. this.cardData.push(data);
  1034. this.hebingjiankongData.push(data);
  1035. }
  1036. // console.log('cardData :>> ', this.cardData);
  1037. console.log('hebingjiankongData :>> ', this.hebingjiankongData);
  1038. },
  1039. resolveUrl(url){
  1040. if(url ==''){
  1041. return;
  1042. }
  1043. let data = {};
  1044. url = url.split("/");
  1045. url = url[2];
  1046. url = url.split(":");
  1047. data.Username = url[0];
  1048. data.Port = 80;
  1049. url = url[1];
  1050. url = url.split("@");
  1051. data.ip = url[1];
  1052. data.Password = url[0];
  1053. data.channelName = "test1";
  1054. return data;
  1055. },
  1056. changeVideo(subjectName) {
  1057. if (subjectName == '')
  1058. return;
  1059. if(subjectName != this.currentSubject) {
  1060. this.SubjectInfo1=subjectName;
  1061. this.currentSubject = subjectName;
  1062. // this.$refs.hkv.stopAll();
  1063. // this.$refs.hkCard.stopAll();
  1064. this.camaraData = []
  1065. this.cardData = []
  1066. this.initUrl(subjectName);
  1067. }
  1068. }
  1069. },
  1070. mounted() {
  1071. // 获取全部单位
  1072. this.getAllUnits();
  1073. // 获取全部系统
  1074. this.getAllSystems();
  1075. // 建立任务的weksocket链接
  1076. this.initWebsoket();
  1077. // this.SubjectInfo1=this.subjectName
  1078. // this.SubjectInfo2=this.taskId
  1079. // setTimeout(() => {
  1080. // this.initUrl('步坦协同课目');
  1081. // }, 1000);
  1082. // setTimeout(() => {
  1083. // console.log('this.camaraSrc :>> ', this.camaraSrc);
  1084. // for(let index = 0; index < this.camaraSrc.length;index++)
  1085. // {
  1086. // this.camaraData.push(this.resolveUrl(this.camaraSrc[index]))
  1087. // }
  1088. // console.log('this.camaraData :>> ', this.camaraData);
  1089. // }, 1000);
  1090. // setTimeout(() => {
  1091. // this.HKshow = true;
  1092. // }, 800);
  1093. // this.currentSubject = "步坦协同课目";
  1094. //
  1095. // // // 过14秒调用
  1096. // setTimeout(() => {
  1097. // for (let index = 0; index < this.camaraSrc.length; index++) {
  1098. // console.log('object :>> ',this.camaraSrc[index]);
  1099. // this.initVideo(this.camaraSrc[index], this.videoList[index]);
  1100. // }
  1101. // }, 5000);
  1102. },
  1103. beforeDestroy() {
  1104. this.HKshow = false;
  1105. if (this.playerList.length) {
  1106. this.playerList.forEach((item) => {
  1107. item.dispose();
  1108. });
  1109. }
  1110. let params ={}
  1111. const res = request("/dt_screen/video/videos/videoClose", "get", params, false);
  1112. }
  1113. };
  1114. </script>
  1115. <style scoped>
  1116. #videoPlayerTask {
  1117. width: 906px;
  1118. height: 350px;
  1119. }
  1120. #videoPlayer_first {
  1121. width: 278px;
  1122. height: 164px;
  1123. margin-right: 10px;
  1124. margin-bottom: 10px;
  1125. }
  1126. #videoPlayer_second {
  1127. width: 278px;
  1128. height: 164px;
  1129. margin-bottom: 10px;
  1130. }
  1131. #videoPlayer_third {
  1132. width: 278px;
  1133. height: 164px;
  1134. margin-right: 10px;
  1135. }
  1136. #videoPlayer_fourth {
  1137. width: 278px;
  1138. height: 164px;
  1139. }
  1140. .video_flex_style {
  1141. display: flex;
  1142. align-items: center;
  1143. flex-wrap: wrap;
  1144. padding: 10px 0;
  1145. box-sizing: border-box;
  1146. }
  1147. </style>