@netang/quasar 0.0.33 → 0.0.35
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/drawer/index.vue +16 -11
- package/components/field-table/index.vue +13 -4
- package/components/search-item/index.vue +13 -81
- package/components/splitter/index.vue +159 -19
- package/components/table/index.vue +77 -11
- package/package.json +1 -1
- package/utils/$power.js +26 -11
- package/utils/$search.js +144 -22
- package/utils/$table.js +20 -10
- package/utils/$tree.js +2 -1
- package/utils/price.js +13 -13
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
<script>
|
|
23
23
|
import { ref, inject, nextTick, watch } from 'vue'
|
|
24
24
|
import { useQuasar } from 'quasar'
|
|
25
|
-
import { useRoute } from 'vue-router'
|
|
26
25
|
|
|
27
26
|
import { layoutKey, emptyRenderFn } from 'quasar/src/utils/private/symbols.js'
|
|
28
27
|
|
|
@@ -108,9 +107,6 @@ export default {
|
|
|
108
107
|
// quasar 对象
|
|
109
108
|
const $q = useQuasar()
|
|
110
109
|
|
|
111
|
-
// 获取当前路由
|
|
112
|
-
const $route = useRoute()
|
|
113
|
-
|
|
114
110
|
// 获取权限注入数据
|
|
115
111
|
const $power = inject(NPowerKey)
|
|
116
112
|
|
|
@@ -124,10 +120,14 @@ export default {
|
|
|
124
120
|
} else {
|
|
125
121
|
currentModelValue.value = props.modelValue
|
|
126
122
|
}
|
|
123
|
+
|
|
127
124
|
} else {
|
|
128
125
|
currentModelValue = ref(props.modelValue)
|
|
129
126
|
}
|
|
130
127
|
|
|
128
|
+
// 创建防抖睡眠方法
|
|
129
|
+
const sleep = utils.debounceSleep()
|
|
130
|
+
|
|
131
131
|
// 缓存名
|
|
132
132
|
let cacheName = ''
|
|
133
133
|
|
|
@@ -159,7 +159,7 @@ export default {
|
|
|
159
159
|
} else if (props.drag && props.cache) {
|
|
160
160
|
|
|
161
161
|
// 设置缓存名
|
|
162
|
-
cacheName = `
|
|
162
|
+
cacheName = `drawer:${props.side}:${props.cache === true ? ($power && $power.routePath ? $power.routePath : utils.router.getRoute('path')) : props.cache}`
|
|
163
163
|
|
|
164
164
|
// 从缓存获取宽度
|
|
165
165
|
const cache = utils.storage.get(cacheName)
|
|
@@ -237,14 +237,19 @@ export default {
|
|
|
237
237
|
// }
|
|
238
238
|
// }
|
|
239
239
|
|
|
240
|
-
// 如果开启缓存
|
|
241
|
-
if (props.cache) {
|
|
242
|
-
// 设置缓存(永久缓存)
|
|
243
|
-
utils.storage.set(cacheName, newWidth, 0)
|
|
244
|
-
}
|
|
245
|
-
|
|
246
240
|
// 设置当前宽度
|
|
247
241
|
currentWidth.value = newWidth
|
|
242
|
+
|
|
243
|
+
// 如果开启缓存
|
|
244
|
+
if (props.drag && props.cache && cacheName) {
|
|
245
|
+
|
|
246
|
+
// 延迟执行
|
|
247
|
+
sleep(500)
|
|
248
|
+
.then(function () {
|
|
249
|
+
// 设置缓存(永久缓存)
|
|
250
|
+
utils.storage.set(cacheName, newWidth, 0)
|
|
251
|
+
})
|
|
252
|
+
}
|
|
248
253
|
}
|
|
249
254
|
|
|
250
255
|
// ==========【返回】=============================================================================================
|
|
@@ -85,8 +85,7 @@
|
|
|
85
85
|
>
|
|
86
86
|
<!-- 快捷表格 -->
|
|
87
87
|
<q-table
|
|
88
|
-
class="n-table"
|
|
89
|
-
style="min-width:500px;max-width:90vw;height: 300px;"
|
|
88
|
+
class="n-table n-field-table__popup-table"
|
|
90
89
|
v-model:pagination="tablePagination"
|
|
91
90
|
v-model:selected="selected"
|
|
92
91
|
:row-key="tableRowKey"
|
|
@@ -160,7 +159,6 @@
|
|
|
160
159
|
|
|
161
160
|
<script>
|
|
162
161
|
import { ref, computed, watch, onMounted, onUpdated } from 'vue'
|
|
163
|
-
import { NRenderKey } from '../../utils/symbols'
|
|
164
162
|
|
|
165
163
|
export default {
|
|
166
164
|
|
|
@@ -506,7 +504,7 @@ export default {
|
|
|
506
504
|
n_search[currentFilterKey.value] = [
|
|
507
505
|
{
|
|
508
506
|
// 比较类型
|
|
509
|
-
|
|
507
|
+
compare: dicts.SEARCH_COMPARE_TYPE__LIKE,
|
|
510
508
|
// 值
|
|
511
509
|
value: val || '',
|
|
512
510
|
}
|
|
@@ -1073,4 +1071,15 @@ export default {
|
|
|
1073
1071
|
cursor: text;
|
|
1074
1072
|
}
|
|
1075
1073
|
}
|
|
1074
|
+
|
|
1075
|
+
/**
|
|
1076
|
+
* 桌面
|
|
1077
|
+
*/
|
|
1078
|
+
body.desktop {
|
|
1079
|
+
.n-field-table {
|
|
1080
|
+
&__popup-table {
|
|
1081
|
+
height: 300px;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1076
1085
|
</style>
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
<!-- 比较类型1 -->
|
|
8
8
|
<q-select
|
|
9
9
|
class="n-field-group__select"
|
|
10
|
-
v-model="modelValue[0].
|
|
11
|
-
:options="compareOptions1"
|
|
10
|
+
v-model="modelValue[0].compare"
|
|
11
|
+
:options="data.compareOptions1"
|
|
12
|
+
:disable="data.compareOptions1.length === 1"
|
|
12
13
|
map-options
|
|
13
14
|
emit-value
|
|
14
15
|
outlined
|
|
@@ -23,14 +24,14 @@
|
|
|
23
24
|
dense
|
|
24
25
|
outlined
|
|
25
26
|
disable
|
|
26
|
-
v-if="data.type === 'date' && modelValue[0].
|
|
27
|
+
v-if="data.type === 'date' && modelValue[0].compare >= 20"
|
|
27
28
|
/>
|
|
28
29
|
|
|
29
30
|
<!-- 多选(类型为 in / not in)-->
|
|
30
31
|
<slot
|
|
31
32
|
:label="data.label"
|
|
32
33
|
:index="0"
|
|
33
|
-
:multiple="utils.indexOf([dicts.
|
|
34
|
+
:multiple="utils.indexOf([dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN], modelValue[0].compare) > -1"
|
|
34
35
|
v-else
|
|
35
36
|
/>
|
|
36
37
|
</div>
|
|
@@ -38,16 +39,14 @@
|
|
|
38
39
|
<!-- 比较2(类型为 > / >=) -->
|
|
39
40
|
<div
|
|
40
41
|
class="n-field-group row"
|
|
41
|
-
v-if="
|
|
42
|
+
v-if="data.compareOptions2.length"
|
|
42
43
|
>
|
|
43
44
|
<!-- 比较类型2 -->
|
|
44
45
|
<q-select
|
|
45
46
|
class="n-field-group__select"
|
|
46
|
-
v-model="modelValue[1].
|
|
47
|
-
:options="
|
|
48
|
-
|
|
49
|
-
{ label: '≤', value: dicts.SEARCH_TYPE__LTE },
|
|
50
|
-
]"
|
|
47
|
+
v-model="modelValue[1].compare"
|
|
48
|
+
:options="data.compareOptions2"
|
|
49
|
+
:disable="data.compareOptions2.length === 1"
|
|
51
50
|
map-options
|
|
52
51
|
emit-value
|
|
53
52
|
outlined
|
|
@@ -65,8 +64,7 @@
|
|
|
65
64
|
</template>
|
|
66
65
|
|
|
67
66
|
<script>
|
|
68
|
-
import {
|
|
69
|
-
import { quickRange } from '../field-date/methods'
|
|
67
|
+
import { watch } from 'vue'
|
|
70
68
|
|
|
71
69
|
export default {
|
|
72
70
|
|
|
@@ -97,73 +95,14 @@ export default {
|
|
|
97
95
|
*/
|
|
98
96
|
setup(props, { emit }) {
|
|
99
97
|
|
|
100
|
-
// ==========【计算属性】=========================================================================================
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* 比较下拉列表1
|
|
104
|
-
* 1: =
|
|
105
|
-
* 2: !=
|
|
106
|
-
* 3: >
|
|
107
|
-
* 4: >=
|
|
108
|
-
* 5: <
|
|
109
|
-
* 6: <=
|
|
110
|
-
* 7: LIKE
|
|
111
|
-
* 8: NOT LIKE
|
|
112
|
-
* 9: IN
|
|
113
|
-
* 10: NOT IN
|
|
114
|
-
*/
|
|
115
|
-
const compareOptions1 = computed(function () {
|
|
116
|
-
|
|
117
|
-
// 如果类型为 文字
|
|
118
|
-
// --------------------------------------------------
|
|
119
|
-
if (props.data.type === 'text') {
|
|
120
|
-
|
|
121
|
-
// 相同 不同 包含 不含
|
|
122
|
-
return [
|
|
123
|
-
{ label: '相同', value: dicts.SEARCH_TYPE__EQUAL },
|
|
124
|
-
{ label: '不同', value: dicts.SEARCH_TYPE__NOT_EQUAL },
|
|
125
|
-
{ label: '包含', value: dicts.SEARCH_TYPE__LIKE },
|
|
126
|
-
{ label: '不含', value: dicts.SEARCH_TYPE__NOT_LIKE },
|
|
127
|
-
{ label: 'IN', value: dicts.SEARCH_TYPE__IN },
|
|
128
|
-
{ label: 'NOT IN', value: dicts.SEARCH_TYPE__NOT_IN },
|
|
129
|
-
]
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// 否则为数字
|
|
133
|
-
// --------------------------------------------------
|
|
134
|
-
const opts = [
|
|
135
|
-
{ label: '=', value: dicts.SEARCH_TYPE__EQUAL },
|
|
136
|
-
{ label: '!=', value: dicts.SEARCH_TYPE__NOT_EQUAL },
|
|
137
|
-
{ label: '>', value: dicts.SEARCH_TYPE__GT },
|
|
138
|
-
{ label: '≥', value: dicts.SEARCH_TYPE__GTE },
|
|
139
|
-
]
|
|
140
|
-
|
|
141
|
-
// 如果类型为日期
|
|
142
|
-
if (props.data.type === 'date') {
|
|
143
|
-
// 添加日期快捷选项
|
|
144
|
-
utils.forEach(quickRange, function(label, key) {
|
|
145
|
-
opts.push({ label, value: key + 20 })
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
// 否则类型为 数字
|
|
149
|
-
} else {
|
|
150
|
-
opts.push(
|
|
151
|
-
{ label: 'IN', value: dicts.SEARCH_TYPE__IN },
|
|
152
|
-
{ label: 'NOT IN', value: dicts.SEARCH_TYPE__NOT_IN },
|
|
153
|
-
)
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return opts
|
|
157
|
-
})
|
|
158
|
-
|
|
159
98
|
// ==========【监听数据】=========================================================================================
|
|
160
99
|
|
|
161
100
|
/**
|
|
162
|
-
*
|
|
101
|
+
* 监听值的比较类型
|
|
163
102
|
*/
|
|
164
|
-
watch(()=>props.modelValue[0].
|
|
103
|
+
watch(()=>props.modelValue[0].compare, function(val) {
|
|
165
104
|
// 如果类型不为 in / not in, 为单选
|
|
166
|
-
if (utils.indexOf([dicts.
|
|
105
|
+
if (utils.indexOf([dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN], val) === -1) {
|
|
167
106
|
const arr = utils.split(props.modelValue[0].value, ',')
|
|
168
107
|
if (arr.length !== 1) {
|
|
169
108
|
// 克隆值
|
|
@@ -175,13 +114,6 @@ export default {
|
|
|
175
114
|
}
|
|
176
115
|
}
|
|
177
116
|
})
|
|
178
|
-
|
|
179
|
-
// ==========【返回】=============================================================================================
|
|
180
|
-
|
|
181
|
-
return {
|
|
182
|
-
// 比较下拉列表1
|
|
183
|
-
compareOptions1,
|
|
184
|
-
}
|
|
185
117
|
},
|
|
186
118
|
}
|
|
187
119
|
</script>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- 拆分器 -->
|
|
3
3
|
<q-splitter
|
|
4
|
+
class="n-splitter"
|
|
5
|
+
:class="currentClass"
|
|
4
6
|
v-model="currentValue"
|
|
5
7
|
v-bind="$attrs"
|
|
6
|
-
v-if="$slots.before && $slots.after"
|
|
7
8
|
>
|
|
8
9
|
<!-- 插槽 -->
|
|
9
10
|
<template
|
|
@@ -13,23 +14,11 @@
|
|
|
13
14
|
<slot :name="slotName" />
|
|
14
15
|
</template>
|
|
15
16
|
</q-splitter>
|
|
16
|
-
|
|
17
|
-
<!-- before 插槽 -->
|
|
18
|
-
<slot
|
|
19
|
-
name="before"
|
|
20
|
-
v-else-if="$slots.before"
|
|
21
|
-
/>
|
|
22
|
-
|
|
23
|
-
<!-- after 插槽 -->
|
|
24
|
-
<slot
|
|
25
|
-
name="after"
|
|
26
|
-
v-else-if="$slots.after"
|
|
27
|
-
/>
|
|
28
|
-
|
|
29
17
|
</template>
|
|
30
18
|
|
|
31
19
|
<script>
|
|
32
|
-
import { computed, ref, watch } from 'vue'
|
|
20
|
+
import { computed, ref, watch, inject } from 'vue'
|
|
21
|
+
import { NPowerKey } from '../../utils/symbols'
|
|
33
22
|
|
|
34
23
|
export default {
|
|
35
24
|
|
|
@@ -47,6 +36,21 @@ export default {
|
|
|
47
36
|
type: Number,
|
|
48
37
|
required: true,
|
|
49
38
|
},
|
|
39
|
+
// 显示前置插槽
|
|
40
|
+
showBefore: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: true,
|
|
43
|
+
},
|
|
44
|
+
// 显示后置插槽
|
|
45
|
+
showAfter: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true,
|
|
48
|
+
},
|
|
49
|
+
// 是否开启缓存
|
|
50
|
+
cache: {
|
|
51
|
+
type: [Boolean, String],
|
|
52
|
+
default: true,
|
|
53
|
+
},
|
|
50
54
|
},
|
|
51
55
|
|
|
52
56
|
/**
|
|
@@ -67,13 +71,79 @@ export default {
|
|
|
67
71
|
* 插槽标识
|
|
68
72
|
*/
|
|
69
73
|
const slotNames = computed(function() {
|
|
70
|
-
|
|
74
|
+
|
|
75
|
+
const keys = []
|
|
76
|
+
|
|
77
|
+
if (utils.isValidObject(slots)) {
|
|
78
|
+
for (const key in slots) {
|
|
79
|
+
if (key === 'before') {
|
|
80
|
+
if (props.showBefore) {
|
|
81
|
+
keys.push(key)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
} else if (key === 'after') {
|
|
85
|
+
if (props.showAfter) {
|
|
86
|
+
keys.push(key)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
} else {
|
|
90
|
+
keys.push(key)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return keys
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 当前样式
|
|
100
|
+
*/
|
|
101
|
+
const currentClass = computed(function () {
|
|
102
|
+
|
|
103
|
+
if (props.showBefore) {
|
|
104
|
+
if (! props.showAfter) {
|
|
105
|
+
return 'n-splitter--hide-before'
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
} else if (props.showAfter) {
|
|
109
|
+
if (! props.showBefore) {
|
|
110
|
+
return 'n-splitter--hide-after'
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
} else {
|
|
114
|
+
return 'n-splitter--hide'
|
|
115
|
+
}
|
|
71
116
|
})
|
|
72
117
|
|
|
73
118
|
// ==========【数据】============================================================================================
|
|
74
119
|
|
|
120
|
+
// 获取权限注入
|
|
121
|
+
const $power = inject(NPowerKey)
|
|
122
|
+
|
|
123
|
+
// 缓存名
|
|
124
|
+
let cacheName = ''
|
|
125
|
+
|
|
126
|
+
// 初始值
|
|
127
|
+
let rawValue = props.modelValue
|
|
128
|
+
|
|
129
|
+
// 如果开启缓存
|
|
130
|
+
if (props.cache) {
|
|
131
|
+
|
|
132
|
+
// 设置缓存名
|
|
133
|
+
cacheName = `splitter:value:${props.cache === true ? ($power && $power.routePath ? $power.routePath : utils.router.getRoute('path')) : props.cache}`
|
|
134
|
+
|
|
135
|
+
// 从缓存获取初始值
|
|
136
|
+
const cache = utils.storage.get(cacheName)
|
|
137
|
+
if (cache) {
|
|
138
|
+
rawValue = cache
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
75
142
|
// 当前值
|
|
76
|
-
const currentValue = ref(
|
|
143
|
+
const currentValue = ref(rawValue)
|
|
144
|
+
|
|
145
|
+
// 创建防抖睡眠方法
|
|
146
|
+
const sleep = utils.debounceSleep()
|
|
77
147
|
|
|
78
148
|
// ==========【监听数据】=========================================================================================
|
|
79
149
|
|
|
@@ -81,10 +151,8 @@ export default {
|
|
|
81
151
|
* 监听声明值
|
|
82
152
|
*/
|
|
83
153
|
watch(()=>props.modelValue, function (val) {
|
|
84
|
-
|
|
85
154
|
// 如果值有变化
|
|
86
155
|
if (val !== currentValue.value) {
|
|
87
|
-
|
|
88
156
|
// 更新当前值
|
|
89
157
|
currentValue.value = val
|
|
90
158
|
}
|
|
@@ -97,6 +165,17 @@ export default {
|
|
|
97
165
|
|
|
98
166
|
// 更新值
|
|
99
167
|
emit('update:modelValue', val)
|
|
168
|
+
|
|
169
|
+
// 如果开启缓存
|
|
170
|
+
if (props.cache) {
|
|
171
|
+
|
|
172
|
+
// 延迟执行
|
|
173
|
+
sleep(500)
|
|
174
|
+
.then(function () {
|
|
175
|
+
// 设置缓存(永久缓存)
|
|
176
|
+
utils.storage.set(cacheName, val, 0)
|
|
177
|
+
})
|
|
178
|
+
}
|
|
100
179
|
})
|
|
101
180
|
|
|
102
181
|
// ==========【返回】=============================================================================================
|
|
@@ -106,7 +185,68 @@ export default {
|
|
|
106
185
|
slotNames,
|
|
107
186
|
// 当前值
|
|
108
187
|
currentValue,
|
|
188
|
+
// 当前样式
|
|
189
|
+
currentClass,
|
|
109
190
|
}
|
|
110
191
|
}
|
|
111
192
|
}
|
|
112
193
|
</script>
|
|
194
|
+
|
|
195
|
+
<style lang="scss">
|
|
196
|
+
@import "@/assets/sass/var.scss";
|
|
197
|
+
|
|
198
|
+
.n-splitter {
|
|
199
|
+
|
|
200
|
+
// 分离器激活背景色
|
|
201
|
+
&.q-splitter--active .q-splitter__separator ,
|
|
202
|
+
.q-splitter__separator:hover {
|
|
203
|
+
background-color: var(--q-primary);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// 隐藏前置插槽
|
|
207
|
+
&--hide-before {
|
|
208
|
+
&.q-splitter--horizontal {
|
|
209
|
+
.q-splitter__before {
|
|
210
|
+
height: 100% !important;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
&.q-splitter--vertical {
|
|
214
|
+
.q-splitter__before {
|
|
215
|
+
width: 100% !important;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
.q-splitter__after,
|
|
219
|
+
.q-splitter__separator {
|
|
220
|
+
display: none !important;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// 隐藏后置插槽
|
|
225
|
+
&--hide-after {
|
|
226
|
+
&.q-splitter--horizontal {
|
|
227
|
+
.q-splitter__after {
|
|
228
|
+
height: 100% !important;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
&.q-splitter--vertical {
|
|
232
|
+
.q-splitter__after {
|
|
233
|
+
width: 100% !important;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
.q-splitter__before,
|
|
237
|
+
.q-splitter__separator {
|
|
238
|
+
display: none !important;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// 隐藏前后置插槽
|
|
243
|
+
&--hide {
|
|
244
|
+
.q-splitter__before,
|
|
245
|
+
.q-splitter__after,
|
|
246
|
+
.q-splitter__separator {
|
|
247
|
+
display: none !important;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
</style>
|
|
252
|
+
|
|
@@ -11,18 +11,28 @@
|
|
|
11
11
|
<n-toolbar
|
|
12
12
|
:dense="dense"
|
|
13
13
|
header
|
|
14
|
-
|
|
14
|
+
>
|
|
15
|
+
<!-- 插槽 -->
|
|
16
|
+
<template
|
|
17
|
+
v-for="slotName in slotNames.toolbar"
|
|
18
|
+
v-slot:[slotName]
|
|
19
|
+
>
|
|
20
|
+
<slot :name="`toolbar-${slotName}`"/>
|
|
21
|
+
</template>
|
|
22
|
+
</n-toolbar>
|
|
15
23
|
|
|
16
24
|
<!-- 左侧分类 -->
|
|
25
|
+
<slot name="left-drawer" v-if="slotNames.leftDrawer" />
|
|
17
26
|
<n-drawer
|
|
18
|
-
:model-value="
|
|
27
|
+
:model-value="! hideLeftDrawer"
|
|
19
28
|
:side="treeSide"
|
|
20
29
|
:width="200"
|
|
21
30
|
:min-width="150"
|
|
22
31
|
bordered
|
|
23
32
|
drag
|
|
24
33
|
cache
|
|
25
|
-
v-
|
|
34
|
+
v-bind="leftDrawerProps"
|
|
35
|
+
v-else-if="treeNodes.length"
|
|
26
36
|
>
|
|
27
37
|
<q-scroll-area class="absolute-full">
|
|
28
38
|
|
|
@@ -50,6 +60,7 @@
|
|
|
50
60
|
v-model:selected="treeSelected"
|
|
51
61
|
no-selection-unset
|
|
52
62
|
default-expand-all
|
|
63
|
+
v-bind="treeProps"
|
|
53
64
|
/>
|
|
54
65
|
|
|
55
66
|
</q-scroll-area>
|
|
@@ -70,6 +81,7 @@
|
|
|
70
81
|
:columns="tableColumns"
|
|
71
82
|
:visible-columns="tableVisibleColumns"
|
|
72
83
|
:selection="tableSelection"
|
|
84
|
+
:separator="tableSeparator"
|
|
73
85
|
:loading="tableLoading"
|
|
74
86
|
:rows-per-page-options="tableRowsPerPageOptions"
|
|
75
87
|
:grid="tableGrid"
|
|
@@ -79,6 +91,7 @@
|
|
|
79
91
|
flat
|
|
80
92
|
virtual-scroll
|
|
81
93
|
:dense="dense"
|
|
94
|
+
v-bind="tableProps"
|
|
82
95
|
>
|
|
83
96
|
<!-- 图片 -->
|
|
84
97
|
<template
|
|
@@ -96,7 +109,7 @@
|
|
|
96
109
|
|
|
97
110
|
<!-- 插槽 -->
|
|
98
111
|
<template
|
|
99
|
-
v-for="slotName in slotNames"
|
|
112
|
+
v-for="slotName in slotNames.table"
|
|
100
113
|
v-slot:[slotName]="props"
|
|
101
114
|
>
|
|
102
115
|
<q-td :props="props">
|
|
@@ -132,14 +145,16 @@
|
|
|
132
145
|
</q-page-container>
|
|
133
146
|
|
|
134
147
|
<!-- 右侧搜索 -->
|
|
148
|
+
<slot name="right-drawer" v-if="slotNames.rightDrawer" />
|
|
135
149
|
<n-drawer
|
|
136
|
-
:model-value="
|
|
150
|
+
:model-value="! hideRightDrawer"
|
|
137
151
|
:side="searchSide"
|
|
138
152
|
:min-width="320"
|
|
139
153
|
bordered
|
|
140
154
|
drag
|
|
141
155
|
cache
|
|
142
|
-
v-
|
|
156
|
+
v-bind="rightDrawerProps"
|
|
157
|
+
v-else-if="! noSearch && tableSearchValue.length"
|
|
143
158
|
>
|
|
144
159
|
<!-- 搜索 -->
|
|
145
160
|
<n-search
|
|
@@ -147,8 +162,17 @@
|
|
|
147
162
|
:options="tableSearchOptions"
|
|
148
163
|
:on-search="tableReload"
|
|
149
164
|
:on-reset="tableSearchReset"
|
|
150
|
-
|
|
165
|
+
>
|
|
166
|
+
<!-- 插槽 -->
|
|
167
|
+
<template
|
|
168
|
+
v-for="slotName in slotNames.search"
|
|
169
|
+
v-slot:[slotName]
|
|
170
|
+
>
|
|
171
|
+
<slot :name="`search-${slotName}`"/>
|
|
172
|
+
</template>
|
|
173
|
+
</n-search>
|
|
151
174
|
</n-drawer>
|
|
175
|
+
|
|
152
176
|
</q-layout>
|
|
153
177
|
</template>
|
|
154
178
|
|
|
@@ -170,6 +194,10 @@ export default {
|
|
|
170
194
|
props: {
|
|
171
195
|
// 表格请求地址
|
|
172
196
|
url: String,
|
|
197
|
+
// 表格声明属性
|
|
198
|
+
tableProps: Object,
|
|
199
|
+
// 树声明属性
|
|
200
|
+
treeProps: Object,
|
|
173
201
|
// 树节点唯一键值
|
|
174
202
|
treeNodeKey: {
|
|
175
203
|
type: String,
|
|
@@ -189,13 +217,13 @@ export default {
|
|
|
189
217
|
treeNodeClick: Function,
|
|
190
218
|
// 显示树筛选
|
|
191
219
|
treeFilter: Boolean,
|
|
192
|
-
// 不显示搜索
|
|
193
|
-
noSearch: Boolean,
|
|
194
220
|
// 树位置
|
|
195
221
|
treeSide: {
|
|
196
222
|
type: String,
|
|
197
223
|
default: 'left',
|
|
198
224
|
},
|
|
225
|
+
// 不显示搜索
|
|
226
|
+
noSearch: Boolean,
|
|
199
227
|
// 搜索位置
|
|
200
228
|
searchSide: {
|
|
201
229
|
type: String,
|
|
@@ -206,6 +234,14 @@ export default {
|
|
|
206
234
|
type: Boolean,
|
|
207
235
|
default: true,
|
|
208
236
|
},
|
|
237
|
+
// 隐藏左边侧滑菜单
|
|
238
|
+
hideLeftDrawer: Boolean,
|
|
239
|
+
// 左边侧滑菜单声明属性
|
|
240
|
+
leftDrawerProps: Object,
|
|
241
|
+
// 隐藏右边侧滑菜单
|
|
242
|
+
hideRightDrawer: Boolean,
|
|
243
|
+
// 右边侧滑菜单声明属性
|
|
244
|
+
rightDrawerProps: Object,
|
|
209
245
|
},
|
|
210
246
|
|
|
211
247
|
/**
|
|
@@ -233,7 +269,7 @@ export default {
|
|
|
233
269
|
// 对话框中的表格双击表格行
|
|
234
270
|
currentTableRowDblclick = function (e, row) {
|
|
235
271
|
// 如果不是多选
|
|
236
|
-
if ($table.tableSelection !== 'multiple') {
|
|
272
|
+
if ($table.tableSelection.value !== 'multiple') {
|
|
237
273
|
$table.tableSelected.value = [ row ]
|
|
238
274
|
$dialog.confirm()
|
|
239
275
|
}
|
|
@@ -259,7 +295,37 @@ export default {
|
|
|
259
295
|
* 插槽标识
|
|
260
296
|
*/
|
|
261
297
|
const slotNames = computed(function() {
|
|
262
|
-
|
|
298
|
+
|
|
299
|
+
const toolbar = []
|
|
300
|
+
const search = []
|
|
301
|
+
const table = []
|
|
302
|
+
let leftDrawer = false
|
|
303
|
+
let rightDrawer = false
|
|
304
|
+
|
|
305
|
+
// 如果有插槽
|
|
306
|
+
if (utils.isValidObject(slots)) {
|
|
307
|
+
for (const key in slots) {
|
|
308
|
+
if (key.startsWith('toolbar-')) {
|
|
309
|
+
toolbar.push(key.replace('toolbar-', ''))
|
|
310
|
+
} else if (key.startsWith('search-')) {
|
|
311
|
+
search.push(key.replace('search-', ''))
|
|
312
|
+
} else if (key === 'left-drawer') {
|
|
313
|
+
leftDrawer = true
|
|
314
|
+
} else if (key === 'right-drawer') {
|
|
315
|
+
rightDrawer = true
|
|
316
|
+
} else {
|
|
317
|
+
table.push(key)
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return {
|
|
323
|
+
toolbar,
|
|
324
|
+
search,
|
|
325
|
+
table,
|
|
326
|
+
leftDrawer,
|
|
327
|
+
rightDrawer,
|
|
328
|
+
}
|
|
263
329
|
})
|
|
264
330
|
|
|
265
331
|
// ==========【监听数据】=========================================================================================
|
package/package.json
CHANGED
package/utils/$power.js
CHANGED
|
@@ -55,6 +55,9 @@ function create(params) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
// 获取当前路由
|
|
59
|
+
const $currentRoute = utils.router.getRoute()
|
|
60
|
+
|
|
58
61
|
// 权限路由
|
|
59
62
|
let $route
|
|
60
63
|
|
|
@@ -85,7 +88,7 @@ function create(params) {
|
|
|
85
88
|
|
|
86
89
|
// 否则获取当前路由
|
|
87
90
|
} else {
|
|
88
|
-
$route =
|
|
91
|
+
$route = $currentRoute
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
// quasar 对象
|
|
@@ -255,8 +258,10 @@ function create(params) {
|
|
|
255
258
|
await request({
|
|
256
259
|
// 按钮数据
|
|
257
260
|
data,
|
|
258
|
-
//
|
|
261
|
+
// 权限路由参数
|
|
259
262
|
$route,
|
|
263
|
+
// 当前路由参数
|
|
264
|
+
$currentRoute,
|
|
260
265
|
// 表格选中数据
|
|
261
266
|
tableSelected,
|
|
262
267
|
// 表格实例
|
|
@@ -784,7 +789,10 @@ async function request(params) {
|
|
|
784
789
|
}, params)
|
|
785
790
|
|
|
786
791
|
const {
|
|
792
|
+
// 权限路由参数
|
|
787
793
|
$route,
|
|
794
|
+
// 当前路由参数
|
|
795
|
+
$currentRoute,
|
|
788
796
|
} = params
|
|
789
797
|
|
|
790
798
|
o.query = $route.query
|
|
@@ -802,6 +810,9 @@ async function request(params) {
|
|
|
802
810
|
return
|
|
803
811
|
}
|
|
804
812
|
|
|
813
|
+
// 克隆 data
|
|
814
|
+
o.data = _.cloneDeep(o.data)
|
|
815
|
+
|
|
805
816
|
// 判断 url
|
|
806
817
|
o.data.url = _.toLower(utils.trimString(o.data.url))
|
|
807
818
|
if (! o.data.url) {
|
|
@@ -844,7 +855,8 @@ async function request(params) {
|
|
|
844
855
|
|
|
845
856
|
// 如果有增加来源页面参数
|
|
846
857
|
if (_.get(o.data, 'addFromPageQuery') === true) {
|
|
847
|
-
|
|
858
|
+
// 来源页面是当前路由的完整路径
|
|
859
|
+
query.n_frompage = encodeURIComponent($currentRoute.fullPath)
|
|
848
860
|
}
|
|
849
861
|
|
|
850
862
|
utils.router.push({
|
|
@@ -953,10 +965,17 @@ async function request(params) {
|
|
|
953
965
|
})
|
|
954
966
|
|
|
955
967
|
// 返回结果数据
|
|
956
|
-
const resultData = Object.assign({
|
|
957
|
-
|
|
968
|
+
const resultData = Object.assign({
|
|
969
|
+
// 参数
|
|
970
|
+
options: o,
|
|
971
|
+
// 请求数据
|
|
958
972
|
requestData,
|
|
959
|
-
})
|
|
973
|
+
}, res)
|
|
974
|
+
|
|
975
|
+
// 请求后执行
|
|
976
|
+
if (await utils.runAsync(o.requestAfter)(resultData) === false) {
|
|
977
|
+
return
|
|
978
|
+
}
|
|
960
979
|
|
|
961
980
|
// 如果请求成功
|
|
962
981
|
if (res.status) {
|
|
@@ -1025,8 +1044,7 @@ async function request(params) {
|
|
|
1025
1044
|
}
|
|
1026
1045
|
|
|
1027
1046
|
// 请求成功执行
|
|
1028
|
-
|
|
1029
|
-
if (res === false) {
|
|
1047
|
+
if (await utils.runAsync(o.requestSuccess)(Object.assign({ next }, resultData)) === false) {
|
|
1030
1048
|
return
|
|
1031
1049
|
}
|
|
1032
1050
|
|
|
@@ -1037,9 +1055,6 @@ async function request(params) {
|
|
|
1037
1055
|
// 请求失败执行
|
|
1038
1056
|
utils.run(o.requestFail)(resultData)
|
|
1039
1057
|
}
|
|
1040
|
-
|
|
1041
|
-
// 请求后执行
|
|
1042
|
-
utils.run(o.requestAfter)(resultData)
|
|
1043
1058
|
}
|
|
1044
1059
|
}
|
|
1045
1060
|
|
package/utils/$search.js
CHANGED
|
@@ -1,18 +1,96 @@
|
|
|
1
1
|
import { date as quasarDate } from 'quasar'
|
|
2
|
-
import { getQuickRange } from '../components/field-date/methods'
|
|
2
|
+
import { getQuickRange, quickRange } from '../components/field-date/methods'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* 比较类型默认值
|
|
6
6
|
*/
|
|
7
7
|
const COMPARE_TYPE_MAPS = {
|
|
8
8
|
// 数字
|
|
9
|
-
number:
|
|
9
|
+
number: dicts.SEARCH_COMPARE_TYPE__EQUAL,
|
|
10
10
|
// 文字
|
|
11
|
-
text:
|
|
11
|
+
text: dicts.SEARCH_COMPARE_TYPE__LIKE,
|
|
12
12
|
// 价格
|
|
13
|
-
price:
|
|
13
|
+
price: dicts.SEARCH_COMPARE_TYPE__EQUAL,
|
|
14
14
|
// 日期
|
|
15
|
-
date:
|
|
15
|
+
date: dicts.SEARCH_COMPARE_TYPE__EQUAL,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 设置单个比较条件
|
|
20
|
+
*/
|
|
21
|
+
function setItemCompare(item) {
|
|
22
|
+
|
|
23
|
+
// 初始比较条件数组
|
|
24
|
+
let opts1 = item.type === 'text'
|
|
25
|
+
// 如果类型为 文字
|
|
26
|
+
? [
|
|
27
|
+
{ label: '相同', value: dicts.SEARCH_COMPARE_TYPE__EQUAL },
|
|
28
|
+
{ label: '不同', value: dicts.SEARCH_COMPARE_TYPE__NOT_EQUAL },
|
|
29
|
+
{ label: '包含', value: dicts.SEARCH_COMPARE_TYPE__LIKE },
|
|
30
|
+
{ label: '不含', value: dicts.SEARCH_COMPARE_TYPE__NOT_LIKE },
|
|
31
|
+
]
|
|
32
|
+
// 否则为数字
|
|
33
|
+
: [
|
|
34
|
+
{ label: '=', value: dicts.SEARCH_COMPARE_TYPE__EQUAL },
|
|
35
|
+
{ label: '!=', value: dicts.SEARCH_COMPARE_TYPE__NOT_EQUAL },
|
|
36
|
+
{ label: '>', value: dicts.SEARCH_COMPARE_TYPE__GT },
|
|
37
|
+
{ label: '≥', value: dicts.SEARCH_COMPARE_TYPE__GTE },
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
// 如果类型为日期
|
|
41
|
+
if (item.type === 'date') {
|
|
42
|
+
// 添加日期快捷选项
|
|
43
|
+
utils.forEach(quickRange, function(label, key) {
|
|
44
|
+
opts1.push({ label, value: key + 20 })
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
// 否则为其他
|
|
48
|
+
} else {
|
|
49
|
+
opts1.push(
|
|
50
|
+
{ label: 'IN', value: dicts.SEARCH_COMPARE_TYPE__IN },
|
|
51
|
+
{ label: 'NOT IN', value: dicts.SEARCH_COMPARE_TYPE__NOT_IN },
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 如果有比较类型
|
|
56
|
+
if (
|
|
57
|
+
_.has(item, 'compare')
|
|
58
|
+
&& utils.isValidArray(item.compare)
|
|
59
|
+
) {
|
|
60
|
+
const {
|
|
61
|
+
compare,
|
|
62
|
+
compareIgnore
|
|
63
|
+
} = item
|
|
64
|
+
|
|
65
|
+
// 如果有筛选比较条件
|
|
66
|
+
// 筛选比较条件
|
|
67
|
+
opts1 = opts1.filter(
|
|
68
|
+
compareIgnore === true
|
|
69
|
+
// 如果为忽略比较条件
|
|
70
|
+
? e => compare.indexOf(e.value) === -1
|
|
71
|
+
// 否则为限制比较条件
|
|
72
|
+
: e => compare.indexOf(e.value) > -1
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// 如果没有比较选项, 则设置相同为默认
|
|
77
|
+
if (! opts1.length) {
|
|
78
|
+
opts1.push({ label: type === 'text' ? '相同' : '=', value: dicts.SEARCH_COMPARE_TYPE__EQUAL })
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// 值1 比较类型条件
|
|
82
|
+
item.compareOptions1 = opts1
|
|
83
|
+
// 值2 比较类型条件
|
|
84
|
+
item.compareOptions2 = []
|
|
85
|
+
|
|
86
|
+
// 如果比较类型有 >
|
|
87
|
+
if (_.findIndex(opts1, { value: dicts.SEARCH_COMPARE_TYPE__GT }) > -1) {
|
|
88
|
+
item.compareOptions2.push({ label: '<', value: dicts.SEARCH_COMPARE_TYPE__LT })
|
|
89
|
+
|
|
90
|
+
// 如果比较类型有 >=
|
|
91
|
+
} else if (_.findIndex(opts1, { value: dicts.SEARCH_COMPARE_TYPE__GTE }) > -1) {
|
|
92
|
+
item.compareOptions2.push({ label: '≤', value: dicts.SEARCH_COMPARE_TYPE__LTE })
|
|
93
|
+
}
|
|
16
94
|
}
|
|
17
95
|
|
|
18
96
|
/**
|
|
@@ -23,26 +101,61 @@ export function setItemValue(value, val) {
|
|
|
23
101
|
// 如果值为数组
|
|
24
102
|
if (Array.isArray(val)) {
|
|
25
103
|
// 比较类型为 in
|
|
26
|
-
value[0].
|
|
104
|
+
value[0].compare = dicts.SEARCH_COMPARE_TYPE__IN
|
|
27
105
|
// 设置值为将数组转为逗号分隔的字符串
|
|
28
106
|
value[0].value = utils.join(val, ',')
|
|
29
107
|
|
|
30
108
|
// 如果值是逗号隔开
|
|
31
109
|
} else if (utils.split(val, ',').length > 1) {
|
|
32
110
|
// 比较类型为 in
|
|
33
|
-
value[0].
|
|
111
|
+
value[0].compare = dicts.SEARCH_COMPARE_TYPE__IN
|
|
34
112
|
// 设置值为将数组转为逗号分隔的字符串
|
|
35
113
|
value[0].value = val
|
|
36
114
|
|
|
37
115
|
// 否则为单个值
|
|
38
116
|
} else {
|
|
39
117
|
// 比较类型为 ==
|
|
40
|
-
value[0].
|
|
118
|
+
value[0].compare = dicts.SEARCH_COMPARE_TYPE__EQUAL
|
|
41
119
|
// 设置值为当前值
|
|
42
120
|
value[0].value = val
|
|
43
121
|
}
|
|
44
122
|
}
|
|
45
123
|
|
|
124
|
+
/**
|
|
125
|
+
* 格式化单个比较条件
|
|
126
|
+
*/
|
|
127
|
+
function formatItemValueCompare(value, { compareOptions1 }) {
|
|
128
|
+
|
|
129
|
+
// 获取第一个值
|
|
130
|
+
const value1 = value[0]
|
|
131
|
+
|
|
132
|
+
// 如果值1 的比较条件不在值1 的限制范围内
|
|
133
|
+
if (_.findIndex(compareOptions1, { value: value1.compare }) === -1) {
|
|
134
|
+
// 则取比较条件中的第一个
|
|
135
|
+
value1.compare = compareOptions1[0].value
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// 如果比较类型不为 in / not in
|
|
139
|
+
if (utils.indexOf([ dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN ], value1.compare) === -1) {
|
|
140
|
+
// 如果值中含有逗号
|
|
141
|
+
const arr = utils.split(value1.value, ',')
|
|
142
|
+
if (arr.length > 1) {
|
|
143
|
+
value1.value = arr[0]
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// 如果值1 比较类型为 >
|
|
148
|
+
if (value1.compare === dicts.SEARCH_COMPARE_TYPE__GT) {
|
|
149
|
+
// 则修改值2 类型为 <
|
|
150
|
+
value[1].compare = dicts.SEARCH_COMPARE_TYPE__LT
|
|
151
|
+
|
|
152
|
+
// 如果值1 比较类型为 >=
|
|
153
|
+
} else if (value1.compare === dicts.SEARCH_COMPARE_TYPE__GTE) {
|
|
154
|
+
// 则修改值2 类型为 <=
|
|
155
|
+
value[1].compare = dicts.SEARCH_COMPARE_TYPE__LTE
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
46
159
|
/**
|
|
47
160
|
* 从表格列获取原始值
|
|
48
161
|
*/
|
|
@@ -80,6 +193,9 @@ function getRawData(tableColumns, query, searchFromQuery = true) {
|
|
|
80
193
|
newItem.dict = item.dict
|
|
81
194
|
}
|
|
82
195
|
|
|
196
|
+
// 设置单个比较条件
|
|
197
|
+
setItemCompare(newItem)
|
|
198
|
+
|
|
83
199
|
// 原始表格搜索参数
|
|
84
200
|
rawSearchOptions.push(newItem)
|
|
85
201
|
|
|
@@ -90,21 +206,21 @@ function getRawData(tableColumns, query, searchFromQuery = true) {
|
|
|
90
206
|
// 值1
|
|
91
207
|
{
|
|
92
208
|
// 比较类型
|
|
93
|
-
|
|
209
|
+
compare: COMPARE_TYPE_MAPS[newItem.type],
|
|
94
210
|
// 值
|
|
95
211
|
value: '',
|
|
96
212
|
},
|
|
97
213
|
// 值2
|
|
98
214
|
{
|
|
99
215
|
// 比较类型
|
|
100
|
-
|
|
216
|
+
compare: dicts.SEARCH_COMPARE_TYPE__LT,
|
|
101
217
|
// 值
|
|
102
218
|
value: '',
|
|
103
219
|
},
|
|
104
220
|
]
|
|
105
221
|
|
|
106
222
|
// 如果是日期
|
|
107
|
-
if (
|
|
223
|
+
if (newItem.type === 'date') {
|
|
108
224
|
// 设置日期类型
|
|
109
225
|
value[0].dateType = 'day'
|
|
110
226
|
}
|
|
@@ -128,10 +244,16 @@ function getRawData(tableColumns, query, searchFromQuery = true) {
|
|
|
128
244
|
searchQueryKey.push(newItem.name)
|
|
129
245
|
|
|
130
246
|
// 否则, 如果表格参数中有设置初始值
|
|
131
|
-
} else if (
|
|
132
|
-
|
|
247
|
+
} else if (
|
|
248
|
+
_.has(newItem, 'value')
|
|
249
|
+
&& utils.isValidArray(newItem.value)
|
|
250
|
+
) {
|
|
251
|
+
value = _.merge([], value, newItem.value)
|
|
133
252
|
}
|
|
134
253
|
|
|
254
|
+
// 格式化单个值的比较条件
|
|
255
|
+
formatItemValueCompare(value, newItem)
|
|
256
|
+
|
|
135
257
|
// 首次初始表格搜索值
|
|
136
258
|
firstTableSearchValue.push(value)
|
|
137
259
|
}
|
|
@@ -257,7 +379,7 @@ function formatValue(rawSearchOptions, searchValue) {
|
|
|
257
379
|
if (utils.isValidValue(value1.value)) {
|
|
258
380
|
|
|
259
381
|
// 如果值1 类型为 in / not in
|
|
260
|
-
if (utils.indexOf([dicts.
|
|
382
|
+
if (utils.indexOf([dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN], value1.compare) > -1) {
|
|
261
383
|
const vals = []
|
|
262
384
|
utils.forEach(utils.split(utils.trimString(value1.value).replaceAll(',', ','), ','), function (item) {
|
|
263
385
|
item = utils.numberDeep(item)
|
|
@@ -268,7 +390,7 @@ function formatValue(rawSearchOptions, searchValue) {
|
|
|
268
390
|
if (vals.length) {
|
|
269
391
|
lists.push({
|
|
270
392
|
field: name,
|
|
271
|
-
|
|
393
|
+
compare: value1.compare,
|
|
272
394
|
value: vals,
|
|
273
395
|
})
|
|
274
396
|
}
|
|
@@ -278,7 +400,7 @@ function formatValue(rawSearchOptions, searchValue) {
|
|
|
278
400
|
// 否则添加值1
|
|
279
401
|
lists.push({
|
|
280
402
|
field: name,
|
|
281
|
-
|
|
403
|
+
compare: value1.compare,
|
|
282
404
|
value: utils.numberDeep(value1.value),
|
|
283
405
|
})
|
|
284
406
|
}
|
|
@@ -299,9 +421,9 @@ function formatValue(rawSearchOptions, searchValue) {
|
|
|
299
421
|
// 如果是日期
|
|
300
422
|
type === 'date'
|
|
301
423
|
// 如果类型为快捷日期
|
|
302
|
-
&& value1.
|
|
424
|
+
&& value1.compare >= 20
|
|
303
425
|
) {
|
|
304
|
-
const res = getQuickRange(value1.
|
|
426
|
+
const res = getQuickRange(value1.compare - 20, true)
|
|
305
427
|
if (res) {
|
|
306
428
|
|
|
307
429
|
lists.push(
|
|
@@ -309,14 +431,14 @@ function formatValue(rawSearchOptions, searchValue) {
|
|
|
309
431
|
{
|
|
310
432
|
field: name,
|
|
311
433
|
// ≥
|
|
312
|
-
|
|
434
|
+
compare: dicts.SEARCH_COMPARE_TYPE__GTE,
|
|
313
435
|
value: utils.numberDeep(quasarDate.formatDate(utils.toDate(`${res.date.from} ${res.time.from}`), 'X')),
|
|
314
436
|
},
|
|
315
437
|
// 日期止
|
|
316
438
|
{
|
|
317
439
|
field: name,
|
|
318
440
|
// ≤
|
|
319
|
-
|
|
441
|
+
compare: dicts.SEARCH_COMPARE_TYPE__LTE,
|
|
320
442
|
value: utils.numberDeep(quasarDate.formatDate(utils.toDate(`${res.date.to} ${res.time.to}`), 'X')),
|
|
321
443
|
}
|
|
322
444
|
)
|
|
@@ -328,12 +450,12 @@ function formatValue(rawSearchOptions, searchValue) {
|
|
|
328
450
|
addValue1(value1)
|
|
329
451
|
|
|
330
452
|
// 只有值1 类型为 > / ≥ 值2才有效
|
|
331
|
-
if (utils.indexOf([dicts.
|
|
453
|
+
if (utils.indexOf([dicts.SEARCH_COMPARE_TYPE__GT, dicts.SEARCH_COMPARE_TYPE__GTE], value1.compare) > -1) {
|
|
332
454
|
const value2 = searchValue[itemIndex][1]
|
|
333
455
|
if (utils.isValidValue(value2.value)) {
|
|
334
456
|
lists.push({
|
|
335
457
|
field: name,
|
|
336
|
-
|
|
458
|
+
compare: value2.compare,
|
|
337
459
|
value: utils.numberDeep(value2.value),
|
|
338
460
|
})
|
|
339
461
|
}
|
package/utils/$table.js
CHANGED
|
@@ -37,6 +37,8 @@ function create(params) {
|
|
|
37
37
|
rowKey: 'id',
|
|
38
38
|
// 选择类型, 可选值 single multiple none
|
|
39
39
|
selection: 'multiple',
|
|
40
|
+
// 分隔栏, 可选值 horizontal vertical cell none
|
|
41
|
+
separator: 'cell',
|
|
40
42
|
// 已选数据
|
|
41
43
|
selected: [],
|
|
42
44
|
// 表格加载状态
|
|
@@ -198,7 +200,7 @@ function create(params) {
|
|
|
198
200
|
})
|
|
199
201
|
|
|
200
202
|
// 获取可见列缓存
|
|
201
|
-
const visibleColumnsCache = o.showVisibleColumns && isCache ? utils.storage.get('
|
|
203
|
+
const visibleColumnsCache = o.showVisibleColumns && isCache ? utils.storage.get('table:visible_columns:' + cacheName) : []
|
|
202
204
|
|
|
203
205
|
// 表格可见列
|
|
204
206
|
const tableVisibleColumns = ref(Array.isArray(visibleColumnsCache) ? visibleColumnsCache : _.uniq([...o.visibleColumns]))
|
|
@@ -213,7 +215,7 @@ function create(params) {
|
|
|
213
215
|
const tablePagination = ref($route.fullPath ? o.pagination : {})
|
|
214
216
|
|
|
215
217
|
// 表格宫格
|
|
216
|
-
const tableGrid = ref(o.showGrid && isCache ? utils.storage.get('
|
|
218
|
+
const tableGrid = ref(o.showGrid && isCache ? utils.storage.get('table:grid:' + cacheName) === true : false)
|
|
217
219
|
|
|
218
220
|
// 表格传参
|
|
219
221
|
const tableQuery = ref({})
|
|
@@ -227,6 +229,12 @@ function create(params) {
|
|
|
227
229
|
// 表格合计
|
|
228
230
|
const tableSummary = ref(null)
|
|
229
231
|
|
|
232
|
+
// 表格选择类型
|
|
233
|
+
const tableSelection = ref(o.selection)
|
|
234
|
+
|
|
235
|
+
// 表格分隔栏
|
|
236
|
+
const tableSeparator = ref(o.separator)
|
|
237
|
+
|
|
230
238
|
const {
|
|
231
239
|
// 原始参数
|
|
232
240
|
rawQuery,
|
|
@@ -304,7 +312,7 @@ function create(params) {
|
|
|
304
312
|
|
|
305
313
|
// 设置宫格模式缓存(永久缓存)
|
|
306
314
|
// #if ! IS_DEV
|
|
307
|
-
utils.storage.set('
|
|
315
|
+
utils.storage.set('table:grid:' + cacheName, val, 0)
|
|
308
316
|
// #endif
|
|
309
317
|
})
|
|
310
318
|
}
|
|
@@ -317,7 +325,7 @@ function create(params) {
|
|
|
317
325
|
|
|
318
326
|
// 设置可见列缓存(永久缓存)
|
|
319
327
|
// #if ! IS_DEV
|
|
320
|
-
utils.storage.set('
|
|
328
|
+
utils.storage.set('table:visible_columns:' + cacheName, val, 0)
|
|
321
329
|
// #endif
|
|
322
330
|
})
|
|
323
331
|
}
|
|
@@ -402,11 +410,11 @@ function create(params) {
|
|
|
402
410
|
if (hasNSearch && _.has(query.n_search, item.name)) {
|
|
403
411
|
const newSearchItem = query.n_search[item.name]
|
|
404
412
|
if (utils.isValidArray(newSearchItem)) {
|
|
405
|
-
valueItem[0].
|
|
413
|
+
valueItem[0].compare = newSearchItem[0].compare
|
|
406
414
|
valueItem[0].value = newSearchItem[0].value
|
|
407
415
|
|
|
408
416
|
if (newSearchItem.length > 1) {
|
|
409
|
-
valueItem[1].
|
|
417
|
+
valueItem[1].compare = newSearchItem[1].compare
|
|
410
418
|
valueItem[1].value = newSearchItem[1].value
|
|
411
419
|
}
|
|
412
420
|
}
|
|
@@ -750,7 +758,7 @@ function create(params) {
|
|
|
750
758
|
function _tableRowClick(e, row) {
|
|
751
759
|
|
|
752
760
|
// 如果选择类型为无
|
|
753
|
-
if (
|
|
761
|
+
if (tableSelection.value === 'none') {
|
|
754
762
|
// 则无任何操作
|
|
755
763
|
return
|
|
756
764
|
}
|
|
@@ -765,7 +773,7 @@ function create(params) {
|
|
|
765
773
|
if (itemIndex === -1) {
|
|
766
774
|
|
|
767
775
|
// 如果选择类型为单选
|
|
768
|
-
if (
|
|
776
|
+
if (tableSelection.value === 'single') {
|
|
769
777
|
tableSelected.value = [ row ]
|
|
770
778
|
|
|
771
779
|
// 否则为多选
|
|
@@ -795,7 +803,7 @@ function create(params) {
|
|
|
795
803
|
function _tableRowDblclick(e, row) {
|
|
796
804
|
|
|
797
805
|
// 如果选择类型为无
|
|
798
|
-
if (
|
|
806
|
+
if (tableSelection.value === 'none') {
|
|
799
807
|
// 则无任何操作
|
|
800
808
|
return
|
|
801
809
|
}
|
|
@@ -860,7 +868,9 @@ function create(params) {
|
|
|
860
868
|
// 表格 id key
|
|
861
869
|
tableRowKey: o.rowKey,
|
|
862
870
|
// 表格选择类型
|
|
863
|
-
tableSelection
|
|
871
|
+
tableSelection,
|
|
872
|
+
// 表格分隔栏
|
|
873
|
+
tableSeparator,
|
|
864
874
|
// 表格每页显示行数选项
|
|
865
875
|
tableRowsPerPageOptions: rowsPerPageOptions,
|
|
866
876
|
// 表格列数据(对象数组)
|
package/utils/$tree.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isRef, watch } from 'vue'
|
|
2
|
+
|
|
2
3
|
import { NPowerKey } from './symbols'
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -280,8 +281,8 @@ function create(params) {
|
|
|
280
281
|
utils.$dialog.create({
|
|
281
282
|
// 标题
|
|
282
283
|
title: `移动至节点的${o.type === 'moveUp' ? '上方' : (o.type === 'moveDown' ? '下方' : '内部')}`,
|
|
284
|
+
// 宽度
|
|
283
285
|
width: 500,
|
|
284
|
-
minWidth: 500,
|
|
285
286
|
// 组件标识
|
|
286
287
|
name: 'moveToTree',
|
|
287
288
|
// 组件参数
|
package/utils/price.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 换算金额
|
|
3
|
-
*/
|
|
4
|
-
utils.price = function(value, params) {
|
|
5
|
-
return utils.decimal(value, Object.assign({
|
|
6
|
-
// 最小值
|
|
7
|
-
min: 0,
|
|
8
|
-
// 小数点位数
|
|
9
|
-
decimalLength: 2,
|
|
10
|
-
// 是否开启人民币分转元(如值 189 -> 1.89)
|
|
11
|
-
centToYuan: utils.config('priceCent') === true,
|
|
12
|
-
}, params))
|
|
13
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 换算金额
|
|
3
|
+
*/
|
|
4
|
+
utils.price = function(value, params) {
|
|
5
|
+
return utils.decimal(value, Object.assign({
|
|
6
|
+
// 最小值
|
|
7
|
+
min: 0,
|
|
8
|
+
// 小数点位数
|
|
9
|
+
decimalLength: 2,
|
|
10
|
+
// 是否开启人民币分转元(如值 189 -> 1.89)
|
|
11
|
+
centToYuan: utils.config('priceCent') === true,
|
|
12
|
+
}, params))
|
|
13
|
+
}
|