add.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. {extend name="common/base" /}
  2. <!-- 主体 -->
  3. {block name="body"}
  4. <form class="layui-form p-4">
  5. <h3 class="pb-3">功能菜单/节点</h3>
  6. {if condition="$id eq 0"}
  7. <table class="layui-table layui-table-form">
  8. <tr>
  9. <td class="layui-td-gray-2">父级菜单/节点<font>*</font>
  10. </td>
  11. <td>
  12. <select name="pid" lay-verify="required" lay-reqText="请选择父级菜单/节点">
  13. <option value="0">作为顶级菜单/节点</option>
  14. {volist name=":set_recursion(get_admin_rule())" id="v"}
  15. <option value="{$v.id}" {eq name="pid" value="$v.id" }selected="" {/eq}>{$v.title} </option>
  16. {/volist}
  17. </select>
  18. </td>
  19. <td class="layui-td-gray-2">左侧菜单显示<font>*</font>
  20. </td>
  21. <td>
  22. <input type="radio" name="menu" value="1" title="是">
  23. <input type="radio" name="menu" value="2" title="不是">
  24. </td>
  25. </tr>
  26. <tr>
  27. <td class="layui-td-gray">菜单/节点名称<font>*</font>
  28. </td>
  29. <td>
  30. <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入菜单/节点名称"
  31. lay-reqText="请输入菜单/节点名称" class="layui-input">
  32. </td>
  33. <td class="layui-td-gray">操作日志名称<font>*</font>
  34. </td>
  35. <td>
  36. <input type="text" name="name" lay-verify="required" placeholder="请输入操作日志名称" lay-reqText="请输入操作日志名称"
  37. autocomplete="off" class="layui-input">
  38. </td>
  39. </tr>
  40. <tr>
  41. <td class="layui-td-gray">菜单/节点URL</td>
  42. <td>
  43. <input type="text" name="src" placeholder="请输入菜单/节点URL,可空" autocomplete="off" class="layui-input">
  44. </td>
  45. <td class="layui-td-gray">菜单排序</td>
  46. <td>
  47. <input type="text" name="sort" value="0" placeholder="请输入数字,越小越靠前" autocomplete="off"
  48. class="layui-input">
  49. </td>
  50. </tr>
  51. <tr>
  52. <td class="layui-td-gray">菜单图标</td>
  53. <td colspan="3">
  54. <input type="text" name="icon" style="width:150px; display:inline" placeholder="请输入图标,可空"
  55. autocomplete="off" class="layui-input">
  56. 如:bi-gear<a href="{__GOUGU__}/icons/remixicon.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
  57. </td>
  58. </tr>
  59. </table>
  60. {else/}
  61. <table class="layui-table layui-table-form">
  62. <tr>
  63. <td class="layui-td-gray-2">父级菜单/节点<font>*</font>
  64. </td>
  65. <td>
  66. <select name="pid" lay-verify="required" lay-reqText="请选择父级菜单/节点">
  67. <option value="0">作为顶级节点</option>
  68. {volist name=":set_recursion(get_admin_rule())" id="v"}
  69. <option value="{$v.id}" {eq name="$detail.pid" value="$v.id" }selected="" {/eq}>{$v.title} </option>
  70. {/volist}
  71. </select>
  72. </td>
  73. <td class="layui-td-gray-2">左侧菜单显示<font>*</font>
  74. </td>
  75. <td>
  76. <input type="radio" name="menu" value="1" title="是" {eq name="$detail.menu" value="1" } checked{/eq}>
  77. <input type="radio" name="menu" value="2" title="不是" {eq name="$detail.menu" value="2" } checked{/eq}>
  78. </td>
  79. </tr>
  80. <tr>
  81. <td class="layui-td-gray">菜单/节点名称<font>*</font>
  82. </td>
  83. <td>
  84. <input type="text" name="title" value="{$detail.title}" lay-verify="required" autocomplete="off"
  85. placeholder="请输入菜单/节点名称" lay-reqText="请输入菜单/节点名称" class="layui-input">
  86. </td>
  87. <td class="layui-td-gray">操作日志名称<font>*</font>
  88. </td>
  89. <td>
  90. <input type="text" name="name" value="{$detail.name}" lay-verify="required" placeholder="请输入操作日志名称"
  91. lay-reqText="请输入操作日志名称" autocomplete="off" class="layui-input">
  92. </td>
  93. </tr>
  94. <tr>
  95. <td class="layui-td-gray">菜单/节点URL</td>
  96. <td>
  97. <input type="text" name="src" value="{$detail.src}" placeholder="请输入菜单/节点URL,可空" autocomplete="off"
  98. class="layui-input">
  99. </td>
  100. <td class="layui-td-gray">菜单排序</td>
  101. <td>
  102. <input type="text" name="sort" value="{$detail.sort}" placeholder="请输入数字,越小越靠前" autocomplete="off"
  103. class="layui-input">
  104. </td>
  105. </tr>
  106. <tr>
  107. <td class="layui-td-gray">菜单图标</td>
  108. <td colspan="3">
  109. <input style="width:200px; display:inline" type="text" name="icon" value="{$detail.icon}" placeholder="请输入图标,可空" autocomplete="off" class="layui-input">
  110. <i class="{$detail.icon}" style="font-size:20px; vertical-align:minddle"></i><a href="{__GOUGU__}/icons/remixicon.html" target="_blank" style="margin-left:10px; color:#007AFF">[查看图标]</a>
  111. </td>
  112. </tr>
  113. </table>
  114. {/if}
  115. <div style="padding: 10px 0">
  116. <input type="hidden" name="id" value="{$id}">
  117. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  118. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  119. </div>
  120. </form>
  121. {/block}
  122. <!-- 主体 -->
  123. <!-- 脚本 -->
  124. {block name="script"}
  125. <script>
  126. const moduleInit = ['tool'];
  127. function gouguInit() {
  128. var form = layui.form,tool=layui.tool;
  129. //监听提交
  130. form.on('submit(webform)', function (data) {
  131. if (!data.field.menu || data.field.menu == '') {
  132. layer.msg('请选择是否在左侧菜单显示');
  133. return false;
  134. }
  135. let callback = function (e) {
  136. layer.msg(e.msg);
  137. if (e.code == 0) {
  138. setTimeout(function () {
  139. parent.location.reload();
  140. }, 1000);
  141. }
  142. }
  143. tool.post("/admin/rule/add", data.field, callback);
  144. return false;
  145. });
  146. }
  147. </script>
  148. {/block}
  149. <!-- /脚本 -->