b290937c382e2663fa03155a815a0437.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <?php /*a:2:{s:56:"D:\phpstudy_pro\WWW\caiping\app\admin\view\role\add.html";i:1723541257;s:59:"D:\phpstudy_pro\WWW\caiping\app\admin\view\common\base.html";i:1723541257;}*/ ?>
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="360-site-verification" content="a7c876fae8b6e3175a52ea9f19543f51" />
  9. <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0">
  10. <script src="/static/dist/xm-select.js"></script>
  11. <link rel="mobile-prefetch" href=""/>
  12. <title><?php echo get_system_config('web','admin_title'); ?></title>
  13. <meta name="keywords" content="<?php echo get_system_config('web','keywords'); ?>"/>
  14. <meta name="description" content="<?php echo get_system_config('web','desc'); ?>"/>
  15. <link rel="stylesheet" href="/static/assets/gougu/css/gougu.css?v=<?php echo get_system_config('web','version'); ?>" media="all">
  16. <style>
  17. .footer{
  18. display: none;
  19. }
  20. .left-note{vertical-align:top; padding-top:20px!important; text-align:center}
  21. .checkbox14 .layui-form-checkbox span{font-size:15px;font-weight:800;}
  22. .right-note .layui-checkbox-disabled span {color: #666666!important;}
  23. </style>
  24. </head>
  25. <body class="main-body">
  26. <!-- 主体 -->
  27. <form class="layui-form p-4">
  28. <h3 class="pb-3">权限角色</h3>
  29. <table class="layui-table layui-table-form">
  30. <tr>
  31. <td class="layui-td-gray">角色名称<font>*</font>
  32. </td>
  33. <td>
  34. <input type="hidden" name="id" value="<?php echo htmlentities($id); ?>" />
  35. <input class="layui-input" type="text" name="title" lay-verify="required" lay-reqText="请输入角色名称" <?php if(!(empty($role['title']) || (($role['title'] instanceof \think\Collection || $role['title'] instanceof \think\Paginator ) && $role['title']->isEmpty()))): ?>value="<?php echo htmlentities($role['title']); ?>" <?php endif; ?> placeholder="请输入角色名称" autocomplete="off" />
  36. </td>
  37. <td class="layui-td-gray">状态<font>*</font>
  38. </td>
  39. <td>
  40. <?php if($id == 0): ?>
  41. <input type="radio" name="status" value="1" title="正常" checked>
  42. <input type="radio" name="status" value="-1" title="禁用">
  43. <?php else: ?>
  44. <input type="radio" name="status" value="1" title="正常" <?php if($role['status'] == '1'): ?>checked<?php endif; ?>>
  45. <input type="radio" name="status" value="-1" title="禁用" <?php if($role['status'] == '-1'): ?>checked<?php endif; ?>>
  46. <?php endif; ?>
  47. </td>
  48. </tr>
  49. <?php if($permission == 1): ?>
  50. <tr>
  51. <td class="layui-td-gray">权限组类型<font>*</font></td>
  52. <?php if($id == 0): ?>
  53. <td>
  54. <select name="unit_name" lay-verify="required" lay-reqText="请选择权限组单位">
  55. <option value="">请选择权限组单位</option>
  56. <?php if(is_array($department) || $department instanceof \think\Collection || $department instanceof \think\Paginator): $i = 0; $__LIST__ = $department;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
  57. <option value="<?php echo htmlentities($v['id']); ?>"><?php echo htmlentities($v['title']); ?></option>
  58. <?php endforeach; endif; else: echo "" ;endif; ?>
  59. </select>
  60. </td>
  61. <?php else: ?>
  62. <td>
  63. <select name="unit_name" lay-verify="required" lay-reqText="请选择权限组单位">
  64. <option value="">请选择权限组单位</option>
  65. <?php if($role['unit_name'] >= 1): if(is_array($department) || $department instanceof \think\Collection || $department instanceof \think\Paginator): $i = 0; $__LIST__ = $department;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
  66. <option value="<?php echo htmlentities($v['id']); ?>" <?php if($v['id'] == $role['unit_name']): ?>selected<?php endif; ?>><?php echo htmlentities($v['title']); ?></option>
  67. <?php endforeach; endif; else: echo "" ;endif; else: if(is_array($department) || $department instanceof \think\Collection || $department instanceof \think\Paginator): $i = 0; $__LIST__ = $department;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
  68. <option value="<?php echo htmlentities($v['id']); ?>"><?php echo htmlentities($v['title']); ?></option>
  69. <?php endforeach; endif; else: echo "" ;endif; ?>
  70. <?php endif; ?>
  71. </select>
  72. </td>
  73. <?php endif; ?>
  74. </tr>
  75. <?php endif; ?>
  76. <tr>
  77. <td class="layui-td-gray-2">权限配置说明<font>*</font></td>
  78. <td colspan="3"><strong class="red">注意:如果右侧子级权限有节点被勾选了,左侧的顶级权限就必须勾选,否则无法查看右侧的子级菜单。</strong></td>
  79. </tr>
  80. <tr>
  81. <td colspan="4">
  82. <table style="width:100%" id="rule">
  83. <tr>
  84. <td style="text-align:center; background-color:#f8f8f8; width:160px;">选择可操作的顶级权限 <font style="color:red">↓</font></td>
  85. <td style="text-align:left; background-color:#f8f8f8;">选择可操作的子级权限 <font style="color:red">↓</font></td>
  86. </tr>
  87. <?php if(is_array($role_rule) || $role_rule instanceof \think\Collection || $role_rule instanceof \think\Paginator): $i = 0; $__LIST__ = $role_rule;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
  88. <tr>
  89. <td class="left-note">
  90. <input type="checkbox" name="rule[]" value="<?php echo htmlentities($vo['id']); ?>" title="<?php echo htmlentities($vo['title']); ?>" class="aaa" <?php if($vo['checked'] == 'true'): ?>checked<?php endif; ?>>
  91. </td>
  92. <?php if(!(empty($vo['children']) || (($vo['children'] instanceof \think\Collection || $vo['children'] instanceof \think\Paginator ) && $vo['children']->isEmpty()))): ?>
  93. <td class="right-note">
  94. <div style="padding:0 0 0 10px;">
  95. <?php if(is_array($vo['children']) || $vo['children'] instanceof \think\Collection || $vo['children'] instanceof \think\Paginator): $k = 0; $__LIST__ = $vo['children'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$voo): $mod = ($k % 2 );++$k;?>
  96. <div class="checkbox15" style="padding:10px 0;">
  97. <input type="checkbox" lay-filter="rule" name="rule[]" value="<?php echo htmlentities($voo['id']); ?>" lay-skin="primary" title="<?php echo htmlentities($voo['title']); ?>" <?php if($voo['checked'] == 'true'): ?>checked<?php endif; ?>>
  98. <?php if($voo['title'] == "造价项目"): if($voo['src'] == "admin/project.cost_company/datalist"): ?>
  99. <!-- <input id="company_field" type="button" class="layui-btn layui-btn-xs" lay-filter="rule" name="field_id" value="<?php echo htmlentities($field_id); ?>" lay-skin="primary" title="属性设置"> -->
  100. <button id="company_field" type="button" class="layui-btn layui-btn-xs">属性设置</button>
  101. <input id="company_field_id" hidden type="text" name="field_id" value="<?php echo htmlentities($field_id); ?>">
  102. <?php endif; if($voo['src'] == "admin/project.cost/datalist"): ?>
  103. <!-- <input id="finance_field" type="button" class="layui-btn layui-btn-xs" lay-filter="rule" name="field_id" value="<?php echo htmlentities($field_id); ?>" lay-skin="primary" title="属性设置"> -->
  104. <button id="finance_field" type="button" class="layui-btn layui-btn-xs">属性设置</button>
  105. <input id="finance_field_id" hidden type="text" name="field_id" value="<?php echo htmlentities($field_id); ?>">
  106. <?php endif; if($voo['src'] == "admin/project.costproprietor/datalist"): ?>
  107. <!-- <input id="proprietor_field" type="button" class="layui-btn layui-btn-xs" lay-filter="rule" name="field_id" value="<?php echo htmlentities($field_id); ?>" lay-skin="primary" title="属性设置"> -->
  108. <button id="proprietor_field" type="button" class="layui-btn layui-btn-xs">属性设置</button>
  109. <input id="proprietor_field_id" hidden type="text" name="field_id" value="<?php echo htmlentities($field_id); ?>">
  110. <?php endif; ?>
  111. <?php endif; ?>
  112. </div>
  113. <?php if(!(empty($voo['children']) || (($voo['children'] instanceof \think\Collection || $voo['children'] instanceof \think\Paginator ) && $voo['children']->isEmpty()))): ?>
  114. <div style="padding:0 0 3px; <?php if($k != count($vo['children'])): ?>margin-bottom:3px; padding-bottom:16px; border-bottom:1px solid #eee;<?php endif; ?>">
  115. <?php if(is_array($voo['children']) || $voo['children'] instanceof \think\Collection || $voo['children'] instanceof \think\Paginator): $i = 0; $__LIST__ = $voo['children'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vooo): $mod = ($i % 2 );++$i;?>
  116. <div class="layui-input-inline" style="margin-right:10px;">
  117. <input type="checkbox" data-rule="<?php echo htmlentities($voo['id']); ?>" name="rule[]" value="<?php echo htmlentities($vooo['id']); ?>" lay-skin="primary" title="<?php echo htmlentities($vooo['title']); ?>" <?php if($vooo['checked'] == 'true'): ?>checked<?php endif; ?>>
  118. </div>
  119. <?php if(!(empty($vooo['children']) || (($vooo['children'] instanceof \think\Collection || $vooo['children'] instanceof \think\Paginator ) && $vooo['children']->isEmpty()))): ?>
  120. <div style="padding:0 0 3px; <?php if($k != count($vo['children'])): ?>margin-bottom:3px; padding-bottom:16px; border-bottom:1px solid #eee;<?php endif; ?>">
  121. <?php if(is_array($vooo['children']) || $vooo['children'] instanceof \think\Collection || $vooo['children'] instanceof \think\Paginator): $i = 0; $__LIST__ = $vooo['children'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$voooo): $mod = ($i % 2 );++$i;?>
  122. <div class="layui-input-inline" style="margin-right:10px;">
  123. <input type="checkbox" data-rule="<?php echo htmlentities($vooo['id']); ?>" name="rule[]" value="<?php echo htmlentities($voooo['id']); ?>" lay-skin="primary" title="<?php echo htmlentities($voooo['title']); ?>" <?php if($voooo['checked'] == 'true'): ?>checked<?php endif; ?>>
  124. </div>
  125. <?php endforeach; endif; else: echo "" ;endif; ?>
  126. </div>
  127. <?php endif; ?>
  128. <?php endforeach; endif; else: echo "" ;endif; ?>
  129. </div>
  130. <?php endif; ?>
  131. <?php endforeach; endif; else: echo "" ;endif; ?>
  132. </div>
  133. </td>
  134. <?php endif; ?>
  135. </tr>
  136. <?php endforeach; endif; else: echo "" ;endif; ?>
  137. </table>
  138. </td>
  139. </tr>
  140. <tr>
  141. <td class="layui-td-gray" style="vertical-align: top;">备注内容</td>
  142. <td colspan="3">
  143. <textarea name="desc" placeholder="请输入备注" class="layui-textarea"><?php if(!(empty($role['desc']) || (($role['desc'] instanceof \think\Collection || $role['desc'] instanceof \think\Paginator ) && $role['desc']->isEmpty()))): ?><?php echo htmlentities($role['desc']); ?><?php endif; ?></textarea>
  144. </td>
  145. </tr>
  146. </table>
  147. <div style="padding: 10px 0">
  148. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  149. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  150. </div>
  151. </form>
  152. <!-- /主体 -->
  153. <!-- 底部 -->
  154. <div class="footer">
  155. 逸管工程项目管理系统 © www.yiguanfep.com
  156. <img src="/static/home/images/police.png" alt="" style="width:14.5px;height:16px;">
  157. <a href="https://beian.mps.gov.cn/#/query/websearch?code=45030202000160 " rel="\&quot;noreferrer'target=\”blank\&quot;" onclick="window.open(this.href); return false;">桂公网安备45030202000160号</a>
  158. <a href="https://beian.miit.gov.cn/#/Integrated/index" onclick="window.open(this.href); return false;">桂ICP备17000971号</a>
  159. </div>
  160. <!-- /底部 -->
  161. <!-- 脚本 -->
  162. <script>
  163. const moduleInit = ['tool'];
  164. function gouguInit() {
  165. var form = layui.form,tool=layui.tool, tree = layui.tree;
  166. parent.layui.field_id = 0;
  167. //监听提交
  168. form.on('submit(webform)', function (obj) {
  169. //字段的id
  170. console.log(parent.layui.field_id)
  171. console.log(1);
  172. obj.field.field_id = parent.layui.field_id
  173. $.ajax({
  174. url: "/admin/role/add",
  175. data: obj.field,
  176. type: 'post',
  177. success: function (e) {
  178. layer.msg(e.msg);
  179. if (e.code == 0) {
  180. parent.layui.tool.close(1000);
  181. }
  182. }
  183. });
  184. return false;
  185. });
  186. // $("#l1").click(parent.layui.tool.side("../field.field/add",callback));
  187. // 跳转公司
  188. $("#company_field").click(function(e){
  189. var field_id = $('[name="field_id"]').val();
  190. parent.layui.tool.side("../field.fieldcompany/add?id=" + field_id);
  191. });
  192. // 跳转财政局
  193. $("#finance_field").click(function(e){
  194. var field_id = $('[name="field_id"]').val();
  195. parent.layui.tool.side("../field.field/add?id=" + field_id);
  196. });
  197. // 跳转业主
  198. $("#proprietor_field").click(function(e){
  199. var field_id = $('[name="field_id"]').val();
  200. parent.layui.tool.side("../field.fieldproprietor/add?id=" + field_id);
  201. });
  202. //监听多选框点击事件 通过 lay-filter="menu"来监听
  203. form.on('checkbox(menu)', function (data) {
  204.   let val = data.value;
  205. if(data.elem.checked){
  206. //判断当前多选框是选中还是取消选中
  207. $("input[data-menu='"+val+"']").prop("checked", true);//true:选中 false:不选中
  208. }
  209. else{
  210. $("input[data-menu='"+val+"']").prop("checked", false);
  211. }
  212. form.render();//实时渲染选中和不选中的样式
  213. });
  214. $('[lay-filter="rule"]').click(function (){
  215. console.log(1);
  216. })
  217. //监听多选框点击事件 通过 lay-filter="rule"来监听
  218. form.on('checkbox(rule)', function (data) {
  219. let val = data.value;
  220. if(data.elem.checked){
  221. //判断当前多选框是选中还是取消选中
  222. $("input[data-rule='"+val+"']").prop("checked", true);//true:选中 false:不选中
  223. }
  224. else{
  225. $("input[data-rule='"+val+"']").prop("checked", false);
  226. }
  227. form.render();//实时渲染选中和不选中的样式
  228. });
  229. // $("#l1").click(console.log("role_rule"));
  230. }
  231. </script>
  232. <!-- /脚本 -->
  233. <!-- <script src="/static/assets/layui/layui.js"></script> -->
  234. <script src="/static/assets/layui/layui.js"></script>
  235. <script src="/static/assets/third_party/echart/echarts.min.js"></script>
  236. <script src="/static/assets/gougu/gouguInit.js"></script>
  237. <script src="https://unpkg.com/pinyin-pro"></script>
  238. <script>
  239. var { pinyin } = pinyinPro;
  240. </script>
  241. <!-- 统计代码 -->
  242. <!-- /统计代码 -->
  243. </body>
  244. </html>