el-checkbox 获取选中的所有数组值,或从选中当中删除已选的数组

时间:2025-01-19 17:24:53
  • handleExceptRisk(val, item, svrType) {
  • if (val) {
  • if (svrType === '0') { // 险类
  • this.checkExceptRisk.push(item)
  • // ('险类', )
  • } else if (svrType === '1') { // 菜单
  • this.checkExceptMenu.push(item)
  • // ('菜单', )
  • } else { // E通
  • this.checkExceptModule.push(item)
  • // ('E通', )
  • }
  • } else {
  • const code = svrType === '0' ? item.classCode : item.id
  • const checkExceptList = svrType === '0' ? this.checkExceptRisk : svrType === '1' ? this.checkExceptMenu : this.checkExceptModule
  • console.log('checkExceptList', checkExceptList)
  • this.delCheckItem(code, checkExceptList, svrType)
  • }
  • },
  • delCheckItem(code, list, svrType) {
  • for (var key in list) {
  • const curCode = svrType === '0' ? list[key].classCode : list[key].id
  • if (curCode === code) {
  • list.splice(key, 1)
  • }
  • }
  • },