@netang/quasar 0.0.103 → 0.0.104
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/search/index.vue +224 -222
- package/components/search-item/index.vue +212 -210
- package/package.json +1 -1
- package/sass/common.scss +179 -174
|
@@ -1,222 +1,224 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="flex column absolute-full" v-if="isValidArray(options)">
|
|
3
|
-
<q-scroll-area
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
v-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
:
|
|
36
|
-
|
|
37
|
-
:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
{ label: '
|
|
49
|
-
{ label: '
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
</
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
import
|
|
171
|
-
import
|
|
172
|
-
import
|
|
173
|
-
|
|
174
|
-
import
|
|
175
|
-
|
|
176
|
-
import $
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
//
|
|
203
|
-
|
|
204
|
-
//
|
|
205
|
-
|
|
206
|
-
//
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex column absolute-full" v-if="isValidArray(options)">
|
|
3
|
+
<q-scroll-area
|
|
4
|
+
class="n-flex-1"
|
|
5
|
+
content-style="n-overflow-hidden-x"
|
|
6
|
+
>
|
|
7
|
+
<div class="n-search q-pa-sm q-pt-sm q-gutter-sm">
|
|
8
|
+
|
|
9
|
+
<template
|
|
10
|
+
v-for="(item, itemIndex) in options"
|
|
11
|
+
>
|
|
12
|
+
<template v-if="! item.hide">
|
|
13
|
+
|
|
14
|
+
<!-- 如果有 name 插槽 -->
|
|
15
|
+
<slot
|
|
16
|
+
:name="`name-${item.name}`"
|
|
17
|
+
:item="item"
|
|
18
|
+
:item-index="itemIndex"
|
|
19
|
+
v-if="$slots[`name-${item.name}`]"
|
|
20
|
+
/>
|
|
21
|
+
|
|
22
|
+
<!-- 否则自定义组件 -->
|
|
23
|
+
<n-search-item
|
|
24
|
+
:data="item"
|
|
25
|
+
v-model="modelValue[itemIndex]"
|
|
26
|
+
v-slot="{ label, index, multiple }"
|
|
27
|
+
v-else
|
|
28
|
+
>
|
|
29
|
+
<!-- 日期 -->
|
|
30
|
+
<template v-if="item.type === 'date'">
|
|
31
|
+
|
|
32
|
+
<!-- 日期 -->
|
|
33
|
+
<n-field-date
|
|
34
|
+
class="n-field-fieldset n-flex-1"
|
|
35
|
+
:label="label"
|
|
36
|
+
v-model="modelValue[itemIndex][index].value"
|
|
37
|
+
:type="modelValue[itemIndex][0].dateType"
|
|
38
|
+
dense
|
|
39
|
+
:is-end-date="index === 1"
|
|
40
|
+
outlined
|
|
41
|
+
clearable
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
<!-- 日期类型 -->
|
|
45
|
+
<q-select
|
|
46
|
+
v-model="modelValue[itemIndex][0].dateType"
|
|
47
|
+
:options="[
|
|
48
|
+
{ label: '年', value: 'year' },
|
|
49
|
+
{ label: '月', value: 'month' },
|
|
50
|
+
{ label: '日', value: 'day' },
|
|
51
|
+
{ label: '时', value: 'datetime' },
|
|
52
|
+
]"
|
|
53
|
+
map-options
|
|
54
|
+
emit-value
|
|
55
|
+
outlined
|
|
56
|
+
dense
|
|
57
|
+
options-dense
|
|
58
|
+
v-if="index === 0"
|
|
59
|
+
/>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<!-- 数字输入框 价格 -->
|
|
63
|
+
<n-input-number
|
|
64
|
+
class="n-field-fieldset"
|
|
65
|
+
:label="label"
|
|
66
|
+
v-model="modelValue[itemIndex][index].value"
|
|
67
|
+
dense
|
|
68
|
+
outlined
|
|
69
|
+
clearable
|
|
70
|
+
|
|
71
|
+
:decimal-length="2"
|
|
72
|
+
:cent-to-yuan="centToYuan"
|
|
73
|
+
|
|
74
|
+
v-bind="item.input"
|
|
75
|
+
v-else-if="item.type === 'price'"
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
<!-- 输入框 -->
|
|
79
|
+
<template v-else-if="item.searchType === 'input'">
|
|
80
|
+
<q-input
|
|
81
|
+
class="n-field-fieldset"
|
|
82
|
+
:label="label"
|
|
83
|
+
v-model="modelValue[itemIndex][index].value"
|
|
84
|
+
dense
|
|
85
|
+
outlined
|
|
86
|
+
clearable
|
|
87
|
+
v-bind="item.input"
|
|
88
|
+
/>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<!-- 下拉列表 -->
|
|
92
|
+
<q-select
|
|
93
|
+
class="n-field-fieldset"
|
|
94
|
+
:label="label"
|
|
95
|
+
v-model="modelValue[itemIndex][index].value"
|
|
96
|
+
map-options
|
|
97
|
+
emit-value
|
|
98
|
+
outlined
|
|
99
|
+
dense
|
|
100
|
+
:multiple="multiple"
|
|
101
|
+
:use-chips="multiple"
|
|
102
|
+
options-dense
|
|
103
|
+
clearable
|
|
104
|
+
v-bind="item.select"
|
|
105
|
+
v-else-if="item.searchType === 'select'"
|
|
106
|
+
/>
|
|
107
|
+
|
|
108
|
+
<!-- 下拉树 -->
|
|
109
|
+
<n-field-tree
|
|
110
|
+
class="n-field-fieldset"
|
|
111
|
+
:label="label"
|
|
112
|
+
v-model="modelValue[itemIndex][index].value"
|
|
113
|
+
dense
|
|
114
|
+
outlined
|
|
115
|
+
:multiple="multiple"
|
|
116
|
+
v-bind="item.tree"
|
|
117
|
+
v-else-if="item.searchType === 'tree'"
|
|
118
|
+
/>
|
|
119
|
+
|
|
120
|
+
<!-- 下拉表格 -->
|
|
121
|
+
<n-field-table
|
|
122
|
+
class="n-field-fieldset"
|
|
123
|
+
:label="label"
|
|
124
|
+
v-model="modelValue[itemIndex][index].value"
|
|
125
|
+
dense
|
|
126
|
+
outlined
|
|
127
|
+
:value-type="multiple ? 'stringArray' : 'string'"
|
|
128
|
+
:multiple="multiple"
|
|
129
|
+
v-bind="item.table"
|
|
130
|
+
v-else-if="item.searchType === 'table'"
|
|
131
|
+
/>
|
|
132
|
+
|
|
133
|
+
</n-search-item>
|
|
134
|
+
</template>
|
|
135
|
+
</template>
|
|
136
|
+
</div>
|
|
137
|
+
</q-scroll-area>
|
|
138
|
+
|
|
139
|
+
<!-- 底部 -->
|
|
140
|
+
<q-toolbar
|
|
141
|
+
class="q-footer q-footer--bordered"
|
|
142
|
+
:class="{
|
|
143
|
+
'bg-grey-2': ! $q.dark.isActive,
|
|
144
|
+
}"
|
|
145
|
+
>
|
|
146
|
+
<div class="row n-flex-1 q-gutter-sm">
|
|
147
|
+
<q-btn
|
|
148
|
+
class="n-flex-1"
|
|
149
|
+
color="default"
|
|
150
|
+
outline
|
|
151
|
+
label="搜索"
|
|
152
|
+
icon="search"
|
|
153
|
+
@click="onSearch"
|
|
154
|
+
unelevated
|
|
155
|
+
/>
|
|
156
|
+
<q-btn
|
|
157
|
+
class="q-pl-md"
|
|
158
|
+
color="default"
|
|
159
|
+
outline
|
|
160
|
+
label="重置"
|
|
161
|
+
@click="onReset"
|
|
162
|
+
unelevated
|
|
163
|
+
/>
|
|
164
|
+
</div>
|
|
165
|
+
</q-toolbar>
|
|
166
|
+
</div>
|
|
167
|
+
</template>
|
|
168
|
+
|
|
169
|
+
<script>
|
|
170
|
+
import NSearchItem from '../search-item'
|
|
171
|
+
import NFieldDate from '../field-date'
|
|
172
|
+
import NInputNumber from '../input-number'
|
|
173
|
+
import NFieldTree from '../field-tree'
|
|
174
|
+
import NFieldTable from '../field-table'
|
|
175
|
+
|
|
176
|
+
import $n_isValidArray from '@netang/utils/isValidArray'
|
|
177
|
+
|
|
178
|
+
import $n_config from '../../utils/config'
|
|
179
|
+
|
|
180
|
+
export default {
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* 标识
|
|
184
|
+
*/
|
|
185
|
+
name: 'NSearch',
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* 组件
|
|
189
|
+
*/
|
|
190
|
+
components: {
|
|
191
|
+
NSearchItem,
|
|
192
|
+
NFieldDate,
|
|
193
|
+
NInputNumber,
|
|
194
|
+
NFieldTree,
|
|
195
|
+
NFieldTable,
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* 声明属性
|
|
200
|
+
*/
|
|
201
|
+
props: {
|
|
202
|
+
// 值
|
|
203
|
+
modelValue: Array,
|
|
204
|
+
// 参数
|
|
205
|
+
options: Array,
|
|
206
|
+
// 搜索
|
|
207
|
+
onSearch: Function,
|
|
208
|
+
// 重置
|
|
209
|
+
onReset: Function,
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* 组合式
|
|
214
|
+
*/
|
|
215
|
+
setup() {
|
|
216
|
+
return {
|
|
217
|
+
// 如果金额为分
|
|
218
|
+
centToYuan: $n_config('priceCentToYuan') === true,
|
|
219
|
+
|
|
220
|
+
isValidArray: $n_isValidArray,
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
</script>
|
|
@@ -1,210 +1,212 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="n-search__item n-field-group">
|
|
3
|
-
|
|
4
|
-
<!-- 比较1 -->
|
|
5
|
-
<div class="n-field-group row no-wrap">
|
|
6
|
-
|
|
7
|
-
<!-- 比较类型1 -->
|
|
8
|
-
<q-select
|
|
9
|
-
class="n-field-group__select"
|
|
10
|
-
v-model="modelValue[0].compare"
|
|
11
|
-
:options="data.compareOptions1"
|
|
12
|
-
:disable="data.compareOptions1.length === 1"
|
|
13
|
-
map-options
|
|
14
|
-
emit-value
|
|
15
|
-
outlined
|
|
16
|
-
stack-label
|
|
17
|
-
dense
|
|
18
|
-
options-dense
|
|
19
|
-
/>
|
|
20
|
-
|
|
21
|
-
<q-input
|
|
22
|
-
class="n-field-fieldset"
|
|
23
|
-
:label="data.label"
|
|
24
|
-
dense
|
|
25
|
-
outlined
|
|
26
|
-
disable
|
|
27
|
-
v-if="data.type === 'date' && modelValue[0].compare >= 20"
|
|
28
|
-
/>
|
|
29
|
-
|
|
30
|
-
<!-- 多选(类型为 in / not in)-->
|
|
31
|
-
<slot
|
|
32
|
-
:label="data.label"
|
|
33
|
-
:index="0"
|
|
34
|
-
:multiple="indexOf([dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN], modelValue[0].compare) > -1"
|
|
35
|
-
v-else
|
|
36
|
-
/>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
<!-- 比较2(类型为 > / >=) -->
|
|
40
|
-
<div
|
|
41
|
-
class="n-field-group row"
|
|
42
|
-
v-if="data.compareOptions2.length && indexOf([dicts.
|
|
43
|
-
>
|
|
44
|
-
<!-- 比较类型2 -->
|
|
45
|
-
<q-select
|
|
46
|
-
class="n-field-group__select"
|
|
47
|
-
v-model="modelValue[1].compare"
|
|
48
|
-
:options="data.compareOptions2"
|
|
49
|
-
:disable="data.compareOptions2.length === 1"
|
|
50
|
-
map-options
|
|
51
|
-
emit-value
|
|
52
|
-
outlined
|
|
53
|
-
dense
|
|
54
|
-
options-dense
|
|
55
|
-
/>
|
|
56
|
-
|
|
57
|
-
<slot
|
|
58
|
-
:label="undefined"
|
|
59
|
-
:multiple="false"
|
|
60
|
-
:index="1"
|
|
61
|
-
/>
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
</template>
|
|
65
|
-
|
|
66
|
-
<script>
|
|
67
|
-
import { watch } from 'vue'
|
|
68
|
-
|
|
69
|
-
import $n_isArray from 'lodash/isArray'
|
|
70
|
-
import $n_cloneDeep from 'lodash/cloneDeep'
|
|
71
|
-
|
|
72
|
-
import $n_split from '@netang/utils/split'
|
|
73
|
-
import $n_indexOf from '@netang/utils/indexOf'
|
|
74
|
-
import $n_numberDeep from '@netang/utils/numberDeep'
|
|
75
|
-
|
|
76
|
-
import { configs } from '../../utils/config'
|
|
77
|
-
|
|
78
|
-
const {
|
|
79
|
-
// 字典常量
|
|
80
|
-
dicts,
|
|
81
|
-
} = configs
|
|
82
|
-
|
|
83
|
-
export default {
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* 标识
|
|
87
|
-
*/
|
|
88
|
-
name: 'NSearchItem',
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* 声明属性
|
|
92
|
-
*/
|
|
93
|
-
props: {
|
|
94
|
-
// 值
|
|
95
|
-
modelValue: Array,
|
|
96
|
-
// 数据
|
|
97
|
-
data: Object,
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* 声明事件
|
|
102
|
-
*/
|
|
103
|
-
emits: [
|
|
104
|
-
'update:modelValue',
|
|
105
|
-
],
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* 组合式
|
|
109
|
-
*/
|
|
110
|
-
setup(props, { emit }) {
|
|
111
|
-
|
|
112
|
-
// ==========【监听数据】=========================================================================================
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* 监听值的比较类型
|
|
116
|
-
*/
|
|
117
|
-
watch(()=>props.modelValue[0].compare, function(compare) {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
//
|
|
192
|
-
&:
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="n-search__item n-field-group">
|
|
3
|
+
|
|
4
|
+
<!-- 比较1 -->
|
|
5
|
+
<div class="n-field-group row no-wrap">
|
|
6
|
+
|
|
7
|
+
<!-- 比较类型1 -->
|
|
8
|
+
<q-select
|
|
9
|
+
class="n-field-group__select"
|
|
10
|
+
v-model="modelValue[0].compare"
|
|
11
|
+
:options="data.compareOptions1"
|
|
12
|
+
:disable="data.compareOptions1.length === 1"
|
|
13
|
+
map-options
|
|
14
|
+
emit-value
|
|
15
|
+
outlined
|
|
16
|
+
stack-label
|
|
17
|
+
dense
|
|
18
|
+
options-dense
|
|
19
|
+
/>
|
|
20
|
+
|
|
21
|
+
<q-input
|
|
22
|
+
class="n-field-fieldset"
|
|
23
|
+
:label="data.label"
|
|
24
|
+
dense
|
|
25
|
+
outlined
|
|
26
|
+
disable
|
|
27
|
+
v-if="data.type === 'date' && modelValue[0].compare >= 20"
|
|
28
|
+
/>
|
|
29
|
+
|
|
30
|
+
<!-- 多选(类型为 in / not in)-->
|
|
31
|
+
<slot
|
|
32
|
+
:label="data.label"
|
|
33
|
+
:index="0"
|
|
34
|
+
:multiple="indexOf([dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN], modelValue[0].compare) > -1"
|
|
35
|
+
v-else
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<!-- 比较2(类型为 > / >=) -->
|
|
40
|
+
<div
|
|
41
|
+
class="n-field-group row"
|
|
42
|
+
v-if="data.compareOptions2.length && indexOf([dicts.SEARCH_COMPARE_TYPE__GT, dicts.SEARCH_COMPARE_TYPE__GTE], modelValue[0].compare) > -1"
|
|
43
|
+
>
|
|
44
|
+
<!-- 比较类型2 -->
|
|
45
|
+
<q-select
|
|
46
|
+
class="n-field-group__select"
|
|
47
|
+
v-model="modelValue[1].compare"
|
|
48
|
+
:options="data.compareOptions2"
|
|
49
|
+
:disable="data.compareOptions2.length === 1"
|
|
50
|
+
map-options
|
|
51
|
+
emit-value
|
|
52
|
+
outlined
|
|
53
|
+
dense
|
|
54
|
+
options-dense
|
|
55
|
+
/>
|
|
56
|
+
|
|
57
|
+
<slot
|
|
58
|
+
:label="undefined"
|
|
59
|
+
:multiple="false"
|
|
60
|
+
:index="1"
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
|
|
66
|
+
<script>
|
|
67
|
+
import { watch } from 'vue'
|
|
68
|
+
|
|
69
|
+
import $n_isArray from 'lodash/isArray'
|
|
70
|
+
import $n_cloneDeep from 'lodash/cloneDeep'
|
|
71
|
+
|
|
72
|
+
import $n_split from '@netang/utils/split'
|
|
73
|
+
import $n_indexOf from '@netang/utils/indexOf'
|
|
74
|
+
import $n_numberDeep from '@netang/utils/numberDeep'
|
|
75
|
+
|
|
76
|
+
import { configs } from '../../utils/config'
|
|
77
|
+
|
|
78
|
+
const {
|
|
79
|
+
// 字典常量
|
|
80
|
+
dicts,
|
|
81
|
+
} = configs
|
|
82
|
+
|
|
83
|
+
export default {
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 标识
|
|
87
|
+
*/
|
|
88
|
+
name: 'NSearchItem',
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 声明属性
|
|
92
|
+
*/
|
|
93
|
+
props: {
|
|
94
|
+
// 值
|
|
95
|
+
modelValue: Array,
|
|
96
|
+
// 数据
|
|
97
|
+
data: Object,
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* 声明事件
|
|
102
|
+
*/
|
|
103
|
+
emits: [
|
|
104
|
+
'update:modelValue',
|
|
105
|
+
],
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 组合式
|
|
109
|
+
*/
|
|
110
|
+
setup(props, { emit }) {
|
|
111
|
+
|
|
112
|
+
// ==========【监听数据】=========================================================================================
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* 监听值的比较类型
|
|
116
|
+
*/
|
|
117
|
+
watch(() => props.modelValue[0].compare, function(compare) {
|
|
118
|
+
|
|
119
|
+
console.log('compare', props.data, props.modelValue[0].compare)
|
|
120
|
+
|
|
121
|
+
// 获取当前值
|
|
122
|
+
const value = props.modelValue[0].value
|
|
123
|
+
|
|
124
|
+
// 如果类型为 in / not in, 则为多选
|
|
125
|
+
// --------------------------------------------------
|
|
126
|
+
if ($n_indexOf([dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN], compare) > -1) {
|
|
127
|
+
|
|
128
|
+
// 如果当前值不为数组
|
|
129
|
+
if (! $n_isArray(value)) {
|
|
130
|
+
|
|
131
|
+
// 则将值转为数组
|
|
132
|
+
// 触发更新值
|
|
133
|
+
emitModelValue($n_split(value, ','))
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// 否则为单选 && 如果值为: 数组
|
|
137
|
+
// --------------------------------------------------
|
|
138
|
+
} else if ($n_isArray(value)) {
|
|
139
|
+
|
|
140
|
+
// 触发更新值
|
|
141
|
+
emitModelValue(value.length ? $n_numberDeep(value[0]) : '')
|
|
142
|
+
|
|
143
|
+
// 否则为单选 && 值为: 字符串 / 数字
|
|
144
|
+
// --------------------------------------------------
|
|
145
|
+
} else {
|
|
146
|
+
|
|
147
|
+
// 将值转为数组
|
|
148
|
+
const arr = $n_split(value, ',')
|
|
149
|
+
|
|
150
|
+
// 如果数组长度不为 1, 则说明有多个值 || 无值
|
|
151
|
+
if (arr.length !== 1) {
|
|
152
|
+
|
|
153
|
+
// 触发更新值
|
|
154
|
+
emitModelValue(arr.length > 1 ? arr[0] : '')
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
// ==========【方法】=============================================================================================
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* 触发更新值
|
|
163
|
+
*/
|
|
164
|
+
function emitModelValue(value) {
|
|
165
|
+
|
|
166
|
+
// 克隆值
|
|
167
|
+
const _modelValue = $n_cloneDeep(props.modelValue)
|
|
168
|
+
|
|
169
|
+
// 更新值
|
|
170
|
+
_modelValue[0].value = value
|
|
171
|
+
|
|
172
|
+
// 更新值
|
|
173
|
+
emit('update:modelValue', _modelValue)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// ==========【返回】=============================================================================================
|
|
177
|
+
|
|
178
|
+
return {
|
|
179
|
+
dicts,
|
|
180
|
+
indexOf: $n_indexOf,
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
}
|
|
184
|
+
</script>
|
|
185
|
+
|
|
186
|
+
<style lang="scss">
|
|
187
|
+
.n-search__item {
|
|
188
|
+
.n-field-group {
|
|
189
|
+
> .q-field--outlined {
|
|
190
|
+
|
|
191
|
+
// 第一个子节点
|
|
192
|
+
&:first-child,
|
|
193
|
+
// 第三个子节点
|
|
194
|
+
&:nth-child(3) {
|
|
195
|
+
.q-field__control {
|
|
196
|
+
height: 100% !important;
|
|
197
|
+
background-color: rgba(var(--n-reverse-color-rgb), 0.04);
|
|
198
|
+
|
|
199
|
+
.q-field__marginal {
|
|
200
|
+
height: 100% !important;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// 第二个子节点
|
|
206
|
+
&:nth-child(2) {
|
|
207
|
+
flex: 1;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
</style>
|
package/package.json
CHANGED
package/sass/common.scss
CHANGED
|
@@ -1,174 +1,179 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 亮色
|
|
3
|
-
*/
|
|
4
|
-
.body--light {
|
|
5
|
-
// 反色
|
|
6
|
-
--n-reverse-color: var(--q-dark);
|
|
7
|
-
// 反色 rgb(亮色是黑色)
|
|
8
|
-
--n-reverse-color-rgb: 0, 0, 0;
|
|
9
|
-
// 主题颜色
|
|
10
|
-
--n-mode-color: #ffffff;;
|
|
11
|
-
// 占位符颜色
|
|
12
|
-
--n-placeholder-color: rgba(0, 0, 0, 0.5);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 暗色
|
|
17
|
-
*/
|
|
18
|
-
.body--dark {
|
|
19
|
-
// 反色
|
|
20
|
-
--n-reverse-color: #ffffff;
|
|
21
|
-
// 反色 rgb(暗色是白色)
|
|
22
|
-
--n-reverse-color-rgb: 255, 255, 255;
|
|
23
|
-
// 主题颜色
|
|
24
|
-
--n-mode-color: var(--q-dark);
|
|
25
|
-
// 占位符颜色
|
|
26
|
-
--n-placeholder-color: rgba(255, 255, 255, 0.5);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
body {
|
|
30
|
-
--n-bg-grey-1: rgba(var(--n-reverse-color-rgb), 0.02);
|
|
31
|
-
--n-bg-grey-2: rgba(var(--n-reverse-color-rgb), 0.04);
|
|
32
|
-
--n-bg-grey-3: rgba(var(--n-reverse-color-rgb), 0.07);
|
|
33
|
-
--n-bg-grey-4: rgba(var(--n-reverse-color-rgb), 0.12);
|
|
34
|
-
--n-bg-grey-5: rgba(var(--n-reverse-color-rgb), 0.26);
|
|
35
|
-
--n-bg-grey-6: rgba(var(--n-reverse-color-rgb), 0.38);
|
|
36
|
-
--n-bg-grey-7: rgba(var(--n-reverse-color-rgb), 0.54);
|
|
37
|
-
--n-bg-grey-8: rgba(var(--n-reverse-color-rgb), 0.62);
|
|
38
|
-
--n-bg-grey-9: rgba(var(--n-reverse-color-rgb), 0.75);
|
|
39
|
-
--n-bg-grey-10: rgba(var(--n-reverse-color-rgb), 0.86);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
//
|
|
43
|
-
.n-overflow-
|
|
44
|
-
overflow-x:
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
//
|
|
48
|
-
.n-overflow-auto-
|
|
49
|
-
overflow-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
//
|
|
53
|
-
.n-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
//
|
|
74
|
-
.n-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
//
|
|
79
|
-
.n-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
//
|
|
106
|
-
.n-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
::-webkit-scrollbar
|
|
153
|
-
height:
|
|
154
|
-
width:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
::-webkit-scrollbar-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 亮色
|
|
3
|
+
*/
|
|
4
|
+
.body--light {
|
|
5
|
+
// 反色
|
|
6
|
+
--n-reverse-color: var(--q-dark);
|
|
7
|
+
// 反色 rgb(亮色是黑色)
|
|
8
|
+
--n-reverse-color-rgb: 0, 0, 0;
|
|
9
|
+
// 主题颜色
|
|
10
|
+
--n-mode-color: #ffffff;;
|
|
11
|
+
// 占位符颜色
|
|
12
|
+
--n-placeholder-color: rgba(0, 0, 0, 0.5);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 暗色
|
|
17
|
+
*/
|
|
18
|
+
.body--dark {
|
|
19
|
+
// 反色
|
|
20
|
+
--n-reverse-color: #ffffff;
|
|
21
|
+
// 反色 rgb(暗色是白色)
|
|
22
|
+
--n-reverse-color-rgb: 255, 255, 255;
|
|
23
|
+
// 主题颜色
|
|
24
|
+
--n-mode-color: var(--q-dark);
|
|
25
|
+
// 占位符颜色
|
|
26
|
+
--n-placeholder-color: rgba(255, 255, 255, 0.5);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
body {
|
|
30
|
+
--n-bg-grey-1: rgba(var(--n-reverse-color-rgb), 0.02);
|
|
31
|
+
--n-bg-grey-2: rgba(var(--n-reverse-color-rgb), 0.04);
|
|
32
|
+
--n-bg-grey-3: rgba(var(--n-reverse-color-rgb), 0.07);
|
|
33
|
+
--n-bg-grey-4: rgba(var(--n-reverse-color-rgb), 0.12);
|
|
34
|
+
--n-bg-grey-5: rgba(var(--n-reverse-color-rgb), 0.26);
|
|
35
|
+
--n-bg-grey-6: rgba(var(--n-reverse-color-rgb), 0.38);
|
|
36
|
+
--n-bg-grey-7: rgba(var(--n-reverse-color-rgb), 0.54);
|
|
37
|
+
--n-bg-grey-8: rgba(var(--n-reverse-color-rgb), 0.62);
|
|
38
|
+
--n-bg-grey-9: rgba(var(--n-reverse-color-rgb), 0.75);
|
|
39
|
+
--n-bg-grey-10: rgba(var(--n-reverse-color-rgb), 0.86);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// 隐藏横向滚动条
|
|
43
|
+
.n-overflow-hidden-x {
|
|
44
|
+
overflow-x: hidden !important;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// 自动显示横向滚动条
|
|
48
|
+
.n-overflow-auto-x {
|
|
49
|
+
overflow-x: auto !important;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// 自动显示竖向滚动条
|
|
53
|
+
.n-overflow-auto-y {
|
|
54
|
+
overflow-y: auto !important;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// 字体大小 12 像素
|
|
58
|
+
.n-font-size-12 {
|
|
59
|
+
font-size: 12px;
|
|
60
|
+
}
|
|
61
|
+
// 字体大小 13 像素
|
|
62
|
+
.n-font-size-13 {
|
|
63
|
+
font-size: 13px;
|
|
64
|
+
}
|
|
65
|
+
// 字体大小 14 像素
|
|
66
|
+
.n-font-size-14 {
|
|
67
|
+
font-size: 14px;
|
|
68
|
+
}
|
|
69
|
+
// 字体大小 15 像素
|
|
70
|
+
.n-font-size-15 {
|
|
71
|
+
font-size: 15px;
|
|
72
|
+
}
|
|
73
|
+
// 字体大小 16 像素
|
|
74
|
+
.n-font-size-16 {
|
|
75
|
+
font-size: 16px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 占位符
|
|
79
|
+
.n-placeholder {
|
|
80
|
+
color: var(--n-placeholder-color);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 不可点击
|
|
84
|
+
.n-pointer-none {
|
|
85
|
+
pointer-events: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//.n-color-primary,
|
|
89
|
+
//.n-color-main {
|
|
90
|
+
// color: var(--q-primary);
|
|
91
|
+
//}
|
|
92
|
+
//.n-color-success {
|
|
93
|
+
// color: var(--q-positive);
|
|
94
|
+
//}
|
|
95
|
+
//.n-color-warning {
|
|
96
|
+
// color: var(--q-warning);
|
|
97
|
+
//}
|
|
98
|
+
//.n-color-danger {
|
|
99
|
+
// color: var(--q-negative);
|
|
100
|
+
//}
|
|
101
|
+
//.n-color-info {
|
|
102
|
+
// color: var(--q-info);
|
|
103
|
+
//}
|
|
104
|
+
|
|
105
|
+
// flex 1
|
|
106
|
+
.n-flex-1 {
|
|
107
|
+
flex: 1;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// 网格行填充
|
|
111
|
+
.n-col-space {
|
|
112
|
+
width: 100%;
|
|
113
|
+
padding: 0;
|
|
114
|
+
margin: 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.n-bg-grey-1 {
|
|
118
|
+
background-color: var(--n-bg-grey-1)
|
|
119
|
+
}
|
|
120
|
+
.n-bg-grey-2 {
|
|
121
|
+
background-color: var(--n-bg-grey-2)
|
|
122
|
+
}
|
|
123
|
+
.n-bg-grey-3 {
|
|
124
|
+
background-color: var(--n-bg-grey-3)
|
|
125
|
+
}
|
|
126
|
+
.n-bg-grey-4 {
|
|
127
|
+
background-color: var(--n-bg-grey-4)
|
|
128
|
+
}
|
|
129
|
+
.n-bg-grey-5 {
|
|
130
|
+
background-color: var(--n-bg-grey-5)
|
|
131
|
+
}
|
|
132
|
+
.n-bg-grey-6 {
|
|
133
|
+
background-color: var(--n-bg-grey-6)
|
|
134
|
+
}
|
|
135
|
+
.n-bg-grey-7 {
|
|
136
|
+
background-color: var(--n-bg-grey-7)
|
|
137
|
+
}
|
|
138
|
+
.n-bg-grey-8 {
|
|
139
|
+
background-color: var(--n-bg-grey-8)
|
|
140
|
+
}
|
|
141
|
+
.n-bg-grey-9 {
|
|
142
|
+
background-color: var(--n-bg-grey-9)
|
|
143
|
+
}
|
|
144
|
+
.n-bg-grey-10 {
|
|
145
|
+
background-color: var(--n-bg-grey-10)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* 桌面
|
|
150
|
+
*/
|
|
151
|
+
body.desktop {
|
|
152
|
+
::-webkit-scrollbar {
|
|
153
|
+
height: 10px;
|
|
154
|
+
width: 10px;
|
|
155
|
+
overflow: visible;
|
|
156
|
+
}
|
|
157
|
+
::-webkit-scrollbar-button {
|
|
158
|
+
height: 0;
|
|
159
|
+
width: 0;
|
|
160
|
+
}
|
|
161
|
+
::-webkit-scrollbar-corner {
|
|
162
|
+
background: transparent;
|
|
163
|
+
}
|
|
164
|
+
::-webkit-scrollbar-thumb,
|
|
165
|
+
::-webkit-scrollbar-track {
|
|
166
|
+
border-radius: 0;
|
|
167
|
+
border: none;
|
|
168
|
+
background-clip: padding-box;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
::-webkit-scrollbar-thumb,
|
|
172
|
+
::-webkit-scrollbar-track,
|
|
173
|
+
::-webkit-scrollbar-thumb:hover {
|
|
174
|
+
background-color: rgba(var(--n-reverse-color-rgb), 0.2);
|
|
175
|
+
}
|
|
176
|
+
::-webkit-scrollbar-track {
|
|
177
|
+
background-color: rgba(var(--n-reverse-color-rgb), 0.05);
|
|
178
|
+
}
|
|
179
|
+
}
|