ソースを参照

Update 优化演练画像,评估报告及其导出

Yue 1 年間 前
コミット
2722bf4f6e

+ 62 - 55
SourceCode/WeApp.Web/Views/Shared/Camp/_Report.cshtml

@@ -94,8 +94,6 @@
                     word-break: break-all;
                 }
 
-
-
     .play-chart-box, .play-scene-box {
         width: 100%;
         display: flex;
@@ -162,19 +160,22 @@
             border: 1px dashed;
             background: #e7f0f3;
         }
-    .scene-box .behavior-info .progress {
-        background: #c7f0f3;
-        margin: 5px 0;
-    }
-    .scene-box .behavior-info .progress-bar {
+
+            .scene-box .behavior-info .progress {
+                background: #c7f0f3;
+                margin: 5px 0;
+            }
+
+            .scene-box .behavior-info .progress-bar {
+                background-color: #02595a;
+            }
+
+    .btn.btn-iwb {
+        color: #fff;
         background-color: #02595a;
+        border-color: #02595a;
+        box-shadow: none;
     }
-        .btn.btn-iwb {
-            color: #fff;
-            background-color: #02595a;
-            border-color: #02595a;
-            box-shadow: none;
-        }
 
     .table-box .table th, .table td {
         text-align: center;
@@ -246,6 +247,10 @@
             margin: 0 8px;
         }
 
+        .table-box .t-level.l-0 {
+            background: #ddd;
+        }
+
         .table-box .t-level.l-1 {
             background: #f00
         }
@@ -361,7 +366,6 @@
             <div class="play-scene-box">
                 <div class="chart-title">演练过程得分详解:</div>
                 <div id="scene-box" class="scene-info-box">
-
                 </div>
             </div>
         </div>
@@ -381,7 +385,6 @@
             <div class="play-scene-box">
                 <div class="chart-title">五力评析:</div>
                 <div id="wl-chart" class="chart-box">
-
                 </div>
             </div>
         </div>
@@ -401,7 +404,6 @@
             <div class="play-scene-box">
                 <div class="chart-title">专家评语:</div>
                 <div id="zj-review" class="review-box">
-
                 </div>
             </div>
         </div>
@@ -414,7 +416,6 @@
     </div>
 }
 
-
 @using (Html.BeginScripts())
 {
     <script src="~/Content/Libs/eCharts/echarts.min.js"></script>
@@ -432,10 +433,8 @@
     @*<script src="~/Content/Libs/html2canva/html2canvas.min.js"></script>
         <script src="~/Content/Libs/jsPdf/jspdf.min.js.js"></script>
         <script src="~/Content/Libs/jsPdf/html2pdf.js"></script>*@
-    
-    <script>
-   
 
+    <script>
     </script>
     <script id="report-data-script">
         var t;
@@ -556,6 +555,7 @@
         function TagRoundFormatter(data) {
             var str = '';
             if (data && data.length) {
+                console.log("TG", data)
                 str = '<table class="table table-bordered">';
                 data.forEach(function (v) {
                     var level = '<div class="l-box"><span class="t-level l-1 big"></span><span>及格</span></div>';
@@ -563,9 +563,9 @@
                     level += '<div class="l-box"><span class="t-level l-3 big"></span><span>优秀</span></div>';
                     str +=
                         '<thead><tr><th class="round-tag" colspan="20"><strong>第{0}轮</strong><div class="level-box">{1}</div></th></tr></thead>'
-                        .format(
-                            v.roundIndex,
-                            level);
+                            .format(
+                                v.roundIndex,
+                                level);
                     var isFirst = true;
                     v.sceneInfos.forEach(function (a) {
                         str += TagFormatter(a, isFirst);
@@ -576,6 +576,7 @@
                     v.behaviorTags.forEach(function (vv) {
                         str += '<td class=""> <span class="t-level l-{0}"><span></td>'.format(vv.level);
                     });
+
                     str += '</tr></tbody>';
                 });
 
@@ -602,9 +603,16 @@
                 }
                 str += '<tr>';
                 str += '<td class="">{0}</td>'.format(data.name);
-                data.behaviorTags.forEach(function (v) {
-                    str += '<td class=""> <span class="t-level l-{0}"><span></td>'.format(v.level);
-                });
+
+                if (data.behaviorTags.length) {
+                    data.behaviorTags.forEach(function (v) {
+                        str += '<td class=""> <span class="t-level l-{0}"><span></td>'.format(v.level);
+                    });
+                } else {
+                    for (var i = 0; i < 9; i++) {
+                        str += '<td class=""> <span class="t-level l-0"><span></td>';
+                    }
+                }
                 str += '</tr>';
             }
             return str;
@@ -617,14 +625,14 @@
             if (data && data.length) {
                 data.forEach(function(v) {
                     if (v.type == @(PortraitRemarkTypeDefinition.ZhuanJia)) {
-                        var s = '<div class="review"><span>{0}</span></div>'.format(v.content);
+                        var s = '<div class="review"><span>{0}</span></div>'.format(v.content || "无");
                         if (s) {
                             $('#zj-review').html(s);
                         }
                     } else {
                         str += '<div class="review">';
                         str += '<strong>{0}</strong>'.format(GetReviewName(v.type));
-                        str += '<span>{0}</span>'.format(v.content);
+                        str += '<span>{0}</span>'.format(v.content || "无");
                         str += '</div>';
                     }
                 });
@@ -868,7 +876,7 @@
                 return;
             }
             if (data && data.length > 0) {
-                // console.log("RoundScore", data);
+                console.log("RoundScore", data);
             } else {
                 console.log("RoundScore-Null");
                 return;
@@ -1211,7 +1219,7 @@
                     newItem.name = newItem.name.indexOf('情景流') == 0
                         ? "情景流"
                         : newItem.name.indexOf('情景') == 0
-                        ? "情景"
+                            ? "情景"
                             : newItem.name;
                     newItem.collapsed = true;
 
@@ -1245,7 +1253,6 @@
         function atou(str) {
             return decodeURIComponent(escape(window.atob(str)));
         }
-
     </script>
 
     <script>
@@ -1259,13 +1266,13 @@
     {
         <script>
             setTimeout(function () { $('.preloader').fadeOut(600); }, 50);
-           
+
             var hasLoad = false;
             $(function() {
                 $('#export button').text("导出PDF").prop("disabled", false);
                 hasLoad = true;
             });
-            
+
             function ExportSql() {
                 if (!hasLoad) {
                     $('#export button').text("正在加载PDF导出插件").prop("disabled", true);
@@ -1313,7 +1320,7 @@
                 doc.setTextColor(2, 89, 90);
                 w = mr;
                 h = mr;
-                Face();
+                Face(group);
                 if (group) {
                     WriteTitle("演练信息");
                     Info1(group);
@@ -1329,8 +1336,9 @@
                 doc.save("@(group.Name)演练报告@(DateTime.Now.ToString("yyyyMMddHHmm")).pdf");
             }
             //封面
-            function Face() {
-                var name = "@(SettingManager.GetSettingValue(IwbSettingNames.ReportCompany))";
+            function Face(group) {
+                //var name = "@(SettingManager.GetSettingValue(IwbSettingNames.ReportCompany))";
+                var name = group.campName;
                 var hh = mh / 2 - 50;
                 doc.setFontSize(30);
                 var l = doc.getTextDimensions(name), lw = Math.ceil(l.w), lh = Math.ceil(l.h );
@@ -1358,7 +1366,7 @@
                 //WriteText("演练分组:{0}".format(group.name));
                 ww = WriteTitleSm("培  训  营:");
                 WriteText(group.campName, ww + 1);
-                ww = WriteTitleSm("演练分组:");
+                ww = WriteTitleSm("演练主题:");
                 WriteText(group.packageName, ww);
                 ww = WriteTitleSm("演练时长:");
                 WriteText("{0} 分钟( {1} — {2} ) ".format(group.trainingMinute, new Date(group.startDate).format("yyyy-MM-dd hh:mm:ss"), new Date(group.endDate).format("yyyy-MM-dd hh:mm:ss")), ww);
@@ -1373,10 +1381,10 @@
                 h = h - 5;
                 C1();
                 AddPage();
-                WriteTitleSm("情景蜂巢图:", true);
+                @*WriteTitleSm("情景蜂巢图:", true);
                 h = h - 5;
                 C2();
-                AddPage();
+                AddPage();*@
                 WriteTitleSm("演练过程得分详解:", true);
                 C3(data.scenes);
                 function C1() {
@@ -1653,14 +1661,14 @@
                 h = h + 10;
                 //WriteTitle("系统评语:", true);
                 WriteTitleSm("四项基本功:", true);
-                WriteText(data.reportEvalStrings[0].content, 0, true, 12, 2);
+                WriteText(data.reportEvalStrings[0].content || "无", 0, true, 12, 2);
                 WriteTitleSm("五项能力:", true);
-                WriteText(data.reportEvalStrings[1].content, 0, true, 12, 2);
+                WriteText(data.reportEvalStrings[1].content || "无", 0, true, 12, 2);
                 WriteTitleSm("成绩与不足:", true);
-                WriteText(data.reportEvalStrings[2].content, 0, true, 12, 2);
+                WriteText(data.reportEvalStrings[2].content || "无", 0, true, 12, 2);
 
                 WriteTitleSm("专家评语:", true);
-                WriteText(data.reportEvalStrings[3].content, 0, true, 12, 2);
+                WriteText(data.reportEvalStrings[3].content || "无", 0, true, 12, 2);
 
                 function C9(data) {
                     if (data&&data.length) {
@@ -1830,35 +1838,36 @@
                         return hh;
                     }
                     function Tags(tags, hh) {
-                        if (tags && tags.length) {
+                        if (tags ) {
                             w = mr + tw1;
-                            for (var i = 0; i < tags.length; i++) {
-                                var tag = tags[i];
+                            for (var i = 0; i < 9; i++) {
+                                var tag = tags[i]||{level:0};
                                 var ww = i == 2 || i == 7 ? tw3 : tw2;
                                 Tag(tag.level, ww, hh);
                             }
                         }
                     }
                     function Tag(level, ww, hh) {
-                        if (level != 0) {
-                            switch (level) {
+                        switch (level) {
                             case 1:
                                 doc.setDrawColor(255, 0, 0);
                                 doc.setFillColor(255, 0, 0);
-                                doc.circle(w + ww / 2, h + hh / 2, 2, "FD");
                                 break;
                             case 2:
                                 doc.setDrawColor(255, 165, 0);
                                 doc.setFillColor(255, 165, 0);
-                                doc.circle(w + ww / 2, h + hh / 2, 2, "FD");
                                 break;
                             case 3:
                                 doc.setDrawColor(0, 255, 0);
                                 doc.setFillColor(0, 255, 0);
-                                doc.circle(w + ww / 2, h + hh / 2, 2, "FD");
                                 break;
-                            }
+                            default:
+                                doc.setDrawColor(221, 221, 221);
+                                doc.setFillColor(221, 221, 221);
+                                break;
                         }
+                        doc.circle(w + ww / 2, h + hh / 2, 2, "FD");
+
                         w = w + ww;
                         doc.setDrawColor(2, 89, 90);
                         doc.line(w, h, w, h + hh);
@@ -1972,9 +1981,7 @@
                 }
                 return { w: 0, h: 0 };
             }
-
-
         </script>
 
     }
-}
+}

+ 20 - 25
SourceCode/WeApp.Web/Views/Train/Portrait.cshtml

@@ -61,7 +61,6 @@
                     <a class="nav-link " style="background: coral; border: 1px solid coral;color:#fff" href="javascript:RefreshPortrait()">重新生成画像</a>
                 </li>
             }
-
         </ul>
     }
 </div>
@@ -145,10 +144,8 @@
                                     <div class="inner-title">组织角色</div>
                                     <div class="inner-content ">
                                         <div id="cmd-info_@(id)" class="tab-box fdc">
-
                                         </div>
                                     </div>
-
                                 </div>
                             </div>
                         </div>
@@ -175,12 +172,9 @@
                                                     <button class="btn btn-iwb btn-sm" data-type="@(PortraitRemarkTypeDefinition.SiGong)">信息提示</button>
                                                     <textarea id="sg_text_@(id)" name="" style="width: 100%; height: 100%;" placeholder="四功评估简要说明"></textarea>
                                                 }
-
                                             </div>
                                         </div>
-
                                     </div>
-
                                 </div>
                                 <div class="inner-box" style="width: 38%; margin-left: 5px;">
                                     <div class="inner-title">五力评估</div>
@@ -194,7 +188,6 @@
                                                     <button class="btn btn-iwb btn-sm" data-type="@(PortraitRemarkTypeDefinition.WuLi)">信息提示</button>
                                                     <textarea id="wl_text_@(id)" name="" style="width: 100%; height: 100%;" placeholder="五力评估简要说明"></textarea>
                                                 }
-
                                             </div>
                                         </div>
                                     </div>
@@ -226,7 +219,6 @@
                                             </div>
                                         </div>
                                     </div>
-
                                 </div>
                             </div>
                         </div>
@@ -521,9 +513,9 @@
         //推演网格
         function TreePathChart(groupNo, data, idStr) {
             if (data) {
-                console.log("TreePath", data);
+                //console.log("TreePath", data);
             } else {
-                console.log("TreePath-Null");
+                //console.log("TreePath-Null");
                 return;
             }
             var isRadial = idStr == "hx";
@@ -533,7 +525,7 @@
             }
             var treeChart = echarts.init(document.getElementById(idStr)), seriesOpt = {};
             var d = ConvertTreeData(data.infos, isRadial);
-            console.log("ConvertTreeData", d);
+            //console.log("ConvertTreeData", d);
             if (isRadial) {
                 seriesOpt = {
                     layout: 'radial'
@@ -571,7 +563,7 @@
                 animationDurationUpdate: 450
             };
             var o = $.extend(true, {}, opt, seriesOpt);
-            console.log(o);
+            //console.log(o);
             var option = {
                 tooltip: {
                     trigger: 'item',
@@ -593,7 +585,7 @@
                         seriesData.push($.extend({}, { name: v.name, type: 'spline', data: v.flowInfos }));
                     });
                 }
-                console.log(seriesData);
+                //console.log(seriesData);
                 idStr = idStr + '-container_' + groupNo + '_' + data.roundIndex;
                 if ($('#' + idStr).data('use') === true) {
                     return;
@@ -678,7 +670,9 @@
 
         //轮次得分条
         function RoundScoreChart(groupNo, data) {
+            var scoreChart = echarts.init(document.getElementById('score-chart_' + groupNo));
             if ($('#score-chart_' + groupNo).data('use') === true) {
+                scoreChart.resize();
                 return;
             }
             if (data && data.length > 0) {
@@ -687,7 +681,6 @@
                 console.log("RoundScore-Null");
                 return;
             }
-            var scoreChart = echarts.init(document.getElementById('score-chart_' + groupNo));
             var series = [];
             for (var i = 1; i <= data.length; i++) {
                 var temp = {
@@ -758,22 +751,24 @@
                 series: series
             };
             scoreChart.setOption(option);
+            scoreChart.resize();
             $('#score-chart_' + groupNo).data('use', true);
 
         }
 
         //四功
         function SiGongChart(groupNo, data) {
+            var siGongChart = echarts.init(document.getElementById('sg-chart_' + groupNo));
             if ($('#sg-chart_' + groupNo).data('use') === true) {
+                siGongChart.resize();
                 return;
             }
             if (data && data.length > 0) {
-                console.log("SiGong", data);
+                //console.log("SiGong", data);
             } else {
-                console.log("SiGong-Null");
+                //console.log("SiGong-Null");
                 return;
             }
-            var siGongChart = echarts.init(document.getElementById('sg-chart_' + groupNo));
             var series = [];
             var legendDate = [];
             var sgData = [[], [], []];
@@ -889,23 +884,25 @@
                 },
                 series: series
             };
-            console.log(option);
+            //console.log(option);
             siGongChart.setOption(option);
+            siGongChart.resize();
             $('#sg-chart_' + groupNo).data('use', true);
         }
 
         //五力
         function WuLiChart(groupNo, data) {
+            var wuLiChart = echarts.init(document.getElementById('wl-chart_' + groupNo));
             if ($('#wl-chart_' + groupNo).data('use') === true) {
+                wuLiChart.resize();
                 return;
             }
             if (data && data.length > 0) {
-                console.log("WuLi", data);
+                //console.log("WuLi", data);
             } else {
-                console.log("WuLi-Null");
+                //console.log("WuLi-Null");
                 return;
             }
-            var wuLiChart = echarts.init(document.getElementById('wl-chart_' + groupNo));
             var series = [];
             var indicatorData = [];
             var wlData = [
@@ -1028,6 +1025,7 @@
             };
             //console.log(option);
             wuLiChart.setOption(option);
+            wuLiChart.resize();
             $('#wl-chart_' + groupNo).data('use', true);
         }
 
@@ -1075,7 +1073,6 @@
             }
             return newData;
         }
-
     </script>
 
     <script>
@@ -1192,7 +1189,6 @@
             }
         }
 
-
         function StateFormatter(v) {
             var name = $('#hid-state option[value="' + v + '"]').text();
             switch (v) {
@@ -1211,7 +1207,6 @@
 
 }
 
-
 <section style="display: none">
     <select id="hid-type">
         <option value=""></option>
@@ -1223,4 +1218,4 @@
         @(Html.Raw(groupState))
     </select>
     @*@Html.DropDownList("hid-type", type)*@
-</section>
+</section>