cd-personselector 1.3.4 → 1.3.5
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/dist/index.js +1 -1
- package/dist/index.mjs +349 -335
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/InputSelect.vue +33 -6
- package/src/PersonSelector.vue +1 -0
package/package.json
CHANGED
package/src/InputSelect.vue
CHANGED
|
@@ -40,18 +40,23 @@
|
|
|
40
40
|
</div>
|
|
41
41
|
<div v-else class="cd-input-select__option-avatar cd-input-select__option-avatar--placeholder"
|
|
42
42
|
:style="{
|
|
43
|
-
backgroundColor:
|
|
44
|
-
color:
|
|
43
|
+
backgroundColor: getNodeTypeColor(result.nodeType),
|
|
44
|
+
color: '#fff'
|
|
45
45
|
}">
|
|
46
|
-
{{
|
|
46
|
+
{{ getNodeTypeIcon(result.nodeType) }}
|
|
47
47
|
</div>
|
|
48
48
|
<div class="cd-input-select__option-info">
|
|
49
49
|
<div class="cd-input-select__option-name">{{ result.name }}</div>
|
|
50
|
-
<div v-if="result.department || result.
|
|
51
|
-
{{ result.department }}{{ result.department && result.
|
|
50
|
+
<div v-if="result.isUser && (result.department || result.post)" class="cd-input-select__option-desc">
|
|
51
|
+
{{ result.department }}{{ result.department && result.post ? ' · ' : '' }}{{ result.post }}
|
|
52
|
+
</div>
|
|
53
|
+
<div v-else-if="result.fnumber" class="cd-input-select__option-desc">
|
|
54
|
+
{{ result.fnumber }}
|
|
52
55
|
</div>
|
|
53
56
|
</div>
|
|
54
|
-
<
|
|
57
|
+
<span class="cd-input-select__option-tag" :style="{ backgroundColor: getNodeTypeColor(result.nodeType) + '18', color: getNodeTypeColor(result.nodeType) }">
|
|
58
|
+
{{ getNodeTypeLabel(result.nodeType) }}
|
|
59
|
+
</span>
|
|
55
60
|
</div>
|
|
56
61
|
</t-checkbox>
|
|
57
62
|
</div>
|
|
@@ -137,6 +142,19 @@ const isDepartment = (id: string | number): boolean => {
|
|
|
137
142
|
return String(id).startsWith('dept-');
|
|
138
143
|
};
|
|
139
144
|
|
|
145
|
+
// nodeType 辅助函数
|
|
146
|
+
const nodeTypeMap: Record<string, { label: string; color: string; icon: string }> = {
|
|
147
|
+
department: { label: '部门', color: '#0052d9', icon: '部' },
|
|
148
|
+
user: { label: '人员', color: '#1890ff', icon: '人' },
|
|
149
|
+
post: { label: '岗位', color: '#52c41a', icon: '岗' },
|
|
150
|
+
position: { label: '职务', color: '#722ed1', icon: '职' },
|
|
151
|
+
business: { label: '商业', color: '#fa8c16', icon: '商' },
|
|
152
|
+
external: { label: '外部', color: '#eb2f96', icon: '外' },
|
|
153
|
+
};
|
|
154
|
+
const getNodeTypeLabel = (t?: string) => nodeTypeMap[t || '']?.label || '其他';
|
|
155
|
+
const getNodeTypeColor = (t?: string) => nodeTypeMap[t || '']?.color || '#999';
|
|
156
|
+
const getNodeTypeIcon = (t?: string) => nodeTypeMap[t || '']?.icon || '?';
|
|
157
|
+
|
|
140
158
|
// 根据 value (ID) 获取标签主题颜色
|
|
141
159
|
const getTagThemeByValue = (value: string | number): 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' => {
|
|
142
160
|
const idStr = String(value);
|
|
@@ -315,6 +333,8 @@ watch(inputValue, (keyword) => {
|
|
|
315
333
|
&__panel {
|
|
316
334
|
max-height: 300px;
|
|
317
335
|
overflow-y: auto;
|
|
336
|
+
width: 100%;
|
|
337
|
+
box-sizing: border-box;
|
|
318
338
|
}
|
|
319
339
|
&__loading,
|
|
320
340
|
&__empty {
|
|
@@ -383,5 +403,12 @@ watch(inputValue, (keyword) => {
|
|
|
383
403
|
color: var(--td-brand-color, #0052d9);
|
|
384
404
|
flex-shrink: 0;
|
|
385
405
|
}
|
|
406
|
+
&-tag {
|
|
407
|
+
font-size: 11px;
|
|
408
|
+
padding: 1px 6px;
|
|
409
|
+
border-radius: 3px;
|
|
410
|
+
flex-shrink: 0;
|
|
411
|
+
white-space: nowrap;
|
|
412
|
+
}
|
|
386
413
|
}
|
|
387
414
|
</style>
|