mineadmin/MineAdmin

[BUG] columns属性中配置了formType: "select",multiple:true时,点击重置按钮报错问题修复

Closed this issue · 1 comments

bug描述:

columns属性中配置了multiple:true时,点击重置按钮报错

重现步骤:

{   
 title: "订单状态",
    dataIndex: "status",
    formType: "select",
    multiple:true
}

报错如图
bug_img

bug修复代码

/src/components/ma-crud/components/searchFormItem/form-select.vue 169行
判断multiple为true时,设置默认值为空数组则报错问题解决

if (props.component.multiple) {
    v = v == null ? [] : v
    if(v.length>0){
      v.forEach(k => {
        if ( !optionMap.value[k] ) {
          optionMap.value[k] = dicts.value[dictIndex].find(i => i.value === k)
        }
      })
      for(const k in optionMap.value) {
        if ( !v.includes(k) ) delete optionMap.value[k]
      }
    }
  }

Thanks for opening your first issue here! Be sure to follow the issue template! 感谢您在这里反馈第一个问题!请务必遵循问题模板!