<a-table
              :bordered="true"
              :dataSource="noticeData"
              :columns="columnsv"
              rowKey="rowID" 
              :row-selection="rowSelection"
              :pagination="false"
              size="small"
              class="notice-table"
            >

rowKey的值务必要保持唯一性,这样才不会影响其他的复选框

computed:{
    // 短信通知单位类型过滤
    filteredOptions() {
      return this.typeOptions.filter(o => !this.typeValue.includes(o))
    },
    rowSelection() {
      const { selectedRowKeys } = this
      return {
        selectedRowKeys,
        onChange: this.onSelectChange,
        onSelection: this.onSelection,
        getCheckboxProps: record => ({//record为选中的表格行
          props: {
            // 让没有联系电话的禁选
            disabled:record.notifySign==='',
            // 某几项默认禁止选中(R: 当state等于1时)
            // disabled: record.state == 1,
            // 某几项默认选中(R: 当state等于1时)
            // defaultChecked: record.state == 1,
          },
        }),
      }
    },
  },
methods:{
    onSelectChange(selectedRowKeys, selectedRows){
      this.selectedRowKeys = selectedRowKeys
      this.selectedRows = selectedRows
    },
}

使用getCheckboxProps可实现让符合条件的复选框禁选

实现效果:没有联系电话的复选框不可选

其他有联系电话的复选框并不会受到影响,还是可选的

 

 

Logo

前往低代码交流专区

更多推荐