From 84adad2cc7c2c8285b6064d804039bfb24bef6ed Mon Sep 17 00:00:00 2001 From: wangzemei Date: Tue, 18 Oct 2022 16:32:06 +0800 Subject: [PATCH] * task 72350 --- module/report/css/annualdata.css | 70 +++++++++ module/report/js/annualdata.js | 2 + module/report/js/processor.js | 46 ++++++ module/report/view/annualdata.html.php | 192 ++++++++++++++++++++++++- 4 files changed, 308 insertions(+), 2 deletions(-) create mode 100644 module/report/js/processor.js diff --git a/module/report/css/annualdata.css b/module/report/css/annualdata.css index eca95154a2..f97e6720f1 100644 --- a/module/report/css/annualdata.css +++ b/module/report/css/annualdata.css @@ -82,3 +82,73 @@ section.active {border: 1px solid rgb(0, 166, 255);} .dataYearStat .canvas {float: left; height: 305px; padding-left: 30px;} .dataYearStat .canvas.left {width: 450px;} .dataYearStat .canvas.right {width: 810px; float: right;} + +#timeline { + display: inline-block; + width: 310px; + padding-top: 20px; + list-style: none; + text-align: center; + margin-left: 25px; + } + .scroll-shell { + position: relative; + } + #stopPlaying { + font-size: 18px; + position: absolute; + left: 0; + top: 8px; + } + + #timeline li { + display: inline-block; + cursor: pointer; + color: #444; + padding: 0 5px; + margin: 0; + position: relative; + } + + + #timeline li::before{ + content: ''; + display: inline-block; + width: 8px; + height: 8px; + border-radius: 4px; + background: #fff; + position: absolute; + left: 20px; + top: -8px; + z-index: 2; + } + #timeline li::after{content: ''; display: block; width: 100%; height: 2px; border-radius: 1px; background: #fff; position: absolute; left: -20px; top: -5px;} + + .biaoqian { + background-size: 60px 24px; + } + + #timeline .selecteded { + color: #1a77a5; + /* background: url('img/tuoyuan2.png') 0 15px no-repeat; + background-size: 20px 20px; */ + } + #timeline .selecteded::before { + background: #1a77a5; + } + + .scroll-shell { + width: 100px; + height: 96%; + margin-top: 1.5%; + float: left; + overflow: hidden; + } +.scroll-shell {width: 330px;} +.scroll { + width: 330px; + height: 103%; + overflow: auto; + overflow-x: hidden; +} \ No newline at end of file diff --git a/module/report/js/annualdata.js b/module/report/js/annualdata.js index 67fa201cc7..31d654ce20 100644 --- a/module/report/js/annualdata.js +++ b/module/report/js/annualdata.js @@ -52,6 +52,7 @@ function drawStatusPieChart(id, title, data, callback) itemHeight: legendItemHeight, textStyle: legendTextStyle, }, + saveAsImage: {}, series: [ { name: title, @@ -186,6 +187,7 @@ function exportAnnualImage(sucessCallback, errorCallback) if(sucessCallback) sucessCallback(imageUrl); afterFinish(canvas); }); + console.log(imageUrl); }); } diff --git a/module/report/js/processor.js b/module/report/js/processor.js new file mode 100644 index 0000000000..dd8093fed1 --- /dev/null +++ b/module/report/js/processor.js @@ -0,0 +1,46 @@ +let processor = { + timerCallback: function() { + if (this.video.paused || this.video.ended) { + return; + } + this.computeFrame(); + let self = this; + setTimeout(function () { + self.timerCallback(); + }, 0); + }, + + doLoad: function() { + this.video = document.getElementById("video"); + this.c1 = document.getElementById("c1"); + this.ctx1 = this.c1.getContext("2d"); + this.c2 = document.getElementById("c2"); + this.ctx2 = this.c2.getContext("2d"); + let self = this; + this.video.addEventListener("play", function() { + self.width = self.video.videoWidth / 2; + self.height = self.video.videoHeight / 2; + self.timerCallback(); + }, false); + }, + + computeFrame: function() { + this.ctx1.drawImage(this.video, 0, 0, this.width, this.height); + let frame = this.ctx1.getImageData(0, 0, this.width, this.height); + let l = frame.data.length / 4; + + for (let i = 0; i < l; i++) { + let r = frame.data[i * 4 + 0]; + let g = frame.data[i * 4 + 1]; + let b = frame.data[i * 4 + 2]; + if (g > 100 && r > 100 && b < 43) + frame.data[i * 4 + 3] = 0; + } + this.ctx2.putImageData(frame, 0, 0); + return; + } +}; + +document.addEventListener("DOMContentLoaded", () => { +processor.doLoad(); +}); \ No newline at end of file diff --git a/module/report/view/annualdata.html.php b/module/report/view/annualdata.html.php index 4cf774c9c2..bc932a46a6 100644 --- a/module/report/view/annualdata.html.php +++ b/module/report/view/annualdata.html.php @@ -5,6 +5,7 @@ report->annualData;?> report->annualData;?> soFar, $year);?> +
)'>
) top no-repeat'>