CheckMethonds.cshtml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. 
  2. @{
  3. Layout = null;
  4. }
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <meta name="viewport" content="width=device-width" />
  9. <title>CheckProjectType</title>
  10. <link href="~/easyui/themes/default/easyui.css" rel="stylesheet" />
  11. <link href="~/easyui/themes/icon.css" rel="stylesheet" />
  12. <link href="~/Content/css/bootstrap.min.css" rel="stylesheet" />
  13. <link href="~/Content/js/plugins/layer/skin/layer.css" rel="stylesheet" />
  14. <script src="~/Content/js/jquery.min.js"></script>
  15. <script src="~/Content/js/bootstrap.min.js"></script>
  16. <script src="~/easyui/jquery.easyui.min.js"></script>
  17. <script src="~/easyui/jquery.easyui.mobile.js"></script>
  18. <script src="~/easyui/locale/easyui-lang-zh_CN.js"></script>
  19. <script src="~/Content/js/plugins/layer/laydate/laydate.js"></script>
  20. <script src="~/Content/js/plugins/layer/layer.min.js"></script>
  21. <script src="~/js/Utils.js"></script>
  22. <link href="~/Content/css/Style/Markets.css" rel="stylesheet" />
  23. @*<script src="~/Content/js/js/MarketJs.js"></script>*@
  24. <style>
  25. .td_1 {
  26. padding-bottom: 5px;
  27. padding-left: 5px;
  28. }
  29. </style>
  30. </head>
  31. <body>
  32. <section class="hidden">
  33. <input id="hid_Type" name="hid_Type" type="hidden" value="0" />
  34. <input id="hid_IsLock" name="IsLock" type="hidden" value="N" />
  35. </section>
  36. <section class="container-fluid" style="height: 100vh; padding-top: 20px;">
  37. <div class="row tbToolBar" id="tbToolBar">
  38. <div class="toolbar">
  39. <label>
  40. <input type="checkbox" id="DataToggle"> 显示已删除记录
  41. </label>
  42. </div>
  43. <div class="toolbar" id="CurdTool" style="float:left">
  44. <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="btn_Add()">添加</a>
  45. <span class="shuxian"></span>
  46. <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="btn_Edit()">修改</a>
  47. <span class="shuxian"></span>
  48. <a href="#" class="easyui-linkbutton" iconCls="icon-no" plain="true" onclick="DelOrRetore('Del')">删除</a>
  49. </div>
  50. <div class="col-sm-3" id="ResetTool">
  51. <a href="#" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="DelOrRetore('ReDel')">恢复删除</a>
  52. </div>
  53. </div>
  54. <table id="dgTable" class="easyui-datagrid" style="height: 100%;"
  55. data-options="singleSelect: true,
  56. method: 'post',
  57. multiSort: false,
  58. toolbar: '#tbToolBar',
  59. fitColumns: true,
  60. remoteSort: false,
  61. loadFilter: pagerFilter,
  62. rownumbers: true,
  63. pagination: true,
  64. pageSize: 50,
  65. pageList: [15, 25, 50, 100]
  66. ">
  67. <thead>
  68. <tr>
  69. @*<th data-options="field:'CheckMethodId',width:150">检测方法编号</th>*@
  70. <th data-options="field:'CheckMethodName',width:150">检测方法名称</th>
  71. <th data-options="field:'Sort',width:60">排序值</th>
  72. </tr>
  73. </thead>
  74. </table>
  75. </section>
  76. <section>
  77. <div id="winCheckMethodInfo" class="easyui-window" title="检测方法信息维护" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:600px;height:350px;padding:10px 10px;">
  78. <div class="easyui-layout" data-options="fit:true">
  79. <div data-options="region:'center'" style="padding:5px;height:250px">
  80. <table cellpadding="10" cellspacing="0" style="margin-left:10px">
  81. <tr style="display: none">
  82. <td class="td_1">检测方法编号:</td>
  83. <td class="td_1">
  84. <input class="easyui-textbox" type="text" id="CheckMethodId" name="CheckMethodId" style="width:400px" readonly="readonly" />
  85. </td>
  86. </tr>
  87. <tr>
  88. <td class="td_1">检测方法名称:</td>
  89. <td class="td_1">
  90. <input class="easyui-textbox" type="text" id="CheckMethodName" name="CheckMethodName" data-options="required:true,min:0,precision:2" style="width:400px" />
  91. </td>
  92. </tr>
  93. <tr>
  94. <td class="td_1">排序值:</td>
  95. <td class="td_1">
  96. <input class="easyui-numberbox" type="text" id="Sort" name="Sort" data-options="required:true" style="width:400px" />
  97. </td>
  98. </tr>
  99. <tr>
  100. <td class="td_1">备注:</td>
  101. <td class="td_1">
  102. <input class="easyui-textbox" type="text" id="Remark" name="Remark" style="width:400px" />
  103. </td>
  104. </tr>
  105. </table>
  106. </div>
  107. <div data-options="region:'south',border:false" style="text-align:right;height:50px;padding-top:5px">
  108. <a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save();" style="width:80px">确认</a>
  109. <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winCheckMethodInfo').window('close');" style="width:80px">取消</a>
  110. </div>
  111. </div>
  112. </div>
  113. </section>
  114. <script>
  115. //切换显示不同状态数据
  116. $("#DataToggle").on("click",
  117. function () {
  118. if ($('#hid_IsLock').val() === "N") {
  119. $('#hid_IsLock').val("Y");
  120. $("#CurdTool").hide();
  121. $("#ResetTool").show();
  122. } else {
  123. $('#hid_IsLock').val("N");
  124. $("#ResetTool").hide();
  125. $("#CurdTool").show();
  126. }
  127. window.LoadTable();
  128. });
  129. //添加
  130. function btn_Add() {
  131. $("#hid_Type").val("Add");
  132. $("#CheckMethodId").textbox("setValue", "");
  133. $("#CheckMethodName").textbox("setValue", "");
  134. $("#Sort").numberbox("setValue", "");
  135. $("#Remark").textbox("setValue", "");
  136. $('#winCheckMethodInfo').window('open');
  137. }
  138. //修改
  139. function btn_Edit() {
  140. $("#hid_Type").val("Edit");
  141. var row = $('#dgTable').datagrid('getSelected');
  142. if (row) {
  143. console.log(row);
  144. //var row = rows[0];
  145. $("#CheckMethodId").textbox("setValue", row.CheckMethodId);
  146. $("#CheckMethodName").textbox("setValue", row.CheckMethodName);
  147. $("#Sort").numberbox("setValue", row.Sort);
  148. $("#Remark").textbox("setValue", row.Remark);
  149. $('#winCheckMethodInfo').window('open');
  150. } else {
  151. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  152. }
  153. }
  154. function DelOrRetore(type) {
  155. var checkMethodId = $('#dgTable').datagrid('getSelections')[0].CheckMethodId;
  156. if (!checkMethodId) {
  157. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  158. return;
  159. }
  160. if (type === 'Del' || type === "ReDel" ) {
  161. $.messager.confirm('删除或恢复', '确定删除或恢复这条记录?', function (r) {
  162. if (r) {
  163. $.ajax({
  164. url: "@Url.Action("CheckMethondsOper", "BaseInfo")",
  165. type: "post",
  166. data: {
  167. Type: type,
  168. CheckMethodId: checkMethodId
  169. },
  170. success: function (data) {
  171. if (CheckAajxData(data) == false) {
  172. return;
  173. }
  174. var msg = JSON.parse(data);
  175. if (msg != null && msg.Success == true) {
  176. LoadTable();
  177. layer.alert("操作成功!", { title: '提示信息' });
  178. } else {
  179. layer.alert(msg.ErrorInfo, { title: '提示信息' });
  180. }
  181. }
  182. });
  183. }
  184. })
  185. }
  186. }
  187. //提交
  188. function Save(type) {
  189. type = type || $("#hid_Type").val();
  190. if (isNaN($("#Sort").numberbox('getValue'))) {
  191. layer.alert('标准值必须为数字!', { title: '提示信息' });
  192. return;
  193. }
  194. var checkMethodId = type === "Edit" ? $('#dgTable').datagrid('getSelections')[0].CheckMethodId : '';
  195. $.ajax({
  196. url: "@Url.Action("CheckMethondsOper", "BaseInfo")",
  197. type: "post",
  198. data: {
  199. Type: type,
  200. CheckMethodName: $("#CheckMethodName").textbox('getValue'),
  201. Sort: $("#Sort").numberbox('getValue'),
  202. Remark: $("#Remark").textbox("getValue"),
  203. CheckMethodId: checkMethodId
  204. },
  205. success: function (data) {
  206. if (CheckAajxData(data) == false) {
  207. return;
  208. }
  209. var msg = JSON.parse(data);
  210. if (msg != null && msg.Success == true) {
  211. LoadTable();
  212. $('#winCheckMethodInfo').window('close');
  213. layer.alert("操作成功!", { title: '提示信息' });
  214. } else {
  215. layer.alert(msg.ErrorInfo, { title: '提示信息' });
  216. }
  217. }
  218. });
  219. }
  220. //加载表格数据
  221. function LoadTable() {
  222. $('#dgTable').datagrid({
  223. url: '@Url.Action("CheckMethondsList", "BaseInfo")' + '?IsLock=' + $('#hid_IsLock').val(),
  224. onDblClickRow: function () {
  225. if ($('#hid_IsLock').val() === "N") {
  226. btn_Edit();
  227. }
  228. },
  229. });
  230. }
  231. $(function () {
  232. //加载表格数据
  233. window.LoadTable();
  234. //加载日历控件
  235. //laydate({
  236. // elem: '#PractiseTime',
  237. // format: "YYYY-MM-DD",
  238. // min: "1980-01-01",
  239. // event: "focus"
  240. //});
  241. });
  242. </script>
  243. </body>
  244. </html>