Index.cshtml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. <a class="btn btn-primary btn-xs p310" id="showPassword" action="showPassword"><i class="im-vcard"></i> 查看密码</a>
  22. </div>
  23. </div>
  24. <div class="ibox-content">
  25. <!-- search star -->
  26. @using (Ajax.BeginForm("Index", null, new AjaxOptions() { }, new { @id = "form1", @class = "form-horizontal", @method = "get" }))
  27. {
  28. <div class="form-horizontal clearfix">
  29. <div class="col-lg-4 col-sm-3 pl0" style="width:55%;">
  30. <div class="form-group">
  31. </div>
  32. </div>
  33. <div class="col-lg-4 col-sm-4" style="float:right;">
  34. <div class="form-group">
  35. <div class="col-lg-12 col-sm-12 input-group">
  36. @Html.TextBox("Search", null, new { @class = "input-sm form-control", @placeholder = "请输入查询关键词" })
  37. <span class="input-group-btn">
  38. <button type="button" onclick="submit()" class="btn btn-sm btn-primary"> 搜索</button>
  39. </span>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. <!-- search end -->
  45. <div id="example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
  46. <table id="example" class="table table-striped table-bordered table-hover dataTables-example dataTable" cellspacing="0" width="100%">
  47. <thead>
  48. <tr>
  49. <th class="tn" style="width: 40px !important"><input name="checkall" id="checkall" type="checkbox" value=""></th>
  50. <th>设备名称</th>
  51. <th>设备编码</th>
  52. <th>设备地址</th>
  53. <th style="width: 170px !important">创建时间</th>
  54. </tr>
  55. </thead>
  56. <tbody>
  57. @{foreach (var item in Model.List)
  58. {
  59. <tr>
  60. <td class="tn"><input name="checkbox_name" type="checkbox" value="@item.Id"></td>
  61. <td>
  62. <a href="javascript:modify('@item.Id')" listaction="detail"> @item.Name</a>
  63. </td>
  64. <td>@item.Name</td>
  65. <td>@item.Code</td>
  66. <td>@item.Address</td>
  67. <td>@item.CreateDT</td>
  68. </tr>
  69. }
  70. }
  71. </tbody>
  72. </table>
  73. <!-- page -->
  74. <div class="bottom">
  75. <div class="dataTables_info" id="example_info" Post="status" aria-live="polite">显示第 @Model.BeginPage 至 @Model.EndPage 项结果,共 @Model.Count 项</div>
  76. <div class="dataTables_length" id="example_length">
  77. <label>
  78. 显示
  79. <select name="example_length" onchange="submit()" aria-controls="example" class="form-control input-sm">
  80. <option value="10" @(Model.PageSize == 10 ? "selected" : "")>10</option>
  81. <option value="25" @(Model.PageSize == 25 ? "selected" : "")>25</option>
  82. <option value="50" @(Model.PageSize == 50 ? "selected" : "")>50</option>
  83. <option value="100" @(Model.PageSize == 100 ? "selected" : "")>100</option>
  84. </select> 项结果
  85. </label>
  86. </div>
  87. @CommonHtmlHelper.PaginationPager(Model.Index, Model.PageSize, Model.Count, 7, Model.Url)
  88. <div class="clear"></div>
  89. </div>
  90. <!-- page -->
  91. </div>
  92. }
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. <!-- table end -->
  98. @section scripts{
  99. <script type="text/javascript">
  100. //点击修改
  101. function modify(n) {
  102. dig.addModel('添加/编辑设备', '/Sys/DeviceSet/Detail/' + n, 600, 280, function () {
  103. if (this.returnValue == 'yes') {
  104. location.reload();
  105. }
  106. });
  107. }
  108. $(function () {
  109. $('.select2').select2();
  110. //添加
  111. $('#insert').click(function () {
  112. dig.addModel('添加/编辑设备', '/Sys/DeviceSet/Detail', 600, 280, function () {
  113. if (this.returnValue == 'yes') {
  114. location.reload();
  115. }
  116. });
  117. });
  118. //修改
  119. $('#modify').click(function () {
  120. var vals = '';
  121. var num = 0;
  122. $('input[name="checkbox_name"]:checked').each(function () {
  123. vals = $(this).val();
  124. num++;
  125. });
  126. if (!vals) {
  127. dig.alertError("提示", "对不起,请选中您要操作的记录!");
  128. return;
  129. }
  130. if (num > 1) {
  131. dig.alertError("提示", "对不起,每次只能修改一条记录!");
  132. return;
  133. }
  134. dig.addModel('添加/编辑设备', '/Sys/DeviceSet/Detail/' + vals, 600, 280, function () {
  135. if (this.returnValue == 'yes') {
  136. location.reload();
  137. }
  138. });
  139. });
  140. //查看密码
  141. $('#showPassword').click(function () {
  142. var vals = '';
  143. var num = 0;
  144. $('input[name="checkbox_name"]:checked').each(function () {
  145. vals = $(this).val();
  146. num++;
  147. });
  148. if (!vals) {
  149. dig.alertError("提示", "对不起,请选中您要查看的记录!");
  150. return;
  151. }
  152. if (num > 1) {
  153. dig.alertError("提示", "对不起,每次只能查看一条记录!");
  154. return;
  155. }
  156. dig.addModel('查看密码', '/Sys/DeviceSet/ShowPassword/' + vals, 600, 180, function () {
  157. });
  158. });
  159. });
  160. </script>
  161. }