StandardList.cshtml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. 
  2. @{
  3. Layout = null;
  4. }
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <meta name="viewport" content="width=device-width" />
  9. <title>StandardList</title>
  10. <link href="~/easyui/themes/bootstrap/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. <style>
  24. .td_1 {
  25. padding-bottom: 5px;
  26. padding-left: 5px;
  27. }
  28. </style>
  29. </head>
  30. <body>
  31. <section class="hidden">
  32. <input id="hid_Type" name="hid_Type" type="hidden" value="0" />
  33. <input id="hid_IsLock" name="IsLock" type="hidden" value="0" />
  34. <input id="hid_MarketType" name="hid_MarketType" type="hidden" value="0" />
  35. </section>
  36. @*<section class="text-center title">
  37. <h2>市场信息</h2>
  38. </section>*@
  39. <section class="container-fluid" style="height: 100vh; padding-top: 20px;">
  40. <div class="row tbToolBar" id="tbToolBar">
  41. <div class="toolbar">
  42. <label>
  43. <input type="checkbox" id="DataToggle"> 显示已删除记录
  44. </label>
  45. </div>
  46. <div class="toolbar" id="CurdTool" style="float:left">
  47. <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="btn_Add()">添加</a>
  48. <span class="shuxian"></span>
  49. <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="btn_Edit()">修改</a>
  50. <span class="shuxian"></span>
  51. <a href="#" class="easyui-linkbutton" iconCls="icon-no" plain="true" onclick="DelOrRetore('Del')">删除</a>
  52. </div>
  53. <div class="col-sm-3" id="ResetTool">
  54. <a href="#" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="DelOrRetore('ReDel')">恢复删除</a>
  55. </div>
  56. </div>
  57. <table id="dgTable" class="easyui-datagrid" style="height: 100%;"
  58. data-options="singleSelect: true,
  59. method: 'post',
  60. multiSort: false,
  61. toolbar: '#tbToolBar',
  62. fitColumns: true,
  63. rownumbers: true,
  64. remoteSort: false,
  65. loadFilter: pagerFilter,
  66. pagination: true,
  67. pageSize: 15,
  68. pageList: [15, 25, 50, 100]
  69. ">
  70. <thead>
  71. <tr>
  72. <th data-options="field:'StandardID',width:80">标准编号</th>
  73. <th data-options="field:'Names',width:150">标准名称</th>
  74. <th data-options="field:'RegularValue',width:80,">合格限值</th>
  75. <th data-options="field:'OvertopValue',width:50,">超标限值</th>
  76. </tr>
  77. </thead>
  78. </table>
  79. </section>
  80. <section>
  81. <div id="winStandardInfo" class="easyui-window" title="残留农药标准管理" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:600px;height:350px;padding:10px 10px;">
  82. <div class="easyui-layout" data-options="fit:true">
  83. <div data-options="region:'center'" style="padding:5px;height:250px">
  84. <table cellpadding="10" cellspacing="0" style="margin-left:10px">
  85. <tr>
  86. <td class="td_1">标准名称:</td>
  87. <td class="td_1"><input class="easyui-textbox" type="text" id="Names" name="Names" data-options="required:true" style="width:400px" /></td>
  88. </tr>
  89. <tr>
  90. <td class="td_1">合格限值:</td>
  91. <td class="td_1"><input class="easyui-textbox" type="text" id="RegularValue" name="RegularValue" data-options="required:true" style="width:400px" /></td>
  92. </tr>
  93. <tr>
  94. <td class="td_1">超标限值:</td>
  95. <td class="td_1">
  96. <input class="easyui-textbox" type="text" id="OvertopValue" name="OvertopValue" 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. <select class="easyui-combobox" name="IsUse" id="IsUse" style="width:400px">
  103. <option value="0">非在用</option>
  104. <option value="1">在用</option>
  105. </select>
  106. </td>
  107. </tr>
  108. </table>
  109. </div>
  110. <div data-options="region:'south',border:false" style="text-align:right;height:50px;padding-top:5px">
  111. <a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save();" style="width:80px">确认</a>
  112. <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winStandardInfo').window('close');" style="width:80px">取消</a>
  113. </div>
  114. </div>
  115. </div>
  116. </section>
  117. <script>
  118. //切换显示不同状态数据
  119. $("#DataToggle").on("click",
  120. function () {
  121. if ($('#hid_IsLock').val() === "0") {
  122. $('#hid_IsLock').val("1");
  123. $("#CurdTool").hide();
  124. $("#ResetTool").show();
  125. } else {
  126. $('#hid_IsLock').val("0");
  127. $("#ResetTool").hide();
  128. $("#CurdTool").show();
  129. }
  130. window.LoadTable();
  131. });
  132. //添加
  133. function btn_Add() {
  134. $("#hid_Type").val("Add");
  135. $('#Names').textbox('setValue', '');
  136. $('#RegularValue').textbox('setValue', '');
  137. $('#OvertopValue').textbox('setValue', '');
  138. //$('#Names').combobox('setValue', '');
  139. $('#winStandardInfo').window('open');
  140. }
  141. //修改
  142. function btn_Edit() {
  143. $("#hid_Type").val("Edit");
  144. var rows = $('#dgTable').datagrid('getSelections');
  145. if (rows.length === 1) {
  146. var row = rows[0];
  147. $('#Names').textbox('setValue', row.Names);
  148. $('#RegularValue').textbox('setValue', row.RegularValue);
  149. $('#OvertopValue').textbox('setValue', row.OvertopValue);
  150. $('#IsUse').combobox('setValue', row.IsUse);
  151. $('#winStandardInfo').window('open');
  152. } else {
  153. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  154. }
  155. }
  156. function DelOrRetore(type) {
  157. var StandardID = $('#dgTable').datagrid('getSelections')[0].StandardID;
  158. if (!StandardID) {
  159. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  160. return;
  161. }
  162. if (type == 'Del' || type === "ReDel" ) {
  163. $.messager.confirm('删除或恢复', '确定删除或恢复这条记录?', function (r) {
  164. if (r) {
  165. $.ajax({
  166. url: "@Url.Action("StandListOper", "BaseInfo")",
  167. type: "post",
  168. data: {
  169. Type: type,
  170. StandardID: StandardID
  171. },
  172. success: function (data) {
  173. if (CheckAajxData(data) == false) {
  174. return;
  175. }
  176. var msg = JSON.parse(data);
  177. if (msg != null && msg.Success == true) {
  178. LoadTable();
  179. layer.alert("操作成功!", { title: '提示信息' });
  180. } else {
  181. layer.alert(msg.ErrorInfo, { title: '提示信息' });
  182. }
  183. }
  184. });
  185. }
  186. })
  187. }
  188. }
  189. //提交
  190. function Save(type) {
  191. type = type || $("#hid_Type").val();
  192. var StandardID = (type === "Edit" || type === "Del" || type === "ReDel") ? $('#dgTable').datagrid('getSelections')[0].StandardID : "";
  193. $.ajax({
  194. url: "@Url.Action("StandListOper", "BaseInfo")",
  195. type: "post",
  196. data: {
  197. Type: type,
  198. Names: $("#Names").textbox('getValue'),
  199. RegularValue: $("#RegularValue").textbox('getValue'),
  200. OvertopValue: $("#OvertopValue").val(),
  201. IsUse: $("#IsUse").val(),
  202. StandardID: StandardID
  203. },
  204. success: function (data) {
  205. if (CheckAajxData(data) == false) {
  206. return;
  207. }
  208. var msg = JSON.parse(data);
  209. if (msg != null && msg.Success == true) {
  210. LoadTable();
  211. $('#winStandardInfo').window('close');
  212. layer.alert("操作成功!", { title: '提示信息' });
  213. } else {
  214. layer.alert(msg.ErrorInfo, { title: '提示信息' });
  215. }
  216. }
  217. });
  218. }
  219. //modal赋值
  220. function SetModalVal() {
  221. var rows = $('#dgTable').datagrid('getSelections');
  222. if (rows.length === 1) {
  223. var row = rows[0];
  224. //console.log(row);
  225. $("#StandardNames").val(row.Names),
  226. $("#StandardRegularValue").val(row.RegularValue),
  227. $("#OvertopValue").val(row.OvertopValue),
  228. $("#IsUser").val(row.IsUse)
  229. $("#modal").modal("show");
  230. } else {
  231. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  232. }
  233. }
  234. //加载表格数据
  235. function LoadTable() {
  236. $('#dgTable').datagrid({
  237. url: '@Url.Action("GetStandList", "BaseInfo")' + '?IsLock=' + $('#hid_IsLock').val(),
  238. onDblClickRow: function () {
  239. if ($('#hid_IsLock').val() === "0") {
  240. btn_Edit();
  241. }
  242. },
  243. });
  244. }
  245. $(function () {
  246. //加载表格数据
  247. window.LoadTable();
  248. //加载日历控件
  249. });
  250. </script>
  251. </body>
  252. </html>