@netang/quasar 0.0.47 → 0.0.49
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/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/field-date/index.vue +35 -35
- package/components/field-table/index.vue +39 -41
- package/components/field-text/index.vue +2 -2
- package/components/field-tree/index.vue +19 -19
- 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 +22 -11
- 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 +65 -38
- package/package.json +1 -1
- 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 +124 -117
- package/utils/$rule.js +4 -4
- package/utils/$search.js +50 -50
- package/utils/$table.js +76 -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/components/input-format/index.vue +0 -268
|
@@ -184,10 +184,10 @@ export default {
|
|
|
184
184
|
|
|
185
185
|
function setWH(style, field, sign) {
|
|
186
186
|
if (props[field]) {
|
|
187
|
-
if (
|
|
187
|
+
if ($n.indexOf(props[field], '%') > -1) {
|
|
188
188
|
style[field] = props[field].replace('%', sign)
|
|
189
189
|
} else {
|
|
190
|
-
style[field] =
|
|
190
|
+
style[field] = $n.px(props[field])
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
}
|
|
@@ -231,10 +231,10 @@ export default {
|
|
|
231
231
|
// 如果是路由路径
|
|
232
232
|
if (props.route) {
|
|
233
233
|
// 获取路由组件
|
|
234
|
-
comp =
|
|
234
|
+
comp = $n.get(routers, `${$n.slash(props.route, 'start', false)}.component`)
|
|
235
235
|
|
|
236
236
|
// 如果有组件标识
|
|
237
|
-
} else if (props.name &&
|
|
237
|
+
} else if (props.name && $n.has(components, props.name)) {
|
|
238
238
|
// 获取自定义组件
|
|
239
239
|
comp = components[props.name]
|
|
240
240
|
}
|
|
@@ -245,7 +245,7 @@ export default {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
// 如果是方法, 则说明是异步组件
|
|
248
|
-
if (
|
|
248
|
+
if ($n.isFunction(comp)) {
|
|
249
249
|
return defineAsyncComponent(comp)
|
|
250
250
|
}
|
|
251
251
|
|
|
@@ -265,7 +265,7 @@ export default {
|
|
|
265
265
|
|
|
266
266
|
return props.route ?
|
|
267
267
|
// 如果是路由路径, 则获取路由标题
|
|
268
|
-
|
|
268
|
+
$n.get(routers, `${$n.slash(props.route, 'start', false)}.meta.title`, '')
|
|
269
269
|
: ''
|
|
270
270
|
})
|
|
271
271
|
|
|
@@ -285,17 +285,17 @@ export default {
|
|
|
285
285
|
async function onDialogConfirm() {
|
|
286
286
|
|
|
287
287
|
// 如果有确定按钮
|
|
288
|
-
if (
|
|
288
|
+
if ($n.isFunction(props.onConfirm)) {
|
|
289
289
|
|
|
290
|
-
if (!
|
|
290
|
+
if (! $n.isFunction(compSubmit)) {
|
|
291
291
|
// 轻提示
|
|
292
|
-
|
|
292
|
+
$n.toast({
|
|
293
293
|
message: '未调用 $dialog.submit 方法',
|
|
294
294
|
})
|
|
295
295
|
return
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
const res = await
|
|
298
|
+
const res = await $n.runAsync(props.onConfirm)(await $n.runAsync(compSubmit)(), hide)
|
|
299
299
|
if (res === false) {
|
|
300
300
|
return
|
|
301
301
|
}
|
|
@@ -68,7 +68,7 @@ export default {
|
|
|
68
68
|
*/
|
|
69
69
|
const isDrag = computed(function() {
|
|
70
70
|
return props.drag
|
|
71
|
-
&&
|
|
71
|
+
&& $n.isValidArray(props.modelValue)
|
|
72
72
|
&& props.modelValue.length > 1
|
|
73
73
|
})
|
|
74
74
|
|
|
@@ -101,7 +101,7 @@ export default {
|
|
|
101
101
|
if (isDrag.value) {
|
|
102
102
|
|
|
103
103
|
// 如果为火狐浏览器, 则必须要setData
|
|
104
|
-
// if (
|
|
104
|
+
// if ($n.ua.firefox) {
|
|
105
105
|
// e.dataTransfer.setData('info', e.target.id)
|
|
106
106
|
// }
|
|
107
107
|
|
|
@@ -126,7 +126,7 @@ export default {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
// 创建防抖睡眠方法
|
|
129
|
-
const sleep =
|
|
129
|
+
const sleep = $n.debounceSleep()
|
|
130
130
|
|
|
131
131
|
// 缓存名
|
|
132
132
|
let cacheName = ''
|
|
@@ -138,10 +138,10 @@ export default {
|
|
|
138
138
|
if ($q.platform.is.mobile) {
|
|
139
139
|
|
|
140
140
|
// 获取手机端百分比值
|
|
141
|
-
let res =
|
|
141
|
+
let res = $n.percentValue(props.mobileWidth, true)
|
|
142
142
|
|
|
143
143
|
// 如果是百分比值
|
|
144
|
-
if (!
|
|
144
|
+
if (! $n.isNil(res)) {
|
|
145
145
|
// 原始尺寸 = 屏幕宽度 * 百分比
|
|
146
146
|
if (res) {
|
|
147
147
|
originalWidth = $q.screen.width * res
|
|
@@ -149,7 +149,7 @@ export default {
|
|
|
149
149
|
|
|
150
150
|
} else {
|
|
151
151
|
// 原始尺寸 = 屏幕宽度像素
|
|
152
|
-
res =
|
|
152
|
+
res = $n.pxValue(props.mobileWidth)
|
|
153
153
|
if (res) {
|
|
154
154
|
originalWidth = res
|
|
155
155
|
}
|
|
@@ -159,10 +159,10 @@ export default {
|
|
|
159
159
|
} else if (props.drag && props.cache) {
|
|
160
160
|
|
|
161
161
|
// 设置缓存名
|
|
162
|
-
cacheName = `drawer:${props.side}:${props.cache === true ? ($power && $power.routePath ? $power.routePath :
|
|
162
|
+
cacheName = `drawer:${props.side}:${props.cache === true ? ($power && $power.routePath ? $power.routePath : $n.router.getRoute('path')) : props.cache}`
|
|
163
163
|
|
|
164
164
|
// 从缓存获取宽度
|
|
165
|
-
const cache =
|
|
165
|
+
const cache = $n.storage.get(cacheName)
|
|
166
166
|
if (cache) {
|
|
167
167
|
originalWidth = cache
|
|
168
168
|
}
|
|
@@ -247,7 +247,7 @@ export default {
|
|
|
247
247
|
sleep(500)
|
|
248
248
|
.then(function () {
|
|
249
249
|
// 设置缓存(永久缓存)
|
|
250
|
-
|
|
250
|
+
$n.storage.set(cacheName, newWidth, 0)
|
|
251
251
|
})
|
|
252
252
|
}
|
|
253
253
|
}
|
|
@@ -197,17 +197,17 @@ export default {
|
|
|
197
197
|
|
|
198
198
|
// 是否为选择
|
|
199
199
|
const isSelect = computed(function() {
|
|
200
|
-
return
|
|
200
|
+
return $n.indexOf(['year', 'month', 'time'], props.type) > -1
|
|
201
201
|
})
|
|
202
202
|
|
|
203
203
|
// 是否为范围
|
|
204
204
|
const isRange = computed(function() {
|
|
205
|
-
return
|
|
205
|
+
return $n.indexOf(['daterange', 'datetimerange'], props.type) > -1
|
|
206
206
|
})
|
|
207
207
|
|
|
208
208
|
// 是否为选择时间
|
|
209
209
|
const isDatetime = computed(function() {
|
|
210
|
-
return
|
|
210
|
+
return $n.indexOf(['datetime', 'datetimerange'], props.type) > -1
|
|
211
211
|
})
|
|
212
212
|
|
|
213
213
|
// 选择数据列表
|
|
@@ -222,14 +222,14 @@ export default {
|
|
|
222
222
|
lists: []
|
|
223
223
|
}
|
|
224
224
|
for (let i = 0; i <= 23; i++) {
|
|
225
|
-
hh.lists.push([i,
|
|
225
|
+
hh.lists.push([i, $n.padStart(String(i), 2, '0')])
|
|
226
226
|
}
|
|
227
227
|
const ii = {
|
|
228
228
|
type: 'ii',
|
|
229
229
|
lists: []
|
|
230
230
|
}
|
|
231
231
|
for (let i = 0; i <= 59; i++) {
|
|
232
|
-
ii.lists.push([i,
|
|
232
|
+
ii.lists.push([i, $n.padStart(String(i), 2, '0')])
|
|
233
233
|
}
|
|
234
234
|
arr.push(hh, ii)
|
|
235
235
|
if (props.showSecond) {
|
|
@@ -238,7 +238,7 @@ export default {
|
|
|
238
238
|
lists: []
|
|
239
239
|
}
|
|
240
240
|
for (let i = 0; i <= 59; i++) {
|
|
241
|
-
ss.lists.push([i,
|
|
241
|
+
ss.lists.push([i, $n.padStart(String(i), 2, '0')])
|
|
242
242
|
}
|
|
243
243
|
arr.push(ss)
|
|
244
244
|
}
|
|
@@ -267,7 +267,7 @@ export default {
|
|
|
267
267
|
lists: []
|
|
268
268
|
}
|
|
269
269
|
for (let i = 1; i <= 12; i++) {
|
|
270
|
-
mm.lists.push([i,
|
|
270
|
+
mm.lists.push([i, $n.padStart(String(i), 2, '0')])
|
|
271
271
|
}
|
|
272
272
|
|
|
273
273
|
arr.push(mm)
|
|
@@ -333,9 +333,9 @@ export default {
|
|
|
333
333
|
ii: '',
|
|
334
334
|
})
|
|
335
335
|
|
|
336
|
-
if (
|
|
336
|
+
if ($n.isDate(val)) {
|
|
337
337
|
|
|
338
|
-
const { hh, ii, ss } =
|
|
338
|
+
const { hh, ii, ss } = $n.dateObject(val)
|
|
339
339
|
|
|
340
340
|
// 设置时间数据
|
|
341
341
|
Object.assign(obj, {
|
|
@@ -368,8 +368,8 @@ export default {
|
|
|
368
368
|
obj.y = val
|
|
369
369
|
|
|
370
370
|
// 否则如果是日期格式
|
|
371
|
-
} else if (
|
|
372
|
-
const { y } =
|
|
371
|
+
} else if ($n.isDate(val)) {
|
|
372
|
+
const { y } = $n.dateObject(val)
|
|
373
373
|
obj.y = y
|
|
374
374
|
}
|
|
375
375
|
}
|
|
@@ -380,13 +380,13 @@ export default {
|
|
|
380
380
|
// 否则是选择月
|
|
381
381
|
|
|
382
382
|
// 如果是这样的格式 202207, 则转换为 2022-07
|
|
383
|
-
const newVal =
|
|
383
|
+
const newVal = $n.ymd.toString(val)
|
|
384
384
|
if (newVal) {
|
|
385
385
|
val = newVal
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
-
if (
|
|
389
|
-
const { y, mm } =
|
|
388
|
+
if ($n.isDate(val)) {
|
|
389
|
+
const { y, mm } = $n.dateObject(val)
|
|
390
390
|
Object.assign(obj, {
|
|
391
391
|
y,
|
|
392
392
|
mm,
|
|
@@ -404,13 +404,13 @@ export default {
|
|
|
404
404
|
let to = ''
|
|
405
405
|
|
|
406
406
|
// 如果是这样的格式 20220708, 则转换为 2022-07-08
|
|
407
|
-
const newVal =
|
|
407
|
+
const newVal = $n.ymd.toString(val)
|
|
408
408
|
if (newVal) {
|
|
409
409
|
val = newVal
|
|
410
410
|
}
|
|
411
411
|
|
|
412
|
-
if (
|
|
413
|
-
const { y, mm, dd } =
|
|
412
|
+
if ($n.isDate(val)) {
|
|
413
|
+
const { y, mm, dd } = $n.dateObject(val)
|
|
414
414
|
from = `${y}/${mm}/${dd}`
|
|
415
415
|
|
|
416
416
|
// 如果不是日期选择范围, 则返回单个日期
|
|
@@ -420,8 +420,8 @@ export default {
|
|
|
420
420
|
}
|
|
421
421
|
|
|
422
422
|
// 如果是日期选择范围
|
|
423
|
-
if (isRange.value &&
|
|
424
|
-
const { y, mm, dd } =
|
|
423
|
+
if (isRange.value && $n.isDate(props.end)) {
|
|
424
|
+
const { y, mm, dd } = $n.dateObject(props.end)
|
|
425
425
|
to = `${y}/${mm}/${dd}`
|
|
426
426
|
}
|
|
427
427
|
|
|
@@ -441,8 +441,8 @@ export default {
|
|
|
441
441
|
to: '',
|
|
442
442
|
}
|
|
443
443
|
|
|
444
|
-
if (
|
|
445
|
-
const { hh, ii, ss } =
|
|
444
|
+
if ($n.isDate(props.modelValue)) {
|
|
445
|
+
const { hh, ii, ss } = $n.dateObject(props.modelValue)
|
|
446
446
|
obj.from = `${hh}:${ii}`
|
|
447
447
|
if (props.showSecond) {
|
|
448
448
|
obj.from += `:${ss}`
|
|
@@ -455,8 +455,8 @@ export default {
|
|
|
455
455
|
obj.from = props.showSecond ? '00:00:00' : '00:00'
|
|
456
456
|
}
|
|
457
457
|
|
|
458
|
-
if (isRange.value &&
|
|
459
|
-
const { hh, ii, ss } =
|
|
458
|
+
if (isRange.value && $n.isDate(props.end)) {
|
|
459
|
+
const { hh, ii, ss } = $n.dateObject(props.end)
|
|
460
460
|
obj.to = `${hh}:${ii}`
|
|
461
461
|
if (props.showSecond) {
|
|
462
462
|
obj.to += `:${ss}`
|
|
@@ -482,9 +482,9 @@ export default {
|
|
|
482
482
|
// 如果是选择时间
|
|
483
483
|
if (props.type === 'time') {
|
|
484
484
|
if (
|
|
485
|
-
!
|
|
486
|
-
|| !
|
|
487
|
-
|| (props.showSecond && !
|
|
485
|
+
! $n.isValidValue(dateValue.hh)
|
|
486
|
+
|| ! $n.isValidValue(dateValue.ii)
|
|
487
|
+
|| (props.showSecond && ! $n.isValidValue(dateValue.ss))) {
|
|
488
488
|
return ''
|
|
489
489
|
}
|
|
490
490
|
format = 'HH:mm'
|
|
@@ -495,13 +495,13 @@ export default {
|
|
|
495
495
|
|
|
496
496
|
// 否则是选择年月
|
|
497
497
|
} else {
|
|
498
|
-
if (!
|
|
498
|
+
if (! $n.isValidValue(dateValue.y)) {
|
|
499
499
|
return ''
|
|
500
500
|
}
|
|
501
501
|
|
|
502
502
|
const isMonth = props.type === 'month'
|
|
503
503
|
if (isMonth) {
|
|
504
|
-
if (!
|
|
504
|
+
if (! $n.isValidValue(dateValue.mm)) {
|
|
505
505
|
return ''
|
|
506
506
|
}
|
|
507
507
|
|
|
@@ -526,7 +526,7 @@ export default {
|
|
|
526
526
|
return ''
|
|
527
527
|
}
|
|
528
528
|
|
|
529
|
-
if (!
|
|
529
|
+
if (! $n.isRequired(dateValue)) {
|
|
530
530
|
return ''
|
|
531
531
|
}
|
|
532
532
|
|
|
@@ -538,8 +538,8 @@ export default {
|
|
|
538
538
|
} = dateValue
|
|
539
539
|
|
|
540
540
|
if (
|
|
541
|
-
!
|
|
542
|
-
|| !
|
|
541
|
+
! $n.isValidValue(from)
|
|
542
|
+
|| ! $n.isValidValue(to)
|
|
543
543
|
) {
|
|
544
544
|
return ''
|
|
545
545
|
}
|
|
@@ -616,7 +616,7 @@ export default {
|
|
|
616
616
|
function onUpdateDateValue(val) {
|
|
617
617
|
|
|
618
618
|
// 如果为 null, 则清空数据
|
|
619
|
-
if (
|
|
619
|
+
if ($n.isNil(val)) {
|
|
620
620
|
emit('update:modelValue', null)
|
|
621
621
|
if (isRange.value) {
|
|
622
622
|
emit('update:end', null)
|
|
@@ -698,7 +698,7 @@ export default {
|
|
|
698
698
|
* 提交
|
|
699
699
|
*/
|
|
700
700
|
function onEmit(key, value) {
|
|
701
|
-
emit(key,
|
|
701
|
+
emit(key, $n.numberDeep(value))
|
|
702
702
|
}
|
|
703
703
|
|
|
704
704
|
/**
|
|
@@ -712,9 +712,9 @@ export default {
|
|
|
712
712
|
nextTick(function() {
|
|
713
713
|
|
|
714
714
|
// 遍历选择列表
|
|
715
|
-
|
|
715
|
+
$n.forEach(selectLists.value, function(selectItem, selectItemIndex) {
|
|
716
716
|
// 遍历选单个列表
|
|
717
|
-
|
|
717
|
+
$n.forEach(selectItem.lists, function(item, itemIndex) {
|
|
718
718
|
if (dateValue.value[selectItem.type] !== '' && dateValue.value[selectItem.type] == item[0]) {
|
|
719
719
|
scrollRef.value[selectItemIndex].setScrollPosition('vertical', 32 * itemIndex, 0)
|
|
720
720
|
return true
|
|
@@ -287,7 +287,7 @@ export default {
|
|
|
287
287
|
* 插槽标识
|
|
288
288
|
*/
|
|
289
289
|
const slotNames = computed(function() {
|
|
290
|
-
return
|
|
290
|
+
return $n.isValidObject(slots) ? Object.keys(slots) : []
|
|
291
291
|
})
|
|
292
292
|
|
|
293
293
|
/**
|
|
@@ -301,7 +301,7 @@ export default {
|
|
|
301
301
|
* 当前显示字段
|
|
302
302
|
*/
|
|
303
303
|
const currentShowKeys = computed(function() {
|
|
304
|
-
return
|
|
304
|
+
return $n.uniq($n.isValidArray(props.showKeys)
|
|
305
305
|
? props.showKeys
|
|
306
306
|
: [ props.valueKey, currentlabelKey.value ])
|
|
307
307
|
})
|
|
@@ -319,7 +319,7 @@ export default {
|
|
|
319
319
|
const showValue = computed(function () {
|
|
320
320
|
|
|
321
321
|
// 如果有已选数据
|
|
322
|
-
return
|
|
322
|
+
return $n.isValidArray(selected.value)
|
|
323
323
|
// 取已选数据第一条
|
|
324
324
|
? currentFormatLabel(selected.value[0])
|
|
325
325
|
: ''
|
|
@@ -329,9 +329,9 @@ export default {
|
|
|
329
329
|
|
|
330
330
|
|
|
331
331
|
// 创建权限实例
|
|
332
|
-
const $power =
|
|
332
|
+
const $power = $n.$power.create({
|
|
333
333
|
// 路由路径
|
|
334
|
-
path:
|
|
334
|
+
path: $n.isValidString(props.path) ? props.path : false,
|
|
335
335
|
// 路由参数
|
|
336
336
|
query: props.query,
|
|
337
337
|
// 关闭权限页面
|
|
@@ -344,7 +344,7 @@ export default {
|
|
|
344
344
|
} = $power
|
|
345
345
|
|
|
346
346
|
// 创建表格实例
|
|
347
|
-
const $table =
|
|
347
|
+
const $table = $n.$table.create({
|
|
348
348
|
// 权限实例
|
|
349
349
|
$power,
|
|
350
350
|
// 附加请求数据
|
|
@@ -372,7 +372,7 @@ export default {
|
|
|
372
372
|
})
|
|
373
373
|
|
|
374
374
|
// 创建防抖睡眠方法
|
|
375
|
-
const sleep =
|
|
375
|
+
const sleep = $n.debounceSleep()
|
|
376
376
|
|
|
377
377
|
// 输入框节点
|
|
378
378
|
const inputRef = ref(null)
|
|
@@ -423,7 +423,7 @@ export default {
|
|
|
423
423
|
let newSelected = valueToSelected(val, false, false)
|
|
424
424
|
|
|
425
425
|
// 如果值类型是数组对象
|
|
426
|
-
if (props.valueType === '
|
|
426
|
+
if (props.valueType === 'objectArray') {
|
|
427
427
|
|
|
428
428
|
// 设置已选数据
|
|
429
429
|
setSelected(newSelected)
|
|
@@ -502,7 +502,7 @@ export default {
|
|
|
502
502
|
await sleep(props.inputDebounce)
|
|
503
503
|
|
|
504
504
|
// 是否有值
|
|
505
|
-
const hasValue =
|
|
505
|
+
const hasValue = $n.isValidValue(val)
|
|
506
506
|
|
|
507
507
|
const n_search = {}
|
|
508
508
|
n_search[currentFilterKey.value] = [
|
|
@@ -542,7 +542,7 @@ export default {
|
|
|
542
542
|
|
|
543
543
|
if (
|
|
544
544
|
// 如果值类型不是数组对象
|
|
545
|
-
props.valueType !== '
|
|
545
|
+
props.valueType !== 'objectArray'
|
|
546
546
|
// 如果初始加载已选数据
|
|
547
547
|
&& ! props.noFirstLoadSelected
|
|
548
548
|
// 如果有请求路由路径
|
|
@@ -605,14 +605,14 @@ export default {
|
|
|
605
605
|
function currentFormatLabel(item) {
|
|
606
606
|
|
|
607
607
|
// 如果有格式化显示标签方法
|
|
608
|
-
if (
|
|
608
|
+
if ($n.isFunction(props.formatLabel)) {
|
|
609
609
|
// 执行格式化显示标签方法
|
|
610
610
|
return props.formatLabel(item)
|
|
611
611
|
}
|
|
612
612
|
|
|
613
613
|
// 否则显示该值的标签字段
|
|
614
614
|
const val = item[currentlabelKey.value]
|
|
615
|
-
return
|
|
615
|
+
return $n.isValidValue(val) ? val : item[props.valueKey]
|
|
616
616
|
}
|
|
617
617
|
|
|
618
618
|
/**
|
|
@@ -631,16 +631,16 @@ export default {
|
|
|
631
631
|
function valueToSelected(val, isFirst, toSelected) {
|
|
632
632
|
|
|
633
633
|
// 如果值类型是数组对象
|
|
634
|
-
if (props.valueType === '
|
|
634
|
+
if (props.valueType === 'objectArray') {
|
|
635
635
|
|
|
636
636
|
// 如果是有效数组
|
|
637
|
-
if (
|
|
637
|
+
if ($n.isValidArray(val)) {
|
|
638
638
|
for (const item of val) {
|
|
639
639
|
if (
|
|
640
640
|
// 如果元素不是有效对象
|
|
641
|
-
!
|
|
641
|
+
! $n.isValidObject(item)
|
|
642
642
|
// 如果元素没有值字段
|
|
643
|
-
|| !
|
|
643
|
+
|| ! $n.has(item, props.valueKey)
|
|
644
644
|
) {
|
|
645
645
|
return []
|
|
646
646
|
}
|
|
@@ -660,11 +660,11 @@ export default {
|
|
|
660
660
|
|| ! routePath
|
|
661
661
|
) {
|
|
662
662
|
// 将值转为数组
|
|
663
|
-
val = props.valueType === 'string' ?
|
|
663
|
+
val = props.valueType === 'string' ? $n.split(val, props.valueSeparator) : val
|
|
664
664
|
|
|
665
665
|
// 如果是有效数组
|
|
666
|
-
if (
|
|
667
|
-
val = val.filter(e =>
|
|
666
|
+
if ($n.isValidArray(val)) {
|
|
667
|
+
val = val.filter(e => $n.isValidValue(e))
|
|
668
668
|
return toSelected ? val.map(e => setSelectedItem(e)) : val
|
|
669
669
|
}
|
|
670
670
|
}
|
|
@@ -678,7 +678,7 @@ export default {
|
|
|
678
678
|
function selectedToValue(val) {
|
|
679
679
|
|
|
680
680
|
// 如果值类型是数组对象
|
|
681
|
-
if (props.valueType === '
|
|
681
|
+
if (props.valueType === 'objectArray') {
|
|
682
682
|
|
|
683
683
|
// 则直接返回
|
|
684
684
|
return val
|
|
@@ -698,14 +698,14 @@ export default {
|
|
|
698
698
|
: []
|
|
699
699
|
|
|
700
700
|
// 如果值类型是数组
|
|
701
|
-
if (props.valueType === '
|
|
701
|
+
if (props.valueType === 'stringArray') {
|
|
702
702
|
|
|
703
703
|
// 直接返回数组
|
|
704
704
|
return values
|
|
705
705
|
}
|
|
706
706
|
|
|
707
707
|
// 返回转为分隔符隔开的字符串
|
|
708
|
-
return
|
|
708
|
+
return $n.numberDeep($n.join(values, props.valueSeparator))
|
|
709
709
|
}
|
|
710
710
|
|
|
711
711
|
/**
|
|
@@ -714,7 +714,7 @@ export default {
|
|
|
714
714
|
async function onRequestSelected(value) {
|
|
715
715
|
|
|
716
716
|
// 请求数据
|
|
717
|
-
const { status, data } = await
|
|
717
|
+
const { status, data } = await $n.http({
|
|
718
718
|
url: $table.routePath,
|
|
719
719
|
data: Object.assign(
|
|
720
720
|
// 获取表格请求数据
|
|
@@ -743,7 +743,7 @@ export default {
|
|
|
743
743
|
),
|
|
744
744
|
})
|
|
745
745
|
|
|
746
|
-
return status &&
|
|
746
|
+
return status && $n.isValidArray($n.get(data, 'rows')) ? data.rows : []
|
|
747
747
|
}
|
|
748
748
|
|
|
749
749
|
/**
|
|
@@ -754,24 +754,24 @@ export default {
|
|
|
754
754
|
let columns
|
|
755
755
|
|
|
756
756
|
// 如果有声明路由表格列数据
|
|
757
|
-
if (
|
|
758
|
-
columns =
|
|
757
|
+
if ($n.isValidArray(props.columns)) {
|
|
758
|
+
columns = $n.cloneDeep(props.columns)
|
|
759
759
|
|
|
760
760
|
// 如果有路由路径
|
|
761
761
|
} else if (routePath) {
|
|
762
762
|
// 否则如果有路由表格列数据
|
|
763
|
-
const rawTableColumns =
|
|
764
|
-
if (
|
|
765
|
-
columns =
|
|
763
|
+
const rawTableColumns = $n.$table.config(routePath, 'columns')
|
|
764
|
+
if ($n.isValidArray(rawTableColumns)) {
|
|
765
|
+
columns = $n.cloneDeep(rawTableColumns)
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
768
|
|
|
769
|
-
if (
|
|
770
|
-
if (
|
|
769
|
+
if ($n.isValidArray(columns)) {
|
|
770
|
+
if ($n.isValidArray(props.hideSearchKeys)) {
|
|
771
771
|
for (const item of columns) {
|
|
772
772
|
if (
|
|
773
773
|
props.hideSearchKeys.indexOf(item.name) > -1
|
|
774
|
-
&&
|
|
774
|
+
&& $n.has(item, 'search')
|
|
775
775
|
) {
|
|
776
776
|
item.search.hide = true
|
|
777
777
|
}
|
|
@@ -791,21 +791,21 @@ export default {
|
|
|
791
791
|
const columns = []
|
|
792
792
|
|
|
793
793
|
// 如果有原始表格列数据
|
|
794
|
-
if (
|
|
794
|
+
if ($n.isValidArray($table.tableColumns)) {
|
|
795
795
|
|
|
796
796
|
// 克隆原始表格列数据
|
|
797
|
-
const rawTableColumns =
|
|
797
|
+
const rawTableColumns = $n.cloneDeep($table.tableColumns)
|
|
798
798
|
|
|
799
799
|
// 快捷表格显示的属性名称数组
|
|
800
|
-
|
|
800
|
+
$n.forEach(currentShowKeys.value, function (key) {
|
|
801
801
|
for (const item of rawTableColumns) {
|
|
802
802
|
if (item.name === key) {
|
|
803
803
|
// 删除搜索字段
|
|
804
|
-
if (
|
|
804
|
+
if ($n.has(item, 'search')) {
|
|
805
805
|
delete item.search
|
|
806
806
|
}
|
|
807
807
|
// 删除可见字段
|
|
808
|
-
if (
|
|
808
|
+
if ($n.has(item, 'visible')) {
|
|
809
809
|
delete item.visible
|
|
810
810
|
}
|
|
811
811
|
columns.push(item)
|
|
@@ -846,8 +846,6 @@ export default {
|
|
|
846
846
|
// 停止冒泡
|
|
847
847
|
e.stopPropagation()
|
|
848
848
|
|
|
849
|
-
console.log('onFieldBluronFieldBlur', props.filter, showPopup.value)
|
|
850
|
-
|
|
851
849
|
if (
|
|
852
850
|
// 如果开启筛选
|
|
853
851
|
props.filter
|
|
@@ -984,7 +982,7 @@ export default {
|
|
|
984
982
|
opt[props.valueKey] = row[props.valueKey]
|
|
985
983
|
|
|
986
984
|
// 获取当前数据索引
|
|
987
|
-
const itemIndex =
|
|
985
|
+
const itemIndex = $n.findIndex(_selected, opt)
|
|
988
986
|
|
|
989
987
|
// 如果不存在
|
|
990
988
|
if (itemIndex === -1) {
|
|
@@ -1051,7 +1049,7 @@ export default {
|
|
|
1051
1049
|
onUpdated(function () {
|
|
1052
1050
|
if (
|
|
1053
1051
|
popupRef.value
|
|
1054
|
-
&&
|
|
1052
|
+
&& $n.has(popupRef.value, 'currentComponent.ref.updatePosition')
|
|
1055
1053
|
) {
|
|
1056
1054
|
popupRef.value.currentComponent.ref.updatePosition()
|
|
1057
1055
|
}
|
|
@@ -131,7 +131,7 @@ export default {
|
|
|
131
131
|
const slotNames = computed(function() {
|
|
132
132
|
const lists = []
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
$n.forIn(slots, function(val, key) {
|
|
135
135
|
if (key !== 'default') {
|
|
136
136
|
lists.push(key)
|
|
137
137
|
}
|
|
@@ -148,7 +148,7 @@ export default {
|
|
|
148
148
|
function onCopy() {
|
|
149
149
|
const val = props.copyText || props.value
|
|
150
150
|
if (val) {
|
|
151
|
-
|
|
151
|
+
$n.copy(val, `复制【${props.label}】成功`)
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
|