@netang/quasar 0.0.48 → 0.0.50
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/components/data/index.vue +23 -23
- package/components/dialog/index.vue +10 -10
- package/components/dialog-table/index.vue +1 -1
- package/components/dragger/index.vue +2 -2
- package/components/drawer/index.vue +7 -7
- package/components/editor-code/index.vue +282 -0
- package/components/empty/index.vue +22 -3
- package/components/field-date/index.vue +35 -35
- package/components/field-table/index.vue +34 -34
- package/components/field-text/index.vue +2 -2
- package/components/field-tree/index.vue +18 -18
- package/components/input-number/index.vue +2 -2
- package/components/list-menu/index.vue +2 -2
- package/components/private/components/move-to-tree/index.vue +2 -2
- package/components/private/edit-power-data/index.vue +50 -50
- package/components/private/table-visible-columns-button/index.vue +2 -2
- package/components/render/index.vue +6 -6
- package/components/search/index.vue +2 -2
- package/components/search-item/index.vue +5 -5
- package/components/select/index.vue +2 -2
- package/components/splitter/index.vue +7 -7
- package/components/table/index.vue +5 -5
- package/components/table-splitter/index.vue +4 -4
- package/components/table-summary/index.vue +3 -3
- package/components/thumbnail/index.vue +6 -6
- package/components/uploader/index.vue +1 -1
- package/components/uploader-query/index.vue +25 -25
- package/components/value-format/index.vue +12 -12
- package/package.json +1 -1
- package/sass/quasar/field.scss +5 -0
- package/sass/quasar/table.scss +6 -0
- package/utils/$area.js +13 -13
- package/utils/$auth.js +6 -6
- package/utils/$dialog.js +3 -3
- package/utils/$form.js +2 -2
- package/utils/$power.js +118 -118
- package/utils/$rule.js +4 -4
- package/utils/$search.js +50 -50
- package/utils/$table.js +79 -76
- package/utils/$tree.js +43 -43
- package/utils/$uploader.js +47 -47
- package/utils/alert.js +1 -1
- package/utils/arr.js +2 -2
- package/utils/bus.js +1 -1
- package/utils/config.js +4 -4
- package/utils/confrim.js +1 -1
- package/utils/dict.js +5 -5
- package/utils/getData.js +9 -9
- package/utils/getFile.js +5 -5
- package/utils/getImage.js +12 -12
- package/utils/getTime.js +4 -4
- package/utils/http.js +20 -20
- package/utils/loading.js +1 -1
- package/utils/notify.js +1 -1
- package/utils/previewImage.js +2 -2
- package/utils/price.js +3 -3
- package/utils/timestamp.js +1 -1
- package/utils/toast.js +1 -1
- package/utils/uploader/qiniu.js +11 -11
- package/utils/useAuth.js +2 -2
- package/utils/useRouter.js +4 -4
|
@@ -197,17 +197,17 @@ export default {
|
|
|
197
197
|
|
|
198
198
|
// 是否为选择
|
|
199
199
|
const isSelect = computed(function() {
|
|
200
|
-
return
|
|
200
|
+
return $n.indexOf(['year', 'month', 'time'], props.type) > -1
|
|
201
201
|
})
|
|
202
202
|
|
|
203
203
|
// 是否为范围
|
|
204
204
|
const isRange = computed(function() {
|
|
205
|
-
return
|
|
205
|
+
return $n.indexOf(['daterange', 'datetimerange'], props.type) > -1
|
|
206
206
|
})
|
|
207
207
|
|
|
208
208
|
// 是否为选择时间
|
|
209
209
|
const isDatetime = computed(function() {
|
|
210
|
-
return
|
|
210
|
+
return $n.indexOf(['datetime', 'datetimerange'], props.type) > -1
|
|
211
211
|
})
|
|
212
212
|
|
|
213
213
|
// 选择数据列表
|
|
@@ -222,14 +222,14 @@ export default {
|
|
|
222
222
|
lists: []
|
|
223
223
|
}
|
|
224
224
|
for (let i = 0; i <= 23; i++) {
|
|
225
|
-
hh.lists.push([i,
|
|
225
|
+
hh.lists.push([i, $n.padStart(String(i), 2, '0')])
|
|
226
226
|
}
|
|
227
227
|
const ii = {
|
|
228
228
|
type: 'ii',
|
|
229
229
|
lists: []
|
|
230
230
|
}
|
|
231
231
|
for (let i = 0; i <= 59; i++) {
|
|
232
|
-
ii.lists.push([i,
|
|
232
|
+
ii.lists.push([i, $n.padStart(String(i), 2, '0')])
|
|
233
233
|
}
|
|
234
234
|
arr.push(hh, ii)
|
|
235
235
|
if (props.showSecond) {
|
|
@@ -238,7 +238,7 @@ export default {
|
|
|
238
238
|
lists: []
|
|
239
239
|
}
|
|
240
240
|
for (let i = 0; i <= 59; i++) {
|
|
241
|
-
ss.lists.push([i,
|
|
241
|
+
ss.lists.push([i, $n.padStart(String(i), 2, '0')])
|
|
242
242
|
}
|
|
243
243
|
arr.push(ss)
|
|
244
244
|
}
|
|
@@ -267,7 +267,7 @@ export default {
|
|
|
267
267
|
lists: []
|
|
268
268
|
}
|
|
269
269
|
for (let i = 1; i <= 12; i++) {
|
|
270
|
-
mm.lists.push([i,
|
|
270
|
+
mm.lists.push([i, $n.padStart(String(i), 2, '0')])
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
arr.push(mm)
|
|
@@ -333,9 +333,9 @@ export default {
|
|
|
333
333
|
ii: '',
|
|
334
334
|
})
|
|
335
335
|
|
|
336
|
-
if (
|
|
336
|
+
if ($n.isDate(val)) {
|
|
337
337
|
|
|
338
|
-
const { hh, ii, ss } =
|
|
338
|
+
const { hh, ii, ss } = $n.dateObject(val)
|
|
339
339
|
|
|
340
340
|
// 设置时间数据
|
|
341
341
|
Object.assign(obj, {
|
|
@@ -368,8 +368,8 @@ export default {
|
|
|
368
368
|
obj.y = val
|
|
369
369
|
|
|
370
370
|
// 否则如果是日期格式
|
|
371
|
-
} else if (
|
|
372
|
-
const { y } =
|
|
371
|
+
} else if ($n.isDate(val)) {
|
|
372
|
+
const { y } = $n.dateObject(val)
|
|
373
373
|
obj.y = y
|
|
374
374
|
}
|
|
375
375
|
}
|
|
@@ -380,13 +380,13 @@ export default {
|
|
|
380
380
|
// 否则是选择月
|
|
381
381
|
|
|
382
382
|
// 如果是这样的格式 202207, 则转换为 2022-07
|
|
383
|
-
const newVal =
|
|
383
|
+
const newVal = $n.ymd.toString(val)
|
|
384
384
|
if (newVal) {
|
|
385
385
|
val = newVal
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
-
if (
|
|
389
|
-
const { y, mm } =
|
|
388
|
+
if ($n.isDate(val)) {
|
|
389
|
+
const { y, mm } = $n.dateObject(val)
|
|
390
390
|
Object.assign(obj, {
|
|
391
391
|
y,
|
|
392
392
|
mm,
|
|
@@ -404,13 +404,13 @@ export default {
|
|
|
404
404
|
let to = ''
|
|
405
405
|
|
|
406
406
|
// 如果是这样的格式 20220708, 则转换为 2022-07-08
|
|
407
|
-
const newVal =
|
|
407
|
+
const newVal = $n.ymd.toString(val)
|
|
408
408
|
if (newVal) {
|
|
409
409
|
val = newVal
|
|
410
410
|
}
|
|
411
411
|
|
|
412
|
-
if (
|
|
413
|
-
const { y, mm, dd } =
|
|
412
|
+
if ($n.isDate(val)) {
|
|
413
|
+
const { y, mm, dd } = $n.dateObject(val)
|
|
414
414
|
from = `${y}/${mm}/${dd}`
|
|
415
415
|
|
|
416
416
|
// 如果不是日期选择范围, 则返回单个日期
|
|
@@ -420,8 +420,8 @@ export default {
|
|
|
420
420
|
}
|
|
421
421
|
|
|
422
422
|
// 如果是日期选择范围
|
|
423
|
-
if (isRange.value &&
|
|
424
|
-
const { y, mm, dd } =
|
|
423
|
+
if (isRange.value && $n.isDate(props.end)) {
|
|
424
|
+
const { y, mm, dd } = $n.dateObject(props.end)
|
|
425
425
|
to = `${y}/${mm}/${dd}`
|
|
426
426
|
}
|
|
427
427
|
|
|
@@ -441,8 +441,8 @@ export default {
|
|
|
441
441
|
to: '',
|
|
442
442
|
}
|
|
443
443
|
|
|
444
|
-
if (
|
|
445
|
-
const { hh, ii, ss } =
|
|
444
|
+
if ($n.isDate(props.modelValue)) {
|
|
445
|
+
const { hh, ii, ss } = $n.dateObject(props.modelValue)
|
|
446
446
|
obj.from = `${hh}:${ii}`
|
|
447
447
|
if (props.showSecond) {
|
|
448
448
|
obj.from += `:${ss}`
|
|
@@ -455,8 +455,8 @@ export default {
|
|
|
455
455
|
obj.from = props.showSecond ? '00:00:00' : '00:00'
|
|
456
456
|
}
|
|
457
457
|
|
|
458
|
-
if (isRange.value &&
|
|
459
|
-
const { hh, ii, ss } =
|
|
458
|
+
if (isRange.value && $n.isDate(props.end)) {
|
|
459
|
+
const { hh, ii, ss } = $n.dateObject(props.end)
|
|
460
460
|
obj.to = `${hh}:${ii}`
|
|
461
461
|
if (props.showSecond) {
|
|
462
462
|
obj.to += `:${ss}`
|
|
@@ -482,9 +482,9 @@ export default {
|
|
|
482
482
|
// 如果是选择时间
|
|
483
483
|
if (props.type === 'time') {
|
|
484
484
|
if (
|
|
485
|
-
!
|
|
486
|
-
|| !
|
|
487
|
-
|| (props.showSecond && !
|
|
485
|
+
! $n.isValidValue(dateValue.hh)
|
|
486
|
+
|| ! $n.isValidValue(dateValue.ii)
|
|
487
|
+
|| (props.showSecond && ! $n.isValidValue(dateValue.ss))) {
|
|
488
488
|
return ''
|
|
489
489
|
}
|
|
490
490
|
format = 'HH:mm'
|
|
@@ -495,13 +495,13 @@ export default {
|
|
|
495
495
|
|
|
496
496
|
// 否则是选择年月
|
|
497
497
|
} else {
|
|
498
|
-
if (!
|
|
498
|
+
if (! $n.isValidValue(dateValue.y)) {
|
|
499
499
|
return ''
|
|
500
500
|
}
|
|
501
501
|
|
|
502
502
|
const isMonth = props.type === 'month'
|
|
503
503
|
if (isMonth) {
|
|
504
|
-
if (!
|
|
504
|
+
if (! $n.isValidValue(dateValue.mm)) {
|
|
505
505
|
return ''
|
|
506
506
|
}
|
|
507
507
|
|
|
@@ -526,7 +526,7 @@ export default {
|
|
|
526
526
|
return ''
|
|
527
527
|
}
|
|
528
528
|
|
|
529
|
-
if (!
|
|
529
|
+
if (! $n.isRequired(dateValue)) {
|
|
530
530
|
return ''
|
|
531
531
|
}
|
|
532
532
|
|
|
@@ -538,8 +538,8 @@ export default {
|
|
|
538
538
|
} = dateValue
|
|
539
539
|
|
|
540
540
|
if (
|
|
541
|
-
!
|
|
542
|
-
|| !
|
|
541
|
+
! $n.isValidValue(from)
|
|
542
|
+
|| ! $n.isValidValue(to)
|
|
543
543
|
) {
|
|
544
544
|
return ''
|
|
545
545
|
}
|
|
@@ -616,7 +616,7 @@ export default {
|
|
|
616
616
|
function onUpdateDateValue(val) {
|
|
617
617
|
|
|
618
618
|
// 如果为 null, 则清空数据
|
|
619
|
-
if (
|
|
619
|
+
if ($n.isNil(val)) {
|
|
620
620
|
emit('update:modelValue', null)
|
|
621
621
|
if (isRange.value) {
|
|
622
622
|
emit('update:end', null)
|
|
@@ -698,7 +698,7 @@ export default {
|
|
|
698
698
|
* 提交
|
|
699
699
|
*/
|
|
700
700
|
function onEmit(key, value) {
|
|
701
|
-
emit(key,
|
|
701
|
+
emit(key, $n.numberDeep(value))
|
|
702
702
|
}
|
|
703
703
|
|
|
704
704
|
/**
|
|
@@ -712,9 +712,9 @@ export default {
|
|
|
712
712
|
nextTick(function() {
|
|
713
713
|
|
|
714
714
|
// 遍历选择列表
|
|
715
|
-
|
|
715
|
+
$n.forEach(selectLists.value, function(selectItem, selectItemIndex) {
|
|
716
716
|
// 遍历选单个列表
|
|
717
|
-
|
|
717
|
+
$n.forEach(selectItem.lists, function(item, itemIndex) {
|
|
718
718
|
if (dateValue.value[selectItem.type] !== '' && dateValue.value[selectItem.type] == item[0]) {
|
|
719
719
|
scrollRef.value[selectItemIndex].setScrollPosition('vertical', 32 * itemIndex, 0)
|
|
720
720
|
return true
|
|
@@ -287,7 +287,7 @@ export default {
|
|
|
287
287
|
* 插槽标识
|
|
288
288
|
*/
|
|
289
289
|
const slotNames = computed(function() {
|
|
290
|
-
return
|
|
290
|
+
return $n.isValidObject(slots) ? Object.keys(slots) : []
|
|
291
291
|
})
|
|
292
292
|
|
|
293
293
|
/**
|
|
@@ -301,7 +301,7 @@ export default {
|
|
|
301
301
|
* 当前显示字段
|
|
302
302
|
*/
|
|
303
303
|
const currentShowKeys = computed(function() {
|
|
304
|
-
return
|
|
304
|
+
return $n.uniq($n.isValidArray(props.showKeys)
|
|
305
305
|
? props.showKeys
|
|
306
306
|
: [ props.valueKey, currentlabelKey.value ])
|
|
307
307
|
})
|
|
@@ -319,7 +319,7 @@ export default {
|
|
|
319
319
|
const showValue = computed(function () {
|
|
320
320
|
|
|
321
321
|
// 如果有已选数据
|
|
322
|
-
return
|
|
322
|
+
return $n.isValidArray(selected.value)
|
|
323
323
|
// 取已选数据第一条
|
|
324
324
|
? currentFormatLabel(selected.value[0])
|
|
325
325
|
: ''
|
|
@@ -329,9 +329,9 @@ export default {
|
|
|
329
329
|
|
|
330
330
|
|
|
331
331
|
// 创建权限实例
|
|
332
|
-
const $power =
|
|
332
|
+
const $power = $n.$power.create({
|
|
333
333
|
// 路由路径
|
|
334
|
-
path:
|
|
334
|
+
path: $n.isValidString(props.path) ? props.path : false,
|
|
335
335
|
// 路由参数
|
|
336
336
|
query: props.query,
|
|
337
337
|
// 关闭权限页面
|
|
@@ -344,7 +344,7 @@ export default {
|
|
|
344
344
|
} = $power
|
|
345
345
|
|
|
346
346
|
// 创建表格实例
|
|
347
|
-
const $table =
|
|
347
|
+
const $table = $n.$table.create({
|
|
348
348
|
// 权限实例
|
|
349
349
|
$power,
|
|
350
350
|
// 附加请求数据
|
|
@@ -372,7 +372,7 @@ export default {
|
|
|
372
372
|
})
|
|
373
373
|
|
|
374
374
|
// 创建防抖睡眠方法
|
|
375
|
-
const sleep =
|
|
375
|
+
const sleep = $n.debounceSleep()
|
|
376
376
|
|
|
377
377
|
// 输入框节点
|
|
378
378
|
const inputRef = ref(null)
|
|
@@ -502,7 +502,7 @@ export default {
|
|
|
502
502
|
await sleep(props.inputDebounce)
|
|
503
503
|
|
|
504
504
|
// 是否有值
|
|
505
|
-
const hasValue =
|
|
505
|
+
const hasValue = $n.isValidValue(val)
|
|
506
506
|
|
|
507
507
|
const n_search = {}
|
|
508
508
|
n_search[currentFilterKey.value] = [
|
|
@@ -605,14 +605,14 @@ export default {
|
|
|
605
605
|
function currentFormatLabel(item) {
|
|
606
606
|
|
|
607
607
|
// 如果有格式化显示标签方法
|
|
608
|
-
if (
|
|
608
|
+
if ($n.isFunction(props.formatLabel)) {
|
|
609
609
|
// 执行格式化显示标签方法
|
|
610
610
|
return props.formatLabel(item)
|
|
611
611
|
}
|
|
612
612
|
|
|
613
613
|
// 否则显示该值的标签字段
|
|
614
614
|
const val = item[currentlabelKey.value]
|
|
615
|
-
return
|
|
615
|
+
return $n.isValidValue(val) ? val : item[props.valueKey]
|
|
616
616
|
}
|
|
617
617
|
|
|
618
618
|
/**
|
|
@@ -634,13 +634,13 @@ export default {
|
|
|
634
634
|
if (props.valueType === 'objectArray') {
|
|
635
635
|
|
|
636
636
|
// 如果是有效数组
|
|
637
|
-
if (
|
|
637
|
+
if ($n.isValidArray(val)) {
|
|
638
638
|
for (const item of val) {
|
|
639
639
|
if (
|
|
640
640
|
// 如果元素不是有效对象
|
|
641
|
-
!
|
|
641
|
+
! $n.isValidObject(item)
|
|
642
642
|
// 如果元素没有值字段
|
|
643
|
-
|| !
|
|
643
|
+
|| ! $n.has(item, props.valueKey)
|
|
644
644
|
) {
|
|
645
645
|
return []
|
|
646
646
|
}
|
|
@@ -660,11 +660,11 @@ export default {
|
|
|
660
660
|
|| ! routePath
|
|
661
661
|
) {
|
|
662
662
|
// 将值转为数组
|
|
663
|
-
val = props.valueType === 'string' ?
|
|
663
|
+
val = props.valueType === 'string' ? $n.split(val, props.valueSeparator) : val
|
|
664
664
|
|
|
665
665
|
// 如果是有效数组
|
|
666
|
-
if (
|
|
667
|
-
val = val.filter(e =>
|
|
666
|
+
if ($n.isValidArray(val)) {
|
|
667
|
+
val = val.filter(e => $n.isValidValue(e))
|
|
668
668
|
return toSelected ? val.map(e => setSelectedItem(e)) : val
|
|
669
669
|
}
|
|
670
670
|
}
|
|
@@ -705,7 +705,7 @@ export default {
|
|
|
705
705
|
}
|
|
706
706
|
|
|
707
707
|
// 返回转为分隔符隔开的字符串
|
|
708
|
-
return
|
|
708
|
+
return $n.numberDeep($n.join(values, props.valueSeparator))
|
|
709
709
|
}
|
|
710
710
|
|
|
711
711
|
/**
|
|
@@ -714,7 +714,7 @@ export default {
|
|
|
714
714
|
async function onRequestSelected(value) {
|
|
715
715
|
|
|
716
716
|
// 请求数据
|
|
717
|
-
const { status, data } = await
|
|
717
|
+
const { status, data } = await $n.http({
|
|
718
718
|
url: $table.routePath,
|
|
719
719
|
data: Object.assign(
|
|
720
720
|
// 获取表格请求数据
|
|
@@ -743,7 +743,7 @@ export default {
|
|
|
743
743
|
),
|
|
744
744
|
})
|
|
745
745
|
|
|
746
|
-
return status &&
|
|
746
|
+
return status && $n.isValidArray($n.get(data, 'rows')) ? data.rows : []
|
|
747
747
|
}
|
|
748
748
|
|
|
749
749
|
/**
|
|
@@ -754,24 +754,24 @@ export default {
|
|
|
754
754
|
let columns
|
|
755
755
|
|
|
756
756
|
// 如果有声明路由表格列数据
|
|
757
|
-
if (
|
|
758
|
-
columns =
|
|
757
|
+
if ($n.isValidArray(props.columns)) {
|
|
758
|
+
columns = $n.cloneDeep(props.columns)
|
|
759
759
|
|
|
760
760
|
// 如果有路由路径
|
|
761
761
|
} else if (routePath) {
|
|
762
762
|
// 否则如果有路由表格列数据
|
|
763
|
-
const rawTableColumns =
|
|
764
|
-
if (
|
|
765
|
-
columns =
|
|
763
|
+
const rawTableColumns = $n.$table.config(routePath, 'columns')
|
|
764
|
+
if ($n.isValidArray(rawTableColumns)) {
|
|
765
|
+
columns = $n.cloneDeep(rawTableColumns)
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
768
|
|
|
769
|
-
if (
|
|
770
|
-
if (
|
|
769
|
+
if ($n.isValidArray(columns)) {
|
|
770
|
+
if ($n.isValidArray(props.hideSearchKeys)) {
|
|
771
771
|
for (const item of columns) {
|
|
772
772
|
if (
|
|
773
773
|
props.hideSearchKeys.indexOf(item.name) > -1
|
|
774
|
-
&&
|
|
774
|
+
&& $n.has(item, 'search')
|
|
775
775
|
) {
|
|
776
776
|
item.search.hide = true
|
|
777
777
|
}
|
|
@@ -791,21 +791,21 @@ export default {
|
|
|
791
791
|
const columns = []
|
|
792
792
|
|
|
793
793
|
// 如果有原始表格列数据
|
|
794
|
-
if (
|
|
794
|
+
if ($n.isValidArray($table.tableColumns)) {
|
|
795
795
|
|
|
796
796
|
// 克隆原始表格列数据
|
|
797
|
-
const rawTableColumns =
|
|
797
|
+
const rawTableColumns = $n.cloneDeep($table.tableColumns)
|
|
798
798
|
|
|
799
799
|
// 快捷表格显示的属性名称数组
|
|
800
|
-
|
|
800
|
+
$n.forEach(currentShowKeys.value, function (key) {
|
|
801
801
|
for (const item of rawTableColumns) {
|
|
802
802
|
if (item.name === key) {
|
|
803
803
|
// 删除搜索字段
|
|
804
|
-
if (
|
|
804
|
+
if ($n.has(item, 'search')) {
|
|
805
805
|
delete item.search
|
|
806
806
|
}
|
|
807
807
|
// 删除可见字段
|
|
808
|
-
if (
|
|
808
|
+
if ($n.has(item, 'visible')) {
|
|
809
809
|
delete item.visible
|
|
810
810
|
}
|
|
811
811
|
columns.push(item)
|
|
@@ -982,7 +982,7 @@ export default {
|
|
|
982
982
|
opt[props.valueKey] = row[props.valueKey]
|
|
983
983
|
|
|
984
984
|
// 获取当前数据索引
|
|
985
|
-
const itemIndex =
|
|
985
|
+
const itemIndex = $n.findIndex(_selected, opt)
|
|
986
986
|
|
|
987
987
|
// 如果不存在
|
|
988
988
|
if (itemIndex === -1) {
|
|
@@ -1049,7 +1049,7 @@ export default {
|
|
|
1049
1049
|
onUpdated(function () {
|
|
1050
1050
|
if (
|
|
1051
1051
|
popupRef.value
|
|
1052
|
-
&&
|
|
1052
|
+
&& $n.has(popupRef.value, 'currentComponent.ref.updatePosition')
|
|
1053
1053
|
) {
|
|
1054
1054
|
popupRef.value.currentComponent.ref.updatePosition()
|
|
1055
1055
|
}
|
|
@@ -131,7 +131,7 @@ export default {
|
|
|
131
131
|
const slotNames = computed(function() {
|
|
132
132
|
const lists = []
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
$n.forIn(slots, function(val, key) {
|
|
135
135
|
if (key !== 'default') {
|
|
136
136
|
lists.push(key)
|
|
137
137
|
}
|
|
@@ -148,7 +148,7 @@ export default {
|
|
|
148
148
|
function onCopy() {
|
|
149
149
|
const val = props.copyText || props.value
|
|
150
150
|
if (val) {
|
|
151
|
-
|
|
151
|
+
$n.copy(val, `复制【${props.label}】成功`)
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
<div
|
|
107
107
|
class="cursor-pointer full-width"
|
|
108
108
|
:class="{
|
|
109
|
-
'text-primary':
|
|
109
|
+
'text-primary': $n.indexOf(treeTicked, node.id) > -1,
|
|
110
110
|
}"
|
|
111
111
|
@click="onNode($event, node)"
|
|
112
112
|
>{{node.label}}</div>
|
|
@@ -193,7 +193,7 @@ export default {
|
|
|
193
193
|
const showValue = computed(function () {
|
|
194
194
|
|
|
195
195
|
// 如果有已选数据
|
|
196
|
-
return
|
|
196
|
+
return $n.isValidArray(treeTickedNodes.value)
|
|
197
197
|
// 取已选数据第一条的标签
|
|
198
198
|
? treeTickedNodes.value[0].label
|
|
199
199
|
: ''
|
|
@@ -243,10 +243,10 @@ export default {
|
|
|
243
243
|
|
|
244
244
|
const lists = []
|
|
245
245
|
|
|
246
|
-
|
|
246
|
+
$n.forEach(treeTicked.value, function (treeKey) {
|
|
247
247
|
|
|
248
248
|
// 获取树选择的节点
|
|
249
|
-
if (
|
|
249
|
+
if ($n.has(treeAll, treeKey)) {
|
|
250
250
|
lists.push({
|
|
251
251
|
id: treeKey,
|
|
252
252
|
label: treeAll[treeKey][props.showAllLevels ? 'path' : 'label'],
|
|
@@ -290,7 +290,7 @@ export default {
|
|
|
290
290
|
// 如果弹出层是隐藏的
|
|
291
291
|
! showPopup.value
|
|
292
292
|
// 如果输入框有值
|
|
293
|
-
&&
|
|
293
|
+
&& $n.isValidValue(val)
|
|
294
294
|
) {
|
|
295
295
|
// 显示弹出层
|
|
296
296
|
popupRef.value.show()
|
|
@@ -323,13 +323,13 @@ export default {
|
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
// 如果是父节点
|
|
326
|
-
if (
|
|
326
|
+
if ($n.isValidArray(item.children)) {
|
|
327
327
|
getChildren(item.children, item.id, path)
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
if (
|
|
332
|
+
if ($n.isValidArray(props.nodes)) {
|
|
333
333
|
getChildren(props.nodes, 0, '')
|
|
334
334
|
}
|
|
335
335
|
|
|
@@ -347,21 +347,21 @@ export default {
|
|
|
347
347
|
// 如果是单选
|
|
348
348
|
! props.multiple
|
|
349
349
|
// 如果有值
|
|
350
|
-
&&
|
|
350
|
+
&& $n.isRequired(props.modelValue)
|
|
351
351
|
// 存在节点
|
|
352
|
-
&&
|
|
352
|
+
&& $n.has(treeAll, props.modelValue)
|
|
353
353
|
) {
|
|
354
354
|
// 获取父节点
|
|
355
355
|
function getParent({ id, pid, children }) {
|
|
356
356
|
|
|
357
357
|
// 如果是父级节点
|
|
358
|
-
if (
|
|
358
|
+
if ($n.isValidArray(children)) {
|
|
359
359
|
// 设为展开
|
|
360
360
|
expanded.push(id)
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
// 如果有父节点, 则继续向上寻找
|
|
364
|
-
if (pid &&
|
|
364
|
+
if (pid && $n.has(treeAll, pid)) {
|
|
365
365
|
getParent(treeAll[pid])
|
|
366
366
|
}
|
|
367
367
|
}
|
|
@@ -370,7 +370,7 @@ export default {
|
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
if (props.expanded) {
|
|
373
|
-
expanded =
|
|
373
|
+
expanded = $n.uniq($n.concat(expanded, props.expanded))
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
return expanded
|
|
@@ -383,11 +383,11 @@ export default {
|
|
|
383
383
|
|
|
384
384
|
// 如果是多选
|
|
385
385
|
if (props.multiple) {
|
|
386
|
-
return
|
|
386
|
+
return $n.isValidArray(val) ? val : []
|
|
387
387
|
}
|
|
388
388
|
|
|
389
389
|
// 如果为有效值
|
|
390
|
-
if (
|
|
390
|
+
if ($n.isRequired(val)) {
|
|
391
391
|
return [ val ]
|
|
392
392
|
}
|
|
393
393
|
|
|
@@ -412,7 +412,7 @@ export default {
|
|
|
412
412
|
if (props.multiple) {
|
|
413
413
|
|
|
414
414
|
// 如果是父节点
|
|
415
|
-
if (
|
|
415
|
+
if ($n.isValidArray(children)) {
|
|
416
416
|
|
|
417
417
|
// 则无任何操作
|
|
418
418
|
return
|
|
@@ -422,7 +422,7 @@ export default {
|
|
|
422
422
|
const _ticked = [...treeTicked.value]
|
|
423
423
|
|
|
424
424
|
// 获取值在树数据中的索引
|
|
425
|
-
const index =
|
|
425
|
+
const index = $n.indexOf(_ticked, id)
|
|
426
426
|
|
|
427
427
|
// 如果在数据中
|
|
428
428
|
if (index > -1) {
|
|
@@ -443,7 +443,7 @@ export default {
|
|
|
443
443
|
|
|
444
444
|
if (
|
|
445
445
|
// 如果是父节点
|
|
446
|
-
|
|
446
|
+
$n.isValidArray(children)
|
|
447
447
|
// 如果仅可选择叶子节点
|
|
448
448
|
&& ! props.strict
|
|
449
449
|
) {
|
|
@@ -576,7 +576,7 @@ export default {
|
|
|
576
576
|
* 在组件因为响应式状态变更而更新其 DOM 树之后调用
|
|
577
577
|
*/
|
|
578
578
|
onUpdated(function () {
|
|
579
|
-
if (
|
|
579
|
+
if ($n.has(popupRef.value, 'currentComponent.ref.updatePosition')) {
|
|
580
580
|
popupRef.value.currentComponent.ref.updatePosition()
|
|
581
581
|
}
|
|
582
582
|
})
|
|
@@ -151,7 +151,7 @@ export default {
|
|
|
151
151
|
*/
|
|
152
152
|
const slotNames = computed(function() {
|
|
153
153
|
|
|
154
|
-
if (
|
|
154
|
+
if ($n.isValidObject(slots)) {
|
|
155
155
|
|
|
156
156
|
// 忽略插槽
|
|
157
157
|
const ignoreKeys = []
|
|
@@ -167,7 +167,7 @@ export default {
|
|
|
167
167
|
const keys = Object.keys(slots)
|
|
168
168
|
|
|
169
169
|
if (ignoreKeys.length) {
|
|
170
|
-
return
|
|
170
|
+
return $n.filter(keys, e => ignoreKeys.indexOf(e) === -1)
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
return keys
|
|
@@ -71,7 +71,7 @@ export default {
|
|
|
71
71
|
// 如果不是根节点
|
|
72
72
|
attr.pid
|
|
73
73
|
// 有父节点
|
|
74
|
-
&&
|
|
74
|
+
&& $n.has(parentAll, attr.pid)
|
|
75
75
|
) {
|
|
76
76
|
const parentItem = parentAll[attr.pid]
|
|
77
77
|
|
|
@@ -117,7 +117,7 @@ export default {
|
|
|
117
117
|
watch([()=>props.data, ()=>props.activeValue], function() {
|
|
118
118
|
|
|
119
119
|
// 设置激活状态
|
|
120
|
-
if (
|
|
120
|
+
if ($n.isValidArray(props.data)) {
|
|
121
121
|
setActive()
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -48,7 +48,7 @@ export default {
|
|
|
48
48
|
submit,
|
|
49
49
|
// 父级声明属性
|
|
50
50
|
props,
|
|
51
|
-
} =
|
|
51
|
+
} = $n.$dialog.inject()
|
|
52
52
|
|
|
53
53
|
const {
|
|
54
54
|
// 树节点列表
|
|
@@ -121,7 +121,7 @@ export default {
|
|
|
121
121
|
return ref(val.value)
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
if (
|
|
124
|
+
if ($n.isValidArray(val)) {
|
|
125
125
|
return ref(val)
|
|
126
126
|
}
|
|
127
127
|
}
|