add.html 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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=""
  20. autocomplete="off" placeholder="请输入名称" class="layui-input"></td>
  21. <td class="layui-td-gray-2">公司类型<font>*</font></td>
  22. <td><input type="text" name="company_type" lay-verify="required" lay-reqText="请完善公司类型" value=""
  23. 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=""
  26. autocomplete="off" placeholder="请输入公司地址" class="layui-input"></td>
  27. <td colspan='2'></td>
  28. </tr>
  29. <tr>
  30. <td class="layui-td-gray-2">部门联系座机</td>
  31. <td>
  32. <input type="text" name="landline" value="" placeholder="请输入部门联系电话,可空" autocomplete="off" class="layui-input">
  33. </td>
  34. <td class="layui-td-gray-2">有效期<font>*</font></td>
  35. <td id="date">
  36. <div class="layui-input-inline">
  37. <input type="text" id="start_time" name="start_time" readonly lay-verify="required" lay-reqText="请选择开始时间" placeholder="请选择" class="layui-input" value="">
  38. </div>
  39. -
  40. <div class="layui-input-inline">
  41. <input type="text" id="end_time" name="end_time" readonly lay-verify="required" lay-reqText="请选择结束时间" placeholder="请选择" class="layui-input" value="">
  42. </div>
  43. </td>
  44. <td class="layui-td-gray-2">状态</td>
  45. <td>
  46. <input type="radio" name="status" value="1" title="正常" checked>
  47. <input type="radio" name="status" value="0" title="禁用">
  48. </td>
  49. </tr>
  50. </table>
  51. <div class="pt-3">
  52. <input type="hidden" name="" value="0"/>
  53. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  54. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  55. </div>
  56. </form>
  57. {/block}
  58. <!-- /主体 -->
  59. <!-- 脚本 -->
  60. {block name="script"}
  61. <script>
  62. var moduleInit = ['tool'];
  63. function gouguInit() {
  64. var form = layui.form, tool = layui.tool;
  65. //日期选择
  66. layui.laydate.render({
  67. elem: '#date',
  68. range: ['#start_time', '#end_time'],
  69. rangeLinked:true
  70. });
  71. //监听提交
  72. let a = 1;
  73. form.on('submit(webform)', function (data) {
  74. if(a){
  75. let callback = function (e) {
  76. layer.msg(e.msg);
  77. if (e.code == 0) {
  78. tool.sideClose(1000);
  79. a = 1
  80. }
  81. }
  82. tool.post("/admin/cpuser.company/add", data.field, callback);
  83. }
  84. a = 0
  85. return false;
  86. });
  87. }
  88. </script>
  89. {/block}
  90. <!-- /脚本 -->