@king-one/antdv 1.1.13 → 1.2.1
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/CHANGELOG.md +18 -0
- package/dist/es/components/index.mjs +4 -1
- package/dist/es/components/pro-selector/index.mjs +8 -0
- package/dist/es/components/pro-selector/src/components/org-tree.mjs +304 -0
- package/dist/es/components/pro-selector/src/components/user.mjs +92 -0
- package/dist/es/components/pro-selector/src/hooks/index.mjs +4 -0
- package/dist/es/components/pro-selector/src/hooks/useUserSelector.mjs +9 -0
- package/dist/es/components/pro-selector/src/pro-user.mjs +210 -0
- package/dist/es/components/pro-selector/src/types.mjs +1 -0
- package/dist/es/components/pro-selector/src/utils/orgTree.mjs +93 -0
- package/dist/es/components/pro-selector/style/index.mjs +2 -0
- package/dist/es/components/pro-upload/src/gd-upload.mjs +1 -1
- package/dist/es/components/pro-upload/src/hooks/useHttp.mjs +5 -5
- package/dist/es/components/pro-upload/src/hooks/useUpload.mjs +2 -2
- package/dist/es/components/pro-upload/src/props.mjs +4 -0
- package/dist/es/components/pro-user-avatar/index.mjs +10 -0
- package/dist/es/components/pro-user-avatar/src/index.vue.mjs +4 -0
- package/dist/es/components/pro-user-avatar/src/index.vue2.mjs +69 -0
- package/dist/es/components/pro-user-avatar/src/style/index.mjs +2 -0
- package/dist/es/components/pro-user-avatar/src/types.mjs +1 -0
- package/dist/es/components/pro-user-avatar/src/util.mjs +28 -0
- package/dist/es/index.mjs +7 -1
- package/dist/lib/components/index.js +3 -0
- package/dist/lib/components/pro-selector/index.js +8 -0
- package/dist/lib/components/pro-selector/src/components/org-tree.js +304 -0
- package/dist/lib/components/pro-selector/src/components/user.js +92 -0
- package/dist/lib/components/pro-selector/src/hooks/index.js +4 -0
- package/dist/lib/components/pro-selector/src/hooks/useUserSelector.js +9 -0
- package/dist/lib/components/pro-selector/src/pro-user.js +210 -0
- package/dist/lib/components/pro-selector/src/types.js +1 -0
- package/dist/lib/components/pro-selector/src/utils/orgTree.js +93 -0
- package/dist/lib/components/pro-selector/style/index.js +3 -0
- package/dist/lib/components/pro-upload/src/gd-upload.js +1 -1
- package/dist/lib/components/pro-upload/src/hooks/useHttp.js +5 -5
- package/dist/lib/components/pro-upload/src/hooks/useUpload.js +2 -2
- package/dist/lib/components/pro-upload/src/props.js +4 -0
- package/dist/lib/components/pro-user-avatar/index.js +10 -0
- package/dist/lib/components/pro-user-avatar/src/index.vue.js +4 -0
- package/dist/lib/components/pro-user-avatar/src/index.vue2.js +69 -0
- package/dist/lib/components/pro-user-avatar/src/style/index.js +3 -0
- package/dist/lib/components/pro-user-avatar/src/types.js +1 -0
- package/dist/lib/components/pro-user-avatar/src/util.js +28 -0
- package/dist/lib/index.js +6 -0
- package/dist/theme-chalk/fonts/iconfont.ttf +0 -0
- package/dist/theme-chalk/fonts/iconfont.woff +0 -0
- package/dist/theme-chalk/fonts/iconfont.woff2 +0 -0
- package/dist/theme-chalk/icon.css +1 -1
- package/dist/theme-chalk/index.css +1 -1
- package/dist/theme-chalk/pro-selector.css +1 -0
- package/dist/theme-chalk/pro-user-avatar.css +1 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/pro-selector/index.d.ts +4 -0
- package/dist/types/components/pro-selector/src/components/org-tree.d.ts +61 -0
- package/dist/types/components/pro-selector/src/components/user.d.ts +40 -0
- package/dist/types/components/pro-selector/src/hooks/index.d.ts +1 -0
- package/dist/types/components/pro-selector/src/hooks/useUserSelector.d.ts +3 -0
- package/dist/types/components/pro-selector/src/pro-user.d.ts +75 -0
- package/dist/types/components/pro-selector/src/types.d.ts +40 -0
- package/dist/types/components/pro-selector/src/util.d.ts +26 -0
- package/dist/types/components/pro-selector/src/utils/orgTree.d.ts +20 -0
- package/dist/types/components/pro-upload/index.d.ts +9 -0
- package/dist/types/components/pro-upload/src/gd-upload.d.ts +9 -0
- package/dist/types/components/pro-upload/src/hooks/useHttp.d.ts +1 -1
- package/dist/types/components/pro-upload/src/hooks/useUpload.d.ts +1 -1
- package/dist/types/components/pro-upload/src/props.d.ts +4 -0
- package/dist/types/components/pro-upload/src/types.d.ts +4 -0
- package/dist/types/components/pro-user-avatar/index.d.ts +39 -0
- package/dist/types/components/pro-user-avatar/src/index.vue.d.ts +34 -0
- package/dist/types/components/pro-user-avatar/src/types.d.ts +9 -0
- package/dist/types/components/pro-user-avatar/src/util.d.ts +1 -0
- package/global.d.ts +2 -0
- package/package.json +3 -3
- package/dist/theme-chalk/fonts//345/275/222/346/241/243.zip +0 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const index = require("../../../../hooks/use-namespace/index.js");
|
|
5
|
+
const antDesignVue = require("ant-design-vue");
|
|
6
|
+
require("../../../index.js");
|
|
7
|
+
const index$1 = require("../../../pro-user-avatar/index.js");
|
|
8
|
+
const index$2 = require("../../../icon/index.js");
|
|
9
|
+
function _isSlot(s) {
|
|
10
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
|
|
11
|
+
}
|
|
12
|
+
const {
|
|
13
|
+
b
|
|
14
|
+
} = index.useNamespace("pro-user-selector");
|
|
15
|
+
const User = /* @__PURE__ */ vue.defineComponent({
|
|
16
|
+
name: "User",
|
|
17
|
+
props: {
|
|
18
|
+
userInfo: {
|
|
19
|
+
type: Object,
|
|
20
|
+
default: () => ({})
|
|
21
|
+
},
|
|
22
|
+
isChecked: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: true
|
|
25
|
+
},
|
|
26
|
+
isDelete: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
emits: {
|
|
32
|
+
"delete-user": (id) => id,
|
|
33
|
+
"change-checked": (checked, info) => checked
|
|
34
|
+
},
|
|
35
|
+
setup(props, {
|
|
36
|
+
emit,
|
|
37
|
+
slots
|
|
38
|
+
}) {
|
|
39
|
+
const handleChangeChecked = (e) => {
|
|
40
|
+
emit("change-checked", e.target.checked, props.userInfo);
|
|
41
|
+
};
|
|
42
|
+
const getUserInfo = () => vue.createVNode("div", {
|
|
43
|
+
"class": b("user-item-content")
|
|
44
|
+
}, [vue.createVNode("div", {
|
|
45
|
+
"style": {
|
|
46
|
+
width: "100%",
|
|
47
|
+
display: "flex",
|
|
48
|
+
alignItems: "center"
|
|
49
|
+
}
|
|
50
|
+
}, [vue.createVNode(index$1.KUserAvatar, {
|
|
51
|
+
"name": props.userInfo.realName ? props.userInfo.realName : "",
|
|
52
|
+
"avatar": props.userInfo.avatar,
|
|
53
|
+
"size": "default"
|
|
54
|
+
}, null, 8, ["name", "avatar"]), vue.createVNode("div", null, [vue.createVNode("div", {
|
|
55
|
+
"style": "display: flex;align-items: center;"
|
|
56
|
+
}, [slots.name ? slots.name() : vue.createVNode("div", {
|
|
57
|
+
"style": "font-size: 14px;color: #000;"
|
|
58
|
+
}, [props.userInfo.realName]), props.userInfo.position && vue.createVNode("div", {
|
|
59
|
+
"class": b("user-item-content-tag")
|
|
60
|
+
}, [props.userInfo.position], 2)]), vue.createVNode("div", {
|
|
61
|
+
"style": {
|
|
62
|
+
fontSize: "12px",
|
|
63
|
+
color: "#8f959e",
|
|
64
|
+
lineHeight: "20px"
|
|
65
|
+
}
|
|
66
|
+
}, [props.userInfo.stageName])])]), props.isDelete && vue.createVNode("div", {
|
|
67
|
+
"class": "select-user-item-icon",
|
|
68
|
+
"onClick": () => emit("delete-user", props.userInfo.id)
|
|
69
|
+
}, [vue.createVNode(index$2.KIcon, {
|
|
70
|
+
"name": "shanchu",
|
|
71
|
+
"size": 12,
|
|
72
|
+
"color": "#2b2f36"
|
|
73
|
+
}, null)], 8, ["onClick"])], 2);
|
|
74
|
+
return () => {
|
|
75
|
+
let _slot;
|
|
76
|
+
return vue.createVNode("div", {
|
|
77
|
+
"class": b("user-item")
|
|
78
|
+
}, [props.isChecked ? vue.createVNode(antDesignVue.Checkbox, {
|
|
79
|
+
"style": "margin: 0 6px;width: 100%;",
|
|
80
|
+
"checked": props.userInfo.checked,
|
|
81
|
+
"onUpdate:checked": ($event) => props.userInfo.checked = $event,
|
|
82
|
+
"onChange": handleChangeChecked
|
|
83
|
+
}, _isSlot(_slot = getUserInfo()) ? _slot : {
|
|
84
|
+
default: () => [_slot],
|
|
85
|
+
_: 1
|
|
86
|
+
}, 8, ["checked", "onUpdate:checked", "onChange"]) : vue.createVNode("div", {
|
|
87
|
+
"style": "width: 100%;"
|
|
88
|
+
}, [getUserInfo()])], 2);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
exports.default = User;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
require("../../index.js");
|
|
5
|
+
const index = require("../../../hooks/use-namespace/index.js");
|
|
6
|
+
const antDesignVue = require("ant-design-vue");
|
|
7
|
+
const orgTree = require("./components/org-tree.js");
|
|
8
|
+
const user = require("./components/user.js");
|
|
9
|
+
const index$1 = require("../../pro-modal/index.js");
|
|
10
|
+
const index$2 = require("../../icon/index.js");
|
|
11
|
+
const index$3 = require("../../pro-user-avatar/index.js");
|
|
12
|
+
const {
|
|
13
|
+
b
|
|
14
|
+
} = index.useNamespace("pro-user-selector");
|
|
15
|
+
const ns = index.useNamespace("user-selector-extermal");
|
|
16
|
+
const ProUserSelector = /* @__PURE__ */ vue.defineComponent({
|
|
17
|
+
name: "ProUserSelector",
|
|
18
|
+
props: {
|
|
19
|
+
visible: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
23
|
+
title: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: ""
|
|
26
|
+
},
|
|
27
|
+
modelValue: {
|
|
28
|
+
type: Array,
|
|
29
|
+
default: () => []
|
|
30
|
+
},
|
|
31
|
+
maxCount: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 25
|
|
34
|
+
},
|
|
35
|
+
/** @description 单选还是多选,默认多选,单选逻辑后续在实现,单选感觉不能使用当前的 UI 展示 */
|
|
36
|
+
type: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "checkbox"
|
|
39
|
+
},
|
|
40
|
+
load: {
|
|
41
|
+
type: Function,
|
|
42
|
+
default: () => Promise.resolve([])
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
emits: {
|
|
46
|
+
"update:visible": (visible) => true,
|
|
47
|
+
"update:modelValue": (modelValue) => true,
|
|
48
|
+
"delete-user": (id) => true,
|
|
49
|
+
"confirm": (modelValue) => true,
|
|
50
|
+
"cancel": () => true
|
|
51
|
+
},
|
|
52
|
+
setup(props, {
|
|
53
|
+
emit,
|
|
54
|
+
slots,
|
|
55
|
+
expose,
|
|
56
|
+
attrs
|
|
57
|
+
}) {
|
|
58
|
+
const searchValue = vue.ref("");
|
|
59
|
+
const selectUserList = vue.ref([]);
|
|
60
|
+
const orgTreeRef = vue.ref();
|
|
61
|
+
const userListRef = vue.ref(null);
|
|
62
|
+
const localModelValue = vue.ref(props.modelValue || []);
|
|
63
|
+
const isInternalUpdate = vue.ref(false);
|
|
64
|
+
vue.watch(() => props.modelValue, (newValue) => {
|
|
65
|
+
if (isInternalUpdate.value) {
|
|
66
|
+
isInternalUpdate.value = false;
|
|
67
|
+
} else {
|
|
68
|
+
localModelValue.value = JSON.parse(JSON.stringify(newValue));
|
|
69
|
+
vue.nextTick(() => {
|
|
70
|
+
handleExternalDataChange(localModelValue.value);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
deep: true,
|
|
75
|
+
immediate: true
|
|
76
|
+
});
|
|
77
|
+
vue.watch(selectUserList, (newVal, oldVal) => {
|
|
78
|
+
if (newVal.length > oldVal.length) {
|
|
79
|
+
vue.nextTick(() => {
|
|
80
|
+
if (userListRef.value) {
|
|
81
|
+
userListRef.value.scrollTop = userListRef.value.scrollHeight;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
deep: true
|
|
87
|
+
});
|
|
88
|
+
async function handleExternalDataChange(data) {
|
|
89
|
+
if (orgTreeRef.value) {
|
|
90
|
+
const orgData = await orgTreeRef.value.dataLoadPromise;
|
|
91
|
+
orgTreeRef.value.getInitData(data, orgData);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const handleDeleteSelectUser = (id) => {
|
|
95
|
+
var _a;
|
|
96
|
+
selectUserList.value = selectUserList.value.filter((item) => item.id !== id);
|
|
97
|
+
(_a = orgTreeRef.value) == null ? void 0 : _a.deleteDeptUser(id);
|
|
98
|
+
};
|
|
99
|
+
const handleOpen = () => {
|
|
100
|
+
emit("update:visible", false);
|
|
101
|
+
emit("cancel");
|
|
102
|
+
};
|
|
103
|
+
const handleDelUser = (id) => {
|
|
104
|
+
emit("update:modelValue", props.modelValue.filter((user2) => user2.id !== id));
|
|
105
|
+
};
|
|
106
|
+
const handleConfirm = () => {
|
|
107
|
+
const list = selectUserList.value.map((item) => {
|
|
108
|
+
return {
|
|
109
|
+
id: item.id,
|
|
110
|
+
realName: item.realName || "",
|
|
111
|
+
avatar: item.avatar
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
emit("update:visible", false);
|
|
115
|
+
isInternalUpdate.value = true;
|
|
116
|
+
emit("update:modelValue", list);
|
|
117
|
+
emit("confirm", list);
|
|
118
|
+
};
|
|
119
|
+
expose({
|
|
120
|
+
deleteCheckedUser: handleDelUser
|
|
121
|
+
});
|
|
122
|
+
const renderModal = () => vue.createVNode(index$1.KProModal, {
|
|
123
|
+
"modelValue": props.visible,
|
|
124
|
+
"title": "选择联系人",
|
|
125
|
+
"modalProps": {
|
|
126
|
+
cancelText: "取消",
|
|
127
|
+
okText: "确定",
|
|
128
|
+
...attrs
|
|
129
|
+
},
|
|
130
|
+
"onOnCancel": () => handleOpen(),
|
|
131
|
+
"onOnConfirm": () => handleConfirm()
|
|
132
|
+
}, {
|
|
133
|
+
default: () => [vue.createVNode("div", {
|
|
134
|
+
"class": b()
|
|
135
|
+
}, [vue.createVNode("div", {
|
|
136
|
+
"class": b("content-left")
|
|
137
|
+
}, [vue.createVNode("div", {
|
|
138
|
+
"style": "padding: 16px 16px 0 16px"
|
|
139
|
+
}, [vue.createVNode(antDesignVue.Input, {
|
|
140
|
+
"value": searchValue.value,
|
|
141
|
+
"onUpdate:value": ($event) => searchValue.value = $event,
|
|
142
|
+
"size": "small",
|
|
143
|
+
"placeholder": "搜索",
|
|
144
|
+
"allowClear": true
|
|
145
|
+
}, {
|
|
146
|
+
prefix: () => vue.createVNode(index$2.KIcon, {
|
|
147
|
+
"name": "search"
|
|
148
|
+
}, null),
|
|
149
|
+
_: 1
|
|
150
|
+
}, 8, ["value", "onUpdate:value", "allowClear"])]), vue.createVNode(orgTree.default, {
|
|
151
|
+
"ref": orgTreeRef,
|
|
152
|
+
"selectUserList": selectUserList.value,
|
|
153
|
+
"onUpdate:selectUserList": ($event) => selectUserList.value = $event,
|
|
154
|
+
"maxCount": props.maxCount,
|
|
155
|
+
"keyword": searchValue.value,
|
|
156
|
+
"initData": props.load
|
|
157
|
+
}, null, 8, ["selectUserList", "onUpdate:selectUserList", "maxCount", "keyword", "initData"])], 2), vue.createVNode("div", {
|
|
158
|
+
"class": b("content-right")
|
|
159
|
+
}, [vue.createVNode("div", {
|
|
160
|
+
"class": b("content-right-title")
|
|
161
|
+
}, [vue.createTextVNode("已选:"), selectUserList.value.length, vue.createTextVNode("/"), props.maxCount, vue.createTextVNode("人")], 2), vue.createVNode("div", {
|
|
162
|
+
"class": "select-user-list",
|
|
163
|
+
"ref": userListRef
|
|
164
|
+
}, [vue.createVNode("div", {
|
|
165
|
+
"class": b("user-list")
|
|
166
|
+
}, [selectUserList.value.length > 0 ? selectUserList.value.map((item) => vue.createVNode(user.default, {
|
|
167
|
+
"key": item.id,
|
|
168
|
+
"userInfo": item,
|
|
169
|
+
"isChecked": false,
|
|
170
|
+
"isDelete": true,
|
|
171
|
+
"onDelete-user": handleDeleteSelectUser
|
|
172
|
+
}, null, 8, ["userInfo", "isDelete", "onDelete-user"])) : vue.createVNode(antDesignVue.Empty, {
|
|
173
|
+
"image": antDesignVue.Empty.PRESENTED_IMAGE_SIMPLE,
|
|
174
|
+
"description": "暂无数据"
|
|
175
|
+
}, null, 8, ["image"])], 2)], 512)], 2)], 2)]
|
|
176
|
+
}, 8, ["modelValue", "modalProps", "onOnCancel", "onOnConfirm"]);
|
|
177
|
+
const renderComponent = () => {
|
|
178
|
+
return vue.createVNode("div", {
|
|
179
|
+
"class": ns.b()
|
|
180
|
+
}, [slots.default ? slots.default() : vue.createVNode("div", {
|
|
181
|
+
"class": ns.b("list")
|
|
182
|
+
}, [vue.createVNode("div", {
|
|
183
|
+
"class": ns.b("icon"),
|
|
184
|
+
"onClick": () => emit("update:visible", true)
|
|
185
|
+
}, [vue.createVNode(index$2.KIcon, {
|
|
186
|
+
"name": "plus",
|
|
187
|
+
"size": 20,
|
|
188
|
+
"color": "#409eff"
|
|
189
|
+
}, null)], 10, ["onClick"]), props.modelValue.map((user2) => {
|
|
190
|
+
return vue.createVNode("div", {
|
|
191
|
+
"class": ns.b("item")
|
|
192
|
+
}, [vue.createVNode(index$3.KUserAvatar, {
|
|
193
|
+
"name": user2.realName,
|
|
194
|
+
"avatar": user2.avatar,
|
|
195
|
+
"size": "small"
|
|
196
|
+
}, null, 8, ["name", "avatar"]), vue.createVNode("span", {
|
|
197
|
+
"class": ns.be("item", "name")
|
|
198
|
+
}, [user2.realName], 2), vue.createVNode("div", {
|
|
199
|
+
"onClick": () => handleDelUser(user2.id)
|
|
200
|
+
}, [vue.createVNode(index$2.KIcon, {
|
|
201
|
+
"name": "shanchu",
|
|
202
|
+
"size": 18,
|
|
203
|
+
"color": "#646a73"
|
|
204
|
+
}, null)], 8, ["onClick"])], 2);
|
|
205
|
+
})], 2), renderModal()], 2);
|
|
206
|
+
};
|
|
207
|
+
return () => renderComponent();
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
exports.default = ProUserSelector;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function debounce(func, wait) {
|
|
4
|
+
let timeout;
|
|
5
|
+
function debounced(...args) {
|
|
6
|
+
clearTimeout(timeout);
|
|
7
|
+
timeout = setTimeout(() => func.apply(this, args), wait);
|
|
8
|
+
}
|
|
9
|
+
debounced.cancel = function() {
|
|
10
|
+
clearTimeout(timeout);
|
|
11
|
+
};
|
|
12
|
+
return debounced;
|
|
13
|
+
}
|
|
14
|
+
function uniqueById(array) {
|
|
15
|
+
const seen = /* @__PURE__ */ new Map();
|
|
16
|
+
return array.filter((item) => {
|
|
17
|
+
if (!item || item.id === void 0)
|
|
18
|
+
return false;
|
|
19
|
+
return seen.has(item.id) ? false : (seen.set(item.id, true), true);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function formatOrgTree(orgTree) {
|
|
23
|
+
if (!orgTree || orgTree.length === 0)
|
|
24
|
+
return;
|
|
25
|
+
for (const dept of orgTree) {
|
|
26
|
+
if (dept.deptType === "department") {
|
|
27
|
+
dept.checkedUserIds = [];
|
|
28
|
+
}
|
|
29
|
+
if (dept.members && dept.members.length > 0) {
|
|
30
|
+
dept.members.forEach((member) => {
|
|
31
|
+
member.checked = false;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (dept.children && dept.children.length > 0) {
|
|
35
|
+
formatOrgTree(dept.children);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const orgTreeUtil = {
|
|
40
|
+
initOrgTree(data) {
|
|
41
|
+
formatOrgTree(data);
|
|
42
|
+
return data;
|
|
43
|
+
},
|
|
44
|
+
getChildrenByParentId: (parentId) => {
|
|
45
|
+
return [];
|
|
46
|
+
},
|
|
47
|
+
getDeptById: (id) => {
|
|
48
|
+
return {};
|
|
49
|
+
},
|
|
50
|
+
getDeptMemberById: (id) => {
|
|
51
|
+
return {};
|
|
52
|
+
},
|
|
53
|
+
setCheckedValue: (depts, id, flag) => {
|
|
54
|
+
for (const dept of depts) {
|
|
55
|
+
if (dept.members && dept.members.length > 0) {
|
|
56
|
+
dept.members.forEach((member) => {
|
|
57
|
+
member.checked = flag;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (dept.children && dept.children.length > 0) {
|
|
61
|
+
orgTreeUtil.setCheckedValue(dept.children, id, flag);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
findMembersByIds(checkedIds, orgTree) {
|
|
66
|
+
const selectedMembers = [];
|
|
67
|
+
const idSet = /* @__PURE__ */ new Set();
|
|
68
|
+
function traverseTree(departments) {
|
|
69
|
+
if (!departments || departments.length === 0)
|
|
70
|
+
return;
|
|
71
|
+
for (const dept of departments) {
|
|
72
|
+
if (dept.members && dept.members.length > 0) {
|
|
73
|
+
const matchedMembers = dept.members.filter(
|
|
74
|
+
(member) => checkedIds.includes(member.id) && !idSet.has(member.id)
|
|
75
|
+
);
|
|
76
|
+
for (const member of matchedMembers) {
|
|
77
|
+
selectedMembers.push(member);
|
|
78
|
+
idSet.add(member.id);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (dept.children && dept.children.length > 0) {
|
|
82
|
+
traverseTree(dept.children);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
traverseTree(orgTree);
|
|
87
|
+
return selectedMembers;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
exports.debounce = debounce;
|
|
91
|
+
exports.formatOrgTree = formatOrgTree;
|
|
92
|
+
exports.orgTreeUtil = orgTreeUtil;
|
|
93
|
+
exports.uniqueById = uniqueById;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
function useHttp(http) {
|
|
3
|
+
function useHttp(http, prefix) {
|
|
4
4
|
return {
|
|
5
5
|
// 获取文件上传的地址
|
|
6
|
-
getUploadUrl: (config) => http.get(
|
|
6
|
+
getUploadUrl: (config) => http.get(`${prefix}/file/aio/upload/url`, config),
|
|
7
7
|
// 文件上传
|
|
8
8
|
uploadFileApi: (url, config) => http.post(url, config, {
|
|
9
9
|
headers: {
|
|
@@ -11,13 +11,13 @@ function useHttp(http) {
|
|
|
11
11
|
}
|
|
12
12
|
}),
|
|
13
13
|
// 删除文件
|
|
14
|
-
deleteFileApi: (config) => http.delete(
|
|
14
|
+
deleteFileApi: (config) => http.delete(`${prefix}/file/aio`, config),
|
|
15
15
|
// 获取文件下载地址
|
|
16
|
-
getDownloadUrlApi: (config) => http.post(
|
|
16
|
+
getDownloadUrlApi: (config) => http.post(`${prefix}/file/aio/download/url`, config),
|
|
17
17
|
// 下载文件
|
|
18
18
|
downloadFileApi: (url, config) => http.get(url, config),
|
|
19
19
|
// 获取文件详情
|
|
20
|
-
getFileDetailApi: (config) => http.post(
|
|
20
|
+
getFileDetailApi: (config) => http.post(`${prefix}/aio/batch/info`, config)
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
exports.useHttp = useHttp;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const antDesignVue = require("ant-design-vue");
|
|
4
4
|
const useHttp = require("./useHttp.js");
|
|
5
|
-
function useUpload(httpConfig) {
|
|
6
|
-
const http = useHttp.useHttp(httpConfig);
|
|
5
|
+
function useUpload(httpConfig, prefix) {
|
|
6
|
+
const http = useHttp.useHttp(httpConfig, prefix);
|
|
7
7
|
return {
|
|
8
8
|
// 文件上传
|
|
9
9
|
uploadFile: (config) => new Promise(async (resolve, reject) => {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const utils = require("@king-one/utils");
|
|
4
|
+
require("./src/index.vue.js");
|
|
5
|
+
require("./src/style/index.js");
|
|
6
|
+
require("./src/types.js");
|
|
7
|
+
const index_vue_vue_type_script_setup_true_lang = require("./src/index.vue2.js");
|
|
8
|
+
const KUserAvatar = utils.withInstall(index_vue_vue_type_script_setup_true_lang.default);
|
|
9
|
+
exports.KUserAvatar = KUserAvatar;
|
|
10
|
+
exports.default = KUserAvatar;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const index_vue_vue_type_script_setup_true_lang = require("./index.vue2.js");
|
|
4
|
+
exports.default = index_vue_vue_type_script_setup_true_lang.default;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const index = require("../../../hooks/use-namespace/index.js");
|
|
5
|
+
const util = require("./util.js");
|
|
6
|
+
const _hoisted_1 = ["src", "alt"];
|
|
7
|
+
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
8
|
+
...{
|
|
9
|
+
name: "ProUserAvatar"
|
|
10
|
+
},
|
|
11
|
+
__name: "index",
|
|
12
|
+
props: {
|
|
13
|
+
name: { default: "未知" },
|
|
14
|
+
avatar: {},
|
|
15
|
+
size: { default: "default" }
|
|
16
|
+
},
|
|
17
|
+
emits: ["error"],
|
|
18
|
+
setup(__props, { emit: __emit }) {
|
|
19
|
+
const props = __props;
|
|
20
|
+
const emit = __emit;
|
|
21
|
+
const ns = index.useNamespace("user-avatar");
|
|
22
|
+
const imgLoadError = vue.ref(false);
|
|
23
|
+
const nameChars = vue.computed(() => {
|
|
24
|
+
if (props.name.length >= 2) {
|
|
25
|
+
return props.name.slice(props.name.length - 2);
|
|
26
|
+
} else {
|
|
27
|
+
return props.name ? props.name : "未知";
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
function handleError(event) {
|
|
31
|
+
imgLoadError.value = true;
|
|
32
|
+
emit("error", event);
|
|
33
|
+
}
|
|
34
|
+
return (_ctx, _cache) => {
|
|
35
|
+
return vue.openBlock(), vue.createElementBlock(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).b(_ctx.size)])
|
|
39
|
+
},
|
|
40
|
+
[
|
|
41
|
+
_ctx.avatar && !imgLoadError.value ? (vue.openBlock(), vue.createElementBlock("img", {
|
|
42
|
+
key: 0,
|
|
43
|
+
class: vue.normalizeClass([vue.unref(ns).e("img")]),
|
|
44
|
+
src: _ctx.avatar,
|
|
45
|
+
alt: _ctx.name,
|
|
46
|
+
loading: "lazy",
|
|
47
|
+
decoding: "async",
|
|
48
|
+
onError: handleError
|
|
49
|
+
}, null, 42, _hoisted_1)) : (vue.openBlock(), vue.createElementBlock(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
key: 1,
|
|
53
|
+
class: vue.normalizeClass([vue.unref(ns).e("name")]),
|
|
54
|
+
style: vue.normalizeStyle({
|
|
55
|
+
backgroundColor: vue.unref(util.getColorFromString)(_ctx.name)
|
|
56
|
+
})
|
|
57
|
+
},
|
|
58
|
+
vue.toDisplayString(nameChars.value),
|
|
59
|
+
7
|
|
60
|
+
/* TEXT, CLASS, STYLE */
|
|
61
|
+
))
|
|
62
|
+
],
|
|
63
|
+
2
|
|
64
|
+
/* CLASS */
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
exports.default = _sfc_main;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function getColorFromString(str) {
|
|
4
|
+
if (!str)
|
|
5
|
+
return "#e1e1e1";
|
|
6
|
+
let hash = 0;
|
|
7
|
+
for (let i = 0; i < str.length; i++) {
|
|
8
|
+
hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
|
9
|
+
}
|
|
10
|
+
const colors = [
|
|
11
|
+
"#3286fa",
|
|
12
|
+
"#f56a00",
|
|
13
|
+
"#7265e6",
|
|
14
|
+
"#ffbf00",
|
|
15
|
+
"#00a2ae",
|
|
16
|
+
"#1890ff",
|
|
17
|
+
"#52c41a",
|
|
18
|
+
"#faad14",
|
|
19
|
+
"#722ed1",
|
|
20
|
+
"#eb2f96",
|
|
21
|
+
"#fa8c16",
|
|
22
|
+
"#13c2c2",
|
|
23
|
+
"#fadb14"
|
|
24
|
+
];
|
|
25
|
+
const index = Math.abs(hash) % colors.length;
|
|
26
|
+
return colors[index];
|
|
27
|
+
}
|
|
28
|
+
exports.getColorFromString = getColorFromString;
|
package/dist/lib/index.js
CHANGED
|
@@ -39,6 +39,9 @@ const onEffects = require("./components/pro-sign/src/effects/onEffects.js");
|
|
|
39
39
|
const index$i = require("./components/pro-sign/src/core/index.js");
|
|
40
40
|
const useProSign = require("./components/pro-sign/src/hook/useProSign.js");
|
|
41
41
|
const index$h = require("./components/pro-sign/index.js");
|
|
42
|
+
const useUserSelector = require("./components/pro-selector/src/hooks/useUserSelector.js");
|
|
43
|
+
const proUser = require("./components/pro-selector/src/pro-user.js");
|
|
44
|
+
const index$j = require("./components/pro-user-avatar/index.js");
|
|
42
45
|
const useProForm = require("./hooks/useProForm.js");
|
|
43
46
|
exports.default = installer.default;
|
|
44
47
|
exports.definePropType = form.definePropType;
|
|
@@ -83,5 +86,8 @@ exports.onSignSuccess = onEffects.onSignSuccess;
|
|
|
83
86
|
exports.initProSign = index$i.initProSign;
|
|
84
87
|
exports.useProSign = useProSign.useProSign;
|
|
85
88
|
exports.KProSign = index$h.KProSign;
|
|
89
|
+
exports.useUserSelector = useUserSelector.useUserSelector;
|
|
90
|
+
exports.ProUserSelector = proUser.default;
|
|
91
|
+
exports.KUserAvatar = index$j.KUserAvatar;
|
|
86
92
|
exports.useProForm = useProForm.useProForm;
|
|
87
93
|
exports.useProFormInit = useProForm.useProFormInit;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@font-face{font-family:iconfont;src:url(fonts/iconfont.woff2?t=
|
|
1
|
+
@font-face{font-family:iconfont;src:url(fonts/iconfont.woff2?t=83008) format("woff2"),url(fonts/iconfont.woff?t=44364) format("woff"),url(fonts/iconfont.ttf?t=57261) format("truetype")}.king-icon{font-family:iconfont!important;font-size:16px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-king-shanchu:before{content:"\e62f"}.icon-king-zuzhijiagou:before{content:"\e6d4"}.icon-king-search:before{content:"\e671"}.icon-king-calendar:before{content:"\e659"}.icon-king-carry-out:before{content:"\e658"}.icon-king-file-add:before{content:"\e664"}.icon-king-form:before{content:"\e665"}.icon-king-close-circle:before{content:"\e66a"}.icon-king-close-circle-o:before{content:"\e66b"}.icon-king-vertical-align-bottom:before{content:"\e670"}.icon-king-merge-cells:before{content:"\e667"}.icon-king-split-cells:before{content:"\e66e"}.icon-king-down:before{content:"\e65d"}.icon-king-left:before{content:"\e666"}.icon-king-right:before{content:"\e66d"}.icon-king-up:before{content:"\e66f"}.icon-king-plus:before{content:"\e614"}.icon-king-xsl:before{content:"\e602"}.icon-king-word:before{content:"\e622"}.icon-king-eye:before{content:"\e78f"}.icon-king-PDF:before{content:"\e60a"}.icon-king-delete:before{content:"\e63c"}.icon-king-upload-icon:before{content:"\e617"}.icon-king-title-icon:before{content:"\e680"}
|