mainScreen.vue 37 KB

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