devicePlayer.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. <template>
  2. <div id="devicePlayer" v-loading="isLoging">
  3. <el-dialog title="视频播放" top="0" :close-on-click-modal="false" :visible.sync="showVideoDialog" :destroy-on-close="true" @close="close()">
  4. <!-- <LivePlayer v-if="showVideoDialog" ref="videoPlayer" :videoUrl="videoUrl" :error="videoError" :message="videoError" :hasaudio="hasaudio" fluent autoplay live></LivePlayer> -->
  5. <player ref="videoPlayer" :visible.sync="showVideoDialog" :videoUrl="videoUrl" :error="videoError" :message="videoError" :hasaudio="hasaudio" fluent autoplay live></player>
  6. <div id="shared" style="text-align: right; margin-top: 1rem;">
  7. <el-tabs v-model="tabActiveName" @tab-click="tabHandleClick">
  8. <el-tab-pane label="实时视频" name="media">
  9. <div style="margin-bottom: 0.5rem;">
  10. <!-- <el-button type="primary" size="small" @click="playRecord(true, '')">播放</el-button>-->
  11. <!-- <el-button type="primary" size="small" @click="startRecord()">录制</el-button>-->
  12. <!-- <el-button type="primary" size="small" @click="stopRecord()">停止录制</el-button>-->
  13. </div>
  14. <div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;">
  15. <span style="width: 5rem; line-height: 2.5rem; text-align: right;">播放地址:</span>
  16. <el-input v-model="getPlayerShared.sharedUrl" :disabled="true" v-on:click.native="copySharedInfo(getPlayerShared.sharedUrl)"></el-input>
  17. </div>
  18. <div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;">
  19. <span style="width: 5rem; line-height: 2.5rem; text-align: right;">iframe:</span>
  20. <el-input v-model="getPlayerShared.sharedIframe" :disabled="true" v-on:click.native="copySharedInfo(getPlayerShared.sharedIframe)"></el-input>
  21. </div>
  22. <div style="display: flex; margin-bottom: 0.5rem; height: 2.5rem;">
  23. <span style="width: 5rem; line-height: 2.5rem; text-align: right;">资源地址:</span>
  24. <el-input v-model="getPlayerShared.sharedRtmp" :disabled="true" v-on:click.native="copySharedInfo(getPlayerShared.sharedRtmp)"></el-input>
  25. </div>
  26. </el-tab-pane>
  27. <!--{"code":0,"data":{"paths":["22-29-30.mp4"],"rootPath":"/home/kkkkk/Documents/ZLMediaKit/release/linux/Debug/www/record/hls/kkkkk/2020-05-11/"}}-->
  28. <el-tab-pane label="录像查询" name="record">
  29. <el-date-picker size="mini" v-model="videoHistory.date" type="date" value-format="yyyy-MM-dd" placeholder="日期" @change="queryRecords()"></el-date-picker>
  30. <el-table :data="videoHistory.searchHistoryResult" height="150" v-loading="recordsLoading">
  31. <el-table-column label="名称" prop="name"></el-table-column>
  32. <el-table-column label="文件" prop="filePath"></el-table-column>
  33. <el-table-column label="开始时间" prop="startTime" :formatter="timeFormatter"></el-table-column>
  34. <el-table-column label="结束时间" prop="endTime" :formatter="timeFormatter"></el-table-column>
  35. <el-table-column label="操作">
  36. <template slot-scope="scope">
  37. <el-button icon="el-icon-video-play" size="mini" @click="playRecord(scope.row)">播放</el-button>
  38. </template>
  39. </el-table-column>
  40. </el-table>
  41. </el-tab-pane>
  42. <!--遥控界面-->
  43. <el-tab-pane label="云台控制" name="control">
  44. <div style="display: flex; justify-content: left;">
  45. <div class="control-wrapper">
  46. <div class="control-btn control-top" @mousedown="ptzCamera(0, 2, 0)" @mouseup="ptzCamera(0, 0, 0)">
  47. <i class="el-icon-caret-top"></i>
  48. <div class="control-inner-btn control-inner"></div>
  49. </div>
  50. <div class="control-btn control-left" @mousedown="ptzCamera(2, 0, 0)" @mouseup="ptzCamera(0, 0, 0)">
  51. <i class="el-icon-caret-left"></i>
  52. <div class="control-inner-btn control-inner"></div>
  53. </div>
  54. <div class="control-btn control-bottom" @mousedown="ptzCamera(0, 1, 0)" @mouseup="ptzCamera(0, 0, 0)">
  55. <i class="el-icon-caret-bottom"></i>
  56. <div class="control-inner-btn control-inner"></div>
  57. </div>
  58. <div class="control-btn control-right" @mousedown="ptzCamera(1, 0, 0)" @mouseup="ptzCamera(0, 0, 0)">
  59. <i class="el-icon-caret-right"></i>
  60. <div class="control-inner-btn control-inner"></div>
  61. </div>
  62. <div class="control-round">
  63. <div class="control-round-inner"><i class="fa fa-pause-circle"></i></div>
  64. </div>
  65. <div style="position: absolute; left: 7.25rem; top: 1.25rem" @mousedown="ptzCamera(0, 0, 1)" @mouseup="ptzCamera(0, 0, 0)"><i class="el-icon-zoom-in" style="font-size: 1.875rem;"></i></div>
  66. <div style="position: absolute; left: 7.25rem; top: 3.25rem; font-size: 1.875rem;" @mousedown="ptzCamera(0, 0, 2)" @mouseup="ptzCamera(0, 0, 0)"><i class="el-icon-zoom-out"></i></div>
  67. </div>
  68. <div class="control-panel">
  69. <el-button-group>
  70. <el-tag style="position :absolute; left: 0rem; top: 0rem; width: 5rem; text-align: center" size="medium" type="info">预置位编号</el-tag>
  71. <el-input-number style="position: absolute; left: 5rem; top: 0rem; width: 6rem" size="mini" v-model="presetPos" controls-position="right" :precision="0" :step="1" :min="1" :max="255"></el-input-number>
  72. <el-button style="position: absolute; left: 11rem; top: 0rem; width: 5rem" size="mini" icon="el-icon-add-location" @click="presetPosition(129, presetPos)">设置</el-button>
  73. <el-button style="position: absolute; left: 27rem; top: 0rem; width: 5rem" size="mini" type="primary" icon="el-icon-place" @click="presetPosition(130, presetPos)">调用</el-button>
  74. <el-button style="position: absolute; left: 16rem; top: 0rem; width: 5rem" size="mini" icon="el-icon-delete-location" @click="presetPosition(131, presetPos)">删除</el-button>
  75. <el-tag style="position :absolute; left: 0rem; top: 2.5rem; width: 5rem; text-align: center" size="medium" type="info">巡航速度</el-tag>
  76. <el-input-number style="position: absolute; left: 5rem; top: 2.5rem; width: 6rem" size="mini" v-model="cruisingSpeed" controls-position="right" :precision="0" :min="1" :max="4095"></el-input-number>
  77. <el-button style="position: absolute; left: 11rem; top: 2.5rem; width: 5rem" size="mini" icon="el-icon-loading" @click="setSpeedOrTime(134, cruisingGroup, cruisingSpeed)">设置</el-button>
  78. <el-tag style="position :absolute; left: 16rem; top: 2.5rem; width: 5rem; text-align: center" size="medium" type="info">停留时间</el-tag>
  79. <el-input-number style="position: absolute; left: 21rem; top: 2.5rem; width: 6rem" size="mini" v-model="cruisingTime" controls-position="right" :precision="0" :min="1" :max="4095"></el-input-number>
  80. <el-button style="position: absolute; left: 27rem; top: 2.5rem; width: 5rem" size="mini" icon="el-icon-timer" @click="setSpeedOrTime(135, cruisingGroup, cruisingTime)">设置</el-button>
  81. <el-tag style="position :absolute; left: 0rem; top: 4.5rem; width: 5rem; text-align: center" size="medium" type="info">巡航组编号</el-tag>
  82. <el-input-number style="position: absolute; left: 5rem; top: 4.5rem; width: 6rem" size="mini" v-model="cruisingGroup" controls-position="right" :precision="0" :min="0" :max="255"></el-input-number>
  83. <el-button style="position: absolute; left: 11rem; top: 4.5rem; width: 5rem" size="mini" icon="el-icon-add-location" @click="setCommand(132, cruisingGroup, presetPos)">添加点</el-button>
  84. <el-button style="position: absolute; left: 16rem; top: 4.5rem; width: 5rem" size="mini" icon="el-icon-delete-location" @click="setCommand(133, cruisingGroup, presetPos)">删除点</el-button>
  85. <el-button style="position: absolute; left: 21rem; top: 4.5rem; width: 5rem" size="mini" icon="el-icon-delete" @click="setCommand(133, cruisingGroup, 0)">删除组</el-button>
  86. <el-button style="position: absolute; left: 27rem; top: 5rem; width: 5rem" size="mini" type="primary" icon="el-icon-video-camera-solid" @click="setCommand(136, cruisingGroup, 0)">巡航</el-button>
  87. <el-tag style="position :absolute; left: 0rem; top: 7rem; width: 5rem; text-align: center" size="medium" type="info">扫描速度</el-tag>
  88. <el-input-number style="position: absolute; left: 5rem; top: 7rem; width: 6rem" size="mini" v-model="scanSpeed" controls-position="right" :precision="0" :min="1" :max="4095"></el-input-number>
  89. <el-button style="position: absolute; left: 11rem; top: 7rem; width: 5rem" size="mini" icon="el-icon-loading" @click="setSpeedOrTime(138, scanGroup, scanSpeed)">设置</el-button>
  90. <el-tag style="position :absolute; left: 0rem; top: 9rem; width: 5rem; text-align: center" size="medium" type="info">扫描组编号</el-tag>
  91. <el-input-number style="position: absolute; left: 5rem; top: 9rem; width: 6rem" size="mini" v-model="scanGroup" controls-position="right" :precision="0" :step="1" :min="0" :max="255"></el-input-number>
  92. <el-button style="position: absolute; left: 11rem; top: 9rem; width: 5rem" size="mini" icon="el-icon-d-arrow-left" @click="setCommand(137, scanGroup, 1)">左边界</el-button>
  93. <el-button style="position: absolute; left: 16rem; top: 9rem; width: 5rem" size="mini" icon="el-icon-d-arrow-right" @click="setCommand(137, scanGroup, 2)">右边界</el-button>
  94. <el-button style="position: absolute; left: 27rem; top: 7rem; width: 5rem" size="mini" type="primary" icon="el-icon-video-camera-solid" @click="setCommand(137, scanGroup, 0)">扫描</el-button>
  95. <el-button style="position: absolute; left: 27rem; top: 9rem; width: 5rem" size="mini" type="danger" icon="el-icon-switch-button" @click="ptzCamera(0, 0, 0)">停止</el-button>
  96. </el-button-group>
  97. </div>
  98. </div>
  99. </el-tab-pane>
  100. <el-tab-pane label="编码信息" name="codec" v-loading="tracksLoading">
  101. <p>
  102. 无法播放或者没有声音?&nbsp&nbsp&nbsp试一试
  103. <el-button size="mini" type="primary" v-if="!coverPlaying" @click="coverPlay">转码播放</el-button>
  104. <el-button size="mini" type="danger" v-if="coverPlaying" @click="convertStopClick">停止转码</el-button>
  105. </p>
  106. <div class="trank" >
  107. <div v-for="(item, index) in tracks">
  108. <span >流 {{index}}</span>
  109. <div class="trankInfo" v-if="item.codec_type == 0">
  110. <p>格式: {{item.codec_id_name}}</p>
  111. <p>类型: 视频</p>
  112. <p>分辨率: {{item.width}} x {{item.height}}</p>
  113. <p>帧率: {{item.fps}}</p>
  114. </div>
  115. <div class="trankInfo" v-if="item.codec_type == 1">
  116. <p>格式: {{item.codec_id_name}}</p>
  117. <p>类型: 音频</p>
  118. <p>采样位数: {{item.sample_bit}}</p>
  119. <p>采样率: {{item.sample_rate}}</p>
  120. </div>
  121. </div>
  122. </div>
  123. </el-tab-pane>
  124. </el-tabs>
  125. </div>
  126. </el-dialog>
  127. </div>
  128. </template>
  129. <script>
  130. import player from './player.vue'
  131. export default {
  132. name: 'devicePlayer',
  133. props: {},
  134. components: {
  135. player,
  136. },
  137. computed: {
  138. getPlayerShared: function () {
  139. return {
  140. sharedUrl: window.location.host + '/' + this.videoUrl,
  141. sharedIframe: '<iframe src="' + window.location.host + '/' + this.videoUrl + '"></iframe>',
  142. sharedRtmp: this.videoUrl
  143. };
  144. }
  145. },
  146. created() {},
  147. data() {
  148. return {
  149. video: 'http://lndxyj.iqilu.com/public/upload/2019/10/14/8c001ea0c09cdc59a57829dabc8010fa.mp4',
  150. videoUrl: '',
  151. videoHistory: {
  152. date: '',
  153. searchHistoryResult: [] //媒体流历史记录搜索结果
  154. },
  155. showVideoDialog: false,
  156. ssrc: '',
  157. streamId: '',
  158. convertKey: '',
  159. deviceId: '',
  160. channelId: '',
  161. tabActiveName: 'media',
  162. hasaudio: false,
  163. loadingRecords: false,
  164. recordsLoading: false,
  165. isLoging: false,
  166. timeVal: 0,
  167. timeMin: 0,
  168. timeMax: 1440,
  169. presetPos: 1,
  170. cruisingSpeed: 100,
  171. cruisingTime: 5,
  172. cruisingGroup: 0,
  173. scanSpeed: 100,
  174. scanGroup: 0,
  175. tracks: [],
  176. coverPlaying:false,
  177. tracksLoading: false
  178. };
  179. },
  180. methods: {
  181. tabHandleClick: function(tab, event) {
  182. console.log(tab)
  183. var that = this;
  184. that.tracks = [];
  185. that.tracksLoading = true;
  186. if (tab.name == "codec") {
  187. this.$axios({
  188. method: 'get',
  189. url: '/zlm/index/api/getMediaInfo?vhost=__defaultVhost__&schema=rtmp&app=rtp&stream='+ this.streamId
  190. }).then(function (res) {
  191. that.tracksLoading = false;
  192. if (res.data.code == 0 && res.data.online) {
  193. that.tracks = res.data.tracks;
  194. }else{
  195. that.$message({
  196. showClose: true,
  197. message: '获取编码信息失败,',
  198. type: 'warning'
  199. });
  200. }
  201. }).catch(function (e) {});
  202. }
  203. },
  204. openDialog: function (tab, deviceId, channelId, param) {
  205. this.tabActiveName = tab;
  206. this.channelId = channelId;
  207. this.deviceId = deviceId;
  208. this.ssrc = "";
  209. this.streamId = "";
  210. this.videoUrl = ""
  211. if (!!this.$refs.videoPlayer) {
  212. this.$refs.videoPlayer.pause();
  213. }
  214. switch (tab) {
  215. case "media":
  216. this.play(param.streamInfo, param.hasAudio)
  217. break;
  218. case "record":
  219. this.showVideoDialog = true;
  220. this.videoHistory.date = param.date;
  221. this.queryRecords()
  222. break;
  223. case "control":
  224. break;
  225. }
  226. },
  227. timeAxisSelTime: function (val) {
  228. console.log(val)
  229. },
  230. play: function (streamInfo, hasAudio) {
  231. this.hasaudio = hasAudio;
  232. this.isLoging = false;
  233. this.videoUrl = streamInfo.ws_flv;
  234. this.ssrc = streamInfo.ssrc;
  235. this.streamId = streamInfo.streamId;
  236. this.playFromStreamInfo(false, streamInfo)
  237. },
  238. coverPlay: function () {
  239. var that = this;
  240. this.coverPlaying = true;
  241. this.$refs.videoPlayer.pause()
  242. that.$axios({
  243. method: 'post',
  244. url: '/api/play/' + that.ssrc + '/convert'
  245. }).then(function (res) {
  246. if (res.data.code == 0) {
  247. that.convertKey = res.data.key;
  248. setTimeout(()=>{
  249. that.isLoging = false;
  250. that.playFromStreamInfo(false, res.data.data);
  251. }, 2000)
  252. } else {
  253. that.isLoging = false;
  254. that.coverPlaying = false;
  255. that.$message({
  256. showClose: true,
  257. message: '转码失败',
  258. type: 'error'
  259. });
  260. }
  261. }).catch(function (e) {
  262. console.log(e)
  263. that.coverPlaying = false;
  264. that.$message({
  265. showClose: true,
  266. message: '播放错误',
  267. type: 'error'
  268. });
  269. });
  270. },
  271. convertStopClick: function() {
  272. this.convertStop(()=>{
  273. this.$refs.videoPlayer.play(this.videoUrl)
  274. });
  275. },
  276. convertStop: function(callback) {
  277. var that = this;
  278. that.$refs.videoPlayer.pause()
  279. this.$axios({
  280. method: 'post',
  281. url: '/api/play/convert/stop/' + this.convertKey
  282. }).then(function (res) {
  283. if (res.data.code == 0) {
  284. console.log(res.data.msg)
  285. }else {
  286. console.error(res.data.msg)
  287. }
  288. if (callback )callback();
  289. }).catch(function (e) {});
  290. that.coverPlaying = false;
  291. that.convertKey = "";
  292. // if (callback )callback();
  293. },
  294. playFromStreamInfo: function (realHasAudio, streamInfo) {
  295. this.showVideoDialog = true;
  296. this.hasaudio = realHasAudio && this.hasaudio;
  297. this.$refs.videoPlayer.play(streamInfo.ws_flv)
  298. },
  299. close: function () {
  300. console.log('关闭视频');
  301. if (!!this.$refs.videoPlayer){
  302. this.$refs.videoPlayer.pause();
  303. }
  304. this.videoUrl = '';
  305. this.coverPlaying = false;
  306. this.showVideoDialog = false;
  307. if (this.convertKey != '') {
  308. this.convertStop();
  309. }
  310. this.convertKey = ''
  311. },
  312. copySharedInfo: function (data) {
  313. console.log('复制内容:' + data);
  314. this.coverPlaying = false;
  315. this.tracks = []
  316. let _this = this;
  317. this.$copyText(data).then(
  318. function (e) {
  319. _this.$message({
  320. showClose: true,
  321. message: '复制成功',
  322. type: 'success'
  323. });
  324. },
  325. function (e) {
  326. _this.$message({
  327. showClose: true,
  328. message: '复制失败,请手动复制',
  329. type: 'error'
  330. });
  331. }
  332. );
  333. },
  334. queryRecords: function () {
  335. if (!this.videoHistory.date) {
  336. return;
  337. }
  338. this.recordsLoading = true;
  339. this.videoHistory.searchHistoryResult = [];
  340. let that = this;
  341. var startTime = this.videoHistory.date + " 00:00:00";
  342. var endTime = this.videoHistory.date + " 23:59:59";
  343. this.$axios({
  344. method: 'get',
  345. url: '/api/record/' + this.deviceId + '/' + this.channelId + '?startTime=' + startTime + '&endTime=' + endTime
  346. }).then(function (res) {
  347. // 处理时间信息
  348. that.videoHistory.searchHistoryResult = res.data.recordList;
  349. that.recordsLoading = false;
  350. }).catch(function (e) {
  351. console.log(e.message);
  352. // that.videoHistory.searchHistoryResult = falsificationData.recordData;
  353. });
  354. },
  355. onTimeChange: function (video) {
  356. // this.queryRecords()
  357. },
  358. playRecord: function (row) {
  359. let that = this;
  360. if (that.ssrc != "") {
  361. that.stopPlayRecord(function () {
  362. that.ssrc = "",
  363. that.playRecord(row);
  364. })
  365. } else {
  366. this.$axios({
  367. method: 'get',
  368. url: '/api/playback/' + this.deviceId + '/' + this.channelId + '?startTime=' + row.startTime + '&endTime=' +
  369. row.endTime
  370. }).then(function (res) {
  371. var streamInfo = res.data;
  372. that.ssrc = streamInfo.ssrc;
  373. that.videoUrl = streamInfo.ws_flv;
  374. });
  375. }
  376. },
  377. stopPlayRecord: function (callback) {
  378. this.$refs.videoPlayer.pause();
  379. this.videoUrl = '';
  380. this.$axios({
  381. method: 'get',
  382. url: '/api/playback/' + this.ssrc + '/stop'
  383. }).then(function (res) {
  384. if (callback) callback()
  385. });
  386. },
  387. ptzCamera: function (leftRight, upDown, zoom) {
  388. console.log('云台控制:' + leftRight + ' : ' + upDown + " : " + zoom);
  389. let that = this;
  390. this.$axios({
  391. method: 'post',
  392. // url: '/api/ptz/' + this.deviceId + '/' + this.channelId + '?leftRight=' + leftRight + '&upDown=' + upDown +
  393. // '&inOut=' + zoom + '&moveSpeed=50&zoomSpeed=50'
  394. url: '/api/ptz/' + this.deviceId + '/' + this.channelId + '?cmdCode=' + (zoom * 16 + upDown * 4 + leftRight) + '&horizonSpeed=30&verticalSpeed=30&zoomSpeed=' + (2 * 16)
  395. }).then(function (res) {});
  396. },
  397. //////////////////////播放器事件处理//////////////////////////
  398. videoError: function (e) {
  399. console.log("播放器错误:" + JSON.stringify(e));
  400. },
  401. presetPosition: function (cmdCode, presetPos) {
  402. console.log('预置位控制:' + this.presetPos + ' : 0x' + cmdCode.toString(16));
  403. let that = this;
  404. this.$axios({
  405. method: 'post',
  406. url: '/api/frontEndCommand/' + this.deviceId + '/' + this.channelId + '?cmdCode=' + cmdCode + '&parameter1=0&parameter2=' + presetPos + '&combindCode2=0'
  407. }).then(function (res) {});
  408. },
  409. setSpeedOrTime: function (cmdCode, groupNum, parameter) {
  410. let that = this;
  411. let parameter2 = parameter % 256;
  412. let combindCode2 = Math.floor(parameter / 256) * 16;
  413. console.log('前端控制:0x' + cmdCode.toString(16) + ' 0x' + groupNum.toString(16) + ' 0x' + parameter2.toString(16) + ' 0x' + combindCode2.toString(16));
  414. this.$axios({
  415. method: 'post',
  416. url: '/api/frontEndCommand/' + this.deviceId + '/' + this.channelId + '?cmdCode=' + cmdCode + '&parameter1=' + groupNum + '&parameter2=' + parameter2 + '&combindCode2=' + combindCode2
  417. }).then(function (res) {});
  418. },
  419. setCommand: function (cmdCode, groupNum, parameter) {
  420. let that = this;
  421. console.log('前端控制:0x' + cmdCode.toString(16) + ' 0x' + groupNum.toString(16) + ' 0x' + parameter.toString(16) + ' 0x0');
  422. this.$axios({
  423. method: 'post',
  424. url: '/api/frontEndCommand/' + this.deviceId + '/' + this.channelId + '?cmdCode=' + cmdCode + '&parameter1=' + groupNum + '&parameter2=' + parameter + '&combindCode2=0'
  425. }).then(function (res) {});
  426. },
  427. formatTooltip: function (val) {
  428. var h = parseInt(val / 60);
  429. var hStr = h < 10 ? ("0" + h) : h;
  430. var s = val % 60;
  431. var sStr = s < 10 ? ("0" + s) : s;
  432. return h + ":" + sStr;
  433. },
  434. timeFormatter: function (row, column, cellValue, index) {
  435. return cellValue.split(" ")[1];
  436. },
  437. mergeTime: function (timeArray) {
  438. var resultArray = [];
  439. for (let i = 0; i < timeArray.length; i++) {
  440. var startTime = new Date(timeArray[i].startTime);
  441. var endTime = new Date(timeArray[i].endTime);
  442. if (i == 0) {
  443. resultArray[0] = {
  444. startTime: startTime,
  445. endTime: endTime
  446. }
  447. }
  448. for (let j = 0; j < resultArray.length; j++) {
  449. if (startTime > resultArray[j].endTime) { // 合并
  450. if (startTime - resultArray[j].endTime <= 1000) {
  451. resultArray[j].endTime = endTime;
  452. } else {
  453. resultArray[resultArray.length] = {
  454. startTime: startTime,
  455. endTime: endTime
  456. }
  457. }
  458. } else if (resultArray[j].startTime > endTime) { // 合并
  459. if (resultArray[j].startTime - endTime <= 1000) {
  460. resultArray[j].startTime = startTime;
  461. } else {
  462. resultArray[resultArray.length] = {
  463. startTime: startTime,
  464. endTime: endTime
  465. }
  466. }
  467. }
  468. }
  469. }
  470. console.log(resultArray)
  471. return resultArray;
  472. }
  473. }
  474. };
  475. </script>
  476. <style>
  477. .control-wrapper {
  478. position: relative;
  479. width: 6.25rem;
  480. height: 6.25rem;
  481. max-width: 6.25rem;
  482. max-height: 6.25rem;
  483. border-radius: 100%;
  484. margin-top: 2.5rem;
  485. margin-left: 0.5rem;
  486. float: left;
  487. }
  488. .control-panel {
  489. position: relative;
  490. top: 0;
  491. left: 5rem;
  492. height: 11rem;
  493. max-height: 11rem;
  494. }
  495. .control-btn {
  496. display: flex;
  497. justify-content: center;
  498. position: absolute;
  499. width: 44%;
  500. height: 44%;
  501. border-radius: 5px;
  502. border: 1px solid #78aee4;
  503. box-sizing: border-box;
  504. transition: all 0.3s linear;
  505. }
  506. .control-btn i {
  507. font-size: 20px;
  508. color: #78aee4;
  509. display: flex;
  510. justify-content: center;
  511. align-items: center;
  512. }
  513. .control-round {
  514. position: absolute;
  515. top: 21%;
  516. left: 21%;
  517. width: 58%;
  518. height: 58%;
  519. background: #fff;
  520. border-radius: 100%;
  521. }
  522. .control-round-inner {
  523. position: absolute;
  524. left: 13%;
  525. top: 13%;
  526. display: flex;
  527. justify-content: center;
  528. align-items: center;
  529. width: 70%;
  530. height: 70%;
  531. font-size: 40px;
  532. color: #78aee4;
  533. border: 1px solid #78aee4;
  534. border-radius: 100%;
  535. transition: all 0.3s linear;
  536. }
  537. .control-inner-btn {
  538. position: absolute;
  539. width: 60%;
  540. height: 60%;
  541. background: #fafafa;
  542. }
  543. .control-top {
  544. top: -8%;
  545. left: 27%;
  546. transform: rotate(-45deg);
  547. border-radius: 5px 100% 5px 0;
  548. }
  549. .control-top i {
  550. transform: rotate(45deg);
  551. border-radius: 5px 100% 5px 0;
  552. }
  553. .control-top .control-inner {
  554. left: -1px;
  555. bottom: 0;
  556. border-top: 1px solid #78aee4;
  557. border-right: 1px solid #78aee4;
  558. border-radius: 0 100% 0 0;
  559. }
  560. .control-top .fa {
  561. transform: rotate(45deg) translateY(-7px);
  562. }
  563. .control-left {
  564. top: 27%;
  565. left: -8%;
  566. transform: rotate(45deg);
  567. border-radius: 5px 0 5px 100%;
  568. }
  569. .control-left i {
  570. transform: rotate(-45deg);
  571. }
  572. .control-left .control-inner {
  573. right: -1px;
  574. top: -1px;
  575. border-bottom: 1px solid #78aee4;
  576. border-left: 1px solid #78aee4;
  577. border-radius: 0 0 0 100%;
  578. }
  579. .control-left .fa {
  580. transform: rotate(-45deg) translateX(-7px);
  581. }
  582. .control-right {
  583. top: 27%;
  584. right: -8%;
  585. transform: rotate(45deg);
  586. border-radius: 5px 100% 5px 0;
  587. }
  588. .control-right i {
  589. transform: rotate(-45deg);
  590. }
  591. .control-right .control-inner {
  592. left: -1px;
  593. bottom: -1px;
  594. border-top: 1px solid #78aee4;
  595. border-right: 1px solid #78aee4;
  596. border-radius: 0 100% 0 0;
  597. }
  598. .control-right .fa {
  599. transform: rotate(-45deg) translateX(7px);
  600. }
  601. .control-bottom {
  602. left: 27%;
  603. bottom: -8%;
  604. transform: rotate(45deg);
  605. border-radius: 0 5px 100% 5px;
  606. }
  607. .control-bottom i {
  608. transform: rotate(-45deg);
  609. }
  610. .control-bottom .control-inner {
  611. top: -1px;
  612. left: -1px;
  613. border-bottom: 1px solid #78aee4;
  614. border-right: 1px solid #78aee4;
  615. border-radius: 0 0 100% 0;
  616. }
  617. .control-bottom .fa {
  618. transform: rotate(-45deg) translateY(7px);
  619. }
  620. .trank {
  621. width: 80%;
  622. height: 180px;
  623. text-align: left;
  624. padding: 0 10%;
  625. overflow: auto;
  626. }
  627. .trankInfo {
  628. width: 80%;
  629. padding: 0 10%;
  630. }
  631. </style>