@netang/quasar 0.0.53 → 0.0.54
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/_docs/docs/.vuepress/config.js +40 -0
- package/_docs/docs/.vuepress/configs/index.js +2 -0
- package/_docs/docs/.vuepress/configs/navbar/index.js +1 -0
- package/_docs/docs/.vuepress/configs/navbar/zh.js +16 -0
- package/_docs/docs/.vuepress/configs/sidebar/index.js +1 -0
- package/_docs/docs/.vuepress/configs/sidebar/zh.js +20 -0
- package/_docs/docs/.vuepress/public/css/index.css +3 -0
- package/_docs/docs/.vuepress/styles/index.scss +3 -0
- package/_docs/docs/components/field-table.md +55 -0
- package/_docs/docs/components/field-tree.md +1 -0
- package/{docs → _docs}/docs/index.md +0 -0
- package/{docs → _docs}/docs/utils/alert.md +0 -0
- package/{docs → _docs}/docs/utils/confirm.md +0 -0
- package/{docs → _docs}/package.json +11 -11
- package/components/column-title/index.vue +2 -2
- package/components/data/index.vue +20 -23
- package/components/dialog/index.vue +26 -12
- package/components/dialog-table/index.vue +4 -2
- package/components/dragger/index.vue +3 -2
- package/components/drawer/index.vue +16 -9
- package/components/editor-code/index.vue +12 -5
- package/components/empty/index.vue +16 -1
- package/components/field-date/index.vue +48 -36
- package/components/field-table/index.vue +69 -43
- package/components/field-text/index.vue +6 -2
- package/components/field-tree/index.vue +40 -22
- package/components/input-number/index.vue +5 -4
- package/components/list-menu/index.vue +14 -2
- package/components/power-page/index.vue +10 -0
- package/components/private/components/index.js +7 -2
- package/components/private/components/move-to-tree/index.vue +7 -3
- package/components/private/edit-power-data/index.vue +92 -52
- package/components/private/table-visible-columns-button/index.vue +6 -2
- package/components/render/index.vue +21 -7
- package/components/search/index.vue +30 -2
- package/components/search-item/index.vue +24 -8
- package/components/select/index.vue +5 -2
- package/components/splitter/index.vue +13 -9
- package/components/table/index.vue +32 -5
- package/components/table-pagination/index.vue +0 -1
- package/components/table-splitter/index.vue +22 -3
- package/components/table-summary/index.vue +10 -3
- package/components/thumbnail/index.vue +16 -6
- package/components/toolbar/index.vue +0 -2
- package/components/uploader/index.vue +5 -2
- package/components/uploader-query/index.vue +48 -27
- package/components/value-format/index.vue +19 -12
- package/configs/area3.js +1 -0
- package/docs/404.html +33 -0
- package/docs/assets/404.html-60b35caa.js +1 -0
- package/docs/assets/404.html-d1e63d77.js +1 -0
- package/docs/assets/alert.html-568d4e94.js +1 -0
- package/docs/assets/alert.html-f5dbc3e9.js +1 -0
- package/docs/assets/app-8c3ae4de.js +6 -0
- package/docs/assets/back-to-top-8efcbe56.svg +1 -0
- package/docs/assets/confirm.html-7a1566f6.js +1 -0
- package/docs/assets/confirm.html-96f1b004.js +1 -0
- package/docs/assets/field-table.html-68d610b0.js +1 -0
- package/docs/assets/field-table.html-86cc3511.js +1 -0
- package/docs/assets/field-tree.html-45410c3c.js +1 -0
- package/docs/assets/field-tree.html-c98ac993.js +1 -0
- package/docs/assets/framework-204010b2.js +5 -0
- package/docs/assets/index.html-1695dd7c.js +1 -0
- package/docs/assets/index.html-65a4aa67.js +1 -0
- package/docs/assets/style-ac5a9aa6.css +1 -0
- package/docs/components/field-table.html +33 -0
- package/docs/components/field-tree.html +33 -0
- package/docs/index.html +33 -0
- package/docs/utils/alert.html +33 -0
- package/docs/utils/confirm.html +33 -0
- package/package.json +11 -2
- package/store/index.js +3 -20
- package/utils/alert.js +3 -1
- package/utils/area.js +27 -14
- package/utils/arr.js +6 -2
- package/utils/auth.js +40 -35
- package/utils/bus.js +1 -1
- package/utils/config.js +42 -15
- package/utils/{confrim.js → confirm.js} +1 -1
- package/utils/copy.js +18 -0
- package/utils/dialog.js +7 -3
- package/utils/dict.js +5 -28
- package/utils/dictOptions.js +24 -0
- package/utils/form.js +6 -2
- package/utils/getData.js +21 -9
- package/utils/getFile.js +11 -5
- package/utils/getImage.js +23 -12
- package/utils/getTime.js +9 -4
- package/utils/index.js +61 -0
- package/utils/loading.js +3 -1
- package/utils/notify.js +1 -1
- package/utils/power.js +164 -118
- package/utils/previewImage.js +4 -2
- package/utils/price.js +12 -3
- package/utils/rule.js +5 -9
- package/utils/ruleValid.js +10 -0
- package/utils/search.js +81 -50
- package/utils/table.js +119 -87
- package/utils/timestamp.js +2 -2
- package/utils/toast.js +1 -1
- package/utils/tree.js +69 -46
- package/utils/uploader/qiniu.js +31 -15
- package/utils/uploader.js +87 -56
- package/utils/useAuth.js +12 -5
- package/utils/useRouter.js +4 -4
- package/utils/useUploader.js +0 -5
- package/docs/docs/.vuepress/config.js +0 -32
- package/docs/docs/components/field-table.md +0 -1
- package/docs/docs/components/field-tree.md +0 -1
- package/utils/http.js +0 -251
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
ref="scrollRef"
|
|
44
44
|
:style="{
|
|
45
45
|
width: selectLists.length === 1 ? '136px' : '80px',
|
|
46
|
-
height: '300px'
|
|
46
|
+
height: '300px'
|
|
47
47
|
}"
|
|
48
48
|
v-for="(selectItem, selectItemIndex) in selectLists"
|
|
49
49
|
:key="`list-${selectItemIndex}`"
|
|
@@ -138,6 +138,18 @@
|
|
|
138
138
|
import { ref, reactive, computed, watch, nextTick } from 'vue'
|
|
139
139
|
import { date as quasarDate } from 'quasar'
|
|
140
140
|
|
|
141
|
+
import $n_padStart from 'lodash/padStart'
|
|
142
|
+
import $n_isNil from 'lodash/isNil'
|
|
143
|
+
|
|
144
|
+
import $n_forEach from '@netang/utils/forEach'
|
|
145
|
+
import $n_indexOf from '@netang/utils/indexOf'
|
|
146
|
+
import $n_isRequired from '@netang/utils/isRequired'
|
|
147
|
+
import $n_isValidValue from '@netang/utils/isValidValue'
|
|
148
|
+
import $n_numberDeep from '@netang/utils/numberDeep'
|
|
149
|
+
import $n_isDate from '@netang/utils/isDate'
|
|
150
|
+
import $n_dateObject from '@netang/utils/dateObject'
|
|
151
|
+
import $n_ymd from '@netang/utils/ymd'
|
|
152
|
+
|
|
141
153
|
import { quickRange, getQuickRange } from './methods'
|
|
142
154
|
|
|
143
155
|
export default {
|
|
@@ -197,17 +209,17 @@ export default {
|
|
|
197
209
|
|
|
198
210
|
// 是否为选择
|
|
199
211
|
const isSelect = computed(function() {
|
|
200
|
-
return $
|
|
212
|
+
return $n_indexOf(['year', 'month', 'time'], props.type) > -1
|
|
201
213
|
})
|
|
202
214
|
|
|
203
215
|
// 是否为范围
|
|
204
216
|
const isRange = computed(function() {
|
|
205
|
-
return $
|
|
217
|
+
return $n_indexOf(['daterange', 'datetimerange'], props.type) > -1
|
|
206
218
|
})
|
|
207
219
|
|
|
208
220
|
// 是否为选择时间
|
|
209
221
|
const isDatetime = computed(function() {
|
|
210
|
-
return $
|
|
222
|
+
return $n_indexOf(['datetime', 'datetimerange'], props.type) > -1
|
|
211
223
|
})
|
|
212
224
|
|
|
213
225
|
// 选择数据列表
|
|
@@ -222,14 +234,14 @@ export default {
|
|
|
222
234
|
lists: []
|
|
223
235
|
}
|
|
224
236
|
for (let i = 0; i <= 23; i++) {
|
|
225
|
-
hh.lists.push([i, $
|
|
237
|
+
hh.lists.push([i, $n_padStart(String(i), 2, '0')])
|
|
226
238
|
}
|
|
227
239
|
const ii = {
|
|
228
240
|
type: 'ii',
|
|
229
241
|
lists: []
|
|
230
242
|
}
|
|
231
243
|
for (let i = 0; i <= 59; i++) {
|
|
232
|
-
ii.lists.push([i, $
|
|
244
|
+
ii.lists.push([i, $n_padStart(String(i), 2, '0')])
|
|
233
245
|
}
|
|
234
246
|
arr.push(hh, ii)
|
|
235
247
|
if (props.showSecond) {
|
|
@@ -238,7 +250,7 @@ export default {
|
|
|
238
250
|
lists: []
|
|
239
251
|
}
|
|
240
252
|
for (let i = 0; i <= 59; i++) {
|
|
241
|
-
ss.lists.push([i, $
|
|
253
|
+
ss.lists.push([i, $n_padStart(String(i), 2, '0')])
|
|
242
254
|
}
|
|
243
255
|
arr.push(ss)
|
|
244
256
|
}
|
|
@@ -267,7 +279,7 @@ export default {
|
|
|
267
279
|
lists: []
|
|
268
280
|
}
|
|
269
281
|
for (let i = 1; i <= 12; i++) {
|
|
270
|
-
mm.lists.push([i, $
|
|
282
|
+
mm.lists.push([i, $n_padStart(String(i), 2, '0')])
|
|
271
283
|
}
|
|
272
284
|
|
|
273
285
|
arr.push(mm)
|
|
@@ -333,9 +345,9 @@ export default {
|
|
|
333
345
|
ii: '',
|
|
334
346
|
})
|
|
335
347
|
|
|
336
|
-
if ($
|
|
348
|
+
if ($n_isDate(val)) {
|
|
337
349
|
|
|
338
|
-
const { hh, ii, ss } = $
|
|
350
|
+
const { hh, ii, ss } = $n_dateObject(val)
|
|
339
351
|
|
|
340
352
|
// 设置时间数据
|
|
341
353
|
Object.assign(obj, {
|
|
@@ -368,8 +380,8 @@ export default {
|
|
|
368
380
|
obj.y = val
|
|
369
381
|
|
|
370
382
|
// 否则如果是日期格式
|
|
371
|
-
} else if ($
|
|
372
|
-
const { y } = $
|
|
383
|
+
} else if ($n_isDate(val)) {
|
|
384
|
+
const { y } = $n_dateObject(val)
|
|
373
385
|
obj.y = y
|
|
374
386
|
}
|
|
375
387
|
}
|
|
@@ -380,13 +392,13 @@ export default {
|
|
|
380
392
|
// 否则是选择月
|
|
381
393
|
|
|
382
394
|
// 如果是这样的格式 202207, 则转换为 2022-07
|
|
383
|
-
const newVal = $
|
|
395
|
+
const newVal = $n_ymd.toString(val)
|
|
384
396
|
if (newVal) {
|
|
385
397
|
val = newVal
|
|
386
398
|
}
|
|
387
399
|
|
|
388
|
-
if ($
|
|
389
|
-
const { y, mm } = $
|
|
400
|
+
if ($n_isDate(val)) {
|
|
401
|
+
const { y, mm } = $n_dateObject(val)
|
|
390
402
|
Object.assign(obj, {
|
|
391
403
|
y,
|
|
392
404
|
mm,
|
|
@@ -404,13 +416,13 @@ export default {
|
|
|
404
416
|
let to = ''
|
|
405
417
|
|
|
406
418
|
// 如果是这样的格式 20220708, 则转换为 2022-07-08
|
|
407
|
-
const newVal = $
|
|
419
|
+
const newVal = $n_ymd.toString(val)
|
|
408
420
|
if (newVal) {
|
|
409
421
|
val = newVal
|
|
410
422
|
}
|
|
411
423
|
|
|
412
|
-
if ($
|
|
413
|
-
const { y, mm, dd } = $
|
|
424
|
+
if ($n_isDate(val)) {
|
|
425
|
+
const { y, mm, dd } = $n_dateObject(val)
|
|
414
426
|
from = `${y}/${mm}/${dd}`
|
|
415
427
|
|
|
416
428
|
// 如果不是日期选择范围, 则返回单个日期
|
|
@@ -420,8 +432,8 @@ export default {
|
|
|
420
432
|
}
|
|
421
433
|
|
|
422
434
|
// 如果是日期选择范围
|
|
423
|
-
if (isRange.value && $
|
|
424
|
-
const { y, mm, dd } = $
|
|
435
|
+
if (isRange.value && $n_isDate(props.end)) {
|
|
436
|
+
const { y, mm, dd } = $n_dateObject(props.end)
|
|
425
437
|
to = `${y}/${mm}/${dd}`
|
|
426
438
|
}
|
|
427
439
|
|
|
@@ -441,8 +453,8 @@ export default {
|
|
|
441
453
|
to: '',
|
|
442
454
|
}
|
|
443
455
|
|
|
444
|
-
if ($
|
|
445
|
-
const { hh, ii, ss } = $
|
|
456
|
+
if ($n_isDate(props.modelValue)) {
|
|
457
|
+
const { hh, ii, ss } = $n_dateObject(props.modelValue)
|
|
446
458
|
obj.from = `${hh}:${ii}`
|
|
447
459
|
if (props.showSecond) {
|
|
448
460
|
obj.from += `:${ss}`
|
|
@@ -455,8 +467,8 @@ export default {
|
|
|
455
467
|
obj.from = props.showSecond ? '00:00:00' : '00:00'
|
|
456
468
|
}
|
|
457
469
|
|
|
458
|
-
if (isRange.value && $
|
|
459
|
-
const { hh, ii, ss } = $
|
|
470
|
+
if (isRange.value && $n_isDate(props.end)) {
|
|
471
|
+
const { hh, ii, ss } = $n_dateObject(props.end)
|
|
460
472
|
obj.to = `${hh}:${ii}`
|
|
461
473
|
if (props.showSecond) {
|
|
462
474
|
obj.to += `:${ss}`
|
|
@@ -482,9 +494,9 @@ export default {
|
|
|
482
494
|
// 如果是选择时间
|
|
483
495
|
if (props.type === 'time') {
|
|
484
496
|
if (
|
|
485
|
-
! $
|
|
486
|
-
|| ! $
|
|
487
|
-
|| (props.showSecond && ! $
|
|
497
|
+
! $n_isValidValue(dateValue.hh)
|
|
498
|
+
|| ! $n_isValidValue(dateValue.ii)
|
|
499
|
+
|| (props.showSecond && ! $n_isValidValue(dateValue.ss))) {
|
|
488
500
|
return ''
|
|
489
501
|
}
|
|
490
502
|
format = 'HH:mm'
|
|
@@ -495,13 +507,13 @@ export default {
|
|
|
495
507
|
|
|
496
508
|
// 否则是选择年月
|
|
497
509
|
} else {
|
|
498
|
-
if (! $
|
|
510
|
+
if (! $n_isValidValue(dateValue.y)) {
|
|
499
511
|
return ''
|
|
500
512
|
}
|
|
501
513
|
|
|
502
514
|
const isMonth = props.type === 'month'
|
|
503
515
|
if (isMonth) {
|
|
504
|
-
if (! $
|
|
516
|
+
if (! $n_isValidValue(dateValue.mm)) {
|
|
505
517
|
return ''
|
|
506
518
|
}
|
|
507
519
|
|
|
@@ -526,7 +538,7 @@ export default {
|
|
|
526
538
|
return ''
|
|
527
539
|
}
|
|
528
540
|
|
|
529
|
-
if (! $
|
|
541
|
+
if (! $n_isRequired(dateValue)) {
|
|
530
542
|
return ''
|
|
531
543
|
}
|
|
532
544
|
|
|
@@ -538,8 +550,8 @@ export default {
|
|
|
538
550
|
} = dateValue
|
|
539
551
|
|
|
540
552
|
if (
|
|
541
|
-
! $
|
|
542
|
-
|| ! $
|
|
553
|
+
! $n_isValidValue(from)
|
|
554
|
+
|| ! $n_isValidValue(to)
|
|
543
555
|
) {
|
|
544
556
|
return ''
|
|
545
557
|
}
|
|
@@ -616,7 +628,7 @@ export default {
|
|
|
616
628
|
function onUpdateDateValue(val) {
|
|
617
629
|
|
|
618
630
|
// 如果为 null, 则清空数据
|
|
619
|
-
if ($
|
|
631
|
+
if ($n_isNil(val)) {
|
|
620
632
|
emit('update:modelValue', null)
|
|
621
633
|
if (isRange.value) {
|
|
622
634
|
emit('update:end', null)
|
|
@@ -698,7 +710,7 @@ export default {
|
|
|
698
710
|
* 提交
|
|
699
711
|
*/
|
|
700
712
|
function onEmit(key, value) {
|
|
701
|
-
emit(key, $
|
|
713
|
+
emit(key, $n_numberDeep(value))
|
|
702
714
|
}
|
|
703
715
|
|
|
704
716
|
/**
|
|
@@ -712,9 +724,9 @@ export default {
|
|
|
712
724
|
nextTick(function() {
|
|
713
725
|
|
|
714
726
|
// 遍历选择列表
|
|
715
|
-
$
|
|
727
|
+
$n_forEach(selectLists.value, function(selectItem, selectItemIndex) {
|
|
716
728
|
// 遍历选单个列表
|
|
717
|
-
$
|
|
729
|
+
$n_forEach(selectItem.lists, function(item, itemIndex) {
|
|
718
730
|
if (dateValue.value[selectItem.type] !== '' && dateValue.value[selectItem.type] == item[0]) {
|
|
719
731
|
scrollRef.value[selectItemIndex].setScrollPosition('vertical', 32 * itemIndex, 0)
|
|
720
732
|
return true
|
|
@@ -176,6 +176,34 @@
|
|
|
176
176
|
<script>
|
|
177
177
|
import { ref, computed, watch, onUpdated } from 'vue'
|
|
178
178
|
|
|
179
|
+
import $n_has from 'lodash/has'
|
|
180
|
+
import $n_uniq from 'lodash/uniq'
|
|
181
|
+
import $n_cloneDeep from 'lodash/cloneDeep'
|
|
182
|
+
import $n_isFunction from 'lodash/isFunction'
|
|
183
|
+
import $n_findIndex from 'lodash/findIndex'
|
|
184
|
+
import $n_get from 'lodash/get'
|
|
185
|
+
|
|
186
|
+
import $n_forEach from '@netang/utils/forEach'
|
|
187
|
+
import $n_isValidArray from '@netang/utils/isValidArray'
|
|
188
|
+
import $n_join from '@netang/utils/join'
|
|
189
|
+
import $n_split from '@netang/utils/split'
|
|
190
|
+
import $n_isValidObject from '@netang/utils/isValidObject'
|
|
191
|
+
import $n_isValidValue from '@netang/utils/isValidValue'
|
|
192
|
+
import $n_isValidString from '@netang/utils/isValidString'
|
|
193
|
+
import $n_numberDeep from '@netang/utils/numberDeep'
|
|
194
|
+
import $n_sleep from '@netang/utils/sleep'
|
|
195
|
+
import $n_http from '@netang/utils/http'
|
|
196
|
+
|
|
197
|
+
import $n_power from '../../utils/power'
|
|
198
|
+
import $n_table from '../../utils/table'
|
|
199
|
+
|
|
200
|
+
import { configs } from '../../utils/config'
|
|
201
|
+
|
|
202
|
+
const {
|
|
203
|
+
// 字典常量
|
|
204
|
+
dicts,
|
|
205
|
+
} = configs
|
|
206
|
+
|
|
179
207
|
export default {
|
|
180
208
|
|
|
181
209
|
/**
|
|
@@ -217,19 +245,19 @@ export default {
|
|
|
217
245
|
default: ',',
|
|
218
246
|
},
|
|
219
247
|
|
|
220
|
-
//
|
|
248
|
+
// 请求路径
|
|
221
249
|
path: String,
|
|
222
|
-
//
|
|
250
|
+
// 请求参数
|
|
223
251
|
query: Object,
|
|
224
252
|
// 附加请求数据
|
|
225
253
|
data: Object,
|
|
226
254
|
// 初始不加载已选数据
|
|
227
|
-
|
|
255
|
+
noDefaultLoadSelected: Boolean,
|
|
228
256
|
// 更新值时不加载已选数据
|
|
229
257
|
noUpdateLoadSelected: Boolean,
|
|
230
258
|
// 格式化显示标签
|
|
231
259
|
formatLabel: Function,
|
|
232
|
-
//
|
|
260
|
+
// 下拉表格显示的字段数组(空为:[值字段, 标签字段])
|
|
233
261
|
showKeys: Array,
|
|
234
262
|
// 隐藏搜索字段数组
|
|
235
263
|
hideSearchKeys: Array,
|
|
@@ -251,7 +279,7 @@ export default {
|
|
|
251
279
|
rows: Array,
|
|
252
280
|
// 是否多选
|
|
253
281
|
multiple: Boolean,
|
|
254
|
-
//
|
|
282
|
+
// 多选模式下是否折叠标签
|
|
255
283
|
collapseTags: Boolean,
|
|
256
284
|
// 占位符
|
|
257
285
|
placeholder: String,
|
|
@@ -287,7 +315,7 @@ export default {
|
|
|
287
315
|
* 插槽标识
|
|
288
316
|
*/
|
|
289
317
|
const slotNames = computed(function() {
|
|
290
|
-
return $
|
|
318
|
+
return $n_isValidObject(slots) ? Object.keys(slots) : []
|
|
291
319
|
})
|
|
292
320
|
|
|
293
321
|
/**
|
|
@@ -301,7 +329,7 @@ export default {
|
|
|
301
329
|
* 当前显示字段
|
|
302
330
|
*/
|
|
303
331
|
const currentShowKeys = computed(function() {
|
|
304
|
-
return $
|
|
332
|
+
return $n_uniq($n_isValidArray(props.showKeys)
|
|
305
333
|
? props.showKeys
|
|
306
334
|
: [ props.valueKey, currentlabelKey.value ])
|
|
307
335
|
})
|
|
@@ -319,7 +347,7 @@ export default {
|
|
|
319
347
|
const showValue = computed(function () {
|
|
320
348
|
|
|
321
349
|
// 如果有已选数据
|
|
322
|
-
return $
|
|
350
|
+
return $n_isValidArray(selected.value)
|
|
323
351
|
// 取已选数据第一条
|
|
324
352
|
? currentFormatLabel(selected.value[0])
|
|
325
353
|
: ''
|
|
@@ -329,9 +357,9 @@ export default {
|
|
|
329
357
|
|
|
330
358
|
|
|
331
359
|
// 创建权限实例
|
|
332
|
-
const $power = $
|
|
360
|
+
const $power = $n_power.create({
|
|
333
361
|
// 路由路径
|
|
334
|
-
path: $
|
|
362
|
+
path: $n_isValidString(props.path) ? props.path : false,
|
|
335
363
|
// 路由参数
|
|
336
364
|
query: props.query,
|
|
337
365
|
// 关闭权限页面
|
|
@@ -344,7 +372,7 @@ export default {
|
|
|
344
372
|
} = $power
|
|
345
373
|
|
|
346
374
|
// 创建表格实例
|
|
347
|
-
const $table = $
|
|
375
|
+
const $table = $n_table.create({
|
|
348
376
|
// 权限实例
|
|
349
377
|
$power,
|
|
350
378
|
// 附加请求数据
|
|
@@ -372,7 +400,7 @@ export default {
|
|
|
372
400
|
})
|
|
373
401
|
|
|
374
402
|
// 创建睡眠实例
|
|
375
|
-
const sleep = $
|
|
403
|
+
const sleep = $n_sleep()
|
|
376
404
|
|
|
377
405
|
// 输入框节点
|
|
378
406
|
const inputRef = ref(null)
|
|
@@ -502,7 +530,7 @@ export default {
|
|
|
502
530
|
await sleep(props.inputDebounce)
|
|
503
531
|
|
|
504
532
|
// 是否有值
|
|
505
|
-
const hasValue = $
|
|
533
|
+
const hasValue = $n_isValidValue(val)
|
|
506
534
|
|
|
507
535
|
const n_search = {}
|
|
508
536
|
n_search[currentFilterKey.value] = [
|
|
@@ -544,7 +572,7 @@ export default {
|
|
|
544
572
|
// 如果值类型不是数组对象
|
|
545
573
|
props.valueType !== 'objectArray'
|
|
546
574
|
// 如果初始加载已选数据
|
|
547
|
-
&& ! props.
|
|
575
|
+
&& ! props.noDefaultLoadSelected
|
|
548
576
|
// 如果有请求路由路径
|
|
549
577
|
&& routePath
|
|
550
578
|
) {
|
|
@@ -605,14 +633,14 @@ export default {
|
|
|
605
633
|
function currentFormatLabel(item) {
|
|
606
634
|
|
|
607
635
|
// 如果有格式化显示标签方法
|
|
608
|
-
if ($
|
|
636
|
+
if ($n_isFunction(props.formatLabel)) {
|
|
609
637
|
// 执行格式化显示标签方法
|
|
610
638
|
return props.formatLabel(item)
|
|
611
639
|
}
|
|
612
640
|
|
|
613
641
|
// 否则显示该值的标签字段
|
|
614
642
|
const val = item[currentlabelKey.value]
|
|
615
|
-
return $
|
|
643
|
+
return $n_isValidValue(val) ? val : item[props.valueKey]
|
|
616
644
|
}
|
|
617
645
|
|
|
618
646
|
/**
|
|
@@ -634,13 +662,13 @@ export default {
|
|
|
634
662
|
if (props.valueType === 'objectArray') {
|
|
635
663
|
|
|
636
664
|
// 如果是有效数组
|
|
637
|
-
if ($
|
|
665
|
+
if ($n_isValidArray(val)) {
|
|
638
666
|
for (const item of val) {
|
|
639
667
|
if (
|
|
640
668
|
// 如果元素不是有效对象
|
|
641
|
-
! $
|
|
669
|
+
! $n_isValidObject(item)
|
|
642
670
|
// 如果元素没有值字段
|
|
643
|
-
|| ! $
|
|
671
|
+
|| ! $n_has(item, props.valueKey)
|
|
644
672
|
) {
|
|
645
673
|
return []
|
|
646
674
|
}
|
|
@@ -655,16 +683,16 @@ export default {
|
|
|
655
683
|
// 非初始化
|
|
656
684
|
! isFirst
|
|
657
685
|
// 或初始不加载已选数据
|
|
658
|
-
|| props.
|
|
686
|
+
|| props.noDefaultLoadSelected
|
|
659
687
|
// 或没有路由路径
|
|
660
688
|
|| ! routePath
|
|
661
689
|
) {
|
|
662
690
|
// 将值转为数组
|
|
663
|
-
val = props.valueType === 'string' ? $
|
|
691
|
+
val = props.valueType === 'string' ? $n_split(val, props.valueSeparator) : val
|
|
664
692
|
|
|
665
693
|
// 如果是有效数组
|
|
666
|
-
if ($
|
|
667
|
-
val = val.filter(e => $
|
|
694
|
+
if ($n_isValidArray(val)) {
|
|
695
|
+
val = val.filter(e => $n_isValidValue(e))
|
|
668
696
|
return toSelected ? val.map(e => setSelectedItem(e)) : val
|
|
669
697
|
}
|
|
670
698
|
}
|
|
@@ -705,7 +733,7 @@ export default {
|
|
|
705
733
|
}
|
|
706
734
|
|
|
707
735
|
// 返回转为分隔符隔开的字符串
|
|
708
|
-
return $
|
|
736
|
+
return $n_numberDeep($n_join(values, props.valueSeparator))
|
|
709
737
|
}
|
|
710
738
|
|
|
711
739
|
/**
|
|
@@ -714,7 +742,7 @@ export default {
|
|
|
714
742
|
async function onRequestSelected(value) {
|
|
715
743
|
|
|
716
744
|
// 请求数据
|
|
717
|
-
const { status, data } = await $
|
|
745
|
+
const { status, data } = await $n_http({
|
|
718
746
|
url: $table.routePath,
|
|
719
747
|
data: Object.assign(
|
|
720
748
|
// 获取表格请求数据
|
|
@@ -743,7 +771,7 @@ export default {
|
|
|
743
771
|
),
|
|
744
772
|
})
|
|
745
773
|
|
|
746
|
-
return status && $
|
|
774
|
+
return status && $n_isValidArray($n_get(data, 'rows')) ? data.rows : []
|
|
747
775
|
}
|
|
748
776
|
|
|
749
777
|
/**
|
|
@@ -754,24 +782,24 @@ export default {
|
|
|
754
782
|
let columns
|
|
755
783
|
|
|
756
784
|
// 如果有声明路由表格列数据
|
|
757
|
-
if ($
|
|
758
|
-
columns = $
|
|
785
|
+
if ($n_isValidArray(props.columns)) {
|
|
786
|
+
columns = $n_cloneDeep(props.columns)
|
|
759
787
|
|
|
760
788
|
// 如果有路由路径
|
|
761
789
|
} else if (routePath) {
|
|
762
790
|
// 否则如果有路由表格列数据
|
|
763
|
-
const rawTableColumns = $
|
|
764
|
-
if ($
|
|
765
|
-
columns = $
|
|
791
|
+
const rawTableColumns = $n_table.config(routePath, 'columns')
|
|
792
|
+
if ($n_isValidArray(rawTableColumns)) {
|
|
793
|
+
columns = $n_cloneDeep(rawTableColumns)
|
|
766
794
|
}
|
|
767
795
|
}
|
|
768
796
|
|
|
769
|
-
if ($
|
|
770
|
-
if ($
|
|
797
|
+
if ($n_isValidArray(columns)) {
|
|
798
|
+
if ($n_isValidArray(props.hideSearchKeys)) {
|
|
771
799
|
for (const item of columns) {
|
|
772
800
|
if (
|
|
773
801
|
props.hideSearchKeys.indexOf(item.name) > -1
|
|
774
|
-
&& $
|
|
802
|
+
&& $n_has(item, 'search')
|
|
775
803
|
) {
|
|
776
804
|
item.search.hide = true
|
|
777
805
|
}
|
|
@@ -791,21 +819,21 @@ export default {
|
|
|
791
819
|
const columns = []
|
|
792
820
|
|
|
793
821
|
// 如果有原始表格列数据
|
|
794
|
-
if ($
|
|
822
|
+
if ($n_isValidArray($table.tableColumns)) {
|
|
795
823
|
|
|
796
824
|
// 克隆原始表格列数据
|
|
797
|
-
const rawTableColumns = $
|
|
825
|
+
const rawTableColumns = $n_cloneDeep($table.tableColumns)
|
|
798
826
|
|
|
799
827
|
// 快捷表格显示的属性名称数组
|
|
800
|
-
$
|
|
828
|
+
$n_forEach(currentShowKeys.value, function (key) {
|
|
801
829
|
for (const item of rawTableColumns) {
|
|
802
830
|
if (item.name === key) {
|
|
803
831
|
// 删除搜索字段
|
|
804
|
-
if ($
|
|
832
|
+
if ($n_has(item, 'search')) {
|
|
805
833
|
delete item.search
|
|
806
834
|
}
|
|
807
835
|
// 删除可见字段
|
|
808
|
-
if ($
|
|
836
|
+
if ($n_has(item, 'visible')) {
|
|
809
837
|
delete item.visible
|
|
810
838
|
}
|
|
811
839
|
columns.push(item)
|
|
@@ -982,7 +1010,7 @@ export default {
|
|
|
982
1010
|
opt[props.valueKey] = row[props.valueKey]
|
|
983
1011
|
|
|
984
1012
|
// 获取当前数据索引
|
|
985
|
-
const itemIndex = $
|
|
1013
|
+
const itemIndex = $n_findIndex(_selected, opt)
|
|
986
1014
|
|
|
987
1015
|
// 如果不存在
|
|
988
1016
|
if (itemIndex === -1) {
|
|
@@ -1049,7 +1077,7 @@ export default {
|
|
|
1049
1077
|
onUpdated(function () {
|
|
1050
1078
|
if (
|
|
1051
1079
|
popupRef.value
|
|
1052
|
-
&& $
|
|
1080
|
+
&& $n_has(popupRef.value, 'currentComponent.ref.updatePosition')
|
|
1053
1081
|
) {
|
|
1054
1082
|
popupRef.value.currentComponent.ref.updatePosition()
|
|
1055
1083
|
}
|
|
@@ -1118,8 +1146,6 @@ export default {
|
|
|
1118
1146
|
</script>
|
|
1119
1147
|
|
|
1120
1148
|
<style lang="scss">
|
|
1121
|
-
@import "@/assets/sass/var.scss";
|
|
1122
|
-
|
|
1123
1149
|
.n-field-table {
|
|
1124
1150
|
.q-field__input--padding {
|
|
1125
1151
|
padding-left: 4px;
|
|
@@ -73,6 +73,10 @@
|
|
|
73
73
|
<script>
|
|
74
74
|
import { computed } from 'vue'
|
|
75
75
|
|
|
76
|
+
import $n_forIn from '@netang/utils/forIn'
|
|
77
|
+
|
|
78
|
+
import $n_copy from '../../utils/copy'
|
|
79
|
+
|
|
76
80
|
export default {
|
|
77
81
|
|
|
78
82
|
/**
|
|
@@ -131,7 +135,7 @@ export default {
|
|
|
131
135
|
const slotNames = computed(function() {
|
|
132
136
|
const lists = []
|
|
133
137
|
|
|
134
|
-
$
|
|
138
|
+
$n_forIn(slots, function(val, key) {
|
|
135
139
|
if (key !== 'default') {
|
|
136
140
|
lists.push(key)
|
|
137
141
|
}
|
|
@@ -148,7 +152,7 @@ export default {
|
|
|
148
152
|
function onCopy() {
|
|
149
153
|
const val = props.copyText || props.value
|
|
150
154
|
if (val) {
|
|
151
|
-
$
|
|
155
|
+
$n_copy(val, `复制【${props.label}】成功`)
|
|
152
156
|
}
|
|
153
157
|
}
|
|
154
158
|
|