JS根据一个参数值确认是否隐藏另外的参数控件

这段JS目前只对第一次选择起作用,选择调整表1,表2科目的控件会被隐藏,但是再切换成调整表2,没有任何变化;

以下时JS,设置的编辑后事件:

//获取下拉框控件 车型 科目

var model = this.options.form.getWidgetByName("车型");

var account = this.options.form.getWidgetByName("科目");

var account2 = this.options.form.getWidgetByName("表2科目");

//获取下拉框控件area

var tablename = this.options.form.getWidgetByName("表名");

var thisvalue = this.getValue();//取表名控件中值

if(thisvalue="调整表1") {

    model.setVisible(true);

    account.setVisible(true);

    account2.setVisible(false);

    this.options.form.getWidgetByName("车型").setVisible(true);

    this.options.form.getWidgetByName("科目").setVisible(true);

    this.options.form.getWidgetByName("表2科目").setVisible(false);

    this.options.form.getWidgetByName("Label表2科目").setVisible(false);

else if(thisvalue="调整表2") {

    model.setVisible(false);

    account.setVisible(false);

    account2.setVisible(true);

    this.options.form.getWidgetByName("车型").setVisible(false);

    this.options.form.getWidgetByName("科目").setVisible(false);

    this.options.form.getWidgetByName("表2科目").setVisible(true);

    this.options.form.getWidgetByName("Label表2科目").setVisible(true);

else {    

    model.setVisible(true);

    account.setVisible(true);

    account2.setVisible(true);

    this.options.form.getWidgetByName("车型").setVisible(true);

    this.options.form.getWidgetByName("科目").setVisible(true);

    this.options.form.getWidgetByName("表2科目").setVisible(true);

    this.options.form.getWidgetByName("Label表2科目").setVisible(true);

}

image.png

FineReport yzmFYfRS9139997 发布于 2024-12-31 16:05
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
0
snrtuemcLv8专家互助
发布于2024-12-31 16:07

这个你写在哪边,正常是下拉框的编辑结束事件把

最佳回答
0
华莉星宸Lv7资深互助
发布于2024-12-31 16:08

IF里面写两个等号看看

if(thisvalue=="调整表1") 

  • 3关注人数
  • 26浏览人数
  • 最后回答于:2024-12-31 16:08
    请选择关闭问题的原因
    确定 取消
    返回顶部