<el-form-item label="废物类型:">
<el-select clearable v-model="queryForm.hswCateType" placeholder="请选择" @change="industryCategoryChange" @focus="industryCategoryFocus">
<el-option v-for="item in wasteTypeOptions" :key="item.hswCate" :label="item.hswCateName" :value="item.hswCate">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="废物代码:">
<el-select clearable v-model="queryForm.hswCateCode" placeholder="请选择" popper-class="isIndustryBigCategory" class="industryBigCategoryClass" @change="industryBigCategoryChange" @focus="industryBigCategoryFocus">
<el-option v-for="item in wasteCodeOptions" :key="item.hswCode" :label="item.hswCode" :value="item.hswCode">
</el-option>
</el-select>
<div v-if="ifIndustryBigCategory" style="height: 0;margin-top: -8px;color: #f56c6c;">请选择废物类型</div>
</el-form-item>
queryForm:{},
ifIndustryBigCategory: false,
wasteTypeOptions: [
{
hswCateName: "选项1",
hswCate: "1",
},
{
hswCateName: "选项2",
hswCate: "2",
},
],
wasteCodeOptions: [],
created() {
document.addEventListener("click", this.hiddenStyle);
},
beforeDestroy: function () {
document.removeEventListener("click", this.hiddenStyle);
},
hiddenStyle() {
this.ifIndustryBigCategory = false;
$(".industryBigCategoryClass input").css({ "border-color": "" });
},
industryCategoryChange(val) {
if (this.queryForm.hswCateType) {
this.wasteCodeOptions = [{
hswCode:'1',
}];
} else {
this.queryForm.hswCateCode = "";
}
},
industryCategoryFocus() {
this.hiddenStyle();
},
industryBigCategoryChange(val) {},
industryBigCategoryFocus() {
if (this.queryForm.hswCateType) {
this.ifIndustryBigCategory = false;
this.commonStyleReveal(
".isIndustryBigCategory",
".industryBigCategoryClass"
);
} else {
this.ifIndustryBigCategory = true;
this.commonStyleHidden(
".isIndustryBigCategory",
".industryBigCategoryClass"
);
}
},
commonStyleReveal(argument1, argument2) {
$(argument1).css({ opacity: 1 });
$(argument1 + " .el-scrollbar").css({ display: "block" });
$(argument1 + " .el-select-dropdown__empty").css({ display: "block" });
$(argument2 + " input").css({ "border-color": "" });
$(argument2 + " .el-select__caret.el-select__caret").css({
transform: "",
});
},
commonStyleHidden(argument1, argument2) {
$(argument1).css({ opacity: 0 });
$(argument1 + " .el-scrollbar").css({ display: "none" });
$(argument1 + " .el-select-dropdown__empty").css({ display: "none" });
$(argument2 + " input").css({ "border-color": "#f56c6c" });
$(argument2 + " .el-select__caret.el-select__caret").css({
transform: "rotateZ(180deg)",
});
},