<el-form :inline="true" :model="form" class="demo-form-inline">
<el-form-item>
<el-select v-model="form.properties_id" placeholder="请选择样品性质" clearable :multiple="multiple_properties" @change="getData()" @focus="focus_properties()" style="width: 300px">
<el-option v-for="item in sample_properties" :label="item.label" :value="item.value" :key="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-select v-model="form.place_id" placeholder="请选择品名" clearable :multiple="multiple_place" @change="getData()" @focus="focus_place()" style="width: 300px">
<el-option v-for="item in place_data" :label="item.label" :value="item.value" :key="item.value"></el-option>
</el-select>
</el-form-item>
</el-form>
form: {
properties_id : [],
place_id : [],
},
multiple_properties: true,
multiple_place: true,
focus_properties(){
var that = this
that.form.properties_id = [];
if(that.form.place_id.length > 1){
that.multiple_place = true;
that.multiple_properties = false;
}
else{
that.multiple_properties = true;
}
},
focus_place(){
var that = this
that.form.place_id = [];
if(that.form.properties_id.length > 1){
that.multiple_place = false;
that.multiple_properties = true;
}
else{
that.multiple_place = true;
}
},
getData(){
var that = this
var properties_id = [];
var properties_id_len = that.form.properties_id.length;
if(properties_id_len == undefined){
var str = that.form.properties_id
properties_id= JSON.parse("[" + str + "]");
}
else{
properties_id = that.form.properties_id;
}
var place_id = [];
var place_id_len = that.form.place_id.length;
if(place_id_len == undefined){
var str = that.form.place_id
place_id= JSON.parse("[" + str + "]");
}
else{
place_id = that.form.place_id;
}
if(properties_id.length == 0){
properties_id = null;
}
if(place_id.length == 0){
place_id = null;
}
$.ajax({
url: "/admin/report/getDevetimeData",
type: "GET",
data : {
properties_id : properties_id,
place_id : place_id,
},
dataType:'json',
success: function (res) {
if (res.code == 100) {
that.data = res.data;
}
}
});
},