@cgboiler/biz-mobile 1.18.20 → 1.18.22

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.
Files changed (55) hide show
  1. package/es/index.d.ts +2 -4
  2. package/es/index.js +2 -6
  3. package/es/md-preview/index.less +107 -107
  4. package/es/org-picker/OrgPicker.js +19 -11
  5. package/es/org-picker/_atomic.css +0 -21
  6. package/es/org-picker/index.less +230 -230
  7. package/es/org-picker/useApi.d.ts +6 -1
  8. package/es/org-picker/useApi.js +256 -68
  9. package/es/org-picker/useSearch.js +37 -16
  10. package/es/project-select/index.less +45 -45
  11. package/es/vue-sfc-shim.d.ts +8 -8
  12. package/es/vue-tsx-shim.d.ts +29 -29
  13. package/lib/index.d.ts +2 -4
  14. package/lib/index.js +2 -6
  15. package/lib/md-preview/index.less +107 -107
  16. package/lib/org-picker/OrgPicker.js +20 -12
  17. package/lib/org-picker/_atomic.css +0 -21
  18. package/lib/org-picker/index.less +230 -230
  19. package/lib/org-picker/useApi.d.ts +6 -1
  20. package/lib/org-picker/useApi.js +254 -68
  21. package/lib/org-picker/useSearch.js +36 -15
  22. package/lib/project-select/index.less +45 -45
  23. package/lib/vue-sfc-shim.d.ts +8 -8
  24. package/lib/vue-tsx-shim.d.ts +29 -29
  25. package/package.json +2 -3
  26. package/es/rich-text-editor/RichTextEditor.d.ts +0 -26
  27. package/es/rich-text-editor/RichTextEditor.js +0 -23
  28. package/es/rich-text-editor/_atomic.css +0 -32
  29. package/es/rich-text-editor/index.css +0 -0
  30. package/es/rich-text-editor/index.d.ts +0 -3
  31. package/es/rich-text-editor/index.js +0 -5
  32. package/es/rich-text-editor/index.less +0 -0
  33. package/es/rich-text-editor/style/index.d.ts +0 -1
  34. package/es/rich-text-editor/style/index.js +0 -1
  35. package/es/rich-text-editor/style/less.d.ts +0 -1
  36. package/es/rich-text-editor/style/less.js +0 -1
  37. package/es/rich-text-editor/types.d.ts +0 -12
  38. package/es/rich-text-editor/types.js +0 -13
  39. package/lib/rich-text-editor/RichTextEditor.d.ts +0 -26
  40. package/lib/rich-text-editor/RichTextEditor.js +0 -42
  41. package/lib/rich-text-editor/_atomic.css +0 -32
  42. package/lib/rich-text-editor/index.css +0 -0
  43. package/lib/rich-text-editor/index.d.ts +0 -3
  44. package/lib/rich-text-editor/index.js +0 -34
  45. package/lib/rich-text-editor/index.less +0 -0
  46. package/lib/rich-text-editor/style/index.d.ts +0 -1
  47. package/lib/rich-text-editor/style/index.js +0 -1
  48. package/lib/rich-text-editor/style/less.d.ts +0 -1
  49. package/lib/rich-text-editor/style/less.js +0 -1
  50. package/lib/rich-text-editor/types.d.ts +0 -12
  51. package/lib/rich-text-editor/types.js +0 -32
  52. /package/es/org-picker/components/{DeptImg.d.ts → deptImg.d.ts} +0 -0
  53. /package/es/org-picker/components/{DeptImg.js → deptImg.js} +0 -0
  54. /package/lib/org-picker/components/{DeptImg.d.ts → deptImg.d.ts} +0 -0
  55. /package/lib/org-picker/components/{DeptImg.js → deptImg.js} +0 -0
@@ -1,7 +1,24 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
3
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
5
22
  var __export = (target, all) => {
6
23
  for (var name in all)
7
24
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -45,22 +62,15 @@ var import_vue = require("vue");
45
62
  var import_core = require("@cgboiler/core");
46
63
  var import_core2 = require("@cgboiler/core");
47
64
  var import_lodash_es = require("lodash-es");
48
- const orgListCache = /* @__PURE__ */ new Map();
49
- const fetchData = (url, cacheKey) => __async(void 0, null, function* () {
50
- if (cacheKey && orgListCache.has(cacheKey)) {
51
- return orgListCache.get(cacheKey);
52
- }
53
- const res = (yield (0, import_core.useFetch)(url, { method: "GET" })) || [];
54
- if (cacheKey) {
55
- orgListCache.set(cacheKey, res);
56
- }
57
- return res;
58
- });
59
- const fetchOrgList = (deptId) => __async(void 0, null, function* () {
60
- const url = `${window.globalConfig.wFlowApi}/v1/oa/org/tree/cloud?deptId=${deptId}&type=user`;
61
- return fetchData(url, deptId || "");
62
- });
65
+ const COMPANY_CHUANGUO = "fbd9654e-4d19-4d28-b525-e7477a8b28b9";
66
+ const COMPANY_HAZHOU = "23a8cb4b-6b5b-11f0-8f6e-cacc862768d8";
67
+ const COMPANIES = [
68
+ { id: COMPANY_CHUANGUO, name: "\u5DDD\u9505\u516C\u53F8" },
69
+ { id: COMPANY_HAZHOU, name: "\u54C8\u8F74\u516C\u53F8" }
70
+ ];
63
71
  const userList = (0, import_vue.ref)([]);
72
+ const deptList = (0, import_vue.ref)([]);
73
+ const isInitialized = (0, import_vue.ref)(false);
64
74
  const userMap = (0, import_vue.computed)(() => {
65
75
  const map = /* @__PURE__ */ new Map();
66
76
  userList.value.forEach((item) => {
@@ -68,7 +78,6 @@ const userMap = (0, import_vue.computed)(() => {
68
78
  });
69
79
  return map;
70
80
  });
71
- const deptList = (0, import_vue.ref)([]);
72
81
  const deptMap = (0, import_vue.computed)(() => {
73
82
  const map = /* @__PURE__ */ new Map();
74
83
  deptList.value.forEach((item) => {
@@ -76,77 +85,217 @@ const deptMap = (0, import_vue.computed)(() => {
76
85
  });
77
86
  return map;
78
87
  });
79
- function initUserList() {
80
- return __async(this, null, function* () {
81
- userList.value = yield (0, import_core.getUserList)();
82
- });
83
- }
84
- function initDeptList() {
88
+ let initPromise = null;
89
+ const fetchAllCompaniesData = () => __async(void 0, null, function* () {
90
+ const companyIds = [COMPANY_CHUANGUO, COMPANY_HAZHOU];
91
+ console.log("Fetching Org Data for companies in parallel:", companyIds);
92
+ const results = yield Promise.all(
93
+ companyIds.map((cid) => __async(void 0, null, function* () {
94
+ try {
95
+ const [users, depts] = yield Promise.all([(0, import_core.getUserList)(cid), (0, import_core2.getDeptList)(cid)]);
96
+ const processedUsers = (users || []).map((u) => __spreadProps(__spreadValues({}, u), {
97
+ companyId: u.companyId || cid,
98
+ type: "user"
99
+ }));
100
+ const processedDepts = (depts || []).map((d) => __spreadProps(__spreadValues({}, d), {
101
+ companyId: d.companyId || cid,
102
+ type: "dept"
103
+ }));
104
+ return { users: processedUsers, depts: processedDepts };
105
+ } catch (e) {
106
+ console.error(`Failed to fetch data for company ${cid}`, e);
107
+ return { users: [], depts: [] };
108
+ }
109
+ }))
110
+ );
111
+ const allUsers = results.flatMap((r) => r.users);
112
+ const allDepts = results.flatMap((r) => r.depts);
113
+ return { users: allUsers, depts: allDepts };
114
+ });
115
+ function initData() {
85
116
  return __async(this, null, function* () {
86
- deptList.value = yield (0, import_core2.getDeptList)();
117
+ if (isInitialized.value)
118
+ return;
119
+ if (initPromise)
120
+ return initPromise;
121
+ initPromise = (() => __async(this, null, function* () {
122
+ try {
123
+ const { users, depts } = yield fetchAllCompaniesData();
124
+ userList.value = users;
125
+ deptList.value = depts;
126
+ isInitialized.value = true;
127
+ console.log("Org Data Initialized. Users:", users.length, "Depts:", depts.length);
128
+ } catch (e) {
129
+ console.error("Failed to init org data", e);
130
+ } finally {
131
+ initPromise = null;
132
+ }
133
+ }))();
134
+ return initPromise;
87
135
  });
88
136
  }
89
- initUserList();
90
- initDeptList();
91
137
  function getFinalUserList() {
92
138
  return __async(this, null, function* () {
93
- var _a;
94
- if ((_a = userList.value) == null ? void 0 : _a.length) {
95
- return userList.value;
139
+ if (!isInitialized.value) {
140
+ yield initData();
96
141
  }
97
- return yield (0, import_core.getUserList)();
142
+ return userList.value;
98
143
  });
99
144
  }
145
+ const fetchData = (url) => __async(void 0, null, function* () {
146
+ const res = (yield (0, import_core.useFetch)(url, { method: "GET" })) || [];
147
+ return res;
148
+ });
100
149
  const useApi = () => {
101
150
  const orgList = (0, import_vue.ref)([]);
102
151
  const orgSearchList = (0, import_vue.ref)([]);
103
- const currentDeptId = (0, import_vue.ref)("1");
104
- const deptPath = (0, import_vue.ref)([{ id: "1", name: "\u4F01\u4E1A\u901A\u8BAF\u5F55" }]);
152
+ const currentDeptId = (0, import_vue.ref)("");
153
+ const browsedCompanyId = (0, import_vue.ref)("");
154
+ const deptPath = (0, import_vue.ref)([{ id: "", name: "\u4F01\u4E1A\u901A\u8BAF\u5F55" }]);
105
155
  const dataId = (0, import_vue.ref)("");
106
156
  const userInfo = (0, import_vue.ref)({});
107
157
  const getOrgList = (deptId) => __async(void 0, null, function* () {
158
+ if (!isInitialized.value && !initPromise) {
159
+ initData();
160
+ }
161
+ if (deptId && !isInitialized.value) {
162
+ yield initData();
163
+ }
108
164
  if (deptId) {
109
165
  currentDeptId.value = deptId;
110
166
  const index = deptPath.value.findIndex((dept) => dept.id === deptId);
111
167
  if (index > -1) {
112
168
  deptPath.value = deptPath.value.slice(0, index + 1);
169
+ if (deptId === "") {
170
+ browsedCompanyId.value = "";
171
+ } else {
172
+ const firstPathItem = deptPath.value[1];
173
+ if (firstPathItem && COMPANIES.some((c) => c.id === String(firstPathItem.id))) {
174
+ browsedCompanyId.value = String(firstPathItem.id);
175
+ }
176
+ }
113
177
  } else {
114
- const currentDept = orgList.value.find((item) => item.id === deptId && item.type === "dept");
115
- if (currentDept) {
116
- deptPath.value.push({ id: currentDept.id, name: currentDept.name });
178
+ const company = COMPANIES.find((c) => c.id === deptId);
179
+ if (company) {
180
+ deptPath.value.push({ id: company.id, name: company.name });
181
+ browsedCompanyId.value = company.id;
182
+ } else {
183
+ const currentDept = deptList.value.find(
184
+ (item) => item.id === deptId && (!browsedCompanyId.value || item.companyId === browsedCompanyId.value)
185
+ );
186
+ if (currentDept) {
187
+ deptPath.value.push({
188
+ id: currentDept.id,
189
+ name: currentDept.deptName || currentDept.name
190
+ });
191
+ if (!browsedCompanyId.value)
192
+ browsedCompanyId.value = currentDept.companyId;
193
+ }
117
194
  }
118
195
  }
196
+ } else {
197
+ currentDeptId.value = "";
198
+ browsedCompanyId.value = "";
199
+ deptPath.value = [{ id: "", name: "\u4F01\u4E1A\u901A\u8BAF\u5F55" }];
119
200
  }
120
- const list = yield fetchOrgList(currentDeptId.value);
121
- orgList.value = list.filter((item) => {
122
- var _a;
123
- if (item.type === "user") {
124
- return ((_a = userMap.value.get(item.id)) == null ? void 0 : _a.status) !== 5;
201
+ if (!currentDeptId.value) {
202
+ orgList.value = COMPANIES.map(
203
+ (c) => ({
204
+ id: c.id,
205
+ name: c.name,
206
+ type: "dept",
207
+ avatar: "",
208
+ status: 1
209
+ })
210
+ );
211
+ } else {
212
+ if (!isInitialized.value) {
213
+ yield initData();
214
+ }
215
+ const isCompany = COMPANIES.some((c) => c.id === currentDeptId.value);
216
+ let targetDepts = [];
217
+ let targetUsers = [];
218
+ if (isCompany) {
219
+ const companyRootDepts = deptList.value.filter(
220
+ (d) => d.companyId === currentDeptId.value && (d.parentId === "0" || !d.parentId)
221
+ );
222
+ if (companyRootDepts.length === 1) {
223
+ const rootDept = companyRootDepts[0];
224
+ targetDepts = deptList.value.filter(
225
+ (d) => d.parentId === rootDept.id && d.companyId === currentDeptId.value
226
+ );
227
+ targetUsers = userList.value.filter(
228
+ (u) => u.deptId === rootDept.id && u.companyId === currentDeptId.value && u.status !== 5
229
+ );
230
+ } else {
231
+ targetDepts = companyRootDepts;
232
+ targetUsers = userList.value.filter(
233
+ (u) => u.companyId === currentDeptId.value && (u.deptId === "0" || !u.deptId) && u.status !== 5
234
+ );
235
+ }
236
+ } else {
237
+ const currentDeptObj = deptList.value.find(
238
+ (d) => d.id === currentDeptId.value && (!browsedCompanyId.value || d.companyId === browsedCompanyId.value)
239
+ );
240
+ const activeCompanyId = currentDeptObj ? currentDeptObj.companyId : browsedCompanyId.value;
241
+ targetDepts = deptList.value.filter(
242
+ (d) => d.parentId === currentDeptId.value && d.companyId === activeCompanyId
243
+ );
244
+ targetUsers = userList.value.filter(
245
+ (u) => u.deptId === currentDeptId.value && u.status !== 5 && u.companyId === activeCompanyId
246
+ );
125
247
  }
126
- return true;
127
- }) || [];
248
+ const depts = targetDepts.map(
249
+ (d) => __spreadProps(__spreadValues({}, d), {
250
+ id: d.id,
251
+ name: d.deptName || d.name,
252
+ type: "dept",
253
+ avatar: "",
254
+ status: 1
255
+ })
256
+ );
257
+ const users = targetUsers.map(
258
+ (u) => __spreadProps(__spreadValues({}, u), {
259
+ type: "user"
260
+ })
261
+ );
262
+ orgList.value = [...users, ...depts];
263
+ }
128
264
  });
129
265
  const searchOrgList = (0, import_lodash_es.debounce)((userName) => __async(void 0, null, function* () {
130
266
  if (!userName) {
131
267
  orgSearchList.value = [];
132
268
  return;
133
269
  }
134
- const url = `${window.globalConfig.wFlowApi}/v1/oa/org/tree/user/search/cloud?userName=${userName}`;
135
- const searchResults = yield fetchData(url);
136
- orgSearchList.value = searchResults.filter((item) => item.type !== "user" || item.status !== 5).filter((item, index, self) => index === self.findIndex((other) => other.id === item.id));
270
+ if (!isInitialized.value) {
271
+ yield initData();
272
+ }
273
+ const lowerName = userName.toLowerCase();
274
+ const results = userList.value.filter((u) => {
275
+ if (u.status === 5)
276
+ return false;
277
+ const nameMatch = u.name && u.name.toLowerCase().includes(lowerName);
278
+ const pyMatch = u.py && u.py.toLowerCase().includes(lowerName);
279
+ const pinyinMatch = u.pinyin && u.pinyin.toLowerCase().includes(lowerName);
280
+ return nameMatch || pyMatch || pinyinMatch;
281
+ });
282
+ orgSearchList.value = results.filter(
283
+ (item, index, self) => index === self.findIndex((other) => other.id === item.id)
284
+ );
137
285
  }), 300);
138
286
  const MAX_RECENT_SELECTIONS = 20;
139
287
  const getRecentUsers = () => __async(void 0, null, function* () {
140
288
  var _a;
141
289
  const user = yield (0, import_core.getUserInfo)();
142
290
  let name = "";
143
- userList.value = yield (0, import_core.getUserList)();
144
- userList.value.forEach((item) => {
145
- if (item.id === user.userId) {
146
- name = item.name;
147
- userInfo.value = item;
148
- }
149
- });
291
+ yield initData();
292
+ const foundUser = userList.value.find((item) => item.id === user.userId);
293
+ if (foundUser) {
294
+ name = foundUser.name;
295
+ userInfo.value = foundUser;
296
+ } else {
297
+ userInfo.value = user;
298
+ }
150
299
  const url = decodeURIComponent(
151
300
  `${window.globalConfig.wFlowApi}/v1/wflow/process/form/wf687dda91e4b027b047d4654c/data?keywords=${name}_${user.userId}&pageNo=1&pageSize=20`
152
301
  );
@@ -155,7 +304,8 @@ const useApi = () => {
155
304
  if ((_a = res == null ? void 0 : res.records) == null ? void 0 : _a.length) {
156
305
  res.records.forEach((item) => {
157
306
  const data = JSON.parse(item.data);
158
- if (data.field6713678545899 === userInfo.value.name + "_" + user.userId) {
307
+ const currentName = userInfo.value.name || user.name || "";
308
+ if (data.field6713678545899 === currentName + "_" + user.userId) {
159
309
  dataId.value = item.id;
160
310
  const list = data.field5375578403639 ? JSON.parse(data.field5375578403639) : [];
161
311
  recentList = list;
@@ -178,9 +328,8 @@ const useApi = () => {
178
328
  if (data.field5375578403639) {
179
329
  const list = JSON.parse(data.field5375578403639);
180
330
  list.forEach((item) => {
181
- if (item.selectedUsers) {
331
+ if (item.selectedUsers)
182
332
  item.selectedUsers = item.selectedUsers.map((user2) => ({ id: user2.id }));
183
- }
184
333
  });
185
334
  data.field5375578403639 = JSON.stringify(list);
186
335
  }
@@ -194,15 +343,11 @@ const useApi = () => {
194
343
  const token = user.token;
195
344
  const response = yield fetch(url, {
196
345
  method,
197
- headers: {
198
- "Content-Type": "application/json",
199
- token: token || ""
200
- },
346
+ headers: { "Content-Type": "application/json", token: token || "" },
201
347
  body: JSON.stringify(requestData)
202
348
  });
203
- if (!response.ok) {
349
+ if (!response.ok)
204
350
  throw new Error(`HTTP error! status: ${response.status}`);
205
- }
206
351
  const responseText = yield response.text();
207
352
  let result;
208
353
  try {
@@ -212,9 +357,8 @@ const useApi = () => {
212
357
  const match = responseText.match(uuidRegex);
213
358
  if (match && match[1]) {
214
359
  const uuid = match[1];
215
- if (!dataId.value) {
360
+ if (!dataId.value)
216
361
  dataId.value = uuid;
217
- }
218
362
  result = { success: true, message: responseText, id: uuid };
219
363
  } else {
220
364
  result = { success: true, message: responseText };
@@ -244,7 +388,6 @@ const useApi = () => {
244
388
  const history = yield getRecentSelectedUsers();
245
389
  const newSelection = {
246
390
  id: Date.now().toString(),
247
- // 使用时间戳作为唯一ID
248
391
  selectedUsers: users
249
392
  };
250
393
  const filteredHistory = history.filter((item) => {
@@ -284,13 +427,53 @@ const useApi = () => {
284
427
  const getUserInfoById = (id) => {
285
428
  return userList.value.find((item) => item.id === id);
286
429
  };
287
- const getUsersByDeptId = (deptId) => {
430
+ const getUsersByDeptId = (deptId, cid, visited = /* @__PURE__ */ new Set()) => {
431
+ const effectiveCompanyId = cid || browsedCompanyId.value;
432
+ if (visited.has(deptId)) {
433
+ return [];
434
+ }
435
+ visited.add(deptId);
436
+ const isCompany = COMPANIES.some((c) => c.id === deptId);
437
+ if (isCompany) {
438
+ const companyId = deptId;
439
+ if (!deptList.value.length || !userList.value.length)
440
+ return [];
441
+ const gatherUsers = (dId) => {
442
+ const result = [];
443
+ if (dId === companyId) {
444
+ result.push(
445
+ ...userList.value.filter(
446
+ (u) => u.companyId === dId && (u.deptId === "0" || !u.deptId) && u.status !== 5
447
+ )
448
+ );
449
+ } else {
450
+ result.push(
451
+ ...userList.value.filter(
452
+ (u) => u.deptId === dId && u.companyId === companyId && u.status !== 5
453
+ )
454
+ );
455
+ }
456
+ const children = dId === companyId ? deptList.value.filter((d) => d.companyId === dId && (d.parentId === "0" || !d.parentId)) : deptList.value.filter((d) => d.parentId === dId && d.companyId === companyId);
457
+ children.forEach((child) => {
458
+ if (!visited.has(child.id)) {
459
+ visited.add(child.id);
460
+ result.push(...gatherUsers(child.id));
461
+ }
462
+ });
463
+ return result;
464
+ };
465
+ return gatherUsers(companyId);
466
+ }
288
467
  const users = [];
289
- const directUsers = userList.value.filter((user) => user.deptId === deptId && user.status !== 5);
468
+ const directUsers = userList.value.filter(
469
+ (user) => user.deptId === deptId && user.status !== 5 && (!effectiveCompanyId || user.companyId === effectiveCompanyId)
470
+ );
290
471
  users.push(...directUsers);
291
- const childDepts = deptList.value.filter((dept) => dept.parentId === deptId);
472
+ const childDepts = deptList.value.filter(
473
+ (dept) => dept.parentId === deptId && (!effectiveCompanyId || dept.companyId === effectiveCompanyId)
474
+ );
292
475
  childDepts.forEach((childDept) => {
293
- const childUsers = getUsersByDeptId(childDept.id);
476
+ const childUsers = getUsersByDeptId(childDept.id, effectiveCompanyId, visited);
294
477
  users.push(...childUsers);
295
478
  });
296
479
  return users;
@@ -298,12 +481,14 @@ const useApi = () => {
298
481
  const getDeptById = (deptId) => {
299
482
  return deptMap.value.get(deptId);
300
483
  };
484
+ const getCompanies = () => COMPANIES;
301
485
  return {
302
486
  userList,
303
487
  orgList,
304
488
  orgSearchList,
305
489
  getOrgList,
306
490
  currentDeptId,
491
+ browsedCompanyId,
307
492
  deptPath,
308
493
  deleteRecentSelectedUsers,
309
494
  searchOrgList,
@@ -312,6 +497,7 @@ const useApi = () => {
312
497
  getUserInfoById,
313
498
  deptList,
314
499
  getUsersByDeptId,
315
- getDeptById
500
+ getDeptById,
501
+ getCompanies
316
502
  };
317
503
  };
@@ -44,13 +44,19 @@ var import_vue = require("vue");
44
44
  var import_atomic = require("./_atomic.css");
45
45
  var import_vue2 = require("vue");
46
46
  var import_vant = require("vant");
47
+ var import_core = require("@cgboiler/core");
47
48
  const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
49
+ const COMPANY_MAP = {
50
+ "fbd9654e-4d19-4d28-b525-e7477a8b28b9": "\u5DDD\u9505",
51
+ "23a8cb4b-6b5b-11f0-8f6e-cacc862768d8": "\u54C8\u8F74"
52
+ };
48
53
  function useSearch({
49
54
  props,
50
55
  api,
51
56
  isSearchFocus
52
57
  }) {
53
58
  const {
59
+ browsedCompanyId,
54
60
  orgSearchList,
55
61
  getOrgList,
56
62
  currentDeptId,
@@ -62,13 +68,22 @@ function useSearch({
62
68
  } = api;
63
69
  const keyword = (0, import_vue2.ref)("");
64
70
  const searchRef = (0, import_vue2.ref)();
71
+ const currentCompanyId = (0, import_vue2.ref)("");
65
72
  const recentSelectedHistory = (0, import_vue2.ref)([]);
66
73
  const filterRecentSelectedHistory = (0, import_vue2.ref)([]);
67
- (0, import_vue2.watchEffect)(() => __async(this, null, function* () {
68
- if (props.show && props.multiple && !recentSelectedHistory.value.length) {
74
+ (0, import_vue2.onMounted)(() => __async(this, null, function* () {
75
+ const info = yield (0, import_core.getUserInfo)();
76
+ currentCompanyId.value = info.companyId || "";
77
+ }));
78
+ const hasFetchedHistory = (0, import_vue2.ref)(false);
79
+ (0, import_vue2.watch)(() => [props.show, props.multiple], (_0) => __async(this, [_0], function* ([show, multiple]) {
80
+ if (show && multiple && !hasFetchedHistory.value) {
69
81
  recentSelectedHistory.value = yield getRecentSelectedUsers();
82
+ hasFetchedHistory.value = true;
70
83
  }
71
- }));
84
+ }), {
85
+ immediate: true
86
+ });
72
87
  const setRecentUsers = (users) => __async(this, null, function* () {
73
88
  yield setRecentSelectedUsers(users);
74
89
  recentSelectedHistory.value = yield getRecentSelectedUsers();
@@ -125,21 +140,27 @@ function useSearch({
125
140
  }) => {
126
141
  return (0, import_vue.createVNode)("div", {
127
142
  "class": "absolute top-0 left-0 right-0 bottom-0 bg-[#fff] z-1 overflow-auto"
128
- }, [filteredOrgList.value.length ? (0, import_vue.createVNode)(import_vue.Fragment, null, [" ", (0, import_vue.createVNode)("div", {
143
+ }, [filteredOrgList.value.length ? (0, import_vue.createVNode)(import_vue.Fragment, null, [(0, import_vue.createVNode)("div", {
129
144
  "class": "px-16px"
130
145
  }, [filteredOrgList.value.length === 0 ? (0, import_vue.createVNode)(import_vant.Empty, {
131
146
  "description": "\u672A\u627E\u5230\u76F8\u5173\u4EBA\u5458"
132
- }, null) : (0, import_vue.createVNode)(import_vue.Fragment, null, [filteredOrgList.value.map((item) => (0, import_vue.createVNode)("div", {
133
- "class": ["org-item", isSelected(item) ? "selected" : ""],
134
- "onClick": () => handleSelect(item)
135
- }, [(0, import_vue.createVNode)(import_vant.Image, {
136
- "class": "org-avatar",
137
- "src": item.avatar
138
- }, null), (0, import_vue.createVNode)("div", {
139
- "class": "org-name"
140
- }, [item.name, (0, import_vue.createVNode)("span", {
141
- "class": "org-item-select-icon"
142
- }, [(0, import_vue.createTextVNode)("\u2713")])])]))])])]) : "", isSearchFocus.value && isMobile ? (0, import_vue.createVNode)("div", {
147
+ }, null) : (0, import_vue.createVNode)(import_vue.Fragment, null, [filteredOrgList.value.map((item) => {
148
+ const showCompany = browsedCompanyId.value && item.companyId && item.companyId !== browsedCompanyId.value;
149
+ const companyName = showCompany ? COMPANY_MAP[item.companyId] : "";
150
+ return (0, import_vue.createVNode)("div", {
151
+ "class": ["org-item", isSelected(item) ? "selected" : ""],
152
+ "onClick": () => handleSelect(item)
153
+ }, [(0, import_vue.createVNode)(import_vant.Image, {
154
+ "class": "org-avatar",
155
+ "src": item.avatar
156
+ }, null), (0, import_vue.createVNode)("div", {
157
+ "class": "org-name"
158
+ }, [item.name, showCompany && companyName && (0, import_vue.createVNode)("span", {
159
+ "class": "text-gray-500 text-[12px] ml-1"
160
+ }, [(0, import_vue.createTextVNode)("@"), companyName]), (0, import_vue.createVNode)("span", {
161
+ "class": "org-item-select-icon"
162
+ }, [(0, import_vue.createTextVNode)("\u2713")])])]);
163
+ })])])]) : "", isSearchFocus.value && isMobile ? (0, import_vue.createVNode)("div", {
143
164
  "class": "h-[300px]"
144
165
  }, null) : ""]);
145
166
  };
@@ -1,45 +1,45 @@
1
- :root:root {
2
- --van-action-sheet-max-height: 100%;
3
- }
4
- .project-list {
5
- height: 85vh;
6
- display: flex;
7
- flex-direction: column;
8
-
9
- .search-bar {
10
- position: sticky;
11
- top: 0;
12
- z-index: 1;
13
- }
14
-
15
- .van-list {
16
- flex: 1;
17
- overflow-y: auto;
18
- padding: 0 16px;
19
- }
20
-
21
- .project-item {
22
- padding: 12px 0;
23
- border-bottom: 1px solid #eee;
24
- cursor: pointer;
25
-
26
- &.selected {
27
- color: var(--van-primary-color);
28
- }
29
-
30
- .project-name {
31
- font-size: 14px;
32
-
33
- .highlight {
34
- color: var(--van-primary-color);
35
- font-weight: bold;
36
- padding: 0 2px;
37
- border-radius: 2px;
38
- }
39
- }
40
-
41
- &:last-child {
42
- border-bottom: none;
43
- }
44
- }
45
- }
1
+ :root:root {
2
+ --van-action-sheet-max-height: 100%;
3
+ }
4
+ .project-list {
5
+ height: 85vh;
6
+ display: flex;
7
+ flex-direction: column;
8
+
9
+ .search-bar {
10
+ position: sticky;
11
+ top: 0;
12
+ z-index: 1;
13
+ }
14
+
15
+ .van-list {
16
+ flex: 1;
17
+ overflow-y: auto;
18
+ padding: 0 16px;
19
+ }
20
+
21
+ .project-item {
22
+ padding: 12px 0;
23
+ border-bottom: 1px solid #eee;
24
+ cursor: pointer;
25
+
26
+ &.selected {
27
+ color: var(--van-primary-color);
28
+ }
29
+
30
+ .project-name {
31
+ font-size: 14px;
32
+
33
+ .highlight {
34
+ color: var(--van-primary-color);
35
+ font-weight: bold;
36
+ padding: 0 2px;
37
+ border-radius: 2px;
38
+ }
39
+ }
40
+
41
+ &:last-child {
42
+ border-bottom: none;
43
+ }
44
+ }
45
+ }
@@ -1,9 +1,9 @@
1
- declare module '*.vue' {
2
- // eslint-disable-next-line
3
- import { DefineComponent } from 'vue'
4
- const Component: DefineComponent
5
- export default Component
6
- }
7
- declare module "marked";
8
- declare module "katex";
1
+ declare module '*.vue' {
2
+ // eslint-disable-next-line
3
+ import { DefineComponent } from 'vue'
4
+ const Component: DefineComponent
5
+ export default Component
6
+ }
7
+ declare module "marked";
8
+ declare module "katex";
9
9
  declare module "diff-match-patch";