@cgboiler/biz-mobile 1.17.6 → 1.17.8
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 +1 -1
- package/es/index.js +1 -1
- package/es/org-picker/OrgPicker.js +59 -68
- package/es/org-picker/_atomic.css +32 -0
- package/es/org-picker/index.css +1 -1
- package/es/org-picker/index.less +13 -0
- package/es/org-picker/types.d.ts +4 -0
- package/es/org-picker/useApi.d.ts +21 -5
- package/es/org-picker/useApi.js +40 -4
- package/es/org-picker/useSearch.d.ts +9 -0
- package/es/org-picker/useSearch.js +125 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/org-picker/OrgPicker.js +56 -65
- package/lib/org-picker/_atomic.css +32 -0
- package/lib/org-picker/index.css +1 -1
- package/lib/org-picker/index.less +13 -0
- package/lib/org-picker/types.d.ts +4 -0
- package/lib/org-picker/useApi.d.ts +21 -5
- package/lib/org-picker/useApi.js +39 -3
- package/lib/org-picker/useSearch.d.ts +9 -0
- package/lib/org-picker/useSearch.js +144 -0
- package/package.json +2 -2
package/es/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare namespace _default {
|
|
|
7
7
|
}
|
|
8
8
|
export default _default;
|
|
9
9
|
export function install(app: any): void;
|
|
10
|
-
export const version: "1.17.
|
|
10
|
+
export const version: "1.17.7";
|
|
11
11
|
import MdPreview from './md-preview';
|
|
12
12
|
import OrgPicker from './org-picker';
|
|
13
13
|
import ProjectSelect from './project-select';
|
package/es/index.js
CHANGED
|
@@ -1,31 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled = (value) => {
|
|
4
|
-
try {
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
import { createVNode as _createVNode, createTextVNode as _createTextVNode } from "vue";
|
|
1
|
+
import { createVNode as _createVNode, createTextVNode as _createTextVNode, Fragment as _Fragment } from "vue";
|
|
22
2
|
import "./_atomic.css";
|
|
23
|
-
import { defineComponent, ref, computed, watch
|
|
24
|
-
import { ActionSheet, Search, List, Image, Empty } from "vant";
|
|
3
|
+
import { defineComponent, ref, computed, watch } from "vue";
|
|
4
|
+
import { ActionSheet, Search, List, Image, Empty, Tabs, Tab } from "vant";
|
|
25
5
|
import DeptImg from "./components/DeptImg";
|
|
26
6
|
import { orgPickerProps } from "./types";
|
|
27
7
|
import { useApi } from "./useApi";
|
|
28
8
|
import "./index.css";
|
|
9
|
+
import { useSearch } from "./useSearch";
|
|
29
10
|
var stdin_default = defineComponent({
|
|
30
11
|
name: "OrgPicker",
|
|
31
12
|
props: orgPickerProps,
|
|
@@ -33,16 +14,29 @@ var stdin_default = defineComponent({
|
|
|
33
14
|
setup(props, {
|
|
34
15
|
emit
|
|
35
16
|
}) {
|
|
17
|
+
const api = useApi();
|
|
36
18
|
const {
|
|
37
|
-
orgList,
|
|
38
19
|
getOrgList,
|
|
39
|
-
|
|
20
|
+
orgList,
|
|
40
21
|
deptPath,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
} =
|
|
22
|
+
userList,
|
|
23
|
+
setRecentSelectedUsers
|
|
24
|
+
} = api;
|
|
44
25
|
getOrgList();
|
|
26
|
+
const activeTab = ref("txl");
|
|
27
|
+
const {
|
|
28
|
+
keyword,
|
|
29
|
+
searchRef,
|
|
30
|
+
recentSelectedHistory,
|
|
31
|
+
highlightText,
|
|
32
|
+
renderSearchResult
|
|
33
|
+
} = useSearch(props, api);
|
|
45
34
|
const selectedItems = ref([]);
|
|
35
|
+
const sortOrgList = computed(() => {
|
|
36
|
+
const departments = orgList.value.filter((item) => item.type === "dept");
|
|
37
|
+
const personnel = orgList.value.filter((item) => item.type !== "dept");
|
|
38
|
+
return [...personnel, ...departments];
|
|
39
|
+
});
|
|
46
40
|
watch(() => props.modelValue, (newValue) => {
|
|
47
41
|
var _a;
|
|
48
42
|
if (!newValue) {
|
|
@@ -73,46 +67,20 @@ var stdin_default = defineComponent({
|
|
|
73
67
|
selectedItems.value = [item];
|
|
74
68
|
emit("update:modelValue", [item.id]);
|
|
75
69
|
emit("update:show", false);
|
|
70
|
+
setRecentSelectedUsers(selectedItems.value);
|
|
76
71
|
}
|
|
77
72
|
};
|
|
73
|
+
const handleHistorySelect = (item) => {
|
|
74
|
+
selectedItems.value = item.selectedUsers;
|
|
75
|
+
};
|
|
78
76
|
const handleConfirm = () => {
|
|
79
77
|
emit("update:show", false);
|
|
80
78
|
emit("update:modelValue", selectedItems.value.map((item) => item.id));
|
|
79
|
+
setRecentSelectedUsers(selectedItems.value);
|
|
81
80
|
};
|
|
82
|
-
const keyword = ref("");
|
|
83
|
-
const loading = ref(false);
|
|
84
|
-
const finished = ref(true);
|
|
85
|
-
const searchRef = ref();
|
|
86
|
-
watch(() => props.show, (newVal) => __async(this, null, function* () {
|
|
87
|
-
if (newVal && props.autoFocus) {
|
|
88
|
-
yield nextTick();
|
|
89
|
-
setTimeout(() => {
|
|
90
|
-
var _a;
|
|
91
|
-
(_a = searchRef.value) == null ? void 0 : _a.focus();
|
|
92
|
-
}, 300);
|
|
93
|
-
}
|
|
94
|
-
}));
|
|
95
|
-
watch(keyword, (newKeyword) => {
|
|
96
|
-
if (newKeyword) {
|
|
97
|
-
searchOrgList(newKeyword);
|
|
98
|
-
} else {
|
|
99
|
-
getOrgList(currentDeptId.value);
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
const filteredOrgList = computed(() => {
|
|
103
|
-
if (keyword.value) {
|
|
104
|
-
return orgList.value;
|
|
105
|
-
}
|
|
106
|
-
const departments = orgList.value.filter((item) => item.type === "dept");
|
|
107
|
-
const personnel = orgList.value.filter((item) => item.type !== "dept");
|
|
108
|
-
return [...personnel, ...departments];
|
|
109
|
-
});
|
|
110
81
|
const isSelected = (item) => {
|
|
111
82
|
return selectedItems.value.some((s) => s.id === item.id);
|
|
112
83
|
};
|
|
113
|
-
const onLoad = () => {
|
|
114
|
-
finished.value = true;
|
|
115
|
-
};
|
|
116
84
|
return () => _createVNode(ActionSheet, {
|
|
117
85
|
"show": props.show,
|
|
118
86
|
"onUpdate:show": (val) => emit("update:show", val),
|
|
@@ -140,7 +108,30 @@ var stdin_default = defineComponent({
|
|
|
140
108
|
"class": "close-icon"
|
|
141
109
|
}, [_createTextVNode("X")])])) : _createVNode("p", {
|
|
142
110
|
"class": "color-[#aaa] text-[14px] text-center w-full leading-[38px]"
|
|
143
|
-
}, [_createTextVNode("\u672A\u9009\u62E9\u4EBA\u5458")])]),
|
|
111
|
+
}, [_createTextVNode("\u672A\u9009\u62E9\u4EBA\u5458")])]), _createVNode("div", {
|
|
112
|
+
"class": "flex-1 flex flex-col overflow-hidden relative"
|
|
113
|
+
}, [_createVNode(Tabs, {
|
|
114
|
+
"active": activeTab.value,
|
|
115
|
+
"onUpdate:active": ($event) => activeTab.value = $event
|
|
116
|
+
}, {
|
|
117
|
+
default: () => [_createVNode(Tab, {
|
|
118
|
+
"title": "\u901A\u8BAF\u5F55",
|
|
119
|
+
"name": "txl"
|
|
120
|
+
}, null), _createVNode(Tab, {
|
|
121
|
+
"title": "\u6700\u8FD1\u9009\u62E9",
|
|
122
|
+
"name": "zjxz"
|
|
123
|
+
}, null)]
|
|
124
|
+
}), _createVNode("div", {
|
|
125
|
+
"class": "org-content-wrap"
|
|
126
|
+
}, [activeTab.value === "zjxz" ? _createVNode("div", {
|
|
127
|
+
"class": "recent-list-wrap flex-1 overflow-auto px-[16px] py-[8px]"
|
|
128
|
+
}, [recentSelectedHistory.value.length === 0 ? _createVNode(Empty, {
|
|
129
|
+
"description": "\u6682\u65E0\u6700\u8FD1\u9009\u62E9\u8BB0\u5F55"
|
|
130
|
+
}, null) : recentSelectedHistory.value.map((historyItem) => _createVNode("div", {
|
|
131
|
+
"key": historyItem.id,
|
|
132
|
+
"onClick": () => handleHistorySelect(historyItem),
|
|
133
|
+
"class": "px-16px py-8px border-b border-[#eee]"
|
|
134
|
+
}, [_createVNode("span", null, [historyItem.selectedUsers.map((user) => highlightText(user.name, keyword.value)).reduce((prev, curr) => [prev, "\uFF0C", curr])])]))]) : _createVNode(_Fragment, null, [_createVNode("div", {
|
|
144
135
|
"class": "breadcrumb-nav"
|
|
145
136
|
}, [deptPath.value.map((dept, index) => _createVNode("span", {
|
|
146
137
|
"key": dept.id
|
|
@@ -154,14 +145,10 @@ var stdin_default = defineComponent({
|
|
|
154
145
|
"class": "separator"
|
|
155
146
|
}, [_createTextVNode(" / ")])]))]), _createVNode("div", {
|
|
156
147
|
"class": "feed-list-wrap"
|
|
157
|
-
}, [
|
|
158
|
-
"description":
|
|
159
|
-
}, null) : _createVNode(List, {
|
|
160
|
-
|
|
161
|
-
"finished": finished.value,
|
|
162
|
-
"onLoad": onLoad
|
|
163
|
-
}, {
|
|
164
|
-
default: () => [filteredOrgList.value.map((item) => _createVNode("div", {
|
|
148
|
+
}, [sortOrgList.value.length === 0 ? _createVNode(Empty, {
|
|
149
|
+
"description": "\u8BE5\u90E8\u95E8\u4E0B\u6CA1\u6709\u4EBA\u5458"
|
|
150
|
+
}, null) : _createVNode(List, null, {
|
|
151
|
+
default: () => [sortOrgList.value.map((item) => _createVNode("div", {
|
|
165
152
|
"class": ["org-item", isSelected(item) ? "selected" : ""],
|
|
166
153
|
"onClick": () => handleSelect(item)
|
|
167
154
|
}, [item.type === "dept" && !keyword.value ? _createVNode("div", {
|
|
@@ -174,6 +161,10 @@ var stdin_default = defineComponent({
|
|
|
174
161
|
}, [item.name, _createVNode("span", {
|
|
175
162
|
"class": "org-item-select-icon"
|
|
176
163
|
}, [_createTextVNode("\u2713")])])]))]
|
|
164
|
+
})])])]), keyword.value && renderSearchResult({
|
|
165
|
+
handleHistorySelect,
|
|
166
|
+
isSelected,
|
|
167
|
+
handleSelect
|
|
177
168
|
})]), props.multiple && _createVNode("div", {
|
|
178
169
|
"class": "bottom-section"
|
|
179
170
|
}, [_createVNode("div", {
|
|
@@ -31,7 +31,39 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/* layer: default */
|
|
34
|
+
.cgx-atm .absolute{position:absolute;}
|
|
35
|
+
.cgx-atm .bottom-0{bottom:0rem;}
|
|
36
|
+
.cgx-atm .left-0{left:0rem;}
|
|
37
|
+
.cgx-atm .right-0{right:0rem;}
|
|
38
|
+
.cgx-atm .top-0{top:0rem;}
|
|
39
|
+
.cgx-atm .z-1{z-index:1;}
|
|
40
|
+
.cgx-atm .flex-1{flex:1 1 0%;}
|
|
41
|
+
.cgx-atm .overflow-auto{overflow:auto;}
|
|
42
|
+
.cgx-atm .border-b{border-bottom-width:1px;border-bottom-style:solid;}
|
|
43
|
+
.cgx-atm .border-\[\#eee\]{--un-border-opacity:1;border-color:rgba(238,238,238,var(--un-border-opacity));}
|
|
44
|
+
.cgx-atm .bg-\[\#fff\]{--un-bg-opacity:1;background-color:rgba(255,255,255,var(--un-bg-opacity));}
|
|
45
|
+
.cgx-atm .px-\[16px\],
|
|
46
|
+
.cgx-atm .px-16px{padding-left:16px;padding-right:16px;}
|
|
47
|
+
.cgx-atm .py-\[12px\]{padding-top:12px;padding-bottom:12px;}
|
|
48
|
+
.cgx-atm .py-\[8px\],
|
|
49
|
+
.cgx-atm .py-8px{padding-top:8px;padding-bottom:8px;}
|
|
50
|
+
.cgx-atm .text-\[14px\]{font-size:14px;}
|
|
51
|
+
.cgx-atm .font-bold{font-weight:700;}
|
|
52
|
+
.cgx-atm .text-\[\#333\]{--un-text-opacity:1;color:rgba(51,51,51,var(--un-text-opacity));}
|
|
53
|
+
/* layer: default */
|
|
54
|
+
.cgx-atm .relative{position:relative;}
|
|
34
55
|
.cgx-atm .w-full{width:100%;}
|
|
56
|
+
.cgx-atm .flex{display:flex;}
|
|
57
|
+
.cgx-atm .flex-1{flex:1 1 0%;}
|
|
58
|
+
.cgx-atm .flex-col{flex-direction:column;}
|
|
59
|
+
.cgx-atm .overflow-auto{overflow:auto;}
|
|
60
|
+
.cgx-atm .overflow-hidden{overflow:hidden;}
|
|
61
|
+
.cgx-atm .border-b{border-bottom-width:1px;border-bottom-style:solid;}
|
|
62
|
+
.cgx-atm .border-\[\#eee\]{--un-border-opacity:1;border-color:rgba(238,238,238,var(--un-border-opacity));}
|
|
63
|
+
.cgx-atm .px-\[16px\],
|
|
64
|
+
.cgx-atm .px-16px{padding-left:16px;padding-right:16px;}
|
|
65
|
+
.cgx-atm .py-\[8px\],
|
|
66
|
+
.cgx-atm .py-8px{padding-top:8px;padding-bottom:8px;}
|
|
35
67
|
.cgx-atm .text-center{text-align:center;}
|
|
36
68
|
.cgx-atm .text-\[14px\]{font-size:14px;}
|
|
37
69
|
.cgx-atm .leading-\[38px\]{line-height:38px;}
|
package/es/org-picker/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root:root{--van-action-sheet-max-height: 100%}.org-list{height:85vh;display:flex;flex-direction:column}.org-list .breadcrumb-nav{margin-bottom:4px;padding:2px 16px;border-radius:4px;font-size:12px}.org-list .breadcrumb-nav .dept-name.current-dept{color:#969799}.org-list .breadcrumb-nav .separator{color:#969799;margin:0 4px}.org-list .search-bar{position:-webkit-sticky;position:-webkit-sticky;position:sticky;top:0;z-index:1}.org-list .org-selected-items{display:flex;flex-wrap:nowrap;padding:12px 16px;gap:12px;background-color:#fff;overflow-x:auto;height:68px;border-bottom:1px solid #eee}.org-list .org-selected-items .selected-tag{flex-shrink:0;background:none;border:none;padding:0;margin:0;position:relative}.org-list .org-selected-items .selected-tag .close-icon{position:absolute;top:0;right:0;z-index:1;background-color:#fff;border-radius:50%;border:1px solid #eee;width:10px;height:10px;display:flex;align-items:center;justify-content:center;font-size:6px;color:#969799}.org-list .org-selected-items .selected-tag .tag-avatar{width:40px;height:40px}.org-list .org-selected-items .selected-tag .tag-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .bottom-section{border-top:1px solid #eee;background-color:#fff}.org-list .van-list{flex:1;overflow-y:auto;padding:0 16px}.org-list .feed-list-wrap{flex:1;display:flex;overflow:hidden;position:relative;justify-content:center}.org-list .search-result-list{position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;background-color:#fff;overflow-y:auto;padding:0 16px}.org-list .org-item{padding:12px 0;border-bottom:1px solid #eee;cursor:pointer;display:flex;align-items:center;gap:12px}.org-list .org-item .org-item-select-icon{display:none;padding-left:4px}.org-list .org-item.selected{color:var(--van-primary-color)}.org-list .org-item.selected .org-item-select-icon{display:inline}.org-list .org-item .org-avatar{flex-shrink:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.org-list .org-item .org-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .org-item .org-name{font-size:14px;flex:1}.org-list .org-item:last-child{border-bottom:none}.org-list .action-buttons{padding:16px;display:flex;justify-content:center}.org-list .action-buttons .confirm-button{background-color:var(--van-primary-color);color:#fff;padding:10px 0;border-radius:4px;text-align:center;width:100%;font-size:14px}
|
|
1
|
+
:root:root{--van-action-sheet-max-height: 100%}.org-list{height:85vh;display:flex;flex-direction:column}.org-list .highlight{color:var(--van-primary-color);font-weight:700}.org-list .breadcrumb-nav{margin-bottom:4px;padding:2px 16px;border-radius:4px;font-size:12px}.org-list .breadcrumb-nav .dept-name.current-dept{color:#969799}.org-list .breadcrumb-nav .separator{color:#969799;margin:0 4px}.org-list .search-bar{position:-webkit-sticky;position:-webkit-sticky;position:sticky;top:0;z-index:1}.org-list .org-selected-items{display:flex;flex-wrap:nowrap;padding:12px 16px;gap:12px;background-color:#fff;overflow-x:auto;height:68px;border-bottom:1px solid #eee}.org-list .org-selected-items .selected-tag{flex-shrink:0;background:none;border:none;padding:0;margin:0;position:relative}.org-list .org-selected-items .selected-tag .close-icon{position:absolute;top:0;right:0;z-index:1;background-color:#fff;border-radius:50%;border:1px solid #eee;width:10px;height:10px;display:flex;align-items:center;justify-content:center;font-size:6px;color:#969799}.org-list .org-selected-items .selected-tag .tag-avatar{width:40px;height:40px}.org-list .org-selected-items .selected-tag .tag-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .bottom-section{border-top:1px solid #eee;background-color:#fff}.org-list .van-list{flex:1;overflow-y:auto;padding:0 16px}.org-list .org-content-wrap{flex:1;display:flex;flex-direction:column;overflow:hidden;position:relative}.org-list .feed-list-wrap{flex:1;display:flex;overflow:hidden;position:relative;justify-content:center}.org-list .search-result-list{position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;background-color:#fff;overflow-y:auto;padding:0 16px}.org-list .org-item{padding:12px 0;border-bottom:1px solid #eee;cursor:pointer;display:flex;align-items:center;gap:12px}.org-list .org-item .org-item-select-icon{display:none;padding-left:4px}.org-list .org-item.selected{color:var(--van-primary-color)}.org-list .org-item.selected .org-item-select-icon{display:inline}.org-list .org-item .org-avatar{flex-shrink:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.org-list .org-item .org-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .org-item .org-name{font-size:14px;flex:1}.org-list .org-item:last-child{border-bottom:none}.org-list .action-buttons{padding:16px;display:flex;justify-content:center}.org-list .action-buttons .confirm-button{background-color:var(--van-primary-color);color:#fff;padding:10px 0;border-radius:4px;text-align:center;width:100%;font-size:14px}
|
package/es/org-picker/index.less
CHANGED
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
height: 85vh;
|
|
6
6
|
display: flex;
|
|
7
7
|
flex-direction: column;
|
|
8
|
+
|
|
9
|
+
.highlight {
|
|
10
|
+
color: var(--van-primary-color);
|
|
11
|
+
font-weight: bold;
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
.breadcrumb-nav {
|
|
10
15
|
margin-bottom: 4px;
|
|
@@ -87,6 +92,14 @@
|
|
|
87
92
|
padding: 0 16px;
|
|
88
93
|
}
|
|
89
94
|
|
|
95
|
+
.org-content-wrap {
|
|
96
|
+
flex: 1;
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
overflow: hidden;
|
|
100
|
+
position: relative;
|
|
101
|
+
}
|
|
102
|
+
|
|
90
103
|
.feed-list-wrap {
|
|
91
104
|
flex: 1;
|
|
92
105
|
display: flex;
|
package/es/org-picker/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { type OrgItem, RecentSelection } from './types';
|
|
2
3
|
export declare const useApi: () => {
|
|
3
|
-
userList:
|
|
4
|
+
userList: Ref<{
|
|
4
5
|
[x: string]: any;
|
|
5
6
|
id: string | number;
|
|
6
7
|
name: string;
|
|
@@ -13,7 +14,20 @@ export declare const useApi: () => {
|
|
|
13
14
|
type: string;
|
|
14
15
|
avatar?: string | undefined;
|
|
15
16
|
}[]>;
|
|
16
|
-
orgList:
|
|
17
|
+
orgList: Ref<{
|
|
18
|
+
[x: string]: any;
|
|
19
|
+
id: string | number;
|
|
20
|
+
name: string;
|
|
21
|
+
type: string;
|
|
22
|
+
avatar?: string | undefined;
|
|
23
|
+
}[], OrgItem[] | {
|
|
24
|
+
[x: string]: any;
|
|
25
|
+
id: string | number;
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
avatar?: string | undefined;
|
|
29
|
+
}[]>;
|
|
30
|
+
orgSearchList: Ref<{
|
|
17
31
|
[x: string]: any;
|
|
18
32
|
id: string | number;
|
|
19
33
|
name: string;
|
|
@@ -27,8 +41,8 @@ export declare const useApi: () => {
|
|
|
27
41
|
avatar?: string | undefined;
|
|
28
42
|
}[]>;
|
|
29
43
|
getOrgList: (deptId?: string) => Promise<void>;
|
|
30
|
-
currentDeptId:
|
|
31
|
-
deptPath:
|
|
44
|
+
currentDeptId: Ref<string, string>;
|
|
45
|
+
deptPath: Ref<{
|
|
32
46
|
id: string | number;
|
|
33
47
|
name: string;
|
|
34
48
|
}[], {
|
|
@@ -39,4 +53,6 @@ export declare const useApi: () => {
|
|
|
39
53
|
name: string;
|
|
40
54
|
}[]>;
|
|
41
55
|
searchOrgList: import("lodash-es").DebouncedFunc<(userName: string) => Promise<void>>;
|
|
56
|
+
getRecentSelectedUsers: () => Promise<RecentSelection[]>;
|
|
57
|
+
setRecentSelectedUsers: (users: OrgItem[]) => Promise<void>;
|
|
42
58
|
};
|
package/es/org-picker/useApi.js
CHANGED
|
@@ -19,7 +19,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
21
|
import { ref } from "vue";
|
|
22
|
-
import { useFetch, getUserList } from "@cgboiler/core";
|
|
22
|
+
import { useFetch, getUserList, getStorage, setStorage } from "@cgboiler/core";
|
|
23
23
|
import { debounce } from "lodash-es";
|
|
24
24
|
const orgListCache = /* @__PURE__ */ new Map();
|
|
25
25
|
const fetchData = (url, cacheKey) => __async(void 0, null, function* () {
|
|
@@ -45,6 +45,7 @@ function initUserList() {
|
|
|
45
45
|
initUserList();
|
|
46
46
|
const useApi = () => {
|
|
47
47
|
const orgList = ref([]);
|
|
48
|
+
const orgSearchList = ref([]);
|
|
48
49
|
const currentDeptId = ref("1");
|
|
49
50
|
const deptPath = ref([{ id: "1", name: "\u5DDD\u9505\u516C\u53F8" }]);
|
|
50
51
|
const getOrgList = (deptId) => __async(void 0, null, function* () {
|
|
@@ -65,19 +66,54 @@ const useApi = () => {
|
|
|
65
66
|
});
|
|
66
67
|
const searchOrgList = debounce((userName) => __async(void 0, null, function* () {
|
|
67
68
|
if (!userName) {
|
|
68
|
-
|
|
69
|
+
orgSearchList.value = [];
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
71
72
|
const url = `https://wflow.cgboiler.com/v1/oa/org/tree/user/search/cloud?userName=${userName}`;
|
|
72
|
-
|
|
73
|
+
orgSearchList.value = yield fetchData(url);
|
|
73
74
|
}), 300);
|
|
75
|
+
const RECENT_SELECTED_USERS_KEY = "recent_selected_users_history";
|
|
76
|
+
const MAX_RECENT_SELECTIONS = 15;
|
|
77
|
+
const getRecentSelectedUsers = () => __async(void 0, null, function* () {
|
|
78
|
+
try {
|
|
79
|
+
const data = yield getStorage(RECENT_SELECTED_USERS_KEY);
|
|
80
|
+
return data || [];
|
|
81
|
+
} catch (error) {
|
|
82
|
+
console.error("Failed to get recent selected users history from localStorage", error);
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
const setRecentSelectedUsers = (users) => __async(void 0, null, function* () {
|
|
87
|
+
if (!users || users.length === 0)
|
|
88
|
+
return;
|
|
89
|
+
const history = yield getRecentSelectedUsers();
|
|
90
|
+
const newSelection = {
|
|
91
|
+
id: Date.now().toString(),
|
|
92
|
+
// 使用时间戳作为唯一ID
|
|
93
|
+
selectedUsers: users
|
|
94
|
+
};
|
|
95
|
+
const filteredHistory = history.filter((item) => {
|
|
96
|
+
return !(item.selectedUsers.length === newSelection.selectedUsers.length && item.selectedUsers.every(
|
|
97
|
+
(user) => newSelection.selectedUsers.some((sUser) => sUser.id === user.id)
|
|
98
|
+
));
|
|
99
|
+
});
|
|
100
|
+
const updatedHistory = [newSelection, ...filteredHistory].slice(0, MAX_RECENT_SELECTIONS);
|
|
101
|
+
try {
|
|
102
|
+
yield setStorage(RECENT_SELECTED_USERS_KEY, JSON.parse(JSON.stringify(updatedHistory)));
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error("Failed to set recent selected users history to localStorage", error);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
74
107
|
return {
|
|
75
108
|
userList,
|
|
76
109
|
orgList,
|
|
110
|
+
orgSearchList,
|
|
77
111
|
getOrgList,
|
|
78
112
|
currentDeptId,
|
|
79
113
|
deptPath,
|
|
80
|
-
searchOrgList
|
|
114
|
+
searchOrgList,
|
|
115
|
+
getRecentSelectedUsers,
|
|
116
|
+
setRecentSelectedUsers
|
|
81
117
|
};
|
|
82
118
|
};
|
|
83
119
|
export {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function useSearch(props: any, api: any): {
|
|
2
|
+
keyword: import("vue").Ref<string, string>;
|
|
3
|
+
searchRef: import("vue").Ref<any, any>;
|
|
4
|
+
renderSearchResult: ({ handleHistorySelect, isSelected, handleSelect }: any) => import("vue/jsx-runtime").JSX.Element;
|
|
5
|
+
filteredOrgList: import("vue").ComputedRef<any>;
|
|
6
|
+
recentSelectedHistory: import("vue").Ref<any[], any[]>;
|
|
7
|
+
filterRecentSelectedHistory: import("vue").Ref<any[], any[]>;
|
|
8
|
+
highlightText: (text: string, keyword: string) => string | (string | import("vue/jsx-runtime").JSX.Element)[];
|
|
9
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = (value) => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = (value) => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
import { createVNode as _createVNode, Fragment as _Fragment, createTextVNode as _createTextVNode } from "vue";
|
|
22
|
+
import "./_atomic.css";
|
|
23
|
+
import { ref, computed, watch, watchEffect, nextTick } from "vue";
|
|
24
|
+
import { Empty, List, Image } from "vant";
|
|
25
|
+
function useSearch(props, api) {
|
|
26
|
+
const {
|
|
27
|
+
orgSearchList,
|
|
28
|
+
getOrgList,
|
|
29
|
+
currentDeptId,
|
|
30
|
+
searchOrgList,
|
|
31
|
+
getRecentSelectedUsers
|
|
32
|
+
} = api;
|
|
33
|
+
const keyword = ref("");
|
|
34
|
+
const searchRef = ref();
|
|
35
|
+
const recentSelectedHistory = ref([]);
|
|
36
|
+
const filterRecentSelectedHistory = ref([]);
|
|
37
|
+
watchEffect(() => __async(this, null, function* () {
|
|
38
|
+
recentSelectedHistory.value = yield getRecentSelectedUsers();
|
|
39
|
+
}));
|
|
40
|
+
watchEffect(() => {
|
|
41
|
+
if (keyword.value) {
|
|
42
|
+
filterRecentSelectedHistory.value = recentSelectedHistory.value.filter((item) => item.selectedUsers.some((user) => keyword.value.split("").some((char) => user.name.includes(char))));
|
|
43
|
+
} else {
|
|
44
|
+
filterRecentSelectedHistory.value = recentSelectedHistory.value;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
watch(() => props.show, (newVal) => __async(this, null, function* () {
|
|
48
|
+
if (newVal && props.autoFocus) {
|
|
49
|
+
yield nextTick();
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
var _a;
|
|
52
|
+
(_a = searchRef.value) == null ? void 0 : _a.focus();
|
|
53
|
+
}, 300);
|
|
54
|
+
}
|
|
55
|
+
}));
|
|
56
|
+
watch(keyword, (newKeyword) => {
|
|
57
|
+
if (newKeyword) {
|
|
58
|
+
searchOrgList(newKeyword);
|
|
59
|
+
} else {
|
|
60
|
+
getOrgList(currentDeptId.value);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const filteredOrgList = computed(() => {
|
|
64
|
+
if (keyword.value) {
|
|
65
|
+
return orgSearchList.value;
|
|
66
|
+
}
|
|
67
|
+
return [];
|
|
68
|
+
});
|
|
69
|
+
const highlightText = (text, keyword2) => {
|
|
70
|
+
if (!keyword2) {
|
|
71
|
+
return text;
|
|
72
|
+
}
|
|
73
|
+
const keywordChars = keyword2.split("");
|
|
74
|
+
return Array.from(text).map((char, index) => keywordChars.some((kChar) => char.toLowerCase() === kChar.toLowerCase()) ? _createVNode("span", {
|
|
75
|
+
"class": "highlight"
|
|
76
|
+
}, [char]) : char);
|
|
77
|
+
};
|
|
78
|
+
const renderSearchResult = ({
|
|
79
|
+
handleHistorySelect,
|
|
80
|
+
isSelected,
|
|
81
|
+
handleSelect
|
|
82
|
+
}) => {
|
|
83
|
+
return _createVNode("div", {
|
|
84
|
+
"class": "absolute top-0 left-0 right-0 bottom-0 bg-[#fff] z-1"
|
|
85
|
+
}, [filterRecentSelectedHistory.value.length ? _createVNode(_Fragment, null, [_createVNode("p", {
|
|
86
|
+
"class": "text-[14px] text-[#333] font-bold px-[16px] py-[12px] border-b border-[#eee]"
|
|
87
|
+
}, [_createTextVNode("\u6700\u8FD1\u9009\u62E9")]), _createVNode("div", {
|
|
88
|
+
"class": "recent-list-wrap flex-1 overflow-auto px-[16px] py-[8px]"
|
|
89
|
+
}, [filterRecentSelectedHistory.value.map((historyItem) => _createVNode("div", {
|
|
90
|
+
"key": historyItem.id,
|
|
91
|
+
"onClick": () => handleHistorySelect(historyItem),
|
|
92
|
+
"class": "px-16px py-8px border-b border-[#eee]"
|
|
93
|
+
}, [_createVNode("span", null, [historyItem.selectedUsers.map((user) => highlightText(user.name, keyword.value)).reduce((prev, curr) => [prev, "\uFF0C", curr])])]))])]) : "", filteredOrgList.value.length ? _createVNode(_Fragment, null, [" ", _createVNode("p", {
|
|
94
|
+
"class": "text-[14px] text-[#333] font-bold px-[16px] py-[12px] border-b border-[#eee]"
|
|
95
|
+
}, [_createTextVNode("\u901A\u8BAF\u5F55")]), _createVNode("div", {
|
|
96
|
+
"class": "feed-list-wrap"
|
|
97
|
+
}, [filteredOrgList.value.length === 0 ? _createVNode(Empty, {
|
|
98
|
+
"description": "\u672A\u627E\u5230\u76F8\u5173\u4EBA\u5458"
|
|
99
|
+
}, null) : _createVNode(List, null, {
|
|
100
|
+
default: () => [filteredOrgList.value.map((item) => _createVNode("div", {
|
|
101
|
+
"class": ["org-item", isSelected(item) ? "selected" : ""],
|
|
102
|
+
"onClick": () => handleSelect(item)
|
|
103
|
+
}, [_createVNode(Image, {
|
|
104
|
+
"class": "org-avatar",
|
|
105
|
+
"src": item.avatar
|
|
106
|
+
}, null), _createVNode("div", {
|
|
107
|
+
"class": "org-name"
|
|
108
|
+
}, [item.name, _createVNode("span", {
|
|
109
|
+
"class": "org-item-select-icon"
|
|
110
|
+
}, [_createTextVNode("\u2713")])])]))]
|
|
111
|
+
})])]) : ""]);
|
|
112
|
+
};
|
|
113
|
+
return {
|
|
114
|
+
keyword,
|
|
115
|
+
searchRef,
|
|
116
|
+
renderSearchResult,
|
|
117
|
+
filteredOrgList,
|
|
118
|
+
recentSelectedHistory,
|
|
119
|
+
filterRecentSelectedHistory,
|
|
120
|
+
highlightText
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
useSearch
|
|
125
|
+
};
|
package/lib/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare namespace _default {
|
|
|
7
7
|
}
|
|
8
8
|
export default _default;
|
|
9
9
|
export function install(app: any): void;
|
|
10
|
-
export const version: "1.17.
|
|
10
|
+
export const version: "1.17.7";
|
|
11
11
|
import MdPreview from './md-preview';
|
|
12
12
|
import OrgPicker from './org-picker';
|
|
13
13
|
import ProjectSelect from './project-select';
|
package/lib/index.js
CHANGED
|
@@ -42,7 +42,7 @@ var import_project_select = __toESM(require("./project-select"));
|
|
|
42
42
|
__reExport(stdin_exports, require("./md-preview"), module.exports);
|
|
43
43
|
__reExport(stdin_exports, require("./org-picker"), module.exports);
|
|
44
44
|
__reExport(stdin_exports, require("./project-select"), module.exports);
|
|
45
|
-
const version = "1.17.
|
|
45
|
+
const version = "1.17.7";
|
|
46
46
|
function install(app) {
|
|
47
47
|
const components = [
|
|
48
48
|
import_md_preview.default,
|
|
@@ -25,26 +25,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
mod
|
|
26
26
|
));
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
var __async = (__this, __arguments, generator) => {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
var fulfilled = (value) => {
|
|
31
|
-
try {
|
|
32
|
-
step(generator.next(value));
|
|
33
|
-
} catch (e) {
|
|
34
|
-
reject(e);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var rejected = (value) => {
|
|
38
|
-
try {
|
|
39
|
-
step(generator.throw(value));
|
|
40
|
-
} catch (e) {
|
|
41
|
-
reject(e);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
45
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
28
|
var stdin_exports = {};
|
|
49
29
|
__export(stdin_exports, {
|
|
50
30
|
default: () => stdin_default
|
|
@@ -58,6 +38,7 @@ var import_DeptImg = __toESM(require("./components/DeptImg"));
|
|
|
58
38
|
var import_types = require("./types");
|
|
59
39
|
var import_useApi = require("./useApi");
|
|
60
40
|
var import_index = require("./index.css");
|
|
41
|
+
var import_useSearch = require("./useSearch");
|
|
61
42
|
var stdin_default = (0, import_vue2.defineComponent)({
|
|
62
43
|
name: "OrgPicker",
|
|
63
44
|
props: import_types.orgPickerProps,
|
|
@@ -65,16 +46,29 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
65
46
|
setup(props, {
|
|
66
47
|
emit
|
|
67
48
|
}) {
|
|
49
|
+
const api = (0, import_useApi.useApi)();
|
|
68
50
|
const {
|
|
69
|
-
orgList,
|
|
70
51
|
getOrgList,
|
|
71
|
-
|
|
52
|
+
orgList,
|
|
72
53
|
deptPath,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
} =
|
|
54
|
+
userList,
|
|
55
|
+
setRecentSelectedUsers
|
|
56
|
+
} = api;
|
|
76
57
|
getOrgList();
|
|
58
|
+
const activeTab = (0, import_vue2.ref)("txl");
|
|
59
|
+
const {
|
|
60
|
+
keyword,
|
|
61
|
+
searchRef,
|
|
62
|
+
recentSelectedHistory,
|
|
63
|
+
highlightText,
|
|
64
|
+
renderSearchResult
|
|
65
|
+
} = (0, import_useSearch.useSearch)(props, api);
|
|
77
66
|
const selectedItems = (0, import_vue2.ref)([]);
|
|
67
|
+
const sortOrgList = (0, import_vue2.computed)(() => {
|
|
68
|
+
const departments = orgList.value.filter((item) => item.type === "dept");
|
|
69
|
+
const personnel = orgList.value.filter((item) => item.type !== "dept");
|
|
70
|
+
return [...personnel, ...departments];
|
|
71
|
+
});
|
|
78
72
|
(0, import_vue2.watch)(() => props.modelValue, (newValue) => {
|
|
79
73
|
var _a;
|
|
80
74
|
if (!newValue) {
|
|
@@ -105,46 +99,20 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
105
99
|
selectedItems.value = [item];
|
|
106
100
|
emit("update:modelValue", [item.id]);
|
|
107
101
|
emit("update:show", false);
|
|
102
|
+
setRecentSelectedUsers(selectedItems.value);
|
|
108
103
|
}
|
|
109
104
|
};
|
|
105
|
+
const handleHistorySelect = (item) => {
|
|
106
|
+
selectedItems.value = item.selectedUsers;
|
|
107
|
+
};
|
|
110
108
|
const handleConfirm = () => {
|
|
111
109
|
emit("update:show", false);
|
|
112
110
|
emit("update:modelValue", selectedItems.value.map((item) => item.id));
|
|
111
|
+
setRecentSelectedUsers(selectedItems.value);
|
|
113
112
|
};
|
|
114
|
-
const keyword = (0, import_vue2.ref)("");
|
|
115
|
-
const loading = (0, import_vue2.ref)(false);
|
|
116
|
-
const finished = (0, import_vue2.ref)(true);
|
|
117
|
-
const searchRef = (0, import_vue2.ref)();
|
|
118
|
-
(0, import_vue2.watch)(() => props.show, (newVal) => __async(this, null, function* () {
|
|
119
|
-
if (newVal && props.autoFocus) {
|
|
120
|
-
yield (0, import_vue2.nextTick)();
|
|
121
|
-
setTimeout(() => {
|
|
122
|
-
var _a;
|
|
123
|
-
(_a = searchRef.value) == null ? void 0 : _a.focus();
|
|
124
|
-
}, 300);
|
|
125
|
-
}
|
|
126
|
-
}));
|
|
127
|
-
(0, import_vue2.watch)(keyword, (newKeyword) => {
|
|
128
|
-
if (newKeyword) {
|
|
129
|
-
searchOrgList(newKeyword);
|
|
130
|
-
} else {
|
|
131
|
-
getOrgList(currentDeptId.value);
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
const filteredOrgList = (0, import_vue2.computed)(() => {
|
|
135
|
-
if (keyword.value) {
|
|
136
|
-
return orgList.value;
|
|
137
|
-
}
|
|
138
|
-
const departments = orgList.value.filter((item) => item.type === "dept");
|
|
139
|
-
const personnel = orgList.value.filter((item) => item.type !== "dept");
|
|
140
|
-
return [...personnel, ...departments];
|
|
141
|
-
});
|
|
142
113
|
const isSelected = (item) => {
|
|
143
114
|
return selectedItems.value.some((s) => s.id === item.id);
|
|
144
115
|
};
|
|
145
|
-
const onLoad = () => {
|
|
146
|
-
finished.value = true;
|
|
147
|
-
};
|
|
148
116
|
return () => (0, import_vue.createVNode)(import_vant.ActionSheet, {
|
|
149
117
|
"show": props.show,
|
|
150
118
|
"onUpdate:show": (val) => emit("update:show", val),
|
|
@@ -172,7 +140,30 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
172
140
|
"class": "close-icon"
|
|
173
141
|
}, [(0, import_vue.createTextVNode)("X")])])) : (0, import_vue.createVNode)("p", {
|
|
174
142
|
"class": "color-[#aaa] text-[14px] text-center w-full leading-[38px]"
|
|
175
|
-
}, [(0, import_vue.createTextVNode)("\u672A\u9009\u62E9\u4EBA\u5458")])]),
|
|
143
|
+
}, [(0, import_vue.createTextVNode)("\u672A\u9009\u62E9\u4EBA\u5458")])]), (0, import_vue.createVNode)("div", {
|
|
144
|
+
"class": "flex-1 flex flex-col overflow-hidden relative"
|
|
145
|
+
}, [(0, import_vue.createVNode)(import_vant.Tabs, {
|
|
146
|
+
"active": activeTab.value,
|
|
147
|
+
"onUpdate:active": ($event) => activeTab.value = $event
|
|
148
|
+
}, {
|
|
149
|
+
default: () => [(0, import_vue.createVNode)(import_vant.Tab, {
|
|
150
|
+
"title": "\u901A\u8BAF\u5F55",
|
|
151
|
+
"name": "txl"
|
|
152
|
+
}, null), (0, import_vue.createVNode)(import_vant.Tab, {
|
|
153
|
+
"title": "\u6700\u8FD1\u9009\u62E9",
|
|
154
|
+
"name": "zjxz"
|
|
155
|
+
}, null)]
|
|
156
|
+
}), (0, import_vue.createVNode)("div", {
|
|
157
|
+
"class": "org-content-wrap"
|
|
158
|
+
}, [activeTab.value === "zjxz" ? (0, import_vue.createVNode)("div", {
|
|
159
|
+
"class": "recent-list-wrap flex-1 overflow-auto px-[16px] py-[8px]"
|
|
160
|
+
}, [recentSelectedHistory.value.length === 0 ? (0, import_vue.createVNode)(import_vant.Empty, {
|
|
161
|
+
"description": "\u6682\u65E0\u6700\u8FD1\u9009\u62E9\u8BB0\u5F55"
|
|
162
|
+
}, null) : recentSelectedHistory.value.map((historyItem) => (0, import_vue.createVNode)("div", {
|
|
163
|
+
"key": historyItem.id,
|
|
164
|
+
"onClick": () => handleHistorySelect(historyItem),
|
|
165
|
+
"class": "px-16px py-8px border-b border-[#eee]"
|
|
166
|
+
}, [(0, import_vue.createVNode)("span", null, [historyItem.selectedUsers.map((user) => highlightText(user.name, keyword.value)).reduce((prev, curr) => [prev, "\uFF0C", curr])])]))]) : (0, import_vue.createVNode)(import_vue.Fragment, null, [(0, import_vue.createVNode)("div", {
|
|
176
167
|
"class": "breadcrumb-nav"
|
|
177
168
|
}, [deptPath.value.map((dept, index) => (0, import_vue.createVNode)("span", {
|
|
178
169
|
"key": dept.id
|
|
@@ -186,14 +177,10 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
186
177
|
"class": "separator"
|
|
187
178
|
}, [(0, import_vue.createTextVNode)(" / ")])]))]), (0, import_vue.createVNode)("div", {
|
|
188
179
|
"class": "feed-list-wrap"
|
|
189
|
-
}, [
|
|
190
|
-
"description":
|
|
191
|
-
}, null) : (0, import_vue.createVNode)(import_vant.List, {
|
|
192
|
-
|
|
193
|
-
"finished": finished.value,
|
|
194
|
-
"onLoad": onLoad
|
|
195
|
-
}, {
|
|
196
|
-
default: () => [filteredOrgList.value.map((item) => (0, import_vue.createVNode)("div", {
|
|
180
|
+
}, [sortOrgList.value.length === 0 ? (0, import_vue.createVNode)(import_vant.Empty, {
|
|
181
|
+
"description": "\u8BE5\u90E8\u95E8\u4E0B\u6CA1\u6709\u4EBA\u5458"
|
|
182
|
+
}, null) : (0, import_vue.createVNode)(import_vant.List, null, {
|
|
183
|
+
default: () => [sortOrgList.value.map((item) => (0, import_vue.createVNode)("div", {
|
|
197
184
|
"class": ["org-item", isSelected(item) ? "selected" : ""],
|
|
198
185
|
"onClick": () => handleSelect(item)
|
|
199
186
|
}, [item.type === "dept" && !keyword.value ? (0, import_vue.createVNode)("div", {
|
|
@@ -206,6 +193,10 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
206
193
|
}, [item.name, (0, import_vue.createVNode)("span", {
|
|
207
194
|
"class": "org-item-select-icon"
|
|
208
195
|
}, [(0, import_vue.createTextVNode)("\u2713")])])]))]
|
|
196
|
+
})])])]), keyword.value && renderSearchResult({
|
|
197
|
+
handleHistorySelect,
|
|
198
|
+
isSelected,
|
|
199
|
+
handleSelect
|
|
209
200
|
})]), props.multiple && (0, import_vue.createVNode)("div", {
|
|
210
201
|
"class": "bottom-section"
|
|
211
202
|
}, [(0, import_vue.createVNode)("div", {
|
|
@@ -31,7 +31,39 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/* layer: default */
|
|
34
|
+
.cgx-atm .absolute{position:absolute;}
|
|
35
|
+
.cgx-atm .bottom-0{bottom:0rem;}
|
|
36
|
+
.cgx-atm .left-0{left:0rem;}
|
|
37
|
+
.cgx-atm .right-0{right:0rem;}
|
|
38
|
+
.cgx-atm .top-0{top:0rem;}
|
|
39
|
+
.cgx-atm .z-1{z-index:1;}
|
|
40
|
+
.cgx-atm .flex-1{flex:1 1 0%;}
|
|
41
|
+
.cgx-atm .overflow-auto{overflow:auto;}
|
|
42
|
+
.cgx-atm .border-b{border-bottom-width:1px;border-bottom-style:solid;}
|
|
43
|
+
.cgx-atm .border-\[\#eee\]{--un-border-opacity:1;border-color:rgba(238,238,238,var(--un-border-opacity));}
|
|
44
|
+
.cgx-atm .bg-\[\#fff\]{--un-bg-opacity:1;background-color:rgba(255,255,255,var(--un-bg-opacity));}
|
|
45
|
+
.cgx-atm .px-\[16px\],
|
|
46
|
+
.cgx-atm .px-16px{padding-left:16px;padding-right:16px;}
|
|
47
|
+
.cgx-atm .py-\[12px\]{padding-top:12px;padding-bottom:12px;}
|
|
48
|
+
.cgx-atm .py-\[8px\],
|
|
49
|
+
.cgx-atm .py-8px{padding-top:8px;padding-bottom:8px;}
|
|
50
|
+
.cgx-atm .text-\[14px\]{font-size:14px;}
|
|
51
|
+
.cgx-atm .font-bold{font-weight:700;}
|
|
52
|
+
.cgx-atm .text-\[\#333\]{--un-text-opacity:1;color:rgba(51,51,51,var(--un-text-opacity));}
|
|
53
|
+
/* layer: default */
|
|
54
|
+
.cgx-atm .relative{position:relative;}
|
|
34
55
|
.cgx-atm .w-full{width:100%;}
|
|
56
|
+
.cgx-atm .flex{display:flex;}
|
|
57
|
+
.cgx-atm .flex-1{flex:1 1 0%;}
|
|
58
|
+
.cgx-atm .flex-col{flex-direction:column;}
|
|
59
|
+
.cgx-atm .overflow-auto{overflow:auto;}
|
|
60
|
+
.cgx-atm .overflow-hidden{overflow:hidden;}
|
|
61
|
+
.cgx-atm .border-b{border-bottom-width:1px;border-bottom-style:solid;}
|
|
62
|
+
.cgx-atm .border-\[\#eee\]{--un-border-opacity:1;border-color:rgba(238,238,238,var(--un-border-opacity));}
|
|
63
|
+
.cgx-atm .px-\[16px\],
|
|
64
|
+
.cgx-atm .px-16px{padding-left:16px;padding-right:16px;}
|
|
65
|
+
.cgx-atm .py-\[8px\],
|
|
66
|
+
.cgx-atm .py-8px{padding-top:8px;padding-bottom:8px;}
|
|
35
67
|
.cgx-atm .text-center{text-align:center;}
|
|
36
68
|
.cgx-atm .text-\[14px\]{font-size:14px;}
|
|
37
69
|
.cgx-atm .leading-\[38px\]{line-height:38px;}
|
package/lib/org-picker/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root:root{--van-action-sheet-max-height: 100%}.org-list{height:85vh;display:flex;flex-direction:column}.org-list .breadcrumb-nav{margin-bottom:4px;padding:2px 16px;border-radius:4px;font-size:12px}.org-list .breadcrumb-nav .dept-name.current-dept{color:#969799}.org-list .breadcrumb-nav .separator{color:#969799;margin:0 4px}.org-list .search-bar{position:-webkit-sticky;position:-webkit-sticky;position:sticky;top:0;z-index:1}.org-list .org-selected-items{display:flex;flex-wrap:nowrap;padding:12px 16px;gap:12px;background-color:#fff;overflow-x:auto;height:68px;border-bottom:1px solid #eee}.org-list .org-selected-items .selected-tag{flex-shrink:0;background:none;border:none;padding:0;margin:0;position:relative}.org-list .org-selected-items .selected-tag .close-icon{position:absolute;top:0;right:0;z-index:1;background-color:#fff;border-radius:50%;border:1px solid #eee;width:10px;height:10px;display:flex;align-items:center;justify-content:center;font-size:6px;color:#969799}.org-list .org-selected-items .selected-tag .tag-avatar{width:40px;height:40px}.org-list .org-selected-items .selected-tag .tag-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .bottom-section{border-top:1px solid #eee;background-color:#fff}.org-list .van-list{flex:1;overflow-y:auto;padding:0 16px}.org-list .feed-list-wrap{flex:1;display:flex;overflow:hidden;position:relative;justify-content:center}.org-list .search-result-list{position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;background-color:#fff;overflow-y:auto;padding:0 16px}.org-list .org-item{padding:12px 0;border-bottom:1px solid #eee;cursor:pointer;display:flex;align-items:center;gap:12px}.org-list .org-item .org-item-select-icon{display:none;padding-left:4px}.org-list .org-item.selected{color:var(--van-primary-color)}.org-list .org-item.selected .org-item-select-icon{display:inline}.org-list .org-item .org-avatar{flex-shrink:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.org-list .org-item .org-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .org-item .org-name{font-size:14px;flex:1}.org-list .org-item:last-child{border-bottom:none}.org-list .action-buttons{padding:16px;display:flex;justify-content:center}.org-list .action-buttons .confirm-button{background-color:var(--van-primary-color);color:#fff;padding:10px 0;border-radius:4px;text-align:center;width:100%;font-size:14px}
|
|
1
|
+
:root:root{--van-action-sheet-max-height: 100%}.org-list{height:85vh;display:flex;flex-direction:column}.org-list .highlight{color:var(--van-primary-color);font-weight:700}.org-list .breadcrumb-nav{margin-bottom:4px;padding:2px 16px;border-radius:4px;font-size:12px}.org-list .breadcrumb-nav .dept-name.current-dept{color:#969799}.org-list .breadcrumb-nav .separator{color:#969799;margin:0 4px}.org-list .search-bar{position:-webkit-sticky;position:-webkit-sticky;position:sticky;top:0;z-index:1}.org-list .org-selected-items{display:flex;flex-wrap:nowrap;padding:12px 16px;gap:12px;background-color:#fff;overflow-x:auto;height:68px;border-bottom:1px solid #eee}.org-list .org-selected-items .selected-tag{flex-shrink:0;background:none;border:none;padding:0;margin:0;position:relative}.org-list .org-selected-items .selected-tag .close-icon{position:absolute;top:0;right:0;z-index:1;background-color:#fff;border-radius:50%;border:1px solid #eee;width:10px;height:10px;display:flex;align-items:center;justify-content:center;font-size:6px;color:#969799}.org-list .org-selected-items .selected-tag .tag-avatar{width:40px;height:40px}.org-list .org-selected-items .selected-tag .tag-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .bottom-section{border-top:1px solid #eee;background-color:#fff}.org-list .van-list{flex:1;overflow-y:auto;padding:0 16px}.org-list .org-content-wrap{flex:1;display:flex;flex-direction:column;overflow:hidden;position:relative}.org-list .feed-list-wrap{flex:1;display:flex;overflow:hidden;position:relative;justify-content:center}.org-list .search-result-list{position:absolute;top:0;left:0;right:0;bottom:0;z-index:1;background-color:#fff;overflow-y:auto;padding:0 16px}.org-list .org-item{padding:12px 0;border-bottom:1px solid #eee;cursor:pointer;display:flex;align-items:center;gap:12px}.org-list .org-item .org-item-select-icon{display:none;padding-left:4px}.org-list .org-item.selected{color:var(--van-primary-color)}.org-list .org-item.selected .org-item-select-icon{display:inline}.org-list .org-item .org-avatar{flex-shrink:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.org-list .org-item .org-avatar img{border-radius:4px;border:1px solid #eee;object-fit:contain}.org-list .org-item .org-name{font-size:14px;flex:1}.org-list .org-item:last-child{border-bottom:none}.org-list .action-buttons{padding:16px;display:flex;justify-content:center}.org-list .action-buttons .confirm-button{background-color:var(--van-primary-color);color:#fff;padding:10px 0;border-radius:4px;text-align:center;width:100%;font-size:14px}
|
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
height: 85vh;
|
|
6
6
|
display: flex;
|
|
7
7
|
flex-direction: column;
|
|
8
|
+
|
|
9
|
+
.highlight {
|
|
10
|
+
color: var(--van-primary-color);
|
|
11
|
+
font-weight: bold;
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
.breadcrumb-nav {
|
|
10
15
|
margin-bottom: 4px;
|
|
@@ -87,6 +92,14 @@
|
|
|
87
92
|
padding: 0 16px;
|
|
88
93
|
}
|
|
89
94
|
|
|
95
|
+
.org-content-wrap {
|
|
96
|
+
flex: 1;
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
overflow: hidden;
|
|
100
|
+
position: relative;
|
|
101
|
+
}
|
|
102
|
+
|
|
90
103
|
.feed-list-wrap {
|
|
91
104
|
flex: 1;
|
|
92
105
|
display: flex;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { type OrgItem, RecentSelection } from './types';
|
|
2
3
|
export declare const useApi: () => {
|
|
3
|
-
userList:
|
|
4
|
+
userList: Ref<{
|
|
4
5
|
[x: string]: any;
|
|
5
6
|
id: string | number;
|
|
6
7
|
name: string;
|
|
@@ -13,7 +14,20 @@ export declare const useApi: () => {
|
|
|
13
14
|
type: string;
|
|
14
15
|
avatar?: string | undefined;
|
|
15
16
|
}[]>;
|
|
16
|
-
orgList:
|
|
17
|
+
orgList: Ref<{
|
|
18
|
+
[x: string]: any;
|
|
19
|
+
id: string | number;
|
|
20
|
+
name: string;
|
|
21
|
+
type: string;
|
|
22
|
+
avatar?: string | undefined;
|
|
23
|
+
}[], OrgItem[] | {
|
|
24
|
+
[x: string]: any;
|
|
25
|
+
id: string | number;
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
avatar?: string | undefined;
|
|
29
|
+
}[]>;
|
|
30
|
+
orgSearchList: Ref<{
|
|
17
31
|
[x: string]: any;
|
|
18
32
|
id: string | number;
|
|
19
33
|
name: string;
|
|
@@ -27,8 +41,8 @@ export declare const useApi: () => {
|
|
|
27
41
|
avatar?: string | undefined;
|
|
28
42
|
}[]>;
|
|
29
43
|
getOrgList: (deptId?: string) => Promise<void>;
|
|
30
|
-
currentDeptId:
|
|
31
|
-
deptPath:
|
|
44
|
+
currentDeptId: Ref<string, string>;
|
|
45
|
+
deptPath: Ref<{
|
|
32
46
|
id: string | number;
|
|
33
47
|
name: string;
|
|
34
48
|
}[], {
|
|
@@ -39,4 +53,6 @@ export declare const useApi: () => {
|
|
|
39
53
|
name: string;
|
|
40
54
|
}[]>;
|
|
41
55
|
searchOrgList: import("lodash-es").DebouncedFunc<(userName: string) => Promise<void>>;
|
|
56
|
+
getRecentSelectedUsers: () => Promise<RecentSelection[]>;
|
|
57
|
+
setRecentSelectedUsers: (users: OrgItem[]) => Promise<void>;
|
|
42
58
|
};
|
package/lib/org-picker/useApi.js
CHANGED
|
@@ -67,6 +67,7 @@ function initUserList() {
|
|
|
67
67
|
initUserList();
|
|
68
68
|
const useApi = () => {
|
|
69
69
|
const orgList = (0, import_vue.ref)([]);
|
|
70
|
+
const orgSearchList = (0, import_vue.ref)([]);
|
|
70
71
|
const currentDeptId = (0, import_vue.ref)("1");
|
|
71
72
|
const deptPath = (0, import_vue.ref)([{ id: "1", name: "\u5DDD\u9505\u516C\u53F8" }]);
|
|
72
73
|
const getOrgList = (deptId) => __async(void 0, null, function* () {
|
|
@@ -87,18 +88,53 @@ const useApi = () => {
|
|
|
87
88
|
});
|
|
88
89
|
const searchOrgList = (0, import_lodash_es.debounce)((userName) => __async(void 0, null, function* () {
|
|
89
90
|
if (!userName) {
|
|
90
|
-
|
|
91
|
+
orgSearchList.value = [];
|
|
91
92
|
return;
|
|
92
93
|
}
|
|
93
94
|
const url = `https://wflow.cgboiler.com/v1/oa/org/tree/user/search/cloud?userName=${userName}`;
|
|
94
|
-
|
|
95
|
+
orgSearchList.value = yield fetchData(url);
|
|
95
96
|
}), 300);
|
|
97
|
+
const RECENT_SELECTED_USERS_KEY = "recent_selected_users_history";
|
|
98
|
+
const MAX_RECENT_SELECTIONS = 15;
|
|
99
|
+
const getRecentSelectedUsers = () => __async(void 0, null, function* () {
|
|
100
|
+
try {
|
|
101
|
+
const data = yield (0, import_core.getStorage)(RECENT_SELECTED_USERS_KEY);
|
|
102
|
+
return data || [];
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error("Failed to get recent selected users history from localStorage", error);
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const setRecentSelectedUsers = (users) => __async(void 0, null, function* () {
|
|
109
|
+
if (!users || users.length === 0)
|
|
110
|
+
return;
|
|
111
|
+
const history = yield getRecentSelectedUsers();
|
|
112
|
+
const newSelection = {
|
|
113
|
+
id: Date.now().toString(),
|
|
114
|
+
// 使用时间戳作为唯一ID
|
|
115
|
+
selectedUsers: users
|
|
116
|
+
};
|
|
117
|
+
const filteredHistory = history.filter((item) => {
|
|
118
|
+
return !(item.selectedUsers.length === newSelection.selectedUsers.length && item.selectedUsers.every(
|
|
119
|
+
(user) => newSelection.selectedUsers.some((sUser) => sUser.id === user.id)
|
|
120
|
+
));
|
|
121
|
+
});
|
|
122
|
+
const updatedHistory = [newSelection, ...filteredHistory].slice(0, MAX_RECENT_SELECTIONS);
|
|
123
|
+
try {
|
|
124
|
+
yield (0, import_core.setStorage)(RECENT_SELECTED_USERS_KEY, JSON.parse(JSON.stringify(updatedHistory)));
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.error("Failed to set recent selected users history to localStorage", error);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
96
129
|
return {
|
|
97
130
|
userList,
|
|
98
131
|
orgList,
|
|
132
|
+
orgSearchList,
|
|
99
133
|
getOrgList,
|
|
100
134
|
currentDeptId,
|
|
101
135
|
deptPath,
|
|
102
|
-
searchOrgList
|
|
136
|
+
searchOrgList,
|
|
137
|
+
getRecentSelectedUsers,
|
|
138
|
+
setRecentSelectedUsers
|
|
103
139
|
};
|
|
104
140
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function useSearch(props: any, api: any): {
|
|
2
|
+
keyword: import("vue").Ref<string, string>;
|
|
3
|
+
searchRef: import("vue").Ref<any, any>;
|
|
4
|
+
renderSearchResult: ({ handleHistorySelect, isSelected, handleSelect }: any) => import("vue/jsx-runtime").JSX.Element;
|
|
5
|
+
filteredOrgList: import("vue").ComputedRef<any>;
|
|
6
|
+
recentSelectedHistory: import("vue").Ref<any[], any[]>;
|
|
7
|
+
filterRecentSelectedHistory: import("vue").Ref<any[], any[]>;
|
|
8
|
+
highlightText: (text: string, keyword: string) => string | (string | import("vue/jsx-runtime").JSX.Element)[];
|
|
9
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var __async = (__this, __arguments, generator) => {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
var fulfilled = (value) => {
|
|
21
|
+
try {
|
|
22
|
+
step(generator.next(value));
|
|
23
|
+
} catch (e) {
|
|
24
|
+
reject(e);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var rejected = (value) => {
|
|
28
|
+
try {
|
|
29
|
+
step(generator.throw(value));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
reject(e);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
35
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
var stdin_exports = {};
|
|
39
|
+
__export(stdin_exports, {
|
|
40
|
+
useSearch: () => useSearch
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(stdin_exports);
|
|
43
|
+
var import_vue = require("vue");
|
|
44
|
+
var import_atomic = require("./_atomic.css");
|
|
45
|
+
var import_vue2 = require("vue");
|
|
46
|
+
var import_vant = require("vant");
|
|
47
|
+
function useSearch(props, api) {
|
|
48
|
+
const {
|
|
49
|
+
orgSearchList,
|
|
50
|
+
getOrgList,
|
|
51
|
+
currentDeptId,
|
|
52
|
+
searchOrgList,
|
|
53
|
+
getRecentSelectedUsers
|
|
54
|
+
} = api;
|
|
55
|
+
const keyword = (0, import_vue2.ref)("");
|
|
56
|
+
const searchRef = (0, import_vue2.ref)();
|
|
57
|
+
const recentSelectedHistory = (0, import_vue2.ref)([]);
|
|
58
|
+
const filterRecentSelectedHistory = (0, import_vue2.ref)([]);
|
|
59
|
+
(0, import_vue2.watchEffect)(() => __async(this, null, function* () {
|
|
60
|
+
recentSelectedHistory.value = yield getRecentSelectedUsers();
|
|
61
|
+
}));
|
|
62
|
+
(0, import_vue2.watchEffect)(() => {
|
|
63
|
+
if (keyword.value) {
|
|
64
|
+
filterRecentSelectedHistory.value = recentSelectedHistory.value.filter((item) => item.selectedUsers.some((user) => keyword.value.split("").some((char) => user.name.includes(char))));
|
|
65
|
+
} else {
|
|
66
|
+
filterRecentSelectedHistory.value = recentSelectedHistory.value;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
(0, import_vue2.watch)(() => props.show, (newVal) => __async(this, null, function* () {
|
|
70
|
+
if (newVal && props.autoFocus) {
|
|
71
|
+
yield (0, import_vue2.nextTick)();
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
var _a;
|
|
74
|
+
(_a = searchRef.value) == null ? void 0 : _a.focus();
|
|
75
|
+
}, 300);
|
|
76
|
+
}
|
|
77
|
+
}));
|
|
78
|
+
(0, import_vue2.watch)(keyword, (newKeyword) => {
|
|
79
|
+
if (newKeyword) {
|
|
80
|
+
searchOrgList(newKeyword);
|
|
81
|
+
} else {
|
|
82
|
+
getOrgList(currentDeptId.value);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const filteredOrgList = (0, import_vue2.computed)(() => {
|
|
86
|
+
if (keyword.value) {
|
|
87
|
+
return orgSearchList.value;
|
|
88
|
+
}
|
|
89
|
+
return [];
|
|
90
|
+
});
|
|
91
|
+
const highlightText = (text, keyword2) => {
|
|
92
|
+
if (!keyword2) {
|
|
93
|
+
return text;
|
|
94
|
+
}
|
|
95
|
+
const keywordChars = keyword2.split("");
|
|
96
|
+
return Array.from(text).map((char, index) => keywordChars.some((kChar) => char.toLowerCase() === kChar.toLowerCase()) ? (0, import_vue.createVNode)("span", {
|
|
97
|
+
"class": "highlight"
|
|
98
|
+
}, [char]) : char);
|
|
99
|
+
};
|
|
100
|
+
const renderSearchResult = ({
|
|
101
|
+
handleHistorySelect,
|
|
102
|
+
isSelected,
|
|
103
|
+
handleSelect
|
|
104
|
+
}) => {
|
|
105
|
+
return (0, import_vue.createVNode)("div", {
|
|
106
|
+
"class": "absolute top-0 left-0 right-0 bottom-0 bg-[#fff] z-1"
|
|
107
|
+
}, [filterRecentSelectedHistory.value.length ? (0, import_vue.createVNode)(import_vue.Fragment, null, [(0, import_vue.createVNode)("p", {
|
|
108
|
+
"class": "text-[14px] text-[#333] font-bold px-[16px] py-[12px] border-b border-[#eee]"
|
|
109
|
+
}, [(0, import_vue.createTextVNode)("\u6700\u8FD1\u9009\u62E9")]), (0, import_vue.createVNode)("div", {
|
|
110
|
+
"class": "recent-list-wrap flex-1 overflow-auto px-[16px] py-[8px]"
|
|
111
|
+
}, [filterRecentSelectedHistory.value.map((historyItem) => (0, import_vue.createVNode)("div", {
|
|
112
|
+
"key": historyItem.id,
|
|
113
|
+
"onClick": () => handleHistorySelect(historyItem),
|
|
114
|
+
"class": "px-16px py-8px border-b border-[#eee]"
|
|
115
|
+
}, [(0, import_vue.createVNode)("span", null, [historyItem.selectedUsers.map((user) => highlightText(user.name, keyword.value)).reduce((prev, curr) => [prev, "\uFF0C", curr])])]))])]) : "", filteredOrgList.value.length ? (0, import_vue.createVNode)(import_vue.Fragment, null, [" ", (0, import_vue.createVNode)("p", {
|
|
116
|
+
"class": "text-[14px] text-[#333] font-bold px-[16px] py-[12px] border-b border-[#eee]"
|
|
117
|
+
}, [(0, import_vue.createTextVNode)("\u901A\u8BAF\u5F55")]), (0, import_vue.createVNode)("div", {
|
|
118
|
+
"class": "feed-list-wrap"
|
|
119
|
+
}, [filteredOrgList.value.length === 0 ? (0, import_vue.createVNode)(import_vant.Empty, {
|
|
120
|
+
"description": "\u672A\u627E\u5230\u76F8\u5173\u4EBA\u5458"
|
|
121
|
+
}, null) : (0, import_vue.createVNode)(import_vant.List, null, {
|
|
122
|
+
default: () => [filteredOrgList.value.map((item) => (0, import_vue.createVNode)("div", {
|
|
123
|
+
"class": ["org-item", isSelected(item) ? "selected" : ""],
|
|
124
|
+
"onClick": () => handleSelect(item)
|
|
125
|
+
}, [(0, import_vue.createVNode)(import_vant.Image, {
|
|
126
|
+
"class": "org-avatar",
|
|
127
|
+
"src": item.avatar
|
|
128
|
+
}, null), (0, import_vue.createVNode)("div", {
|
|
129
|
+
"class": "org-name"
|
|
130
|
+
}, [item.name, (0, import_vue.createVNode)("span", {
|
|
131
|
+
"class": "org-item-select-icon"
|
|
132
|
+
}, [(0, import_vue.createTextVNode)("\u2713")])])]))]
|
|
133
|
+
})])]) : ""]);
|
|
134
|
+
};
|
|
135
|
+
return {
|
|
136
|
+
keyword,
|
|
137
|
+
searchRef,
|
|
138
|
+
renderSearchResult,
|
|
139
|
+
filteredOrgList,
|
|
140
|
+
recentSelectedHistory,
|
|
141
|
+
filterRecentSelectedHistory,
|
|
142
|
+
highlightText
|
|
143
|
+
};
|
|
144
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cgboiler/biz-mobile",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"lodash-es": "^4.17.21",
|
|
46
46
|
"vant": "^4.9.19",
|
|
47
|
-
"@cgboiler/core": "1.2.
|
|
47
|
+
"@cgboiler/core": "1.2.2",
|
|
48
48
|
"@cgboiler/shared": "1.1.1"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|