联动查询
<label class="layui-form-label">部门:</label> <div class="layui-input-inline"> <select name="depart" lay-filter="select1" id="depart"> <option value="" selected>请选择</option> @foreach($departs as $depart) <option value="{{$depart -> dept_id}}" selected>{{$depart -> dept_name}}</option> @endforeach </select> {{--<input type="text" name="depart" lay-verify="required" autocomplete="off" class="layui-input">--}} </div>
<label class="layui-form-label">项目:</label>
<div class="layui-input-inline">
<select name="project" lay-filter="select2" id="project">
</select>
</div>
layui.use(['form', 'laydate'], function () {
var laydate = layui.laydate;
var form = layui.form;
form.on('select(select1)', function(data){ $.ajax({ url:'/pm/getProject', type:'get', dataType:'json', data:{ department:data.value }, success:function(response){ $('#project').html('<option value="" selected="selected">请选择</option>') for(var i= 0; i< response.length; i++){ var option = $("<option>").val(response[i].pro_id).text(response[i].pro_name); $('#project').append(option); form.render('select'); } } }) })
<input type="text" class="layui-input" name="time" id="test6" placeholder=" - "> layui.use(['form', 'laydate'], function () { var laydate = layui.laydate; var form = layui.form; //日期范围 laydate.render({ elem: '#test6' , range: true startDate = $('#test6').val().split(' - ')[0]; endDate = $('#test6').val().split(' - ')[1]; dept_id = $('#depart').val(); // depa_name = $('#depart').val().split(',')[1];
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步