widget.qw 1.0.83 → 1.0.84
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/.env.development +10 -10
- package/.env.production +8 -8
- package/README.md +75 -75
- package/build/style.css +471 -471
- package/build/widget.qw.es.js +141 -74
- package/build/widget.qw.umd.js +141 -74
- package/index.html +17 -17
- package/package.json +47 -47
- package/src/App.vue +26 -26
- package/src/api/index.js +165 -165
- package/src/components/AuditBar.vue +396 -396
- package/src/components/BillCard.vue +164 -164
- package/src/components/CascaderPicker.vue +132 -132
- package/src/components/CascaderPop.vue +373 -371
- package/src/components/CheckGroup.vue +113 -113
- package/src/components/DatetimeDropdown.vue +62 -0
- package/src/components/{DatetimePicker/index.vue → DatetimePicker.vue} +124 -124
- package/src/components/DayDropdown.vue +56 -56
- package/src/components/FilePicker.vue +169 -169
- package/src/components/Input.vue +80 -80
- package/src/components/MonthDropdown.vue +51 -51
- package/src/components/MultiPicker.vue +123 -123
- package/src/components/ObjsEditor.vue +334 -334
- package/src/components/SecretNotify.js +5 -5
- package/src/components/Sheet.vue +92 -92
- package/src/components/SingleApiPicker.vue +108 -108
- package/src/components/SinglePicker.vue +102 -102
- package/src/components/SingleUserSelector.vue +425 -425
- package/src/components/Switch.vue +64 -64
- package/src/components/TreePicker.vue +113 -113
- package/src/components/UserPicker.vue +106 -106
- package/src/components/UserProfile.vue +129 -129
- package/src/components/UsersPicker.vue +118 -118
- package/src/components/YearDropdown.vue +59 -59
- package/src/components/data_selector.vue +303 -303
- package/src/components/image_picker.vue +123 -123
- package/src/components/images_picker.vue +195 -195
- package/src/components/index.js +167 -162
- package/src/components/mult_list_selector.vue +155 -155
- package/src/components/subdepartment_selector.vue +481 -481
- package/src/components/user_selector.vue +639 -639
- package/src/components/widget/DataPop.vue +95 -95
- package/src/components/{DatetimePicker → widget}/DatetimePop.vue +342 -342
- package/src/components/widget/TreePop.vue +88 -88
- package/src/components/widget/UserPop.vue +347 -347
- package/src/main.js +117 -117
- package/src/router/index.ts +178 -173
- package/src/util/array_util.js +32 -32
- package/src/util/auth_util.js +72 -72
- package/src/util/bool_util.js +5 -5
- package/src/util/bus.js +1 -1
- package/src/util/cache_util.js +18 -18
- package/src/util/errer_code.js +6 -6
- package/src/util/eval_util.js +19 -19
- package/src/util/icon_util.js +36 -36
- package/src/util/image_util.js +27 -27
- package/src/util/index.js +57 -57
- package/src/util/num_util.js +70 -70
- package/src/util/obj_util.js +28 -28
- package/src/util/request.js +73 -73
- package/src/util/request_json.js +71 -71
- package/src/util/request_json_mute.js +65 -65
- package/src/util/request_upload.js +79 -79
- package/src/util/route_util.js +31 -31
- package/src/util/str_util.js +143 -143
- package/src/util/time_util.js +406 -406
- package/src/util/toast_util.js +24 -24
- package/src/util/tree_util.js +153 -153
- package/src/util/uuid_util.js +9 -9
- package/src/util/validate.js +182 -182
- package/src/util/vue_filter.js +223 -223
- package/src/views/auditbar/index.vue +78 -78
- package/src/views/billcard/index.vue +48 -48
- package/src/views/cascaderpicker/index.vue +0 -0
- package/src/views/cascaderpop/index.vue +90 -90
- package/src/views/checkgroup/index.vue +35 -35
- package/src/views/dataSelector/index.vue +48 -48
- package/src/views/datetimedropdown/index.vue +34 -0
- package/src/views/datetimepicker/index.vue +34 -34
- package/src/views/daydropdown/index.vue +31 -31
- package/src/views/filepicker/index.vue +32 -32
- package/src/views/home/index.vue +0 -0
- package/src/views/imagepicker/index.vue +31 -31
- package/src/views/imagespicker/index.vue +37 -37
- package/src/views/input/index.vue +35 -35
- package/src/views/monthdropdown/index.vue +31 -31
- package/src/views/multListSelector/index.vue +61 -61
- package/src/views/multipicker/index.vue +36 -36
- package/src/views/objseditor/index.vue +277 -277
- package/src/views/productSelector/index.vue +35 -35
- package/src/views/projectpicker/index.vue +41 -41
- package/src/views/secretnotify/index.vue +27 -27
- package/src/views/sheet/index.vue +45 -45
- package/src/views/singlepicker/index.vue +35 -35
- package/src/views/subdepartmentSelector/index.vue +40 -40
- package/src/views/switch/index.vue +34 -34
- package/src/views/treepicker/index.vue +41 -41
- package/src/views/userSelector/index.vue +54 -54
- package/src/views/userSelectorNew/index.vue +45 -45
- package/src/views/userpicker/index.vue +43 -43
- package/src/views/userprofile/index.vue +30 -30
- package/src/views/userspicker/index.vue +43 -43
- package/src/views/yeardropdown/index.vue +32 -32
- package/src/vm/index.js +1 -1
- package/vite.config.ts +122 -122
|
@@ -1,372 +1,374 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<van-popup v-model:show="show" round position="bottom" class="cascader-pop">
|
|
3
|
-
<div class="cascader-selector">
|
|
4
|
-
<div class="cascader-header">
|
|
5
|
-
<div class="header-left">
|
|
6
|
-
<van-button @click="onBack" icon="arrow-left" size="small" />
|
|
7
|
-
</div>
|
|
8
|
-
|
|
9
|
-
<!-- 移除header-center包装,直接使用current-path -->
|
|
10
|
-
<div class="current-path">{{ pathsLabel }}</div>
|
|
11
|
-
|
|
12
|
-
<div class="header-right">
|
|
13
|
-
<van-button size="small" @click="onCancel" class="cancel-btn">取消</van-button>
|
|
14
|
-
|
|
15
|
-
<van-button type="primary" size="small" @click="onSubmit" class="confirm-btn">确定</van-button>
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
|
|
19
|
-
<!-- 搜索框 -->
|
|
20
|
-
<van-search v-model="data.keyword" :placeholder="props.placeholder" @clear="onClear" @search="onSearch"
|
|
21
|
-
@cancel="onClear" show-action>
|
|
22
|
-
<template #action>
|
|
23
|
-
<div @click="onSearch">搜索</div>
|
|
24
|
-
</template>
|
|
25
|
-
</van-search>
|
|
26
|
-
|
|
27
|
-
<div class="scroll-container">
|
|
28
|
-
<!-- 遍历子节点列表 -->
|
|
29
|
-
<van-cell-group>
|
|
30
|
-
<van-cell v-for="(item, i) in optionNodes" :key="i"
|
|
31
|
-
<template #title>
|
|
32
|
-
<div class="cell-content">
|
|
33
|
-
<div class="circle-selector" v-if="item.canCheck">
|
|
34
|
-
<van-icon v-if="data.selectedNodeId === item.id" name="success" size="20"
|
|
35
|
-
color="#409eff" />
|
|
36
|
-
<van-icon v-if="data.selectedNodeId != item.id" name="circle" size="20"
|
|
37
|
-
color="#e0e0e0" />
|
|
38
|
-
</div>
|
|
39
|
-
<span class="name">{{ item.label }}</span>
|
|
40
|
-
</div>
|
|
41
|
-
</template>
|
|
42
|
-
<template #right-icon v-if="item.canExpand">
|
|
43
|
-
<van-icon name="arrow" @click.stop="onNextLevel(item)" />
|
|
44
|
-
</template>
|
|
45
|
-
</van-cell>
|
|
46
|
-
</van-cell-group>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</van-popup>
|
|
50
|
-
</template>
|
|
51
|
-
|
|
52
|
-
<script setup>
|
|
53
|
-
import { ref, onMounted, watch, reactive, computed } from "vue";
|
|
54
|
-
import util from "@/util"
|
|
55
|
-
import { useVModel } from '@vueuse/core'
|
|
56
|
-
|
|
57
|
-
const props = defineProps({
|
|
58
|
-
modelValue: {
|
|
59
|
-
type: String,
|
|
60
|
-
default: ''
|
|
61
|
-
},
|
|
62
|
-
show: {
|
|
63
|
-
type: Boolean,
|
|
64
|
-
default: false,
|
|
65
|
-
},
|
|
66
|
-
placeholder: {
|
|
67
|
-
type: String,
|
|
68
|
-
default: ''
|
|
69
|
-
},
|
|
70
|
-
keywordQueryNode: {
|
|
71
|
-
type: Function,
|
|
72
|
-
default: () => { }
|
|
73
|
-
},
|
|
74
|
-
idQueryNode: {
|
|
75
|
-
type: Function,
|
|
76
|
-
default: () => { }
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
// 定义emit
|
|
80
|
-
const emit = defineEmits(["update:modelValue", "update:show", "select"]);
|
|
81
|
-
// 弹出?
|
|
82
|
-
const show = useVModel(props, 'show', emit)
|
|
83
|
-
const modelValue = useVModel(props, 'modelValue', emit)
|
|
84
|
-
const data = reactive({
|
|
85
|
-
//当前父节点
|
|
86
|
-
parentNode: null,
|
|
87
|
-
// 搜索关键字
|
|
88
|
-
keyword: "",
|
|
89
|
-
//勾选的子节点id
|
|
90
|
-
selectedNodeId: ''
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
onMounted(() => {
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
// 待选节点列表
|
|
97
|
-
const optionNodes = computed(() => {
|
|
98
|
-
return data.parentNode?.children ? data.parentNode.children : []
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
//选中节点的路径:父/子/孙
|
|
102
|
-
const pathsLabel = computed(() => {
|
|
103
|
-
return data.parentNode?.path ? data.parentNode.path : ''
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
// 关键字查询节点列表
|
|
107
|
-
const keywordQueryNode = () => {
|
|
108
|
-
props.keywordQueryNode({ keyword: data.keyword, isReturnParent: true }, (node) => {
|
|
109
|
-
data.parentNode = node
|
|
110
|
-
})
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// 关键字查询
|
|
114
|
-
const onSearch = () => {
|
|
115
|
-
keywordQueryNode()
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// 返回上一级
|
|
119
|
-
const onBack = () => {
|
|
120
|
-
let parentId = ''
|
|
121
|
-
if (data.parentNode)
|
|
122
|
-
parentId = data.parentNode.parentId
|
|
123
|
-
|
|
124
|
-
let isReturnParent = false
|
|
125
|
-
if (!parentId)
|
|
126
|
-
isReturnParent = true
|
|
127
|
-
|
|
128
|
-
data.keyword = ""
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
data.selectedNodeId =
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
params
|
|
183
|
-
params.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
params
|
|
202
|
-
params.
|
|
203
|
-
params.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
params
|
|
215
|
-
params.
|
|
216
|
-
params.
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<van-popup v-model:show="show" round position="bottom" class="cascader-pop">
|
|
3
|
+
<div class="cascader-selector">
|
|
4
|
+
<div class="cascader-header">
|
|
5
|
+
<div class="header-left">
|
|
6
|
+
<van-button @click="onBack" icon="arrow-left" size="small" />
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<!-- 移除header-center包装,直接使用current-path -->
|
|
10
|
+
<div class="current-path">{{ pathsLabel }}</div>
|
|
11
|
+
|
|
12
|
+
<div class="header-right">
|
|
13
|
+
<van-button size="small" @click="onCancel" class="cancel-btn">取消</van-button>
|
|
14
|
+
|
|
15
|
+
<van-button type="primary" size="small" @click="onSubmit" class="confirm-btn">确定</van-button>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<!-- 搜索框 -->
|
|
20
|
+
<van-search v-model="data.keyword" :placeholder="props.placeholder" @clear="onClear" @search="onSearch"
|
|
21
|
+
@cancel="onClear" show-action>
|
|
22
|
+
<template #action>
|
|
23
|
+
<div @click="onSearch">搜索</div>
|
|
24
|
+
</template>
|
|
25
|
+
</van-search>
|
|
26
|
+
|
|
27
|
+
<div class="scroll-container">
|
|
28
|
+
<!-- 遍历子节点列表 -->
|
|
29
|
+
<van-cell-group>
|
|
30
|
+
<van-cell v-for="(item, i) in optionNodes" :key="i">
|
|
31
|
+
<template #title>
|
|
32
|
+
<div class="cell-content">
|
|
33
|
+
<div class="circle-selector" v-if="item.canCheck" @click.stop="onToggle(item)">
|
|
34
|
+
<van-icon v-if="data.selectedNodeId === item.id" name="success" size="20"
|
|
35
|
+
color="#409eff" />
|
|
36
|
+
<van-icon v-if="data.selectedNodeId != item.id" name="circle" size="20"
|
|
37
|
+
color="#e0e0e0" />
|
|
38
|
+
</div>
|
|
39
|
+
<span class="name">{{ item.label }}</span>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
<template #right-icon v-if="item.canExpand">
|
|
43
|
+
<van-icon name="arrow" @click.stop="onNextLevel(item)" />
|
|
44
|
+
</template>
|
|
45
|
+
</van-cell>
|
|
46
|
+
</van-cell-group>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</van-popup>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script setup>
|
|
53
|
+
import { ref, onMounted, watch, reactive, computed } from "vue";
|
|
54
|
+
import util from "@/util"
|
|
55
|
+
import { useVModel } from '@vueuse/core'
|
|
56
|
+
|
|
57
|
+
const props = defineProps({
|
|
58
|
+
modelValue: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: ''
|
|
61
|
+
},
|
|
62
|
+
show: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false,
|
|
65
|
+
},
|
|
66
|
+
placeholder: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: ''
|
|
69
|
+
},
|
|
70
|
+
keywordQueryNode: {
|
|
71
|
+
type: Function,
|
|
72
|
+
default: () => { }
|
|
73
|
+
},
|
|
74
|
+
idQueryNode: {
|
|
75
|
+
type: Function,
|
|
76
|
+
default: () => { }
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
// 定义emit
|
|
80
|
+
const emit = defineEmits(["update:modelValue", "update:show", "select"]);
|
|
81
|
+
// 弹出?
|
|
82
|
+
const show = useVModel(props, 'show', emit)
|
|
83
|
+
const modelValue = useVModel(props, 'modelValue', emit)
|
|
84
|
+
const data = reactive({
|
|
85
|
+
//当前父节点
|
|
86
|
+
parentNode: null,
|
|
87
|
+
// 搜索关键字
|
|
88
|
+
keyword: "",
|
|
89
|
+
//勾选的子节点id
|
|
90
|
+
selectedNodeId: ''
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
onMounted(() => {
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
// 待选节点列表
|
|
97
|
+
const optionNodes = computed(() => {
|
|
98
|
+
return data.parentNode?.children ? data.parentNode.children : []
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
//选中节点的路径:父/子/孙
|
|
102
|
+
const pathsLabel = computed(() => {
|
|
103
|
+
return data.parentNode?.path ? data.parentNode.path : ''
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
// 关键字查询节点列表
|
|
107
|
+
const keywordQueryNode = () => {
|
|
108
|
+
props.keywordQueryNode({ keyword: data.keyword, isReturnParent: true }, (node) => {
|
|
109
|
+
data.parentNode = node
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// 关键字查询
|
|
114
|
+
const onSearch = () => {
|
|
115
|
+
keywordQueryNode()
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// 返回上一级
|
|
119
|
+
const onBack = () => {
|
|
120
|
+
let parentId = ''
|
|
121
|
+
if (data.parentNode)
|
|
122
|
+
parentId = data.parentNode.parentId
|
|
123
|
+
|
|
124
|
+
let isReturnParent = false
|
|
125
|
+
if (!parentId)
|
|
126
|
+
isReturnParent = true
|
|
127
|
+
|
|
128
|
+
data.keyword = ""
|
|
129
|
+
//查询父节点
|
|
130
|
+
//父节点一定有子节点
|
|
131
|
+
props.idQueryNode({ id: parentId, isReturnParent: isReturnParent, hasChildren: true }, (node) => {
|
|
132
|
+
data.parentNode = node
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const onClear = () => {
|
|
137
|
+
data.keyword = ''
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// 清除掉选中节点
|
|
141
|
+
const reset = () => {
|
|
142
|
+
// 搜索关键字
|
|
143
|
+
data.keyword = ""
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// 确认按钮
|
|
147
|
+
const onSubmit = () => {
|
|
148
|
+
if (!data.selectedNodeId) {
|
|
149
|
+
util.warnToast("请选择")
|
|
150
|
+
return
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
modelValue.value = data.selectedNodeId
|
|
154
|
+
show.value = false
|
|
155
|
+
|
|
156
|
+
reset()
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// 取消按钮
|
|
160
|
+
const onCancel = () => {
|
|
161
|
+
show.value = false
|
|
162
|
+
reset()
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const onToggle = (node) => {
|
|
166
|
+
if (data.selectedNodeId == node.id)
|
|
167
|
+
data.selectedNodeId = ''
|
|
168
|
+
else
|
|
169
|
+
data.selectedNodeId = node.id
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const onNextLevel = (node) => {
|
|
173
|
+
props.idQueryNode({ id: node.id, isReturnParent: false, hasChildren: true }, (node) => {
|
|
174
|
+
data.parentNode = node
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const query = async () => {
|
|
179
|
+
data.selectedNodeId = modelValue.value
|
|
180
|
+
//空id时,查带子节点的虚拟根节点
|
|
181
|
+
if (!modelValue.value) {
|
|
182
|
+
let params = {}
|
|
183
|
+
params.isReturnParent = true
|
|
184
|
+
params.hasChildren = true
|
|
185
|
+
params.hasPaths = true
|
|
186
|
+
|
|
187
|
+
await props.idQueryNode(params, (node) => {
|
|
188
|
+
data.parentNode = node
|
|
189
|
+
|
|
190
|
+
if (!modelValue.value)
|
|
191
|
+
return
|
|
192
|
+
|
|
193
|
+
let childNode = util.findNode(modelValue.value, data.parentNode.children)
|
|
194
|
+
emit('select', childNode)
|
|
195
|
+
})
|
|
196
|
+
}
|
|
197
|
+
//选中节点时
|
|
198
|
+
else {
|
|
199
|
+
//未显示底部弹窗时,只查节点本身
|
|
200
|
+
if (!props.show) {
|
|
201
|
+
let params = {}
|
|
202
|
+
params.id = modelValue.value
|
|
203
|
+
params.isReturnParent = false
|
|
204
|
+
params.hasChildren = false
|
|
205
|
+
params.hasPaths = true
|
|
206
|
+
|
|
207
|
+
await props.idQueryNode(params, (node) => {
|
|
208
|
+
data.parentNode = {}
|
|
209
|
+
emit('select', node)
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
//显示底部弹窗时,查询带子节点的父节点
|
|
213
|
+
else{
|
|
214
|
+
let params = {}
|
|
215
|
+
params.id = modelValue.value
|
|
216
|
+
params.isReturnParent = true
|
|
217
|
+
params.hasChildren = true
|
|
218
|
+
params.hasPaths = true
|
|
219
|
+
|
|
220
|
+
await props.idQueryNode(params, (node) => {
|
|
221
|
+
data.parentNode = node
|
|
222
|
+
if (!modelValue.value)
|
|
223
|
+
return
|
|
224
|
+
let childNode = util.findNode(modelValue.value, data.parentNode.children)
|
|
225
|
+
emit('select', childNode)
|
|
226
|
+
})
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
watch(() => props.show, () => {
|
|
232
|
+
if (!props.show)
|
|
233
|
+
return
|
|
234
|
+
|
|
235
|
+
query()
|
|
236
|
+
}, {
|
|
237
|
+
immediate: true
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
watch(() => modelValue.value, async (n, o) => {
|
|
241
|
+
query()
|
|
242
|
+
}, {
|
|
243
|
+
immediate: true
|
|
244
|
+
})
|
|
245
|
+
</script>
|
|
246
|
+
|
|
247
|
+
<style scoped>
|
|
248
|
+
.cascader-pop {
|
|
249
|
+
width: 100%;
|
|
250
|
+
overflow: hidden;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.cascader-selector {
|
|
254
|
+
padding: 10px;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.search-buttons {
|
|
258
|
+
display: flex;
|
|
259
|
+
gap: 10px;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.clear-btn {
|
|
263
|
+
background-color: #f2f3f5;
|
|
264
|
+
border: none;
|
|
265
|
+
border-radius: 4px;
|
|
266
|
+
padding: 4px 8px;
|
|
267
|
+
font-size: 14px;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.confirm-btn {
|
|
271
|
+
background-color: #1989fa;
|
|
272
|
+
color: white;
|
|
273
|
+
border: none;
|
|
274
|
+
border-radius: 4px;
|
|
275
|
+
padding: 4px 8px;
|
|
276
|
+
font-size: 14px;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.no-results {
|
|
280
|
+
text-align: center;
|
|
281
|
+
padding: 20px;
|
|
282
|
+
color: #969799;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.cascader-header {
|
|
286
|
+
padding: 10px;
|
|
287
|
+
border-bottom: 1px solid #ebedf0;
|
|
288
|
+
display: flex;
|
|
289
|
+
justify-content: space-between;
|
|
290
|
+
align-items: center;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.current-path {
|
|
294
|
+
flex: 1;
|
|
295
|
+
font-size: 14px;
|
|
296
|
+
color: #323233;
|
|
297
|
+
white-space: nowrap;
|
|
298
|
+
overflow: hidden;
|
|
299
|
+
text-overflow: ellipsis;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.header-right {
|
|
303
|
+
display: flex;
|
|
304
|
+
gap: 8px;
|
|
305
|
+
margin-left: auto;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.cancel-btn {
|
|
309
|
+
color: #969799;
|
|
310
|
+
margin-right: 5px;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.scroll-container {
|
|
314
|
+
height: calc(80vh - 150px);
|
|
315
|
+
overflow-y: auto;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
.cell-content {
|
|
320
|
+
display: flex;
|
|
321
|
+
align-items: center;
|
|
322
|
+
gap: 12px;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.circle-selector {
|
|
326
|
+
width: 20px;
|
|
327
|
+
height: 20px;
|
|
328
|
+
border-radius: 50%;
|
|
329
|
+
display: flex;
|
|
330
|
+
align-items: center;
|
|
331
|
+
justify-content: center;
|
|
332
|
+
transition: all 0.2s;
|
|
333
|
+
flex-shrink: 0;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.circle-selector.selected {
|
|
337
|
+
background-color: #1989fa;
|
|
338
|
+
border-color: #1989fa;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.circle-selector.selected .van-icon {
|
|
342
|
+
color: white;
|
|
343
|
+
font-size: 14px;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.van-cell__right-icon {
|
|
347
|
+
color: #969799;
|
|
348
|
+
font-size: 16px;
|
|
349
|
+
margin-left: 8px;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.name {
|
|
353
|
+
flex: 1;
|
|
354
|
+
overflow: hidden;
|
|
355
|
+
text-overflow: ellipsis;
|
|
356
|
+
white-space: nowrap;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.cancel-btn {
|
|
360
|
+
color: #969799;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.search-field {
|
|
364
|
+
background: #fff;
|
|
365
|
+
padding: 10px 16px;
|
|
366
|
+
border-bottom: 1px solid #ebedf0;
|
|
367
|
+
position: sticky;
|
|
368
|
+
top: 0;
|
|
369
|
+
z-index: 999;
|
|
370
|
+
margin-bottom: 10px;
|
|
371
|
+
flex-shrink: 0;
|
|
372
|
+
/* 防止压缩 */
|
|
373
|
+
}
|
|
372
374
|
</style>
|