部门

介绍
搜索或者层级选择部门
API
Props
| 参数名 | 描述 | 类型 | 默认值 |
|---|---|---|---|
| status | 状态 | 'default' |'disabled'| 'hide'| 'readonly' | 'default' |
| title | 标题 | string | - |
| showLabel | 显示标题 | boolean | true |
| width | 字段占比 | '25%'|'50%'|'75%'|'100%' | '100%' |
| labelWidth | 标签宽度 | string | - |
| value | 默认值 | Value[] | - |
| placeholder | 占位提示 | string | '请输入' |
| name | 数据字段 | string | ${组件编码}_${长度为8的随机字符串} |
| multiple | 支持多选 | boolean | false |
| allowClear | 允许清除 | boolean | false |
| api | 数据API,如果不做配置,将使用我们提供的默认接口 | string | - |
| searchApi | 搜索API,如果不做配置,将使用我们提供的默认接口 | string | - |
| openSearchOrgInfoByApi | 通过API查询已选部门名称、部门全路径 | boolean | false |
| searchOrgInfoByApi | 通过API查询已选部门名称、部门全路径, api地址 | string | - |
| fieldNames | 字段名 | Value | {'orgName':'orgName','orgCode':'orgCode'} |
| orgLevelArr | 默认展开组织层级 | Value[] | - |
| showNextLevel | 下级按钮显示条件 | Function | function showNextLevel(ctx, params) { return true; } |
| baseStyle | 自定义样式 | string | - |
| customClass | 类名绑定 , 绑定类的名称 | string | - |
| boxStyle | 盒模型 , margin,border,padding设置 | BoxStyle | - |
| uniqueKey | 唯一标识 , 组件的唯一标识 | string | - |
| extra | 补充说明 | string | - |
| tip | 气泡提醒 | string | - |
| validate | 校验 | Validate | - |
Events
| 事件名 | 描述 | 参数 |
|---|---|---|
| onChange | 值发生改变时 | ctx params: Value | Value[] |
Type
javascript
type Value = {
"orgName":string,
"orgCode":string,
}常见场景配置
限制可选部门,在部门数据中增加disabled字段设置为true
javascript
{
fullName:"海信集团",
isLeaf:true,
orgCode:"HC12198889",
orgName:"海信集团",
disbaled:true // disbaled为true,部门不可选择
}下级按钮是否展示
javascript
function showNextLevel(ctx, params) {
if(params.orgCode === "HC12198889"){
return false; // 返回false此部门下级按钮不展示
}
return true;
}