8d1fdd4060d42b6bebf3c76a20e33a66.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php /*a:1:{s:63:"D:\project\gyx\gaoyixia\application\user\view\message\form.html";i:1702541857;}*/ ?>
  2. <div class="think-box-shadow"><form class="layui-form layui-card" action="<?php echo request()->url(); ?>" data-auto="true" method="post" autocomplete="off"><div class="layui-card-body"><div class="layui-form-item"><label class="layui-form-label label-required">推送类型</label><div class="layui-input-inline"><select name="type" lay-filter ="type"><?php foreach([2=>'搜索标签',3=>'模块详情'] as $ck=>$cv): if(isset($vo['type'])): ?><option <?php if($vo['type'] == $ck): ?> selected <?php endif; ?> value="<?php echo htmlentities($ck); ?>"><?php echo htmlentities($cv); ?></option><?php else: ?><option <?php if($ck == 2): ?> selected <?php endif; ?> value="<?php echo htmlentities($ck); ?>"><?php echo htmlentities($cv); ?></option><?php endif; ?><?php endforeach; ?></select></div></div><div class="layui-form-item"><label class="layui-form-label ">标签</label><div class="layui-input-block"><input name="label" value='<?php echo htmlentities((isset($vo['label']) && ($vo['label'] !== '')?$vo['label']:"")); ?>' placeholder="请输入标签 不填默认全部发送" class="layui-input"></div></div><div class="layui-form-item"><label class="layui-form-label label-required">标题</label><div class="layui-input-block"><input name="title" required value='<?php echo htmlentities((isset($vo['title']) && ($vo['title'] !== '')?$vo['title']:"")); ?>' placeholder="请输入推送标题" class="layui-input"></div></div><div class="module_div" <?php if(!isset($vo['type']) || $vo['type'] == 2): ?>style="display:none" <?php endif; ?>><div class="layui-form-item"><label class="layui-form-label label-required">模块</label><div class="layui-input-inline"><select name="module" lay-filter ="module"><?php foreach($module_arr as $ck=>$cv): ?><option data-sel_module="<?php echo htmlentities($ck); ?>" <?php if(isset($vo['module']) && $vo['module'] == $ck): ?> selected <?php endif; ?> value="<?php echo htmlentities($ck); ?>"><?php echo htmlentities($cv); ?></option><?php endforeach; ?></select></div></div><div class="layui-form-item"><label class="layui-form-label label-required">详情</label><div class="layui-input-inline"><select name="first_id" id="first_id" lay-filter ="first_id" lay-search=""></select></div><div class="layui-input-inline second_div"><select name="second_id" id="second_id" lay-filter ="second_id" lay-search=""></select></div></div></div><div class="layui-form-item"><label class="layui-form-label label-required">推送内容</label><div class="layui-input-block"><textarea name="content" required rows="10" cols="98"><?php echo htmlentities((isset($vo['content']) && ($vo['content'] !== '')?$vo['content']:'')); ?></textarea></div></div><?php if(!(empty($vo['id']) || (($vo['id'] instanceof \think\Collection || $vo['id'] instanceof \think\Paginator ) && $vo['id']->isEmpty()))): ?><input type='hidden' value='<?php echo htmlentities($vo['id']); ?>' name='id'><?php endif; ?><div class="layui-form-item text-center"><button class="layui-btn" type='submit'>保 存</button><button class="layui-btn layui-btn-danger" type='button' data-close>取消编辑</button></div></div></form><script> form.on('select(type)', function(data){
  3. if(data.value == 3) {
  4. $(".module_div").show();
  5. }else{
  6. $(".module_div").hide();
  7. }
  8. window.form.render();
  9. })
  10. var sel_first = <?php echo isset($vo['first_id']) ? $vo['first_id']:0; ?>;
  11. var sel_second = <?php echo isset($vo['second_id']) ? $vo['second_id']:0; ?>;
  12. var module_list = <?php echo json_encode($module_list); ?>;
  13. // 分类选择监听
  14. var arr = ['video','article','datum','supplier'];
  15. first(1);
  16. form.on('select(module)', function(data){
  17. first(2)
  18. })
  19. // 详情关联监听
  20. form.on('select(first_id)', function(data){
  21. second(2);
  22. })
  23. function first(source) {
  24. sel_module = $("select[name='module']").find("option:selected").data('sel_module');
  25. if(arr.indexOf(sel_module) != -1) {
  26. $(".second_div").show();
  27. }else{
  28. $(".second_div").hide();
  29. }
  30. var cl_html = '<option value="0">请选择</option>';
  31. if(sel_module == '') {
  32. $("select[name='first_id']").html(cl_html);
  33. $("select[name='second_id']").html(cl_html);
  34. window.form.render();
  35. return true;
  36. }else{
  37. $.each(module_list,function (ck,cv) {
  38. if(cv.module == sel_module) {
  39. if(source == 1 && sel_first == cv.id) {
  40. cl_html +='<option selected value="'+cv.id+'">'+cv.title+'</option>';
  41. }else{
  42. cl_html +='<option value="'+cv.id+'">'+cv.title+'</option>';
  43. }
  44. }
  45. })
  46. $("select[name='first_id']").html(cl_html);
  47. $("select[name='second_id']").html('');
  48. }
  49. second(source);
  50. window.form.render();
  51. }
  52. function second(source) {
  53. var cl_html = '<option value="0">请选择</option>';
  54. sel_module = $("select[name='module']").find("option:selected").data('sel_module');
  55. first_id = $("select[name='first_id']").find("option:selected").val();
  56. $.each(module_list,function (ck,cv) {
  57. if(sel_module == cv.module && first_id == cv.id && arr.indexOf(sel_module) != -1) {
  58. $.each(cv.children,function (sk,sv) {
  59. if(source == 1 && sel_second == sv.id) {
  60. cl_html +='<option selected value="'+sv.id+'">'+sv.title+'</option>';
  61. }else{
  62. cl_html +='<option value="'+sv.id+'">'+sv.title+'</option>';
  63. }
  64. })
  65. $("select[name='second_id']").html(cl_html);
  66. $(".second_div").show();
  67. form.render();
  68. }
  69. })
  70. }
  71. </script></div>