@netang/quasar 0.0.52 → 0.0.54
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/_docs/docs/.vuepress/config.js +40 -0
- package/_docs/docs/.vuepress/configs/index.js +2 -0
- package/_docs/docs/.vuepress/configs/navbar/index.js +1 -0
- package/_docs/docs/.vuepress/configs/navbar/zh.js +16 -0
- package/_docs/docs/.vuepress/configs/sidebar/index.js +1 -0
- package/_docs/docs/.vuepress/configs/sidebar/zh.js +20 -0
- package/_docs/docs/.vuepress/public/css/index.css +3 -0
- package/_docs/docs/.vuepress/styles/index.scss +3 -0
- package/_docs/docs/components/field-table.md +55 -0
- package/_docs/docs/components/field-tree.md +1 -0
- package/_docs/docs/index.md +1 -0
- package/_docs/docs/utils/alert.md +1 -0
- package/_docs/docs/utils/confirm.md +1 -0
- package/_docs/package.json +11 -0
- package/components/column-title/index.vue +2 -2
- package/components/data/index.vue +20 -23
- package/components/dialog/index.vue +26 -12
- package/components/dialog-table/index.vue +4 -2
- package/components/dragger/index.vue +3 -2
- package/components/drawer/index.vue +16 -9
- package/components/editor-code/index.vue +12 -5
- package/components/empty/index.vue +16 -1
- package/components/field-date/index.vue +48 -36
- package/components/field-table/index.vue +69 -43
- package/components/field-text/index.vue +6 -2
- package/components/field-tree/index.vue +40 -22
- package/components/input-number/index.vue +5 -4
- package/components/list-menu/index.vue +14 -2
- package/components/power-page/index.vue +10 -0
- package/components/private/components/index.js +7 -2
- package/components/private/components/move-to-tree/index.vue +7 -3
- package/components/private/edit-power-data/index.vue +92 -52
- package/components/private/table-visible-columns-button/index.vue +6 -2
- package/components/render/index.vue +21 -7
- package/components/search/index.vue +30 -2
- package/components/search-item/index.vue +24 -8
- package/components/select/index.vue +5 -2
- package/components/splitter/index.vue +13 -9
- package/components/table/index.vue +32 -5
- package/components/table-pagination/index.vue +0 -1
- package/components/table-splitter/index.vue +22 -3
- package/components/table-summary/index.vue +10 -3
- package/components/thumbnail/index.vue +16 -6
- package/components/toolbar/index.vue +0 -2
- package/components/uploader/index.vue +5 -2
- package/components/uploader-query/index.vue +48 -27
- package/components/value-format/index.vue +19 -12
- package/configs/area3.js +1 -0
- package/docs/404.html +33 -0
- package/docs/assets/404.html-60b35caa.js +1 -0
- package/docs/assets/404.html-d1e63d77.js +1 -0
- package/docs/assets/alert.html-568d4e94.js +1 -0
- package/docs/assets/alert.html-f5dbc3e9.js +1 -0
- package/docs/assets/app-8c3ae4de.js +6 -0
- package/docs/assets/back-to-top-8efcbe56.svg +1 -0
- package/docs/assets/confirm.html-7a1566f6.js +1 -0
- package/docs/assets/confirm.html-96f1b004.js +1 -0
- package/docs/assets/field-table.html-68d610b0.js +1 -0
- package/docs/assets/field-table.html-86cc3511.js +1 -0
- package/docs/assets/field-tree.html-45410c3c.js +1 -0
- package/docs/assets/field-tree.html-c98ac993.js +1 -0
- package/docs/assets/framework-204010b2.js +5 -0
- package/docs/assets/index.html-1695dd7c.js +1 -0
- package/docs/assets/index.html-65a4aa67.js +1 -0
- package/docs/assets/style-ac5a9aa6.css +1 -0
- package/docs/components/field-table.html +33 -0
- package/docs/components/field-tree.html +33 -0
- package/docs/index.html +33 -0
- package/docs/utils/alert.html +33 -0
- package/docs/utils/confirm.html +33 -0
- package/package.json +11 -2
- package/store/index.js +3 -20
- package/utils/alert.js +3 -1
- package/utils/{$area.js → area.js} +27 -14
- package/utils/arr.js +6 -2
- package/utils/auth.js +140 -0
- package/utils/bus.js +1 -1
- package/utils/config.js +42 -15
- package/utils/{confrim.js → confirm.js} +1 -1
- package/utils/copy.js +18 -0
- package/utils/{$dialog.js → dialog.js} +7 -3
- package/utils/dict.js +5 -28
- package/utils/dictOptions.js +24 -0
- package/utils/{$form.js → form.js} +6 -2
- package/utils/getData.js +21 -9
- package/utils/getFile.js +11 -5
- package/utils/getImage.js +23 -12
- package/utils/getTime.js +9 -4
- package/utils/index.js +61 -0
- package/utils/loading.js +3 -1
- package/utils/notify.js +1 -1
- package/utils/{$power.js → power.js} +164 -118
- package/utils/previewImage.js +4 -2
- package/utils/price.js +12 -3
- package/utils/rule.js +13 -0
- package/utils/ruleValid.js +10 -0
- package/utils/{$search.js → search.js} +82 -51
- package/utils/{$table.js → table.js} +119 -87
- package/utils/timestamp.js +2 -2
- package/utils/toast.js +1 -1
- package/utils/{$tree.js → tree.js} +69 -46
- package/utils/uploader/qiniu.js +31 -15
- package/utils/{$uploader.js → uploader.js} +87 -56
- package/utils/useAuth.js +12 -5
- package/utils/useRouter.js +4 -4
- package/utils/useUploader.js +0 -5
- package/utils/$auth.js +0 -135
- package/utils/$rule.js +0 -17
- package/utils/http.js +0 -251
|
@@ -212,7 +212,7 @@
|
|
|
212
212
|
</div>
|
|
213
213
|
|
|
214
214
|
<!-- 请求成功参数 -->
|
|
215
|
-
<!--<div class="col-xs-12 col-sm-6 col-md-3" v-if="$
|
|
215
|
+
<!--<div class="col-xs-12 col-sm-6 col-md-3" v-if="$n_indexOf(['closePush', 'closePushRefresh'], formData.requestSuccess.type) > -1">-->
|
|
216
216
|
|
|
217
217
|
<!-- <!– 树 –>-->
|
|
218
218
|
<!-- <n-field-tree-->
|
|
@@ -259,10 +259,10 @@
|
|
|
259
259
|
|
|
260
260
|
<q-item-section side>
|
|
261
261
|
<div class="text-grey-8 q-gutter-xs">
|
|
262
|
-
<q-btn icon="add" size="12px" flat dense round @click="
|
|
263
|
-
<q-btn icon="remove" size="12px" flat dense round @click="
|
|
264
|
-
<q-btn icon="expand_less" size="12px" flat dense round @click="
|
|
265
|
-
<q-btn icon="expand_more" size="12px" flat dense round @click="
|
|
262
|
+
<q-btn icon="add" size="12px" flat dense round @click="arr.add(formData.requestQuery.list, itemIndex, '')" />
|
|
263
|
+
<q-btn icon="remove" size="12px" flat dense round @click="arr.delete(formData.requestQuery.list, itemIndex)" :disable="itemIndex === 0" />
|
|
264
|
+
<q-btn icon="expand_less" size="12px" flat dense round @click="arr.up(formData.requestQuery.list, itemIndex)" :disable="itemIndex === 0" />
|
|
265
|
+
<q-btn icon="expand_more" size="12px" flat dense round @click="arr.down(formData.requestQuery.list, itemIndex)" :disable="formData.requestQuery.list.length <= itemIndex + 1" />
|
|
266
266
|
</div>
|
|
267
267
|
</q-item-section>
|
|
268
268
|
</q-item>
|
|
@@ -293,10 +293,10 @@
|
|
|
293
293
|
|
|
294
294
|
<q-item-section side>
|
|
295
295
|
<div class="text-grey-8 q-gutter-xs">
|
|
296
|
-
<q-btn icon="add" size="12px" flat dense round @click="
|
|
297
|
-
<q-btn icon="remove" size="12px" flat dense round @click="
|
|
298
|
-
<q-btn icon="expand_less" size="12px" flat dense round @click="
|
|
299
|
-
<q-btn icon="expand_more" size="12px" flat dense round @click="
|
|
296
|
+
<q-btn icon="add" size="12px" flat dense round @click="arr.add(formData.requestQuery.query, itemIndex, '')" />
|
|
297
|
+
<q-btn icon="remove" size="12px" flat dense round @click="arr.delete(formData.requestQuery.query, itemIndex)" :disable="itemIndex === 0" />
|
|
298
|
+
<q-btn icon="expand_less" size="12px" flat dense round @click="arr.up(formData.requestQuery.query, itemIndex)" :disable="itemIndex === 0" />
|
|
299
|
+
<q-btn icon="expand_more" size="12px" flat dense round @click="arr.down(formData.requestQuery.query, itemIndex)" :disable="formData.requestQuery.query.length <= itemIndex + 1" />
|
|
300
300
|
</div>
|
|
301
301
|
</q-item-section>
|
|
302
302
|
</q-item>
|
|
@@ -328,6 +328,35 @@
|
|
|
328
328
|
<script>
|
|
329
329
|
import { ref, watch } from 'vue'
|
|
330
330
|
|
|
331
|
+
import NColumnTitle from '../../column-title'
|
|
332
|
+
import NFieldTree from '../../field-tree'
|
|
333
|
+
|
|
334
|
+
import $n_has from 'lodash/has'
|
|
335
|
+
import $n_isPlainObject from 'lodash/isPlainObject'
|
|
336
|
+
|
|
337
|
+
import $n_forEach from '@netang/utils/forEach'
|
|
338
|
+
import $n_isValidArray from '@netang/utils/isValidArray'
|
|
339
|
+
import $n_indexOf from '@netang/utils/indexOf'
|
|
340
|
+
|
|
341
|
+
import $n_isRequired from '@netang/utils/isRequired'
|
|
342
|
+
import $n_forIn from '@netang/utils/forIn'
|
|
343
|
+
import $n_isValidObject from '@netang/utils/isValidObject'
|
|
344
|
+
import $n_isValidValue from '@netang/utils/isValidValue'
|
|
345
|
+
import $n_trimString from '@netang/utils/trimString'
|
|
346
|
+
import $n_isJson from '@netang/utils/isJson'
|
|
347
|
+
import $n_json from '@netang/utils/json'
|
|
348
|
+
import $n_isValidString from '@netang/utils/isValidString'
|
|
349
|
+
|
|
350
|
+
import $n_arr from '../../../utils/arr'
|
|
351
|
+
import $n_toast from '../../../utils/toast'
|
|
352
|
+
|
|
353
|
+
import { configs } from '../../../utils/config'
|
|
354
|
+
|
|
355
|
+
const {
|
|
356
|
+
// 字典常量
|
|
357
|
+
dicts,
|
|
358
|
+
} = configs
|
|
359
|
+
|
|
331
360
|
export default {
|
|
332
361
|
|
|
333
362
|
/**
|
|
@@ -346,6 +375,14 @@ export default {
|
|
|
346
375
|
treeExpanded: Array,
|
|
347
376
|
},
|
|
348
377
|
|
|
378
|
+
/**
|
|
379
|
+
* 组件
|
|
380
|
+
*/
|
|
381
|
+
components: {
|
|
382
|
+
NColumnTitle,
|
|
383
|
+
NFieldTree,
|
|
384
|
+
},
|
|
385
|
+
|
|
349
386
|
/**
|
|
350
387
|
* 组合式
|
|
351
388
|
*/
|
|
@@ -397,9 +434,9 @@ export default {
|
|
|
397
434
|
|
|
398
435
|
let obj = {}
|
|
399
436
|
|
|
400
|
-
if ($
|
|
401
|
-
const data = $
|
|
402
|
-
if ($
|
|
437
|
+
if ($n_isJson(props.modelValue)) {
|
|
438
|
+
const data = $n_json.parse(props.modelValue)
|
|
439
|
+
if ($n_isValidObject(data)) {
|
|
403
440
|
obj = data
|
|
404
441
|
}
|
|
405
442
|
}
|
|
@@ -447,7 +484,7 @@ export default {
|
|
|
447
484
|
const rawKeys = Object.keys(rawObj)
|
|
448
485
|
|
|
449
486
|
// 删除数据中的无效键值
|
|
450
|
-
$
|
|
487
|
+
$n_forIn(obj, function (item, key) {
|
|
451
488
|
// 如果键值不在原始键值中
|
|
452
489
|
if (rawKeys.indexOf(key) === -1) {
|
|
453
490
|
// 则删除
|
|
@@ -456,12 +493,12 @@ export default {
|
|
|
456
493
|
})
|
|
457
494
|
|
|
458
495
|
// 判断 requestSuccess 值是否合法
|
|
459
|
-
if ($
|
|
496
|
+
if ($n_has(obj, 'requestSuccess') && ! $n_isValidObject(obj.requestSuccess)) {
|
|
460
497
|
delete(obj.requestSuccess)
|
|
461
498
|
}
|
|
462
499
|
|
|
463
500
|
// 判断 requestQuery 值是否合法
|
|
464
|
-
if ($
|
|
501
|
+
if ($n_has(obj, 'requestQuery') && ! $n_isValidObject(obj.requestQuery)) {
|
|
465
502
|
delete(obj.requestQuery)
|
|
466
503
|
}
|
|
467
504
|
|
|
@@ -471,7 +508,7 @@ export default {
|
|
|
471
508
|
obj = Object.assign(rawObj, obj)
|
|
472
509
|
|
|
473
510
|
// 列表选择类型默认值为 single
|
|
474
|
-
if (! $
|
|
511
|
+
if (! $n_isValidString(obj.selection)) {
|
|
475
512
|
obj.selection = 'single'
|
|
476
513
|
}
|
|
477
514
|
|
|
@@ -483,12 +520,12 @@ export default {
|
|
|
483
520
|
obj.confirmContent = ''
|
|
484
521
|
if (obj.confirmPassword) {
|
|
485
522
|
confirm = 2
|
|
486
|
-
if ($
|
|
523
|
+
if ($n_isValidString(obj.confirmPassword)) {
|
|
487
524
|
obj.confirmContent = obj.confirmPassword
|
|
488
525
|
}
|
|
489
526
|
} else if (obj.confirm) {
|
|
490
527
|
confirm = 1
|
|
491
|
-
if ($
|
|
528
|
+
if ($n_isValidString(obj.confirm)) {
|
|
492
529
|
obj.confirmContent = obj.confirm
|
|
493
530
|
}
|
|
494
531
|
}
|
|
@@ -497,36 +534,36 @@ export default {
|
|
|
497
534
|
|
|
498
535
|
// 【格式化请求参数中的 list】
|
|
499
536
|
// ------------------------------------------------------------
|
|
500
|
-
if ($
|
|
537
|
+
if ($n_isValidString(obj.requestQuery.list)) {
|
|
501
538
|
obj.requestQuery.list = [obj.requestQuery.list]
|
|
502
|
-
} else if (! $
|
|
539
|
+
} else if (! $n_isValidArray(obj.requestQuery.list)) {
|
|
503
540
|
obj.requestQuery.list = ['']
|
|
504
541
|
}
|
|
505
542
|
|
|
506
543
|
// 【格式化请求参数中的 query】
|
|
507
544
|
// ------------------------------------------------------------
|
|
508
|
-
if ($
|
|
545
|
+
if ($n_has(obj.requestQuery, 'query')) {
|
|
509
546
|
|
|
510
547
|
// 如果是有效值
|
|
511
|
-
if ($
|
|
548
|
+
if ($n_isValidValue(obj.requestQuery.query)) {
|
|
512
549
|
obj.requestQuery.query = [obj.requestQuery.query]
|
|
513
550
|
|
|
514
551
|
// 如果是有效对象
|
|
515
|
-
} else if ($
|
|
516
|
-
obj.requestQuery.query = [$
|
|
552
|
+
} else if ($n_isValidObject(obj.requestQuery.query)) {
|
|
553
|
+
obj.requestQuery.query = [$n_json.stringify(obj.requestQuery.query)]
|
|
517
554
|
|
|
518
555
|
// 如果是有效数组
|
|
519
|
-
} else if ($
|
|
556
|
+
} else if ($n_isValidArray(obj.requestQuery.query)) {
|
|
520
557
|
const query = []
|
|
521
|
-
$
|
|
558
|
+
$n_forEach(obj.requestQuery.query, function(item) {
|
|
522
559
|
|
|
523
560
|
// 如果是有效值
|
|
524
|
-
if ($
|
|
561
|
+
if ($n_isValidValue(item)) {
|
|
525
562
|
query.push(item)
|
|
526
563
|
|
|
527
564
|
// 如果是对象
|
|
528
|
-
} else if ($
|
|
529
|
-
query.push($
|
|
565
|
+
} else if ($n_isValidObject(item)) {
|
|
566
|
+
query.push($n_json.stringify(item))
|
|
530
567
|
}
|
|
531
568
|
})
|
|
532
569
|
obj.requestQuery.query = query.length ? query : ['']
|
|
@@ -543,15 +580,15 @@ export default {
|
|
|
543
580
|
|
|
544
581
|
// 【格式化其他参数】
|
|
545
582
|
// ------------------------------------------------------------
|
|
546
|
-
if (! $
|
|
583
|
+
if (! $n_has(obj, 'params')) {
|
|
547
584
|
obj.params = ''
|
|
548
585
|
|
|
549
586
|
// 如果不是字符串
|
|
550
|
-
} else if (! $
|
|
551
|
-
if ($
|
|
552
|
-
obj.params = $
|
|
553
|
-
} else if ($
|
|
554
|
-
obj.params = $
|
|
587
|
+
} else if (! $n_isValidString(obj.params)) {
|
|
588
|
+
if ($n_isValidObject(obj.params)) {
|
|
589
|
+
obj.params = $n_json.stringify(obj.params)
|
|
590
|
+
} else if ($n_isValidArray(obj.params)) {
|
|
591
|
+
obj.params = $n_json.stringify(obj.params)
|
|
555
592
|
} else {
|
|
556
593
|
obj.params = ''
|
|
557
594
|
}
|
|
@@ -580,20 +617,20 @@ export default {
|
|
|
580
617
|
// 请求表格参数
|
|
581
618
|
const lists = []
|
|
582
619
|
|
|
583
|
-
$
|
|
620
|
+
$n_forEach(data.requestQuery[field], function(value) {
|
|
584
621
|
|
|
585
622
|
value = formatParams(value)
|
|
586
623
|
|
|
587
624
|
// 如果有值
|
|
588
|
-
if ($
|
|
625
|
+
if ($n_isRequired(value)) {
|
|
589
626
|
|
|
590
627
|
// 如果为表格
|
|
591
628
|
if (field === 'list') {
|
|
592
629
|
|
|
593
|
-
if (Array.isArray(value) || $
|
|
630
|
+
if (Array.isArray(value) || $n_isPlainObject(value)) {
|
|
594
631
|
|
|
595
632
|
// 轻提示
|
|
596
|
-
$
|
|
633
|
+
$n_toast({
|
|
597
634
|
message: '请求列表参数格式不能是数组或对象',
|
|
598
635
|
})
|
|
599
636
|
return false
|
|
@@ -602,7 +639,7 @@ export default {
|
|
|
602
639
|
// 否则为参数
|
|
603
640
|
} else if (Array.isArray(value)) {
|
|
604
641
|
// 轻提示
|
|
605
|
-
$
|
|
642
|
+
$n_toast({
|
|
606
643
|
message: '请求传参参数格式不能是数组',
|
|
607
644
|
})
|
|
608
645
|
return false
|
|
@@ -614,7 +651,7 @@ export default {
|
|
|
614
651
|
})
|
|
615
652
|
|
|
616
653
|
if (lists.length) {
|
|
617
|
-
if (! $
|
|
654
|
+
if (! $n_has(obj, 'requestQuery')) {
|
|
618
655
|
obj.requestQuery = {}
|
|
619
656
|
}
|
|
620
657
|
obj.requestQuery[field] = lists.length === 1 ? lists[0] : lists
|
|
@@ -625,14 +662,14 @@ export default {
|
|
|
625
662
|
|
|
626
663
|
// 格式化其他参数
|
|
627
664
|
function formatParams(value) {
|
|
628
|
-
value = $
|
|
665
|
+
value = $n_trimString(value)
|
|
629
666
|
if (
|
|
630
667
|
(value.startsWith('[') || value.startsWith('{'))
|
|
631
|
-
&& $
|
|
668
|
+
&& $n_isJson(value)
|
|
632
669
|
) {
|
|
633
|
-
value = $
|
|
670
|
+
value = $n_json.parse(value)
|
|
634
671
|
|
|
635
|
-
if (! Array.isArray(value) && ! $
|
|
672
|
+
if (! Array.isArray(value) && ! $n_isPlainObject(value)) {
|
|
636
673
|
return ''
|
|
637
674
|
}
|
|
638
675
|
}
|
|
@@ -644,7 +681,7 @@ export default {
|
|
|
644
681
|
if (props.dataType === dicts.POWER_DATA_TYPE__LIST) {
|
|
645
682
|
|
|
646
683
|
// 列表选择类型
|
|
647
|
-
if ($
|
|
684
|
+
if ($n_indexOf(['none', 'multiple'], data.selection) > -1) {
|
|
648
685
|
obj.selection = data.selection
|
|
649
686
|
}
|
|
650
687
|
|
|
@@ -688,7 +725,7 @@ export default {
|
|
|
688
725
|
// 如果没有选择跳转页面
|
|
689
726
|
if (! data.toPage) {
|
|
690
727
|
// 轻提示
|
|
691
|
-
$
|
|
728
|
+
$n_toast({
|
|
692
729
|
message: '请选择跳转页面',
|
|
693
730
|
})
|
|
694
731
|
return false
|
|
@@ -711,11 +748,11 @@ export default {
|
|
|
711
748
|
|
|
712
749
|
// 如果是(1:提交前确认)
|
|
713
750
|
if (data.confirm === 1) {
|
|
714
|
-
obj.confirm = $
|
|
751
|
+
obj.confirm = $n_isValidString(data.confirmContent) ? data.confirmContent : true
|
|
715
752
|
|
|
716
753
|
// 否则是(2:提交前确认登录密码)
|
|
717
754
|
} else {
|
|
718
|
-
obj.confirmPassword = $
|
|
755
|
+
obj.confirmPassword = $n_isValidString(data.confirmContent) ? data.confirmContent : true
|
|
719
756
|
}
|
|
720
757
|
}
|
|
721
758
|
|
|
@@ -724,7 +761,7 @@ export default {
|
|
|
724
761
|
obj.requestSuccess = {
|
|
725
762
|
type: data.requestSuccess.type
|
|
726
763
|
}
|
|
727
|
-
// if ($
|
|
764
|
+
// if ($n_indexOf(['closePush', 'closePushRefresh'], data.requestSuccess.type) > -1) {
|
|
728
765
|
// if (data.requestSuccess.params) {
|
|
729
766
|
// obj.requestSuccess.params = data.requestSuccess.params
|
|
730
767
|
// } else {
|
|
@@ -737,13 +774,13 @@ export default {
|
|
|
737
774
|
|
|
738
775
|
// 自定义参数
|
|
739
776
|
const params = formatParams(data.params)
|
|
740
|
-
if ($
|
|
777
|
+
if ($n_isRequired(params)) {
|
|
741
778
|
obj.params = params
|
|
742
779
|
}
|
|
743
780
|
}
|
|
744
781
|
|
|
745
782
|
// 转为 json
|
|
746
|
-
return $
|
|
783
|
+
return $n_isValidObject(obj) ? $n_json.stringify(obj) : ''
|
|
747
784
|
}
|
|
748
785
|
|
|
749
786
|
// ==========【返回】=============================================================================================
|
|
@@ -754,6 +791,9 @@ export default {
|
|
|
754
791
|
|
|
755
792
|
// 获取格式化后的表单数据
|
|
756
793
|
getValue,
|
|
794
|
+
|
|
795
|
+
dicts,
|
|
796
|
+
arr: $n_arr,
|
|
757
797
|
}
|
|
758
798
|
}
|
|
759
799
|
}
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
<q-icon
|
|
43
43
|
size="xs"
|
|
44
44
|
name="check"
|
|
45
|
-
v-show="
|
|
45
|
+
v-show="indexOf(tableVisibleColumns, item.name) > -1"
|
|
46
46
|
/>
|
|
47
47
|
</q-item-section>
|
|
48
48
|
</q-item>
|
|
@@ -54,6 +54,8 @@
|
|
|
54
54
|
<script>
|
|
55
55
|
import { inject } from 'vue'
|
|
56
56
|
|
|
57
|
+
import $n_indexOf from '@netang/utils/indexOf'
|
|
58
|
+
|
|
57
59
|
import { NTableKey } from '../../../utils/symbols'
|
|
58
60
|
|
|
59
61
|
export default {
|
|
@@ -79,7 +81,7 @@ export default {
|
|
|
79
81
|
* 表格可见列点击
|
|
80
82
|
*/
|
|
81
83
|
function onTableVisible(item) {
|
|
82
|
-
const index = $
|
|
84
|
+
const index = $n_indexOf(tableVisibleColumns.value, item.name)
|
|
83
85
|
if (index > -1) {
|
|
84
86
|
tableVisibleColumns.value.splice(index, 1)
|
|
85
87
|
} else {
|
|
@@ -99,6 +101,8 @@ export default {
|
|
|
99
101
|
|
|
100
102
|
// 表格可见列点击
|
|
101
103
|
onTableVisible,
|
|
104
|
+
|
|
105
|
+
indexOf: $n_indexOf,
|
|
102
106
|
}
|
|
103
107
|
},
|
|
104
108
|
}
|
|
@@ -22,11 +22,25 @@
|
|
|
22
22
|
|
|
23
23
|
<script>
|
|
24
24
|
import { computed, defineAsyncComponent, provide } from 'vue'
|
|
25
|
+
import $n_router from '@netang/vue-utils/router'
|
|
26
|
+
|
|
27
|
+
import $n_has from 'lodash/has'
|
|
28
|
+
import $n_get from 'lodash/get'
|
|
29
|
+
import $n_isFunction from 'lodash/isFunction'
|
|
30
|
+
|
|
31
|
+
import $n_isValidObject from '@netang/utils/isValidObject'
|
|
32
|
+
import $n_isValidString from '@netang/utils/isValidString'
|
|
33
|
+
import $n_slash from '@netang/utils/slash'
|
|
25
34
|
|
|
26
|
-
import routers from '@/router/routers'
|
|
27
35
|
import components from '../private/components'
|
|
28
36
|
|
|
29
37
|
import { NRenderKey } from '../../utils/symbols'
|
|
38
|
+
import { configs } from '../../utils/config'
|
|
39
|
+
|
|
40
|
+
const {
|
|
41
|
+
// 自定义路由
|
|
42
|
+
routers,
|
|
43
|
+
} = configs
|
|
30
44
|
|
|
31
45
|
export default {
|
|
32
46
|
|
|
@@ -67,10 +81,10 @@ export default {
|
|
|
67
81
|
// 如果是路由路径
|
|
68
82
|
if (props.path) {
|
|
69
83
|
// 获取路由组件
|
|
70
|
-
comp = $
|
|
84
|
+
comp = $n_get(routers, `${$n_slash(props.path, 'start', false)}.component`)
|
|
71
85
|
|
|
72
86
|
// 如果有组件标识
|
|
73
|
-
} else if (props.name && $
|
|
87
|
+
} else if (props.name && $n_has(components, props.name)) {
|
|
74
88
|
// 获取自定义组件
|
|
75
89
|
comp = components[props.name]
|
|
76
90
|
}
|
|
@@ -81,7 +95,7 @@ export default {
|
|
|
81
95
|
}
|
|
82
96
|
|
|
83
97
|
// 如果是方法, 则说明是异步组件
|
|
84
|
-
if ($
|
|
98
|
+
if ($n_isFunction(comp)) {
|
|
85
99
|
return defineAsyncComponent(comp)
|
|
86
100
|
}
|
|
87
101
|
|
|
@@ -96,16 +110,16 @@ export default {
|
|
|
96
110
|
// 组件标识
|
|
97
111
|
name: props.name,
|
|
98
112
|
// 参数
|
|
99
|
-
query: $
|
|
113
|
+
query: $n_isValidObject(props.query) ? props.query : {},
|
|
100
114
|
// 组件传参
|
|
101
115
|
props: props.props,
|
|
102
116
|
}
|
|
103
117
|
|
|
104
118
|
// 如果有路由路径
|
|
105
|
-
if ($
|
|
119
|
+
if ($n_isValidString(props.path)) {
|
|
106
120
|
|
|
107
121
|
// 获取页面路由
|
|
108
|
-
const $route = $
|
|
122
|
+
const $route = $n_router.resolve({
|
|
109
123
|
path: props.path,
|
|
110
124
|
query: data.query,
|
|
111
125
|
})
|
|
@@ -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="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">
|
|
@@ -163,12 +163,38 @@
|
|
|
163
163
|
</template>
|
|
164
164
|
|
|
165
165
|
<script>
|
|
166
|
+
import NSearchItem from '../search-item'
|
|
167
|
+
import NFieldDate from '../field-date'
|
|
168
|
+
import NInputNumber from '../input-number'
|
|
169
|
+
import NFieldTree from '../field-tree'
|
|
170
|
+
import NFieldTable from '../field-table'
|
|
171
|
+
|
|
172
|
+
import $n_isValidArray from '@netang/utils/isValidArray'
|
|
173
|
+
|
|
174
|
+
import { configs } from '../../utils/config'
|
|
175
|
+
|
|
176
|
+
const {
|
|
177
|
+
priceCentToYuan,
|
|
178
|
+
} = configs
|
|
179
|
+
|
|
166
180
|
export default {
|
|
167
181
|
|
|
168
182
|
/**
|
|
169
183
|
* 标识
|
|
170
184
|
*/
|
|
171
185
|
name: 'NSearch',
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 组件
|
|
189
|
+
*/
|
|
190
|
+
components: {
|
|
191
|
+
NSearchItem,
|
|
192
|
+
NFieldDate,
|
|
193
|
+
NInputNumber,
|
|
194
|
+
NFieldTree,
|
|
195
|
+
NFieldTable,
|
|
196
|
+
},
|
|
197
|
+
|
|
172
198
|
/**
|
|
173
199
|
* 声明属性
|
|
174
200
|
*/
|
|
@@ -189,7 +215,9 @@ export default {
|
|
|
189
215
|
setup() {
|
|
190
216
|
return {
|
|
191
217
|
// 如果金额为分
|
|
192
|
-
centToYuan:
|
|
218
|
+
centToYuan: priceCentToYuan,
|
|
219
|
+
|
|
220
|
+
isValidArray: $n_isValidArray,
|
|
193
221
|
}
|
|
194
222
|
}
|
|
195
223
|
}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<slot
|
|
32
32
|
:label="data.label"
|
|
33
33
|
:index="0"
|
|
34
|
-
:multiple="
|
|
34
|
+
:multiple="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 && indexOf([dicts.SEARCH_TYPE__GT, dicts.SEARCH_TYPE__GTE], modelValue[0].compare) > -1"
|
|
43
43
|
>
|
|
44
44
|
<!-- 比较类型2 -->
|
|
45
45
|
<q-select
|
|
@@ -66,6 +66,18 @@
|
|
|
66
66
|
<script>
|
|
67
67
|
import { watch } from 'vue'
|
|
68
68
|
|
|
69
|
+
import $n_cloneDeep from 'lodash/cloneDeep'
|
|
70
|
+
|
|
71
|
+
import $n_split from '@netang/utils/split'
|
|
72
|
+
import $n_indexOf from '@netang/utils/indexOf'
|
|
73
|
+
|
|
74
|
+
import { configs } from '../../utils/config'
|
|
75
|
+
|
|
76
|
+
const {
|
|
77
|
+
// 字典常量
|
|
78
|
+
dicts,
|
|
79
|
+
} = configs
|
|
80
|
+
|
|
69
81
|
export default {
|
|
70
82
|
|
|
71
83
|
/**
|
|
@@ -102,11 +114,11 @@ export default {
|
|
|
102
114
|
*/
|
|
103
115
|
watch(()=>props.modelValue[0].compare, function(val) {
|
|
104
116
|
// 如果类型不为 in / not in, 为单选
|
|
105
|
-
if ($
|
|
106
|
-
const arr = $
|
|
117
|
+
if ($n_indexOf([dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN], val) === -1) {
|
|
118
|
+
const arr = $n_split(props.modelValue[0].value, ',')
|
|
107
119
|
if (arr.length !== 1) {
|
|
108
120
|
// 克隆值
|
|
109
|
-
const _modelValue = $
|
|
121
|
+
const _modelValue = $n_cloneDeep(props.modelValue)
|
|
110
122
|
|
|
111
123
|
// 更新值
|
|
112
124
|
_modelValue[0].value = arr.length > 1 ? arr[0] : ''
|
|
@@ -114,14 +126,18 @@ export default {
|
|
|
114
126
|
}
|
|
115
127
|
}
|
|
116
128
|
})
|
|
129
|
+
|
|
130
|
+
// ==========【返回】=============================================================================================
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
dicts,
|
|
134
|
+
indexOf: $n_indexOf,
|
|
135
|
+
}
|
|
117
136
|
},
|
|
118
137
|
}
|
|
119
138
|
</script>
|
|
120
139
|
|
|
121
|
-
|
|
122
140
|
<style lang="scss">
|
|
123
|
-
@import "@/assets/sass/var.scss";
|
|
124
|
-
|
|
125
141
|
.n-search__item {
|
|
126
142
|
.n-field-group {
|
|
127
143
|
> .q-field--outlined {
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
<script>
|
|
37
37
|
import { ref, computed, watch } from 'vue'
|
|
38
38
|
|
|
39
|
+
import $n_isValidObject from '@netang/utils/isValidObject'
|
|
40
|
+
import $n_collection from '@netang/utils/collection'
|
|
41
|
+
|
|
39
42
|
export default {
|
|
40
43
|
|
|
41
44
|
/**
|
|
@@ -84,7 +87,7 @@ export default {
|
|
|
84
87
|
* 插槽标识
|
|
85
88
|
*/
|
|
86
89
|
const slotNames = computed(function() {
|
|
87
|
-
return $
|
|
90
|
+
return $n_isValidObject(slots) ? Object.keys(slots) : []
|
|
88
91
|
})
|
|
89
92
|
|
|
90
93
|
// ==========【当前值】===========================================================================================
|
|
@@ -130,7 +133,7 @@ export default {
|
|
|
130
133
|
// 选项还原为初始值
|
|
131
134
|
rawOptions
|
|
132
135
|
// 否则筛选选项
|
|
133
|
-
: $
|
|
136
|
+
: $n_collection(rawOptions)
|
|
134
137
|
.where(props.optionLabel, 'like', value)
|
|
135
138
|
.toArray()
|
|
136
139
|
})
|