@netang/quasar 0.2.26 → 0.2.28

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.
@@ -143,7 +143,7 @@ export default {
143
143
  // 加载 script
144
144
  script([
145
145
  [
146
- `${protocol}cdn.staticfile.org/monaco-editor/${version}/min/vs/loader.js`,
146
+ `${protocol}cdn.bootcdn.net/ajax/libs/monaco-editor/${version}/min/vs/loader.js`,
147
147
  `${protocol}fastly.jsdelivr.net/npm/monaco-editor@${version}/min/vs/loader.js`,
148
148
  `${protocol}unpkg.com/monaco-editor@${version}/min/vs/loader.js`,
149
149
  ]
@@ -314,15 +314,24 @@ export default {
314
314
  /**
315
315
  * 监听声明值
316
316
  */
317
- watch([()=>props.modelValue, ()=>props.end, ()=>props.type], function() {
318
- dateValue.value = formatDateValue()
319
- Object.assign(timeValue, formatTimeValue())
320
-
321
- showValue.value = updateValue(dateValue.value, timeValue, false)
317
+ watch([()=>props.modelValue, ()=>props.end], function() {
318
+ watchValue(false)
319
+ })
320
+ watch(()=>props.type, function() {
321
+ watchValue(true)
322
322
  })
323
323
 
324
324
  // ==========【方法】=============================================================================================
325
325
 
326
+ /**
327
+ * 监听值
328
+ */
329
+ function watchValue(isEmit) {
330
+ dateValue.value = formatDateValue()
331
+ Object.assign(timeValue, formatTimeValue())
332
+ showValue.value = updateValue(dateValue.value, timeValue, isEmit)
333
+ }
334
+
326
335
  /**
327
336
  * 格式化日期值
328
337
  */
@@ -764,9 +773,9 @@ export default {
764
773
  * 清空
765
774
  */
766
775
  function onClear() {
767
- emit('update:modelValue', null)
776
+ emit('update:modelValue', '')
768
777
  if (isRange.value) {
769
- emit('update:end', null)
778
+ emit('update:end', '')
770
779
  }
771
780
  popupRef.value.hide()
772
781
  }
@@ -559,7 +559,7 @@ export default {
559
559
 
560
560
  // 触发更新值
561
561
  // 清空树数据
562
- emitModelValue(props.multiple ? [] : null)
562
+ emitModelValue(props.multiple ? [] : '')
563
563
 
564
564
  // 隐藏弹出层
565
565
  popupRef.value.hide()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netang/quasar",
3
- "version": "0.2.26",
3
+ "version": "0.2.28",
4
4
 
5
5
  "description": "netang-quasar",
6
6
  "scripts": {
@@ -449,33 +449,96 @@ export function formatValue(rawSearchOptions, searchValue) {
449
449
  // 否则为数字
450
450
  } else {
451
451
 
452
- if (
453
- // 如果是日期
454
- type === 'date'
455
- // 如果类型为快捷日期
456
- && value1.compare >= 20
457
- ) {
458
- const res = getQuickRange(value1.compare - 20, true)
459
- if (res) {
452
+ // 如果是日期
453
+ if (type === 'date') {
454
+
455
+ // 如果 为 == || !=
456
+ const isEqual = value1.compare === dicts.SEARCH_COMPARE_TYPE__EQUAL
457
+ if (isEqual || value1.compare === dicts.SEARCH_COMPARE_TYPE__NOT_EQUAL) {
458
+ const { value, dateType } = value1
459
+ if ($n_isRequired(value)) {
460
+
461
+ // 当前时间
462
+ const now = $n_toDate(value)
463
+
464
+ let end
465
+ switch (dateType) {
466
+ // 年
467
+ case 'year':
468
+ // 月
469
+ case 'month':
470
+ // 日
471
+ case 'day':
472
+ end = quasarDate.endOfDate(now, dateType)
473
+ break
474
+ // 分
475
+ case 'datetime':
476
+ end = $n_toDate(quasarDate.formatDate(now, 'YYYY/MM/DD HH:mm:59'))
477
+ break
478
+ }
460
479
 
461
- lists.push(
462
- // 日期起
463
- {
464
- field: name,
480
+ let compare1
481
+ let compare2
482
+
483
+ // 如果为 ==
484
+ if (isEqual) {
465
485
  // ≥
466
- compare: dicts.SEARCH_COMPARE_TYPE__GTE,
467
- value: $n_numberDeep(quasarDate.formatDate($n_toDate(`${res.date.from} ${res.time.from}`), 'X')),
468
- },
469
- // 日期止
470
- {
471
- field: name,
486
+ compare1 = dicts.SEARCH_COMPARE_TYPE__GTE
472
487
  // ≤
473
- compare: dicts.SEARCH_COMPARE_TYPE__LTE,
474
- value: $n_numberDeep(quasarDate.formatDate($n_toDate(`${res.date.to} ${res.time.to}`), 'X')),
488
+ compare2 = dicts.SEARCH_COMPARE_TYPE__LTE
489
+
490
+ // 否则为 !=
491
+ } else {
492
+ // <
493
+ compare1 = dicts.SEARCH_COMPARE_TYPE__LT
494
+ // >
495
+ compare2 = dicts.SEARCH_COMPARE_TYPE__GT
475
496
  }
476
- )
497
+
498
+ lists.push(
499
+ // 日期起
500
+ {
501
+ field: name,
502
+ // ≥
503
+ compare: compare1,
504
+ value,
505
+ },
506
+ // 日期止
507
+ {
508
+ field: name,
509
+ // ≤
510
+ compare: compare2,
511
+ value: $n_numberDeep(quasarDate.formatDate(end, 'X')),
512
+ }
513
+ )
514
+ }
515
+ return
516
+
517
+ // 如果类型为快捷日期
518
+ } else if (value1.compare >= 20) {
519
+
520
+ const res = getQuickRange(value1.compare - 20, true)
521
+ if (res) {
522
+
523
+ lists.push(
524
+ // 日期起
525
+ {
526
+ field: name,
527
+ // ≥
528
+ compare: dicts.SEARCH_COMPARE_TYPE__GTE,
529
+ value: $n_numberDeep(quasarDate.formatDate($n_toDate(`${res.date.from} ${res.time.from}`), 'X')),
530
+ },
531
+ // 日期止
532
+ {
533
+ field: name,
534
+ // ≤
535
+ compare: dicts.SEARCH_COMPARE_TYPE__LTE,
536
+ value: $n_numberDeep(quasarDate.formatDate($n_toDate(`${res.date.to} ${res.time.to}`), 'X')),
537
+ }
538
+ )
539
+ }
540
+ return
477
541
  }
478
- return
479
542
  }
480
543
 
481
544
  // 添加值1