add.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. {extend name="common/base"/}
  2. {block name="style"}
  3. <style>
  4. .footer{
  5. display: none;
  6. }
  7. /*表格*/
  8. #tabniubi {
  9. width: 100%;
  10. margin: 10px 0;
  11. background-color: #fff;
  12. color: #5f5f5f;
  13. }
  14. #tabniubi th {
  15. padding: 9px 15px;
  16. min-height: 20px;
  17. height: 40px !important;
  18. text-align: center;
  19. /* font-size: 14px; */
  20. border-width: 1px;
  21. border-style: solid;
  22. border-color: #e2e2e2;
  23. font: 14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial, sans-serif;
  24. }
  25. #tabniubi tr:first-child {
  26. padding: 0;
  27. min-height: 0;
  28. line-height: 0;
  29. border-width: 0;
  30. border-style: none;
  31. border-color: #fff;
  32. font-size: 0;
  33. }
  34. #tabniubi tr:first-child th {
  35. padding: 0;
  36. min-height: 0;
  37. line-height: 0;
  38. border-width: 0;
  39. border-style: none;
  40. border-color: #fff;
  41. font-size: 0;
  42. }
  43. .form-title {
  44. background-color: rgb(241, 241, 241);
  45. color: rgb(95, 95, 95);
  46. border-color: rgb(241, 241, 241);
  47. font-weight: 600;
  48. }
  49. </style>
  50. {/block}
  51. {block name="body"}
  52. <form class="layui-form p-4">
  53. <h3 class="pb-3">新增预约</h3>
  54. <table id="tabniubi" cellpadding="1" cellspacing="1">
  55. <tr>
  56. <th style="width: 10%;height: 0 !important;"></th>
  57. <th style="width: 10%;height: 0 !important;"></th>
  58. <th style="width: 10%;height: 0 !important;"></th>
  59. <th style="width: 10%;height: 0 !important;"></th>
  60. <th style="width: 10%;height: 0 !important;"></th>
  61. <th style="width: 10%;height: 0 !important;"></th>
  62. <th style="width: 10%;height: 0 !important;"></th>
  63. <th style="width: 10%;height: 0 !important;"></th>
  64. <th style="width: 10%;height: 0 !important;"></th>
  65. </tr>
  66. <tr border="1">
  67. <tr>
  68. <th class="form-title">预约时间<font style="color:red;"> *</font></th>
  69. <th colspan="4">
  70. <input type="text" class="layui-input" lay-verify="required" readonly name="appointment_time" id="ID-laydate-type-datetime-1" placeholder="请选择预约时间">
  71. </th>
  72. <th class="form-title">派遣人数<font style="color:red;"> *</font></th>
  73. <th colspan="3">
  74. <input type="text" name="dispatch_num" lay-verify="required" class="layui-input" placeholder="请添加派遣人数">
  75. </th>
  76. </tr>
  77. <tr>
  78. <th class="form-title">地址/备注<font style="color:red;"> *</font></th>
  79. <th colspan="8">
  80. <textarea placeholder="" name="address_or_remark" lay-verify="required" class="layui-textarea"></textarea>
  81. </th>
  82. </tr>
  83. </table>
  84. <div class="pt-3">
  85. <input type="hidden" name="project_id" lay-verify="required" lay-reqText="" placeholder="" class="layui-input" value="{$project_id}" readonly>
  86. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  87. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  88. </div>
  89. </form>
  90. {/block}
  91. <!-- /主体 -->
  92. <!-- 脚本 -->
  93. {block name="script"}
  94. <script>
  95. const moduleInit = ['tool', 'oaTool'];
  96. function gouguInit() {
  97. var form = layui.form, tool = layui.tool, oaTool = layui.oaTool;
  98. layui.laydate.render({
  99. elem: '#ID-laydate-type-datetime-1',
  100. type: 'datetime',
  101. fullPanel: true // 2.8+
  102. });
  103. let a = 1;
  104. //监听提交
  105. form.on('submit(webform)', function (data) {
  106. if (!isIntegerString(data.field.dispatch_num)){
  107. layer.msg('派遣人数请输入整数');
  108. return false;
  109. }
  110. console.log(Number.isInteger(data.field.dispatch_num),data.field.dispatch_num)
  111. if(a){
  112. layer.confirm('确定要申请吗?', {
  113. icon: 3,
  114. title: '提示'
  115. }, function (index) {
  116. let callback = function (e) {
  117. layer.msg(e.msg);
  118. parent.layui.appointmentTable.reload();
  119. if (e.code == 0) {
  120. tool.tabRefresh(71);
  121. tool.sideClose(1000);
  122. a = 1
  123. }
  124. }
  125. tool.post("/admin/project.appointment/add", data.field, callback)
  126. a = 0
  127. });
  128. }
  129. return false;
  130. });
  131. }
  132. function isIntegerString(str) {
  133. var pattern = /^-?\d+$/; // 匹配整数,包括负整数
  134. return pattern.test(str);
  135. }
  136. </script>
  137. {/block}