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