Report.cshtml 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040
  1. @using Abp.Configuration
  2. @using IwbZero.ToolCommon.StringModel
  3. @using WeOnlineApp.Configuration
  4. @using WeOnlineApp.TrainingCampPlay.Dto
  5. @{
  6. Layout = "~/Views/Shared/Layout/_Layout.Play.cshtml";
  7. ViewBag.PageId = "history";
  8. PlayReportDto play = ViewBag.Play;
  9. ViewBag.Title = $"{(StringExtensions.IsEmpty(play.Name) ? "" : $"[{play.Name}] ")}演练报告";
  10. }
  11. <style>
  12. .report-box {
  13. --mainColor: #65758f;
  14. color: var(--mainColor);
  15. width: 894px;
  16. display: flex;
  17. flex-direction: column;
  18. margin: 0 auto;
  19. padding: 0 50px
  20. }
  21. .first-page {
  22. width: 100%;
  23. height: 950pt;
  24. display: flex;
  25. flex-direction: column;
  26. justify-content: center;
  27. align-items: center;
  28. font-size: 24px;
  29. display: none;
  30. }
  31. .first-page .box {
  32. margin-top: 100px;
  33. width: 70%;
  34. padding: 15px 20px;
  35. border-left: 5px solid;
  36. }
  37. .first-page .box .name {
  38. font-size: 40px;
  39. font-weight: 600;
  40. margin: 50px 0;
  41. }
  42. .first-page .date-box {
  43. margin-top: 400px;
  44. font-size: 30px;
  45. }
  46. .box-info {
  47. width: 100%;
  48. }
  49. .box-info .info-header {
  50. width: 100%;
  51. padding: 10px 20px 5px 40px;
  52. border-bottom: 3px solid;
  53. font-size: 24px;
  54. font-weight: 600;
  55. }
  56. .box-info .info-body {
  57. width: 100%;
  58. padding: 10px;
  59. }
  60. .box-info .info-body dl {
  61. display: flex;
  62. align-items: center;
  63. }
  64. .box-info .info-body dl {
  65. margin-bottom: 10px;
  66. }
  67. .box-info .info-body dl:last-child {
  68. margin-bottom: 0;
  69. }
  70. .box-info .info-body dl dt, .box-info .info-body dl dd {
  71. display: inline-block;
  72. }
  73. .box-info .info-body dl dt {
  74. font-weight: 600;
  75. padding-right: 5px;
  76. white-space: nowrap;
  77. font-size: 18px;
  78. }
  79. .box-info .info-body dl dd {
  80. margin-bottom: 0;
  81. word-break: break-all;
  82. }
  83. .table th, .table td {
  84. text-align: center;
  85. }
  86. .table thead th {
  87. border-bottom: 2px solid;
  88. border-top: none;
  89. }
  90. .play-chart-box, .play-scene-box {
  91. width: 100%;
  92. display: flex;
  93. flex-direction: column;
  94. margin-top: 20px;
  95. }
  96. .chart-title {
  97. font-size: 18px;
  98. font-weight: 600;
  99. margin-bottom: 10px;
  100. }
  101. .round {
  102. text-align: center;
  103. }
  104. .round span {
  105. padding: 5px 15px 2px;
  106. font-size: 16px;
  107. font-weight: 600;
  108. border-bottom: 2px solid;
  109. }
  110. .scene-box {
  111. margin: 15px 10px;
  112. padding: 10px 0;
  113. border: 2px solid;
  114. border-radius: 5px;
  115. }
  116. .scene-box .scene-info {
  117. padding: 5px;
  118. border: 1px solid;
  119. border-radius: 5px;
  120. margin: 5px 10px;
  121. background: #e5e5e5;
  122. }
  123. .scene-box .scene-info .name {
  124. font-size: 16px;
  125. font-weight: 600;
  126. }
  127. .scene-box .scene-info .desc {
  128. text-indent: 2em;
  129. font-size: 14px;
  130. }
  131. .scene-box .scene-info .score {
  132. margin-top: 3px;
  133. font-size: 16px;
  134. display: flex;
  135. justify-content: center;
  136. }
  137. .scene-box .scene-info .score span {
  138. font-weight: 600;
  139. text-align: center;
  140. width: 100%;
  141. }
  142. .scene-box .behavior-info {
  143. border: 1px dashed;
  144. background: #f5f5f5;
  145. }
  146. .scene-box .behavior-info .progress {
  147. background: #f0f0f0;
  148. margin: 5px 0;
  149. }
  150. .scene-box .behavior-info .progress-bar {
  151. background-color: var(--mainColor);
  152. }
  153. .btn.btn-iwb {
  154. color: #fff;
  155. background-color: #02595a;
  156. border-color: #02595a;
  157. box-shadow: none;
  158. }
  159. </style>
  160. <div class="report-box" id="report">
  161. <div class="first-page">
  162. <div class="box">
  163. <div class="">@(SettingManager.GetSettingValue(IwbSettingNames.ReportCompany))</div>
  164. <div class="name">@(SettingManager.GetSettingValue(IwbSettingNames.ReportName))</div>
  165. <div class=""> @(play.Name)</div>
  166. </div>
  167. <div class="date-box">@(play.EndDate!=null?play.EndDate?.ToString("yyyy-MM-dd"):DateTime.Now.ToString("yyyy-MM-dd")) </div>
  168. </div>
  169. <div class="base-info-box box-info">
  170. <div class="info-header">演练信息</div>
  171. <div class="info-body">
  172. <dl>
  173. <dt>演练名称:</dt>
  174. <dd>@(play.Name)</dd>
  175. </dl>
  176. <dl>
  177. <dt>培训营名称:</dt>
  178. <dd>@(play.CampName)</dd>
  179. </dl>
  180. <dl>
  181. <dt>演练主题:</dt>
  182. <dd>@(play.PackageName)</dd>
  183. </dl>
  184. <dl>
  185. <dt>演练目的:</dt>
  186. <dd>@(play.Purposes)</dd>
  187. </dl>
  188. <dl>
  189. <dt>主办单位:</dt>
  190. <dd>@(play.Organizer)</dd>
  191. </dl>
  192. <dl>
  193. <dt>演练时长:</dt>
  194. <dd>@(Convert.ToInt32(play.TrainingMinute))分钟 ( @(play.StartDate?.ToString("yyyy-MM-dd HH:mm:ss")) — @(play.EndDate?.ToString("yyyy-MM-dd HH:mm:ss")) )</dd>
  195. </dl>
  196. <dl>
  197. <dt>演练角色:</dt>
  198. <dd>
  199. @if (play.PlayRoleNames.IsNotEmpty())
  200. {
  201. var arr = play.PlayRoleNames.Split(',');
  202. foreach (var r in arr)
  203. {
  204. <span style="padding: 5px">@(r)</span>
  205. }
  206. }
  207. </dd>
  208. </dl>
  209. <dl>
  210. <dt>演练成绩:</dt>
  211. <dd id="eval-result"></dd>
  212. </dl>
  213. </div>
  214. </div>
  215. <div class="base-info-box box-info">
  216. <div class="info-header">参演人员</div>
  217. <div class="info-body">
  218. <table class="table table-hover table-striped">
  219. <thead>
  220. <tr>
  221. <th style="width: 15px">#</th>
  222. <th style="width: 100px">用户名</th>
  223. <th>参演人</th>
  224. <th>参演角色</th>
  225. <th style="width: 120px">状态</th>
  226. </tr>
  227. </thead>
  228. <tbody id="play-user-box"></tbody>
  229. </table>
  230. </div>
  231. </div>
  232. <div class="base-info-box box-info">
  233. <div class="info-header">演练过程</div>
  234. <div class="info-body">
  235. <div class="play-chart-box">
  236. <div class="chart-title">情景演变图:</div>
  237. <div id="tree-chart" class="chart-box"></div>
  238. </div>
  239. <div class="play-chart-box">
  240. <div class="chart-title">情景蜂巢图:</div>
  241. <div id="fc-chart" class="chart-box"></div>
  242. </div>
  243. <div class="play-scene-box">
  244. <div class="chart-title">演练过程得分详解:</div>
  245. <div id="scene-box" class="scene-info-box">
  246. </div>
  247. </div>
  248. </div>
  249. </div>
  250. <div class="base-info-box box-info">
  251. <div class="info-header">演练能力</div>
  252. <div class="info-body">
  253. <div class="play-chart-box">
  254. <div class="chart-title">轮次评分:</div>
  255. <div id="round-chart" class="chart-box"></div>
  256. </div>
  257. <div class="play-chart-box">
  258. <div class="chart-title">四功评析:</div>
  259. <div id="sg-chart" class="chart-box"></div>
  260. </div>
  261. <div class="play-scene-box">
  262. <div class="chart-title">五力评析:</div>
  263. <div id="wl-chart" class="chart-box">
  264. </div>
  265. </div>
  266. </div>
  267. </div>
  268. </div>
  269. <div id="export" style="position: fixed; right: 17%; top: 30px; display: none;">
  270. <button type="button" class="btn btn-iwb btn-sm" onclick="Export()">导出PDF</button>
  271. </div>
  272. @section scripts
  273. {
  274. <script src="~/Content/Libs/eCharts/echarts.min.js"></script>
  275. @*<script type="text/javascript" src="https://code.highcharts.com.cn/highcharts/highcharts.js"></script>
  276. <script type="text/javascript" src="https://code.highcharts.com.cn/highcharts/modules/heatmap.js"></script>
  277. <script type="text/javascript" src="https://code.highcharts.com.cn/highcharts/modules/oldie.js"></script>
  278. <script type="text/javascript" src="https://code.highcharts.com.cn/highcharts/modules/tilemap.js"></script>*@
  279. <script src="~/Content/Libs/highcharts/highcharts.min.js"></script>
  280. <script src="~/Content/Libs/highcharts/modules/heatmap.min.js"></script>
  281. <script src="~/Content/Libs/highcharts/modules/oldie.min.js"></script>
  282. <script src="~/Content/Libs/highcharts/modules/tilemap.min.js"></script>
  283. <script src="~/Content/Libs/html2canva/html2canvas.min.js"></script>
  284. <script src="~/Content/Libs/jsPdf/jspdf.min.js.js"></script>
  285. <script src="~/Content/Libs/jsPdf/html2pdf.js"></script>
  286. <script>
  287. $(function() {
  288. GetPlayUsers();
  289. GetPlayData();
  290. });
  291. function Export() {
  292. $('#report .first-page').css('display', 'flex');
  293. ExportPdf('report', '@(play.Name)演练报告-' + new Date().format('yyMMddhhmm'));
  294. $('#report .first-page').css('display', 'none');
  295. }
  296. function GetPlayUsers() {
  297. $.iwbAjax4({
  298. url: abp.appUrl + 'CampPlay/GetPlayUsers?no=@(play.Id)',
  299. success: function(res) {
  300. if (res && res.length) {
  301. var str = '';
  302. var i = 0;
  303. res.forEach(function(v) {
  304. i++;
  305. var state = v.playerState == @(CampPlayUserStateDefinition.End) ? "完成演练" : "未完成演练";
  306. str += '<tr><th>{0}</th><td>{1}</td><td>{2}</td><td>{3}</td><td>{4}</td></tr>'
  307. .format(i, v.userName, v.playerName, v.role, state);
  308. });
  309. if (str) {
  310. $('#play-user-box').html(str);
  311. }
  312. }
  313. }
  314. });
  315. }
  316. </script>
  317. <script>
  318. var t;
  319. function GetPlayData() {
  320. $('body').append('<div id="loading-data-tip" style="position: fixed; top: 0;right:0; bottom: 0; left: 0; margin: 0 auto; background: rgba(255, 255, 255, .5); color: #02595a; font-size: 24px; font-weight: 600;z-index:9999;display:none;"><div style="width:100%;height:100%;display: flex; justify-content: center; align-items: center; ">正在加载演练报告数据,请稍后!</div></div>');
  321. setTimeout(function () {
  322. $('#loading-data-tip').fadeIn(1000);
  323. }, 1000);
  324. $.iwbAjax4({
  325. url: abp.appUrl + 'CampPlay/GetPlayData?no=@(play.Id)',
  326. success: function(res) {
  327. if (res) {
  328. $('#eval-result').html(res.evalQualitativeResult);
  329. ChartFormatter(res.chartData);
  330. SceneRoundFormatter(res.scenes);
  331. ScoreChartFormatter(res.scoreData);
  332. }
  333. $('#loading-data-tip').fadeOut(1000, function () { $('#loading-data-tip').remove();});
  334. clearTimeout(t);
  335. t = setTimeout(function() {
  336. $('#export').fadeIn(500);
  337. },3000);
  338. },
  339. error: function() {
  340. $('#loading-data-tip').fadeOut(1000, function () { $('#loading-data-tip').remove(); });
  341. }
  342. });
  343. }
  344. function ChartFormatter(data) {
  345. if (data && data.length) {
  346. data.forEach(function(v) {
  347. var str = '<div id="{0}-container_{1}" style="width:100%;height:{2}px;"></div>';
  348. $('#tree-chart').append(str.format('tree', v.roundIndex, 500));
  349. TreePathChart(v, "tree");
  350. $('#fc-chart').append(str.format('fc', v.roundIndex, 420));
  351. FcRoundChart(v, 'fc');
  352. });
  353. }
  354. }
  355. function ScoreChartFormatter(data) {
  356. if (data) {
  357. var str = '<div id="score-container_{0}" style="width:100%;height:{1}px;"></div>';
  358. $('#round-chart').append(str.format('round', 50));
  359. RoundScoreChart(data.scoreInfos);
  360. $('#sg-chart').append(str.format('sg', 400));
  361. SiGongChart(data.siGongInfos);
  362. $('#wl-chart').append(str.format('wl', 300));
  363. WuLiChart(data.wuLiInfos);
  364. }
  365. }
  366. </script>
  367. <script>
  368. function SceneRoundFormatter(data) {
  369. var str = '';
  370. if (data && data.length) {
  371. data.forEach(function (v) {
  372. str += '<div class="round"><span>第{0}轮</span></div>'.format(v.roundIndex);
  373. v.sceneInfos.forEach(function (a) {
  374. str += SceneFormatter(a);
  375. });
  376. });
  377. }
  378. if (str) {
  379. $('#scene-box').html(str);
  380. }
  381. }
  382. function SceneFormatter(data) {
  383. var str = '';
  384. if (data) {
  385. str += '<div class="scene-box">';
  386. str += '<div class="scene-info">';
  387. str += '<div class="name">[情景]:{0}</div>'.format(data.name);
  388. str += '<div class="desc">{0}</div>'.format(data.description);
  389. str += '</div>';
  390. if (data.behaviors && data.behaviors.length) {
  391. data.behaviors.forEach(function (v) {
  392. str += BehaviorFormatter(v);
  393. });
  394. }
  395. str += '</div>';
  396. }
  397. return str;
  398. }
  399. function BehaviorFormatter(data) {
  400. var str = '';
  401. if (data) {
  402. str += '<div class="behavior-info scene-info">';
  403. str += '<div class="name">[规则]:{0}</div>'.format(data.name);
  404. str += '<div class="desc">{0}</div>'.format(data.description);
  405. str += '<div class="score"><span>实际评分:{0} 分</span><span>行为总分:{1} 分</span></div>'.format(data.score,
  406. data.fullScore);
  407. str += '<div class="progress"><div class="progress-bar" style="width:{0}%;"></div></div>'.format(
  408. data.fullScore ? (data.score * 100 / data.fullScore).toFixed(2) : 0);
  409. str += '</div>';
  410. }
  411. return str;
  412. }
  413. </script>
  414. <script>
  415. var color = ['#FF3030', '#FF6A6A', '#FFD700', '#54FF9F', '#00E5EE'];
  416. var roundColor = ['#FFA939', '#FF6A69', '#35D480', '#FFA939', '#FF6A69', '#35D480'];
  417. var mainColor = '#65758f';
  418. //推演网格
  419. function TreePathChart(data, idStr) {
  420. if (data) {
  421. //console.log("TreePath", data);
  422. } else {
  423. console.log("TreePath-Null");
  424. return;
  425. }
  426. //var isRadial = idStr == "hx";
  427. idStr = idStr + '-container_' + data.roundIndex;
  428. if ($('#' + idStr).data('use') === true) {
  429. return;
  430. }
  431. var treeChart = echarts.init(document.getElementById(idStr)), seriesOpt = {};
  432. var d = ConvertTreeData(data.infos, false); // isRadial);
  433. //console.log("ConvertTreeData", d);
  434. //if (isRadial) {
  435. // seriesOpt = {
  436. // layout: 'radial'
  437. // }
  438. //}
  439. var opt = {
  440. type: 'tree',
  441. data: d,
  442. top: '5%',
  443. left: '5%',
  444. bottom: '5%',
  445. right: '5%',
  446. symbolSize: 10,
  447. initialTreeDepth: -1,
  448. label: {
  449. position: 'top',
  450. rotate: 0,
  451. fontSize: 11,
  452. fontWeight: 'normal',
  453. distance: 1
  454. },
  455. lineStyle: {
  456. width: 2
  457. },
  458. itemStyle: {
  459. borderWidth: 1
  460. },
  461. leaves: {
  462. itemStyle: {
  463. borderWidth: 1.5
  464. }
  465. },
  466. expandAndCollapse: true,
  467. animationDuration: 550,
  468. animationDurationUpdate: 450
  469. };
  470. var o = $.extend(true, {}, opt, seriesOpt);
  471. //console.log(o);
  472. var option = {
  473. title: {
  474. text: "第" + data.roundIndex + "轮情景演变示意图",
  475. show: true,
  476. left: 'center',
  477. textStyle: {
  478. color: mainColor
  479. }
  480. },
  481. tooltip: {
  482. trigger: 'item',
  483. triggerOn: 'mousemove',
  484. formatter: function(p) {
  485. return p.data.showName;
  486. },
  487. backgroundColor: "#ddd",
  488. textStyle: { color: mainColor, fontSize:12},
  489. padding: [8, 15]
  490. },
  491. series: [o]
  492. };
  493. treeChart.setOption(option);
  494. $('#' + idStr).data('use', true);
  495. }
  496. //蜂巢网格
  497. function FcRoundChart(data, idStr) {
  498. if (data) {
  499. var seriesData = [];
  500. seriesData.push($.extend({}, { name: data.fcInfo.name, type: 'tilemap', data: data.fcInfo.fcInfos }));
  501. if (data.fcFlowInfo && data.fcFlowInfo.length > 0) {
  502. data.fcFlowInfo.forEach(function (v) {
  503. seriesData.push($.extend({}, { name: v.name, type: 'spline', data: v.flowInfos }));
  504. });
  505. }
  506. console.log(seriesData);
  507. idStr = idStr + '-container_' + data.roundIndex;
  508. if ($('#' + idStr).data('use') === true) {
  509. return;
  510. }
  511. window.Highcharts.chart(idStr,
  512. {
  513. chart: {
  514. reflow: true,
  515. height: '60%',
  516. margin: 10,
  517. inverted: false,
  518. //backgroundColor: {
  519. // linearGradient: [0, 0, 500, 500],
  520. // stops: [
  521. // [0, 'rgba(255, 255, 255,0)'],
  522. // [1, 'rgba(200, 200, 255,0)']
  523. // ]
  524. //}
  525. backgroundColor: 'transparent'
  526. //plotBackgroundColor:'#f3fffe'
  527. //plotBackgroundColor: {
  528. // linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
  529. // stops: [
  530. // [0, '#F5F5F5'],
  531. // [0.5, '#FFffFF'],
  532. // [1, '#F5F5F5']
  533. // ]
  534. //}
  535. },
  536. exporting: {
  537. enabled: false
  538. },
  539. title: {
  540. text: "第" + data.roundIndex + "轮情景流蜂巢示意图",
  541. align: 'center',
  542. floating: false,
  543. margin: 125,
  544. style: {
  545. 'color': mainColor,
  546. 'fontWeight': '600',
  547. 'fontFamily': 'sans-serif'
  548. },
  549. y: 25
  550. },
  551. xAxis: {
  552. visible: false
  553. },
  554. yAxis: {
  555. visible: false,
  556. reversed: true
  557. },
  558. colorAxis: {
  559. visible: false,
  560. dataClasses: [
  561. {
  562. from: 0,
  563. to: 1,
  564. color: '#ddd',
  565. name: ''
  566. }, {
  567. from: 1,
  568. to: 2,
  569. color: mainColor,
  570. name: ''
  571. }
  572. ]
  573. },
  574. tooltip: {
  575. enabled: false,
  576. headerFormat: '',
  577. pointFormat: ''
  578. },
  579. colors: ['#ddd'],
  580. legend: {
  581. enabled: false
  582. },
  583. credits: {
  584. enabled: false
  585. },
  586. plotOptions: {
  587. tilemap: {
  588. allowPointSelect: true,
  589. clip: true,
  590. cursor: 'pointer',
  591. enableMouseTracking: false
  592. },
  593. spline: {
  594. enableMouseTracking: false,
  595. lineWidth: 5,
  596. marker: {
  597. enabled: false
  598. },
  599. series: {
  600. animation: {
  601. duration: 3000
  602. }
  603. }
  604. }
  605. },
  606. series: seriesData
  607. });
  608. $('#' + idStr).data('use', true);
  609. }
  610. }
  611. //轮次得分条
  612. function RoundScoreChart(data) {
  613. if ($('#score-container_round').data('use') === true) {
  614. return;
  615. }
  616. if (data && data.length > 0) {
  617. // console.log("RoundScore", data);
  618. } else {
  619. console.log("RoundScore-Null");
  620. return;
  621. }
  622. var scoreChart = echarts.init(document.getElementById('score-container_round'));
  623. var series = [];
  624. for (var i = 0; i < data.length; i++) {
  625. var temp = {
  626. name: '第 ' + (i + 1) + ' 轮',
  627. type: 'bar',
  628. stack: '总分',
  629. label: {
  630. normal: {
  631. show: true,
  632. position: 'inside',
  633. color: "#fff",
  634. fontSize: 14,
  635. fontWeight: 'bold',
  636. formatter: '{a}: {c} 分'
  637. }
  638. },
  639. barWidth: 40,
  640. barMinHeight: 150,
  641. itemStyle: {},
  642. data: [data[i]]
  643. };
  644. if (i === 0 && i === data.length - 1) {
  645. temp.itemStyle = {
  646. barBorderRadius: [30]
  647. }
  648. } else if (i === 0) {
  649. temp.itemStyle = {
  650. barBorderRadius: [30, 0, 0, 30]
  651. }
  652. } else if (i === data.length - 1) {
  653. temp.itemStyle = {
  654. barBorderRadius: [0, 30, 30, 0]
  655. }
  656. }
  657. temp.itemStyle.color = roundColor[i % 3];
  658. series.push(temp);
  659. }
  660. var option = {
  661. grid: {
  662. left: 0,
  663. right: 0
  664. },
  665. xAxis: {
  666. show: false,
  667. type: 'value'
  668. },
  669. yAxis: {
  670. show: false,
  671. type: 'category',
  672. data: ['分数']
  673. },
  674. series: series
  675. };
  676. //console.log(option);
  677. scoreChart.setOption(option);
  678. $('#score-container_round').data('use', true);
  679. }
  680. //四功
  681. function SiGongChart(data) {
  682. if ($('#score-container_sg').data('use') === true) {
  683. return;
  684. }
  685. if (data && data.length > 0) {
  686. //console.log("SiGong", data);
  687. } else {
  688. console.log("SiGong-Null");
  689. return;
  690. }
  691. var series = [];
  692. var legendDate = [];
  693. var sgData = [];
  694. for (var i = 1; i <= data.length; i++) {
  695. if (i > 4) {
  696. return;
  697. }
  698. var item = data[i - 1];
  699. legendDate.push(item.name);
  700. sgData.push([]);
  701. }
  702. if (data[0] && data[0].tagScoreInfos) {
  703. var roundCount = data[0].tagScoreInfos.length;
  704. for (var w = 1; w <= data.length; w++) {
  705. if (w > 4) {
  706. return;
  707. }
  708. var scores = data[w - 1].tagScoreInfos;
  709. for (var q = 0; q < scores.length; q++) {
  710. sgData[q].push(scores[q]);
  711. }
  712. }
  713. for (var j = 0; j < roundCount; j++) {
  714. var temp = {
  715. name: '第 ' + (j + 1) + ' 轮',
  716. type: 'bar',
  717. label: {
  718. normal: {
  719. show: true,
  720. formatter: '{a}:{c} 分',
  721. color: "#fff",
  722. rotate: 90
  723. }
  724. },
  725. barMinHeight: 150,
  726. itemStyle: {
  727. color: {
  728. type: 'linear',
  729. x: 0,
  730. y: 0,
  731. x2: 0,
  732. y2: 1,
  733. colorStops: [
  734. {
  735. offset: 0,
  736. color: roundColor[j % 3] // 0% 处的颜色
  737. }, {
  738. offset: 1,
  739. color: mainColor // 100% 处的颜色
  740. }
  741. ]
  742. },
  743. barBorderRadius: [50, 50, 0, 0]
  744. //shadowBlur: 2,
  745. //shadowColor: "#666",
  746. //shadowOffsetX: 2,
  747. //shadowOffsetY: 1
  748. },
  749. data: sgData[j]
  750. };
  751. series.push(temp);
  752. }
  753. }
  754. var option = {
  755. grid: {
  756. top: 40,
  757. bottom: 40,
  758. left: 30,
  759. right: 30,
  760. borderColor: mainColor
  761. },
  762. title: {
  763. text: "四功能力评析示意图",
  764. show: true,
  765. left: 'center',
  766. textStyle: {
  767. color: mainColor
  768. }
  769. },
  770. //legend: {
  771. // data: legendDate
  772. //},
  773. xAxis: {
  774. type: 'category',
  775. data: legendDate,
  776. axisLabel: {
  777. color: mainColor
  778. },
  779. axisLine: {
  780. show: true,
  781. lineStyle: {
  782. color: mainColor
  783. }
  784. }
  785. },
  786. yAxis: {
  787. type: 'value',
  788. axisLabel: {
  789. color: mainColor
  790. },
  791. axisLine: {
  792. show: true,
  793. lineStyle: {
  794. color: mainColor
  795. }
  796. },
  797. splitLine: {
  798. lineStyle: {
  799. color: mainColor
  800. }
  801. }
  802. },
  803. series: series
  804. };
  805. //console.log(option);
  806. var siGongChart = echarts.init(document.getElementById('score-container_sg'));
  807. siGongChart.setOption(option);
  808. $('#score-container_sg').data('use', true);
  809. }
  810. //五力
  811. function WuLiChart(data) {
  812. if ($('#score-container_wl').data('use') === true) {
  813. return;
  814. }
  815. if (data && data.length > 0) {
  816. //console.log("WuLi", data);
  817. } else {
  818. console.log("WuLi-Null");
  819. return;
  820. }
  821. var indicatorData = [];
  822. for (var i = 1; i <= data.length; i++) {
  823. if (i > 5) {
  824. return;
  825. }
  826. var item = data[i - 1];
  827. indicatorData.push({ text: item.name, max: 100, color: color[i - 1] });
  828. }
  829. var series = [];
  830. var wlData = [];
  831. var radar = [
  832. {
  833. indicator: indicatorData,
  834. center: ['30%', '50%'],
  835. radius: 120,
  836. splitNumber: 5,
  837. axisLine: {
  838. lineStyle: {
  839. color: ['#C1CDCD']
  840. }
  841. },
  842. splitLine: {
  843. lineStyle: {
  844. color: ['#00ced1', mainColor]
  845. }
  846. }
  847. }
  848. ];
  849. if (data[0] && data[0].tagScoreInfos) {
  850. var roundCount = data[0].tagScoreInfos.length;
  851. var h = 175 * roundCount;
  852. if (h > 300) {
  853. $('#score-container_wl').height(h);
  854. }
  855. var radarTemp = {
  856. indicator: indicatorData,
  857. radius: 40,
  858. center: ['77%', '25%'],
  859. splitNumber: 3,
  860. nameGap: 5,
  861. axisLine: {
  862. show: false
  863. },
  864. splitLine: {
  865. lineStyle: {
  866. color: ['#00ced1', mainColor]
  867. }
  868. }
  869. };
  870. var minSplit = (100 / (roundCount + 1)).toFixed(2);
  871. for (var j = 0; j <= roundCount; j++) {
  872. var temp = {
  873. name: '第 ' + j + ' 轮',
  874. type: 'radar',
  875. radarIndex: j
  876. }
  877. if (j === 0) {
  878. temp.name = '五力雷达图';
  879. temp.data = wlData;
  880. } else {
  881. wlData.push({ name: '第 ' + j + ' 轮', value: [], lineStyle: { color: roundColor[j - 1] } });
  882. temp.lineStyle = {
  883. color: roundColor[j - 1]
  884. };
  885. temp.data = [wlData[j - 1]];
  886. radar.push($.extend(true, {}, radarTemp, { center: ['77%', (minSplit * j) + '%'] }));
  887. }
  888. series.push(temp);
  889. }
  890. for (var w = 1; w <= data.length; w++) {
  891. if (w > 5) {
  892. return;
  893. }
  894. var scores = data[w - 1].tagScoreInfos;
  895. for (var q = 0; q < scores.length; q++) {
  896. wlData[q].value.push(scores[q]);
  897. }
  898. }
  899. }
  900. var option = {
  901. grid: { top: 10, bottom: 10, left: 30, right: 30 },
  902. title: {
  903. text: "五力能力评析示意图",
  904. show: true,
  905. left: 'center',
  906. textStyle: {
  907. color: mainColor
  908. }
  909. },
  910. radar: radar,
  911. series: series
  912. };
  913. //console.log(option);
  914. var wuLiChart = echarts.init(document.getElementById('score-container_wl'));
  915. wuLiChart.setOption(option);
  916. $('#score-container_wl').data('use', true);
  917. }
  918. function ConvertTreeData(data, isRadial) {
  919. var newData = [];
  920. var color1 = mainColor,
  921. color2 = "#ddd",
  922. width1 = 2, // isRadial ? 2 : 4,
  923. width2 = 1; // isRadial ? 1 : 3;
  924. if (data && data.length) {
  925. data.forEach(function (v) {
  926. var newItem = $.extend(true,
  927. {},
  928. {
  929. itemStyle: {
  930. color: color2,
  931. borderColor: color2,
  932. width: width2
  933. },
  934. label: {
  935. color: "#999"
  936. },
  937. lineStyle: {
  938. color: color2,
  939. borderColor: color2,
  940. width: width2
  941. }
  942. },
  943. v);
  944. newItem.showName = newItem.name;
  945. newItem.name = newItem.name.indexOf('情景流') == 0
  946. ? "情景流"
  947. : newItem.name.indexOf('情景') == 0
  948. ? "情景"
  949. : newItem.name;
  950. newItem.collapsed = true;
  951. if (v.isRun) {
  952. newItem.itemStyle.color = color1;
  953. newItem.itemStyle.borderColor = color1;
  954. newItem.itemStyle.width = width1;
  955. newItem.label.color = color1;
  956. newItem.label.fontWeight = 'bold';
  957. newItem.lineStyle.color = color1;
  958. newItem.lineStyle.borderColor = color1;
  959. newItem.lineStyle.width = width1;
  960. newItem.collapsed = false;
  961. }
  962. if (v.children && v.children.length) {
  963. newItem.children = ConvertTreeData(v.children, isRadial);
  964. }
  965. newData.push(newItem);
  966. });
  967. }
  968. return newData;
  969. }
  970. </script>
  971. }