Departments.cshtml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. 
  2. @{
  3. Layout = null;
  4. }
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <meta name="viewport" content="width=device-width" />
  9. <title>Departments</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. @*<input class="btn btn-primary" id="btn_back" type="button" value="返回" onclick="btn_Back()"/>*@
  53. </div>
  54. <div class="col-sm-3" id="ResetTool">
  55. <a href="#" class="easyui-linkbutton" iconCls="icon-undo" plain="true" onclick="DelOrRetore('ReDel')">恢复删除</a>
  56. </div>
  57. </div>
  58. <table id="dgTable" class="easyui-datagrid" style="height: 100%;"
  59. data-options="singleSelect: true,
  60. method: 'post',
  61. multiSort: false,
  62. toolbar: '#tbToolBar',
  63. fitColumns: true,
  64. rownumbers: true,
  65. remoteSort: false,
  66. loadFilter: pagerFilter,
  67. pagination: true,
  68. pageSize: 15,
  69. pageList: [15, 25, 50, 100]
  70. ">
  71. <thead>
  72. <tr>
  73. @*hid_IsLock<th data-options="field:'TradeTypeID'" class="hidden">行业类型</th>*@
  74. <th data-options="field:'Names',width:80,">名称</th>
  75. </tr>
  76. </thead>
  77. </table>
  78. </section>
  79. <section>
  80. <div id="winModal" class="easyui-window winModal" title="部门名称维护" style="width: 600px; height: 250px;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="Names" name="Names" 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"><textarea id="Remark" name="Remark" style="width:400px;" rows="3"></textarea></td>
  94. </tr>
  95. <tr></tr>
  96. </table>
  97. </div>
  98. <div data-options="region:'south',border:false" style="text-align:right; padding: 12px 20px ;height:52px;">
  99. <a class="easyui-linkbutton" id="Save" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save()" style="width:80px">确认</a>
  100. <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winModal').window('close');" style="width:80px">取消</a>
  101. </div>
  102. </div>
  103. </div>
  104. </section>
  105. <script>
  106. //切换显示不同状态数据
  107. $("#DataToggle").on("click",
  108. function () {
  109. if ($('#hid_IsLock').val() === "0") {
  110. $('#hid_IsLock').val("1");
  111. $("#CurdTool").hide();
  112. $("#ResetTool").show();
  113. } else {
  114. $('#hid_IsLock').val("0");
  115. $("#ResetTool").hide();
  116. $("#CurdTool").show();
  117. }
  118. window.LoadTable();
  119. });
  120. //添加
  121. function btn_Add() {
  122. $("#hid_Type").val("Add");
  123. $("#Names").textbox("setValue", "");
  124. $("#Remark").val("");
  125. $('#winModal').window('open')
  126. }
  127. //修改
  128. function btn_Edit() {
  129. $("#hid_Type").val("Edit");
  130. var row = $('#dgTable').datagrid('getSelected');
  131. if (row) {
  132. $("#Names").textbox("setValue", row.Names);
  133. $("#Remark").val(row.Remark);
  134. $('#winModal').window('open')
  135. } else {
  136. layer.alert('请选择一条记录进行设置', { icon: '0', title: '提示信息' });
  137. }
  138. }
  139. function DelOrRetore(type) {
  140. var DepartmentID = $('#dgTable').datagrid('getSelections')[0].DepartmentID;
  141. if (!DepartmentID) {
  142. layer.alert('请选择一条记录进行设置', { icon: '0', title: '提示信息' });
  143. return;
  144. }
  145. if (type == 'Del' || type === "ReDel") {
  146. $.messager.confirm('删除或恢复', '确定删除或恢复这条记录?', function (r) {
  147. if (r) {
  148. $.ajax({
  149. url: "@Url.Action("DepartmentsListOper", "BaseInfo")",
  150. type: "post",
  151. data: {
  152. Type: type,
  153. DepartmentID: DepartmentID
  154. },
  155. success: function (data) {
  156. if (CheckAajxData(data) == false) {
  157. return;
  158. }
  159. var msg = JSON.parse(data);
  160. if (msg != null && msg.Success == true) {
  161. LoadTable();
  162. layer.alert("操作成功!", { icon:'1',title: '提示信息' });
  163. } else {
  164. layer.alert(msg.ErrorInfo, {icon:'2', title: '提示信息' });
  165. }
  166. }
  167. });
  168. }
  169. })
  170. }
  171. }
  172. //提交
  173. function Save(type) {
  174. type = type || $("#hid_Type").val();
  175. var DepartmentID = (type === "Edit" || type === "Del" || type === "ReDel") ? $('#dgTable').datagrid('getSelections')[0].DepartmentID : "";
  176. $.ajax({
  177. url: "@Url.Action("DepartmentsListOper", "BaseInfo")",
  178. type: "post",
  179. data: {
  180. Type: type,
  181. Remark: $("#Remark").val(),
  182. Names: $("#Names").val(),
  183. DepartmentID: DepartmentID
  184. },
  185. success: function (data) {
  186. if (CheckAajxData(data) == false) {
  187. return;
  188. }
  189. var msg = JSON.parse(data);
  190. if (msg != null && msg.Success == true) {
  191. LoadTable();
  192. $('#winModal').window('close')
  193. layer.alert("操作成功!", { icon: '1', title: '提示信息' });
  194. } else {
  195. layer.alert(msg.ErrorInfo, { icon: '2', title: '提示信息' });
  196. }
  197. }
  198. });
  199. }
  200. //modal赋值
  201. function SetModalVal() {
  202. var rows = $('#dgTable').datagrid('getSelections');
  203. if (rows.length === 1) {
  204. var row = rows[0];
  205. //console.log(row);
  206. $("#Remark").val(row.Remark),
  207. $("#Names").val(row.Names),
  208. $("#modal").modal("show");
  209. } else {
  210. layer.alert('请选择一条记录进行设置', { icon: 7, title: '提示信息' });
  211. }
  212. }
  213. //加载表格数据
  214. function LoadTable() {
  215. $('#dgTable').datagrid({
  216. url: '@Url.Action("GetDepartmentsList", "BaseInfo")' + '?IsLock=' + $('#hid_IsLock').val(),
  217. onDblClickRow: function () {
  218. if ($('#hid_IsLock').val() === "0") {
  219. btn_Edit();
  220. }
  221. }
  222. });
  223. }
  224. $(function () {
  225. //加载表格数据
  226. window.LoadTable();
  227. //加载日历控件
  228. //laydate({
  229. // elem: '#PractiseTime',
  230. // format: "YYYY-MM-DD",
  231. // min: "1980-01-01",
  232. // event: "focus"
  233. //});
  234. });
  235. </script>
  236. </body>
  237. </html>