LawRuleList.cshtml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. 
  2. @{
  3. Layout = null;
  4. }
  5. <!DOCTYPE html>
  6. <html>
  7. <head>
  8. <meta name="viewport" content="width=device-width" />
  9. <title>LawRuleList</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="~/Content/plugins/ajaxFileUpload/ajaxFileUpload-M.js"></script>
  22. <script src="~/js/Utils.js"></script>
  23. <link href="~/Content/css/Style/Markets.css" rel="stylesheet" />
  24. <link href="~/Content/kindeditor-master/themes/default/default.css" rel="stylesheet" />
  25. <script src="~/Content/kindeditor-master/kindeditor-all.js"></script>
  26. <script src="~/Content/kindeditor-master/kindeditor-all-min.js"></script>
  27. <script src="~/Content/kindeditor-master/lang/zh-CN.js"></script>
  28. <style>
  29. .td_1 {
  30. padding-bottom: 5px;
  31. padding-left: 5px;
  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_RuleType" name="hid_RuleType" type="hidden" value="@ViewBag.RuleType" />
  39. <input id="hid_IsAdd" name="hid_RuleType" type="hidden" value="@ViewBag.IsAdd" />
  40. <input id="hid_IsUpdate" name="hid_RuleType" type="hidden" value="@ViewBag.IsUpdate" />
  41. <input id="hid_IsDelete" name="hid_RuleType" type="hidden" value="@ViewBag.IsDelete" />
  42. </section>
  43. @*<section class="text-center title">
  44. <h2>市场信息</h2>
  45. </section>*@
  46. <section class="container-fluid" style="height: 95vh; padding-top: 5px;">
  47. <div class="row tbToolBar" id="tbToolBar">
  48. <div class="toolbar" id="CurdTool" style="float:left">
  49. <a href="#" class="easyui-linkbutton" id="btn_Add" iconCls="icon-add" plain="true" onclick="btn_Add()">添加</a>
  50. <a href="#" class="easyui-linkbutton" id="btn_Update" iconCls="icon-edit" plain="true" onclick="btn_Edit()">修改</a>
  51. <a href="#" class="easyui-linkbutton" id="btn_Delete" iconCls="icon-remove" plain="true" onclick="btn_Del()">删除</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. rownumbers: true,
  61. remoteSort: false,
  62. loadFilter: pagerFilter,
  63. pagination: true,
  64. pageSize: 25,
  65. pageList: [15, 25, 50, 100]
  66. ">
  67. <thead>
  68. <tr>
  69. @*hid_IsLock<th data-options="field:'TradeTypeID'" class="hidden">行业类型</th>*@
  70. <th data-options="field:'LawRuleName',width:80,align:'center'">标题</th>
  71. <th data-options="field:'promulgateDate',width:80,align:'center'">发布日期</th>
  72. <th data-options="field:'lawruleType',width:80,align:'center'">法规类型</th>
  73. </tr>
  74. </thead>
  75. </table>
  76. </section>
  77. <section>
  78. <div id="winModal" class="easyui-window winModal" title="法规文本维护" style="width: 650px; height:450px;padding:5px;"
  79. iconCls="icon-save" data-options="modal:true,closed:true">
  80. <div class="easyui-layout" data-options="fit:true" style="height:400px">
  81. <div data-options="region:'center'" style="padding:5px 5px 1px; height:385px">
  82. <table cellpadding="10" cellspacing="0" style="margin-left:10px">
  83. <tr>
  84. <td class="td_1">法规类型</td>
  85. <td class="td_1">
  86. <select class="easyui-combobox" id="LawRuleTypeId" name="LawRuleTypeId" style="width:400px;height:20px" >
  87. @Html.Raw(ViewBag.SelLawRuleType)
  88. </select>
  89. </td>
  90. </tr>
  91. <tr>
  92. <td class="td_1">名称</td>
  93. <td class="td_1">
  94. <input class="easyui-textbox" type="text" id="LawRuleName" name="LawRuleName" data-options="required:true" style="width:400px;height:20px" />
  95. </td>
  96. </tr>
  97. <tr>
  98. <td class="td_1">发布日期</td>
  99. <td class="td_1">
  100. <input class="laydate-icon" type="text" id="promulgateDate" name="promulgateDate" data-options="required:true" style="width:400px;height:20px" />
  101. </td>
  102. </tr>
  103. <tr>
  104. <td class="td_1">发 布 者</td>
  105. <td class="td_1">
  106. <input class="easyui-textbox" type="text" id="promulgator" name="promulgator" data-options="required:true" style="width:400px;height:20px" />
  107. </td>
  108. </tr>
  109. <tr>
  110. <td class="td_1">上传附件</td>
  111. <td class="td_1">
  112. <input class="easyui-filebox" id="UploadedFile" name="UploadedFile" data-options="prompt:'Choose a file...'" style="width:300px;height:20px" />
  113. </td>
  114. </tr>
  115. <tr>
  116. <td colspan="2">
  117. <label id="DownUrl"></label>
  118. </td>
  119. </tr>
  120. <tr style="color:cornflowerblue">
  121. <td align="center" colspan="2" style="background-color:lightgray" >
  122. <span><strong>内容</strong></span>
  123. </td>
  124. </tr>
  125. <tr>
  126. <td class="td_1" colspan="2">
  127. <textarea id="Content" name="Content" class="easyui-validatebox" data-options="required:true" style="width: 550px; height: 150px;" placeholder="请输入内容"></textarea>
  128. </td>
  129. </tr>
  130. <tr></tr>
  131. </table>
  132. </div>
  133. <div data-options="region:'south',border:false" style="text-align:right; padding: 12px 20px ;height:52px;">
  134. <a class="easyui-linkbutton" id="Save" data-options="iconCls:'icon-ok'" href="javascript:void(0)" onclick="Save()" style="width:80px">确认</a>
  135. <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" href="javascript:void(0)" onclick="$('#winModal').window('close');" style="width:80px">取消</a>
  136. </div>
  137. </div>
  138. </div>
  139. </section>
  140. <script>
  141. function btn_Add() {
  142. $("#hid_Type").val("Add");
  143. $("#promulgator").textbox("setValue", "");
  144. $("#LawRuleName").textbox("setValue", "")
  145. //ClearFile(getFileElement());
  146. $('#UploadedFile').filebox('setValue', '');
  147. $("#DownUrl").html("");
  148. KindEditor.html('#Content', "");
  149. $('#winModal').window('open');
  150. }
  151. //修改
  152. function btn_Edit() {
  153. $("#hid_Type").val("Edit");
  154. //ClearFile(getFileElement());
  155. $("#UploadedFile").filebox("setValue", "");
  156. var row = $('#dgTable').datagrid('getSelected');
  157. if (row) {
  158. $("#LawRuleTypeId").combobox("setValue", row.LawRuleTypeId);
  159. $("#LawRuleName").textbox("setValue", row.LawRuleName)
  160. $("#promulgateDate").val(row.promulgateDate);
  161. $("#promulgator").textbox("setValue",row.promulgator);
  162. $("#DownUrl").html(row.DownUrl);
  163. KindEditor.html('#Content', row.Content);
  164. $('#winModal').window('open');
  165. } else {
  166. layer.alert('请选择一条记录进行查看', {icon:0, title: '提示信息' });
  167. }
  168. }
  169. function Save(type) {
  170. type = type || $("#hid_Type").val();
  171. var LawRuleId = (type === "Edit") ? $('#dgTable').datagrid('getSelections')[0].LawRuleId:"";
  172. $.ajaxFileUpload({
  173. url: "@Url.Action("RowAndRuleListOper", "LawAndRule")",
  174. secureuri: false, //一般设置为false
  175. fileElementId: getfileelement(),//$("#UploadedFile").filebox('getValue'),
  176. type: "post",
  177. dataType: "json",
  178. data: {
  179. Type: type,
  180. UploadFile: "true",
  181. LawRuleId:LawRuleId,
  182. LawRuleTypeId: $("#LawRuleTypeId").combobox("getValue"),
  183. LawRuleName: $("#LawRuleName").textbox("getValue"),
  184. promulgateDate: $("#promulgateDate").val(),
  185. promulgator: $("#promulgator").textbox("getValue"),
  186. Content: $("#Content").val()
  187. },
  188. success: function (data) {
  189. if (CheckAajxData(data) === false) return;
  190. //$("#UploadedFile").filebox("setValue", "");
  191. $('#UploadedFile').filebox({
  192. buttonText: '选择文件...',
  193. buttonAlign: 'right'
  194. })
  195. var msg = data.ErrorInfo;
  196. if (data.Success === true) {
  197. LoadTable();
  198. $("#winModal").window("close");
  199. layer.alert(msg, { icon: 1, title: '提示信息' });
  200. } else {
  201. layer.alert(msg, { icon: 7, title: '提示信息' });
  202. }
  203. }
  204. });
  205. }
  206. function btn_Del() {
  207. $("#hid_Type").val("Del");
  208. var row = $('#dgTable').datagrid('getSelected');
  209. if (row) {
  210. layer.confirm('确认删除这条记录?', {
  211. btn: ['确认删除', '取消'] //按钮
  212. }, function () {
  213. if (row) {
  214. $.ajax({
  215. url: "/LawAndRule/RowAndRuleListOper?ran=" + Math.random(),
  216. type: "POST",
  217. dataType: "json",
  218. data: { LawRuleId: row.LawRuleId, Type: 'Del', },
  219. success: function (data) {
  220. if (CheckAajxData(data) == false) {
  221. return;
  222. }
  223. var msg = data.ErrorInfo;
  224. if (data != null && data.Success == true) {
  225. LoadTable();
  226. //$('#winSetSysStatusInfo').window('close');
  227. layer.alert("操作成功!", {icon: 1, title: '提示信息' });
  228. } else {
  229. layer.alert(msg, { icon: 2, title: '提示信息' });
  230. }
  231. }
  232. })
  233. }
  234. })
  235. } else {
  236. layer.alert('请选择一条记录进行查看', { icon: 0, title: '提示信息' });
  237. }
  238. }
  239. //加载表格数据
  240. function LoadTable() {
  241. $('#dgTable').datagrid({
  242. url: '@Url.Action("GetLawRuleList", "LawAndRule")',
  243. onDblClickRow: function () {
  244. btn_Edit();
  245. }
  246. });
  247. }
  248. var editor;
  249. $(function () {
  250. //加载表格数据
  251. window.LoadTable();
  252. editor = KindEditor.create('textarea[name="Content"]', {
  253. resizeType: 1, width: "100%", height: "500px", afterChange: function () {
  254. this.sync();
  255. }, afterBlur: function () {
  256. this.sync();
  257. }, allowUpload: true, uploadJson: '/SystemModule/UploadImage'
  258. });
  259. laydate({
  260. elem: '#promulgateDate',
  261. format: "YYYY-MM-DD",
  262. min: "2000-01-01",
  263. event: "focus"
  264. });
  265. $('#UploadedFile').filebox({
  266. buttonText: '选择文件...',
  267. buttonAlign: 'right'
  268. })
  269. if ($('#hid_IsAdd').val() == "N") {
  270. $("#btn_Add").hide();
  271. }
  272. if ($('#hid_IsUpdate').val() == "N") {
  273. $("#btn_Update").hide();
  274. }
  275. if ($('#hid_IsDelete').val() == "N") {
  276. $("#btn_Delete").hide();
  277. }
  278. });
  279. //function ClearFile(idStr) {
  280. // var file = $(idStr);
  281. // file.after(file.clone().val(""));
  282. // file.remove();
  283. //}
  284. function getfileelement(uploadedfile) {
  285. uploadedfile = uploadedfile || "UploadedFile";
  286. return $('#' + uploadedfile).next().find("input[type='file']").attr("id")
  287. }
  288. </script>
  289. </body>
  290. </html>