Eval.cshtml 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123
  1. @using WeApp.Configuration
  2. @using WeApp.Authorization
  3. @using WeApp.TrainingCampGroup.Dto
  4. @using WeApp.Views.Shared.Modals
  5. @{
  6. ViewBag.Title = "演练培训营评估";
  7. string activeMenu = PermissionNames.PagesTrainMgEvalMg;
  8. ViewBag.ActiveMenu = activeMenu;
  9. string campNo = ViewBag.CampNo, campState = ViewBag.CampState, groupState = ViewBag.GroupState;
  10. List<CampGroupDto> groups = ViewBag.Groups;
  11. List<string> groupNos = groups?.Select(a => a.Id).ToList() ?? new List<string>();
  12. }
  13. @section css{
  14. <style>
  15. .cmd-box .btn {
  16. min-width: 100px;
  17. }
  18. .group-round-info {
  19. margin-bottom: 7px;
  20. }
  21. .block-box {
  22. color: #3cb371;
  23. padding: 5px 0;
  24. cursor: none;
  25. }
  26. .block-box .iconfont {
  27. padding-right: 5px;
  28. font-size: 13px;
  29. }
  30. .block-box:nth-of-type(2n+1) {
  31. border-right: 1px solid #3cb371;
  32. }
  33. .block-box .block-title {
  34. text-align: center;
  35. font-size: 0.9rem;
  36. font-weight: 600;
  37. color: inherit;
  38. padding-bottom: 5px;
  39. border-bottom: 1px solid;
  40. }
  41. .flow-box {
  42. color: #00ced1;
  43. border: 1px solid;
  44. border-radius: 4px;
  45. width: calc(33% - 10px);
  46. padding: 5px 0;
  47. margin: 5px;
  48. padding: 3px 0;
  49. float: left;
  50. }
  51. .flow-box .flow-title {
  52. text-align: center;
  53. padding-bottom: 3px;
  54. border-bottom: 1px solid;
  55. font-weight: 600;
  56. font-size: 0.7rem;
  57. font-weight: 600;
  58. }
  59. .flow-box .flow-info {
  60. float: left;
  61. width: 100%;
  62. }
  63. .flow-box .scene-info {
  64. width: 100%;
  65. display: flex;
  66. flex: auto;
  67. padding: 0 5px;
  68. }
  69. .flow-box .scene-info .scene-name {
  70. width: 70%;
  71. white-space: nowrap;
  72. overflow: hidden;
  73. text-overflow: ellipsis;
  74. }
  75. .flow-box .scene-info .scene-score {
  76. width: 30%;
  77. text-align: right;
  78. white-space: nowrap;
  79. }
  80. .flow-box .scene-arrow {
  81. color: #aaa;
  82. text-align: center;
  83. line-height: 8px;
  84. }
  85. .flow-box .scene-arrow .iconfont {
  86. font-size: .5rem;
  87. }
  88. .round-box.end .block-box,
  89. .block-box.end {
  90. color: #ff4500
  91. }
  92. .round-box.end .flow-box,
  93. .block-box.end .flow-box,
  94. .flow-box.end,
  95. .round-box.end .flow-info,
  96. .block-box.end .flow-info,
  97. .flow-box.end .flow-info,
  98. .flow-info.end {
  99. color: #aaa;
  100. font-weight: 600;
  101. }
  102. </style>
  103. <style>
  104. .cmd-input-box {
  105. display: none;
  106. }
  107. </style>
  108. <style>
  109. #group-path-box {
  110. height: calc(100vh - 165px);
  111. }
  112. </style>
  113. @*<link href="~/Content/Css/path.min.css" rel="stylesheet" />*@
  114. }
  115. <div class="row">
  116. <div class="col-md-7">
  117. <div>
  118. <ul class="nav nav-tabs">
  119. <li class="nav-item">
  120. <a class="nav-link active" data-toggle="pill" href="#tab-content-info" role="tab">演练信息</a>
  121. </li>
  122. <li class="nav-item">
  123. <a class="nav-link" data-toggle="pill" id="tab-path" href="#tab-content-path" role="tab">演练路径</a>
  124. </li>
  125. </ul>
  126. </div>
  127. <div class="tab-content" style="padding-top: 3px;">
  128. <div class="tab-pane fade show active" id="tab-content-info">
  129. <div id="group-info-box"></div>
  130. </div>
  131. <div class="tab-pane fade" id="tab-content-path">
  132. <div id="group-path-box"></div>
  133. </div>
  134. </div>
  135. </div>
  136. <div class="col-md-5">
  137. <div class="row cmd-box">
  138. <div class="col-md-12" style="margin-bottom: 5px">
  139. <span style="float: left;">
  140. <a href="javascript:Cmd()" class="btn btn-danger btn-sm">
  141. <span>
  142. <i class="iconfont icon-display-code"></i>
  143. <span>指令</span>
  144. </span>
  145. </a>
  146. <a href="javascript:Refresh()" class="btn btn-default btn-sm">
  147. <span>
  148. <i class="iconfont icon-sync-alt"></i>
  149. <span>刷新</span>
  150. </span>
  151. </a>
  152. </span>
  153. <span style="float: right;">
  154. <a href="javascript:SaveScore()" class="btn btn-success btn-sm">
  155. <span>
  156. <i class="iconfont icon-save"></i>
  157. <span>保存</span>
  158. </span>
  159. </a>
  160. <a href="javascript:SendScore()" class="btn btn-danger btn-sm">
  161. <span>
  162. <i class="iconfont icon-release"></i>
  163. <span>发送</span>
  164. </span>
  165. </a>
  166. </span>
  167. </div>
  168. </div>
  169. <div id="group-score-box"></div>
  170. </div>
  171. </div>
  172. @section modal{
  173. <!--Main Modal-->
  174. @{
  175. var modal = new ModalViewModel("分组", new ModalBodyViewModel(new List<Input>()
  176. {
  177. new InputHide("id"),
  178. new InputHide("campNo"),
  179. new Input("name", "分组名称"),
  180. }));
  181. }
  182. @Html.Partial("Modals/_Modal", modal)
  183. <!--CMD Modal-->
  184. <section>
  185. <div class="modal fade" id="modal-cmd" tabindex="-1" aria-modal="true">
  186. <div class="modal-dialog modal-lg" style="">
  187. <div class="modal-content">
  188. @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("发送指令"))
  189. <div class="modal-body" style="padding: 0">
  190. <form class="form-horizontal " id="form" novalidate="novalidate" style="">
  191. <div class="form-group row">
  192. <label class=" iwb-label iwb-label-sm iwb-label-required" for="no">培训营</label>
  193. <div class="">
  194. <div class="input-group input-group-sm">
  195. <select class="form-control required" id="no" name="no" placeholder="请选择培训营..." style="width: 100%">
  196. <option value="@(campNo)" selected="" data-type="0">全部分组</option>
  197. @if (groups != null && groups.Any())
  198. {
  199. foreach (var g in groups)
  200. {
  201. <option value="@(g.Id)" data-type="1">@(g.Name)</option>
  202. }
  203. }
  204. </select>
  205. </div>
  206. </div>
  207. </div>
  208. <div class="form-group row">
  209. <label class=" iwb-label iwb-label-sm iwb-label-required" for="cmd-type">指令类型</label>
  210. <div class="">
  211. <div class="input-group input-group-sm">
  212. <select class="form-control required" id="cmd-type" name="cmd-type" placeholder="请选择操作指令..." style="width: 100%">
  213. <option value="" selected="">请选择指令类型...</option>
  214. <option value="o">操作指令</option>
  215. <option value="p">页面指令</option>
  216. <option value="e">特效指令</option>
  217. </select>
  218. </div>
  219. </div>
  220. </div>
  221. <div class="cmd-o cmd-input-box">
  222. <div class="form-group row">
  223. <label class=" iwb-label iwb-label-sm iwb-label-required" for="cmd-o">操作指令</label>
  224. <div class="">
  225. <div class="input-group input-group-sm">
  226. <select class="form-control required" id="cmd-o" name="cmd-o" placeholder="请选择操作指令..." style="width: 100%">
  227. <option value="" selected="">请选择操作指令...</option>
  228. <option value="@(CampGroupStateDefinition.Ready)" data-url="ChangeState">准备就绪</option>
  229. <option value="@(CampGroupStateDefinition.HeadQuarterBuilding)" data-url="ChangeState">组建指挥部</option>
  230. <option value="1" data-url="StartCamp">开始演练</option>
  231. <option value="2" data-url="NextFlowNode">下一情景节点</option>
  232. <option value="3" data-url="NextRound">下一轮次</option>
  233. <option value="4" data-url="WaitReport">等待报告</option>
  234. <option value="5" data-url="StopCamp">推送报告</option>
  235. <option value="6" data-url="EndCamp">结束演练</option>
  236. </select>
  237. </div>
  238. </div>
  239. </div>
  240. </div>
  241. <div class="cmd-p cmd-input-box">
  242. <div class="form-group row">
  243. <label class=" iwb-label iwb-label-sm iwb-label-required" for="cmd-p">页面指令</label>
  244. <div class="">
  245. <div class="input-group input-group-sm">
  246. <select class="form-control required" id="cmd-p" name="cmd-p" placeholder="请选择操作指令..." style="width: 100%">
  247. <option value="" selected="">请选择页面指令...</option>
  248. <option value="1">刷新所有页面</option>
  249. <option value="2">刷新学员页面</option>
  250. <option value="3">刷新指挥长页面</option>
  251. <option value="4">刷新公共屏页面</option>
  252. <option value="5">刷新专家页面</option>
  253. </select>
  254. </div>
  255. </div>
  256. </div>
  257. </div>
  258. <div class="cmd-e cmd-input-box">
  259. <div class="form-group row">
  260. <label class=" iwb-label iwb-label-sm iwb-label-required" for="cmd-e">特效指令</label>
  261. <div class="">
  262. <div class="input-group input-group-sm">
  263. <select class="form-control required" id="cmd-e" name="cmd-e" placeholder="请选择操作指令..." style="width: 100%">
  264. <option value="" selected="">请选择特效指令...</option>
  265. </select>
  266. </div>
  267. </div>
  268. </div>
  269. </div>
  270. </form>
  271. </div>
  272. @Html.Partial("Modals/_ModalFooter", "0")
  273. </div>
  274. </div>
  275. </div>
  276. </section>
  277. }
  278. @section js{
  279. <script>
  280. abp.signalr = abp.signalr || {};
  281. abp.signalr.autoConnect = false;
  282. </script>
  283. }
  284. @section scripts
  285. {
  286. <script src="~/Content/Js/scene-path.js"></script>
  287. <script type="text/javascript">
  288. abp.signalr.hubs = abp.signalr.hubs || {};
  289. abp.signalr.hubs.iwbHub = $.connection.iwbHub;
  290. var iwbHub = abp.signalr.hubs.iwbHub;
  291. //Connect to the server
  292. abp.signalr.connect = function() {
  293. $.connection.hub.start().done(function() {
  294. abp.log.debug('Connected to SignalR server!'); //TODO: Remove log
  295. abp.event.trigger('abp.signalr.connected');
  296. abp.signalr.hubs.common.server.register().done(function() {
  297. abp.log.debug('Registered to the SignalR server!'); //TODO: Remove log
  298. });
  299. if (iwbHub) {
  300. iwbHub.server.register('@(campNo)').done(function() {
  301. abp.log.debug('@(campNo)' + ' Registered to the SignalR server!');
  302. });
  303. @if (groupNos.Any())
  304. {
  305. foreach (var groupNo in groupNos)
  306. {
  307. <text>
  308. iwbHub.server.register('@(groupNo)').done(function() {
  309. abp.log.debug('@(groupNo)' + ' Registered to the SignalR server!');
  310. });
  311. </text>
  312. }
  313. }
  314. }
  315. });
  316. };
  317. var campNo = '@(campNo)', roundIndex = 1;
  318. $(function() {
  319. abp.signalr.connect();
  320. PreLoad();
  321. $('#modal-cmd #cmd-type').on('change.cmd',
  322. function() {
  323. var v = $(this).val();
  324. $('#modal-cmd .cmd-input-box').hide();
  325. if (v) {
  326. $('#modal-cmd .cmd-' + v).fadeIn();
  327. }
  328. });
  329. CampGroupInfo();
  330. $('#tab-path').on('shown.bs.tab', ScenePath);
  331. });
  332. function Refresh() {
  333. CampGroupInfo();
  334. }
  335. function ScenePath() {
  336. $.iwbAjax5({
  337. url: abp.appUrl + 'Query/GetCampRunningInfos?no=@(campNo)',
  338. success: function(res) {
  339. var str = FormatterScenePath(res);
  340. $('#group-path-box').html(str);
  341. }
  342. });
  343. }
  344. var _loadCount = 0, _loadTimeout;
  345. function PreLoad() {
  346. _loadCount++;
  347. console.log("加载数据中... " + _loadCount);
  348. if (!$('#modal-cmd .modal-title .load-box').length) {
  349. $('#modal-cmd .modal-title ').append(`<span class="load-box" > <span style="padding-left:20px;color:red;">正在加载演练数据</span></span>`);
  350. }
  351. if (_loadCount > 3) {
  352. return;
  353. }
  354. $.iwbAjax5({
  355. url: abp.appUrl + "Query/LoadCampPre?no=@campNo&type=1",
  356. timeout: 1000 * 60 * 5,
  357. success:() => {
  358. clearTimeout(_loadTimeout);
  359. $('#modal-cmd .modal-title .load-box').html(`(演练数据已加载)`);
  360. $('.cmd-box .btn').eq(2).before(`<span style="color:red;margin:0 10px;">演练数据已加载</span>`);
  361. },
  362. complete: () => {
  363. console.log("加载中... " + _loadCount);
  364. }
  365. });
  366. clearTimeout(_loadTimeout);
  367. _loadTimeout = setTimeout(PreLoad, 1000 * 60 * 2);
  368. }
  369. </script>
  370. <script id="group-info">
  371. function CampGroupInfo() {
  372. $.iwbAjax4({
  373. url: abp.appUrl + "Eval/GetCampDetail?no=" + campNo,
  374. success: function(res) {
  375. CampGroupFormatter(res);
  376. }
  377. });
  378. }
  379. function CampGroupFormatter(data) {
  380. $('#group-info-box').empty();
  381. $('#group-score-box').empty();
  382. if (data && data.groups && data.groups.length > 0) {
  383. ParseScoreRule(data);
  384. data.groups.forEach(function(g) {
  385. //test(g);
  386. GroupInfoFormatter(g);
  387. GroupScoreFormatter(g, data);
  388. OverlayScrollbar($('.group-info-box > .card-body,.group-score-box .card-body>div>div:first'));
  389. //$('.group-info-box > .card-body,.group-score-box .card-body>div>div:first').overlayScrollbars({
  390. // className: "os-theme-thin-dark",
  391. // resize: "n", //[ "none", "both", "horizontal", "vertical" ]shorthand: [ "n", "b", "h", "v" ]
  392. // normalizeRTL: true, //是否应规范化RTL滚动。
  393. // sizeAutoCapable: true,
  394. // clipAlways: true,
  395. // paddingAbsolute: false,
  396. // overflowBehavior: {
  397. // x: "v-h", //[ "hidden", "scroll", "visible-hidden", "visible-scroll" ]shorthand: [ "h", "s", "v-h", "v-s" ]
  398. // y: "s"
  399. // },
  400. // scrollbars: {
  401. // dragScrolling: true,
  402. // clickScrolling: true,
  403. // visibility: "a", //[ "visible", "hidden", "auto" ]shorthand: [ "v", "h", "a" ]
  404. // autoHide: "n", //[ "never", "scroll", "leave", "move" ]shorthand: [ "n", "s", "l", "m" ]
  405. // autoHideDelay: 800
  406. // }
  407. //});
  408. });
  409. }
  410. }
  411. //解析评分规则
  412. function ParseScoreRule(data) {
  413. var rule = data.scoreRule;
  414. var score = {};
  415. var arr = rule.split('@@');
  416. var xArr = arr[0].split('|');
  417. var zArr = arr[1].split('|');
  418. var dArr = arr[2].split('|');
  419. var xp = Number(xArr[0]),
  420. xs = Number(xArr[1]),
  421. zp = Number(zArr[0]),
  422. zs = Number(zArr[1]),
  423. dp = Number(dArr[0]),
  424. ds = Number(dArr[1]);
  425. var tp = xp + zp + dp;
  426. score.xtScore = xs;
  427. score.zjScore = zs;
  428. score.dzScore = ds;
  429. score.xtTotal = data.roundScore * xp / tp;
  430. score.zjTotal = data.roundScore * zp / tp;
  431. score.dzTotal = data.roundScore * dp / tp;
  432. data.score = score;
  433. return data;
  434. }
  435. //格式化分组情景信息
  436. function GroupInfoFormatter(group) {
  437. var round = group.runningInfo
  438. ? group.runningInfo.currentRoundIndex
  439. : group.roundIndex
  440. ? group.roundIndex
  441. : 1;
  442. var $tool = $('<div>', { 'class': 'card-tools ' })
  443. .append(
  444. '<button type="button" class="btn btn-tool btn-primary" data-card-widget="collapse"><i class="fas fa-minus"></i></button>');
  445. var stateText = group.campGroupState == @CampGroupStateDefinition.Ready
  446. ? "演练已就绪"
  447. : group.campGroupState == @CampGroupStateDefinition.HeadQuarterBuilding
  448. ? "正在组建指挥部"
  449. : group.campGroupState == @CampGroupStateDefinition.HeadQuarterBuilded
  450. ? "指挥部已组建"
  451. : "";
  452. var $head = $('<div>', { 'class': 'card-header ' })
  453. .append(
  454. '<h3 class="card-title"><i class="iconfont icon-resource" style="padding-right:5px;"></i>{0}</h3>'
  455. .format(group.name))
  456. .append('<div class="header-ex" style="float: left; margin-left:20px">{0}</div>'.format(stateText))
  457. .append($tool);
  458. var $bodyRow = $('<div>', { 'class': 'row rounds-box' });
  459. RoundsFormatter(group.runningInfo, $bodyRow);
  460. //if (group.runningInfo && group.runningInfo.roundInfo && group.runningInfo.roundInfo.length > 0) {
  461. // group.runningInfo.roundInfo.forEach(function (r) {
  462. // if (r.isStart) {
  463. // RoundFormatter(r, $bodyRow);
  464. // }
  465. // });
  466. //}
  467. var $body = $('<div>',
  468. {
  469. 'class': 'card-body ',
  470. 'id': 'group_info_' + group.id,
  471. 'css': { 'padding': '5px 15px', 'height': '200px' }
  472. }).append($bodyRow);
  473. var $box = $('<div>',
  474. {
  475. 'class': 'card card-primary group-info-box',
  476. 'id': 'group_info_box_' + group.id,
  477. 'data': { id: group.id, round: round }
  478. }).append($head)
  479. .append($body);
  480. $('#group-info-box').append($box);
  481. }
  482. //格式化分组评分
  483. function GroupScoreFormatter(group, camp) {
  484. var round = group.runningInfo
  485. ? group.runningInfo.currentRoundIndex
  486. : group.roundIndex
  487. ? group.roundIndex
  488. : 1;
  489. var tagScore, xtScore = 0, zjScore = 0, dzScore = 0, ckScore = 0, fScore = 0;
  490. if (group.groupScore) {
  491. var groupScore = group.groupScore.find(function(v) {
  492. return v.roundIndex === round;
  493. });
  494. if (groupScore) {
  495. xtScore = groupScore.systemScore || 0;
  496. zjScore = groupScore.specialistScore || 0;
  497. dzScore = groupScore.audienceScore || 0;
  498. ckScore = groupScore.referenceScore || 0;
  499. fScore = groupScore.finalTotalScore || 0;
  500. if (groupScore.behaviorTagScoreInfo) {
  501. try {
  502. tagScore = JSON.parse(groupScore.behaviorTagScoreInfo);
  503. } catch (e) {
  504. console.log(e);
  505. }
  506. }
  507. }
  508. }
  509. var $tool = $('<div>', { 'class': 'card-tools ', style: 'display:inline-flex' });
  510. $tool.append('<label class="mr-2 mb-0"><input class="mr-1" type="radio" name="vr_{0}" value="" checked />VR未执行</label>'.format(group.id));
  511. $tool.append('<label class="mr-2 mb-0 text-danger"><input class="mr-1" type="radio" name="vr_{0}" value="1" />失败</label>'.format(group.id));
  512. $tool.append('<label class="mr-3 mb-0 text-success"><input class="mr-1" type="radio" name="vr_{0}" value="2" />成功</label>'.format(group.id));
  513. $tool.append('<button type="button" class="btn btn-tool btn-primary" data-card-widget="collapse"><i class="fas fa-minus"></i></button>');
  514. var $head = $('<div>', { 'class': 'card-header ' })
  515. .append(
  516. '<h3 class="card-title"><i class="iconfont icon-resource" style="padding-right:5px;"></i>{0}</h3>'
  517. .format(group.name))
  518. .append(
  519. '<div class="header-ex" style="display:{1};float: left; margin-left:20px">当前第<span class="round-index" style="color:red;font-weight:600; padding:0 5px;">{0}</span>轮</div>'
  520. .format(round, group.campGroupState == @(CampGroupStateDefinition.Run) ? "block" : "none"))
  521. .append($tool);
  522. var $tagBox = $('<div>', { 'class': 'row tag-box', 'css': { 'maxHeight': '180px' } });
  523. var tagArr = camp.evalBehaviorTags ? camp.evalBehaviorTags.split(',') : [];
  524. var tagInput =
  525. '<div class="tag-info col-md-4" data-tag="{0}"><div class="form-group" style="margin-bottom: 5px;"><div class="input-group input-group-sm"><div class="input-group-prepend"><span class="input-group-text" style="min-width: 68px;">{0}</span></div><input type="text" class="form-control form-control-sm system-score number" value="{1}" placeholder="系统分" readonly="" data-tag-no="{0}" data-score-type="ts" autocomplete="off"><input type="text" class="form-control form-control-sm correct-score number" value="{2}" placeholder="校对分" data-score-type="tc" autocomplete="off" style="color:red"><input type="hidden" class="number" value="{3}" data-score-type="tt" autocomplete="off"></div></div></div>';
  526. tagArr.forEach(function(v) {
  527. var ts = 0, tc = 0,tt=0;
  528. if (tagScore) {
  529. var tag = tagScore.find(function(val) {
  530. return val.tagNo === v;
  531. });
  532. if (tag) {
  533. ts = tag.systemScore;
  534. tc = tag.correctionScore;
  535. tt = tag.totalScore;
  536. }
  537. }
  538. $tagBox.append(tagInput.format(v, ts, tc,tt));
  539. });
  540. var $left = $('<div>', { 'class': '', 'css': { 'width': 'calc(100% - 150px)', 'padding': '0 5px' } });
  541. $left.append($tagBox);
  542. var sysScoreInput =
  543. '<div class="input-group input-group-sm" style="margin-bottom: 5px;"><div class="input-group-prepend"><span class="input-group-text">{0}</span></div><input type="text" class="form-control form-control-sm number" data-score-type="{1}" value="{2}" readonly="readonly" autocomplete="off" style="color:red"></div>',
  544. scoreInput =
  545. '<div class="input-group input-group-sm" style="margin-bottom: 5px;"><div class="input-group-prepend"><span class="input-group-text">{0}</span></div><input type="text" class="form-control form-control-sm number" data-score-type="{1}" value="{2}" autocomplete="off" style="color:red" onchange="{3}"></div>',
  546. scoreChange = 'CalcScore(this)';
  547. var $right = $('<div>',
  548. { 'class': 'score-box', 'css': { 'width': '150px', 'padding': '0 5px' }, 'data': camp.score })
  549. .append(sysScoreInput.format('系统评分', 'x', xtScore))
  550. .append(scoreInput.format('专家评分', 'z', zjScore, scoreChange))
  551. .append(scoreInput.format('大众评分', 'd', dzScore, scoreChange))
  552. .append(sysScoreInput.format('参考评分', 'c', ckScore))
  553. .append(scoreInput.format('评分矫正', 'f', fScore, ''));
  554. var $body = $('<div>',
  555. {
  556. 'class': 'card-body ',
  557. 'id': 'group_score_' + group.id,
  558. 'css': { 'padding': '12.5px 10px 7.5px', 'height': '200px' }
  559. })
  560. .append($('<div>', { 'class': 'row' }).append($left).append($right));
  561. var $box = $('<div>',
  562. {
  563. 'class': 'card card-primary group-score-box',
  564. 'data': { id: group.id, round: round }
  565. }).append($head)
  566. .append($body);
  567. $('#group-score-box').append($box);
  568. }
  569. </script>
  570. <script id="cmd-script">
  571. function Cmd() {
  572. $('#modal-cmd .cmd-input-box').hide();
  573. OpenModal({
  574. modal: 'modal-cmd',
  575. data: { 'cmd-type': '', no: '@(campNo)' },
  576. save: SendCmd
  577. });
  578. }
  579. function SendCmd() {
  580. var cmdType = $('#modal-cmd #cmd-type').val();
  581. var no = $('#modal-cmd #no').val();
  582. switch (cmdType) {
  583. case 'o':
  584. OperationCmd(no);
  585. break;
  586. case 'p':
  587. PageCmd(no);
  588. break;
  589. case 'e':
  590. EffectCmd(no);
  591. break;
  592. default:
  593. break;
  594. }
  595. }
  596. function OperationCmd(no) {
  597. var cmd = $('#modal-cmd #cmd-o').val();
  598. var url = $('#modal-cmd #cmd-o option:selected').data('url');
  599. if (cmd && url) {
  600. var type = $('#modal-cmd #no option:selected').data('type');
  601. var campNo = "none", groupNo = "none";
  602. if (type == 0) {
  603. campNo = no;
  604. } else {
  605. groupNo = no;
  606. }
  607. url = abp.appUrl + 'Eval/{0}?campNo={1}&groupNo={2}'.format(url, campNo, groupNo);
  608. if (cmd >= 10) {
  609. url += '&groupState={0}'.format(cmd);
  610. }
  611. $.iwbAjax1({
  612. url: url,
  613. data: {},
  614. modal: $('#modal-cmd'),
  615. success: function() {
  616. if ($('#modal-cmd #cmd-o').val()==3) {
  617. $(".tag-box input").val('0');
  618. }
  619. }
  620. });
  621. }
  622. }
  623. function PageCmd(no) {
  624. var cmd = $('#modal-cmd #cmd-p').val();
  625. if (cmd) {
  626. iwbHub.server.sendReload(no, cmd).done(function() {
  627. abp.log.debug('PageReload:', no, cmd);
  628. });
  629. abp.message.warn('指令已发送!');
  630. }
  631. }
  632. function EffectCmd(no) {
  633. var cmd = $('#modal-cmd #cmd-e').val();
  634. if (cmd) {
  635. }
  636. }
  637. </script>
  638. <script id="round">
  639. function RoundsFormatter(data, $appendTo) {
  640. //if (data && data.children && data.children.length > 0) {
  641. // data.children.forEach(function (r) {
  642. // if (r.isStart) {
  643. // RoundFormatter(r, $appendTo);
  644. // }
  645. // });
  646. //}
  647. if (data && data.ch && data.ch.length > 0) {
  648. data.ch.forEach(function (r) {
  649. if (r.r) {
  650. RoundFormatter(r, $appendTo);
  651. }
  652. });
  653. }
  654. }
  655. function RoundFormatter(data, $appendTo) {
  656. var $box = $('<div>');
  657. //if (data) {
  658. // var score = data.correctionScore ? data.correctionScore : data.systemScore || 0;
  659. // var $tool = $('<div>', { 'class': 'card-tools ' })
  660. // .append(
  661. // '<button type="button" class="btn btn-tool btn-info" data-card-widget="collapse"><i class="fa fa-minus"></i></button>');
  662. // var $head = $('<div>', { 'class': 'card-header ' })
  663. // .append(
  664. // '<h3 class="card-title"><i class="iconfont icon-diagnose" style="padding-right:5px;"></i>{0}</h3>'
  665. // .format(data.name))
  666. // .append(
  667. // '<div class="header-ex" style="float: left; margin-left:15px">轮次得分:<span class="round-index" style="color:red;font-weight:600; padding:0 5px;">{0}</span>分</div>'
  668. // .format(score))
  669. // .append($tool);
  670. // var endClass = data.isEnd ? "end" : "";
  671. // var $bodyRow = $('<div>', { 'class': 'row round-box ' + endClass });
  672. // if (data.children && data.children.length > 0) {
  673. // data.children.forEach(function (v) {
  674. // if (v.isStart) {
  675. // BlockFormatter(v, $bodyRow);
  676. // }
  677. // });
  678. // }
  679. // var $body = $('<div>',
  680. // {
  681. // 'class': 'card-body',
  682. // 'id': 'group_round_' + data.id + '_' + data.roundIndex,
  683. // 'css': { 'padding': '0 10px', 'min-height': '100px' }
  684. // }).append($bodyRow);
  685. // $box = $('<div>',
  686. // {
  687. // 'class': 'card card-info card-sm group-round-info ',
  688. // 'css': { 'width': '100%' }
  689. // }).append($head)
  690. // .append($body);
  691. // if (data.isEnd) {
  692. // setTimeout(function () { $tool.find('button[data-card-widget="collapse"]').trigger('click'); }, 200);
  693. // }
  694. //}
  695. if (data) {
  696. var score = data.cs ? data.cs : data.ss || 0;
  697. var $tool = $('<div>', { 'class': 'card-tools ' })
  698. .append(
  699. '<button type="button" class="btn btn-tool btn-info" data-card-widget="collapse"><i class="fa fa-minus"></i></button>');
  700. var $head = $('<div>', { 'class': 'card-header ' })
  701. .append(
  702. '<h3 class="card-title"><i class="iconfont icon-diagnose" style="padding-right:5px;"></i>{0}</h3>'
  703. .format(data.nm))
  704. .append(
  705. '<div class="header-ex" style="float: left; margin-left:15px">轮次得分:<span class="round-index" style="color:red;font-weight:600; padding:0 5px;">{0}</span>分</div>'
  706. .format(score))
  707. .append($tool);
  708. var endClass = data.re ? "end" : "";
  709. var $bodyRow = $('<div>', { 'class': 'row round-box ' + endClass });
  710. if (data.ch && data.ch.length > 0) {
  711. data.ch.forEach(function (v) {
  712. if (v.r) {
  713. BlockFormatter(v, $bodyRow);
  714. }
  715. });
  716. }
  717. var $body = $('<div>',
  718. {
  719. 'class': 'card-body',
  720. 'id': 'group_round_' + data.i + '_' + data.roundIndex,
  721. 'css': { 'padding': '0 10px', 'min-height': '100px' }
  722. }).append($bodyRow);
  723. $box = $('<div>',
  724. {
  725. 'class': 'card card-info card-sm group-round-info ',
  726. 'css': { 'width': '100%' }
  727. }).append($head)
  728. .append($body);
  729. if (data.re) {
  730. setTimeout(function () { $tool.find('button[data-card-widget="collapse"]').trigger('click'); }, 200);
  731. }
  732. }
  733. if ($appendTo) {
  734. $appendTo.append($box);
  735. }
  736. return $box;
  737. }
  738. function BlockFormatter(data, $appendTo) {
  739. //var endClass = data.isEnd ? " end " : "";
  740. //var $blockBox = $('<div>', { 'class': 'col-sm-6 block-box ' + endClass });
  741. //var $flows = $('<div>', { 'class': '' });
  742. //if (data.children && data.children.length > 0) {
  743. // data.children.forEach(function (v) {
  744. // if (v.isStart) {
  745. // FlowFormatter(v, $flows);
  746. // }
  747. // });
  748. //}
  749. //$blockBox.append(
  750. // '<div class="block-title"><i class="iconfont icon-integral"></i>{0}</div>'.format(data.name +
  751. // "(" +
  752. // data.path +
  753. // ")"))
  754. // .append($flows);
  755. var endClass = data.re ? " end " : "";
  756. var $blockBox = $('<div>', { 'class': 'col-sm-6 block-box ' + endClass });
  757. var $flows = $('<div>', { 'class': '' });
  758. if (data.ch && data.ch.length > 0) {
  759. data.ch.forEach(function (v) {
  760. if (v.r) {
  761. FlowFormatter(v, $flows);
  762. }
  763. });
  764. }
  765. $blockBox.append(
  766. '<div class="block-title"><i class="iconfont icon-integral"></i>{0}</div>'.format(data.nm +
  767. "(" +
  768. data.p +
  769. ")"))
  770. .append($flows);
  771. if ($appendTo) {
  772. $appendTo.append($blockBox);
  773. }
  774. return $blockBox;
  775. }
  776. function FlowFormatter(data, $appendTo) {
  777. //var endClass = data.isEnd ? " end " : "";
  778. //var $flowBox = $('<div>', { 'class': 'flow-box ' + endClass });
  779. //var $flows = $('<div>', { 'class': endClass, 'css': { 'display': 'flex', 'flex-direction': 'column' } });
  780. //if (data.children && data.children.length > 0) {
  781. // data.children.forEach(function (v) {
  782. // if (v.isStart) {
  783. // FlowNodeFormatter(v, $flows);
  784. // }
  785. // });
  786. //}
  787. //$flowBox.append(
  788. // '<div class="flow-title"><i class="iconfont icon-early-warning"></i>{0}</div>'.format(data.name))
  789. // .append($flows);
  790. var endClass = data.re ? " end " : "";
  791. var $flowBox = $('<div>', { 'class': 'flow-box ' + endClass });
  792. var $flows = $('<div>', { 'class': endClass, 'css': { 'display': 'flex', 'flex-direction': 'column' } });
  793. if (data.ch && data.ch.length > 0) {
  794. data.ch.forEach(function (v) {
  795. if (v.r) {
  796. FlowNodeFormatter(v, $flows);
  797. }
  798. });
  799. }
  800. $flowBox.append(
  801. '<div class="flow-title"><i class="iconfont icon-early-warning"></i>{0}</div>'.format(data.nm))
  802. .append($flows);
  803. if ($appendTo) {
  804. $appendTo.append($flowBox);
  805. }
  806. return $flowBox;
  807. }
  808. function FlowNodeFormatter(data, $appendTo) {
  809. //var endClass = data.isEnd ? " end " : "";
  810. //var $flowInfo = $('<div>', { 'class': ' flow-info ' + endClass });
  811. //if (data.sceneNodes && data.sceneNodes.length > 0) {
  812. // data.sceneNodes.forEach(function (v) {
  813. // if (v.isStart) {
  814. // var score = v.correctionScore ? v.correctionScore : v.systemScore || 0;
  815. // var $scene = $('<div>', { 'class': 'scene-info' })
  816. // .append(
  817. // '<div class="scene-name">{0}</div><div class="scene-score"><span style="padding:0 5px">{1}</span>分</div>'
  818. // .format(v.name, score));
  819. // $flowInfo.append($scene);
  820. // }
  821. // });
  822. //}
  823. //if ($appendTo) {
  824. // $appendTo.append($flowInfo);
  825. //}
  826. //if (data.children && data.children.length > 0) {
  827. // data.children.forEach(function (v) {
  828. // if (v.isStart) {
  829. // $appendTo.append(
  830. // '<div class="scene-arrow {"><i class="iconfont icon-angle-double-down"></i></div>');
  831. // FlowNodeFormatter(v, $appendTo);
  832. // }
  833. // });
  834. //}
  835. var endClass = data.re ? " end " : "";
  836. var $flowInfo = $('<div>', { 'class': ' flow-info ' + endClass });
  837. if (data.sn && data.sn.length > 0) {
  838. data.sn.forEach(function (v) {
  839. if (v.r) {
  840. var score = v.cs ? v.cs : v.ss || 0;
  841. var $scene = $('<div>', { 'class': 'scene-info' })
  842. .append(
  843. '<div class="scene-name">{0}</div><div class="scene-score"><span style="padding:0 5px">{1}</span>分</div>'
  844. .format(v.nm, score));
  845. $flowInfo.append($scene);
  846. }
  847. });
  848. }
  849. if ($appendTo) {
  850. $appendTo.append($flowInfo);
  851. }
  852. if (data.ch && data.ch.length > 0) {
  853. data.ch.forEach(function (v) {
  854. if (v.r) {
  855. $appendTo.append(
  856. '<div class="scene-arrow {"><i class="iconfont icon-angle-double-down"></i></div>');
  857. FlowNodeFormatter(v, $appendTo);
  858. }
  859. });
  860. }
  861. return $flowInfo;
  862. }
  863. function RoundChange(data) {
  864. if (data) {
  865. var $that = $('#group_info_' + data.i).find('div.rounds-box').empty();
  866. RoundsFormatter(data, $that);
  867. }
  868. }
  869. </script>
  870. <script id="score">
  871. function CalcScore(that) {
  872. var $that = $(that).closest('.score-box'),
  873. xtScore = $that.data('xt-score'),
  874. zjScore = $that.data('zj-score'),
  875. dzScore = $that.data('dz-score'),
  876. xtTotal = $that.data('xt-total'),
  877. zjTotal = $that.data('zj-total'),
  878. dzTotal = $that.data('dz-total');
  879. var xScore = Number($that.find('input[data-score-type="x"]').val()),
  880. zScore = Number($that.find('input[data-score-type="z"]').val()),
  881. dScore = Number($that.find('input[data-score-type="d"]').val());
  882. var cScore = 0;
  883. if (xScore != NaN && zScore != NaN && dScore != NaN) {
  884. xScore = xScore > xtScore ? xtScore : xScore < 0 ? 0 : xScore;
  885. var xs = xtTotal * xScore / xtScore;
  886. zScore = zScore > zjScore ? zjScore : zScore < 0 ? 0 : zScore;
  887. var zj = zjTotal * zScore / zjScore;
  888. dScore = dScore > dzScore ? dzScore : dScore < 0 ? 0 : dScore;
  889. var dz = dzTotal * dScore / dzScore;
  890. cScore = xs + zj + dz;
  891. }
  892. $that.find('input[data-score-type="c"]').val(cScore.toFixed(2));
  893. }
  894. function SendScore() {
  895. SaveScore(true);
  896. }
  897. function SaveScore(send) {
  898. send = send || false;
  899. var data = [];
  900. $('#group-score-box .group-score-box').each(function () {
  901. var $that = $(this), behaviorTagScore = [];
  902. $that.find('.tag-info').each(function () {
  903. var $that = $(this);
  904. var totalScore = Number($that.find('input[data-score-type="tt"]').val()),
  905. systemScore = Number($that.find('input[data-score-type="ts"]').val()),
  906. correctionScore = Number($that.find('input[data-score-type="tc"]').val());
  907. systemScore = systemScore > totalScore ? totalScore : systemScore;
  908. correctionScore = correctionScore > totalScore && totalScore > 0 ? totalScore : correctionScore;
  909. behaviorTagScore.push({
  910. tagNo: $that.data('tag'),
  911. systemScore: systemScore,
  912. correctionScore: correctionScore,
  913. totalScore: totalScore
  914. });
  915. });
  916. var group = {
  917. isSend: send,
  918. campNo: campNo,
  919. groupNo: $that.data('id'),
  920. roundIndex: $that.data('round'),
  921. systemScore: Number($that.find('input[data-score-type="x"]').val()),
  922. specialistScore: Number($that.find('input[data-score-type="z"]').val()),
  923. audienceScore: Number($that.find('input[data-score-type="d"]').val()),
  924. referenceScore: Number($that.find('input[data-score-type="c"]').val()),
  925. finalTotalScore: Number($that.find('input[data-score-type="f"]').val()),
  926. behaviorTagScoreInfo: JSON.stringify(behaviorTagScore)
  927. };
  928. data.push(group);
  929. });
  930. $.iwbAjax1({
  931. url: abp.appUrl + "Eval/SaveGroupScore",
  932. data: data,
  933. success: function () {
  934. abp.message.warn("保存成功!");
  935. }
  936. });
  937. }
  938. function ScoreChange(data) {
  939. if (data) {
  940. var no = data.no, round = data.round;
  941. var $that = $('#group_score_' + no);
  942. $that.closest('.card').data('round', round).find('.header-ex .round-index').html(round);
  943. $that.find('input[data-score-type="x"]').val(data.systemScore ? data.systemScore : 0);
  944. if (data.tagScores && data.tagScores.length > 0) {
  945. data.tagScores.forEach(function (v) {
  946. var $tag = $that.find('.tag-info[data-tag="' + v.tagNo + '"]');
  947. var sScore = Number($tag.find('input[data-score-type="ts"]').val()),
  948. cScore = Number($tag.find('input[data-score-type="tc"]').val());
  949. var ssScore = (v.systemScore ? v.systemScore : 0) + sScore,
  950. ccScore = cScore ? cScore + (v.systemScore ? v.systemScore : 0) : 0;
  951. $tag.find('input[data-score-type="ts"]').val(ssScore);
  952. $tag.find('input[data-score-type="tc"]').val(ccScore);
  953. $tag.find('input[data-score-type="tt"]').val(v.totalScore);
  954. });
  955. }
  956. };
  957. }
  958. </script>
  959. <script id="hub-s">
  960. iwbHub.client.getRunningChange = function (msg) {
  961. console.log('getRunningChange: ', msg);
  962. if (msg) {
  963. try {
  964. var data = JSON.parse(msg);
  965. if (data) {
  966. var $rBox = $('#group_info_' + data.no).find('.rounds-box');
  967. if ($rBox.length > 0) {
  968. $.iwbAjax5({
  969. url: abp.appUrl + 'Eval/GetGroupRunningInfo?no=' + data.no,
  970. success: function (res) {
  971. if (res) {
  972. //var round = res.currentRoundIndex ? res.currentRoundIndex : 1;
  973. var round = res.cri ? res.cri : 1;
  974. $('#group-score-box').find('.header-ex').css("display", "block").find('.round-index').html(round);
  975. $('#group_score_' + data.no).closest('.group-score-box').data("round", round);
  976. $rBox.empty();
  977. RoundsFormatter(res, $rBox);
  978. }
  979. }
  980. });
  981. }
  982. }
  983. } catch (e) {
  984. console.log('getRunningChange: ', e);
  985. }
  986. }
  987. };
  988. iwbHub.client.getRoundScore = function (msg) {
  989. console.log('getRoundScore: ', msg);
  990. if (msg) {
  991. try {
  992. var data = JSON.parse(msg);
  993. ScoreChange(data);
  994. } catch (e) {
  995. console.log('getRoundScore: ', e);
  996. }
  997. }
  998. };
  999. iwbHub.client.getHeadquarter = function (msg) {
  1000. console.log('getHeadquarter: ', msg);
  1001. if (msg) {
  1002. try {
  1003. var data = JSON.parse(msg);
  1004. if (data) {
  1005. var no = data.no, text = data.text;
  1006. var $that = $('#group_info_box_' + no).find('.card-header .header-ex');
  1007. if ($that.length > 0) {
  1008. $that.html(text);
  1009. }
  1010. };
  1011. } catch (e) {
  1012. console.log('getHeadquarter: ', e);
  1013. }
  1014. }
  1015. }
  1016. </script>
  1017. <!--格式化-->
  1018. <script id="formatter-script" type="text/javascript">
  1019. function TypeFormatter(v) {
  1020. var name = $('#hid-type option[value="' + v + '"]').text();
  1021. switch (v) {
  1022. case 0:
  1023. return '<span class="label label-danger">' + name + '</span>';
  1024. default:
  1025. return '<span class="label label-info">' + name + '</span>';
  1026. }
  1027. }
  1028. function StateFormatter(v) {
  1029. var name = $('#hid-state option[value="' + v + '"]').text();
  1030. switch (v) {
  1031. case '@(CampGroupStateDefinition.New)':
  1032. return '<span class="label label-info">' + name + '</span>';
  1033. case '@(CampGroupStateDefinition.Run)':
  1034. return '<span class="label label-iwb">' + name + '</span>';
  1035. case '@(CampGroupStateDefinition.Error)':
  1036. case '@(CampGroupStateDefinition.End)':
  1037. return '<span class="label label-danger">' + name + '</span>';
  1038. default:
  1039. return '<span class="label label-info">' + name + '</span>';
  1040. }
  1041. }
  1042. </script>
  1043. }
  1044. <section style="display: none">
  1045. <select id="hid-type">
  1046. <option value=""></option>
  1047. </select>
  1048. <select id="hid-camp-state">
  1049. @(Html.Raw(campState))
  1050. </select>
  1051. <select id="hid-group-state">
  1052. @(Html.Raw(groupState))
  1053. </select>
  1054. @*@Html.DropDownList("hid-type", type)*@
  1055. </section>