加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Angularjs按需查询

发布时间:2020-12-17 08:40:47 所属栏目:安全 来源:网络整理
导读:课程信息管理界面有这样一个需求,当课程类型为公选课的时候,可以选择课程性质,当为其他课程类型的时候,不必选择课程性质。 代码: /** * 获取课程类型下拉框数据 */ getCourseTypeNameOptions(){ let url = "teachingManagement-web/course/queryAllCour

课程信息管理界面有这样一个需求,当课程类型为公选课的时候,可以选择课程性质,当为其他课程类型的时候,不必选择课程性质。


代码:

/** * 获取课程类型下拉框数据 */
  getCourseTypeNameOptions(){
      let url = "teachingManagement-web/course/queryAllCourseType";

      this.http.get(url).subscribe(
          res =>{
              this.courseTypeNameOptions = res.json().data;

              //如果是公共选修,可以选择课程性质,如果不是,课程性质为空
              this.courseTypeNameOptions.forEach(item =>{
                JSON.stringify(item);
                console.log(item);
                if(item.dictionaryName == "公共选修课"){
                  this.getCourseNatureNameOptions();
                }else{
                  return;
                }
              })
          }
      );
  }
  /** * 课程类型为公共选修课,可选择课程性质;其他类型,则不需选择课程性质 * @param type */
  changeType(type:string){
    let dictionaryName=this.courseTypeNameOptions.find(x=>x.id==type).dictionaryName;//获取的课程类型名称
    this.dictionaryName=dictionaryName;  
    if(this.dictionaryName=="公共选修课"){
      this.renderer2.removeAttribute(this.courseNature.nativeElement,"disabled");
    }else{  
      this.courseInfo.courseNatureId=""; 
      this.renderer2.setAttribute(this.courseNature.nativeElement,"disabled","disabled");
    }
  }

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读