function main(page: IPage, portlet: IFilterPortlet) {
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>开始
//这段代码,是渲染页面时,根据下拉框的值,禁用日期组件
let otherportlet = page.getPortletsByTitle('筛选_1')[0];
current_value = portlet.getValue();
if (current_value[0] == '2017') {
//禁用filter-wrapper
otherportlet.appendCss('.filter-wrapper__row', {
'pointer-events': 'none',
'opacity': '0.5'
});
//禁用input__suffix
otherportlet.appendCss('.el-input__suffix-inner', {
'pointer-events': 'none',
});
};
//<<<<<<<<<<<<<<<<<<<<<<<<<结束
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>开始
//这里是在选中下拉参数时,控制日期组件是否可用
portlet.setFilterValueChangeHandler(function (value: Array) {
if (value[0] == '2017') {//添加禁用日期组件的CSS代码
//禁用filter-wrapper
otherportlet.appendCss('.filter-wrapper__row', {
'pointer-events': 'none',
'opacity': '0.5'
});
//禁用input__suffix
otherportlet.appendCss('.el-input__suffix-inner', {
'pointer-events': 'none',
});
}
else { //移除禁用日期组件的CSS代码
otherportlet.removeCss('.filter-wrapper__row', {
'pointer-events': 'none',
'opacity': '0.5'
});
otherportlet.removeCss('.el-input__suffix-inner', {
'pointer-events': 'none',
});
};
return value;
})
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<结束