add.html 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. {extend name="common/base"/}
  2. {block name="style"}
  3. <style>
  4. .layui-td-gray-2{
  5. text-align: center;
  6. }
  7. .footer{
  8. display: none;
  9. }
  10. </style>
  11. {/block}
  12. <!-- 主体 -->
  13. {block name="body"}
  14. <form class="layui-form p-4">
  15. <h3 class="pb-3">新建财政局列表</h3>
  16. <table class="layui-table layui-table-form">
  17. <tr>
  18. <td class="layui-td-gray-2">财政局<font>*</font></td>
  19. <td><input type="text" name="title" lay-verify="required" lay-reqText="请完善财政局" value="" autocomplete="off" placeholder="请输入财政局" class="layui-input"></td>
  20. </tr>
  21. <tr>
  22. <td class="layui-td-gray-2">座机<font>*</font></td>
  23. <td><input type="text" name="landline" lay-verify="required" lay-reqText="请完善座机" value="" autocomplete="off" placeholder="请输入座机" class="layui-input"></td>
  24. <td class="layui-td-gray-2">地址<font>*</font></td>
  25. <td><input type="text" name="address" lay-verify="required" lay-reqText="请完善地址" value="" autocomplete="off" placeholder="请输入地址" class="layui-input"></td>
  26. </tr>
  27. </table>
  28. <div class="pt-3">
  29. <input type="hidden" name="id" value="0"/>
  30. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  31. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  32. </div>
  33. </form>
  34. {/block}
  35. <!-- /主体 -->
  36. <!-- 脚本 -->
  37. {block name="script"}
  38. <script>
  39. var moduleInit = ['tool'];
  40. function gouguInit() {
  41. var form = layui.form, tool = layui.tool;
  42. let a = 1;
  43. //监听提交
  44. form.on('submit(webform)', function (data) {
  45. if(a){
  46. let callback = function (e) {
  47. layer.msg(e.msg);
  48. if (e.code == 0) {
  49. tool.sideClose(1000);
  50. a = 1
  51. }
  52. }
  53. tool.post("/admin/cpuser.financial/add", data.field, callback);
  54. }
  55. a = 0
  56. return false;
  57. });
  58. }
  59. </script>
  60. {/block}
  61. <!-- /脚本 -->