<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];