main.html 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <style type="text/css">
  2. .alert_level_error{
  3. color:red;
  4. }
  5. .alert_level_waring{
  6. color:#b5b51f;
  7. }
  8. .alert_level_hint{
  9. color:#558655;
  10. }
  11. </style>
  12. <script type="text/javascript" src="/static/js/layui_crud.js"></script>
  13. <div class="children-content" id="rule_check_cnf">
  14. <blockquote class="layui-elem-quote" style="padding:1rem;line-height:2.5rem;">
  15. 校验规则配置 / SCD校验规则
  16. </blockquote>
  17. <div style="position:relative;width:100%;">
  18. <script type="text/html" id="table_tools_bar_syntax">
  19. <div class="layui-btn-container">
  20. <button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="add">添加新规则</button>
  21. </div>
  22. </script>
  23. <div id="table_search_panel_syntax" class="layui-panel" style="height:5.4rem;line-height:5.4rem;">
  24. <form id="frm_syntax" class="layui-form layui-form-pane" action="">
  25. <span style="float:left;margin:0 0.5rem 0 2rem;">启用状态:</span>
  26. <div class="layui-input-block" style="float:left;margin:1rem 1rem 0 1rem;width:15rem;">
  27. <select id="enable">
  28. <option value="">全部</option>
  29. <option value="1">启用</option>
  30. <option value="0">禁用</option>
  31. </select>
  32. </div>
  33. <span style="float:left;margin:0 0.5rem 0 2rem;">校验类型:</span>
  34. <div class="layui-input-block" style="float:left;margin:1rem 1rem 0 1rem;width:15rem;">
  35. <select id="check_type"></select>
  36. </div>
  37. <span style="float:left;margin:0 0.5rem 0 2rem;">校验对象名称:</span>
  38. <div class="layui-input-block" style="float:left;float:left;margin:1rem 1rem 0 1rem;width:15rem;">
  39. <input type="text" id="object_name" autocomplete="off" class="layui-input">
  40. </div>
  41. <span style="float:left;margin:0 0.5rem 0 2rem;">校验等级:</span>
  42. <div class="layui-input-block" style="float:left;margin:1rem 1rem 0 1rem;width:15rem;">
  43. <select id="alert_level">
  44. <option value="">全部</option>
  45. <option value="error">错误</option>
  46. <option value="waring">警告</option>
  47. <option value="hint">提醒</option>
  48. </select>
  49. </div>
  50. <button id="btnSearch" type="button" class="layui-btn layui-btn-normal" style="margin-left:4rem;height:3.2rem;line-height:3.2rem;" onclick="ruleCrud_syntax.Query();">查询</button>
  51. <button id="btnSearch" type="button" class="layui-btn layui-btn-normal" style="margin-left:4rem;height:3.2rem;line-height:3.2rem;background-color: #b39393;" onclick="ruleCrud_syntax.Reset();">重置</button>
  52. </form>
  53. </div>
  54. </div>
  55. <table id="table_datalist_control_syntax" lay-filter="table_row_operator_syntax">
  56. </table>
  57. </div>
  58. <!--语法规则-->
  59. <script type="text/html" id="table_row_operator_syntax">
  60. <i class="layui-icon layui-icon-edit" style="cursor:pointer;" lay-event="edit"></i>
  61. <i class="layui-icon layui-icon-delete" style="margin-left:10px;cursor:pointer;" lay-event="delete"></i>
  62. </script>
  63. <!--逻辑规则-->
  64. <script type="text/html" id="table_row_operator_logic">
  65. <i class="layui-icon layui-icon-edit" style="cursor:pointer;" lay-event="edit"></i>
  66. <i class="layui-icon layui-icon-delete" style="margin-left:10px;cursor:pointer;" lay-event="delete"></i>
  67. </script>
  68. <script type="text/javascript">
  69. //规则类型码定义
  70. var check_type_list=[];
  71. //来源标准码定义
  72. var apply_standard_list=[];
  73. $.getJSON(Global.AccessUrl+"/api/getGlobalCode",{"pcode": "checkrule_type"},function(r){
  74. if(r.code!=0){
  75. layer.msg("获取校验类型失败!",{icon:Global.ICON_ERROR});
  76. return;
  77. }
  78. check_type_list=r.data;
  79. var opts=template('select_option_tpl',{"data":[{"id":"","name":"全部"}].concat(r.data)});
  80. $("#check_type").html(opts);
  81. layui.form.render("select");
  82. });
  83. /*
  84. $.getJSON(Global.AccessUrl+"/api/getGlobalCode",{"pcode": "checkrule_apply_stan"},function(r){
  85. if(r.code!=0){
  86. layer.msg("获取校验规则来源标准定义失败!",{icon:Global.ICON_ERROR});
  87. return;
  88. }
  89. apply_standard_list=r.data;
  90. });
  91. */
  92. var alert_level_map={"error":"错误","waring":"警告","hint":"提醒"};
  93. //语法规则管理对象
  94. var ruleCrud_syntax=new CurdObj();
  95. ruleCrud_syntax.Init({
  96. "module_name":"rule_check_cnf",
  97. "list_table_id":"table_ruleCrud_syntax",
  98. "window_size": ['70rem', '65rem'],
  99. "window_title": ['语义规则', ''],
  100. "nameColKey":"object_name",
  101. "height": ($(".main-body").height()-$("#table_datalist_control_syntax").offset().top ),
  102. //默认的数据table ID
  103. "table_datalist_control": "table_datalist_control_syntax",
  104. //默认的数据table工具栏ID
  105. "table_tools_bar": "table_tools_bar_syntax",
  106. //默认的数据table查询条件元素ID
  107. "table_search_panel": "table_search_panel_syntax",
  108. //默认的数据table操作模板ID
  109. "table_row_operator": "table_row_operator_syntax",
  110. "apiUrl": {
  111. "save_url": "/api/scd/rule/save?rule_type=syntax",
  112. "read_url": "/api/scd/rule/list?rule_type=syntax",
  113. "delete_url": "/api/scd/rule/remove?rule_type=syntax",
  114. "list_url": "/api/scd/rule/list?rule_type=syntax"
  115. },
  116. "data":{"ruleType":"syntax"},
  117. "columns":[
  118. [
  119. {
  120. field: 'check_type_name',
  121. title: "校验类型",
  122. width: 160,
  123. fixed:"left"
  124. },{
  125. field: 'check_name',
  126. title: "规则名称",
  127. width: 160,
  128. fixed:"left",
  129. templet:function(data){
  130. return "<span title='"+(data.check_name||'')+"'>"+(data.check_name||'未定义')+"</span>";
  131. }
  132. },{
  133. field: 'object_name',
  134. title: "校验对象名称",
  135. width: 200
  136. }, {
  137. field: 'enable',
  138. title: "启用状态",
  139. width: 90,
  140. templet:function(data){
  141. return data.enable==1?"启用中":"<b style='color:red'>已禁用</b>";
  142. }
  143. }, {
  144. field: 'alert_level',
  145. title: "校验等级",
  146. width: 90,
  147. templet:function(data){
  148. return "<span class='alert_level_"+data.alert_level+"'>"+alert_level_map[data.alert_level]+"</span>";
  149. }
  150. }, {
  151. field: 'func_name',
  152. title: "应用标准及条款",
  153. width: 180,
  154. templet:function(data){
  155. return data.apply_standard+"&nbsp;&nbsp;&nbsp;&nbsp;"+data.apply_standard_no;
  156. }
  157. },{
  158. field: 'check_desc',
  159. title: "规则说明",
  160. width: 460
  161. }, {
  162. fixed: 'right',
  163. title: "操作",
  164. width: 120,
  165. align: 'center',
  166. toolbar: '#table_row_operator_syntax'
  167. }
  168. ]
  169. ]
  170. });
  171. $(document).ready(function () {
  172. layui.form.render("select");
  173. $('#text_startdate,#text_enddate').val(Global.GetCurrentDate());
  174. layui.use(['form', 'layedit', 'laydate'], function () {
  175. var laydate = layui.laydate;
  176. laydate.render({
  177. elem: '#text_startdate,#text_enddate'
  178. });
  179. });
  180. ruleCrud_syntax.GetList({});
  181. });
  182. </script>