add.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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>
  9. </td>
  10. <td>
  11. <input type="hidden" name="id" value="{$id}" />
  12. <input type="text" name="title" lay-verify="required" autocomplete="off" placeholder="请输入配置名称"
  13. lay-reqText="请输入配置名称" class="layui-input" {notempty name="$config.title" } value="{$config.title}"
  14. {/notempty}>
  15. </td>
  16. <td class="layui-td-gray">状态<font>*</font>
  17. </td>
  18. <td>{if condition="$id eq 0"}
  19. <input type="radio" name="status" value="1" title="正常" checked>
  20. <input type="radio" name="status" value="0" title="禁用">
  21. {else/}
  22. <input type="radio" name="status" value="1" title="正常" {eq name="$config.status" value="1"
  23. }checked{/eq}>
  24. <input type="radio" name="status" value="0" title="禁用" {eq name="$config.status" value="0"
  25. }checked{/eq}>
  26. {/if}
  27. </td>
  28. </tr>
  29. <tr>
  30. <td class="layui-td-gray">
  31. 配置标识<font>*</font>
  32. </td>
  33. <td colspan="3">
  34. <input type="text" name="name" lay-verify="required" placeholder="请输入配置标识" lay-reqText="请输入配置标识"
  35. autocomplete="off" class="layui-input" {notempty name="$config.name" } value="{$config.name}"
  36. {/notempty}>
  37. </td>
  38. </tr>
  39. <tr>
  40. <td colspan="4">
  41. <span
  42. style="color: red; font-size: 12px;">注意:新增配置项以后,需要对应新增模板文件,模板文件名称需与标识名称一致,建议复制现有的配置模板文件,然后根据需求修改对应的表单即可。</span>
  43. </td>
  44. </tr>
  45. </table>
  46. <div class="py-3">
  47. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  48. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  49. </div>
  50. </form>
  51. {/block}
  52. <!-- /主体 -->
  53. <!-- 脚本 -->
  54. {block name="script"}
  55. <script>
  56. const moduleInit = ['tool'];
  57. function gouguInit() {
  58. var form = layui.form, tool = layui.tool;
  59. //监听提交
  60. form.on('submit(webform)', function (data) {
  61. let callback = function (e) {
  62. layer.msg(e.msg);
  63. if (e.code == 0) {
  64. parent.layui.tool.close(1000);
  65. }
  66. }
  67. tool.post("/admin/conf/add", data.field, callback);
  68. return false;
  69. });
  70. }
  71. </script>
  72. {/block}
  73. <!-- /脚本 -->