npmapps 1.0.21 → 1.0.23
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/app/Wscats.vue-1.0.26.vsix +0 -0
- package/app/febean.vue-format-0.1.8.vsix +0 -0
- package/app/wujie-vue3-child/.claude/settings.local.json +8 -0
- package/app/wujie-vue3-child/.vscode/extensions.json +3 -0
- package/app/wujie-vue3-child/PROJECT_MEMORY.md +427 -0
- package/app/wujie-vue3-child/README.md +5 -0
- package/app/wujie-vue3-child/index.html +13 -0
- package/app/wujie-vue3-child/package-lock.json +5744 -0
- package/app/wujie-vue3-child/package.json +28 -0
- package/app/wujie-vue3-child/public/vite.svg +1 -0
- package/app/wujie-vue3-child/src/App.vue +130 -0
- package/app/wujie-vue3-child/src/assets/vue.svg +1 -0
- package/app/wujie-vue3-child/src/components/HelloWorld.vue +43 -0
- package/app/wujie-vue3-child/src/components/tags-view.vue +193 -0
- package/app/wujie-vue3-child/src/components/tags-view1.vue +131 -0
- package/app/wujie-vue3-child/src/hooks/useClickOutside.js +11 -0
- package/app/wujie-vue3-child/src/hooks/useTableDragSort.js +28 -0
- package/app/wujie-vue3-child/src/main.js +15 -0
- package/app/wujie-vue3-child/src/router/index.js +104 -0
- package/app/wujie-vue3-child/src/store/tagsViewStroe.js +34 -0
- package/app/wujie-vue3-child/src/style.css +4 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/README.md +836 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/REFLEX_EXAMPLES.md +728 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentPersonnelSelector.jsx +687 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentPersonnelSelector.module.scss +560 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelector.jsx +570 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelector.module.scss +330 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelectorV2.jsx +378 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/DepartmentSelectorV2.module.scss +228 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/OptionsSelector.jsx +399 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/OptionsSelector.module.scss +252 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PersonnelSelector.jsx +585 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PersonnelSelector.module.scss +331 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PopoverSelector.jsx +392 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/PopoverSelector.module.scss +39 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/README.md +248 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/SelectorTrigger.jsx +194 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/index.jsx +1459 -0
- package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/mockData.js +301 -0
- package/app/{aiCoach → wujie-vue3-child/src/views/aiCoach}/dialogueSegment/index.jsx +28 -4
- package/app/wujie-vue3-child/src/views/aiCoach/index.jsx +32 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ChartsPanel/index.jsx +121 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ChartsPanel/index.module.scss +76 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/DonutChart/index.jsx +104 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/PracticeTable/index.jsx +75 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/PracticeTable/index.module.scss +12 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankBarChart/index.jsx +62 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankBarChart/index.module.scss +43 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingGroup/index.jsx +29 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingGroup/index.module.scss +5 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingList/index.jsx +58 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/RankingList/index.module.scss +85 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ScriptStatsPanel/index.jsx +92 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/ScriptStatsPanel/index.module.scss +56 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/StatCardsRow/index.jsx +40 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/StatCardsRow/index.module.scss +53 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/echarts/EchartsDonut.jsx +106 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/components/echarts/EchartsRankBar.jsx +132 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/index.jsx +176 -0
- package/app/wujie-vue3-child/src/views/aiCoach/practiceStatus/index.module.scss +96 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/CoachReport/index.jsx +162 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/CoachReport/index.module.scss +16 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ComprehensiveEvaluation/index.jsx +29 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ComprehensiveEvaluation/index.module.scss +25 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueBubble/index.jsx +106 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueBubble/index.module.scss +164 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueRecord/index.jsx +182 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DialogueRecord/index.module.scss +203 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionDetail/index.jsx +145 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionDetail/index.module.scss +126 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionScores/index.jsx +67 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/DimensionScores/index.module.scss +105 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ReportHeader/index.jsx +81 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ReportHeader/index.module.scss +47 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/RoleInfo/index.jsx +64 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/RoleInfo/index.module.scss +85 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ScoreBadge/index.jsx +39 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/ScoreBadge/index.module.scss +44 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/SubDimensionItem/index.jsx +83 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/components/SubDimensionItem/index.module.scss +101 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/index.jsx +50 -0
- package/app/wujie-vue3-child/src/views/aiCoach/reportDetail/index.module.scss +25 -0
- package/app/wujie-vue3-child/src/views/child-to-parent.vue +117 -0
- package/app/wujie-vue3-child/src/views/home.vue +53 -0
- package/app/wujie-vue3-child/src/views/jsx/btnSelect/btnSelect.vue +169 -0
- package/app/wujie-vue3-child/src/views/jsx/btnSelect/index.vue +69 -0
- package/app/wujie-vue3-child/src/views/jsx/com.vue +44 -0
- package/app/wujie-vue3-child/src/views/jsx/dialog.jsx +66 -0
- package/app/wujie-vue3-child/src/views/jsx/index.vue +72 -0
- package/app/wujie-vue3-child/src/views/jsx/props.vue +33 -0
- package/app/wujie-vue3-child/src/views/parent-to-child.vue +225 -0
- package/app/wujie-vue3-child/src/views/phone-code.vue +318 -0
- package/app/wujie-vue3-child/src/views/router-jump.vue +123 -0
- package/app/wujie-vue3-child/src/views/test.vue +192 -0
- package/app/wujie-vue3-child/vite.config.js +15 -0
- package/package.json +1 -1
- package/app/aiCoach/index.jsx +0 -20
- package/npmapps-1.0.20.tgz +0 -0
- /package/app/{aiCoach → wujie-vue3-child/src/views/aiCoach}/collapseExpand/index.jsx +0 -0
- /package/app/{aiCoach → wujie-vue3-child/src/views/aiCoach}/collapseExpand/index.module.scss +0 -0
- /package/app/{aiCoach → wujie-vue3-child/src/views/aiCoach}/dialogueSegment/index.module.scss +0 -0
- /package/app/{aiCoach → wujie-vue3-child/src/views/aiCoach}/scriptTable/index.jsx +0 -0
- /package/app/{aiCoach → wujie-vue3-child/src/views/aiCoach}/scriptTable/index.module.scss +0 -0
- /package/app/{aiCoach → wujie-vue3-child/src/views/aiCoach}/scriptTable/inputColumn/index.jsx +0 -0
- /package/app/{aiCoach → wujie-vue3-child/src/views/aiCoach}/scriptTable/inputColumn/index.module.scss +0 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
// 部门选择器V2样式(基于PopoverSelector)
|
|
2
|
+
|
|
3
|
+
// 输入框触发器
|
|
4
|
+
.inputTrigger {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
width: 100%;
|
|
8
|
+
min-height: 32px;
|
|
9
|
+
padding: 1px 11px;
|
|
10
|
+
background: #fff;
|
|
11
|
+
border: 1px solid #dcdfe6;
|
|
12
|
+
border-radius: 4px;
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
15
|
+
outline: none;
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
|
|
18
|
+
&:hover {
|
|
19
|
+
border-color: #c0c4cc;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&.focused {
|
|
23
|
+
border-color: #409eff;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.disabled {
|
|
27
|
+
background-color: #f5f7fa;
|
|
28
|
+
border-color: #e4e7ed;
|
|
29
|
+
color: #c0c4cc;
|
|
30
|
+
cursor: not-allowed;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// 按钮触发器
|
|
35
|
+
.buttonTrigger {
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 按钮内部容器
|
|
40
|
+
.buttonInner {
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: space-between;
|
|
44
|
+
width: 100%;
|
|
45
|
+
gap: 8px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 内容区域
|
|
49
|
+
.content {
|
|
50
|
+
flex: 1;
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
min-width: 0;
|
|
54
|
+
min-height: 30px;
|
|
55
|
+
padding: 2px 0;
|
|
56
|
+
text-align: left;
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// 图标区域
|
|
61
|
+
.icons {
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
gap: 4px;
|
|
65
|
+
margin-left: 8px;
|
|
66
|
+
flex-shrink: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// 清除图标
|
|
70
|
+
.clearIcon {
|
|
71
|
+
font-size: 14px;
|
|
72
|
+
color: #c0c4cc;
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
transition: color 0.2s;
|
|
75
|
+
|
|
76
|
+
&:hover {
|
|
77
|
+
color: #909399;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// 下拉箭头
|
|
82
|
+
.arrowIcon {
|
|
83
|
+
font-size: 14px;
|
|
84
|
+
color: #c0c4cc;
|
|
85
|
+
transition: transform 0.3s;
|
|
86
|
+
|
|
87
|
+
&.reverse {
|
|
88
|
+
transform: rotate(180deg);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// 前置标签
|
|
93
|
+
.label {
|
|
94
|
+
color: #606266;
|
|
95
|
+
font-size: 14px;
|
|
96
|
+
margin-right: 4px;
|
|
97
|
+
flex-shrink: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// 占位符
|
|
101
|
+
.placeholder {
|
|
102
|
+
color: #c0c4cc;
|
|
103
|
+
font-size: 14px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// 文本
|
|
107
|
+
.text {
|
|
108
|
+
color: #606266;
|
|
109
|
+
font-size: 14px;
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
text-overflow: ellipsis;
|
|
112
|
+
white-space: nowrap;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// 文字包装器
|
|
116
|
+
.textWrapper {
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
gap: 8px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// 数量徽章
|
|
123
|
+
.countBadge {
|
|
124
|
+
display: inline-flex;
|
|
125
|
+
align-items: center;
|
|
126
|
+
justify-content: center;
|
|
127
|
+
min-width: 20px;
|
|
128
|
+
height: 20px;
|
|
129
|
+
padding: 0 4px;
|
|
130
|
+
background-color: #ecf5ff;
|
|
131
|
+
color: #409eff;
|
|
132
|
+
font-size: 12px;
|
|
133
|
+
font-weight: 500;
|
|
134
|
+
border-radius: 10px;
|
|
135
|
+
white-space: nowrap;
|
|
136
|
+
flex-shrink: 0;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// 悬浮窗内容
|
|
140
|
+
.dropdownContent {
|
|
141
|
+
display: flex;
|
|
142
|
+
flex-direction: column;
|
|
143
|
+
height: 100%;
|
|
144
|
+
max-height: inherit; // 继承父容器的 maxHeight
|
|
145
|
+
overflow: hidden; // 防止内容溢出到悬浮窗外
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// 搜索框
|
|
149
|
+
.searchBox {
|
|
150
|
+
padding: 8px;
|
|
151
|
+
border-bottom: 1px solid #e4e7ed;
|
|
152
|
+
background: #fff;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// 树容器
|
|
156
|
+
.treeWrapper {
|
|
157
|
+
flex: 1;
|
|
158
|
+
overflow-y: auto;
|
|
159
|
+
padding: 8px 0;
|
|
160
|
+
|
|
161
|
+
// 自定义滚动条
|
|
162
|
+
&::-webkit-scrollbar {
|
|
163
|
+
width: 6px;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
&::-webkit-scrollbar-track {
|
|
167
|
+
background: #f1f1f1;
|
|
168
|
+
border-radius: 3px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&::-webkit-scrollbar-thumb {
|
|
172
|
+
background: #c1c1c1;
|
|
173
|
+
border-radius: 3px;
|
|
174
|
+
|
|
175
|
+
&:hover {
|
|
176
|
+
background: #a8a8a8;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// 树样式
|
|
181
|
+
:global {
|
|
182
|
+
.el-tree {
|
|
183
|
+
background: transparent;
|
|
184
|
+
|
|
185
|
+
.el-tree-node__content {
|
|
186
|
+
height: 32px;
|
|
187
|
+
padding-right: 12px;
|
|
188
|
+
transition: background-color 0.2s;
|
|
189
|
+
|
|
190
|
+
&:hover {
|
|
191
|
+
background-color: #f5f7fa;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.el-tree-node__label {
|
|
196
|
+
font-size: 14px;
|
|
197
|
+
color: #606266;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.el-tree-node.is-current > .el-tree-node__content {
|
|
201
|
+
background-color: #ecf5ff;
|
|
202
|
+
color: #409eff;
|
|
203
|
+
|
|
204
|
+
.el-tree-node__label {
|
|
205
|
+
color: #409eff;
|
|
206
|
+
font-weight: 500;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// 加载状态
|
|
214
|
+
.loading {
|
|
215
|
+
display: flex;
|
|
216
|
+
flex-direction: column;
|
|
217
|
+
align-items: center;
|
|
218
|
+
justify-content: center;
|
|
219
|
+
padding: 60px 16px;
|
|
220
|
+
color: #909399;
|
|
221
|
+
font-size: 14px;
|
|
222
|
+
gap: 12px;
|
|
223
|
+
|
|
224
|
+
:global(.el-icon) {
|
|
225
|
+
font-size: 24px;
|
|
226
|
+
color: #409eff;
|
|
227
|
+
}
|
|
228
|
+
}
|
package/app/wujie-vue3-child/src/views/aiCoach/departmentPersonnel/components/OptionsSelector.jsx
ADDED
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import { defineComponent, ref, computed } from 'vue'
|
|
2
|
+
import { ArrowDown, CircleClose, Check } from '@element-plus/icons-vue'
|
|
3
|
+
import PopoverSelector from './PopoverSelector.jsx'
|
|
4
|
+
import styles from './OptionsSelector.module.scss'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 通用选项选择器组件(基于 PopoverSelector)
|
|
8
|
+
* @component OptionsSelector
|
|
9
|
+
* @description 基于 PopoverSelector 构建的通用选项选择器,支持单选/多选
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // 单选
|
|
13
|
+
* const selected = ref({ label: '选项 1', value: 1 })
|
|
14
|
+
* <OptionsSelector
|
|
15
|
+
* v-model={selected.value}
|
|
16
|
+
* options={[
|
|
17
|
+
* { label: '全部', value: '' },
|
|
18
|
+
* { label: '选项 1', value: 1 },
|
|
19
|
+
* { label: '选项 2', value: 2 }
|
|
20
|
+
* ]}
|
|
21
|
+
* />
|
|
22
|
+
*
|
|
23
|
+
* // 多选
|
|
24
|
+
* const selected = ref([{ label: '选项 1', value: 1 }, { label: '选项 2', value: 2 }])
|
|
25
|
+
* <OptionsSelector
|
|
26
|
+
* v-model={selected.value}
|
|
27
|
+
* options={options}
|
|
28
|
+
* multiple={true}
|
|
29
|
+
* />
|
|
30
|
+
*/
|
|
31
|
+
export default defineComponent({
|
|
32
|
+
name: 'OptionsSelector',
|
|
33
|
+
|
|
34
|
+
props: {
|
|
35
|
+
/**
|
|
36
|
+
* 选中的选项(单选时为对象,多选时为数组)
|
|
37
|
+
* @type {Object|Array<Object>}
|
|
38
|
+
* @example 单选:{ label: '选项 1', value: 1 }
|
|
39
|
+
* @example 多选:[{ label: '选项 1', value: 1 }, { label: '选项 2', value: 2 }]
|
|
40
|
+
*/
|
|
41
|
+
modelValue: {
|
|
42
|
+
type: [Object, Array],
|
|
43
|
+
default: null,
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* 选项列表
|
|
47
|
+
* @type {Array<{label: string, value: any}>}
|
|
48
|
+
* @example [{ label: '全部', value: '' }, { label: '选项 1', value: 1 }]
|
|
49
|
+
*/
|
|
50
|
+
options: {
|
|
51
|
+
type: Array,
|
|
52
|
+
default: () => [],
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* 是否多选
|
|
56
|
+
*/
|
|
57
|
+
multiple: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false,
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* 占位文本
|
|
63
|
+
*/
|
|
64
|
+
placeholder: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: '请选择',
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* 前置标签
|
|
70
|
+
*/
|
|
71
|
+
label: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: '',
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* 显示类型:input | button
|
|
77
|
+
*/
|
|
78
|
+
displayType: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: 'input',
|
|
81
|
+
validator: (value) => ['input', 'button'].includes(value),
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* 是否禁用
|
|
85
|
+
*/
|
|
86
|
+
disabled: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: false,
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* 是否可清空
|
|
92
|
+
*/
|
|
93
|
+
clearable: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: false,
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* 是否显示搜索框
|
|
99
|
+
*/
|
|
100
|
+
filterable: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
default: true,
|
|
103
|
+
},
|
|
104
|
+
/**
|
|
105
|
+
* 悬浮窗宽度
|
|
106
|
+
*/
|
|
107
|
+
width: {
|
|
108
|
+
type: [Number, String],
|
|
109
|
+
default: 240,
|
|
110
|
+
},
|
|
111
|
+
/**
|
|
112
|
+
* 悬浮窗最大高度
|
|
113
|
+
*/
|
|
114
|
+
maxHeight: {
|
|
115
|
+
type: Number,
|
|
116
|
+
default: 300,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
emits: ['update:modelValue', 'change'],
|
|
121
|
+
|
|
122
|
+
setup(props, { emit }) {
|
|
123
|
+
// 是否 hover
|
|
124
|
+
const isHovering = ref(false)
|
|
125
|
+
// 搜索关键词
|
|
126
|
+
const searchKeyword = ref('')
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 获取选中的选项信息
|
|
130
|
+
*/
|
|
131
|
+
const selectedOptions = computed(() => {
|
|
132
|
+
if (!props.modelValue) return []
|
|
133
|
+
// v-model 直接绑定对象,单选转数组,多选直接使用
|
|
134
|
+
return Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue]
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 显示文本
|
|
139
|
+
*/
|
|
140
|
+
const displayText = computed(() => {
|
|
141
|
+
const selected = selectedOptions.value
|
|
142
|
+
if (selected.length === 0) return ''
|
|
143
|
+
return selected.map(d => d.label).join(', ')
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* 过滤后的选项列表
|
|
148
|
+
*/
|
|
149
|
+
const filteredOptions = computed(() => {
|
|
150
|
+
if (!searchKeyword.value) return props.options
|
|
151
|
+
const keyword = searchKeyword.value.toLowerCase()
|
|
152
|
+
return props.options.filter(option =>
|
|
153
|
+
option.label.toLowerCase().includes(keyword)
|
|
154
|
+
)
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* 选项点击
|
|
159
|
+
*/
|
|
160
|
+
const handleOptionClick = (option, close) => {
|
|
161
|
+
if (props.multiple) {
|
|
162
|
+
// 多选
|
|
163
|
+
const selected = selectedOptions.value
|
|
164
|
+
const index = selected.findIndex(item => item.value === option.value)
|
|
165
|
+
|
|
166
|
+
let newValue
|
|
167
|
+
if (index > -1) {
|
|
168
|
+
// 已选中,取消选择
|
|
169
|
+
newValue = selected.filter((_, i) => i !== index)
|
|
170
|
+
} else {
|
|
171
|
+
// 未选中,添加选择
|
|
172
|
+
newValue = [...selected, option]
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
emit('update:modelValue', newValue)
|
|
176
|
+
emit('change', newValue)
|
|
177
|
+
} else {
|
|
178
|
+
// 单选:选中后关闭
|
|
179
|
+
emit('update:modelValue', option)
|
|
180
|
+
emit('change', option)
|
|
181
|
+
close()
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* 判断选项是否选中
|
|
187
|
+
*/
|
|
188
|
+
const isOptionSelected = (option) => {
|
|
189
|
+
return selectedOptions.value.some(item => item.value === option.value)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* 清空选择
|
|
194
|
+
*/
|
|
195
|
+
const handleClear = (e) => {
|
|
196
|
+
e.stopPropagation()
|
|
197
|
+
emit('update:modelValue', props.multiple ? [] : null)
|
|
198
|
+
emit('change', props.multiple ? [] : null)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* 移除单个选中项(多选模式)
|
|
203
|
+
*/
|
|
204
|
+
const handleRemoveTag = (e, option) => {
|
|
205
|
+
e.stopPropagation()
|
|
206
|
+
const selected = selectedOptions.value.filter(item => item.value !== option.value)
|
|
207
|
+
emit('update:modelValue', selected)
|
|
208
|
+
emit('change', selected)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* 悬浮窗打开时
|
|
213
|
+
*/
|
|
214
|
+
const handleOpen = () => {
|
|
215
|
+
searchKeyword.value = ''
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return () => {
|
|
219
|
+
// 渲染显示内容
|
|
220
|
+
const renderContent = () => {
|
|
221
|
+
let content = null
|
|
222
|
+
|
|
223
|
+
if (props.multiple) {
|
|
224
|
+
const selected = selectedOptions.value
|
|
225
|
+
if (selected.length === 0) {
|
|
226
|
+
content = <span class={styles.placeholder}>{props.placeholder}</span>
|
|
227
|
+
} else if (props.displayType === 'button') {
|
|
228
|
+
// 按钮模式:显示文字 + 徽章
|
|
229
|
+
const first = selected[0]
|
|
230
|
+
const restCount = selected.length - 1
|
|
231
|
+
content = (
|
|
232
|
+
<div class={styles.textWrapper}>
|
|
233
|
+
<span class={styles.text}>{first.label}</span>
|
|
234
|
+
{restCount > 0 && (
|
|
235
|
+
<span class={styles.countBadge}>+{restCount}</span>
|
|
236
|
+
)}
|
|
237
|
+
</div>
|
|
238
|
+
)
|
|
239
|
+
} else {
|
|
240
|
+
// 输入框模式:显示 tag 列表
|
|
241
|
+
content = (
|
|
242
|
+
<div class={styles.tagsWrapper}>
|
|
243
|
+
{selected.map(option => (
|
|
244
|
+
<el-tag
|
|
245
|
+
key={option.value}
|
|
246
|
+
closable
|
|
247
|
+
size="small"
|
|
248
|
+
type="info"
|
|
249
|
+
onClose={(e) => handleRemoveTag(e, option)}
|
|
250
|
+
class={styles.tag}
|
|
251
|
+
>
|
|
252
|
+
{option.label}
|
|
253
|
+
</el-tag>
|
|
254
|
+
))}
|
|
255
|
+
</div>
|
|
256
|
+
)
|
|
257
|
+
}
|
|
258
|
+
} else {
|
|
259
|
+
content = displayText.value ? (
|
|
260
|
+
<span class={styles.text}>{displayText.value}</span>
|
|
261
|
+
) : (
|
|
262
|
+
<span class={styles.placeholder}>{props.placeholder}</span>
|
|
263
|
+
)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (props.label) {
|
|
267
|
+
return (
|
|
268
|
+
<>
|
|
269
|
+
<span class={styles.label}>{props.label}</span>
|
|
270
|
+
{content}
|
|
271
|
+
</>
|
|
272
|
+
)
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return content
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// 渲染图标
|
|
279
|
+
const renderIcons = (visible) => {
|
|
280
|
+
const hasValue = props.multiple
|
|
281
|
+
? selectedOptions.value.length > 0
|
|
282
|
+
: !!displayText.value
|
|
283
|
+
|
|
284
|
+
const showClearIcon = props.clearable && hasValue && isHovering.value
|
|
285
|
+
|
|
286
|
+
return (
|
|
287
|
+
<div class={styles.icons}>
|
|
288
|
+
{showClearIcon && (
|
|
289
|
+
<el-icon class={styles.clearIcon} onClick={handleClear}>
|
|
290
|
+
<CircleClose />
|
|
291
|
+
</el-icon>
|
|
292
|
+
)}
|
|
293
|
+
{!showClearIcon && (
|
|
294
|
+
<el-icon class={[styles.arrowIcon, visible && styles.reverse]}>
|
|
295
|
+
<ArrowDown />
|
|
296
|
+
</el-icon>
|
|
297
|
+
)}
|
|
298
|
+
</div>
|
|
299
|
+
)
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return (
|
|
303
|
+
<PopoverSelector
|
|
304
|
+
width={props.width}
|
|
305
|
+
maxHeight={props.maxHeight}
|
|
306
|
+
disabled={props.disabled}
|
|
307
|
+
onOpen={handleOpen}
|
|
308
|
+
>
|
|
309
|
+
{{
|
|
310
|
+
// 触发器插槽
|
|
311
|
+
trigger: ({ open, visible }) => {
|
|
312
|
+
if (props.displayType === 'button') {
|
|
313
|
+
return (
|
|
314
|
+
<el-button
|
|
315
|
+
disabled={props.disabled}
|
|
316
|
+
onClick={open}
|
|
317
|
+
onMouseenter={() => (isHovering.value = true)}
|
|
318
|
+
onMouseleave={() => (isHovering.value = false)}
|
|
319
|
+
class={styles.buttonTrigger}
|
|
320
|
+
>
|
|
321
|
+
{{
|
|
322
|
+
default: () => (
|
|
323
|
+
<div class={styles.buttonInner}>
|
|
324
|
+
<div class={styles.content}>
|
|
325
|
+
{renderContent()}
|
|
326
|
+
</div>
|
|
327
|
+
{renderIcons(visible)}
|
|
328
|
+
</div>
|
|
329
|
+
),
|
|
330
|
+
}}
|
|
331
|
+
</el-button>
|
|
332
|
+
)
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
return (
|
|
336
|
+
<div
|
|
337
|
+
class={[
|
|
338
|
+
styles.inputTrigger,
|
|
339
|
+
props.disabled && styles.disabled,
|
|
340
|
+
visible && styles.focused,
|
|
341
|
+
]}
|
|
342
|
+
onClick={open}
|
|
343
|
+
onMouseenter={() => (isHovering.value = true)}
|
|
344
|
+
onMouseleave={() => (isHovering.value = false)}
|
|
345
|
+
>
|
|
346
|
+
<div class={styles.content}>{renderContent()}</div>
|
|
347
|
+
{renderIcons(visible)}
|
|
348
|
+
</div>
|
|
349
|
+
)
|
|
350
|
+
},
|
|
351
|
+
|
|
352
|
+
// 悬浮窗内容插槽
|
|
353
|
+
default: ({ close }) => (
|
|
354
|
+
<div class={styles.dropdownContent}>
|
|
355
|
+
{/* 搜索框 */}
|
|
356
|
+
{props.filterable && (
|
|
357
|
+
<div class={styles.searchBox}>
|
|
358
|
+
<el-input
|
|
359
|
+
v-model={searchKeyword.value}
|
|
360
|
+
placeholder="搜索选项"
|
|
361
|
+
prefix-icon="Search"
|
|
362
|
+
clearable
|
|
363
|
+
size="small"
|
|
364
|
+
/>
|
|
365
|
+
</div>
|
|
366
|
+
)}
|
|
367
|
+
|
|
368
|
+
{/* 选项列表 */}
|
|
369
|
+
<div class={styles.optionsList}>
|
|
370
|
+
{filteredOptions.value.length > 0 ? (
|
|
371
|
+
filteredOptions.value.map(option => (
|
|
372
|
+
<div
|
|
373
|
+
key={option.value}
|
|
374
|
+
class={[
|
|
375
|
+
styles.optionItem,
|
|
376
|
+
isOptionSelected(option) && styles.selected,
|
|
377
|
+
]}
|
|
378
|
+
onClick={() => handleOptionClick(option, close)}
|
|
379
|
+
>
|
|
380
|
+
<span class={styles.optionLabel}>{option.label}</span>
|
|
381
|
+
{isOptionSelected(option) && (
|
|
382
|
+
<el-icon class={styles.checkIcon}>
|
|
383
|
+
<Check />
|
|
384
|
+
</el-icon>
|
|
385
|
+
)}
|
|
386
|
+
</div>
|
|
387
|
+
))
|
|
388
|
+
) : (
|
|
389
|
+
<div class={styles.empty}>暂无数据</div>
|
|
390
|
+
)}
|
|
391
|
+
</div>
|
|
392
|
+
</div>
|
|
393
|
+
),
|
|
394
|
+
}}
|
|
395
|
+
</PopoverSelector>
|
|
396
|
+
)
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
})
|