element 单选 可删除 用 多选改的

279 阅读1分钟
<template>
    <div class="radio-style">
        <el-checkbox-group
            v-model="proposalArr"
            >
            <el-checkbox
              v-for="(item,index) in proposalList"
              :key="index"
              :label="item.code"
              @change="changeType"
            >
              {{ item.name }}
            </el-checkbox>
        </el-checkbox-group>
     </div>
</template>
export default {
  components: {
    InfsDialog,
    ProposalDialog,
    DetailDialog,
    PermissionDialog
  },
  data() {
    return {
      dataSearch: {
      },
      proposalArr: [],
      proposalList:[
        {
            name:"王毅",
            code:"3333",
            actKey:"dfsfd"
        },
        {
            name:"李白",
            code:"44444",
            actKey:"dfsfd"
        },
      ],
      itemIdActKey:""
    },
   
  },
  mounted() {
  },
  methods: {

    changeType(code) {
      if (this.proposalTypeModel.length > 1) {
        this.proposalTypeModel.splice(0, 1)
        if(this.proposalTypeModel[0]){
          this.dataSearch.proposalType = this.proposalTypeModel[0]
          this.itemIdActKey = this.proposalType.filter(item => item.code === this.dataSearch.proposalType).map(item => item.actKey).toString();
        }
      }else if(this.proposalTypeModel.length === 1){
        this.dataSearch.proposalType = this.proposalTypeModel[0]
        this.itemIdActKey = this.proposalType.filter(item => item.code === this.dataSearch.proposalType).map(item => item.actKey).toString();
      }else {
        this.dataSearch.proposalType = null;
        this.itemIdActKey = null
      }

    }
  }
}
</script>

```````````````