**JSelectRole 角色选择组件** ***** [TOC] ## 参数定义 | 参数 | 类型 | 是否可选 | 默认值 | 说明 | | --- | --- | --- | --- | --- | | value | \[String,Array\] | 否 | 无 | 回显值 | | showButton | Boolean | 否 | true | 是否显示选择按钮 | | placeholder | String | 否 | 请选择 | 选择提示语 | | rowKey | String | 否 | id| 取值字段配置,一般为主键字段 | | labelKey | String | 否 | name | 显示字段配置 | | params | String | 否 | \- | 自定义查询参数,需要传递字符串,如:params:**'{"code":"001"}'** | | maxSelectCount | Number | 否 | 0| 最大选择数量 | | isRadioSelection | boolean| 否 | false| 是否单选 | ## 事件定义 | 事件名 | 参数 | 说明 | | --- | --- | --- | | getSelectResult | options, values | 确认选择回调,单独使用选择框中使用该事件获取选中值 | ## 使用示例 ### BaseForm中使用示例 ![](https://img.kancloud.cn/e6/26/e6260bc1dcb6b4f15b463224315e2a08_704x73.png) ![](https://img.kancloud.cn/0e/31/0e319ec1c64cdddc90a2bd6285ce2378_739x651.png) ~~~ { field: 'role', component: 'JSelectRole', label: '选择示例', helpMessage: ['component模式'], componentProps:{ labelKey:'roleName', rowKey:'id' } } ~~~ ### 插槽中使用示例 ~~~ <template #jSelectPosition="{model, field }"> <JSelectRole v-model:value="model[field]"/> </template> ~~~ ### 单独使用示例 ~~~ <template> <a-button type="primary" preIcon="ant-design:plus-outlined" @click="openHandle">选择</a-button> <RoleSelectModal @register="registerSelModal" @getSelectResult="onSelectOk"/> </template> <script lang="ts" setup> import RoleSelectModal from '/@/components/Form/src/jeecg/components/modal/RoleSelectModal.vue' // 注册选择框 const [registerSelModal, {openModal}] = useModal() // 打开选择框 function openHandle() { openModal(); } // 选择确认事件 function onSelectOk(selectRows, selectKeys) { //处理业务逻辑 } </script> ~~~