CheckItems.cshtml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. 
  2. @{
  3. Layout = null;
  4. }
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <meta name="viewport" content="width=device-width" />
  9. <title>CheckItem</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. .tree-folder, .tree-folder-open, .tree-file {
  30. width: 0;
  31. background: transparent
  32. }
  33. </style>
  34. </head>
  35. <body>
  36. <section class="hidden">
  37. <input id="hid_Type" name="hid_Type" type="hidden" value="0" />
  38. <input id="hid_IsLock" name="IsLock" type="hidden" value="N" />
  39. </section>
  40. <section class="container-fluid" style="height: 100vh; padding-top: 20px;">
  41. <div class="row tbToolBar" id="tbToolBar">
  42. <div class="toolbar" id="CurdTool" style="float:left">
  43. <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="btn_Add()">添加</a>
  44. <span class="shuxian"></span>
  45. <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="btn_Edit()">修改</a>
  46. <span class="shuxian"></span>
  47. <a href="#" class="easyui-linkbutton" iconCls="icon-no" plain="true" onclick="DelOrRetore('Del')">删除</a>
  48. </div>
  49. </div>
  50. <table id="tgTable">
  51. </table>
  52. </section>
  53. <section>
  54. <div id="winCheckItemInfo" class="easyui-window" title="检测方法信息维护" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:600px;height:350px;padding:10px 10px;">
  55. <div class="easyui-layout" data-options="fit:true">
  56. <div data-options="region:'center'" style="padding:5px;height:250px">
  57. <table cellpadding="10" cellspacing="0" style="margin-left: 10px">
  58. @Html.Hidden("ParentId")
  59. @Html.Hidden("Depth")
  60. @Html.Hidden("Path")
  61. <tr style="display: none">
  62. <td class="td_1">检测项目编号:</td>
  63. <td class="td_1">
  64. <input class="easyui-textbox" type="text" id="CheckItemId" name="CheckItemId" style="width: 400px" readonly="readonly"/>
  65. </td>
  66. </tr>
  67. <tr>
  68. <td class="td_1">检测项目名称:</td>
  69. <td class="td_1">
  70. <input class="easyui-textbox" type="text" id="CheckItemName" name="CheckItemName" data-options="required:true" style="width: 400px"/>
  71. </td>
  72. </tr>
  73. <tr>
  74. <td class="td_1">排序值:</td>
  75. <td class="td_1">
  76. <input class="easyui-numberbox" type="text" id="Sort" name="Sort" data-options="required:true" style="width: 400px"/>
  77. </td>
  78. </tr>
  79. <tr>
  80. <td class="td_1">备注:</td>
  81. <td class="td_1">
  82. <input class="easyui-textbox" type="text" id="Remark" name="Remark" style="width: 400px"/>
  83. </td>
  84. </tr>
  85. </table>
  86. </div>
  87. <div data-options="region:'south',border:false" style="text-align:right;height:50px;padding-top:5px">
  88. <a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save();" style="width:80px">确认</a>
  89. <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winCheckItemInfo').window('close');" style="width:80px">取消</a>
  90. </div>
  91. </div>
  92. </div>
  93. </section>
  94. <script>
  95. //添加
  96. function btn_Add() {
  97. $("#hid_Type").val("Add");
  98. var row = $('#tgTable').treegrid('getSelected');
  99. if (row) {
  100. if (row.Depth > 1) {
  101. layer.alert('该记录下不能创建子记录', { icon: 7, title: '提示信息' });
  102. }
  103. $("#CheckItemId").textbox("setValue", "");
  104. $("#CheckItemName").textbox("setValue", "");
  105. $("#Sort").numberbox("setValue", "");
  106. $("#Remark").textbox("setValue", "");
  107. $("#ParentId").val( row.CheckItemId);
  108. $("#Depth").val(Number(row.Depth) + 1);
  109. $("#Path").val(row.Path);
  110. $('#winCheckItemInfo').window('open');
  111. } else {
  112. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  113. }
  114. }
  115. //修改
  116. function btn_Edit() {
  117. $("#hid_Type").val("Edit");
  118. var row = $('#tgTable').treegrid('getSelected');
  119. if (row) {
  120. console.log(row);
  121. //var row = rows[0];
  122. $("#CheckItemId").textbox("setValue", row.CheckItemId);
  123. $("#CheckItemName").textbox("setValue", row.CheckItemName);
  124. $("#Sort").numberbox("setValue", row.Sort);
  125. $("#Remark").textbox("setValue", row.Remark);
  126. $("#ParentId").val( row._parentId);
  127. $("#Path").val(row.Path);
  128. $("#Depth").val( row.Depth);
  129. $('#winCheckItemInfo').window('open');
  130. } else {
  131. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  132. }
  133. }
  134. function DelOrRetore(type) {
  135. var checkItemId = $('#tgTable').treegrid('getSelections')[0].CheckItemId;
  136. if (!checkItemId) {
  137. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  138. return;
  139. }
  140. if (type == 'Del' || type === "ReDel" ) {
  141. $.messager.confirm('删除','确定删除这条记录?',function(r) {
  142. if (r) {
  143. $.ajax({
  144. url: "@Url.Action("CheckItemsOper", "BaseInfo")",
  145. type: "post",
  146. data: {
  147. Type: type,
  148. CheckItemId: checkItemId
  149. },
  150. success: function(data) {
  151. if (CheckAajxData(data) == false) {
  152. return;
  153. }
  154. var msg = JSON.parse(data);
  155. if (msg != null && msg.Success == true) {
  156. LoadTable();
  157. layer.alert("操作成功!", { title: '提示信息' });
  158. } else {
  159. layer.alert(msg.ErrorInfo, { title: '提示信息' });
  160. }
  161. }
  162. });
  163. }
  164. });
  165. }
  166. }
  167. //提交
  168. function Save(type) {
  169. type = type || $("#hid_Type").val();
  170. if (isNaN($("#Sort").numberbox('getValue'))) {
  171. layer.alert('标准值必须为数字!', { title: '提示信息' });
  172. return;
  173. }
  174. var checkItemId = type === "Edit" ? $('#tgTable').datagrid('getSelections')[0].CheckItemId : '';
  175. $.ajax({
  176. url: "@Url.Action("CheckItemsOper", "BaseInfo")",
  177. type: "post",
  178. data: {
  179. Type: type,
  180. CheckItemName: $("#CheckItemName").textbox('getValue'),
  181. Sort: $("#Sort").numberbox('getValue'),
  182. Remark: $("#Remark").textbox("getValue"),
  183. ParentId: $("#ParentId").val(),
  184. Depth: $("#Depth").val(),
  185. Path: $("#Path").val(),
  186. CheckItemId: checkItemId
  187. },
  188. success: function (data) {
  189. if (CheckAajxData(data) == false) {
  190. return;
  191. }
  192. var msg = JSON.parse(data);
  193. if (msg != null && msg.Success == true) {
  194. LoadTable();
  195. $('#winCheckItemInfo').window('close');
  196. layer.alert("操作成功!", { title: '提示信息' });
  197. } else {
  198. layer.alert(msg.ErrorInfo, { title: '提示信息' });
  199. }
  200. }
  201. });
  202. }
  203. //加载表格数据
  204. function LoadTable() {
  205. $('#tgTable').treegrid({
  206. rownumbers: true,
  207. animate: true,
  208. collapsible: true,
  209. fitColumns: true,
  210. url: '@Url.Action("CheckItemsList", "BaseInfo")' ,
  211. method: 'get',
  212. idField: 'CheckItemId',
  213. treeField: 'CheckItemName',
  214. showFooter: true,
  215. columns: [
  216. [
  217. { field: 'CheckItemName', title: '检测项目名称', width: 180 },
  218. { field: 'Sort', title: '排序值', width: 60 }
  219. ]
  220. ],
  221. //onLoadSuccess: function() {
  222. // $('#tgTable').treegrid("collapseAll");
  223. // $('#tgTable').treegrid("expand", $('#tgTable').treegrid("getRoot"));
  224. //}
  225. });
  226. }
  227. $(function() {
  228. LoadTable();
  229. });
  230. </script>
  231. </body>
  232. </html>