| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- @using WeApp.Configuration
- @using WeApp.TrainingCampGroup.Dto
- @{
- Layout = "~/Views/Shared/Layout/_Layout.Stu.cshtml";
- CampGroupDto group = ViewBag.Group;
- ViewBag.Title = "指挥长屏(" + group.Name + ")";
- string id = group.Id,
- groupName = group.Name,
- campNo = group.CampNo;
- }
- @section css{
- <link href="~/Content/Css/Exercise/stu-leader.min.css" rel="stylesheet" />
- }
- <div class="body">
- <div class="title-box box">
- <div class="left-box">
- <div class="line"></div>
- <div class="title">@(groupName)指挥部 —— 指挥长</div>
- </div>
- <div class="right-box">
- <div class="btn btn-submit" onclick="SubmitNextScene()">进入下一阶段情景</div>
- </div>
- </div>
- <div class="leader-box box">
- <table class="table">
- <thead>
- <tr>
- <th style="width: 200px">角色</th>
- <th>指令内容</th>
- <th style="width: 80px">下达状态</th>
- <th style="width: 120px">操作</th>
- </tr>
- </thead>
- <tbody id="log-box">
- <tr class="empty">
- <td colspan="5">暂无指令,等待组员发送指令</td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- @section scripts
- {
- <script>
- $(function() {
- GetLog();
- OverlayScrollbar($('.leader-box'));
- });
- function RoleHandle(that) {
- MsgConfirm("您确认下达这条指令吗?",
- "下达指令",
- function() {
- var $that = $(that).closest('tr');
- var id = $that.data('id');
- $.iwbAjax4({
- url: abp.appUrl + "Eval/OperationScene?id=" + id,
- success: function() {
- $that.removeClass('wait').addClass('send');
- $that.find('.state').html('已下达');
- $that.find('.action').html('');
- }
- });
- });
- }
- function SubmitNextScene() {
- var log = $("#log-box tr.send");
- if (!log || log.length <= 0) {
- abp.message.warn("请至少下达一条指令后再操作!");
- return;
- }
- MsgConfirm("您确认进入到下一情景吗?",
- "情景流转",
- function() {
- $.iwbAjax4({
- url: abp.appUrl + "Eval/NextFlowNode?groupNo=@(id)&campNo=none",
- success: function(res) {
- $("#log-box").html('<tr class="empty"><td colspan="5">暂无指令,等待组员发送指令</td></tr>');
- }
- });
- });
- }
- function GetLog() {
- $.iwbAjax5({
- url: abp.appUrl + "Query/GetCurrentSceneLog?no=@(id)",
- success: function(res) {
- if (res) {
- $("#box-body").empty();
- var str = '';
- for (var i = 0; i < res.length; i++) {
- var item = res[i];
- str += FormatLog(item);
- }
- if (str) {
- $("#log-box").html(str);
- }
- }
- }
- });
- }
- function FormatLog(data) {
- var str = "";
- if (data) {
- var msg = data.word ? data.word : "",
- btn = data.logState == '@(LogStateDefinition.New)'
- ? '<button type="button" class="btn btn-submit" style="" onclick="RoleHandle(this)">下达指令</button>'
- : '',
- state = data.logState == '@(LogStateDefinition.New)' ? '待下达' : '已下达',
- style = data.logState == '@(LogStateDefinition.New)' ? 'wait' : 'send';
- str = '<tr class="{5}" data-id="{0}"><td>{1}</td><td>{2}</td><td class="state">{3}</td><td class="action">{4}</td></tr>'.format(
- data.id,
- data.role,
- msg,
- state,
- btn,
- style);
- //str =
- // '<div class="handle-box leader {4}" data-id="{0}"> <div class="handle-content"><span class="role-text">{1}</span><span class="text">:</span><span class="content-text">{2}</span></div><div class="handle-button">{3}</div></div>'
- // .format(data.id, data.role, msg, btn, style);
- }
- return str;
- }
- </script>
- <script>
- abp.signalr.connect(['@(id)', '@(campNo)']);
- iwbHub.client.getReloadAll = function(msg) {
- console.log('getReloadAll: ', msg);
- if (msg) {
- try {
- var data = JSON.parse(msg);
- if (data) {
- if (data.no == '@(id)' || data.no == '@(campNo)') {
- window.location.reload();
- }
- }
- } catch (e) {
- console.log('getReloadAll: ', e);
- }
- }
- };
- iwbHub.client.getReloadLeader = function(msg) {
- console.log('getReloadLeader: ', msg);
- if (msg) {
- try {
- var data = JSON.parse(msg);
- if (data) {
- if (data.no == '@(id)' || data.no == '@(campNo)') {
- window.location.reload();
- }
- }
- } catch (e) {
- console.log('getReloadLeader: ', e);
- }
- }
- };
- iwbHub.client.getOperationLog = function(msg) {
- console.log('getOperationLog: ', msg);
- if (msg) {
- try {
- var data = JSON.parse(msg);
- if (data) {
- if (data.no == '@(id)') {
- $('tr.empty').remove();
- var str = FormatLog(data);
- $('#log-box').prepend(str);
- }
- }
- } catch (e) {
- console.log('getOperationLog: ', e);
- }
- }
- };
- </script>
- }
|