_Report.cshtml 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980
  1. @using Abp.Configuration
  2. @using IwbZero.ToolCommon.StringModel
  3. @using WeApp.Configuration
  4. @using WeApp.Helpers
  5. @using WeApp.TrainingPortrait.Dto
  6. @model WeApp.Views.Shared.Camp.ReportModel
  7. @{
  8. GroupReportDto group = Model.Group;
  9. ViewBag.Title = $"{(StringExtensions.IsEmpty(group.Name) ? "" : $"[{group.Name}] ")}演练报告";
  10. }
  11. <style>
  12. .report-box {
  13. color: #02595a;
  14. width: 894px;
  15. display: flex;
  16. flex-direction: column;
  17. margin: 0 auto;
  18. padding: 0 50px
  19. }
  20. .first-page {
  21. width: 100%;
  22. height: 950pt;
  23. display: flex;
  24. flex-direction: column;
  25. justify-content: center;
  26. align-items: center;
  27. font-size: 24px;
  28. display: none;
  29. }
  30. .first-page .box {
  31. margin-top: 100px;
  32. width: 70%;
  33. padding: 15px 20px;
  34. border-left: 5px solid;
  35. }
  36. .first-page .box .name {
  37. font-size: 40px;
  38. font-weight: 600;
  39. margin: 50px 0;
  40. }
  41. .first-page .date-box {
  42. margin-top: 400px;
  43. font-size: 30px;
  44. }
  45. .box-info {
  46. width: 100%;
  47. }
  48. .box-info .info-header {
  49. width: 100%;
  50. padding: 10px 20px 5px 40px;
  51. border-bottom: 3px solid;
  52. font-size: 24px;
  53. font-weight: 600;
  54. }
  55. .box-info .info-body {
  56. width: 100%;
  57. padding: 10px;
  58. }
  59. .box-info .info-body dl {
  60. display: flex;
  61. align-items: center;
  62. }
  63. .box-info .info-body dl {
  64. margin-bottom: 10px;
  65. }
  66. .box-info .info-body dl:last-child {
  67. margin-bottom: 0;
  68. }
  69. .box-info .info-body dl dt, .box-info .info-body dl dd {
  70. display: inline-block;
  71. }
  72. .box-info .info-body dl dt {
  73. font-weight: 600;
  74. padding-right: 5px;
  75. white-space: nowrap;
  76. font-size: 18px;
  77. }
  78. .box-info .info-body dl dd {
  79. margin-bottom: 0;
  80. word-break: break-all;
  81. }
  82. .play-chart-box, .play-scene-box {
  83. width: 100%;
  84. display: flex;
  85. flex-direction: column;
  86. margin-top: 20px;
  87. }
  88. .chart-title {
  89. font-size: 18px;
  90. font-weight: 600;
  91. margin-bottom: 10px;
  92. }
  93. .round {
  94. text-align: center;
  95. }
  96. .round span {
  97. padding: 5px 15px 2px;
  98. font-size: 16px;
  99. font-weight: 600;
  100. border-bottom: 2px solid;
  101. }
  102. .scene-box {
  103. margin: 15px 10px;
  104. padding: 10px 0;
  105. border: 2px solid;
  106. border-radius: 5px;
  107. }
  108. .scene-box .scene-info {
  109. padding: 5px;
  110. border: 1px solid;
  111. border-radius: 5px;
  112. margin: 5px 10px;
  113. background: #c7f0f3;
  114. }
  115. .scene-box .scene-info .name {
  116. font-size: 16px;
  117. font-weight: 600;
  118. }
  119. .scene-box .scene-info .desc {
  120. text-indent: 2em;
  121. font-size: 14px;
  122. }
  123. .scene-box .scene-info .score {
  124. margin-top: 3px;
  125. font-size: 16px;
  126. display: flex;
  127. justify-content: center;
  128. }
  129. .scene-box .scene-info .score span {
  130. font-weight: 600;
  131. text-align: center;
  132. width: 100%;
  133. }
  134. .scene-box .behavior-info {
  135. border: 1px dashed;
  136. background: #e7f0f3;
  137. }
  138. .scene-box .behavior-info .progress {
  139. background: #c7f0f3;
  140. margin: 5px 0;
  141. }
  142. .scene-box .behavior-info .progress-bar {
  143. background-color: #02595a;
  144. }
  145. .btn.btn-iwb {
  146. color: #fff;
  147. background-color: #02595a;
  148. border-color: #02595a;
  149. box-shadow: none;
  150. }
  151. .table-box .table th, .table td {
  152. text-align: center;
  153. border-color: #02595a;
  154. padding: 8px 5px;
  155. }
  156. .table-box .table thead th {
  157. /*border-bottom: 2px solid;*/
  158. border-top: 1px solid #02595a;
  159. border-bottom: 1px solid #02595a;
  160. }
  161. .table-box th.round-tag {
  162. padding: 10px 10px 10px 75px;
  163. text-align: left;
  164. position: relative;
  165. }
  166. .table-box th.round-tag strong {
  167. font-size: 130%;
  168. letter-spacing: 10px;
  169. }
  170. .table-box th.scene {
  171. width: 200px;
  172. }
  173. .table-box th.b-title {
  174. vertical-align: middle;
  175. letter-spacing: 3px;
  176. font-size: 115%;
  177. }
  178. .table-box th.s-title, td {
  179. vertical-align: middle;
  180. font-size: 85%;
  181. }
  182. .table-box th.round-tag .level-box {
  183. position: absolute;
  184. right: 40px;
  185. top: 0;
  186. display: flex;
  187. flex-direction: row;
  188. height: 100%;
  189. font-weight: 400;
  190. }
  191. .table-box .level-box .l-box {
  192. display: inline-block;
  193. margin-right: 15px;
  194. display: flex;
  195. flex-direction: row;
  196. align-items: center;
  197. }
  198. .table-box .t-level {
  199. --wh: 15px;
  200. display: inline-block;
  201. width: var(--wh);
  202. height: var(--wh);
  203. border-radius: 50%;
  204. margin: 0 auto;
  205. }
  206. .table-box .t-level.big {
  207. --wh: 18px;
  208. margin: 0 8px;
  209. }
  210. .table-box .t-level.l-1 {
  211. background: #f00
  212. }
  213. .table-box .t-level.l-2 {
  214. background: orange;
  215. }
  216. .table-box .t-level.l-3 {
  217. background: #0f0
  218. }
  219. .review-box {
  220. padding: 0 20px 10px;
  221. }
  222. .review-box strong {
  223. font-size: 18px;
  224. }
  225. .review-box .review {
  226. margin-top: 10px;
  227. text-indent: 2em;
  228. }
  229. </style>
  230. <div class="report-box" id="report">
  231. <div class="first-page">
  232. <div class="box">
  233. <div class="">@(SettingManager.GetSettingValue(IwbSettingNames.ReportCompany))</div>
  234. <div class="name">@(SettingManager.GetSettingValue(IwbSettingNames.ReportName))</div>
  235. <div class=""> @(group.Name)</div>
  236. </div>
  237. <div class="date-box">@(group.EndDate!=null?group.EndDate?.ToString("yyyy-MM-dd"):DateTime.Now.ToString("yyyy-MM-dd")) </div>
  238. </div>
  239. <div class="base-info-box box-info">
  240. <div class="info-header">演练信息</div>
  241. <div class="info-body">
  242. <dl>
  243. <dt>演练分组:</dt>
  244. <dd>@(group.Name)</dd>
  245. </dl>
  246. <dl>
  247. <dt>培 训 营:</dt>
  248. <dd>@(group.CampName)</dd>
  249. </dl>
  250. <dl>
  251. <dt>演练主题:</dt>
  252. <dd>@(group.PackageName)</dd>
  253. </dl>
  254. @*<dl>
  255. <dt>演练目的:</dt>
  256. <dd>@(group.Purposes)</dd>
  257. </dl>
  258. <dl>
  259. <dt>主办单位:</dt>
  260. <dd>@(group.Organizer)</dd>
  261. </dl>*@
  262. <dl>
  263. <dt>演练时长:</dt>
  264. <dd>@(Convert.ToInt32(group.TrainingMinute))分钟 ( @(group.StartDate?.ToString("yyyy-MM-dd HH:mm:ss")) — @(group.EndDate?.ToString("yyyy-MM-dd HH:mm:ss")) )</dd>
  265. </dl>
  266. <dl>
  267. <dt>演练角色:</dt>
  268. <dd>
  269. @if (group.RoleNames.IsNotEmpty())
  270. {
  271. var arr = group.RoleNames.Split(',');
  272. foreach (var r in arr)
  273. {
  274. <span style="padding: 5px">@(r)</span>
  275. }
  276. }
  277. </dd>
  278. </dl>
  279. <dl>
  280. <dt>演练成绩:</dt>
  281. <dd id="eval-result">优秀</dd>
  282. </dl>
  283. </div>
  284. </div>
  285. @*<div class="base-info-box box-info">
  286. <div class="info-header">参演人员</div>
  287. <div class="info-body">
  288. <table class="table table-hover table-striped">
  289. <thead>
  290. <tr>
  291. <th style="width: 15px">#</th>
  292. <th style="width: 100px">用户名</th>
  293. <th>参演人</th>
  294. <th>参演角色</th>
  295. <th style="width: 120px">状态</th>
  296. </tr>
  297. </thead>
  298. <tbody id="play-user-box"></tbody>
  299. </table>
  300. </div>
  301. </div>*@
  302. <div class="base-info-box box-info">
  303. <div class="info-header">演练过程</div>
  304. <div class="info-body">
  305. <div class="play-chart-box">
  306. <div class="chart-title">情景演变图:</div>
  307. <div id="tree-chart" class="chart-box"></div>
  308. </div>
  309. <div class="play-chart-box">
  310. <div class="chart-title">情景蜂巢图:</div>
  311. <div id="fc-chart" class="chart-box"></div>
  312. </div>
  313. <div class="play-scene-box">
  314. <div class="chart-title">演练过程得分详解:</div>
  315. <div id="scene-box" class="scene-info-box">
  316. </div>
  317. </div>
  318. </div>
  319. </div>
  320. <div class="base-info-box box-info">
  321. <div class="info-header">演练能力</div>
  322. <div class="info-body">
  323. <div class="play-chart-box">
  324. <div class="chart-title">轮次评分:</div>
  325. <div id="round-chart" class="chart-box"></div>
  326. </div>
  327. <div class="play-chart-box">
  328. <div class="chart-title">四功评析:</div>
  329. <div id="sg-chart" class="chart-box"></div>
  330. </div>
  331. <div class="play-scene-box">
  332. <div class="chart-title">五力评析:</div>
  333. <div id="wl-chart" class="chart-box">
  334. </div>
  335. </div>
  336. </div>
  337. </div>
  338. <div class="base-info-box box-info">
  339. <div class="info-header">能力解析</div>
  340. <div class="info-body">
  341. <div class="play-chart-box">
  342. <div class="chart-title">四功五力解析详情:</div>
  343. <div id="tag-box" class="table-box"></div>
  344. </div>
  345. <div class="play-chart-box">
  346. <div class="chart-title">系统评语:</div>
  347. <div id="xt-review" class="review-box"></div>
  348. </div>
  349. <div class="play-scene-box">
  350. <div class="chart-title">专家评语:</div>
  351. <div id="zj-review" class="review-box">
  352. </div>
  353. </div>
  354. </div>
  355. </div>
  356. </div>
  357. @if (Model.IsSystem)
  358. {
  359. <div id="export" style="position: fixed; right: 17%; top: 80px; display: block;">
  360. <button type="button" class="btn btn-iwb btn-sm" onclick="ExportSql()">导出PDF</button>
  361. </div>
  362. }
  363. @using (Html.BeginScripts())
  364. {
  365. <script src="~/Content/Libs/eCharts/echarts.min.js"></script>
  366. @*<script type="text/javascript" src="https://code.highcharts.com.cn/highcharts/highcharts.js"></script>
  367. <script type="text/javascript" src="https://code.highcharts.com.cn/highcharts/modules/heatmap.js"></script>
  368. <script type="text/javascript" src="https://code.highcharts.com.cn/highcharts/modules/oldie.js"></script>
  369. <script type="text/javascript" src="https://code.highcharts.com.cn/highcharts/modules/tilemap.js"></script>*@
  370. <script src="~/Content/Libs/highcharts/highcharts.min.js"></script>
  371. <script src="~/Content/Libs/highcharts/modules/heatmap.min.js"></script>
  372. <script src="~/Content/Libs/highcharts/modules/oldie.min.js"></script>
  373. <script src="~/Content/Libs/highcharts/modules/tilemap.min.js"></script>
  374. <script src="~/Content/Libs/highcharts/modules/exporting.js"></script>
  375. @*<script src="~/Content/Libs/highcharts/modules/offline-exporting.src.js"></script>*@
  376. @*<script src="~/Content/Libs/highcharts/modules/exporting-image.src.js"></script>*@
  377. @*<script src="~/Content/Libs/html2canva/html2canvas.min.js"></script>
  378. <script src="~/Content/Libs/jsPdf/jspdf.min.js.js"></script>
  379. <script src="~/Content/Libs/jsPdf/html2pdf.js"></script>*@
  380. <script>
  381. </script>
  382. <script id="report-data-script">
  383. var t;
  384. function GetReportData() {
  385. $('body').append(loading.format('loading-data-tip','正在加载演练报告数据,请稍后!'));
  386. setTimeout(function() {
  387. $('#loading-data-tip').fadeIn(1000);
  388. },
  389. 1000);
  390. $.iwbAjax4({
  391. url: abp.appUrl + 'Portrait/GetGroupReportData?no=@(group.Id)',
  392. success: function(res) {
  393. if (res) {
  394. $('#report').data("report-info", res);
  395. $('#eval-result').html(res.evalQualitativeResult);
  396. ChartFormatter(res.chartData);
  397. SceneRoundFormatter(res.scenes);
  398. TagRoundFormatter(res.scenes);
  399. ReviewFormatter(res.reportEvalStrings);
  400. ScoreChartFormatter(res.scoreData);
  401. //window.Highcharts.charts.forEach(function(v) {
  402. // v.getImageData();
  403. //});
  404. }
  405. $('#loading-data-tip').fadeOut(1000, function() { $('#loading-data-tip').remove(); });
  406. clearTimeout(t);
  407. t = setTimeout(function() {
  408. $('#export').fadeIn(500);
  409. },
  410. 3000);
  411. },
  412. error: function() {
  413. $('#loading-data-tip').fadeOut(1000, function() { $('#loading-data-tip').remove(); });
  414. }
  415. });
  416. }
  417. function ChartFormatter(data) {
  418. if (data && data.length) {
  419. data.forEach(function(v) {
  420. var str = '<div id="{0}-container_{1}" style="width:100%;height:{2}px;"></div>';
  421. $('#tree-chart').append(str.format('tree', v.roundIndex, 500));
  422. TreePathChart(v, "tree");
  423. $('#fc-chart').append(str.format('fc', v.roundIndex, 420));
  424. FcRoundChart(v, 'fc');
  425. });
  426. }
  427. }
  428. function ScoreChartFormatter(data) {
  429. if (data) {
  430. var str = '<div id="score-container_{0}" style="width:100%;height:{1}px;"></div>';
  431. $('#round-chart').append(str.format('round', 50));
  432. RoundScoreChart(data.scoreInfos);
  433. $('#sg-chart').append(str.format('sg', 400));
  434. SiGongChart(data.siGongInfos);
  435. $('#wl-chart').append(str.format('wl', 300));
  436. WuLiChart(data.wuLiInfos);
  437. }
  438. }
  439. </script>
  440. <script id="scene-script">
  441. function SceneRoundFormatter(data) {
  442. var str = '';
  443. if (data && data.length) {
  444. data.forEach(function (v) {
  445. str += '<div class="round"><span>第{0}轮</span></div>'.format(v.roundIndex);
  446. v.sceneInfos.forEach(function (a) {
  447. str += SceneFormatter(a);
  448. });
  449. });
  450. }
  451. if (str) {
  452. $('#scene-box').html(str);
  453. }
  454. }
  455. function SceneFormatter(data) {
  456. var str = '';
  457. if (data) {
  458. str += '<div class="scene-box">';
  459. str += '<div class="scene-info">';
  460. str += '<div class="name">[情景]:{0}</div>'.format(data.name);
  461. str += '<div class="desc">{0}</div>'.format(data.description);
  462. str += '</div>';
  463. if (data.behaviors && data.behaviors.length) {
  464. data.behaviors.forEach(function (v) {
  465. str += BehaviorFormatter(v);
  466. });
  467. }
  468. str += '</div>';
  469. }
  470. return str;
  471. }
  472. function BehaviorFormatter(data) {
  473. var str = '';
  474. if (data) {
  475. str += '<div class="behavior-info scene-info">';
  476. str += '<div class="name">[规则]:{0}</div>'.format(data.name);
  477. str += '<div class="desc">{0}</div>'.format(data.description);
  478. str += '<div class="score"><span>实际评分:{0} 分</span><span>行为总分:{1} 分</span></div>'.format(data.score,
  479. data.fullScore);
  480. str += '<div class="progress"><div class="progress-bar" style="width:{0}%;"></div></div>'.format(
  481. data.fullScore ? (data.score * 100 / data.fullScore).toFixed(2) : 0);
  482. str += '</div>';
  483. }
  484. return str;
  485. }
  486. </script>
  487. <script id="tag-script">
  488. function TagRoundFormatter(data) {
  489. var str = '';
  490. if (data && data.length) {
  491. str = '<table class="table table-bordered">';
  492. data.forEach(function (v) {
  493. var level = '<div class="l-box"><span class="t-level l-1 big"></span><span>及格</span></div>';
  494. level += '<div class="l-box"><span class="t-level l-2 big"></span><span>良好</span></div>';
  495. level += '<div class="l-box"><span class="t-level l-3 big"></span><span>优秀</span></div>';
  496. str +=
  497. '<thead><tr><th class="round-tag" colspan="20"><strong>第{0}轮</strong><div class="level-box">{1}</div></th></tr></thead>'
  498. .format(
  499. v.roundIndex,
  500. level);
  501. var isFirst = true;
  502. v.sceneInfos.forEach(function (a) {
  503. str += TagFormatter(a, isFirst);
  504. isFirst = false;
  505. });
  506. str += '<tr>';
  507. str += '<th class="b-title">{0}</th>'.format("轮次总结");
  508. v.behaviorTags.forEach(function (vv) {
  509. str += '<td class=""> <span class="t-level l-{0}"><span></td>'.format(vv.level);
  510. });
  511. str += '</tr></tbody>';
  512. });
  513. str += '</table>';
  514. }
  515. if (str) {
  516. $('#tag-box').html(str);
  517. }
  518. }
  519. function TagFormatter(data, isFirst) {
  520. var str = '';
  521. if (data && data.behaviorTags) {
  522. if (isFirst) {
  523. var head = '';
  524. head +=
  525. '<tr class="header"><th class="b-title scene" rowspan="2" >情景信息</th><th class="b-title" colspan="4">四项基本功</th><th class="b-title" colspan="5">五项能力</th></tr>';
  526. head += '<tr>';
  527. data.behaviorTags.forEach(function (v) {
  528. head += '<th class="s-title">{0}</th>'.format(v.tagNo);
  529. });
  530. head += '</tr>';
  531. str += ' <thead>{0}</thead><tbody>'.format(head);;
  532. }
  533. str += '<tr>';
  534. str += '<td class="">{0}</td>'.format(data.name);
  535. data.behaviorTags.forEach(function (v) {
  536. str += '<td class=""> <span class="t-level l-{0}"><span></td>'.format(v.level);
  537. });
  538. str += '</tr>';
  539. }
  540. return str;
  541. }
  542. </script>
  543. <script id="pingYu-script">
  544. function ReviewFormatter(data) {
  545. var str = "";
  546. if (data && data.length) {
  547. data.forEach(function(v) {
  548. if (v.type == @(PortraitRemarkTypeDefinition.ZhuanJia)) {
  549. var s = '<div class="review"><span>{0}</span></div>'.format(v.content);
  550. if (s) {
  551. $('#zj-review').html(s);
  552. }
  553. } else {
  554. str += '<div class="review">';
  555. str += '<strong>{0}</strong>'.format(GetReviewName(v.type));
  556. str += '<span>{0}</span>'.format(v.content);
  557. str += '</div>';
  558. }
  559. });
  560. }
  561. if (str) {
  562. $('#xt-review').html(str);
  563. }
  564. }
  565. function GetReviewName(type) {
  566. switch (type) {
  567. case @(PortraitRemarkTypeDefinition.Scene):
  568. return "场景:";
  569. case @(PortraitRemarkTypeDefinition.SiGong):
  570. return "四项基本功:";
  571. case @(PortraitRemarkTypeDefinition.WuLi):
  572. return "五项能力:";
  573. case @(PortraitRemarkTypeDefinition.Short):
  574. return "成绩与不足:";
  575. case @(PortraitRemarkTypeDefinition.ZhuanJia):
  576. return "专家评语:";
  577. default:
  578. return "";
  579. }
  580. }
  581. </script>
  582. <script id="chart-script">
  583. var color = ['#FF3030', '#FF6A6A', '#FFD700', '#54FF9F', '#00E5EE'];
  584. var roundColor = ['#FFA939', '#FF6A69', '#35D480', '#FFA939', '#FF6A69', '#35D480'];
  585. var mainColor = '#02595a';
  586. //推演网格
  587. function TreePathChart(data, idStr) {
  588. if (data) {
  589. //console.log("TreePath", data);
  590. } else {
  591. console.log("TreePath-Null");
  592. return;
  593. }
  594. //var isRadial = idStr == "hx";
  595. idStr = idStr + '-container_' + data.roundIndex;
  596. if ($('#' + idStr).data('use') === true) {
  597. return;
  598. }
  599. var treeChart = echarts.init(document.getElementById(idStr)), seriesOpt = {};
  600. var d = ConvertTreeData(data.infos, false); // isRadial);
  601. //console.log("ConvertTreeData", d);
  602. //if (isRadial) {
  603. // seriesOpt = {
  604. // layout: 'radial'
  605. // }
  606. //}
  607. var opt = {
  608. type: 'tree',
  609. data: d,
  610. top: '5%',
  611. left: '5%',
  612. bottom: '5%',
  613. right: '5%',
  614. symbolSize: 10,
  615. initialTreeDepth: -1,
  616. label: {
  617. position: 'top',
  618. rotate: 0,
  619. fontSize: 11,
  620. fontWeight: 'normal',
  621. distance: 1
  622. },
  623. lineStyle: {
  624. width: 2
  625. },
  626. itemStyle: {
  627. borderWidth: 1
  628. },
  629. leaves: {
  630. itemStyle: {
  631. borderWidth: 1.5
  632. }
  633. },
  634. expandAndCollapse: true,
  635. animationDuration: 550,
  636. animationDurationUpdate: 450
  637. };
  638. var o = $.extend(true, {}, opt, seriesOpt);
  639. //console.log(o);
  640. var option = {
  641. title: {
  642. text: "第" + data.roundIndex + "轮情景演变示意图",
  643. show: true,
  644. left: 'center',
  645. textStyle: {
  646. color: mainColor
  647. }
  648. },
  649. tooltip: {
  650. trigger: 'item',
  651. triggerOn: 'mousemove',
  652. formatter: function (p) {
  653. return p.data.showName;
  654. },
  655. backgroundColor: "#c7f0f3",
  656. textStyle: { color: mainColor, fontSize: 12 },
  657. padding: [8, 15]
  658. },
  659. series: [o]
  660. };
  661. treeChart.setOption(option);
  662. $('#' + idStr).data('use', true);
  663. }
  664. //蜂巢网格
  665. function FcRoundChart(data, idStr) {
  666. if (data) {
  667. var seriesData = [];
  668. seriesData.push($.extend({}, { name: data.fcInfo.name, type: 'tilemap', data: data.fcInfo.fcInfos }));
  669. if (data.fcFlowInfo && data.fcFlowInfo.length > 0) {
  670. data.fcFlowInfo.forEach(function (v) {
  671. seriesData.push($.extend({}, { name: v.name, type: 'spline', data: v.flowInfos }));
  672. });
  673. }
  674. console.log(seriesData);
  675. idStr = idStr + '-container_' + data.roundIndex;
  676. if ($('#' + idStr).data('use') === true) {
  677. return;
  678. }
  679. window.Highcharts.chart(idStr,
  680. {
  681. chart: {
  682. //events:{
  683. // load:function(e){
  684. // var curDiv=this.container;
  685. // //svg标签转img标签,某些邮件客户端支持img_svg,不支持svg标签
  686. // var svg=curDiv.innerHTML;
  687. // var imgStr="<img src=\"data:image/svg+xml;base64,"+utoa(svg)+"\" >";
  688. // curDiv.outerHTML=imgStr;
  689. // }
  690. //},
  691. reflow: true,
  692. height: '60%',
  693. margin: 10,
  694. inverted: false,
  695. //backgroundColor: {
  696. // linearGradient: [0, 0, 500, 500],
  697. // stops: [
  698. // [0, 'rgba(255, 255, 255,0)'],
  699. // [1, 'rgba(200, 200, 255,0)']
  700. // ]
  701. //}
  702. backgroundColor: '#ffffff'
  703. //plotBackgroundColor:'#f3fffe'
  704. //plotBackgroundColor: {
  705. // linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
  706. // stops: [
  707. // [0, '#F5F5F5'],
  708. // [0.5, '#FFffFF'],
  709. // [1, '#F5F5F5']
  710. // ]
  711. //}
  712. },
  713. exporting: {
  714. enabled: false
  715. },
  716. title: {
  717. text: "第" + data.roundIndex + "轮情景流蜂巢示意图",
  718. align: 'center',
  719. floating: false,
  720. margin: 125,
  721. style: {
  722. 'color': mainColor,
  723. 'fontWeight': '600',
  724. 'fontFamily': 'sans-serif'
  725. },
  726. y: 25
  727. },
  728. xAxis: {
  729. visible: false
  730. },
  731. yAxis: {
  732. visible: false,
  733. reversed: true
  734. },
  735. colorAxis: {
  736. visible: false,
  737. dataClasses: [
  738. {
  739. from: 0,
  740. to: 1,
  741. color: '#c7f0f3',
  742. name: ''
  743. }, {
  744. from: 1,
  745. to: 2,
  746. color: mainColor,
  747. name: ''
  748. }
  749. ]
  750. },
  751. tooltip: {
  752. enabled: false,
  753. headerFormat: '',
  754. pointFormat: ''
  755. },
  756. colors: ['#c7f0f3'],
  757. legend: {
  758. enabled: false
  759. },
  760. credits: {
  761. enabled: false
  762. },
  763. plotOptions: {
  764. tilemap: {
  765. allowPointSelect: true,
  766. clip: true,
  767. cursor: 'pointer',
  768. enableMouseTracking: false
  769. },
  770. spline: {
  771. enableMouseTracking: false,
  772. lineWidth: 5,
  773. marker: {
  774. enabled: false
  775. },
  776. series: {
  777. animation: {
  778. duration: 3000
  779. }
  780. }
  781. }
  782. },
  783. series: seriesData
  784. });
  785. $('#' + idStr).data('use', true);
  786. }
  787. }
  788. //轮次得分条
  789. function RoundScoreChart(data) {
  790. if ($('#score-container_round').data('use') === true) {
  791. return;
  792. }
  793. if (data && data.length > 0) {
  794. // console.log("RoundScore", data);
  795. } else {
  796. console.log("RoundScore-Null");
  797. return;
  798. }
  799. var scoreChart = echarts.init(document.getElementById('score-container_round'));
  800. var series = [];
  801. for (var i = 0; i < data.length; i++) {
  802. var temp = {
  803. name: '第 ' + (i + 1) + ' 轮',
  804. type: 'bar',
  805. stack: '总分',
  806. label: {
  807. normal: {
  808. show: true,
  809. position: 'inside',
  810. color: "#fff",
  811. fontSize: 14,
  812. fontWeight: 'bold',
  813. formatter: '{a}: {c} 分'
  814. }
  815. },
  816. barWidth: 40,
  817. barMinHeight: 150,
  818. itemStyle: {},
  819. data: [data[i]]
  820. };
  821. if (i === 0 && i === data.length - 1) {
  822. temp.itemStyle = {
  823. barBorderRadius: [30]
  824. }
  825. } else if (i === 0) {
  826. temp.itemStyle = {
  827. barBorderRadius: [30, 0, 0, 30]
  828. }
  829. } else if (i === data.length - 1) {
  830. temp.itemStyle = {
  831. barBorderRadius: [0, 30, 30, 0]
  832. }
  833. }
  834. temp.itemStyle.color = roundColor[i % 3];
  835. series.push(temp);
  836. }
  837. var option = {
  838. grid: {
  839. left: 0,
  840. right: 0
  841. },
  842. xAxis: {
  843. show: false,
  844. type: 'value'
  845. },
  846. yAxis: {
  847. show: false,
  848. type: 'category',
  849. data: ['分数']
  850. },
  851. series: series
  852. };
  853. //console.log(option);
  854. scoreChart.setOption(option);
  855. $('#score-container_round').data('use', true);
  856. }
  857. //四功
  858. function SiGongChart(data) {
  859. if ($('#score-container_sg').data('use') === true) {
  860. return;
  861. }
  862. if (data && data.length > 0) {
  863. //console.log("SiGong", data);
  864. } else {
  865. console.log("SiGong-Null");
  866. return;
  867. }
  868. var series = [];
  869. var legendDate = [];
  870. var sgData = [];
  871. for (var i = 1; i <= data.length; i++) {
  872. if (i > 4) {
  873. return;
  874. }
  875. var item = data[i - 1];
  876. legendDate.push(item.name);
  877. sgData.push([]);
  878. }
  879. if (data[0] && data[0].tagScoreInfos) {
  880. var roundCount = data[0].tagScoreInfos.length;
  881. for (var w = 1; w <= data.length; w++) {
  882. if (w > 4) {
  883. return;
  884. }
  885. var scores = data[w - 1].tagScoreInfos;
  886. for (var q = 0; q < scores.length; q++) {
  887. sgData[q].push(scores[q]);
  888. }
  889. }
  890. for (var j = 0; j < roundCount; j++) {
  891. var temp = {
  892. name: '第 ' + (j + 1) + ' 轮',
  893. type: 'bar',
  894. label: {
  895. normal: {
  896. show: true,
  897. formatter: '{a}:{c} 分',
  898. color: "#fff",
  899. rotate: 90
  900. }
  901. },
  902. barMinHeight: 150,
  903. itemStyle: {
  904. color: {
  905. type: 'linear',
  906. x: 0,
  907. y: 0,
  908. x2: 0,
  909. y2: 1,
  910. colorStops: [
  911. {
  912. offset: 0,
  913. color: roundColor[j % 3] // 0% 处的颜色
  914. }, {
  915. offset: 1,
  916. color: '#27303f' // 100% 处的颜色
  917. }
  918. ]
  919. },
  920. barBorderRadius: [50, 50, 0, 0]
  921. //shadowBlur: 2,
  922. //shadowColor: "#666",
  923. //shadowOffsetX: 2,
  924. //shadowOffsetY: 1
  925. },
  926. data: sgData[j]
  927. };
  928. series.push(temp);
  929. }
  930. }
  931. var option = {
  932. grid: {
  933. top: 40,
  934. bottom: 40,
  935. left: 30,
  936. right: 30,
  937. borderColor: mainColor
  938. },
  939. title: {
  940. text: "四功能力评析示意图",
  941. show: true,
  942. left: 'center',
  943. textStyle: {
  944. color: mainColor
  945. }
  946. },
  947. //legend: {
  948. // data: legendDate
  949. //},
  950. xAxis: {
  951. type: 'category',
  952. data: legendDate,
  953. axisLabel: {
  954. color: mainColor
  955. },
  956. axisLine: {
  957. show: true,
  958. lineStyle: {
  959. color: mainColor
  960. }
  961. }
  962. },
  963. yAxis: {
  964. type: 'value',
  965. axisLabel: {
  966. color: mainColor
  967. },
  968. axisLine: {
  969. show: true,
  970. lineStyle: {
  971. color: mainColor
  972. }
  973. },
  974. splitLine: {
  975. lineStyle: {
  976. color: mainColor
  977. }
  978. }
  979. },
  980. series: series
  981. };
  982. //console.log(option);
  983. var siGongChart = echarts.init(document.getElementById('score-container_sg'));
  984. siGongChart.setOption(option);
  985. $('#score-container_sg').data('use', true);
  986. }
  987. //五力
  988. function WuLiChart(data) {
  989. if ($('#score-container_wl').data('use') === true) {
  990. return;
  991. }
  992. if (data && data.length > 0) {
  993. //console.log("WuLi", data);
  994. } else {
  995. console.log("WuLi-Null");
  996. return;
  997. }
  998. var indicatorData = [];
  999. for (var i = 1; i <= data.length; i++) {
  1000. if (i > 5) {
  1001. return;
  1002. }
  1003. var item = data[i - 1];
  1004. indicatorData.push({ text: item.name, max: 100, color: color[i - 1] });
  1005. }
  1006. var series = [];
  1007. var wlData = [];
  1008. var radar = [
  1009. {
  1010. indicator: indicatorData,
  1011. center: ['30%', '50%'],
  1012. radius: 120,
  1013. splitNumber: 5,
  1014. axisLine: {
  1015. lineStyle: {
  1016. color: ['#C1CDCD']
  1017. }
  1018. },
  1019. splitLine: {
  1020. lineStyle: {
  1021. color: ['#00ced1', mainColor]
  1022. }
  1023. }
  1024. }
  1025. ];
  1026. if (data[0] && data[0].tagScoreInfos) {
  1027. var roundCount = data[0].tagScoreInfos.length;
  1028. var h = 175 * roundCount;
  1029. if (h > 300) {
  1030. $('#score-container_wl').height(h);
  1031. }
  1032. var radarTemp = {
  1033. indicator: indicatorData,
  1034. radius: 40,
  1035. center: ['77%', '25%'],
  1036. splitNumber: 3,
  1037. nameGap: 5,
  1038. axisLine: {
  1039. show: false
  1040. },
  1041. splitLine: {
  1042. lineStyle: {
  1043. color: ['#00ced1', mainColor]
  1044. }
  1045. }
  1046. };
  1047. var minSplit = (100 / (roundCount + 1)).toFixed(2);
  1048. for (var j = 0; j <= roundCount; j++) {
  1049. var temp = {
  1050. name: '第 ' + j + ' 轮',
  1051. type: 'radar',
  1052. radarIndex: j
  1053. }
  1054. if (j === 0) {
  1055. temp.name = '五力雷达图';
  1056. temp.data = wlData;
  1057. } else {
  1058. wlData.push({ name: '第 ' + j + ' 轮', value: [], lineStyle: { color: roundColor[j - 1] } });
  1059. temp.lineStyle = {
  1060. color: roundColor[j - 1]
  1061. };
  1062. temp.data = [wlData[j - 1]];
  1063. radar.push($.extend(true, {}, radarTemp, { center: ['77%', (minSplit * j) + '%'] }));
  1064. }
  1065. series.push(temp);
  1066. }
  1067. for (var w = 1; w <= data.length; w++) {
  1068. if (w > 5) {
  1069. return;
  1070. }
  1071. var scores = data[w - 1].tagScoreInfos;
  1072. for (var q = 0; q < scores.length; q++) {
  1073. wlData[q].value.push(scores[q]);
  1074. }
  1075. }
  1076. }
  1077. var option = {
  1078. grid: { top: 10, bottom: 10, left: 30, right: 30 },
  1079. title: {
  1080. text: "五力能力评析示意图",
  1081. show: true,
  1082. left: 'center',
  1083. textStyle: {
  1084. color: mainColor
  1085. }
  1086. },
  1087. radar: radar,
  1088. series: series
  1089. };
  1090. //console.log(option);
  1091. var wuLiChart = echarts.init(document.getElementById('score-container_wl'));
  1092. wuLiChart.setOption(option);
  1093. $('#score-container_wl').data('use', true);
  1094. }
  1095. function ConvertTreeData(data, isRadial) {
  1096. var newData = [];
  1097. var color1 = "#02595a",
  1098. color2 = "#999",
  1099. width1 = 2, // isRadial ? 2 : 4,
  1100. width2 = 1; // isRadial ? 1 : 3;
  1101. if (data && data.length) {
  1102. data.forEach(function (v) {
  1103. var newItem = $.extend(true,
  1104. {},
  1105. {
  1106. itemStyle: {
  1107. color: color2,
  1108. borderColor: color2,
  1109. width: width2
  1110. },
  1111. label: {
  1112. color: "#999"
  1113. },
  1114. lineStyle: {
  1115. color: color2,
  1116. borderColor: color2,
  1117. width: width2
  1118. }
  1119. },
  1120. v);
  1121. newItem.showName = newItem.name;
  1122. newItem.name = newItem.name.indexOf('情景流') == 0
  1123. ? "情景流"
  1124. : newItem.name.indexOf('情景') == 0
  1125. ? "情景"
  1126. : newItem.name;
  1127. newItem.collapsed = true;
  1128. if (v.isRun) {
  1129. newItem.itemStyle.color = color1;
  1130. newItem.itemStyle.borderColor = color1;
  1131. newItem.itemStyle.width = width1;
  1132. newItem.label.color = color1;
  1133. newItem.label.fontWeight = 'bold';
  1134. newItem.lineStyle.color = color1;
  1135. newItem.lineStyle.borderColor = color1;
  1136. newItem.lineStyle.width = width1;
  1137. newItem.collapsed = false;
  1138. }
  1139. if (v.children && v.children.length) {
  1140. newItem.children = ConvertTreeData(v.children, isRadial);
  1141. }
  1142. newData.push(newItem);
  1143. });
  1144. }
  1145. return newData;
  1146. }
  1147. // 使用utf-8字符集进行base64编码
  1148. function utoa(str) {
  1149. return window.btoa(unescape(encodeURIComponent(str)));
  1150. }
  1151. // 使用utf-8字符集解析base64字符串
  1152. function atou(str) {
  1153. return decodeURIComponent(escape(window.atob(str)));
  1154. }
  1155. </script>
  1156. <script>
  1157. var loading =
  1158. '<div id="{0}" 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; ">{1}</div></div>';
  1159. $('#report').data("group-info", @(Html.Raw(group.Obj2StringCamelCase())));
  1160. GetReportData();
  1161. </script>
  1162. if (Model.IsSystem)
  1163. {
  1164. <script>
  1165. setTimeout(function () { $('.preloader').fadeOut(600); }, 50);
  1166. var hasLoad = false;
  1167. $(function() {
  1168. $('#export button').text("导出PDF").prop("disabled", false);
  1169. hasLoad = true;
  1170. });
  1171. function ExportSql() {
  1172. if (!hasLoad) {
  1173. $('#export button').text("正在加载PDF导出插件").prop("disabled", true);
  1174. abp.message.warn("PDF导出插件正在加载中,请稍后...!");
  1175. return;
  1176. }
  1177. $('body').append(loading.format('loading-report-tip','正在导出演练报告,请稍后!'));
  1178. $('#loading-report-tip').fadeIn(500,
  1179. function() {
  1180. try {
  1181. ReportToPdf();
  1182. } catch (e) {
  1183. console.log("ReportToPdf", e);
  1184. abp.message.error("导出失败!");
  1185. } finally {
  1186. $('#loading-report-tip').fadeOut(1000, function () { $('#loading-report-tip').remove(); });
  1187. }
  1188. });
  1189. @*$('#report .first-page').css('display', 'flex');
  1190. ExportSqlPdf('report', '@(group.Name)演练报告-' + new Date().format('yyMMddhhmm'));
  1191. $('#report .first-page').css('display', 'none');*@
  1192. }
  1193. </script>
  1194. <script src="~/Content/Libs/canvg/umd.js"></script>
  1195. <script src="~/Content/Libs/jsPdf/dist/jspdf.umd.min.js"></script>
  1196. <script src="~/Content/Libs/jsPdf/CustomFonts/jspdf.customfonts.min.js"></script>
  1197. <script src="~/Content/Libs/jsPdf/CustomFonts/iwbyue-normal.js"></script>
  1198. <script src="~/Content/Libs/jsPdf/CustomFonts/iwbyue-bold.js"></script>
  1199. <script id="pdf-script">
  1200. window.jsPDF = window.jspdf.jsPDF;
  1201. var doc, mr = 20, mw = 210 - mr, mh = 297 - mr, w = 0, h = 0;
  1202. function ReportToPdf() {
  1203. var group = $('#report').data("group-info"), data = $('#report').data("report-info");
  1204. //console.log("ReportToPdf", group, data);
  1205. doc = new jsPDF('p', 'mm', 'a4');
  1206. doc.addFileToVFS('iwbyue-normal.ttf', font);
  1207. doc.addFont('iwbyue-normal.ttf', 'iwbyue', 'normal');
  1208. doc.addFileToVFS('iwbyue-bold.ttf', fontb);
  1209. doc.addFont('iwbyue-bold.ttf', 'iwbyue', 'bold');
  1210. // set font
  1211. doc.setFont("iwbyue", "normal");
  1212. doc.setTextColor(2, 89, 90);
  1213. w = mr;
  1214. h = mr;
  1215. Face();
  1216. if (group) {
  1217. WriteTitle("演练信息");
  1218. Info1(group);
  1219. }
  1220. if (data) {
  1221. WriteTitle("演练过程");
  1222. Info2(data);
  1223. WriteTitle("演练能力");
  1224. Info3(data);
  1225. WriteTitle("能力解析");
  1226. Info4(data);
  1227. }
  1228. doc.save("@(group.Name)演练报告@(DateTime.Now.ToString("yyyyMMddHHmm")).pdf");
  1229. }
  1230. //封面
  1231. function Face() {
  1232. var name = "@(SettingManager.GetSettingValue(IwbSettingNames.ReportCompany))";
  1233. var hh = mh / 2 - 50;
  1234. doc.setFontSize(30);
  1235. var l = doc.getTextDimensions(name), lw = Math.ceil(l.w), lh = Math.ceil(l.h );
  1236. var ww = ((mw - lw - mr) / 2) + mr;
  1237. doc.text(name, ww, hh);
  1238. hh = hh + lh+10;
  1239. doc.setFontSize(28);
  1240. name = "@(SettingManager.GetSettingValue(IwbSettingNames.ReportName))";
  1241. l = doc.getTextDimensions(name), lw = Math.ceil(l.w), lh = Math.ceil(l.h);
  1242. ww = ((mw - lw - mr) / 2) + mr;
  1243. doc.text(name, ww, hh);
  1244. hh = mh / 2 + 50;
  1245. var date = new Date().format("yyyy - MM - dd");
  1246. doc.setFontSize(24);
  1247. l = doc.getTextDimensions(date), lw = Math.ceil(l.w);
  1248. ww = ((mw - lw - mr) / 2) + mr;
  1249. doc.text(date, ww, hh);
  1250. }
  1251. //演练信息
  1252. function Info1(group) {
  1253. doc.setFont("iwbyue", "bold");
  1254. var ww = WriteTitleSm("演练分组:");
  1255. WriteText(group.name, ww);
  1256. //WriteText("演练分组:{0}".format(group.name));
  1257. ww = WriteTitleSm("培 训 营:");
  1258. WriteText(group.campName, ww + 1);
  1259. ww = WriteTitleSm("演练分组:");
  1260. WriteText(group.packageName, ww);
  1261. ww = WriteTitleSm("演练时长:");
  1262. 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);
  1263. ww = WriteTitleSm("演练角色:");
  1264. WriteText(group.roleNames, ww, true);
  1265. ww = WriteTitleSm("演练成绩:");
  1266. WriteText($("#eval-result").text(), ww);
  1267. }
  1268. //演练过程
  1269. function Info2(data) {
  1270. WriteTitleSm("情景演变图:", true);
  1271. h = h - 5;
  1272. C1();
  1273. AddPage();
  1274. WriteTitleSm("情景蜂巢图:", true);
  1275. h = h - 5;
  1276. C2();
  1277. AddPage();
  1278. WriteTitleSm("演练过程得分详解:", true);
  1279. C3(data.scenes);
  1280. function C1() {
  1281. $('#tree-chart').find('canvas').each(function (i, v) {
  1282. var chart = echarts.getInstanceByDom(document.getElementById('tree-container_' + (i + 1)));
  1283. var img = new Image();
  1284. img.src = chart.getDataURL({
  1285. pixelRatio: 1,
  1286. backgroundColor: '#fff'
  1287. });
  1288. h = h - 5;
  1289. var hh = 83;
  1290. if (h+hh > mh) {
  1291. AddPage();
  1292. }
  1293. doc.addImage(img, 'JPEG', w+15, h, mw - mr-15, hh);
  1294. h = hh + h;
  1295. });
  1296. }
  1297. function C2() {
  1298. //console.log(window.Highcharts.charts);
  1299. //window.Highcharts.charts.forEach(function (v) {
  1300. // var hh = 100;
  1301. // if (h + hh > mh) {
  1302. // AddPage();
  1303. // }
  1304. // var svg = v.getSVG();
  1305. // //var canvas = document.createElement('canvas');
  1306. // //var dataUrl = v.getImageData();
  1307. // //console.log("111",dataUrl);
  1308. // //var img = new Image();
  1309. // //img.src = dataUrl;
  1310. // //var imgData = canvas.toDataURL('image/png');
  1311. // //var img = v.getImageData();
  1312. // //doc.addImage(imgData, 'JPEG', w, h, mw - mr, hh);
  1313. // doc.addSvgAsImage(svg, w, h, mw - mr, hh);
  1314. // h = hh + h;
  1315. //});
  1316. //window.Highcharts.charts.forEach(function (v) {
  1317. // var hh = 90;
  1318. // if (h + hh > mh) {
  1319. // AddPage();
  1320. // }
  1321. // var svg = v.getSVG();
  1322. // var canvas = document.createElement('canvas');
  1323. // canvas.width = mw - mr;
  1324. // canvas.height = hh;
  1325. // var ctx = canvas.getContext("2d");
  1326. // ctx.fillStyle = "#fff";
  1327. // ctx.fillRect(0, 0, canvas.width, canvas.height);
  1328. // var ops = {
  1329. // ignoreMouse: true,
  1330. // ignoreAnimation: true,
  1331. // ignoreDimensions: true
  1332. // };
  1333. // var vv = window.canvg.Canvg.fromString(ctx, svg, ops);
  1334. // vv.render(ops);
  1335. // doc.addImage(canvas.toDataURL("image/jpeg", 1.0),"png" , w, h, mw - mr, hh);
  1336. // h = hh + h;
  1337. //});
  1338. $('#fc-chart').find('svg').each(function (i,v) {
  1339. var hh = 83;
  1340. if (h + hh > mh) {
  1341. AddPage();
  1342. }
  1343. var svg = $(v).parent()[0].innerHTML;
  1344. if (svg)
  1345. svg = svg.replace(/\r?\n|\r/g, '').trim();
  1346. var canvas = document.createElement('canvas');
  1347. var www=15,ww = mw - mr - www;
  1348. canvas.width =ww;
  1349. canvas.height = hh;
  1350. var ctx = canvas.getContext("2d");
  1351. ctx.fillStyle = "#fff";
  1352. ctx.fillRect(0, 0, canvas.width, canvas.height);
  1353. var ops = {
  1354. ignoreMouse: true,
  1355. ignoreAnimation: true,
  1356. ignoreDimensions: true
  1357. };
  1358. var vv = window.canvg.Canvg.fromString(ctx, svg, ops);
  1359. vv.resize();
  1360. vv.start();
  1361. //vv.render(ops);
  1362. doc.addImage(canvas.toDataURL("image/png"),"png" , w+www, h, ww, hh);
  1363. h = hh + h;
  1364. });
  1365. //$('#fc-chart').find('svg').each(function (i, v) {
  1366. // var hh = 90;
  1367. // if (h + hh > mh) {
  1368. // AddPage();
  1369. // }
  1370. // //var svg = $('#fc-container_' + (i + 1)).find('svg').parent()[0].innerHTML;
  1371. // //var svg = $(v).parent()[0].innerHTML;
  1372. // //var canvas = document.createElement('canvas');
  1373. // //console.log(svg);
  1374. // //if (svg)
  1375. // // svg = svg.replace(/\r?\n|\r/g, '').trim();
  1376. // //var vv = window.canvg.Canvg.fromString(canvas, svg);
  1377. // //vv.start();
  1378. // //console.log(canvas);
  1379. // // $(body).append(canvas);
  1380. // //var imgData = canvas.toDataURL('image/png');
  1381. // //var img = v.getImageData();
  1382. // //var img = new Image();
  1383. // //var imgData = $(v).attr("src").replace("data:image/svg+xml;base64,", "");
  1384. // //img.src = imgData
  1385. // //console.log(imgData);
  1386. // //var img = ImgToDataUrl($(v).attr("src"), CallbackBase64);
  1387. // //doc.addImage(svg, 'png', w, h, mw - mr, hh);
  1388. // doc.addSvgAsImage($(v).attr("src"), w, h, mw - mr, hh);
  1389. // h = hh + h;
  1390. //});
  1391. }
  1392. function C3(data) {
  1393. if (data&&data.length) {
  1394. data.forEach(function(v) {
  1395. Round(v.roundIndex);
  1396. Scene(v.sceneInfos);
  1397. });
  1398. }
  1399. function Round(index) {
  1400. var txt = "第 {0} 轮".format(index);
  1401. doc.setFontSize(16);
  1402. doc.setFont("iwbyue", "bold");
  1403. var l = doc.getTextDimensions(txt), lw = Math.ceil(l.w), lh = Math.ceil(l.h);
  1404. //console.log(l);
  1405. var ww = ((mw - lw - mr) / 2) + mr;
  1406. doc.text(txt, ww, h);
  1407. doc.setFont("iwbyue", "normal");
  1408. h = h + 2;
  1409. doc.setLineWidth(1);
  1410. doc.setLineDash([0]);
  1411. doc.setDrawColor(2, 89, 90);
  1412. doc.line(ww - 3, h, ww + lw + 3, h);
  1413. doc.setFontSize(16);
  1414. h = h + 10;
  1415. if (h > mh) {
  1416. AddPage();
  1417. }
  1418. }
  1419. function Scene(data) {
  1420. if (data && data.length) {
  1421. data.forEach(function (v) {
  1422. WriteTitleSm("[情景] {0}".format(v.name), true);
  1423. WriteText(v.description, 5, true, 13, 2);
  1424. Behavior(v.behaviors);
  1425. doc.setLineWidth(0.1);
  1426. doc.setLineDash([2.5]);
  1427. doc.setDrawColor(2, 89, 90);
  1428. h = h - 5;
  1429. doc.line(mr - 5, h, mw + 5, h);
  1430. h = h + 10;
  1431. if (h > mh) {
  1432. AddPage();
  1433. }
  1434. doc.setFontSize(16);
  1435. });
  1436. }
  1437. }
  1438. function Behavior(data) {
  1439. if (data && data.length) {
  1440. data.forEach(function (v) {
  1441. // WriteTitleSm("[规则][得分:{1}/{2}] {0}".format(v.name, v.score, v.fullScore), true);
  1442. WriteTitleSm("[规则] [得分:{1}/{2}] {0}".format("", v.score, v.fullScore), true,14);
  1443. WriteText(v.description, 5, true, 12, 2);
  1444. if (h > mh) {
  1445. AddPage();
  1446. }
  1447. });
  1448. }
  1449. }
  1450. }
  1451. function ImgToDataUrl(src, callback, imageType) {
  1452. var img = new Image();
  1453. imageType = imageType || 'image/png';
  1454. img.setAttribute('crossOrigin', 'anonymous');
  1455. img.onload = function () {
  1456. /*image completely converted to base64string */
  1457. var canvas = document.createElement('CANVAS');
  1458. var ctx = canvas.getContext('2d');
  1459. canvas.height = this.height;
  1460. canvas.width = this.width;
  1461. ctx.drawImage(this, 0, 0);
  1462. var dataURL = canvas.toDataURL(imageType);
  1463. //img.src = dataURL;
  1464. /* call back function */
  1465. callback(dataURL);
  1466. };
  1467. img.src = src;
  1468. if (img.complete || img.complete === undefined) {
  1469. img.src = src;
  1470. }
  1471. return img;
  1472. }
  1473. function CallbackBase64(base64Img)
  1474. {
  1475. /*base64Img contains full base64string of image */
  1476. console.log("XXXXX",base64Img);
  1477. }
  1478. }
  1479. //演练能力
  1480. function Info3(data) {
  1481. WriteTitleSm("轮次评分:", true);
  1482. C4();
  1483. WriteTitleSm("四功评析:", true);
  1484. C5();
  1485. WriteTitleSm("五力评析:", true);
  1486. C6(data.scenes);
  1487. function C4() {
  1488. var chart = echarts.getInstanceByDom(document.getElementById('score-container_round'));
  1489. var img = new Image();
  1490. img.src = chart.getDataURL({
  1491. pixelRatio: 1,
  1492. backgroundColor: '#fff'
  1493. });
  1494. h = h - 5;
  1495. var hh = 12;
  1496. if (h+hh > mh) {
  1497. AddPage();
  1498. }
  1499. doc.addImage(img, 'JPEG', w, h, mw - mr, hh);
  1500. h = hh + h+10;
  1501. }
  1502. function C5() {
  1503. var chart = echarts.getInstanceByDom(document.getElementById('score-container_sg'));
  1504. var img = new Image();
  1505. img.src = chart.getDataURL({
  1506. pixelRatio: 1,
  1507. backgroundColor: '#fff'
  1508. });
  1509. h = h - 5;
  1510. var hh = 90;
  1511. if (h+hh > mh) {
  1512. AddPage();
  1513. }
  1514. doc.addImage(img, 'JPEG', w, h, mw - mr, hh);
  1515. h = hh + h+10;
  1516. }
  1517. function C6(data) {
  1518. var chart = echarts.getInstanceByDom(document.getElementById('score-container_wl'));
  1519. var img = new Image();
  1520. img.src = chart.getDataURL({
  1521. pixelRatio: 1,
  1522. backgroundColor: '#fff'
  1523. });
  1524. h = h - 5;
  1525. var hh = 35 * data.length || 105;
  1526. if (h+hh > mh) {
  1527. AddPage();
  1528. }
  1529. doc.addImage(img, 'JPEG', w, h, mw - mr, hh);
  1530. h = hh + h+10;
  1531. }
  1532. }
  1533. var th = 13, th2 = 9, tw1 = 34, tw2 = 14, tw3 = 19,mr2=5;
  1534. function Info4(data) {
  1535. doc.setFontSize(10);
  1536. var ll = doc.getTextDimensions("我");
  1537. var c = Math.floor((tw1 - mr2) / ll.w);
  1538. WriteTitleSm("四功五力解析详情:", true);
  1539. h = h - 5;
  1540. C9(data.scenes);
  1541. h = h + 10;
  1542. //WriteTitle("系统评语:", true);
  1543. WriteTitleSm("四项基本功:", true);
  1544. WriteText(data.reportEvalStrings[0].content, 0, true, 12, 2);
  1545. WriteTitleSm("五项能力:", true);
  1546. WriteText(data.reportEvalStrings[1].content, 0, true, 12, 2);
  1547. WriteTitleSm("成绩与不足:", true);
  1548. WriteText(data.reportEvalStrings[2].content, 0, true, 12, 2);
  1549. WriteTitleSm("专家评语:", true);
  1550. WriteText(data.reportEvalStrings[3].content, 0, true, 12, 2);
  1551. function C9(data) {
  1552. if (data&&data.length) {
  1553. data.forEach(function (v) {
  1554. RoundTh(v.roundIndex);
  1555. SceneTd(v.sceneInfos);
  1556. var hh = WriteSceneName("轮次总结");
  1557. Tags(v.behaviorTags, hh);
  1558. h=h+hh;
  1559. doc.line(mr, h, mw, h);
  1560. });
  1561. }
  1562. function RoundTh(index) {
  1563. //var th = window.th, tw1 = window.tw1, tw2 = window.tw2, tw3 = window.tw3;
  1564. w = mr;
  1565. //doc.setFontType("bold");
  1566. doc.setFontSize(20);
  1567. doc.setFont("iwbyue", "bold");
  1568. var txt = "第 {0} 轮".format(index);
  1569. var l = doc.getTextDimensions(txt);
  1570. var ww = mr + 15;
  1571. var hh = h + (th - l.h) / 2 + l.h;
  1572. doc.setLineWidth(0.2);
  1573. doc.setDrawColor(2, 89, 90);
  1574. doc.line(mr, h, mw, h);
  1575. doc.line(mr, h, mr, h+th);
  1576. doc.line(mw, h, mw, h + th);
  1577. doc.text(txt, ww, hh);
  1578. doc.setFontSize(14);
  1579. doc.setLineWidth(0.1);
  1580. doc.setDrawColor(255, 0, 0);
  1581. doc.setFillColor(255, 0, 0);
  1582. //doc.setFontType("normal");
  1583. var tw = 20;
  1584. ww = mw - tw * 3 - 10;
  1585. doc.circle(ww, h+th/2, 2.5, "FD");
  1586. doc.text("及格", ww + 5, h + th/2+2);
  1587. ww = ww + tw;
  1588. doc.setDrawColor(255, 165, 0);
  1589. doc.setFillColor(255, 165, 0);
  1590. doc.circle(ww, h+th/2, 2.5, "FD");
  1591. doc.text("良好", ww + 5, h + th/2 +2 );
  1592. ww = ww + tw;
  1593. doc.setDrawColor(0,255, 0);
  1594. doc.setFillColor(0,255, 0);
  1595. doc.circle(ww, h+th/2, 2.5, "FD");
  1596. doc.text("优秀", ww + 5, h + th / 2 + 2);
  1597. doc.setLineWidth(0.2);
  1598. h = th + h;
  1599. doc.setDrawColor(2, 89, 90);
  1600. doc.line(mr, h, mw, h);
  1601. //doc.setFontType("bold");
  1602. doc.line(mr,h,mr,h+th2*2);
  1603. doc.line(mr + tw1, h, mr + tw1, h + th2 *2);
  1604. txt = "情 景 信 息";
  1605. l = doc.getTextDimensions(txt);
  1606. ww = mr + (tw1 - l.w) / 2;
  1607. hh = h + (th2*2 - l.h) / 2 + l.h;
  1608. doc.text(txt, ww, hh);
  1609. doc.line(mr + tw1 + tw2 * 3 + tw3, h, mr + tw1 + tw2 * 3 + tw3, h + th2*2);
  1610. txt = "四 项 基 本 功";
  1611. l = doc.getTextDimensions(txt);
  1612. hh = h + (th2 - l.h) / 2 + l.h;
  1613. ww = mr+tw1 + (tw2 * 3 + tw3 - l.w) / 2;
  1614. doc.text(txt, ww, hh);
  1615. doc.line(mw, h, mw, h + th2*2);
  1616. txt = "五 项 能 力";
  1617. l = doc.getTextDimensions(txt);
  1618. ww = mr + tw1 + tw2 * 3 + tw3+ (tw2 * 4 + tw3 - l.w) / 2;
  1619. hh = h + (th2 - l.h) / 2 + l.h;
  1620. doc.text(txt, ww, hh );
  1621. doc.line(mr + tw1, h + th2, mw, h + th2);
  1622. h = th2 + h;
  1623. doc.setFontSize(10);
  1624. //doc.setFontType("normal");
  1625. w = mr + tw1 + tw2;
  1626. doc.line(w, h, w, h + th2);
  1627. txt = "对上级";
  1628. l = doc.getTextDimensions(txt);
  1629. ww = w - (tw2 - l.w) / 2 - l.w;
  1630. hh = h + (th2 - l.h) / 2 + l.h;
  1631. doc.text(txt, ww, hh);
  1632. w = w+ tw2;
  1633. doc.line(w, h, w, h + th2);
  1634. txt = "对下级";
  1635. ww = w - (tw2 - l.w) / 2 - l.w;
  1636. doc.text(txt, ww, hh);
  1637. w = w+ tw3;
  1638. doc.line(w, h, w, h + th2);
  1639. txt = "对相关单位";
  1640. //doc.setFontSize(8);
  1641. l = doc.getTextDimensions(txt);
  1642. ww = w - (tw3 - l.w) / 2 - l.w;
  1643. doc.text(txt, ww, hh);
  1644. w = w+ tw2;
  1645. txt = "对媒体";
  1646. //doc.setFontSize(10);
  1647. l = doc.getTextDimensions(txt);
  1648. ww = w - (tw2 - l.w) / 2 - l.w;
  1649. doc.text(txt, ww, hh);
  1650. w = w + tw2;
  1651. doc.line(w, h, w, h + th2);
  1652. txt = "协调力";
  1653. ww = w - (tw2 - l.w) / 2 - l.w;
  1654. doc.text(txt, ww, hh);
  1655. w = w + tw2;
  1656. doc.line(w, h, w, h + th2);
  1657. txt = "决策力";
  1658. ww = w - (tw2 - l.w) / 2 - l.w;
  1659. doc.text(txt, ww, hh);
  1660. w = w + tw2;
  1661. doc.line(w, h, w, h + th2);
  1662. txt = "掌控力";
  1663. ww = w - (tw2 - l.w) / 2 - l.w;
  1664. doc.text(txt, ww, hh);
  1665. w = w + tw3;
  1666. doc.line(w, h, w, h + th2);
  1667. txt = "舆论引导力";
  1668. //doc.setFontSize(8);
  1669. l = doc.getTextDimensions(txt);
  1670. ww = w - (tw3 - l.w) / 2 - l.w;
  1671. doc.text(txt, ww, hh);
  1672. w = w + tw2;
  1673. txt = "研判力";
  1674. //doc.setFontSize(10);
  1675. l = doc.getTextDimensions(txt);
  1676. ww = w - (tw2 - l.w) / 2 - l.w;
  1677. doc.text(txt, ww, hh);
  1678. h = h + th2;
  1679. doc.line(mr, h, mw, h);
  1680. }
  1681. function SceneTd(data) {
  1682. doc.setFontSize(10);
  1683. if (data&&data.length) {
  1684. data.forEach(function (v) {
  1685. var hh= WriteSceneName(v.name);
  1686. Tags(v.behaviorTags, hh);
  1687. h=h+hh;
  1688. doc.line(mr, h, mw, h);
  1689. });
  1690. }
  1691. }
  1692. function WriteSceneName(txt) {
  1693. var cc = Math.ceil(txt.length / c);
  1694. var hh = cc * ll.h + mr2;
  1695. doc.setLineWidth(0.2);
  1696. doc.setDrawColor(2, 89, 90);
  1697. doc.line(mr, h, mr, h + hh);
  1698. doc.line(mr + tw1, h, mr + tw1, h + hh);
  1699. var txt2 = doc.splitTextToSize(txt, tw1 - mr2);
  1700. doc.text(txt2, mr + mr2 / 2, h + ll.h + mr2 / 2);
  1701. return hh;
  1702. }
  1703. function Tags(tags, hh) {
  1704. if (tags && tags.length) {
  1705. w = mr + tw1;
  1706. for (var i = 0; i < tags.length; i++) {
  1707. var tag = tags[i];
  1708. var ww = i == 2 || i == 7 ? tw3 : tw2;
  1709. Tag(tag.level, ww, hh);
  1710. }
  1711. }
  1712. }
  1713. function Tag(level, ww, hh) {
  1714. if (level != 0) {
  1715. switch (level) {
  1716. case 1:
  1717. doc.setDrawColor(255, 0, 0);
  1718. doc.setFillColor(255, 0, 0);
  1719. doc.circle(w + ww / 2, h + hh / 2, 2, "FD");
  1720. break;
  1721. case 2:
  1722. doc.setDrawColor(255, 165, 0);
  1723. doc.setFillColor(255, 165, 0);
  1724. doc.circle(w + ww / 2, h + hh / 2, 2, "FD");
  1725. break;
  1726. case 3:
  1727. doc.setDrawColor(0, 255, 0);
  1728. doc.setFillColor(0, 255, 0);
  1729. doc.circle(w + ww / 2, h + hh / 2, 2, "FD");
  1730. break;
  1731. }
  1732. }
  1733. w = w + ww;
  1734. doc.setDrawColor(2, 89, 90);
  1735. doc.line(w, h, w, h + hh);
  1736. }
  1737. }
  1738. }
  1739. function AddPage() {
  1740. w = mr;
  1741. h = mr;
  1742. doc.addPage("a4");
  1743. }
  1744. function WriteTitle(title) {
  1745. if (doc&&title) {
  1746. AddPage();
  1747. w = mr;
  1748. doc.setFontSize(24);
  1749. doc.setFont("iwbyue");
  1750. //doc.setFontType("bold");
  1751. doc.text(title, w + 10, h);
  1752. //doc.setFontType("normal");
  1753. h = h + 5;
  1754. doc.setLineWidth(1);
  1755. doc.setDrawColor(2, 89, 90);
  1756. doc.line(mr - 5, h, mw + 5, h);
  1757. doc.setFontSize(16);
  1758. h = h + 10;
  1759. if (h > mh) {
  1760. AddPage();
  1761. }
  1762. }
  1763. }
  1764. function WriteTitleSm(title, hh,fs) {
  1765. if (doc&&title) {
  1766. w = mr;
  1767. fs = fs || 16;
  1768. doc.setFontSize(fs);
  1769. //doc.setFontType("bold");
  1770. doc.text(title, w, h);
  1771. var dim = doc.getTextDimensions(title);
  1772. //console.log(dim);
  1773. if (hh) {
  1774. h = h + 10;
  1775. if (h > mh) {
  1776. AddPage();
  1777. }
  1778. }
  1779. //doc.setFontType("normal");
  1780. return Math.ceil(dim.w);
  1781. }
  1782. }
  1783. function WriteText(txt, ww, long, fs, ti, rw) {
  1784. var hh = 0;
  1785. if (doc) {
  1786. fs = fs || 16;
  1787. doc.setFontSize(fs);
  1788. var www = mr;
  1789. rw = rw || mw;
  1790. if (ww) {
  1791. www = mr + ww;
  1792. }
  1793. if (txt) {
  1794. if (long) {
  1795. var txt1 = txt.split('');
  1796. var l = GetTextDimensions(txt1, doc), lw = l.w, lh = Math.ceil(l.h + 2);
  1797. hh = lh;
  1798. if (ti) {
  1799. www = www + ti * lw;
  1800. }
  1801. txt = txt.split('');
  1802. for (var i = 0; i < txt.length; i++) {
  1803. doc.text(txt[i], www, h);
  1804. www = www + lw;
  1805. if (www >= rw) {
  1806. www = mr + ww;
  1807. h = h + lh;
  1808. hh = hh + lh;
  1809. if (h > mh) {
  1810. AddPage();
  1811. }
  1812. }
  1813. }
  1814. } else {
  1815. doc.text(txt, www, h);
  1816. }
  1817. }
  1818. h = h + 10;
  1819. if (h > mh) {
  1820. AddPage();
  1821. }
  1822. }
  1823. return hh;
  1824. }
  1825. function GetTextDimensions(txt, doc,i) {
  1826. if (txt[0] || i < 10) {
  1827. i = i || 0;
  1828. var reg = /\p{Unified_Ideograph}/u;
  1829. if (reg.test(txt[0])) {
  1830. return doc.getTextDimensions(txt[0]);
  1831. } else {
  1832. if (!txt[0]) {
  1833. i++;
  1834. }
  1835. txt.shift();
  1836. return GetTextDimensions(txt, doc,i);
  1837. }
  1838. }
  1839. return { w: 0, h: 0 };
  1840. }
  1841. </script>
  1842. }
  1843. }