addwarn.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. @extends('vip.layouts')
  2. @section('content')
  3. <div class="layui-row">
  4. <div class="layui-col-xs12">
  5. <div class="layui-form-item" style="margin-left:50px;">
  6. <form class="layui-form rewrite" eventType="eventForm" action="">
  7. <div class="layui-inline">
  8. <label class="layui-form-label">搜&nbsp;&nbsp;索 </label>
  9. <input type="hidden" id="match_id" name="match_id" value="{{$match_id}}">
  10. <div class="layui-input-inline">
  11. <select name="sousuo" id="sousuo" autocomplete="off">
  12. <option value="">请选择危险球类型</option>
  13. <option value="角球">角球</option>
  14. <option value="12码罚球">12码罚球</option>
  15. <option value="自由球">自由球</option>
  16. <option value="掷入球">掷入球</option>
  17. </select>
  18. <!-- <input type="text" placeholder="输入赛事ID" name="sousuo" id="sousuo" lay-verify="" autocomplete="off" class="layui-input" value="{{$sousuo}}">11 -->
  19. </div>
  20. <div class="layui-inline">
  21. <button class="layui-btn layui-btn-sm lay-btn-diy" data-type="reload" style="opacity: 1; pointer-events: auto;">提交</button>
  22. </div>
  23. </div>
  24. </form>
  25. <div class="layui-inline" style="margin-left:320px;margin-top:-55px;"><button onclick="addResult({{$match_id}},'',10000)" class="layui-btn layui-btn-sm set">添加危险球</button></div>
  26. </div>
  27. </div>
  28. </div>
  29. <table id="demo" lay-filter="test"></table>
  30. <!--
  31. <table lay-filter="parse-table-demo" style="width:80%;text-align:left;">
  32. <tr class="layui-form-item">
  33. <td class="layui-form-label" style="width:5%;left:10px;"><h3>id</h3></td>
  34. <td class="layui-form-label" style="width:20%;left:10px;"><h3>危险球时间</h3></td>
  35. <td class="layui-form-label" style="width:20%;left:10px;"><h3>危险球有效时间</h3></td>
  36. <td class="layui-form-label" style="width:20%;left:10px;"><h3>危险球类型</h3></td>
  37. <td class="layui-form-label" style="width:20%;left:10px;"><h3>操 作</h3></td>
  38. </tr>
  39. @if($warnmore)
  40. @foreach ($warnmore as $k=>$val)
  41. <tr class="layui-form-item">
  42. <td class="layui-form-label" style="width:5%;left:10px;">{{$k+1}}</td>
  43. <td class="layui-form-label" style="width:20%;left:10px;">{{$val['timei']}}</td>
  44. <td class="layui-form-label" style="width:20%;left:10px;">{{$val['timep']}}</td>
  45. <td class="layui-form-label" style="width:20%;left:10px;">{{$val['rtype']}}</td>
  46. <td class="layui-form-label" style="width:20%;left:10px;">
  47. <button onclick="addResult({{$match_id}},{{$k}},2)" class="layui-btn layui-btn-sm layui-btn-green set">编辑</button>
  48. </td>
  49. </tr>
  50. @endforeach
  51. @else
  52. <tr class="layui-form-item">
  53. <td class="layui-form-label" style="width:150px;left:10px;">暂时无危险球数据</td>
  54. </tr>
  55. @endif
  56. </table>
  57. -->
  58. <script type="text/javascript">
  59. $(function () {
  60. $('body').on('click', 'a[eventtype="event-delete"]', function () {
  61. var span = $(this).prev();
  62. var id = span.attr('data-id');
  63. })
  64. $('body').on('click','#form_sureblur~.layui-form-switch',function(){
  65. var sus = $('#form_sureblur').next().text();
  66. if(sus=='精确'){
  67. $('#form_sureblurs').val('on');
  68. }else{
  69. $('#form_sureblurs').val('off');
  70. }
  71. })
  72. })
  73. let conttxt = '';
  74. let layerOpen = '';
  75. function addResult(match_id,wid,typenum){
  76. var wid = wid?wid:0;
  77. $.ajax({
  78. type: 'POST',
  79. dataType: 'json',
  80. url: '/admin/Sportsfoot/warnresult',
  81. data: {match_id:match_id,wid:wid,typenum:typenum},
  82. success: function(data) {
  83. conttxt ='<div style="margin-left:50px;margin-top:20px;font-size:18px;line-height:150%;"><input type="hidden" id="matchid" name="matchid" value="'+match_id+'" /><input type="hidden" id="wid" name="wid" value="'+wid+'" /><input type="hidden" id="typenum" name="typenum" value="'+typenum+'" /><div style="display: flex;margin-top: 30px;"><li style="width: 120px;">危险球时间:</li>';
  84. /*
  85. if(wid!=0){
  86. conttxt += '<input type="text" id="timei" name="timei" value="'+data.warn_more[wid].timei+'" autocomplete="off">';
  87. }else{
  88. conttxt += '<input type="text" id="timei" name="timei" value="'+data['starttime']+'" autocomplete="off">';
  89. }
  90. //=================
  91. /*
  92. conttxt += '<input type="number" min="0" max="90" style="width:63px;" placeholder="0~90" id="timei_i" name="timei_i" value="" autocomplete="off">';
  93. conttxt += '<p>分</p>';
  94. conttxt += '<input type="number" min="0" max="59" style="width:63px;" placeholder="0~59" id="timei_s" name="timei_s" value="" autocomplete="off">';
  95. conttxt += '<p>秒</p>';
  96. */
  97. //======================
  98. conttxt += '<input type="text" id="timei" name="timei">';
  99. conttxt +='</div><div style="display: flex;margin-top: 20px;"><li style="width: 120px;">需审核时间:</li>';
  100. if(data.warn_more[wid].timep!=0){
  101. conttxt += '<input type="number" min="60" max="300" style="width:200px;" placeholder="60~300" id="timep" name="timep" value="'+data.warn_more[wid].timep+'" autocomplete="off">';
  102. }else{
  103. conttxt += '<input type="number" min="60" max="300" style="width:200px;" placeholder="60~300" id="timep" name="timep" autocomplete="off">';
  104. }
  105. conttxt += '<p>秒</p>';
  106. conttxt += '</div><div style="display: flex;margin-top: 20px;"><li style="width: 120px;">危险球类型:</li><select style="width:225px;" name="warntype" id="warntype">';
  107. if(data.warn_more[wid].rtype!=0){
  108. conttxt += '<option style="width:225px;" value="'+data.warn_more[wid].rtype+'">'+data.warn_more[wid].rtype+'</option><option style="width:140px;" value="0">无危险球类型';
  109. }else{
  110. conttxt += '<option style="width:225px;" value="0">请选择危险球类型';
  111. }
  112. conttxt += '</option><option style="width:225px;" value="角球">角球</option><option style="width:225px;" value="12码罚球">12码罚球</option><option style="width:225px;" value="自由球">自由球</option><option style="width:225px;" value="掷入球">掷入球</option></select></div><br><div style="margin-left:230px;"><button class="layui-btn layui-btn-sm layui-btn-green set" onclick="buttonClick()"><h3>确定</h3></button>&nbsp;<button class="layui-btn layui-btn-sm layui-btn-danger" onclick="czClick()"><h3>取消</h3></button></div></div>';
  113. layerOpen = layer.open({
  114. type: 1 //Page层类型
  115. ,area: ['500px', '270px']
  116. ,title: '<h2>添加/编辑危险球结果<h2>'
  117. ,shade: 0.6 //遮罩透明度
  118. ,maxmin: true //允许全屏最小化
  119. ,anim: 1 //0-6的动画形式,-1不开启
  120. ,content:conttxt
  121. });
  122. //日期时间有效范围的设定:
  123. laydate.render({
  124. elem: '#timei'
  125. ,type: 'datetime'
  126. ,value: data.warn_more[wid].timei
  127. ,min: data.starttime
  128. ,max: data.endtime
  129. });
  130. }
  131. })
  132. }
  133. function czClick() {
  134. layer.close(layerOpen)
  135. }
  136. function ces(){
  137. var match_id = $("#match_id").val();
  138. var warn_type = $("#sousuo").val();
  139. console.log(match_id);
  140. console.log(warn_type);
  141. }
  142. function buttonClick(){
  143. var matchid = $("#matchid").val();
  144. var timei = $("#timei").val();
  145. var timep = $("#timep").val();
  146. var warntype = $("#warntype").val();
  147. var wid = ($("#wid").val())-1;
  148. var typenum = $("#typenum").val();
  149. $.ajax({
  150. type: 'POST',
  151. dataType: 'json',
  152. url: '/admin/Sportsfoot/addwarnonly',
  153. data: {match_id:matchid,time_i:timei,time_p:timep,warn_type:warntype,wid:wid,type_num:typenum},
  154. success: function(data) {
  155. //console.log(data);
  156. if(data.status==1){
  157. layer.msg(data.msg);
  158. location. reload()//刷新当前页面
  159. }else{
  160. layer.msg(data.msg);return;
  161. }
  162. }
  163. })
  164. }
  165. /*
  166. function buttonClick(){
  167. var matchid = $("#matchid").val();
  168. var timei = $("#timei").val();
  169. var timep = $("#timep").val();
  170. var warntype = $("#warntype").val();
  171. var wid = $("#wid").val();
  172. var typenum = $("#typenum").val();
  173. $.ajax({
  174. type: 'POST',
  175. dataType: 'json',
  176. url: '/admin/Sportsfoot/addwarnonly',
  177. data: {matchid:matchid,timei:timei,timep:timep,warntype:warntype,wid:wid,typenum:typenum},
  178. success: function(data) {
  179. //console.log(data);
  180. if(data.status==1){
  181. layer.msg(data.msg);
  182. location. reload()//刷新当前页面
  183. }else{
  184. layer.msg(data.msg);return;
  185. }
  186. }
  187. })
  188. }
  189. */
  190. </script>
  191. <script src="/layui/layui.js"></script>
  192. <script type='text/javascript'>
  193. var table = layui.table;
  194. //执行渲染危险期数据
  195. table.render({
  196. elem: '#demo' //指定原始表格元素选择器(推荐id选择器)
  197. ,height: 315 //容器高度
  198. ,cols: [[ //标题栏
  199. {checkbox: true}
  200. ,{field: 'id', title: 'ID'}
  201. ,{field: 'timei', title: '发生时间'}
  202. ,{field: 'timep', title: '有效时间(秒)'}
  203. ,{field: 'rtype', title: '类型'}
  204. ,{fixed: 'right', title: '操作', align:'center', toolbar: '#barDemo'}
  205. ]]
  206. ,url: '/admin/Sportsfoot/getWarnData'
  207. ,where: {match_id: {{$match_id}}}
  208. });
  209. //监听工具条
  210. table.on('tool(test)', function(obj){ //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
  211. var warn_id = (obj.data.id)-1; //获得当前id
  212. var layEvent = obj.event;
  213. if(layEvent === 'edit'){ //编辑
  214. addResult({{$match_id}},warn_id,2)
  215. }
  216. });
  217. </script>
  218. <script type="text/html" id="barDemo">
  219. <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
  220. </script>
  221. @endsection