@netang/quasar 0.0.48 → 0.0.50
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/data/index.vue +23 -23
- package/components/dialog/index.vue +10 -10
- package/components/dialog-table/index.vue +1 -1
- package/components/dragger/index.vue +2 -2
- package/components/drawer/index.vue +7 -7
- package/components/editor-code/index.vue +282 -0
- package/components/empty/index.vue +22 -3
- package/components/field-date/index.vue +35 -35
- package/components/field-table/index.vue +34 -34
- package/components/field-text/index.vue +2 -2
- package/components/field-tree/index.vue +18 -18
- package/components/input-number/index.vue +2 -2
- package/components/list-menu/index.vue +2 -2
- package/components/private/components/move-to-tree/index.vue +2 -2
- package/components/private/edit-power-data/index.vue +50 -50
- package/components/private/table-visible-columns-button/index.vue +2 -2
- package/components/render/index.vue +6 -6
- package/components/search/index.vue +2 -2
- package/components/search-item/index.vue +5 -5
- package/components/select/index.vue +2 -2
- package/components/splitter/index.vue +7 -7
- package/components/table/index.vue +5 -5
- package/components/table-splitter/index.vue +4 -4
- package/components/table-summary/index.vue +3 -3
- package/components/thumbnail/index.vue +6 -6
- package/components/uploader/index.vue +1 -1
- package/components/uploader-query/index.vue +25 -25
- package/components/value-format/index.vue +12 -12
- package/package.json +1 -1
- package/sass/quasar/field.scss +5 -0
- package/sass/quasar/table.scss +6 -0
- package/utils/$area.js +13 -13
- package/utils/$auth.js +6 -6
- package/utils/$dialog.js +3 -3
- package/utils/$form.js +2 -2
- package/utils/$power.js +118 -118
- package/utils/$rule.js +4 -4
- package/utils/$search.js +50 -50
- package/utils/$table.js +79 -76
- package/utils/$tree.js +43 -43
- package/utils/$uploader.js +47 -47
- package/utils/alert.js +1 -1
- package/utils/arr.js +2 -2
- package/utils/bus.js +1 -1
- package/utils/config.js +4 -4
- package/utils/confrim.js +1 -1
- package/utils/dict.js +5 -5
- package/utils/getData.js +9 -9
- package/utils/getFile.js +5 -5
- package/utils/getImage.js +12 -12
- package/utils/getTime.js +4 -4
- package/utils/http.js +20 -20
- package/utils/loading.js +1 -1
- package/utils/notify.js +1 -1
- package/utils/previewImage.js +2 -2
- package/utils/price.js +3 -3
- package/utils/timestamp.js +1 -1
- package/utils/toast.js +1 -1
- package/utils/uploader/qiniu.js +11 -11
- package/utils/useAuth.js +2 -2
- package/utils/useRouter.js +4 -4
package/utils/$rule.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 验证规则(用于表单验证)
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
$n.$rule = function (rule) {
|
|
5
5
|
return function(value) {
|
|
6
|
-
const res =
|
|
6
|
+
const res = $n.validate(value, 'data', rule, '', '该值')
|
|
7
7
|
if (res) {
|
|
8
8
|
return res
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
$n.$ruleValid = function (rule) {
|
|
14
14
|
return function(value) {
|
|
15
|
-
return !
|
|
15
|
+
return ! $n.validate(value, 'data', rule, '', '该值')
|
|
16
16
|
}
|
|
17
17
|
}
|
package/utils/$search.js
CHANGED
|
@@ -40,7 +40,7 @@ function setItemCompare(item) {
|
|
|
40
40
|
// 如果类型为日期
|
|
41
41
|
if (item.type === 'date') {
|
|
42
42
|
// 添加日期快捷选项
|
|
43
|
-
|
|
43
|
+
$n.forEach(quickRange, function(label, key) {
|
|
44
44
|
opts1.push({ label, value: key + 20 })
|
|
45
45
|
})
|
|
46
46
|
|
|
@@ -54,8 +54,8 @@ function setItemCompare(item) {
|
|
|
54
54
|
|
|
55
55
|
// 如果有比较类型
|
|
56
56
|
if (
|
|
57
|
-
|
|
58
|
-
&&
|
|
57
|
+
$n.has(item, 'compare')
|
|
58
|
+
&& $n.isValidArray(item.compare)
|
|
59
59
|
) {
|
|
60
60
|
const {
|
|
61
61
|
compare,
|
|
@@ -84,11 +84,11 @@ function setItemCompare(item) {
|
|
|
84
84
|
item.compareOptions2 = []
|
|
85
85
|
|
|
86
86
|
// 如果比较类型有 >
|
|
87
|
-
if (
|
|
87
|
+
if ($n.findIndex(opts1, { value: dicts.SEARCH_COMPARE_TYPE__GT }) > -1) {
|
|
88
88
|
item.compareOptions2.push({ label: '<', value: dicts.SEARCH_COMPARE_TYPE__LT })
|
|
89
89
|
|
|
90
90
|
// 如果比较类型有 >=
|
|
91
|
-
} else if (
|
|
91
|
+
} else if ($n.findIndex(opts1, { value: dicts.SEARCH_COMPARE_TYPE__GTE }) > -1) {
|
|
92
92
|
item.compareOptions2.push({ label: '≤', value: dicts.SEARCH_COMPARE_TYPE__LTE })
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -103,10 +103,10 @@ export function setItemValue(value, val) {
|
|
|
103
103
|
// 比较类型为 in
|
|
104
104
|
value[0].compare = dicts.SEARCH_COMPARE_TYPE__IN
|
|
105
105
|
// 设置值为将数组转为逗号分隔的字符串
|
|
106
|
-
value[0].value =
|
|
106
|
+
value[0].value = $n.join(val, ',')
|
|
107
107
|
|
|
108
108
|
// 如果值是逗号隔开
|
|
109
|
-
} else if (
|
|
109
|
+
} else if ($n.split(val, ',').length > 1) {
|
|
110
110
|
// 比较类型为 in
|
|
111
111
|
value[0].compare = dicts.SEARCH_COMPARE_TYPE__IN
|
|
112
112
|
// 设置值为将数组转为逗号分隔的字符串
|
|
@@ -130,15 +130,15 @@ function formatItemValueCompare(value, { compareOptions1 }) {
|
|
|
130
130
|
const value1 = value[0]
|
|
131
131
|
|
|
132
132
|
// 如果值1 的比较条件不在值1 的限制范围内
|
|
133
|
-
if (
|
|
133
|
+
if ($n.findIndex(compareOptions1, { value: value1.compare }) === -1) {
|
|
134
134
|
// 则取比较条件中的第一个
|
|
135
135
|
value1.compare = compareOptions1[0].value
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
// 如果比较类型不为 in / not in
|
|
139
|
-
if (
|
|
139
|
+
if ($n.indexOf([ dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN ], value1.compare) === -1) {
|
|
140
140
|
// 如果值中含有逗号
|
|
141
|
-
const arr =
|
|
141
|
+
const arr = $n.split(value1.value, ',')
|
|
142
142
|
if (arr.length > 1) {
|
|
143
143
|
value1.value = arr[0]
|
|
144
144
|
}
|
|
@@ -173,23 +173,23 @@ function getRawData(tableColumns, query, searchFromQuery = true) {
|
|
|
173
173
|
// 搜索参数键值数组
|
|
174
174
|
const searchQueryKey = []
|
|
175
175
|
|
|
176
|
-
|
|
177
|
-
if (
|
|
176
|
+
$n.forEach(tableColumns, function (item) {
|
|
177
|
+
if ($n.has(item, 'search.type')) {
|
|
178
178
|
|
|
179
179
|
// 【设置原始表格搜索参数】
|
|
180
180
|
// --------------------------------------------------
|
|
181
181
|
|
|
182
182
|
// 搜索参数
|
|
183
|
-
const newItem =
|
|
183
|
+
const newItem = $n.merge({
|
|
184
184
|
// 标签
|
|
185
185
|
label: item.label,
|
|
186
186
|
}, item.search)
|
|
187
187
|
|
|
188
188
|
// 标识
|
|
189
|
-
newItem.name =
|
|
189
|
+
newItem.name = $n.has(newItem, 'name') ? newItem.name : item.name
|
|
190
190
|
|
|
191
191
|
// 如果有字典标识
|
|
192
|
-
if (
|
|
192
|
+
if ($n.has(item, 'dict')) {
|
|
193
193
|
newItem.dict = item.dict
|
|
194
194
|
}
|
|
195
195
|
|
|
@@ -226,16 +226,16 @@ function getRawData(tableColumns, query, searchFromQuery = true) {
|
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
// 添加原始表格搜索值
|
|
229
|
-
rawTableSearchValue.push(
|
|
229
|
+
rawTableSearchValue.push($n.cloneDeep(value))
|
|
230
230
|
|
|
231
231
|
if (
|
|
232
232
|
// 如果开启从参数中获取搜索值
|
|
233
233
|
searchFromQuery
|
|
234
234
|
// 如果在传参中有搜索参数
|
|
235
|
-
&&
|
|
235
|
+
&& $n.has(query, newItem.name)
|
|
236
236
|
) {
|
|
237
237
|
// 如果有值
|
|
238
|
-
if (
|
|
238
|
+
if ($n.isRequired(query[newItem.name])) {
|
|
239
239
|
// 设置单个搜索值
|
|
240
240
|
setItemValue(value, query[newItem.name])
|
|
241
241
|
}
|
|
@@ -245,10 +245,10 @@ function getRawData(tableColumns, query, searchFromQuery = true) {
|
|
|
245
245
|
|
|
246
246
|
// 否则, 如果表格参数中有设置初始值
|
|
247
247
|
} else if (
|
|
248
|
-
|
|
249
|
-
&&
|
|
248
|
+
$n.has(newItem, 'value')
|
|
249
|
+
&& $n.isValidArray(newItem.value)
|
|
250
250
|
) {
|
|
251
|
-
value =
|
|
251
|
+
value = $n.merge([], value, newItem.value)
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
// 格式化单个值的比较条件
|
|
@@ -260,7 +260,7 @@ function getRawData(tableColumns, query, searchFromQuery = true) {
|
|
|
260
260
|
})
|
|
261
261
|
|
|
262
262
|
if (searchQueryKey.length) {
|
|
263
|
-
|
|
263
|
+
$n.forIn(query, function(val, key) {
|
|
264
264
|
if (searchQueryKey.indexOf(key) === -1) {
|
|
265
265
|
rawQuery[key] = val
|
|
266
266
|
}
|
|
@@ -288,43 +288,43 @@ async function getOptions(rawSearchOptions, format) {
|
|
|
288
288
|
|
|
289
289
|
const lists = []
|
|
290
290
|
|
|
291
|
-
if (
|
|
291
|
+
if ($n.isValidArray(rawSearchOptions)) {
|
|
292
292
|
for (const item of rawSearchOptions) {
|
|
293
293
|
|
|
294
294
|
const newItem = Object.assign({}, item)
|
|
295
295
|
|
|
296
296
|
// 格式化单个参数
|
|
297
|
-
if (
|
|
298
|
-
const res = await
|
|
299
|
-
if (
|
|
300
|
-
|
|
297
|
+
if ($n.isFunction(format)) {
|
|
298
|
+
const res = await $n.runAsync(format)(newItem)
|
|
299
|
+
if ($n.isValidObject(res)) {
|
|
300
|
+
$n.merge(newItem, res)
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
// 如果有字典标识, 则一定是下拉菜单
|
|
305
|
-
if (
|
|
306
|
-
|
|
305
|
+
if ($n.has(newItem, 'dict')) {
|
|
306
|
+
$n.merge(newItem, {
|
|
307
307
|
searchType: 'select',
|
|
308
308
|
select: {
|
|
309
|
-
options:
|
|
309
|
+
options: $n.dictOptions(newItem.dict)
|
|
310
310
|
},
|
|
311
311
|
})
|
|
312
312
|
|
|
313
313
|
// 如果有下拉菜单选项
|
|
314
|
-
} else if (
|
|
314
|
+
} else if ($n.has(newItem, 'select')) {
|
|
315
315
|
newItem.searchType = 'select'
|
|
316
316
|
newItem.select = Object.assign({
|
|
317
317
|
options: [],
|
|
318
318
|
}, newItem.select)
|
|
319
319
|
|
|
320
320
|
// 如果下拉选项是方法
|
|
321
|
-
if (
|
|
321
|
+
if ($n.isFunction(newItem.select.options)) {
|
|
322
322
|
// 读取下拉选项
|
|
323
|
-
newItem.select.options = await
|
|
323
|
+
newItem.select.options = await $n.runAsync(newItem.select.options)()
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
// 如果有树选项(调用的是 <n-field-tree> 组件)
|
|
327
|
-
} else if (
|
|
327
|
+
} else if ($n.has(newItem, 'tree')) {
|
|
328
328
|
newItem.searchType = 'tree'
|
|
329
329
|
newItem.tree = Object.assign({
|
|
330
330
|
nodes: [],
|
|
@@ -333,13 +333,13 @@ async function getOptions(rawSearchOptions, format) {
|
|
|
333
333
|
}, newItem.tree)
|
|
334
334
|
|
|
335
335
|
// 如果节点数组是方法
|
|
336
|
-
if (
|
|
336
|
+
if ($n.isFunction(newItem.tree.nodes)) {
|
|
337
337
|
// 读取下拉选项
|
|
338
|
-
newItem.tree.nodes = await
|
|
338
|
+
newItem.tree.nodes = await $n.runAsync(newItem.tree.nodes)()
|
|
339
339
|
}
|
|
340
340
|
|
|
341
341
|
// 如果有表格选项(调用的是 <n-field-table> 组件)
|
|
342
|
-
} else if (
|
|
342
|
+
} else if ($n.has(newItem, 'table')) {
|
|
343
343
|
newItem.searchType = 'table'
|
|
344
344
|
newItem.table = Object.assign({
|
|
345
345
|
// 值字段(必填)
|
|
@@ -370,20 +370,20 @@ function formatValue(rawSearchOptions, searchValue) {
|
|
|
370
370
|
|
|
371
371
|
const lists = []
|
|
372
372
|
|
|
373
|
-
|
|
373
|
+
$n.forEach(rawSearchOptions, function ({ name, type }, itemIndex) {
|
|
374
374
|
|
|
375
375
|
// 添加值1
|
|
376
376
|
function addValue1(value1) {
|
|
377
377
|
|
|
378
378
|
// 如果有值1
|
|
379
|
-
if (
|
|
379
|
+
if ($n.isValidValue(value1.value)) {
|
|
380
380
|
|
|
381
381
|
// 如果值1 类型为 in / not in
|
|
382
|
-
if (
|
|
382
|
+
if ($n.indexOf([dicts.SEARCH_COMPARE_TYPE__IN, dicts.SEARCH_COMPARE_TYPE__NOT_IN], value1.compare) > -1) {
|
|
383
383
|
const vals = []
|
|
384
|
-
|
|
385
|
-
item =
|
|
386
|
-
if (
|
|
384
|
+
$n.forEach($n.split($n.trimString(value1.value).replaceAll(',', ','), ','), function (item) {
|
|
385
|
+
item = $n.numberDeep(item)
|
|
386
|
+
if ($n.isValidValue(item)) {
|
|
387
387
|
vals.push(item)
|
|
388
388
|
}
|
|
389
389
|
})
|
|
@@ -401,7 +401,7 @@ function formatValue(rawSearchOptions, searchValue) {
|
|
|
401
401
|
lists.push({
|
|
402
402
|
field: name,
|
|
403
403
|
compare: value1.compare,
|
|
404
|
-
value:
|
|
404
|
+
value: $n.numberDeep(value1.value),
|
|
405
405
|
})
|
|
406
406
|
}
|
|
407
407
|
}
|
|
@@ -432,14 +432,14 @@ function formatValue(rawSearchOptions, searchValue) {
|
|
|
432
432
|
field: name,
|
|
433
433
|
// ≥
|
|
434
434
|
compare: dicts.SEARCH_COMPARE_TYPE__GTE,
|
|
435
|
-
value:
|
|
435
|
+
value: $n.numberDeep(quasarDate.formatDate($n.toDate(`${res.date.from} ${res.time.from}`), 'X')),
|
|
436
436
|
},
|
|
437
437
|
// 日期止
|
|
438
438
|
{
|
|
439
439
|
field: name,
|
|
440
440
|
// ≤
|
|
441
441
|
compare: dicts.SEARCH_COMPARE_TYPE__LTE,
|
|
442
|
-
value:
|
|
442
|
+
value: $n.numberDeep(quasarDate.formatDate($n.toDate(`${res.date.to} ${res.time.to}`), 'X')),
|
|
443
443
|
}
|
|
444
444
|
)
|
|
445
445
|
}
|
|
@@ -450,13 +450,13 @@ function formatValue(rawSearchOptions, searchValue) {
|
|
|
450
450
|
addValue1(value1)
|
|
451
451
|
|
|
452
452
|
// 只有值1 类型为 > / ≥ 值2才有效
|
|
453
|
-
if (
|
|
453
|
+
if ($n.indexOf([dicts.SEARCH_COMPARE_TYPE__GT, dicts.SEARCH_COMPARE_TYPE__GTE], value1.compare) > -1) {
|
|
454
454
|
const value2 = searchValue[itemIndex][1]
|
|
455
|
-
if (
|
|
455
|
+
if ($n.isValidValue(value2.value)) {
|
|
456
456
|
lists.push({
|
|
457
457
|
field: name,
|
|
458
458
|
compare: value2.compare,
|
|
459
|
-
value:
|
|
459
|
+
value: $n.numberDeep(value2.value),
|
|
460
460
|
})
|
|
461
461
|
}
|
|
462
462
|
}
|
|
@@ -469,7 +469,7 @@ function formatValue(rawSearchOptions, searchValue) {
|
|
|
469
469
|
/**
|
|
470
470
|
* 搜素业务
|
|
471
471
|
*/
|
|
472
|
-
|
|
472
|
+
$n.$search = {
|
|
473
473
|
// 获取原始值
|
|
474
474
|
getRawData,
|
|
475
475
|
// 获取参数
|