@netang/quasar 0.1.13 → 0.1.15

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.
@@ -1,110 +1,107 @@
1
- <template>
2
- <q-tr class="q-table__bottom">
3
- <q-td
4
- v-for="(item, index) in columns"
5
- :class="item.css"
6
- >
7
- <!-- 合计标题 -->
8
- <span v-if="index === 0">合计</span>
9
-
10
- <!-- 合计数据 -->
11
- <span v-else-if="item.value">{{item.value}}</span>
12
- </q-td>
13
- </q-tr>
14
- </template>
15
-
16
- <script>
17
- import { computed, inject } from 'vue'
18
-
19
- import $n_has from 'lodash/has'
20
- import $n_get from 'lodash/get'
21
-
22
- import $n_forEach from '@netang/utils/forEach'
23
-
24
- import $n_price from '../../utils/price'
25
-
26
- import { NTableKey } from '../../utils/symbols'
27
-
28
- export default {
29
-
30
- /**
31
- * 标识
32
- */
33
- name: 'NTableSummary',
34
-
35
- /**
36
- * 声明属性
37
- */
38
- props: {
39
- // 传值
40
- props: Object,
41
- // 选择类型, 可选值 single multiple none
42
- selection: String,
43
- // 表格合计数据
44
- data: Object,
45
- },
46
-
47
- /**
48
- * 组合式
49
- */
50
- setup(props) {
51
-
52
- // ==========【数据】============================================================================================
53
-
54
- // 获取表格注入
55
- const {
56
- // 表格选择类型
57
- tableSelection,
58
- } = inject(NTableKey)
59
-
60
- // ==========【计算属性】============================================================================================
61
-
62
- const columns = computed(function () {
63
-
64
- const lists = []
65
-
66
- if (tableSelection.value !== 'none') {
67
- lists.push({
68
- css: 'q-table--col-auto-width text-center',
69
- name: '',
70
- })
71
- }
72
-
73
- $n_forEach($n_get(props.props, 'cols'), function(item) {
74
-
75
- const {
76
- // 标识
77
- name,
78
- // 对齐方式
79
- align,
80
- } = item
81
-
82
- const res = {
83
- css: `text-${align}`,
84
- name,
85
- value: '',
86
- }
87
-
88
- // 如果有统计字段
89
- if ($n_has(props.data, name)) {
90
- // 判断是否是价格
91
- res.value = $n_has(item, 'price') ? $n_price(props.data[name]) : props.data[name]
92
- }
93
-
94
- lists.push(res)
95
- })
96
-
97
- return lists
98
- })
99
-
100
- // ==========【返回】=============================================================================================
101
-
102
- return {
103
- // 栏目
104
- columns,
105
- // 表格选择类型
106
- tableSelection,
107
- }
108
- },
109
- }
110
- </script>
1
+ <template>
2
+ <q-tr class="q-table__bottom">
3
+ <q-td
4
+ v-for="(item, index) in columns"
5
+ :class="item.css"
6
+ >
7
+ <!-- 合计标题 -->
8
+ <span v-if="index === 0">合计</span>
9
+
10
+ <!-- 合计数据 -->
11
+ <span v-else-if="item.value">{{item.value}}</span>
12
+ </q-td>
13
+ </q-tr>
14
+ </template>
15
+
16
+ <script>
17
+ import { computed, inject } from 'vue'
18
+
19
+ import $n_has from 'lodash/has'
20
+ import $n_get from 'lodash/get'
21
+
22
+ import $n_forEach from '@netang/utils/forEach'
23
+
24
+ import $n_price from '../../utils/price'
25
+
26
+ import { NTableKey } from '../../utils/symbols'
27
+
28
+ export default {
29
+
30
+ /**
31
+ * 标识
32
+ */
33
+ name: 'NTableSummary',
34
+
35
+ /**
36
+ * 声明属性
37
+ */
38
+ props: {
39
+ // 传值
40
+ props: Object,
41
+ },
42
+
43
+ /**
44
+ * 组合式
45
+ */
46
+ setup(props) {
47
+
48
+ // ==========【数据】============================================================================================
49
+
50
+ // 获取表格注入
51
+ const {
52
+ // 表格选择类型
53
+ tableSelection,
54
+ tableSummary,
55
+ } = inject(NTableKey)
56
+
57
+ // ==========【计算属性】============================================================================================
58
+
59
+ const columns = computed(function () {
60
+
61
+ const lists = []
62
+
63
+ if (tableSelection.value !== 'none') {
64
+ lists.push({
65
+ css: 'q-table--col-auto-width text-center',
66
+ name: '',
67
+ })
68
+ }
69
+
70
+ $n_forEach($n_get(props.props, 'cols'), function(item) {
71
+
72
+ const {
73
+ // 标识
74
+ name,
75
+ // 对齐方式
76
+ align,
77
+ } = item
78
+
79
+ const res = {
80
+ css: `text-${align}`,
81
+ name,
82
+ value: '',
83
+ }
84
+
85
+ // 如果有统计字段
86
+ if ($n_has(tableSummary.value, name)) {
87
+ // 判断是否是价格
88
+ res.value = $n_has(item, 'price') ? $n_price(tableSummary.value[name]) : tableSummary.value[name]
89
+ }
90
+
91
+ lists.push(res)
92
+ })
93
+
94
+ return lists
95
+ })
96
+
97
+ // ==========【返回】=============================================================================================
98
+
99
+ return {
100
+ // 栏目
101
+ columns,
102
+ // 表格选择类型
103
+ tableSelection,
104
+ }
105
+ },
106
+ }
107
+ </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netang/quasar",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "netang-quasar",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/utils/$table.js CHANGED
@@ -679,8 +679,11 @@ function create(options) {
679
679
  }
680
680
  })
681
681
 
682
+ console.log('tableSearchValue.value', tableSearchValue.value)
683
+
682
684
  // 获取搜索值
683
685
  const search = formatValue(rawSearchOptions, tableSearchValue.value)
686
+ console.log('search', search)
684
687
  if ($n_isValidArray(search)) {
685
688
  data.n_search = $n_has(data, 'n_search') ? $n_concat(data.n_search, search) : search
686
689
  }
@@ -1,4 +1,5 @@
1
1
  import $n_has from 'lodash/has'
2
+ import $n_isArray from 'lodash/isArray'
2
3
  import $n_cloneDeep from 'lodash/cloneDeep'
3
4
  import $n_merge from 'lodash/merge'
4
5
  import $n_isFunction from 'lodash/isFunction'
@@ -18,6 +19,7 @@ import $n_isValidValue from '@netang/utils/isValidValue'
18
19
  import $n_trimString from '@netang/utils/trimString'
19
20
  import $n_numberDeep from '@netang/utils/numberDeep'
20
21
  import $n_toDate from '@netang/utils/toDate'
22
+ import $n_replaceAll from '@netang/utils/replaceAll'
21
23
 
22
24
  import { date as quasarDate } from 'quasar'
23
25
  import { getQuickRange, quickRange } from '../components/field-date/methods'
@@ -399,17 +401,21 @@ export function formatValue(rawSearchOptions, searchValue) {
399
401
  function addValue1(value1) {
400
402
 
401
403
  // 如果有值1
402
- if ($n_isValidValue(value1.value)) {
404
+ if ($n_isRequired(value1.value)) {
403
405
 
404
406
  // 如果值1 类型为 in / not in
405
407
  if ($n_indexOf([dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN], value1.compare) > -1) {
408
+
406
409
  const vals = []
407
- $n_forEach($n_split($n_trimString(value1.value).replaceAll(',', ','), ','), function (item) {
410
+
411
+ const values = $n_isArray(value1.value) ? value1.value : $n_split($n_replaceAll($n_trimString(value1.value), ',', ','), ',')
412
+ $n_forEach(values, function (item) {
408
413
  item = $n_numberDeep(item)
409
414
  if ($n_isValidValue(item)) {
410
415
  vals.push(item)
411
416
  }
412
417
  })
418
+
413
419
  if (vals.length) {
414
420
  lists.push({
415
421
  field: name,