单选框,复选框,多选框回显

单选框,复选框,多选框回显,开关

1.单选框

label 是关键

<el-form-item label="性别:" :label-width="formLabelWidth">    
  <el-radio v-model="addStudent.sex" label="男">男</el-radio>
  <el-radio v-model="addStudent.sex" label="女">女</el-radio>
</el-form-item>

2.复选框

对数组复选框进行拼接依次填入

/*
  学生修改按钮
 */
handleUpd(row){
  console.log(row)

  this.addStudent=row
  let  k =  this.addStudent.courseId= row.courseName;
   let s1 = k.substring(0,2);
   let s2 = k.substring(3,5);
   let s3 = k.substring(6,8);
 this.addStudent.courseId=[s1,s2,s3];
  console.log(this.addStudent.courseId)
  this.dialogFormVisible=true

},

注意: courseId 是[ ] 类型

<el-form-item label="选课:" :label-width="formLabelWidth">
  <el-checkbox-group v-model="addStudent.courseId">
    <el-checkbox v-for="c in courseList" :key="c.courseId"  :value="c.courseId" :label="c.courseName"></el-checkbox>
  </el-checkbox-group>
</el-form-item>
//修改
handleUpd(row){
  let bankLname = row.bankLname;
  let s1 = bankLname.substring(0,4);
  let s2 = bankLname.substring(5,9);
  let s3 = bankLname.substring(10,14);
  this.addform=row      // 语文  数学 英语 结构的
  this.addform.bankName=[s1,s2,s3]
  this.dialogFormVisible=true

},
/**
     * 添加修改
     * @return
     */
    @PostMapping("addsenior")
    public R addsenior(@RequestBody SysSenior sysSenior){
        if (sysSenior.getSeniorId()==null){
            sysSenior.setTime(new Date());
            sysSeniorService.save(sysSenior);
            String[] jobId = sysSenior.getJobId();
            for (String s : jobId) {
                QueryWrapper queryWrapper = new QueryWrapper();
                queryWrapper.eq("job_name",s);
                SysJob one = sysJobService.getOne(queryWrapper);
                SysSeniorJob sysSeniorJob = new SysSeniorJob();
                sysSeniorJob.setJobId(one.getJobId());
                sysSeniorJob.setSeniorId(sysSenior.getSeniorId());
                sysSeniorJobService.save(sysSeniorJob);
            }
            return R.successed("添加成功");
        }else{
            sysSeniorService.updateById(sysSenior);
            QueryWrapper queryWrapper = new QueryWrapper();
            queryWrapper.eq("senior_id",sysSenior.getSeniorId());
            sysSeniorJobService.remove(queryWrapper);

            String[] jobId = sysSenior.getJobId();
            for (String s : jobId) {
                QueryWrapper queryWrapper1 = new QueryWrapper();
                queryWrapper1.eq("job_name",s);
                SysJob one = sysJobService.getOne(queryWrapper1);
                if (ObjectUtil.isEmpty(one)){
                    System.err.println(one);
                }else {
                    SysSeniorJob sysSeniorJob = new SysSeniorJob();
                    sysSeniorJob.setSeniorId(sysSenior.getSeniorId());
                    sysSeniorJob.setJobId(one.getJobId());
                    sysSeniorJobService.save(sysSeniorJob);
                }
            }
      return R.successed("修改成功");

        }
    }

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

3.开关

<el-table-column
     prop="status"
    label="角色状态">
      <template v-slot="pp">
        <el-switch
            v-model="pp.row.status"
            active-color="#13ce66"
            inactive-color="#ff4949"
            @change="outStatus(pp.row)"  // 改变方法
            active-value="0"     // 开启的值
            inactive-value="1">   // 关闭的值
        </el-switch>
      </template>
    </el-table-column>

状态改变方法

/*
 状态失效
  */
outStatus(u){
    this.axios.post("role/roleUpdStatus",u).then(r=>{
      this.$message.success(r.data.data)
      this.getroleList()
    })
},

s(u){
this.axios.post(“role/roleUpdStatus”,u).then(r=>{
this.$message.success(r.data.data)
this.getroleList()
})
},


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值