@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
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
</div>
|
|
185
185
|
|
|
186
186
|
<!-- 请求成功参数 -->
|
|
187
|
-
<!--<div class="col-xs-12 col-sm-6 col-md-3" v-if="
|
|
187
|
+
<!--<div class="col-xs-12 col-sm-6 col-md-3" v-if="$n.indexOf(['closePush', 'closePushRefresh'], formData.requestSuccess.type) > -1">-->
|
|
188
188
|
|
|
189
189
|
<!-- <!– 树 –>-->
|
|
190
190
|
<!-- <n-field-tree-->
|
|
@@ -230,10 +230,10 @@
|
|
|
230
230
|
|
|
231
231
|
<q-item-section side>
|
|
232
232
|
<div class="text-grey-8 q-gutter-xs">
|
|
233
|
-
<q-btn icon="add" size="12px" flat dense round @click="
|
|
234
|
-
<q-btn icon="remove" size="12px" flat dense round @click="
|
|
235
|
-
<q-btn icon="expand_less" size="12px" flat dense round @click="
|
|
236
|
-
<q-btn icon="expand_more" size="12px" flat dense round @click="
|
|
233
|
+
<q-btn icon="add" size="12px" flat dense round @click="$n.arr.add(formData.requestQuery.table, itemIndex, '')" />
|
|
234
|
+
<q-btn icon="remove" size="12px" flat dense round @click="$n.arr.delete(formData.requestQuery.table, itemIndex)" :disable="itemIndex === 0" />
|
|
235
|
+
<q-btn icon="expand_less" size="12px" flat dense round @click="$n.arr.up(formData.requestQuery.table, itemIndex)" :disable="itemIndex === 0" />
|
|
236
|
+
<q-btn icon="expand_more" size="12px" flat dense round @click="$n.arr.down(formData.requestQuery.table, itemIndex)" :disable="formData.requestQuery.table.length <= itemIndex + 1" />
|
|
237
237
|
</div>
|
|
238
238
|
</q-item-section>
|
|
239
239
|
</q-item>
|
|
@@ -264,10 +264,10 @@
|
|
|
264
264
|
|
|
265
265
|
<q-item-section side>
|
|
266
266
|
<div class="text-grey-8 q-gutter-xs">
|
|
267
|
-
<q-btn icon="add" size="12px" flat dense round @click="
|
|
268
|
-
<q-btn icon="remove" size="12px" flat dense round @click="
|
|
269
|
-
<q-btn icon="expand_less" size="12px" flat dense round @click="
|
|
270
|
-
<q-btn icon="expand_more" size="12px" flat dense round @click="
|
|
267
|
+
<q-btn icon="add" size="12px" flat dense round @click="$n.arr.add(formData.requestQuery.query, itemIndex, '')" />
|
|
268
|
+
<q-btn icon="remove" size="12px" flat dense round @click="$n.arr.delete(formData.requestQuery.query, itemIndex)" :disable="itemIndex === 0" />
|
|
269
|
+
<q-btn icon="expand_less" size="12px" flat dense round @click="$n.arr.up(formData.requestQuery.query, itemIndex)" :disable="itemIndex === 0" />
|
|
270
|
+
<q-btn icon="expand_more" size="12px" flat dense round @click="$n.arr.down(formData.requestQuery.query, itemIndex)" :disable="formData.requestQuery.query.length <= itemIndex + 1" />
|
|
271
271
|
</div>
|
|
272
272
|
</q-item-section>
|
|
273
273
|
</q-item>
|
|
@@ -367,9 +367,9 @@ export default {
|
|
|
367
367
|
|
|
368
368
|
let obj = {}
|
|
369
369
|
|
|
370
|
-
if (
|
|
371
|
-
const data =
|
|
372
|
-
if (
|
|
370
|
+
if ($n.isJson(props.modelValue)) {
|
|
371
|
+
const data = $n.json.parse(props.modelValue)
|
|
372
|
+
if ($n.isValidObject(data)) {
|
|
373
373
|
obj = data
|
|
374
374
|
}
|
|
375
375
|
}
|
|
@@ -415,7 +415,7 @@ export default {
|
|
|
415
415
|
const rawKeys = Object.keys(rawObj)
|
|
416
416
|
|
|
417
417
|
// 删除数据中的无效键值
|
|
418
|
-
|
|
418
|
+
$n.forIn(obj, function (item, key) {
|
|
419
419
|
// 如果键值不在原始键值中
|
|
420
420
|
if (rawKeys.indexOf(key) === -1) {
|
|
421
421
|
// 则删除
|
|
@@ -424,12 +424,12 @@ export default {
|
|
|
424
424
|
})
|
|
425
425
|
|
|
426
426
|
// 判断 requestSuccess 值是否合法
|
|
427
|
-
if (
|
|
427
|
+
if ($n.has(obj, 'requestSuccess') && ! $n.isValidObject(obj.requestSuccess)) {
|
|
428
428
|
delete(obj.requestSuccess)
|
|
429
429
|
}
|
|
430
430
|
|
|
431
431
|
// 判断 requestQuery 值是否合法
|
|
432
|
-
if (
|
|
432
|
+
if ($n.has(obj, 'requestQuery') && ! $n.isValidObject(obj.requestQuery)) {
|
|
433
433
|
delete(obj.requestQuery)
|
|
434
434
|
}
|
|
435
435
|
|
|
@@ -446,12 +446,12 @@ export default {
|
|
|
446
446
|
obj.confirmContent = ''
|
|
447
447
|
if (obj.confirmPassword) {
|
|
448
448
|
confirm = 2
|
|
449
|
-
if (
|
|
449
|
+
if ($n.isValidString(obj.confirmPassword)) {
|
|
450
450
|
obj.confirmContent = obj.confirmPassword
|
|
451
451
|
}
|
|
452
452
|
} else if (obj.confirm) {
|
|
453
453
|
confirm = 1
|
|
454
|
-
if (
|
|
454
|
+
if ($n.isValidString(obj.confirm)) {
|
|
455
455
|
obj.confirmContent = obj.confirm
|
|
456
456
|
}
|
|
457
457
|
}
|
|
@@ -460,36 +460,36 @@ export default {
|
|
|
460
460
|
|
|
461
461
|
// 【格式化请求参数中的 table】
|
|
462
462
|
// ------------------------------------------------------------
|
|
463
|
-
if (
|
|
463
|
+
if ($n.isValidString(obj.requestQuery.table)) {
|
|
464
464
|
obj.requestQuery.table = [obj.requestQuery.table]
|
|
465
|
-
} else if (!
|
|
465
|
+
} else if (! $n.isValidArray(obj.requestQuery.table)) {
|
|
466
466
|
obj.requestQuery.table = ['']
|
|
467
467
|
}
|
|
468
468
|
|
|
469
469
|
// 【格式化请求参数中的 query】
|
|
470
470
|
// ------------------------------------------------------------
|
|
471
|
-
if (
|
|
471
|
+
if ($n.has(obj.requestQuery, 'query')) {
|
|
472
472
|
|
|
473
473
|
// 如果是有效值
|
|
474
|
-
if (
|
|
474
|
+
if ($n.isValidValue(obj.requestQuery.query)) {
|
|
475
475
|
obj.requestQuery.query = [obj.requestQuery.query]
|
|
476
476
|
|
|
477
477
|
// 如果是有效对象
|
|
478
|
-
} else if (
|
|
479
|
-
obj.requestQuery.query = [
|
|
478
|
+
} else if ($n.isValidObject(obj.requestQuery.query)) {
|
|
479
|
+
obj.requestQuery.query = [$n.json.stringify(obj.requestQuery.query)]
|
|
480
480
|
|
|
481
481
|
// 如果是有效数组
|
|
482
|
-
} else if (
|
|
482
|
+
} else if ($n.isValidArray(obj.requestQuery.query)) {
|
|
483
483
|
const query = []
|
|
484
|
-
|
|
484
|
+
$n.forEach(obj.requestQuery.query, function(item, key) {
|
|
485
485
|
|
|
486
486
|
// 如果是有效值
|
|
487
|
-
if (
|
|
487
|
+
if ($n.isValidValue(item)) {
|
|
488
488
|
query.push(item)
|
|
489
489
|
|
|
490
490
|
// 如果是对象
|
|
491
|
-
} else if (
|
|
492
|
-
query.push(
|
|
491
|
+
} else if ($n.isValidObject(item)) {
|
|
492
|
+
query.push($n.json.stringify(item))
|
|
493
493
|
}
|
|
494
494
|
})
|
|
495
495
|
obj.requestQuery.query = query.length ? query : ['']
|
|
@@ -506,15 +506,15 @@ export default {
|
|
|
506
506
|
|
|
507
507
|
// 【格式化其他参数】
|
|
508
508
|
// ------------------------------------------------------------
|
|
509
|
-
if (!
|
|
509
|
+
if (! $n.has(obj, 'params')) {
|
|
510
510
|
obj.params = ''
|
|
511
511
|
|
|
512
512
|
// 如果不是字符串
|
|
513
|
-
} else if (!
|
|
514
|
-
if (
|
|
515
|
-
obj.params =
|
|
516
|
-
} else if (
|
|
517
|
-
obj.params =
|
|
513
|
+
} else if (! $n.isValidString(obj.params)) {
|
|
514
|
+
if ($n.isValidObject(obj.params)) {
|
|
515
|
+
obj.params = $n.json.stringify(obj.params)
|
|
516
|
+
} else if ($n.isValidArray(obj.params)) {
|
|
517
|
+
obj.params = $n.json.stringify(obj.params)
|
|
518
518
|
} else {
|
|
519
519
|
obj.params = ''
|
|
520
520
|
}
|
|
@@ -543,20 +543,20 @@ export default {
|
|
|
543
543
|
// 请求表格参数
|
|
544
544
|
const lists = []
|
|
545
545
|
|
|
546
|
-
|
|
546
|
+
$n.forEach(data.requestQuery[field], function(value) {
|
|
547
547
|
|
|
548
548
|
value = formatParams(value)
|
|
549
549
|
|
|
550
550
|
// 如果有值
|
|
551
|
-
if (
|
|
551
|
+
if ($n.isRequired(value)) {
|
|
552
552
|
|
|
553
553
|
// 如果为表格
|
|
554
554
|
if (field === 'table') {
|
|
555
555
|
|
|
556
|
-
if (Array.isArray(value) ||
|
|
556
|
+
if (Array.isArray(value) || $n.isPlainObject(value)) {
|
|
557
557
|
|
|
558
558
|
// 轻提示
|
|
559
|
-
|
|
559
|
+
$n.toast({
|
|
560
560
|
message: '请求列表参数格式不能是数组或对象',
|
|
561
561
|
})
|
|
562
562
|
return false
|
|
@@ -565,7 +565,7 @@ export default {
|
|
|
565
565
|
// 否则为参数
|
|
566
566
|
} else if (Array.isArray(value)) {
|
|
567
567
|
// 轻提示
|
|
568
|
-
|
|
568
|
+
$n.toast({
|
|
569
569
|
message: '请求传参参数格式不能是数组',
|
|
570
570
|
})
|
|
571
571
|
return false
|
|
@@ -577,7 +577,7 @@ export default {
|
|
|
577
577
|
})
|
|
578
578
|
|
|
579
579
|
if (lists.length) {
|
|
580
|
-
if (!
|
|
580
|
+
if (! $n.has(obj, 'requestQuery')) {
|
|
581
581
|
obj.requestQuery = {}
|
|
582
582
|
}
|
|
583
583
|
obj.requestQuery[field] = lists.length === 1 ? lists[0] : lists
|
|
@@ -588,14 +588,14 @@ export default {
|
|
|
588
588
|
|
|
589
589
|
// 格式化其他参数
|
|
590
590
|
function formatParams(value) {
|
|
591
|
-
value =
|
|
591
|
+
value = $n.trimString(value)
|
|
592
592
|
if (
|
|
593
593
|
(value.startsWith('[') || value.startsWith('{'))
|
|
594
|
-
&&
|
|
594
|
+
&& $n.isJson(value)
|
|
595
595
|
) {
|
|
596
|
-
value =
|
|
596
|
+
value = $n.json.parse(value)
|
|
597
597
|
|
|
598
|
-
if (! Array.isArray(value) && !
|
|
598
|
+
if (! Array.isArray(value) && ! $n.isPlainObject(value)) {
|
|
599
599
|
return ''
|
|
600
600
|
}
|
|
601
601
|
}
|
|
@@ -641,7 +641,7 @@ export default {
|
|
|
641
641
|
// 如果没有选择跳转页面
|
|
642
642
|
if (! data.toPage) {
|
|
643
643
|
// 轻提示
|
|
644
|
-
|
|
644
|
+
$n.toast({
|
|
645
645
|
message: '请选择跳转页面',
|
|
646
646
|
})
|
|
647
647
|
return false
|
|
@@ -664,11 +664,11 @@ export default {
|
|
|
664
664
|
|
|
665
665
|
// 如果是(1:提交前确认)
|
|
666
666
|
if (data.confirm === 1) {
|
|
667
|
-
obj.confirm =
|
|
667
|
+
obj.confirm = $n.isValidString(data.confirmContent) ? data.confirmContent : true
|
|
668
668
|
|
|
669
669
|
// 否则是(2:提交前确认登录密码)
|
|
670
670
|
} else {
|
|
671
|
-
obj.confirmPassword =
|
|
671
|
+
obj.confirmPassword = $n.isValidString(data.confirmContent) ? data.confirmContent : true
|
|
672
672
|
}
|
|
673
673
|
}
|
|
674
674
|
|
|
@@ -677,7 +677,7 @@ export default {
|
|
|
677
677
|
obj.requestSuccess = {
|
|
678
678
|
type: data.requestSuccess.type
|
|
679
679
|
}
|
|
680
|
-
// if (
|
|
680
|
+
// if ($n.indexOf(['closePush', 'closePushRefresh'], data.requestSuccess.type) > -1) {
|
|
681
681
|
// if (data.requestSuccess.params) {
|
|
682
682
|
// obj.requestSuccess.params = data.requestSuccess.params
|
|
683
683
|
// } else {
|
|
@@ -689,13 +689,13 @@ export default {
|
|
|
689
689
|
|
|
690
690
|
// 自定义参数
|
|
691
691
|
const params = formatParams(data.params)
|
|
692
|
-
if (
|
|
692
|
+
if ($n.isRequired(params)) {
|
|
693
693
|
obj.params = params
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
696
|
|
|
697
697
|
// 转为 json
|
|
698
|
-
return
|
|
698
|
+
return $n.isValidObject(obj) ? $n.json.stringify(obj) : ''
|
|
699
699
|
}
|
|
700
700
|
|
|
701
701
|
// ==========【返回】=============================================================================================
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
<q-icon
|
|
43
43
|
size="xs"
|
|
44
44
|
name="check"
|
|
45
|
-
v-show="
|
|
45
|
+
v-show="$n.indexOf(tableVisibleColumns, item.name) > -1"
|
|
46
46
|
/>
|
|
47
47
|
</q-item-section>
|
|
48
48
|
</q-item>
|
|
@@ -79,7 +79,7 @@ export default {
|
|
|
79
79
|
* 表格可见列点击
|
|
80
80
|
*/
|
|
81
81
|
function onTableVisible(item) {
|
|
82
|
-
const index =
|
|
82
|
+
const index = $n.indexOf(tableVisibleColumns.value, item.name)
|
|
83
83
|
if (index > -1) {
|
|
84
84
|
tableVisibleColumns.value.splice(index, 1)
|
|
85
85
|
} else {
|
|
@@ -67,10 +67,10 @@ export default {
|
|
|
67
67
|
// 如果是路由路径
|
|
68
68
|
if (props.path) {
|
|
69
69
|
// 获取路由组件
|
|
70
|
-
comp =
|
|
70
|
+
comp = $n.get(routers, `${$n.slash(props.path, 'start', false)}.component`)
|
|
71
71
|
|
|
72
72
|
// 如果有组件标识
|
|
73
|
-
} else if (props.name &&
|
|
73
|
+
} else if (props.name && $n.has(components, props.name)) {
|
|
74
74
|
// 获取自定义组件
|
|
75
75
|
comp = components[props.name]
|
|
76
76
|
}
|
|
@@ -81,7 +81,7 @@ export default {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// 如果是方法, 则说明是异步组件
|
|
84
|
-
if (
|
|
84
|
+
if ($n.isFunction(comp)) {
|
|
85
85
|
return defineAsyncComponent(comp)
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -96,16 +96,16 @@ export default {
|
|
|
96
96
|
// 组件标识
|
|
97
97
|
name: props.name,
|
|
98
98
|
// 参数
|
|
99
|
-
query:
|
|
99
|
+
query: $n.isValidObject(props.query) ? props.query : {},
|
|
100
100
|
// 组件传参
|
|
101
101
|
props: props.props,
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// 如果有路由路径
|
|
105
|
-
if (
|
|
105
|
+
if ($n.isValidString(props.path)) {
|
|
106
106
|
|
|
107
107
|
// 获取页面路由
|
|
108
|
-
const $route =
|
|
108
|
+
const $route = $n.router.resolve({
|
|
109
109
|
path: props.path,
|
|
110
110
|
query: data.query,
|
|
111
111
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="flex column absolute-full" v-if="
|
|
2
|
+
<div class="flex column absolute-full" v-if="$n.isValidArray(options)">
|
|
3
3
|
<q-scroll-area class="n-flex-1">
|
|
4
4
|
|
|
5
5
|
<div class="n-search q-pa-sm q-pt-sm q-gutter-sm">
|
|
@@ -189,7 +189,7 @@ export default {
|
|
|
189
189
|
setup() {
|
|
190
190
|
return {
|
|
191
191
|
// 如果金额为分
|
|
192
|
-
centToYuan:
|
|
192
|
+
centToYuan: $n.config('priceCent') === true,
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<slot
|
|
32
32
|
:label="data.label"
|
|
33
33
|
:index="0"
|
|
34
|
-
:multiple="
|
|
34
|
+
:multiple="$n.indexOf([dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN], modelValue[0].compare) > -1"
|
|
35
35
|
v-else
|
|
36
36
|
/>
|
|
37
37
|
</div>
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
<!-- 比较2(类型为 > / >=) -->
|
|
40
40
|
<div
|
|
41
41
|
class="n-field-group row"
|
|
42
|
-
v-if="data.compareOptions2.length &&
|
|
42
|
+
v-if="data.compareOptions2.length && $n.indexOf([dicts.SEARCH_TYPE__GT, dicts.SEARCH_TYPE__GTE], modelValue[0].compare) > -1"
|
|
43
43
|
>
|
|
44
44
|
<!-- 比较类型2 -->
|
|
45
45
|
<q-select
|
|
@@ -102,11 +102,11 @@ export default {
|
|
|
102
102
|
*/
|
|
103
103
|
watch(()=>props.modelValue[0].compare, function(val) {
|
|
104
104
|
// 如果类型不为 in / not in, 为单选
|
|
105
|
-
if (
|
|
106
|
-
const arr =
|
|
105
|
+
if ($n.indexOf([dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN], val) === -1) {
|
|
106
|
+
const arr = $n.split(props.modelValue[0].value, ',')
|
|
107
107
|
if (arr.length !== 1) {
|
|
108
108
|
// 克隆值
|
|
109
|
-
const _modelValue =
|
|
109
|
+
const _modelValue = $n.cloneDeep(props.modelValue)
|
|
110
110
|
|
|
111
111
|
// 更新值
|
|
112
112
|
_modelValue[0].value = arr.length > 1 ? arr[0] : ''
|
|
@@ -84,7 +84,7 @@ export default {
|
|
|
84
84
|
* 插槽标识
|
|
85
85
|
*/
|
|
86
86
|
const slotNames = computed(function() {
|
|
87
|
-
return
|
|
87
|
+
return $n.isValidObject(slots) ? Object.keys(slots) : []
|
|
88
88
|
})
|
|
89
89
|
|
|
90
90
|
// ==========【当前值】===========================================================================================
|
|
@@ -130,7 +130,7 @@ export default {
|
|
|
130
130
|
// 选项还原为初始值
|
|
131
131
|
rawOptions
|
|
132
132
|
// 否则筛选选项
|
|
133
|
-
:
|
|
133
|
+
: $n.collection(rawOptions)
|
|
134
134
|
.where(props.optionLabel, 'like', value)
|
|
135
135
|
.toArray()
|
|
136
136
|
})
|
|
@@ -104,10 +104,10 @@ export default {
|
|
|
104
104
|
if (props.cache) {
|
|
105
105
|
|
|
106
106
|
// 设置缓存名
|
|
107
|
-
cacheName = `splitter:${props.cache === true ? ($power && $power.routePath ? $power.routePath :
|
|
107
|
+
cacheName = `splitter:${props.cache === true ? ($power && $power.routePath ? $power.routePath : $n.router.getRoute('path')) : props.cache}:`
|
|
108
108
|
|
|
109
109
|
// 从缓存获取初始值
|
|
110
|
-
let cache =
|
|
110
|
+
let cache = $n.storage.get(cacheName + 'modelValue')
|
|
111
111
|
if (cache !== null) {
|
|
112
112
|
rawValue = cache
|
|
113
113
|
}
|
|
@@ -119,7 +119,7 @@ export default {
|
|
|
119
119
|
|
|
120
120
|
} else {
|
|
121
121
|
// 从缓存获取初始值
|
|
122
|
-
cache =
|
|
122
|
+
cache = $n.storage.get(cacheName + 'before')
|
|
123
123
|
if (cache !== null) {
|
|
124
124
|
rawBefore = cache
|
|
125
125
|
}
|
|
@@ -132,7 +132,7 @@ export default {
|
|
|
132
132
|
|
|
133
133
|
} else {
|
|
134
134
|
// 从缓存获取初始值
|
|
135
|
-
cache =
|
|
135
|
+
cache = $n.storage.get(cacheName + 'after')
|
|
136
136
|
if (cache !== null) {
|
|
137
137
|
rawAfter = cache
|
|
138
138
|
}
|
|
@@ -155,7 +155,7 @@ export default {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
// 创建防抖睡眠方法
|
|
158
|
-
const sleep =
|
|
158
|
+
const sleep = $n.debounceSleep()
|
|
159
159
|
|
|
160
160
|
// 当前值
|
|
161
161
|
const currentValue = ref(rawValue)
|
|
@@ -184,7 +184,7 @@ export default {
|
|
|
184
184
|
|
|
185
185
|
const keys = []
|
|
186
186
|
|
|
187
|
-
if (
|
|
187
|
+
if ($n.isValidObject(slots)) {
|
|
188
188
|
|
|
189
189
|
for (const key in slots) {
|
|
190
190
|
if (key === 'before') {
|
|
@@ -243,7 +243,7 @@ export default {
|
|
|
243
243
|
await sleep(500, key)
|
|
244
244
|
|
|
245
245
|
// 设置缓存(永久缓存)
|
|
246
|
-
|
|
246
|
+
$n.storage.set(cacheName + key, val, 0)
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
|
|
@@ -308,7 +308,7 @@ export default {
|
|
|
308
308
|
let rightDrawer = false
|
|
309
309
|
|
|
310
310
|
// 如果有插槽
|
|
311
|
-
if (
|
|
311
|
+
if ($n.isValidObject(slots)) {
|
|
312
312
|
for (const key in slots) {
|
|
313
313
|
if (key.startsWith('toolbar-')) {
|
|
314
314
|
toolbar.push(key.replace('toolbar-', ''))
|
|
@@ -336,13 +336,13 @@ export default {
|
|
|
336
336
|
// ==========【监听数据】=========================================================================================
|
|
337
337
|
|
|
338
338
|
// 如果有树节点点击方法
|
|
339
|
-
if (
|
|
339
|
+
if ($n.isFunction(props.treeNodeClick)) {
|
|
340
340
|
|
|
341
341
|
/**
|
|
342
342
|
* 树节点 all
|
|
343
343
|
*/
|
|
344
344
|
const treeNodesAll = computed(function () {
|
|
345
|
-
return
|
|
345
|
+
return $n.collection(props.treeNodes)
|
|
346
346
|
.keyBy(props.treeNodeKey)
|
|
347
347
|
.toObject()
|
|
348
348
|
})
|
|
@@ -356,7 +356,7 @@ export default {
|
|
|
356
356
|
watch(treeSelected, function(nodeKey) {
|
|
357
357
|
|
|
358
358
|
// 如果节点值不是有效值
|
|
359
|
-
if (!
|
|
359
|
+
if (! $n.isValidValue(nodeKey)) {
|
|
360
360
|
|
|
361
361
|
// 则无任何操作
|
|
362
362
|
return
|
|
@@ -365,7 +365,7 @@ export default {
|
|
|
365
365
|
// 树节点点击
|
|
366
366
|
const res = props.treeNodeClick(nodeKey, treeNodesAll.value[nodeKey])
|
|
367
367
|
|
|
368
|
-
if (
|
|
368
|
+
if ($n.isValidObject(res)) {
|
|
369
369
|
|
|
370
370
|
// 设置表格传参
|
|
371
371
|
$table.setQuery(res)
|
|
@@ -167,7 +167,7 @@ export default {
|
|
|
167
167
|
* 插槽标识
|
|
168
168
|
*/
|
|
169
169
|
const slotNames = computed(function() {
|
|
170
|
-
return
|
|
170
|
+
return $n.isValidObject(slots) ? Object.keys(slots).filter(e => e !== 'toolbar-right') : []
|
|
171
171
|
})
|
|
172
172
|
|
|
173
173
|
/**
|
|
@@ -185,10 +185,10 @@ export default {
|
|
|
185
185
|
// 如果有已选数据
|
|
186
186
|
if (
|
|
187
187
|
currentSelectedItem.value
|
|
188
|
-
&&
|
|
188
|
+
&& $n.isFunction(props.renderQuery)
|
|
189
189
|
) {
|
|
190
190
|
const resQuery = props.renderQuery(currentSelectedItem.value)
|
|
191
|
-
if (
|
|
191
|
+
if ($n.isValidObject(resQuery)) {
|
|
192
192
|
|
|
193
193
|
// 如果需要加载渲染页面标识参数
|
|
194
194
|
if (! props.noRendPageName) {
|
|
@@ -308,7 +308,7 @@ export default {
|
|
|
308
308
|
if (showAfter && $table.tableSelected.value.length > 1) {
|
|
309
309
|
|
|
310
310
|
// 如果有多条已选数据, 则只取第一条数据
|
|
311
|
-
$table.tableSelected.value = [ $table.tableSelected.value[
|
|
311
|
+
$table.tableSelected.value = [ $table.tableSelected.value[$table.tableSelected.value.length - 1] ]
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
}
|
|
@@ -63,7 +63,7 @@ export default {
|
|
|
63
63
|
})
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
$n.forEach($n.get(props.props, 'cols'), function(item) {
|
|
67
67
|
|
|
68
68
|
const {
|
|
69
69
|
// 标识
|
|
@@ -79,9 +79,9 @@ export default {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// 如果有统计字段
|
|
82
|
-
if (
|
|
82
|
+
if ($n.has(props.data, name)) {
|
|
83
83
|
// 判断是否是价格
|
|
84
|
-
res.value =
|
|
84
|
+
res.value = $n.has(item, 'price') ? $n.price(props.data[name]) : props.data[name]
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
lists.push(res)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<q-img
|
|
3
3
|
:src="currentSrc"
|
|
4
|
-
:spinner-size="
|
|
5
|
-
:width="
|
|
6
|
-
:height="
|
|
4
|
+
:spinner-size="$n.px(size / 2)"
|
|
5
|
+
:width="$n.px(size)"
|
|
6
|
+
:height="$n.px(size)"
|
|
7
7
|
fit="fill"
|
|
8
8
|
v-if="currentSrc"
|
|
9
9
|
>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<div
|
|
12
12
|
class="absolute-full transparent cursor-pointer"
|
|
13
13
|
@click.prevent.stop="onPreview"
|
|
14
|
-
@dblclick.prevent.stop="
|
|
14
|
+
@dblclick.prevent.stop="$n.noop"
|
|
15
15
|
v-if="preview"
|
|
16
16
|
></div>
|
|
17
17
|
</q-img>
|
|
@@ -60,7 +60,7 @@ export default {
|
|
|
60
60
|
* 当前图片地址
|
|
61
61
|
*/
|
|
62
62
|
const currentSrc = computed(function () {
|
|
63
|
-
const res =
|
|
63
|
+
const res = $n.getImage(props.src, { w: $q.platform.is.mobile ? props.size * 2 : props.size })
|
|
64
64
|
if (res) {
|
|
65
65
|
return res
|
|
66
66
|
}
|
|
@@ -73,7 +73,7 @@ export default {
|
|
|
73
73
|
*/
|
|
74
74
|
function onPreview() {
|
|
75
75
|
// 预览图片
|
|
76
|
-
|
|
76
|
+
$n.previewImage(props.src)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
return {
|