fix: 修复下拉选择回显问题&成员列表不可删除最后一个用户组

--bug=1046504 --user=吕梦园
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001046504
--bug=1046478 --user=吕梦园
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001046478
This commit is contained in:
teukkk 2024-09-18 19:01:38 +08:00 committed by Craftsman
parent 0a4a603888
commit 6ed59b1275
4 changed files with 14 additions and 8 deletions

View File

@ -450,7 +450,9 @@ export default defineComponent(
if (typeof props.optionLabelRender === 'function') {
return label;
}
const option = remoteOriginOptions.value.find((e) => e[props.labelKey || 'label'] === label);
const option = remoteOriginOptions.value.find(
(e) => e[props.labelKey || 'label'].toLowerCase() === label?.toLowerCase()
);
return option ? option[props.labelKey || 'label'] : props.optionNotExitsText || t('ms.select.optionsNotExits');
}

View File

@ -36,7 +36,7 @@ export default function useSelect(config: UseSelectOption) {
const innerViewWidth = selectViewInner.value?.getBoundingClientRect().width;
let lastWidth = innerViewWidth - 60; // 60px 是“+N”的标签宽度+聚焦输入框的宽度
const childrenNodes = selectViewInner.value.children;
if (maxTagCount.value >= 1 && maxTagCount.value < config.selectVal.value.length) {
if (maxTagCount.value >= 1 && maxTagCount.value < config.selectVal.value?.length) {
return;
}
for (let i = 0; i < childrenNodes.length; i++) {

View File

@ -48,7 +48,6 @@
v-else
v-model:model-value="record.userRoleList"
:placeholder="t('system.user.createUserUserGroupPlaceholder')"
:options="userGroupOptions"
:search-keys="['name']"
:loading="record.selectUserGroupLoading"
:disabled="record.selectUserGroupLoading"
@ -60,8 +59,11 @@
label-key="name"
class="w-full max-w-[300px]"
allow-clear
multiple
at-least-one
v-bind="{
options: userGroupOptions,
multiple: true,
}"
:at-least-one="true"
:object-value="true"
@popup-visible-change="(value) => handleUserGroupChange(value, record)"
>

View File

@ -49,7 +49,6 @@
v-else
v-model:model-value="record.userRoleList"
:placeholder="t('system.user.createUserUserGroupPlaceholder')"
:options="userGroupOptions"
:search-keys="['name']"
:loading="record.selectUserGroupLoading"
:disabled="record.selectUserGroupLoading"
@ -61,8 +60,11 @@
label-key="name"
class="w-full max-w-[300px]"
allow-clear
multiple
at-least-one
v-bind="{
options: userGroupOptions,
multiple: true,
}"
:at-least-one="true"
:object-value="true"
@popup-visible-change="(value) => handleUserGroupChange(value, record)"
>