Index.cshtml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. @model PageInfo
  11. <!-- table star -->
  12. <div class="row col-lg-12">
  13. <div class="wrapper wrapper-content animated fadeInUp">
  14. <div class="ibox">
  15. <div class="ibox-title">
  16. <h5>编码管理</h5>
  17. <div class="ibox-tools rboor">
  18. <a class="btn btn-primary btn-xs p310" id="insert" action="add"><i class="im-plus"></i> 创建新编码</a>
  19. <a class="btn btn-primary btn-xs p310" id="modify" action="edit"><i class="im-pencil2"></i> 编辑</a>
  20. <a class="btn btn-primary btn-xs p310" id="delete" action="remove"><i class="im-remove4"></i> 删除</a>
  21. </div>
  22. </div>
  23. <div class="ibox-content">
  24. <!-- search star -->
  25. @using (Ajax.BeginForm("Index", null, new AjaxOptions() { }, new { @id = "form1", @class = "form-horizontal", @method = "get" }))
  26. {
  27. <div class="form-horizontal clearfix">
  28. <div class="col-lg-4 col-sm-3 pl0" style="width:38%;">
  29. <div class="form-group">
  30. <label class="control-label" style="width:20%; float:left;">编码类型:</label>
  31. <div class="col-lg-8 col-sm-7">
  32. <select id="codetype" name="codetype" class="input-sm form-control input-s-sm inline" style="width:auto;" onchange="submit()">
  33. <option value="" @(ViewData["codet"] == null ? "selected=\"selected\"" : "")>全部</option>
  34. @{
  35. var codeType = ViewData["codeType"] as Dictionary<string,string>;
  36. foreach (var item in codeType)
  37. {
  38. <option value="@item.Value" @(ViewData["codet"] != null && ViewData["codet"].ToString() == item.Value ? "selected=\"selected\"" : "")>@item.Key</option>
  39. }
  40. }
  41. </select>
  42. </div>
  43. </div>
  44. </div>
  45. <div class="col-lg-4 col-sm-4" style="float:right;">
  46. <div class="form-group">
  47. <div class="col-lg-12 col-sm-12 input-group">
  48. @Html.TextBox("Search", null, new { @class = "input-sm form-control", @placeholder = "请输入查询关键词" })
  49. <span class="input-group-btn">
  50. <button type="button" onclick="submit()" class="btn btn-sm btn-primary"> 搜索</button>
  51. </span>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <!-- search end -->
  57. <div id="example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
  58. <table id="example" class="table table-striped table-bordered table-hover dataTables-example dataTable" cellspacing="0" width="100%">
  59. <thead>
  60. <tr>
  61. <th class="tn" style="width: 40px !important"><input name="checkall" id="checkall" type="checkbox" value=""></th>
  62. <th>编码类型</th>
  63. <th>编码名称</th>
  64. <th>编码值</th>
  65. <th>显示顺序</th>
  66. <th>备注</th>
  67. <th width="200px">更新时间</th>
  68. </tr>
  69. </thead>
  70. <tbody>
  71. @{foreach (var item in Model.List)
  72. {
  73. <tr>
  74. <td class="tn"><input name="checkbox_name" type="checkbox" value="@item.ID"></td>
  75. <td>
  76. @(ClsDic.GetDicKeyByValue(item.CODETYPE, ClsDic.DicCodeType))
  77. </td>
  78. <td>
  79. <a href="javascript:modify('@item.ID')" listaction="detail"> @item.NAMETEXT</a>
  80. </td>
  81. <td>@item.CODEVALUE</td>
  82. <td>@item.SHOWORDER</td>
  83. <td>@item.REMARK</td>
  84. <td>@item.UPDATEDATE</td>
  85. </tr>
  86. }
  87. }
  88. </tbody>
  89. </table>
  90. <!-- page -->
  91. <div class="bottom">
  92. <div class="dataTables_info" id="example_info" post="status" aria-live="polite">显示第 @Model.BeginPage 至 @Model.EndPage 项结果,共 @Model.Count 项</div>
  93. <div class="dataTables_length" id="example_length">
  94. <label>
  95. 显示
  96. <select name="example_length" onchange="submit()" aria-controls="example" class="form-control input-sm">
  97. <option value="10" @(Model.PageSize == 10 ? "selected" : "")>10</option>
  98. <option value="25" @(Model.PageSize == 25 ? "selected" : "")>25</option>
  99. <option value="50" @(Model.PageSize == 50 ? "selected" : "")>50</option>
  100. <option value="100" @(Model.PageSize == 100 ? "selected" : "")>100</option>
  101. </select> 项结果
  102. </label>
  103. </div>
  104. @CommonHtmlHelper.PaginationPager(Model.Index, Model.PageSize, Model.Count, 7, Model.Url)
  105. <div class="clear"></div>
  106. </div>
  107. <!-- page -->
  108. </div>
  109. }
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. <!-- table end -->
  115. @section scripts{
  116. <script type="text/javascript">
  117. //点击修改
  118. function modify(n) {
  119. dig.addModel('添加/编辑编码', '/Sys/Code/Detail/' + n, 700, 370, function () {
  120. if (this.returnValue == 'yes') {
  121. location.reload();
  122. }
  123. });
  124. }
  125. $(function () {
  126. //添加
  127. $('#insert').click(function () {
  128. dig.addModel('添加/编辑编码', '/Sys/Code/Detail', 700, 370, function () {
  129. if (this.returnValue == 'yes') {
  130. location.reload();
  131. }
  132. });
  133. });
  134. //修改
  135. $('#modify').click(function () {
  136. var vals = '';
  137. var num = 0;
  138. $('input[name="checkbox_name"]:checked').each(function () {
  139. vals = $(this).val();
  140. num++;
  141. });
  142. if (!vals) {
  143. dig.alertError("提示", "对不起,请选中您要操作的记录!");
  144. return;
  145. }
  146. if (num > 1) {
  147. dig.alertError("提示", "对不起,每次只能修改一条记录!");
  148. return;
  149. }
  150. dig.addModel('添加/编辑编码', '/Sys/Code/Detail/' + vals, 700, 370, function () {
  151. if (this.returnValue == 'yes') {
  152. location.reload();
  153. }
  154. });
  155. });
  156. });
  157. </script>
  158. }