@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.
Files changed (109) hide show
  1. package/_docs/docs/.vuepress/config.js +40 -0
  2. package/_docs/docs/.vuepress/configs/index.js +2 -0
  3. package/_docs/docs/.vuepress/configs/navbar/index.js +1 -0
  4. package/_docs/docs/.vuepress/configs/navbar/zh.js +16 -0
  5. package/_docs/docs/.vuepress/configs/sidebar/index.js +1 -0
  6. package/_docs/docs/.vuepress/configs/sidebar/zh.js +20 -0
  7. package/_docs/docs/.vuepress/public/css/index.css +3 -0
  8. package/_docs/docs/.vuepress/styles/index.scss +3 -0
  9. package/_docs/docs/components/field-table.md +55 -0
  10. package/_docs/docs/components/field-tree.md +1 -0
  11. package/_docs/docs/index.md +1 -0
  12. package/_docs/docs/utils/alert.md +1 -0
  13. package/_docs/docs/utils/confirm.md +1 -0
  14. package/_docs/package.json +11 -0
  15. package/components/column-title/index.vue +2 -2
  16. package/components/data/index.vue +20 -23
  17. package/components/dialog/index.vue +26 -12
  18. package/components/dialog-table/index.vue +4 -2
  19. package/components/dragger/index.vue +3 -2
  20. package/components/drawer/index.vue +16 -9
  21. package/components/editor-code/index.vue +12 -5
  22. package/components/empty/index.vue +16 -1
  23. package/components/field-date/index.vue +48 -36
  24. package/components/field-table/index.vue +69 -43
  25. package/components/field-text/index.vue +6 -2
  26. package/components/field-tree/index.vue +40 -22
  27. package/components/input-number/index.vue +5 -4
  28. package/components/list-menu/index.vue +14 -2
  29. package/components/power-page/index.vue +10 -0
  30. package/components/private/components/index.js +7 -2
  31. package/components/private/components/move-to-tree/index.vue +7 -3
  32. package/components/private/edit-power-data/index.vue +92 -52
  33. package/components/private/table-visible-columns-button/index.vue +6 -2
  34. package/components/render/index.vue +21 -7
  35. package/components/search/index.vue +30 -2
  36. package/components/search-item/index.vue +24 -8
  37. package/components/select/index.vue +5 -2
  38. package/components/splitter/index.vue +13 -9
  39. package/components/table/index.vue +32 -5
  40. package/components/table-pagination/index.vue +0 -1
  41. package/components/table-splitter/index.vue +22 -3
  42. package/components/table-summary/index.vue +10 -3
  43. package/components/thumbnail/index.vue +16 -6
  44. package/components/toolbar/index.vue +0 -2
  45. package/components/uploader/index.vue +5 -2
  46. package/components/uploader-query/index.vue +48 -27
  47. package/components/value-format/index.vue +19 -12
  48. package/configs/area3.js +1 -0
  49. package/docs/404.html +33 -0
  50. package/docs/assets/404.html-60b35caa.js +1 -0
  51. package/docs/assets/404.html-d1e63d77.js +1 -0
  52. package/docs/assets/alert.html-568d4e94.js +1 -0
  53. package/docs/assets/alert.html-f5dbc3e9.js +1 -0
  54. package/docs/assets/app-8c3ae4de.js +6 -0
  55. package/docs/assets/back-to-top-8efcbe56.svg +1 -0
  56. package/docs/assets/confirm.html-7a1566f6.js +1 -0
  57. package/docs/assets/confirm.html-96f1b004.js +1 -0
  58. package/docs/assets/field-table.html-68d610b0.js +1 -0
  59. package/docs/assets/field-table.html-86cc3511.js +1 -0
  60. package/docs/assets/field-tree.html-45410c3c.js +1 -0
  61. package/docs/assets/field-tree.html-c98ac993.js +1 -0
  62. package/docs/assets/framework-204010b2.js +5 -0
  63. package/docs/assets/index.html-1695dd7c.js +1 -0
  64. package/docs/assets/index.html-65a4aa67.js +1 -0
  65. package/docs/assets/style-ac5a9aa6.css +1 -0
  66. package/docs/components/field-table.html +33 -0
  67. package/docs/components/field-tree.html +33 -0
  68. package/docs/index.html +33 -0
  69. package/docs/utils/alert.html +33 -0
  70. package/docs/utils/confirm.html +33 -0
  71. package/package.json +11 -2
  72. package/store/index.js +3 -20
  73. package/utils/alert.js +3 -1
  74. package/utils/{$area.js → area.js} +27 -14
  75. package/utils/arr.js +6 -2
  76. package/utils/auth.js +140 -0
  77. package/utils/bus.js +1 -1
  78. package/utils/config.js +42 -15
  79. package/utils/{confrim.js → confirm.js} +1 -1
  80. package/utils/copy.js +18 -0
  81. package/utils/{$dialog.js → dialog.js} +7 -3
  82. package/utils/dict.js +5 -28
  83. package/utils/dictOptions.js +24 -0
  84. package/utils/{$form.js → form.js} +6 -2
  85. package/utils/getData.js +21 -9
  86. package/utils/getFile.js +11 -5
  87. package/utils/getImage.js +23 -12
  88. package/utils/getTime.js +9 -4
  89. package/utils/index.js +61 -0
  90. package/utils/loading.js +3 -1
  91. package/utils/notify.js +1 -1
  92. package/utils/{$power.js → power.js} +164 -118
  93. package/utils/previewImage.js +4 -2
  94. package/utils/price.js +12 -3
  95. package/utils/rule.js +13 -0
  96. package/utils/ruleValid.js +10 -0
  97. package/utils/{$search.js → search.js} +82 -51
  98. package/utils/{$table.js → table.js} +119 -87
  99. package/utils/timestamp.js +2 -2
  100. package/utils/toast.js +1 -1
  101. package/utils/{$tree.js → tree.js} +69 -46
  102. package/utils/uploader/qiniu.js +31 -15
  103. package/utils/{$uploader.js → uploader.js} +87 -56
  104. package/utils/useAuth.js +12 -5
  105. package/utils/useRouter.js +4 -4
  106. package/utils/useUploader.js +0 -5
  107. package/utils/$auth.js +0 -135
  108. package/utils/$rule.js +0 -17
  109. 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="$n.indexOf(['closePush', 'closePushRefresh'], formData.requestSuccess.type) > -1">-->
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
  <!-- &lt;!&ndash; 树 &ndash;&gt;-->
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="$n.arr.add(formData.requestQuery.list, itemIndex, '')" />
263
- <q-btn icon="remove" size="12px" flat dense round @click="$n.arr.delete(formData.requestQuery.list, itemIndex)" :disable="itemIndex === 0" />
264
- <q-btn icon="expand_less" size="12px" flat dense round @click="$n.arr.up(formData.requestQuery.list, itemIndex)" :disable="itemIndex === 0" />
265
- <q-btn icon="expand_more" size="12px" flat dense round @click="$n.arr.down(formData.requestQuery.list, itemIndex)" :disable="formData.requestQuery.list.length <= itemIndex + 1" />
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="$n.arr.add(formData.requestQuery.query, itemIndex, '')" />
297
- <q-btn icon="remove" size="12px" flat dense round @click="$n.arr.delete(formData.requestQuery.query, itemIndex)" :disable="itemIndex === 0" />
298
- <q-btn icon="expand_less" size="12px" flat dense round @click="$n.arr.up(formData.requestQuery.query, itemIndex)" :disable="itemIndex === 0" />
299
- <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" />
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 ($n.isJson(props.modelValue)) {
401
- const data = $n.json.parse(props.modelValue)
402
- if ($n.isValidObject(data)) {
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
- $n.forIn(obj, function (item, key) {
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 ($n.has(obj, 'requestSuccess') && ! $n.isValidObject(obj.requestSuccess)) {
496
+ if ($n_has(obj, 'requestSuccess') && ! $n_isValidObject(obj.requestSuccess)) {
460
497
  delete(obj.requestSuccess)
461
498
  }
462
499
 
463
500
  // 判断 requestQuery 值是否合法
464
- if ($n.has(obj, 'requestQuery') && ! $n.isValidObject(obj.requestQuery)) {
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 (! $n.isValidString(obj.selection)) {
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 ($n.isValidString(obj.confirmPassword)) {
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 ($n.isValidString(obj.confirm)) {
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 ($n.isValidString(obj.requestQuery.list)) {
537
+ if ($n_isValidString(obj.requestQuery.list)) {
501
538
  obj.requestQuery.list = [obj.requestQuery.list]
502
- } else if (! $n.isValidArray(obj.requestQuery.list)) {
539
+ } else if (! $n_isValidArray(obj.requestQuery.list)) {
503
540
  obj.requestQuery.list = ['']
504
541
  }
505
542
 
506
543
  // 【格式化请求参数中的 query】
507
544
  // ------------------------------------------------------------
508
- if ($n.has(obj.requestQuery, 'query')) {
545
+ if ($n_has(obj.requestQuery, 'query')) {
509
546
 
510
547
  // 如果是有效值
511
- if ($n.isValidValue(obj.requestQuery.query)) {
548
+ if ($n_isValidValue(obj.requestQuery.query)) {
512
549
  obj.requestQuery.query = [obj.requestQuery.query]
513
550
 
514
551
  // 如果是有效对象
515
- } else if ($n.isValidObject(obj.requestQuery.query)) {
516
- obj.requestQuery.query = [$n.json.stringify(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 ($n.isValidArray(obj.requestQuery.query)) {
556
+ } else if ($n_isValidArray(obj.requestQuery.query)) {
520
557
  const query = []
521
- $n.forEach(obj.requestQuery.query, function(item, key) {
558
+ $n_forEach(obj.requestQuery.query, function(item) {
522
559
 
523
560
  // 如果是有效值
524
- if ($n.isValidValue(item)) {
561
+ if ($n_isValidValue(item)) {
525
562
  query.push(item)
526
563
 
527
564
  // 如果是对象
528
- } else if ($n.isValidObject(item)) {
529
- query.push($n.json.stringify(item))
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 (! $n.has(obj, 'params')) {
583
+ if (! $n_has(obj, 'params')) {
547
584
  obj.params = ''
548
585
 
549
586
  // 如果不是字符串
550
- } else if (! $n.isValidString(obj.params)) {
551
- if ($n.isValidObject(obj.params)) {
552
- obj.params = $n.json.stringify(obj.params)
553
- } else if ($n.isValidArray(obj.params)) {
554
- obj.params = $n.json.stringify(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
- $n.forEach(data.requestQuery[field], function(value) {
620
+ $n_forEach(data.requestQuery[field], function(value) {
584
621
 
585
622
  value = formatParams(value)
586
623
 
587
624
  // 如果有值
588
- if ($n.isRequired(value)) {
625
+ if ($n_isRequired(value)) {
589
626
 
590
627
  // 如果为表格
591
628
  if (field === 'list') {
592
629
 
593
- if (Array.isArray(value) || $n.isPlainObject(value)) {
630
+ if (Array.isArray(value) || $n_isPlainObject(value)) {
594
631
 
595
632
  // 轻提示
596
- $n.toast({
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
- $n.toast({
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 (! $n.has(obj, 'requestQuery')) {
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 = $n.trimString(value)
665
+ value = $n_trimString(value)
629
666
  if (
630
667
  (value.startsWith('[') || value.startsWith('{'))
631
- && $n.isJson(value)
668
+ && $n_isJson(value)
632
669
  ) {
633
- value = $n.json.parse(value)
670
+ value = $n_json.parse(value)
634
671
 
635
- if (! Array.isArray(value) && ! $n.isPlainObject(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 ($n.indexOf(['none', 'multiple'], data.selection) > -1) {
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
- $n.toast({
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 = $n.isValidString(data.confirmContent) ? data.confirmContent : true
751
+ obj.confirm = $n_isValidString(data.confirmContent) ? data.confirmContent : true
715
752
 
716
753
  // 否则是(2:提交前确认登录密码)
717
754
  } else {
718
- obj.confirmPassword = $n.isValidString(data.confirmContent) ? data.confirmContent : true
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 ($n.indexOf(['closePush', 'closePushRefresh'], data.requestSuccess.type) > -1) {
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 ($n.isRequired(params)) {
777
+ if ($n_isRequired(params)) {
741
778
  obj.params = params
742
779
  }
743
780
  }
744
781
 
745
782
  // 转为 json
746
- return $n.isValidObject(obj) ? $n.json.stringify(obj) : ''
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="$n.indexOf(tableVisibleColumns, item.name) > -1"
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 = $n.indexOf(tableVisibleColumns.value, item.name)
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 = $n.get(routers, `${$n.slash(props.path, 'start', false)}.component`)
84
+ comp = $n_get(routers, `${$n_slash(props.path, 'start', false)}.component`)
71
85
 
72
86
  // 如果有组件标识
73
- } else if (props.name && $n.has(components, 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 ($n.isFunction(comp)) {
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: $n.isValidObject(props.query) ? props.query : {},
113
+ query: $n_isValidObject(props.query) ? props.query : {},
100
114
  // 组件传参
101
115
  props: props.props,
102
116
  }
103
117
 
104
118
  // 如果有路由路径
105
- if ($n.isValidString(props.path)) {
119
+ if ($n_isValidString(props.path)) {
106
120
 
107
121
  // 获取页面路由
108
- const $route = $n.router.resolve({
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="$n.isValidArray(options)">
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: $n.config('priceCent') === true,
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="$n.indexOf([dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN], modelValue[0].compare) > -1"
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 && $n.indexOf([dicts.SEARCH_TYPE__GT, dicts.SEARCH_TYPE__GTE], modelValue[0].compare) > -1"
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 ($n.indexOf([dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN], val) === -1) {
106
- const arr = $n.split(props.modelValue[0].value, ',')
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 = $n.cloneDeep(props.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 $n.isValidObject(slots) ? Object.keys(slots) : []
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
- : $n.collection(rawOptions)
136
+ : $n_collection(rawOptions)
134
137
  .where(props.optionLabel, 'like', value)
135
138
  .toArray()
136
139
  })