Regions.cshtml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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. @*hid_IsLock<th data-options="field:'TradeTypeID'" class="hidden">行业类型</th>*@
  73. <th data-options="field:'Names',width:80,">名称</th>
  74. <th data-options="field:'RegionID',width:80,">编号</th>
  75. </tr>
  76. </thead>
  77. </table>
  78. </section>
  79. <section>
  80. <div id="winModal" class="easyui-window winModal" title="区域信息维护" style="width: 520px; height: 220px;padding:5px;"
  81. iconCls="icon-save" data-options="modal:true,closed:true">
  82. <div class="easyui-layout" data-options="fit:true" style="height:400px">
  83. <div data-options="region:'center'" style="padding:5px 5px 1px; height:385px">
  84. <table cellpadding="10" cellspacing="0" style="margin-left:10px">
  85. <tr>
  86. <td class="td_1">编号</td>
  87. <td class="td_1">
  88. <input class="easyui-textbox" type="text" id="RegionID" name="RegionID" data-options="required:true" style="width:400px;height:20px" />
  89. </td>
  90. </tr>
  91. <tr>
  92. <td class="td_1">名称</td>
  93. <td class="td_1"><input class="easyui-textbox" type="text" id="Names" name="Names" data-options="required:true" style="width:400px;height:20px" /></td>
  94. </tr>
  95. <tr></tr>
  96. <tr>
  97. <td class="td_1">网址</td>
  98. <td class="td_1">
  99. <input class="easyui-textbox" type="text" id="URL" name="URL" style="width:400px;height:20px" />
  100. </td>
  101. </tr>
  102. </table>
  103. </div>
  104. <div data-options="region:'south',border:false" style="text-align:right; padding: 12px 20px ;height:52px;">
  105. <a class="easyui-linkbutton" id="Save" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save()" style="width:80px">确认</a>
  106. <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winModal').window('close');" style="width:80px">取消</a>
  107. </div>
  108. </div>
  109. </div>
  110. </section>
  111. <script>
  112. //切换显示不同状态数据
  113. $("#DataToggle").on("click",
  114. function () {
  115. if ($('#hid_IsLock').val() === "0") {
  116. $('#hid_IsLock').val("1");
  117. $("#CurdTool").hide();
  118. $("#ResetTool").show();
  119. } else {
  120. $('#hid_IsLock').val("0");
  121. $("#ResetTool").hide();
  122. $("#CurdTool").show();
  123. }
  124. window.LoadTable();
  125. });
  126. //添加
  127. function btn_Add() {
  128. $("#hid_Type").val("Add");
  129. var row = $('#dgTable').datagrid('getSelected');
  130. if (row) {
  131. $("#RegionID").textbox("setValue", '');
  132. $("#Names").textbox("setValue", '');
  133. $("#RegionID").textbox("enable");
  134. $("#Names").textbox("enable");
  135. $("#URL").textbox("setValue", '');
  136. $('#winModal').window('open');
  137. } else {
  138. layer.alert('请选择一条父节点进行添加!', { icon: '0', title: '提示信息' });
  139. }
  140. }
  141. //修改
  142. function btn_Edit() {
  143. $("#hid_Type").val("Edit");
  144. var row = $('#dgTable').datagrid('getSelected');
  145. if (row) {
  146. $("#RegionID").textbox("setValue", row.RegionID);
  147. var name = row.Names;
  148. if (name) {
  149. name = name.replace(/-*/i, '');
  150. }
  151. $("#Names").textbox("setValue", name);
  152. $("#RegionID").textbox("disable");
  153. //$("#Names").textbox("disable");
  154. $("#URL").textbox("setValue", row.URL);
  155. $('#winModal').window('open');
  156. } else {
  157. layer.alert('请选择一条记录进行设置', { icon: '0', title: '提示信息' });
  158. }
  159. }
  160. function DelOrRetore(type) {
  161. var RegionID = $('#dgTable').datagrid('getSelections')[0].RegionID;
  162. if (!RegionID) {
  163. layer.alert('请选择一条记录进行设置', { icon: '0', title: '提示信息' });
  164. return;
  165. }
  166. if (type == 'Del' || type === "ReDel") {
  167. $.messager.confirm('删除或恢复', '确定删除或恢复这条记录?', function (r) {
  168. if (r) {
  169. $.ajax({
  170. url: "@Url.Action("RegionsListOper", "BaseInfo")",
  171. type: "post",
  172. data: {
  173. Type: type,
  174. RegionID: RegionID
  175. },
  176. success: function (data) {
  177. if (CheckAajxData(data) == false) {
  178. return;
  179. }
  180. var msg = JSON.parse(data);
  181. if (msg != null && msg.Success == true) {
  182. LoadTable();
  183. layer.alert("操作成功!", { icon: '1', title: '提示信息' });
  184. } else {
  185. layer.alert(msg.ErrorInfo, { icon: '2', title: '提示信息' });
  186. }
  187. }
  188. });
  189. }
  190. })
  191. }
  192. }
  193. //提交
  194. function Save(type) {
  195. if ($('#RegionID').textbox('getValue').length <= 0) {
  196. layer.alert("区域编号不能为空!", { icon: '0', title: '提示信息' });
  197. return;
  198. }
  199. if ($('#Names').textbox('getValue').length <= 0) {
  200. layer.alert("区域名称不能为空!", { icon: '0', title: '提示信息' });
  201. return;
  202. }
  203. type = type || $("#hid_Type").val();
  204. var RegionID = (type === "Edit" || type === "up" || type === "down") ? $('#dgTable').datagrid('getSelections')[0].RegionID : $('#RegionID').textbox('getValue');
  205. var FRegionID = $('#dgTable').datagrid('getSelections')[0].RegionID;
  206. $.ajax({
  207. url: "@Url.Action("RegionsListOper", "BaseInfo")",
  208. type: "post",
  209. data: {
  210. Type: type,
  211. URL: $("#URL").textbox('getValue'),
  212. Names: $("#Names").textbox('getValue'),
  213. RegionID: RegionID,
  214. FRegionID: FRegionID
  215. },
  216. success: function (data) {
  217. if (CheckAajxData(data) == false) {
  218. return;
  219. }
  220. var msg = JSON.parse(data);
  221. if (msg != null && msg.Success == true) {
  222. LoadTable();
  223. $('#winModal').window('close')
  224. layer.alert("操作成功!", { icon: '1', title: '提示信息' });
  225. } else {
  226. layer.alert(msg.ErrorInfo, { icon: '2', title: '提示信息' });
  227. }
  228. }
  229. });
  230. }
  231. //加载表格数据
  232. function LoadTable() {
  233. $('#dgTable').datagrid({
  234. url: '@Url.Action("GetRegionsList", "BaseInfo")' + '?IsLock=' + $('#hid_IsLock').val(),
  235. onDblClickRow: function () {
  236. if ($('#hid_IsLock').val() === "0") {
  237. btn_Edit();
  238. }
  239. }
  240. });
  241. }
  242. $(function () {
  243. //加载表格数据
  244. window.LoadTable();
  245. //加载日历控件
  246. //laydate({
  247. // elem: '#PractiseTime',
  248. // format: "YYYY-MM-DD",
  249. // min: "1980-01-01",
  250. // event: "focus"
  251. //});
  252. });
  253. </script>
  254. </body>
  255. </html>