@netang/quasar 0.0.34 → 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 +2 -10
- package/components/field-table/index.vue +13 -4
- package/components/search-item/index.vue +13 -81
- package/components/splitter/index.vue +2 -4
- package/components/table/index.vue +2 -1
- 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
|
@@ -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
|
-
let fullPath = ''
|
|
113
|
-
|
|
114
110
|
// 获取权限注入数据
|
|
115
111
|
const $power = inject(NPowerKey)
|
|
116
112
|
|
|
@@ -124,13 +120,9 @@ export default {
|
|
|
124
120
|
} else {
|
|
125
121
|
currentModelValue.value = props.modelValue
|
|
126
122
|
}
|
|
127
|
-
// 权限路由路径
|
|
128
|
-
fullPath = $power.routeFullPath
|
|
129
123
|
|
|
130
124
|
} else {
|
|
131
125
|
currentModelValue = ref(props.modelValue)
|
|
132
|
-
// 当前路由路径
|
|
133
|
-
fullPath = useRoute().fullPath
|
|
134
126
|
}
|
|
135
127
|
|
|
136
128
|
// 创建防抖睡眠方法
|
|
@@ -167,7 +159,7 @@ export default {
|
|
|
167
159
|
} else if (props.drag && props.cache) {
|
|
168
160
|
|
|
169
161
|
// 设置缓存名
|
|
170
|
-
cacheName = `
|
|
162
|
+
cacheName = `drawer:${props.side}:${props.cache === true ? ($power && $power.routePath ? $power.routePath : utils.router.getRoute('path')) : props.cache}`
|
|
171
163
|
|
|
172
164
|
// 从缓存获取宽度
|
|
173
165
|
const cache = utils.storage.get(cacheName)
|
|
@@ -249,7 +241,7 @@ export default {
|
|
|
249
241
|
currentWidth.value = newWidth
|
|
250
242
|
|
|
251
243
|
// 如果开启缓存
|
|
252
|
-
if (props.cache) {
|
|
244
|
+
if (props.drag && props.cache && cacheName) {
|
|
253
245
|
|
|
254
246
|
// 延迟执行
|
|
255
247
|
sleep(500)
|
|
@@ -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>
|
|
@@ -120,9 +120,6 @@ export default {
|
|
|
120
120
|
// 获取权限注入
|
|
121
121
|
const $power = inject(NPowerKey)
|
|
122
122
|
|
|
123
|
-
// 当前路由完整路径
|
|
124
|
-
const fullPath = $power ? $power.routeFullPath : utils.router.getRoute('fullPath')
|
|
125
|
-
|
|
126
123
|
// 缓存名
|
|
127
124
|
let cacheName = ''
|
|
128
125
|
|
|
@@ -131,8 +128,9 @@ export default {
|
|
|
131
128
|
|
|
132
129
|
// 如果开启缓存
|
|
133
130
|
if (props.cache) {
|
|
131
|
+
|
|
134
132
|
// 设置缓存名
|
|
135
|
-
cacheName = `
|
|
133
|
+
cacheName = `splitter:value:${props.cache === true ? ($power && $power.routePath ? $power.routePath : utils.router.getRoute('path')) : props.cache}`
|
|
136
134
|
|
|
137
135
|
// 从缓存获取初始值
|
|
138
136
|
const cache = utils.storage.get(cacheName)
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
:columns="tableColumns"
|
|
82
82
|
:visible-columns="tableVisibleColumns"
|
|
83
83
|
:selection="tableSelection"
|
|
84
|
+
:separator="tableSeparator"
|
|
84
85
|
:loading="tableLoading"
|
|
85
86
|
:rows-per-page-options="tableRowsPerPageOptions"
|
|
86
87
|
:grid="tableGrid"
|
|
@@ -268,7 +269,7 @@ export default {
|
|
|
268
269
|
// 对话框中的表格双击表格行
|
|
269
270
|
currentTableRowDblclick = function (e, row) {
|
|
270
271
|
// 如果不是多选
|
|
271
|
-
if ($table.tableSelection !== 'multiple') {
|
|
272
|
+
if ($table.tableSelection.value !== 'multiple') {
|
|
272
273
|
$table.tableSelected.value = [ row ]
|
|
273
274
|
$dialog.confirm()
|
|
274
275
|
}
|
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
|
// 组件参数
|