SetEntryConditions.cshtml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. @{
  2. ViewBag.Title = "比赛项目";
  3. Layout = "~/Views/Shared/_Layout.cshtml";
  4. }
  5. @using MES.Production.Service;
  6. @using Central.Control.Domain;
  7. @using Ant.Service.Common;
  8. @using Ant.Service.Common.Enums;
  9. @using CommonToolHelper;
  10. @using MES.Production.Entity;
  11. @using ChangFa.Machinery.WebPage.Areas;
  12. @model PageInfo
  13. <div class="row col-lg-12">
  14. <div class="wrapper wrapper-content animated fadeInUp" style="overflow-y:scroll;">
  15. <div class="ibox">
  16. @if (Convert.ToInt32(ViewData["state"]) == 0)
  17. {
  18. <div class="ibox-title">
  19. <div class="ibox-tools rboor">
  20. <a class="btn btn-primary btn-xs p310" id="insert" action="add"><i class="im-plus"></i> 增加</a>
  21. <a class="btn btn-primary btn-xs p310" id="modify" action="edit"><i class="im-pencil2"></i> 修改</a>
  22. <a class="btn btn-primary btn-xs p310" id="delete" action="remove"><i class="im-remove4"></i> 删除</a>
  23. </div>
  24. </div>
  25. }
  26. <div class="ibox-content">
  27. <div class="panel panel-default">
  28. <div class="panel-heading">
  29. <h3 class="panel-title">比赛项目</h3>
  30. </div>
  31. <div class="panel-body">
  32. <div class="clearfix f-hafl">
  33. <div class="row">
  34. <div class="col-xs-4 col-md-4">
  35. <label class="col-lg-0 control-label" style="float:left;">比赛大项:</label>
  36. <div class="col-lg-8 col-sm-7">
  37. <label class="control-label">@ViewBag.SportsName</label>
  38. </div>
  39. </div>
  40. <div class="col-lg-8 col-sm-8" style="float:right;">
  41. @*<label class="col-lg-0 control-label" style="float:left;">比赛小项:</label>*@
  42. <div class="col-xs-10 col-md-4">
  43. <div class="col-lg-12 col-sm-12 input-group" style="width: 100%; float: right;">
  44. @Html.Hidden("sportsId", ViewData["sportsIds"])
  45. @Html.TextBox("SmallEventName", ViewData["SmallEventName"], new
  46. {
  47. @class = "input-sm form-control",
  48. @readonly = "readonly",
  49. @placeholder = "请选择比赛项目名称",
  50. style = "display:none;"
  51. })
  52. <span class="input-group-btn">
  53. <a class="btn btn-sm btn-primary" id="selectsport"><i class="im-pencil2"></i>设置组别项目</a>
  54. </span>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="clearfix f-hafl">
  60. <div class="col-lg-2 col-sm-3 pl0">
  61. <div class="form-group">
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. <div id="example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
  69. <table id="example" class="table table-striped table-bordered table-hover dataTables-example dataTable" cellspacing="0" width="100%">
  70. <thead>
  71. <tr>
  72. <th class="tn" style="width: 5% !important"><input name="checkall" id="checkall" type="checkbox" value=""></th>
  73. <th width="10%">组别</th>
  74. <th width="20%">年龄段</th>
  75. <th width="10%">男生人数</th>
  76. <th width="10%">女生人数</th>
  77. <th width="10%">混合人数</th>
  78. <th width="10%">类型</th>
  79. <th width="10%">操作</th>
  80. </tr>
  81. </thead>
  82. <tbody>
  83. @{foreach (var item in Model.List)
  84. {
  85. <tr>
  86. <td class="tn"><input name="checkbox_name" type="checkbox" value="@item.ID"></td>
  87. <td>
  88. <a href="javascript:modify('@item.ID')" listaction="detail">@item.Constituencies</a>
  89. </td>
  90. <td>@(Convert.ToDateTime(item.AgeStart).ToString("yyyy-MM-dd"))~@(Convert.ToDateTime(item.AgeEnd).ToString("yyyy-MM-dd"))</td>
  91. <td>@item.BoysMax</td>
  92. <td>@item.GirlsMax</td>
  93. <td>@item.MixedMax</td>
  94. <td>@item.SchoolSmallType</td>
  95. <td><a href="javascript:settings(@item.SEPID,@item.ID)">项目规则</a></td>
  96. </tr>
  97. }
  98. }
  99. </tbody>
  100. </table>
  101. <!-- page -->
  102. <div class="bottom">
  103. @if (Model != null)
  104. {
  105. <div class="dataTables_info" id="example_info" Post="status" aria-live="polite">显示第 @Model.BeginPage 至 @Model.EndPage 项结果,共 @Model.Count 项</div>
  106. <div class="dataTables_length" id="example_length">
  107. <label>
  108. 显示
  109. <select name="example_length" onchange="submit()" aria-controls="example" class="form-control input-sm">
  110. <option value="10" @(Model.PageSize == 10 ? "selected" : "")>10</option>
  111. <option value="25" @(Model.PageSize == 25 ? "selected" : "")>25</option>
  112. <option value="50" @(Model.PageSize == 50 ? "selected" : "")>50</option>
  113. <option value="100" @(Model.PageSize == 100 ? "selected" : "")>100</option>
  114. </select> 项结果
  115. </label>
  116. </div>
  117. @CommonHtmlHelper.PaginationPager(Model.Index, Model.PageSize, Model.Count, 7, Model.Url);
  118. }
  119. <div class="clear"></div>
  120. </div>
  121. <!-- page -->
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. @*<div class="hr-line-dashed">
  127. <div class="form-group" style="margin-top:10px !important;">
  128. <div class="col-sm-2 col-sm-offset-2">
  129. <button class="btn btn-primary btn-save" type="submit" id="btn-dig-close"><i class="fa fa-check"></i> <span>确定</span></button>
  130. </div>
  131. </div>
  132. </div>*@
  133. </div>
  134. <!-- table end -->
  135. @section scripts{
  136. <script type="text/javascript">
  137. function settings(a, b) {
  138. @*var states =@ViewData["state"];
  139. if (states > 0) {
  140. dig.alertError("提示", "对不起,只有赛事状态为起草的时,才能修改操作!");
  141. return;
  142. }*@
  143. dig.addModel('修改项目规则', '/Sys/ProjectEntry/ProjectEntryList?SEPID=' + a + "&SCID=" + b + "&State=@ViewData["state"]", 1000, 800, function () {
  144. if (this.returnValue == 'yes') {
  145. }
  146. });
  147. }
  148. $(function () {
  149. var dialog = top.dialog.get(window);
  150. var state =@ViewData["state"];
  151. //if (parseInt(state) > 0) {
  152. // dig.alertError("提示", "对不起,只有赛事状态为起草的时,才能修改操作!");
  153. // return;
  154. //}
  155. //添加
  156. $('#insert').click(function () {
  157. dig.addModel('添加/修改组别', '/Sys/EntryConditions/Detail?sportsName=@ViewData["sportsName"]&sportsId=@ViewData["sportsId"]&SEPID=@ViewData["ID"]', 800, 600, function () {
  158. if (this.returnValue == 'yes') {
  159. location.reload();
  160. }
  161. });
  162. });
  163. $('#modify').click(function () {
  164. var vals = '';
  165. var num = 0;
  166. $('input[name="checkbox_name"]:checked').each(function () {
  167. vals = $(this).val();
  168. num++;
  169. });
  170. if (!vals) {
  171. dig.alertError("提示", "对不起,请选中您要操作的记录!");
  172. return;
  173. }
  174. if (num > 1) {
  175. dig.alertError("提示", "对不起,每次只能选择一条赛事进行报名!");
  176. return;
  177. }
  178. if (state > 0) {
  179. dig.alertError("提示", "对不起,只有赛事状态为起草的时,才能修改操作!");
  180. return;
  181. }
  182. dig.addModel('添加/修改组别', '/Sys/EntryConditions/Detail?id=' + vals+'&sportsName=@ViewData["sportsName"]&sportsId=@ViewData["sportsId"]&SEPID=@ViewData["ID"]', 800, 600, function () {
  183. if (this.returnValue == 'yes') {
  184. location.reload();
  185. }
  186. });
  187. });
  188. //删除
  189. $('#delete').click(function () {
  190. if (state > 0) {
  191. dig.alertError("提示", "对不起,只有赛事状态为起草的时,才能删除操作!");
  192. return;
  193. }
  194. else {
  195. var vals = '';
  196. var num = 0;
  197. $('input[name="checkbox_name"]:checked').each(function () {
  198. if (num == 0)
  199. vals = $(this).val();
  200. else
  201. vals = vals + ',' + $(this).val();
  202. num++;
  203. });
  204. if (vals == '' || vals == ',') {
  205. dig.alertError("提示", "对不起,请选中您要操作的记录!");
  206. return;
  207. }
  208. var msg = "删除记录后不可恢复,您确定吗?";
  209. dig.confirm("删除确认", msg, function () {
  210. $.post('/Sys/EntryConditions/Delete', { idList: vals }, function (res) {
  211. if (res.Status == "y") {
  212. dig.alertSuccess('提示', '删除成功', function () {
  213. location.reload();
  214. });
  215. } else {
  216. dig.alertError("提示", res.Msg);
  217. }
  218. }, "json");
  219. });
  220. }
  221. });
  222. function filter(str) {
  223. str = str.replace(/\+/g, "%2B");
  224. str = str.replace(/\&/g, "%26");
  225. return str;
  226. }
  227. $('#selectsport').click(function () {
  228. var vals = '';
  229. var num = 0;
  230. $('input[name="checkbox_name"]:checked').each(function () {
  231. vals = $(this).val();
  232. num++;
  233. });
  234. if (!vals) {
  235. dig.alertError("提示", "对不起,请选择需要设置的组别!");
  236. return false;
  237. }
  238. if (num > 1) {
  239. dig.alertError("提示", "对不起,每次只能选对一条需要设置的组别!");
  240. return false;
  241. }
  242. var scid = "";
  243. $("input[name='checkbox_name']:checked").each(function (a, b) {
  244. scid += $(b).val() + ",";
  245. });
  246. scid = scid.substring(0, scid.lastIndexOf(','));
  247. dig.addModel('选择比赛项目', '/Sys/SportsEvent/SelectSport?sportsName=@ViewData["sportsName"]&sportsId=@ViewData["sportsId"]&id=@ViewData["ID"]', 800, 600, function () {
  248. if (this.returnValue == 'yes') {
  249. var str = this.returnParas.sportsName;
  250. str = str.substring(0, str.lastIndexOf(','));
  251. var strId = this.returnParas.sportsId;
  252. strId = strId.substring(0, strId.lastIndexOf(','));
  253. str = filter(str);
  254. debugger;
  255. $.post('/Sys/EntryConditions/SetProjectEntry?sportsName=@ViewData["sportsName"]&sportsId=@ViewData["sportsId"]&SEPID=@ViewData["ID"]&smallSport=' + str + '&smallSportId=' + strId+'&SCID=' + scid, { }, function (res) {
  256. if (res.Status == "y") {
  257. dig.alertSuccess('提示', '设置成功', function () {
  258. });
  259. } else {
  260. dig.alertError("提示", res.Msg);
  261. }
  262. }, "json");
  263. }
  264. });
  265. });
  266. });
  267. </script>
  268. }