add.html 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. {extend name="common/base"/}
  2. <!-- 主体 -->
  3. {block name="body"}
  4. <form class="layui-form p-4">
  5. <h3 class="pb-3">导航组</h3>
  6. <table class="layui-table layui-table-form">
  7. <tr>
  8. <td class="layui-td-gray">标题<font>*</font></td>
  9. <td>
  10. <input type="hidden" name="id" value="{$id}" />
  11. <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入标题" lay-reqText="请输入标题" class="layui-input" {notempty name="$nav.title" }value="{$nav.title}" {/notempty}>
  12. </td>
  13. <td class="layui-td-gray">标识<font>*</font></td>
  14. <td>
  15. <input type="text" name="name" lay-verify="required" autocomplete="off" placeholder="请输入标识" lay-reqText="请输入标识" class="layui-input" {notempty name="$nav.name" }value="{$nav.name}" {/notempty}>
  16. </td>
  17. </tr>
  18. <tr>
  19. <td class="layui-td-gray">状态<font>*</font></td>
  20. <td colspan="3">
  21. {if condition="$id eq 0"}
  22. <input type="radio" name="status" value="1" title="正常" checked>
  23. <input type="radio" name="status" value="-1" title="禁用">
  24. {else/}
  25. <input type="radio" name="status" value="1" title="正常" {eq name="$nav.status" value="1" }checked{/eq}>
  26. <input type="radio" name="status" value="-1" title="禁用" {eq name="$nav.status" value="-1" }checked{/eq}>
  27. {/if}
  28. </td>
  29. </tr>
  30. <tr>
  31. <td class="layui-td-gray">备注</td>
  32. <td colspan="3"><textarea name="desc" placeholder="请输入备注" class="layui-textarea">{notempty name="$nav.desc" }{$nav.desc}{/notempty}</textarea></td>
  33. </tr>
  34. </table>
  35. <div class="py-3">
  36. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  37. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  38. </div>
  39. </form>
  40. {/block}
  41. <!-- /主体 -->
  42. <!-- 脚本 -->
  43. {block name="script"}
  44. <script>
  45. const moduleInit = ['tool'];
  46. function gouguInit() {
  47. var form = layui.form,tool=layui.tool;
  48. //监听提交
  49. form.on('submit(webform)', function (data) {
  50. let callback = function (e) {
  51. layer.msg(e.msg);
  52. if (e.code == 0) {
  53. parent.layui.tool.close(1000);
  54. }
  55. }
  56. tool.post("/admin/nav/add", data.field, callback);
  57. return false;
  58. });
  59. }
  60. </script>
  61. {/block}
  62. <!-- /脚本 -->