add.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 !important;">*</font></th>-->
  79. <!-- <th colspan="2">-->
  80. <!-- <select name="approval_name" lay-reqText="请选择审核人">-->
  81. <!-- <option value="">请选择审核人</option>-->
  82. <!-- {volist name="person" id="v"}-->
  83. <!-- <option value="{$v.nickname}">{$v.nickname}</option>-->
  84. <!-- {/volist}-->
  85. <!-- </select>-->
  86. <!-- </th>-->
  87. <!-- </tr>-->
  88. <tr>
  89. <th class="form-title">地址/备注<font style="color:red;"> *</font></th>
  90. <th colspan="8">
  91. <textarea placeholder="" name="address_or_remark" lay-verify="required" class="layui-textarea"></textarea>
  92. </th>
  93. </tr>
  94. </table>
  95. <div class="pt-3">
  96. <input type="hidden" name="project_id" lay-verify="required" lay-reqText="" placeholder="" class="layui-input" value="{$project_id}" readonly>
  97. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  98. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  99. </div>
  100. </form>
  101. {/block}
  102. <!-- /主体 -->
  103. <!-- 脚本 -->
  104. {block name="script"}
  105. <script>
  106. const moduleInit = ['tool', 'oaTool'];
  107. function gouguInit() {
  108. var form = layui.form, tool = layui.tool, oaTool = layui.oaTool;
  109. layui.laydate.render({
  110. elem: '#ID-laydate-type-datetime-1',
  111. type: 'datetime',
  112. fullPanel: true // 2.8+
  113. });
  114. let a = 1;
  115. //监听提交
  116. form.on('submit(webform)', function (data) {
  117. if (!isIntegerString(data.field.dispatch_num)){
  118. layer.msg('派遣人数请输入整数');
  119. return false;
  120. }
  121. console.log(Number.isInteger(data.field.dispatch_num),data.field.dispatch_num)
  122. if(a){
  123. layer.confirm('确定要申请吗?', {
  124. icon: 3,
  125. title: '提示'
  126. }, function (index) {
  127. let callback = function (e) {
  128. layer.msg(e.msg);
  129. parent.layui.appointmentTable.reload();
  130. if (e.code == 0) {
  131. tool.tabRefresh(71);
  132. tool.sideClose(1000);
  133. a = 1
  134. }
  135. }
  136. tool.post("/admin/project.appointment/add", data.field, callback)
  137. a = 0
  138. });
  139. }
  140. return false;
  141. });
  142. }
  143. function isIntegerString(str) {
  144. var pattern = /^-?\d+$/; // 匹配整数,包括负整数
  145. return pattern.test(str);
  146. }
  147. </script>
  148. {/block}