@blueking/bk-user-selector 0.0.29-beta.1 → 0.0.29-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@
3
3
  })(this, function(exports2, vue, bkuiVue) {
4
4
  "use strict";
5
5
  var __vite_style__ = document.createElement("style");
6
- __vite_style__.textContent = ".me-tag[data-v-9ccd9029] {\n position: absolute;\n top: 50%;\n right: 8px;\n z-index: 1;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n padding: 0 8px;\n font-size: 12px;\n color: #4d4f56;\n cursor: pointer;\n background-color: #e1ecff;\n border-radius: 50%;\n transform: translateY(-50%);\n}\n.me-tag[data-v-9ccd9029]:hover {\n color: #3a84ff;\n background-color: #cddffe;\n}\n.me-tag.disabled[data-v-9ccd9029] {\n color: #c4c6cc;\n cursor: not-allowed;\n background-color: #f0f1f5;\n}.dropdown-content[data-v-a4132257] {\n min-height: 40px;\n max-height: 300px;\n padding: 5px 0;\n overflow-y: auto;\n}\n.dropdown-content .no-data[data-v-a4132257] {\n padding: 10px;\n color: #979ba5;\n text-align: center;\n}\n.dropdown-content .user-group .group-header[data-v-a4132257] {\n display: flex;\n align-items: center;\n padding: 8px 12px;\n color: #979ba5;\n}\n.dropdown-content .user-group .group-header .group-count[data-v-a4132257] {\n margin-left: 4px;\n}\n.dropdown-content .user-option[data-v-a4132257] {\n display: flex;\n align-items: center;\n height: 32px;\n padding: 8px 12px;\n cursor: pointer;\n}\n.dropdown-content .user-option[data-v-a4132257]:hover {\n background-color: #f5f7fa;\n}.bk-user-selector-popover.bk-user-selector-pop2-content {\n padding: 0;\n}.user-tag[data-v-51944a49] {\n margin-right: 4px;\n margin-left: 0;\n}\n.user-tag.draggable[data-v-51944a49] {\n cursor: move;\n}\n.user-tag.active[data-v-51944a49] {\n background-color: #e1ecff;\n border-color: #3a84ff;\n}\n.user-tag .tag-content .user-name[data-v-51944a49] {\n overflow: hidden;\n font-size: 12px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}.multiple-selector[data-v-bebe517d] {\n position: relative;\n width: 100%;\n}\n.multiple-selector.is-disabled[data-v-bebe517d] {\n pointer-events: none;\n}\n.multiple-selector .tags-container[data-v-bebe517d] {\n min-height: 32px;\n padding: 1px 10px 1px 8px;\n background-color: #fff;\n border: 1px solid #c4c6cc;\n border-radius: 2px;\n transition: all 0.2s ease;\n}\n.multiple-selector .tags-container.focused[data-v-bebe517d] {\n border-color: #3a84ff;\n box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);\n}\n.multiple-selector .tags-container.collapsed[data-v-bebe517d] {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n}\n.multiple-selector .tag-list[data-v-bebe517d] {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n}\n.multiple-selector .tag-wrapper[data-v-bebe517d] {\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n}\n.multiple-selector .search-input[data-v-bebe517d] {\n min-width: 10px;\n height: 28px;\n background: transparent;\n border: none;\n outline: none;\n}\n.multiple-selector .search-input[data-v-bebe517d]::placeholder {\n color: #c4c6cc;\n}\n.multiple-selector .search-input.inline[data-v-bebe517d] {\n min-width: 10px;\n}\n.multiple-selector .search-input.last[data-v-bebe517d], .multiple-selector .search-input.collapsed[data-v-bebe517d] {\n flex: 1;\n min-width: 60px;\n}.single-selector[data-v-67f2ee6a] {\n position: relative;\n width: 100%;\n}\n.single-selector.is-disabled[data-v-67f2ee6a] {\n pointer-events: none;\n}\n.input-container[data-v-67f2ee6a] {\n position: relative;\n display: flex;\n align-items: center;\n min-height: 32px;\n padding: 0 8px;\n background-color: #fff;\n border: 1px solid #c4c6cc;\n border-radius: 2px;\n}\n.input-container[data-v-67f2ee6a]:focus-within {\n border-color: #3a84ff;\n box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);\n}\n.search-input[data-v-67f2ee6a] {\n flex: 1;\n height: 30px;\n background: transparent;\n border: none;\n outline: none;\n}\n.search-input[data-v-67f2ee6a]::placeholder {\n color: #c4c6cc;\n}.bk-user-selector[data-v-30b84150] {\n position: relative;\n width: 100%;\n font-size: 12px;\n}\n.bk-user-selector.is-disabled[data-v-30b84150] {\n cursor: not-allowed;\n background-color: #dcdee5;\n}";
6
+ __vite_style__.textContent = ".me-tag[data-v-9ccd9029] {\n position: absolute;\n top: 50%;\n right: 8px;\n z-index: 1;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n padding: 0 8px;\n font-size: 12px;\n color: #4d4f56;\n cursor: pointer;\n background-color: #e1ecff;\n border-radius: 50%;\n transform: translateY(-50%);\n}\n.me-tag[data-v-9ccd9029]:hover {\n color: #3a84ff;\n background-color: #cddffe;\n}\n.me-tag.disabled[data-v-9ccd9029] {\n color: #c4c6cc;\n cursor: not-allowed;\n background-color: #f0f1f5;\n}.dropdown-content[data-v-6380faf5] {\n min-height: 40px;\n max-height: 300px;\n padding: 5px 0;\n overflow-y: auto;\n}\n.dropdown-content .no-data[data-v-6380faf5] {\n padding: 10px;\n color: #979ba5;\n text-align: center;\n}\n.dropdown-content .user-group .group-header[data-v-6380faf5] {\n display: flex;\n align-items: center;\n padding: 8px 12px;\n color: #979ba5;\n}\n.dropdown-content .user-group .group-header .group-count[data-v-6380faf5] {\n margin-left: 4px;\n}\n.dropdown-content .user-option[data-v-6380faf5] {\n display: flex;\n align-items: center;\n height: 32px;\n padding: 8px 12px;\n cursor: pointer;\n}\n.dropdown-content .user-option[data-v-6380faf5]:hover {\n background-color: #f5f7fa;\n}.bk-user-selector-popover.bk-user-selector-pop2-content {\n padding: 0;\n}.user-tag[data-v-51944a49] {\n margin-right: 4px;\n margin-left: 0;\n}\n.user-tag.draggable[data-v-51944a49] {\n cursor: move;\n}\n.user-tag.active[data-v-51944a49] {\n background-color: #e1ecff;\n border-color: #3a84ff;\n}\n.user-tag .tag-content .user-name[data-v-51944a49] {\n overflow: hidden;\n font-size: 12px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}.multiple-selector[data-v-69acfacb] {\n position: relative;\n width: 100%;\n}\n.multiple-selector.is-disabled[data-v-69acfacb] {\n pointer-events: none;\n}\n.multiple-selector .tags-container[data-v-69acfacb] {\n min-height: 32px;\n padding: 1px 10px 1px 8px;\n background-color: #fff;\n border: 1px solid #c4c6cc;\n border-radius: 2px;\n transition: all 0.2s ease;\n}\n.multiple-selector .tags-container.focused[data-v-69acfacb] {\n border-color: #3a84ff;\n box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);\n}\n.multiple-selector .tags-container.collapsed[data-v-69acfacb] {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n}\n.multiple-selector .tag-list[data-v-69acfacb] {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n}\n.multiple-selector .tag-wrapper[data-v-69acfacb] {\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n}\n.multiple-selector .search-input[data-v-69acfacb] {\n min-width: 10px;\n height: 28px;\n background: transparent;\n border: none;\n outline: none;\n}\n.multiple-selector .search-input[data-v-69acfacb]::placeholder {\n color: #c4c6cc;\n}\n.multiple-selector .search-input.inline[data-v-69acfacb] {\n min-width: 10px;\n}\n.multiple-selector .search-input.last[data-v-69acfacb], .multiple-selector .search-input.collapsed[data-v-69acfacb] {\n flex: 1;\n min-width: 60px;\n}.single-selector[data-v-d52d578d] {\n position: relative;\n width: 100%;\n}\n.single-selector.is-disabled[data-v-d52d578d] {\n pointer-events: none;\n}\n.input-container[data-v-d52d578d] {\n position: relative;\n display: flex;\n align-items: center;\n min-height: 32px;\n padding: 0 8px;\n background-color: #fff;\n border: 1px solid #c4c6cc;\n border-radius: 2px;\n}\n.input-container[data-v-d52d578d]:focus-within {\n border-color: #3a84ff;\n box-shadow: 0 0 0 2px rgba(58, 132, 255, 0.1);\n}\n.search-input[data-v-d52d578d] {\n flex: 1;\n height: 30px;\n background: transparent;\n border: none;\n outline: none;\n}\n.search-input[data-v-d52d578d]::placeholder {\n color: #c4c6cc;\n}.bk-user-selector[data-v-02466e5e] {\n position: relative;\n width: 100%;\n font-size: 12px;\n}\n.bk-user-selector.is-disabled[data-v-02466e5e] {\n cursor: not-allowed;\n background-color: #dcdee5;\n}";
7
7
  document.head.appendChild(__vite_style__);
8
8
  const generateCallbackName = () => {
9
9
  const timestamp = Date.now();
@@ -13,10 +13,15 @@
13
13
  const jsonpRequest = (requestUrl, options = {}) => {
14
14
  return new Promise((resolve, reject) => {
15
15
  const url = vue.unref(requestUrl);
16
- const { timeout = 1e3 * 60 * 2, params } = options;
16
+ const { timeout = 1e3 * 60 * 2, params, withCredentials = true } = options;
17
17
  const callbackName = generateCallbackName();
18
18
  const script = document.createElement("script");
19
19
  let timeoutId;
20
+ if (withCredentials) {
21
+ script.crossOrigin = "use-credentials";
22
+ } else {
23
+ script.crossOrigin = "anonymous";
24
+ }
20
25
  const cleanup = () => {
21
26
  if (timeoutId) {
22
27
  clearTimeout(timeoutId);
@@ -30,7 +35,7 @@
30
35
  };
31
36
  window[callbackName] = (data) => {
32
37
  cleanup();
33
- resolve(data);
38
+ resolve(data.data || data);
34
39
  };
35
40
  timeoutId = setTimeout(() => {
36
41
  cleanup();
@@ -46,48 +51,6 @@
46
51
  document.head.appendChild(script);
47
52
  });
48
53
  };
49
- const useJSONP = (url, options = {}) => {
50
- const data = vue.shallowRef(null);
51
- const loading = vue.shallowRef(false);
52
- const error = vue.shallowRef(null);
53
- let abortFlag = false;
54
- const executeRequest = async (requestUrl) => {
55
- if (!requestUrl) return;
56
- loading.value = true;
57
- error.value = null;
58
- abortFlag = false;
59
- try {
60
- const result = await jsonpRequest(requestUrl, options);
61
- if (!abortFlag) {
62
- data.value = result;
63
- }
64
- } catch (err) {
65
- if (!abortFlag) {
66
- const errorObj = err instanceof Error ? err : new Error(String(err));
67
- error.value = errorObj;
68
- }
69
- } finally {
70
- if (!abortFlag) {
71
- loading.value = false;
72
- }
73
- }
74
- };
75
- const stopWatcher = vue.watchEffect(() => {
76
- executeRequest(vue.unref(url));
77
- });
78
- vue.onScopeDispose(() => {
79
- abortFlag = true;
80
- stopWatcher();
81
- });
82
- return {
83
- data,
84
- loading,
85
- error,
86
- refetch: () => {
87
- executeRequest(vue.unref(url));
88
- }
89
- };
90
- };
91
54
  const getTenants = async (apiBaseUrl, tenantId) => {
92
55
  if (!apiBaseUrl || !tenantId) {
93
56
  console.warn("获取租户信息需要提供有效的apiBaseUrl和租户ID");
@@ -114,7 +77,7 @@
114
77
  };
115
78
  const searchUsers = async (params) => {
116
79
  const { apiBaseUrl, tenantId, keyword, enableMultiTenantMode = true } = params;
117
- if (enableMultiTenantMode) {
80
+ if (!enableMultiTenantMode) {
118
81
  const userList = await getUserList(apiBaseUrl, {
119
82
  keyword,
120
83
  pageSize: 100,
@@ -150,13 +113,13 @@
150
113
  const lookupUsers = async (params) => {
151
114
  const { apiBaseUrl, tenantId, exactSearchKey = "bk_username", usersList = [], enableMultiTenantMode = true } = params;
152
115
  const users = usersList.filter((user) => user).map((user) => user.trim());
153
- if (enableMultiTenantMode) {
116
+ if (!enableMultiTenantMode) {
154
117
  const userList = await getUserList(apiBaseUrl, {
155
118
  userIds: users
156
119
  }).catch(() => {
157
120
  return [];
158
121
  });
159
- return userList;
122
+ return users.map((user) => userList.find((u) => u.username === user)).filter(Boolean);
160
123
  }
161
124
  if (users.length === 0 || !apiBaseUrl || !tenantId) {
162
125
  console.warn("批量查找用户需要提供有效的apiBaseUrl、租户ID和至少一个用户名");
@@ -181,18 +144,26 @@
181
144
  return [];
182
145
  }
183
146
  };
184
- const formatUsers = (users) => {
147
+ const formatUsers = (users, enableMultiTenantMode = true) => {
185
148
  if (!users || !Array.isArray(users)) return [];
149
+ if (!enableMultiTenantMode) {
150
+ return users.map((user) => ({
151
+ ...user,
152
+ id: user.username,
153
+ name: `${user.display_name}(${user.username})`,
154
+ tenantId: user.owner_tenant_id
155
+ }));
156
+ }
186
157
  return users.map((user) => ({
187
- id: user.bk_username || user.username,
158
+ id: user.bk_username,
188
159
  name: user.display_name,
189
160
  tenantId: user.owner_tenant_id,
190
161
  ...user
191
162
  }));
192
163
  };
193
164
  const getUserList = async (url, params) => {
194
- const { userIds, keyword, pageSize, page, appCode } = params;
195
- const { data: userList } = await useJSONP(url, {
165
+ const { userIds, keyword, pageSize = 20, page, appCode } = params;
166
+ const data = await jsonpRequest(url, {
196
167
  params: {
197
168
  exact_lookups: (userIds == null ? void 0 : userIds.join(",")) || void 0,
198
169
  fuzzy_lookups: keyword || void 0,
@@ -201,9 +172,9 @@
201
172
  app_code: appCode || "bk-magicbox"
202
173
  }
203
174
  });
204
- return userList.value || [];
175
+ return (data == null ? void 0 : data.results) || [];
205
176
  };
206
- const useTenantData = (apiBaseUrl, tenantId) => {
177
+ const useTenantData = (apiBaseUrl, tenantId, enableMultiTenantMode = true) => {
207
178
  const tenants = vue.ref({});
208
179
  const loading = vue.ref(false);
209
180
  const fetchTenants = async () => {
@@ -228,7 +199,9 @@
228
199
  }
229
200
  };
230
201
  vue.onBeforeMount(() => {
231
- fetchTenants();
202
+ if (enableMultiTenantMode) {
203
+ fetchTenants();
204
+ }
232
205
  });
233
206
  return {
234
207
  tenants,
@@ -3034,7 +3007,7 @@
3034
3007
  }
3035
3008
  return Math.max(1, visibleCount);
3036
3009
  };
3037
- const useUserSearch = (apiBaseUrl, tenantId) => {
3010
+ const useUserSearch = (apiBaseUrl, tenantId, enableMultiTenantMode = true) => {
3038
3011
  const searchResults = vue.ref([]);
3039
3012
  const loading = vue.ref(false);
3040
3013
  const searchQuery = vue.ref("");
@@ -3043,7 +3016,7 @@
3043
3016
  searchResults.value = [];
3044
3017
  return;
3045
3018
  }
3046
- if (!apiBaseUrl || !tenantId) {
3019
+ if (enableMultiTenantMode && (!apiBaseUrl || !tenantId)) {
3047
3020
  console.warn("执行用户搜索需要提供有效的API基础URL和租户ID");
3048
3021
  return;
3049
3022
  }
@@ -3053,9 +3026,9 @@
3053
3026
  apiBaseUrl,
3054
3027
  tenantId,
3055
3028
  keyword,
3056
- enableMultiTenantMode: true
3029
+ enableMultiTenantMode
3057
3030
  });
3058
- searchResults.value = formatUsers(results);
3031
+ searchResults.value = formatUsers(results, enableMultiTenantMode);
3059
3032
  } catch (error) {
3060
3033
  console.error("用户搜索失败:", error);
3061
3034
  searchResults.value = [];
@@ -3397,13 +3370,16 @@
3397
3370
  /* STABLE */
3398
3371
  }, 8, ["loading"])
3399
3372
  ]),
3400
- _: 1
3401
- /* STABLE */
3373
+ default: vue.withCtx(() => [
3374
+ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
3375
+ ]),
3376
+ _: 3
3377
+ /* FORWARDED */
3402
3378
  }, 8, ["is-show", "offset", "width"]);
3403
3379
  };
3404
3380
  }
3405
3381
  });
3406
- const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-a4132257"]]);
3382
+ const SelectionPopover = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-6380faf5"]]);
3407
3383
  const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
3408
3384
  ...{
3409
3385
  name: "UserTag"
@@ -3487,7 +3463,7 @@
3487
3463
  searchQuery,
3488
3464
  // clearSearch,
3489
3465
  handleSearchInput
3490
- } = useUserSearch(props.apiBaseUrl, props.tenantId);
3466
+ } = useUserSearch(props.apiBaseUrl, props.tenantId, props.enableMultiTenantMode);
3491
3467
  const containerRef = vue.ref(null);
3492
3468
  const tagsContainerRef = vue.ref(null);
3493
3469
  const sortableContainerRef = vue.ref(null);
@@ -3505,7 +3481,14 @@
3505
3481
  return searchResults.value.filter((user) => !props.selectedUsers.some((selectedUser) => selectedUser.id === user.id)).filter((user) => !props.excludeUserIds.includes(user.id));
3506
3482
  });
3507
3483
  const userGroupFilter = vue.computed(() => {
3508
- return props.userGroup.filter((group) => !props.selectedUsers.some((user) => user.id === group.id) && !group.hidden);
3484
+ return props.userGroup.filter((group) => {
3485
+ var _a, _b;
3486
+ const filtered = !props.selectedUsers.some((user) => user.id === group.id) && !group.hidden;
3487
+ if (filtered) {
3488
+ return ((_a = group.id) == null ? void 0 : _a.includes(searchQuery.value)) || ((_b = group.name) == null ? void 0 : _b.includes(searchQuery.value));
3489
+ }
3490
+ return false;
3491
+ });
3509
3492
  });
3510
3493
  const initSortable = () => {
3511
3494
  if (!props.draggable || !sortableContainerRef.value) return;
@@ -3614,7 +3597,7 @@
3614
3597
  usersList: [props.currentUserId],
3615
3598
  enableMultiTenantMode: props.enableMultiTenantMode
3616
3599
  });
3617
- const formattedUsers = formatUsers(result);
3600
+ const formattedUsers = formatUsers(result, props.enableMultiTenantMode);
3618
3601
  if (formattedUsers.length > 0) {
3619
3602
  if (!props.selectedUsers.some((item) => item.id === formattedUsers[0].id)) {
3620
3603
  emit("update:selectedUsers", [...props.selectedUsers, formattedUsers[0]]);
@@ -3642,7 +3625,7 @@
3642
3625
  usersList: users,
3643
3626
  enableMultiTenantMode: props.enableMultiTenantMode
3644
3627
  });
3645
- const formattedUsers = formatUsers(result);
3628
+ const formattedUsers = formatUsers(result, props.enableMultiTenantMode);
3646
3629
  if (formattedUsers.length > 0) {
3647
3630
  const updatedUsers = [...props.selectedUsers, ...formattedUsers];
3648
3631
  emit("update:selectedUsers", updatedUsers);
@@ -3745,210 +3728,215 @@
3745
3728
  class: vue.normalizeClass(["multiple-selector", { "is-disabled": _ctx.disabled }])
3746
3729
  },
3747
3730
  [
3748
- vue.createCommentVNode(" 聚焦状态 - 可编辑模式 "),
3749
- isFocused.value ? (vue.openBlock(), vue.createElementBlock(
3750
- "div",
3751
- {
3752
- key: 0,
3753
- ref_key: "tagsContainerRef",
3754
- ref: tagsContainerRef,
3755
- class: "tags-container focused",
3756
- onClick: vue.withModifiers(handleContainerClick, ["stop"])
3757
- },
3758
- [
3759
- vue.createCommentVNode(" 用户标签列表 "),
3760
- vue.createElementVNode(
3731
+ vue.createCommentVNode(" 下拉选项列表 "),
3732
+ vue.createVNode(SelectionPopover, {
3733
+ "container-width": containerRef.value ? containerRef.value.offsetWidth : "auto",
3734
+ "cross-axis-offset": crossAxisOffset.value,
3735
+ "empty-text": _ctx.emptyText,
3736
+ "is-show": showDropdown.value,
3737
+ loading: vue.unref(searchLoading),
3738
+ options: options.value,
3739
+ "render-list-item": _ctx.renderListItem,
3740
+ "search-query": vue.unref(searchQuery),
3741
+ "tenant-id": _ctx.tenantId,
3742
+ tenants: _ctx.tenants,
3743
+ "user-group": userGroupFilter.value,
3744
+ "user-group-name": _ctx.userGroupName,
3745
+ onClickOutside: handleClickOutside,
3746
+ onSelectUser: addUser
3747
+ }, {
3748
+ default: vue.withCtx(() => [
3749
+ vue.createCommentVNode(" 聚焦状态 - 可编辑模式 "),
3750
+ isFocused.value ? (vue.openBlock(), vue.createElementBlock(
3761
3751
  "div",
3762
3752
  {
3763
- ref_key: "sortableContainerRef",
3764
- ref: sortableContainerRef,
3765
- class: "tag-list"
3753
+ key: 0,
3754
+ ref_key: "tagsContainerRef",
3755
+ ref: tagsContainerRef,
3756
+ class: "tags-container focused",
3757
+ onClick: vue.withModifiers(handleContainerClick, ["stop"])
3766
3758
  },
3767
3759
  [
3768
- (vue.openBlock(true), vue.createElementBlock(
3769
- vue.Fragment,
3770
- null,
3771
- vue.renderList(_ctx.selectedUsers, (user, index) => {
3772
- return vue.openBlock(), vue.createElementBlock("div", {
3773
- class: "tag-wrapper",
3774
- key: user.id,
3775
- onClick: vue.withModifiers(($event) => handleTagClick(index), ["stop"])
3776
- }, [
3777
- vue.createVNode(UserTag, {
3778
- active: index === activeTagIndex.value,
3779
- "current-tenant-id": _ctx.tenantId,
3780
- draggable: _ctx.draggable,
3781
- "render-tag": _ctx.renderTag,
3782
- tenants: _ctx.tenants,
3783
- user,
3784
- onClick: ($event) => handleTagClick(index),
3785
- onClose: ($event) => removeUser(user)
3786
- }, null, 8, ["active", "current-tenant-id", "draggable", "render-tag", "tenants", "user", "onClick", "onClose"]),
3787
- vue.createCommentVNode(" 在当前激活标签后插入输入框 "),
3788
- index === activeTagIndex.value && activeTagIndex.value !== _ctx.selectedUsers.length - 1 ? vue.withDirectives((vue.openBlock(), vue.createElementBlock(
3789
- "input",
3790
- {
3791
- key: 0,
3792
- ref_for: true,
3793
- ref_key: "inlineInputRef",
3794
- ref: inlineInputRef,
3795
- class: "search-input inline",
3796
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(searchQuery) ? searchQuery.value = $event : null),
3797
- onFocus: handleInputFocus,
3798
- onInput: handleInput,
3799
- onKeydown: handleKeyDown,
3800
- onPaste: handlePaste
3801
- },
3802
- null,
3803
- 544
3804
- /* NEED_HYDRATION, NEED_PATCH */
3805
- )), [
3806
- [vue.vModelText, vue.unref(searchQuery)]
3807
- ]) : vue.createCommentVNode("v-if", true)
3808
- ], 8, _hoisted_1$1);
3809
- }),
3810
- 128
3811
- /* KEYED_FRAGMENT */
3812
- )),
3813
- vue.createCommentVNode(" 最后一个输入框 "),
3814
- activeTagIndex.value === -1 || activeTagIndex.value === _ctx.selectedUsers.length - 1 ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
3815
- key: 0,
3816
- ref_key: "lastInputRef",
3817
- ref: lastInputRef,
3818
- class: "search-input last",
3819
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(searchQuery) ? searchQuery.value = $event : null),
3820
- placeholder: !_ctx.selectedUsers.length ? _ctx.placeholder : "",
3821
- onFocus: handleInputFocus,
3822
- onInput: handleInput,
3823
- onKeydown: handleKeyDown,
3824
- onPaste: handlePaste
3825
- }, null, 40, _hoisted_2$1)), [
3826
- [vue.vModelText, vue.unref(searchQuery)]
3827
- ]) : vue.createCommentVNode("v-if", true),
3828
- vue.createCommentVNode(' "我"标签 '),
3829
- vue.createVNode(MeTag, {
3830
- "current-user-id": _ctx.currentUserId,
3831
- "is-disabled": !!_ctx.currentUserId && _ctx.selectedUsers.some((user) => user.id === _ctx.currentUserId),
3832
- onClick: addCurrentUser
3833
- }, null, 8, ["current-user-id", "is-disabled"])
3760
+ vue.createCommentVNode(" 用户标签列表 "),
3761
+ vue.createElementVNode(
3762
+ "div",
3763
+ {
3764
+ ref_key: "sortableContainerRef",
3765
+ ref: sortableContainerRef,
3766
+ class: "tag-list"
3767
+ },
3768
+ [
3769
+ (vue.openBlock(true), vue.createElementBlock(
3770
+ vue.Fragment,
3771
+ null,
3772
+ vue.renderList(_ctx.selectedUsers, (user, index) => {
3773
+ return vue.openBlock(), vue.createElementBlock("div", {
3774
+ class: "tag-wrapper",
3775
+ key: user.id,
3776
+ onClick: vue.withModifiers(($event) => handleTagClick(index), ["stop"])
3777
+ }, [
3778
+ vue.createVNode(UserTag, {
3779
+ active: index === activeTagIndex.value,
3780
+ "current-tenant-id": _ctx.tenantId,
3781
+ draggable: _ctx.draggable,
3782
+ "render-tag": _ctx.renderTag,
3783
+ tenants: _ctx.tenants,
3784
+ user,
3785
+ onClick: ($event) => handleTagClick(index),
3786
+ onClose: ($event) => removeUser(user)
3787
+ }, null, 8, ["active", "current-tenant-id", "draggable", "render-tag", "tenants", "user", "onClick", "onClose"]),
3788
+ vue.createCommentVNode(" 在当前激活标签后插入输入框 "),
3789
+ index === activeTagIndex.value && activeTagIndex.value !== _ctx.selectedUsers.length - 1 ? vue.withDirectives((vue.openBlock(), vue.createElementBlock(
3790
+ "input",
3791
+ {
3792
+ key: 0,
3793
+ ref_for: true,
3794
+ ref_key: "inlineInputRef",
3795
+ ref: inlineInputRef,
3796
+ class: "search-input inline",
3797
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(searchQuery) ? searchQuery.value = $event : null),
3798
+ onFocus: handleInputFocus,
3799
+ onInput: handleInput,
3800
+ onKeydown: handleKeyDown,
3801
+ onPaste: handlePaste
3802
+ },
3803
+ null,
3804
+ 544
3805
+ /* NEED_HYDRATION, NEED_PATCH */
3806
+ )), [
3807
+ [vue.vModelText, vue.unref(searchQuery)]
3808
+ ]) : vue.createCommentVNode("v-if", true)
3809
+ ], 8, _hoisted_1$1);
3810
+ }),
3811
+ 128
3812
+ /* KEYED_FRAGMENT */
3813
+ )),
3814
+ vue.createCommentVNode(" 最后一个输入框 "),
3815
+ activeTagIndex.value === -1 || activeTagIndex.value === _ctx.selectedUsers.length - 1 ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
3816
+ key: 0,
3817
+ ref_key: "lastInputRef",
3818
+ ref: lastInputRef,
3819
+ class: "search-input last",
3820
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(searchQuery) ? searchQuery.value = $event : null),
3821
+ placeholder: !_ctx.selectedUsers.length ? _ctx.placeholder : "",
3822
+ onFocus: handleInputFocus,
3823
+ onInput: handleInput,
3824
+ onKeydown: handleKeyDown,
3825
+ onPaste: handlePaste
3826
+ }, null, 40, _hoisted_2$1)), [
3827
+ [vue.vModelText, vue.unref(searchQuery)]
3828
+ ]) : vue.createCommentVNode("v-if", true),
3829
+ vue.createCommentVNode(' "我"标签 '),
3830
+ vue.createVNode(MeTag, {
3831
+ "current-user-id": _ctx.currentUserId,
3832
+ "is-disabled": !!_ctx.currentUserId && _ctx.selectedUsers.some((user) => user.id === _ctx.currentUserId),
3833
+ onClick: addCurrentUser
3834
+ }, null, 8, ["current-user-id", "is-disabled"])
3835
+ ],
3836
+ 512
3837
+ /* NEED_PATCH */
3838
+ )
3834
3839
  ],
3835
3840
  512
3836
3841
  /* NEED_PATCH */
3837
- )
3838
- ],
3839
- 512
3840
- /* NEED_PATCH */
3841
- )) : (vue.openBlock(), vue.createElementBlock(
3842
- vue.Fragment,
3843
- { key: 1 },
3844
- [
3845
- vue.createCommentVNode(" 未聚焦状态 - 只读展示模式 "),
3846
- vue.createElementVNode(
3847
- "div",
3848
- {
3849
- ref_key: "collapsedContainerRef",
3850
- ref: collapsedContainerRef,
3851
- class: "tags-container collapsed",
3852
- onClick: vue.withModifiers(handleFocus, ["stop"])
3853
- },
3842
+ )) : (vue.openBlock(), vue.createElementBlock(
3843
+ vue.Fragment,
3844
+ { key: 1 },
3854
3845
  [
3855
- (vue.openBlock(true), vue.createElementBlock(
3856
- vue.Fragment,
3857
- null,
3858
- vue.renderList(visibleUsers.value, (user) => {
3859
- return vue.openBlock(), vue.createBlock(UserTag, {
3860
- "current-tenant-id": _ctx.tenantId,
3861
- key: user.id,
3862
- "render-tag": _ctx.renderTag,
3863
- "show-tenant": true,
3864
- tenants: _ctx.tenants,
3865
- user,
3866
- onClick: handleFocus,
3867
- onClose: ($event) => removeUser(user)
3868
- }, null, 8, ["current-tenant-id", "render-tag", "tenants", "user", "onClose"]);
3869
- }),
3870
- 128
3871
- /* KEYED_FRAGMENT */
3872
- )),
3873
- vue.createCommentVNode(" 显示折叠标签数量 "),
3874
- hiddenCount.value > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(bkuiVue.Popover), {
3875
- key: 0,
3876
- placement: "top"
3877
- }, {
3878
- content: vue.withCtx(() => [
3846
+ vue.createCommentVNode(" 未聚焦状态 - 只读展示模式 "),
3847
+ vue.createElementVNode(
3848
+ "div",
3849
+ {
3850
+ ref_key: "collapsedContainerRef",
3851
+ ref: collapsedContainerRef,
3852
+ class: "tags-container collapsed",
3853
+ onClick: vue.withModifiers(handleFocus, ["stop"])
3854
+ },
3855
+ [
3879
3856
  (vue.openBlock(true), vue.createElementBlock(
3880
3857
  vue.Fragment,
3881
3858
  null,
3882
- vue.renderList(_ctx.selectedUsers.slice(visibleUsers.value.length), (user) => {
3883
- return vue.openBlock(), vue.createBlock(vue.unref(UserRender), {
3859
+ vue.renderList(visibleUsers.value, (user) => {
3860
+ return vue.openBlock(), vue.createBlock(UserTag, {
3861
+ "current-tenant-id": _ctx.tenantId,
3884
3862
  key: user.id,
3885
- "tenant-id": _ctx.tenantId,
3863
+ "render-tag": _ctx.renderTag,
3864
+ "show-tenant": true,
3886
3865
  tenants: _ctx.tenants,
3887
- user
3888
- }, null, 8, ["tenant-id", "tenants", "user"]);
3866
+ user,
3867
+ onClick: handleFocus,
3868
+ onClose: ($event) => removeUser(user)
3869
+ }, null, 8, ["current-tenant-id", "render-tag", "tenants", "user", "onClose"]);
3889
3870
  }),
3890
3871
  128
3891
3872
  /* KEYED_FRAGMENT */
3892
- ))
3893
- ]),
3894
- default: vue.withCtx(() => [
3895
- vue.createVNode(vue.unref(bkuiVue.Tag), null, {
3873
+ )),
3874
+ vue.createCommentVNode(" 显示折叠标签数量 "),
3875
+ hiddenCount.value > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(bkuiVue.Popover), {
3876
+ key: 0,
3877
+ placement: "top"
3878
+ }, {
3879
+ content: vue.withCtx(() => [
3880
+ (vue.openBlock(true), vue.createElementBlock(
3881
+ vue.Fragment,
3882
+ null,
3883
+ vue.renderList(_ctx.selectedUsers.slice(visibleUsers.value.length), (user) => {
3884
+ return vue.openBlock(), vue.createBlock(vue.unref(UserRender), {
3885
+ key: user.id,
3886
+ "tenant-id": _ctx.tenantId,
3887
+ tenants: _ctx.tenants,
3888
+ user
3889
+ }, null, 8, ["tenant-id", "tenants", "user"]);
3890
+ }),
3891
+ 128
3892
+ /* KEYED_FRAGMENT */
3893
+ ))
3894
+ ]),
3896
3895
  default: vue.withCtx(() => [
3897
- vue.createTextVNode(
3898
- " +" + vue.toDisplayString(hiddenCount.value),
3899
- 1
3900
- /* TEXT */
3901
- )
3896
+ vue.createVNode(vue.unref(bkuiVue.Tag), null, {
3897
+ default: vue.withCtx(() => [
3898
+ vue.createTextVNode(
3899
+ " +" + vue.toDisplayString(hiddenCount.value),
3900
+ 1
3901
+ /* TEXT */
3902
+ )
3903
+ ]),
3904
+ _: 1
3905
+ /* STABLE */
3906
+ })
3902
3907
  ]),
3903
3908
  _: 1
3904
3909
  /* STABLE */
3905
- })
3906
- ]),
3907
- _: 1
3908
- /* STABLE */
3909
- })) : vue.createCommentVNode("v-if", true),
3910
- vue.createCommentVNode(" 搜索输入框 "),
3911
- vue.withDirectives(vue.createElementVNode("input", {
3912
- ref_key: "collapsedInputRef",
3913
- ref: collapsedInputRef,
3914
- class: "search-input collapsed",
3915
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(searchQuery) ? searchQuery.value = $event : null),
3916
- placeholder: !_ctx.selectedUsers.length ? _ctx.placeholder : "",
3917
- onFocus: handleFocus
3918
- }, null, 40, _hoisted_3), [
3919
- [vue.vModelText, vue.unref(searchQuery)]
3920
- ]),
3921
- vue.createCommentVNode(' 未聚焦状态下的"我"标签 '),
3922
- vue.createVNode(MeTag, {
3923
- "current-user-id": _ctx.currentUserId,
3924
- "is-disabled": !!_ctx.currentUserId && _ctx.selectedUsers.some((user) => user[props.exactSearchKey] === _ctx.currentUserId),
3925
- onClick: addCurrentUser
3926
- }, null, 8, ["current-user-id", "is-disabled"])
3910
+ })) : vue.createCommentVNode("v-if", true),
3911
+ vue.createCommentVNode(" 搜索输入框 "),
3912
+ vue.withDirectives(vue.createElementVNode("input", {
3913
+ ref_key: "collapsedInputRef",
3914
+ ref: collapsedInputRef,
3915
+ class: "search-input collapsed",
3916
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(searchQuery) ? searchQuery.value = $event : null),
3917
+ placeholder: !_ctx.selectedUsers.length ? _ctx.placeholder : "",
3918
+ onFocus: handleFocus
3919
+ }, null, 40, _hoisted_3), [
3920
+ [vue.vModelText, vue.unref(searchQuery)]
3921
+ ]),
3922
+ vue.createCommentVNode(' 未聚焦状态下的"我"标签 '),
3923
+ vue.createVNode(MeTag, {
3924
+ "current-user-id": _ctx.currentUserId,
3925
+ "is-disabled": !!_ctx.currentUserId && _ctx.selectedUsers.some((user) => user[props.exactSearchKey] === _ctx.currentUserId),
3926
+ onClick: addCurrentUser
3927
+ }, null, 8, ["current-user-id", "is-disabled"])
3928
+ ],
3929
+ 512
3930
+ /* NEED_PATCH */
3931
+ )
3927
3932
  ],
3928
- 512
3929
- /* NEED_PATCH */
3930
- )
3931
- ],
3932
- 2112
3933
- /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
3934
- )),
3935
- vue.createCommentVNode(" 下拉选项列表 "),
3936
- vue.createVNode(SelectionPopover, {
3937
- "container-width": containerRef.value ? containerRef.value.offsetWidth : "auto",
3938
- "cross-axis-offset": crossAxisOffset.value,
3939
- "empty-text": _ctx.emptyText,
3940
- "is-show": showDropdown.value,
3941
- loading: vue.unref(searchLoading),
3942
- options: options.value,
3943
- "render-list-item": _ctx.renderListItem,
3944
- "search-query": vue.unref(searchQuery),
3945
- "tenant-id": _ctx.tenantId,
3946
- tenants: _ctx.tenants,
3947
- "user-group": userGroupFilter.value,
3948
- "user-group-name": _ctx.userGroupName,
3949
- onClickOutside: handleClickOutside,
3950
- onSelectUser: addUser
3951
- }, null, 8, ["container-width", "cross-axis-offset", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
3933
+ 2112
3934
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
3935
+ ))
3936
+ ]),
3937
+ _: 1
3938
+ /* STABLE */
3939
+ }, 8, ["container-width", "cross-axis-offset", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
3952
3940
  ],
3953
3941
  2
3954
3942
  /* CLASS */
@@ -3956,7 +3944,7 @@
3956
3944
  };
3957
3945
  }
3958
3946
  });
3959
- const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-bebe517d"]]);
3947
+ const MultipleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-69acfacb"]]);
3960
3948
  const _hoisted_1 = { class: "input-container" };
3961
3949
  const _hoisted_2 = ["placeholder"];
3962
3950
  const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
@@ -3993,7 +3981,14 @@
3993
3981
  const searchQuery = vue.ref("");
3994
3982
  const showDropdown = vue.ref(false);
3995
3983
  const userGroupFilter = vue.computed(() => {
3996
- return props.userGroup.filter((group) => group.id !== selectedUser.value && !group.hidden);
3984
+ return props.userGroup.filter((group) => {
3985
+ var _a, _b;
3986
+ const filtered = group.id !== selectedUser.value && !group.hidden;
3987
+ if (filtered) {
3988
+ return ((_a = group.id) == null ? void 0 : _a.includes(searchQuery.value)) || ((_b = group.name) == null ? void 0 : _b.includes(searchQuery.value));
3989
+ }
3990
+ return false;
3991
+ });
3997
3992
  });
3998
3993
  const selectedUserInfo = vue.computed(() => {
3999
3994
  const userGroup = (props.userGroup || []).map((group) => ({
@@ -4017,7 +4012,9 @@
4017
4012
  usersList: [props.modelValue],
4018
4013
  enableMultiTenantMode: props.enableMultiTenantMode
4019
4014
  });
4020
- options.value = formatUsers(result).filter((user) => !props.excludeUserIds.includes(user.id));
4015
+ options.value = formatUsers(result, props.enableMultiTenantMode).filter(
4016
+ (user) => !props.excludeUserIds.includes(user.id)
4017
+ );
4021
4018
  if (props.userGroup.length > 0) {
4022
4019
  const groupResult = props.userGroup.filter((group) => group.id == props.modelValue);
4023
4020
  options.value = groupResult.map((group) => ({
@@ -4048,7 +4045,7 @@
4048
4045
  usersList: [props.currentUserId],
4049
4046
  enableMultiTenantMode: props.enableMultiTenantMode
4050
4047
  });
4051
- const formattedResults = formatUsers(result);
4048
+ const formattedResults = formatUsers(result, props.enableMultiTenantMode);
4052
4049
  if (formattedResults.length > 0) {
4053
4050
  options.value = formattedResults.filter((user) => !props.excludeUserIds.includes(user.id));
4054
4051
  addUser(formattedResults[0]);
@@ -4070,7 +4067,7 @@
4070
4067
  keyword,
4071
4068
  enableMultiTenantMode: props.enableMultiTenantMode
4072
4069
  });
4073
- options.value = formatUsers(result).filter((user) => !selectedUser.value || user.id !== selectedUser.value).filter((user) => !props.excludeUserIds.includes(user.id));
4070
+ options.value = formatUsers(result, props.enableMultiTenantMode).filter((user) => !selectedUser.value || user.id !== selectedUser.value).filter((user) => !props.excludeUserIds.includes(user.id));
4074
4071
  } catch (error) {
4075
4072
  console.error("获取用户列表失败:", error);
4076
4073
  options.value = [];
@@ -4117,39 +4114,6 @@
4117
4114
  class: vue.normalizeClass(["single-selector", { "is-disabled": _ctx.disabled }])
4118
4115
  },
4119
4116
  [
4120
- vue.createCommentVNode(" 输入框 "),
4121
- vue.createElementVNode("div", _hoisted_1, [
4122
- vue.createCommentVNode(" 用户标签显示 "),
4123
- selectedUserInfo.value ? (vue.openBlock(), vue.createElementBlock("div", {
4124
- key: 0,
4125
- onClick: vue.withModifiers(removeSelectedUser, ["stop"])
4126
- }, [
4127
- vue.createVNode(UserTag, {
4128
- "current-tenant-id": _ctx.tenantId,
4129
- "render-tag": _ctx.renderTag,
4130
- tenants: _ctx.tenants,
4131
- user: selectedUserInfo.value,
4132
- onClose: removeSelectedUser
4133
- }, null, 8, ["current-tenant-id", "render-tag", "tenants", "user"])
4134
- ])) : vue.createCommentVNode("v-if", true),
4135
- vue.withDirectives(vue.createElementVNode("input", {
4136
- ref_key: "inputRef",
4137
- ref: inputRef,
4138
- class: "search-input",
4139
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
4140
- placeholder: selectedUserInfo.value ? "" : _ctx.placeholder,
4141
- onFocus: handleInputFocus,
4142
- onInput: handleInput
4143
- }, null, 40, _hoisted_2), [
4144
- [vue.vModelText, searchQuery.value]
4145
- ]),
4146
- vue.createCommentVNode(' "我"标签 '),
4147
- vue.createVNode(MeTag, {
4148
- "current-user-id": _ctx.currentUserId,
4149
- "is-disabled": !!_ctx.currentUserId && !!selectedUserInfo.value && selectedUserInfo.value[_ctx.exactSearchKey] === _ctx.currentUserId,
4150
- onClick: addCurrentUser
4151
- }, null, 8, ["current-user-id", "is-disabled"])
4152
- ]),
4153
4117
  vue.createCommentVNode(" 使用新的公共下拉选项组件 "),
4154
4118
  vue.createVNode(SelectionPopover, {
4155
4119
  "container-width": containerRef.value ? containerRef.value.offsetWidth : "auto",
@@ -4164,7 +4128,45 @@
4164
4128
  "user-group": userGroupFilter.value,
4165
4129
  "user-group-name": _ctx.userGroupName,
4166
4130
  onSelectUser: addUser
4167
- }, null, 8, ["container-width", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
4131
+ }, {
4132
+ default: vue.withCtx(() => [
4133
+ vue.createCommentVNode(" 输入框 "),
4134
+ vue.createElementVNode("div", _hoisted_1, [
4135
+ vue.createCommentVNode(" 用户标签显示 "),
4136
+ selectedUserInfo.value ? (vue.openBlock(), vue.createElementBlock("div", {
4137
+ key: 0,
4138
+ onClick: vue.withModifiers(removeSelectedUser, ["stop"])
4139
+ }, [
4140
+ vue.createVNode(UserTag, {
4141
+ "current-tenant-id": _ctx.tenantId,
4142
+ "render-tag": _ctx.renderTag,
4143
+ tenants: _ctx.tenants,
4144
+ user: selectedUserInfo.value,
4145
+ onClose: removeSelectedUser
4146
+ }, null, 8, ["current-tenant-id", "render-tag", "tenants", "user"])
4147
+ ])) : vue.createCommentVNode("v-if", true),
4148
+ vue.withDirectives(vue.createElementVNode("input", {
4149
+ ref_key: "inputRef",
4150
+ ref: inputRef,
4151
+ class: "search-input",
4152
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchQuery.value = $event),
4153
+ placeholder: selectedUserInfo.value ? "" : _ctx.placeholder,
4154
+ onFocus: handleInputFocus,
4155
+ onInput: handleInput
4156
+ }, null, 40, _hoisted_2), [
4157
+ [vue.vModelText, searchQuery.value]
4158
+ ]),
4159
+ vue.createCommentVNode(' "我"标签 '),
4160
+ vue.createVNode(MeTag, {
4161
+ "current-user-id": _ctx.currentUserId,
4162
+ "is-disabled": !!_ctx.currentUserId && !!selectedUserInfo.value && selectedUserInfo.value[_ctx.exactSearchKey] === _ctx.currentUserId,
4163
+ onClick: addCurrentUser
4164
+ }, null, 8, ["current-user-id", "is-disabled"])
4165
+ ])
4166
+ ]),
4167
+ _: 1
4168
+ /* STABLE */
4169
+ }, 8, ["container-width", "empty-text", "is-show", "loading", "options", "render-list-item", "search-query", "tenant-id", "tenants", "user-group", "user-group-name"])
4168
4170
  ],
4169
4171
  2
4170
4172
  /* CLASS */
@@ -4174,7 +4176,7 @@
4174
4176
  };
4175
4177
  }
4176
4178
  });
4177
- const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-67f2ee6a"]]);
4179
+ const SingleSelector = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-d52d578d"]]);
4178
4180
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4179
4181
  ...{
4180
4182
  name: "BkUserSelector"
@@ -4196,7 +4198,7 @@
4196
4198
  renderListItem: {},
4197
4199
  renderTag: {},
4198
4200
  excludeUserIds: { default: () => [] },
4199
- enableMultiTenantMode: { type: Boolean, default: false }
4201
+ enableMultiTenantMode: { type: Boolean, default: true }
4200
4202
  },
4201
4203
  emits: ["update:modelValue", "change"],
4202
4204
  setup(__props, { emit: __emit }) {
@@ -4205,7 +4207,7 @@
4205
4207
  });
4206
4208
  const props = __props;
4207
4209
  const emit = __emit;
4208
- const { tenants = {} } = useTenantData(props.apiBaseUrl, props.tenantId);
4210
+ const { tenants = {} } = useTenantData(props.apiBaseUrl, props.tenantId, props.enableMultiTenantMode);
4209
4211
  const selectedUsers = vue.ref([]);
4210
4212
  const selectedUser = vue.ref(props.multiple ? "" : props.modelValue);
4211
4213
  const selectedUserIds = vue.computed(() => {
@@ -4232,7 +4234,8 @@
4232
4234
  usersList: ids,
4233
4235
  enableMultiTenantMode: props.enableMultiTenantMode
4234
4236
  });
4235
- selectedUsers.value = [...selected, ...formatUsers(result)];
4237
+ const selectedList = [...selected, ...formatUsers(result, props.enableMultiTenantMode)];
4238
+ selectedUsers.value = ids.map((id) => selectedList.find((user) => user.id === id)).filter(Boolean);
4236
4239
  } catch (error) {
4237
4240
  console.error("获取选中用户信息失败:", error);
4238
4241
  }
@@ -4339,7 +4342,7 @@
4339
4342
  };
4340
4343
  }
4341
4344
  });
4342
- const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-30b84150"]]);
4345
+ const BkUserSelector = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-02466e5e"]]);
4343
4346
  exports2.BkUserSelector = BkUserSelector;
4344
4347
  exports2.default = BkUserSelector;
4345
4348
  Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });