Skip to main content

Department Selection

WdDepartment

Applicable Scenarios

for selecting departments at various levels in the organizational structure

Basic Capabilities

This component currently only supports usage within model applications. The usage method is as follows:

  1. Create a "relationship" type field in the data model, and select the platform-preset department model (model identifier: sys_department) as the associated model.
  2. In the page editor, add a form container and bind it to the aforementioned data model. The department selection component will be automatically generated on the page (if a dropdown selection component is generated by default, you can switch the corresponding component for this field to the department selection component in the form container's field properties).
  3. In the preview area and application runtime, departments within the organization can be selected.

Extended Scenarios

Refer to the Form Scenario Practice Guide to learn about various supported scenarios and implementation solutions for forms.

Example

Interactive Preview

Component Input State

Style API Example

#wd-page-root .wd-form-item .wd-department-department {
border-color: cyan;
background-color: black;
border-width: 2px;
border-radius: 6px;
color: cyan;
}

Properties

External properties received by the component

Property Name
Property Identifier
Type
Description
显示标题labelVisibleboolean

Default value: true

标题对齐labelAlignstring

表单场景下默认会跟随表单容器的标题对齐配置

标题换行labelWrapboolean

如果标题内容过长关闭时只显示一行、溢出省略;开启时换行展示。表单场景下默认会跟随表单容器的标题换行配置

标题位置layoutstring

设置标题在表单组件的展示位置,表单场景下默认会跟随表单容器的标题的位置配置

标题宽度labelWidthstring

您可以输入数值 + px、%等单位,示例:200px

表单场景下默认会跟随表单容器的标题宽度配置

标题提示labelTipsstring

PC/H5端生效

配置标题的工具提示内容

显示清空按钮clearableboolean

开启后提供快捷清空按钮

Default value: true

前缀文字beforestring

表单输入框显示前缀文字,表单提交场景下前缀文字会作为表单内容一起提交到数据模型中

后缀文字afterstring

表单输入框显示后缀文字,表单提交场景下后缀文字会作为表单内容一起提交到数据模型中

前缀图标类型prefixTypestring

选择图标的类型

Example: ""

前缀图标prefixIconstring

表单输入框中展示前图标

Example: "success"

前缀图标prefixSrcstring

设置自定义图标地址

后缀图标类型suffixTypestring

选择图标的类型

Example: "inner"

后缀图标suffixIconstring

表单输入框中展示后图标

Example: "td:folder"

后缀图标suffixSrcstring

设置自定义图标地址

下方提示extrastring

配置后提示内容常显在输入框下方

支持多选multipleboolean

beta属性:开启后,可获取成员多选数据,但是暂不支持将多选数据进行提交,请谨慎开启!

可选范围departmentScopearray

填写部门id后,可选择范围内的各部门

Default value: []

移动端显示下划线borderedH5boolean

关闭后移动端不显示底部下划线

Default value: true

PC端显示输入边框borderedPcboolean

关闭后PC端不显示输入边框

Default value: true

状态statusstring

Example: "edit"

必填requiredboolean
必填标识requiredFlagboolean

启用后,组件若要求必填,则会显示必填星号标记

Default value: true

必填校验提示requiredMsgstring

Example: "该项为必填项"

绑定字段namestring

表单字段的Key值,用于提交数据时,匹配数据模型字段标识。表单内需保证唯一。

标题内容labelstring

Example: "部门"

选中值valuestring

Example: null

占位文字placeholderstring

Example: "请选择部门"

PC端组件尺寸sizestring

尺寸配置仅对PC端生效,表单场景下默认会跟随表单容器的组件尺寸配置

Events

Events exposed by the component. You can listen to component events to trigger external actions

Event Name
Event Code
Event Output Parameters event.detail
Applicable Scenarios
Description
值改变changeobject
  • value: string

    输入值

Compatible with all platforms

用户修改组件值时触发

Property API

Through the Property API, you can access the internal state and property values of components. You can access internal values using$w.componentId.propertyName, such as $w.input1.value. For details, please refer to Property API

Read-only Property Name
Property Identifier
Type
Description
绑定字段namestring

表单字段的Key值,用于提交数据时,匹配数据模型字段标识。表单内需保证唯一。

标题内容labelstring
输入值valuestring
前缀文字beforestring

表单输入框显示前缀文字,表单提交场景下前缀文字会作为表单内容一起提交到数据模型中

后缀文字afterstring

表单输入框显示后缀文字,表单提交场景下后缀文字会作为表单内容一起提交到数据模型中

必填requiredboolean
是否展示visibleboolean

组件是否展示

是否禁用disabledboolean

组件是否禁用

是否只读readOnlyboolean

组件是否只读

Method API

Through the Method API, you can programmatically trigger internal methods of components, such as submitting forms, displaying popups, etc. You can call component methods using $w.componentId.methodName, such as $w.form1.submit()

Method Name
Method Identifier
Parameters
Method Description
设置值setValuestring

通过 $w.id1.setValue("weda") 设置组件值

设置显隐setVisibleboolean显示

通过 $w.id1.setVisible(false) 设置组件为隐藏

设置禁用setDisabledboolean禁用

通过 $w.id1.setDisabled(true) 设置组件为禁用

清空值clearValue

通过 $w.id1.clearValue() 清空组件值

设置只读setReadOnlyboolean只读

通过 $w.id1.setReadOnly(true) 设置组件为只读

触发校验handleValidate

通过 $w.id1.handleValidate() 校验组件值

清除校验clearValidate

通过 $w.id1.clearValidate() 清除组件校验

Style API

Through the Style API, you can override the styles of internal elements in components to achieve customization. For example, in the low-code editor, you can write styles for all button components using #wd-page-root .wd-btn, and control individual component styles with :scope. For detailed instructions, please refer toStyle API

Name
Class Name
Description and Examples
根元素.wd-select-root组件最外层元素
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope.wd-select-root {
  /* Write CSS styles here */
}
H5 端根元素.wd-h5-select-root可设定 H5 端的根元素样式
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope.wd-h5-select-root {
  /* Write CSS styles here */
}
PC 端根元素.wd-pc-select-root可设定 PC 端的根元素样式
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope.wd-pc-select-root {
  /* Write CSS styles here */
}
小程序端根元素.wd-mp-select-root可设定小程序端的根元素样式
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope.wd-mp-select-root {
  /* Write CSS styles here */
}
无边框状态.wd-select-root.is-borderless设置组件无边框状态样式
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope.wd-select-root.is-borderless {
  /* Write CSS styles here */
}
必填状态.wd-select-root.is-required设置组件必填状态样式
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope.wd-select-root.is-required {
  /* Write CSS styles here */
}
标题.wd-select__label组件标题元素
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope .wd-select__label {
  /* Write CSS styles here */
}
标题禁用状态.wd-select__label.is-disabled设置组件标题禁用状态样式
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope .wd-select__label.is-disabled {
  /* Write CSS styles here */
}
标题不换行.wd-select__label.is-nowrap设置组件标题不换行时状态样式
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope .wd-select__label.is-nowrap {
  /* Write CSS styles here */
}
提示文字.wd-select__help设置组件提示文字样式
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope .wd-select__help {
  /* Write CSS styles here */
}
校验信息.wd-select__error设置组件校验信息样式
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope .wd-select__error {
  /* Write CSS styles here */
}
前缀文字.wd-select__text-before设置组件前缀文字样式
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope .wd-select__text-before {
  /* Write CSS styles here */
}
后缀文字.wd-select__text-after设置组件后缀文字样式
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope .wd-select__text-after {
  /* Write CSS styles here */
}
前缀图标.wd-select__icon-before设置组件前缀图标样式
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope .wd-select__icon-before {
  /* Write CSS styles here */
}
后缀图标.wd-select__icon-after设置组件后缀图标样式
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope .wd-select__icon-after {
  /* Write CSS styles here */
}
组件边框.wd-select-select组件边框、边距样式
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope .wd-select-select {
  /* Write CSS styles here */
}
组件输入禁用状态.wd-select-select.is-disabled组件禁用样式
/* :scope refers to the current component element */
/* For details, refer to the Style API documentation */
:scope .wd-select-select.is-disabled {
  /* Write CSS styles here */
}

Learn about Style API

Version Changes

  • Property changes
  • Style changes
  • widget api changes