vue2-client 1.8.132 → 1.8.133
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/package.json
CHANGED
|
@@ -53,12 +53,16 @@ export default {
|
|
|
53
53
|
localConfig: {
|
|
54
54
|
type: Object,
|
|
55
55
|
default: undefined
|
|
56
|
+
},
|
|
57
|
+
dontFormat: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: false
|
|
56
60
|
}
|
|
57
61
|
},
|
|
58
62
|
components: {
|
|
59
63
|
XReportDesign
|
|
60
64
|
},
|
|
61
|
-
data
|
|
65
|
+
data() {
|
|
62
66
|
return {
|
|
63
67
|
config: undefined,
|
|
64
68
|
type: 'design',
|
|
@@ -77,7 +81,7 @@ export default {
|
|
|
77
81
|
},
|
|
78
82
|
methods: {
|
|
79
83
|
// 检查slot是否在配置文件中包含,如果没有包含,则视为非法获取
|
|
80
|
-
checkSlotDefine
|
|
84
|
+
checkSlotDefine(config) {
|
|
81
85
|
const slotsDeclare = config.slotsDeclare
|
|
82
86
|
const total = slotsDeclare.length
|
|
83
87
|
let count = 0
|
|
@@ -94,16 +98,16 @@ export default {
|
|
|
94
98
|
return count === total
|
|
95
99
|
},
|
|
96
100
|
// 切换了标签页
|
|
97
|
-
tabChanged
|
|
101
|
+
tabChanged(key) {
|
|
98
102
|
this.scanFinish = false
|
|
99
|
-
this.originalConfig.data = {
|
|
103
|
+
this.originalConfig.data = {...this.originalConfig.data, ...this.config.data}
|
|
100
104
|
this.config.data = this.originalConfig.data
|
|
101
105
|
this.$nextTick(() => {
|
|
102
106
|
this.scanFinish = true
|
|
103
107
|
})
|
|
104
108
|
},
|
|
105
109
|
// 获取当前日期,为保存文件命名用
|
|
106
|
-
getDate
|
|
110
|
+
getDate() {
|
|
107
111
|
const currentDate = new Date()
|
|
108
112
|
|
|
109
113
|
const year = currentDate.getFullYear()
|
|
@@ -115,7 +119,7 @@ export default {
|
|
|
115
119
|
return formattedDate
|
|
116
120
|
},
|
|
117
121
|
// 导出PDF
|
|
118
|
-
exportPDF
|
|
122
|
+
exportPDF() {
|
|
119
123
|
const date = this.getDate()
|
|
120
124
|
let title = this.config.title
|
|
121
125
|
title = title.replace(/<[^>]+>/g, '')
|
|
@@ -123,7 +127,7 @@ export default {
|
|
|
123
127
|
HtmlToPdf.getPdf(fileName, '#printReady')
|
|
124
128
|
},
|
|
125
129
|
// 用于分割配置中的colums,将需要处理的数组提取出来
|
|
126
|
-
formatConfigRow
|
|
130
|
+
formatConfigRow() {
|
|
127
131
|
for (let i = 0; i < this.config.columns.length; i++) {
|
|
128
132
|
// 对原始数组进行递归,依次将该位置拆分为三个部分,当前处理位置之前的,当前处理位置,当前处理位置之后的
|
|
129
133
|
const before = this.config.columns.slice(0, i)
|
|
@@ -173,7 +177,7 @@ export default {
|
|
|
173
177
|
}
|
|
174
178
|
},
|
|
175
179
|
// 处理colums数组,为声明了rowspan的单元格,自动匹配格式
|
|
176
|
-
checkRow
|
|
180
|
+
checkRow(rowArr) {
|
|
177
181
|
// 不需要更改的数据
|
|
178
182
|
const original = []
|
|
179
183
|
// 需要更改新加的数据
|
|
@@ -204,7 +208,14 @@ export default {
|
|
|
204
208
|
}
|
|
205
209
|
|
|
206
210
|
if (cell.text && total !== 0) { // 如果遇到了下一个声明行,证明rowspan少了一行,需要补充一个占位格
|
|
207
|
-
const nullObj = {
|
|
211
|
+
const nullObj = {
|
|
212
|
+
type: 'placeHolderColumn',
|
|
213
|
+
order: subRowIndex,
|
|
214
|
+
noBoarder: true,
|
|
215
|
+
needSplit: true,
|
|
216
|
+
colSpan: preColSpan,
|
|
217
|
+
dontShowRow: true
|
|
218
|
+
}
|
|
208
219
|
subRowIndex++
|
|
209
220
|
waitForAddArr.push(nullObj)
|
|
210
221
|
total = 0
|
|
@@ -213,7 +224,14 @@ export default {
|
|
|
213
224
|
firstSubLine = false
|
|
214
225
|
} else if ((total !== count + cell.rowSpan) && forEachCount === rowArr.length) {
|
|
215
226
|
// 如果没有遇到了下一个声明行,但已经是当前行最后一个数据,也证明rowspan少了一行,需要补充一个占位格
|
|
216
|
-
const nullObj = {
|
|
227
|
+
const nullObj = {
|
|
228
|
+
type: 'placeHolderColumn',
|
|
229
|
+
order: subRowIndex,
|
|
230
|
+
noBoarder: true,
|
|
231
|
+
needSplit: true,
|
|
232
|
+
colSpan: preColSpan,
|
|
233
|
+
dontShowRow: true
|
|
234
|
+
}
|
|
217
235
|
subRowIndex++
|
|
218
236
|
waitForAddArr.push(nullObj)
|
|
219
237
|
total = 0
|
|
@@ -304,7 +322,7 @@ export default {
|
|
|
304
322
|
}
|
|
305
323
|
},
|
|
306
324
|
// 扫描配置,如果有插槽则拼接插槽
|
|
307
|
-
scanConfigSlot
|
|
325
|
+
scanConfigSlot(config) {
|
|
308
326
|
const columnsArr = config.columns
|
|
309
327
|
for (let i = 0; i < columnsArr.length; i++) {
|
|
310
328
|
for (let j = 0; j < columnsArr[i].length; j++) {
|
|
@@ -365,7 +383,7 @@ export default {
|
|
|
365
383
|
config.slotsDeclare = []
|
|
366
384
|
}
|
|
367
385
|
|
|
368
|
-
config.data = {
|
|
386
|
+
config.data = {...config.data, ...this.configFromWeb[targetName].data}
|
|
369
387
|
this.configFromWeb = {}
|
|
370
388
|
}
|
|
371
389
|
}
|
|
@@ -373,7 +391,7 @@ export default {
|
|
|
373
391
|
this.config = config
|
|
374
392
|
},
|
|
375
393
|
// 扫描所有插槽名
|
|
376
|
-
scanConfigName
|
|
394
|
+
scanConfigName(config, resut) {
|
|
377
395
|
if (config.slotsDeclare) {
|
|
378
396
|
config.slotsDeclare.forEach(name => {
|
|
379
397
|
resut.push(name)
|
|
@@ -381,7 +399,7 @@ export default {
|
|
|
381
399
|
}
|
|
382
400
|
},
|
|
383
401
|
// 获取插槽
|
|
384
|
-
getConfigAndJoin
|
|
402
|
+
getConfigAndJoin(config, outerLock) {
|
|
385
403
|
// 检查主配置插槽声明是否合法
|
|
386
404
|
const check = this.checkSlotDefine(config)
|
|
387
405
|
const waitForDownloadSlotName = []
|
|
@@ -394,7 +412,7 @@ export default {
|
|
|
394
412
|
|
|
395
413
|
// 挨个获取插槽
|
|
396
414
|
waitForDownloadSlotName.forEach(configName => {
|
|
397
|
-
getConfigByName(configName,
|
|
415
|
+
getConfigByName(configName, 'af-system', res => {
|
|
398
416
|
this.configFromWeb[configName] = res
|
|
399
417
|
count++
|
|
400
418
|
})
|
|
@@ -406,7 +424,7 @@ export default {
|
|
|
406
424
|
clearInterval(timer)
|
|
407
425
|
this.scanConfigSlot(config)
|
|
408
426
|
if (config.slotsDeclare.length > 0) {
|
|
409
|
-
const lock = {
|
|
427
|
+
const lock = {status: true}
|
|
410
428
|
this.getConfigAndJoin(config, lock)
|
|
411
429
|
const innerTimer = setInterval(() => {
|
|
412
430
|
if (!lock.status) {
|
|
@@ -425,8 +443,8 @@ export default {
|
|
|
425
443
|
}
|
|
426
444
|
},
|
|
427
445
|
// 获取配置之后的初始化
|
|
428
|
-
configInit
|
|
429
|
-
const lock = {
|
|
446
|
+
configInit() {
|
|
447
|
+
const lock = {status: true}
|
|
430
448
|
|
|
431
449
|
this.getConfigAndJoin(this.config, lock)
|
|
432
450
|
|
|
@@ -435,8 +453,10 @@ export default {
|
|
|
435
453
|
clearInterval(this.timer)
|
|
436
454
|
console.log('拼接完成', this.config)
|
|
437
455
|
this.originalConfig = Object.assign({}, this.config)
|
|
438
|
-
|
|
439
|
-
|
|
456
|
+
if (!this.dontFormat) {
|
|
457
|
+
// 扫描配置文件中有没有rowSpan,进行格式化调整
|
|
458
|
+
this.formatConfigRow(this.config)
|
|
459
|
+
}
|
|
440
460
|
this.activeConfig = this.config
|
|
441
461
|
this.$nextTick(() => {
|
|
442
462
|
this.scanFinish = true
|
|
@@ -445,12 +465,12 @@ export default {
|
|
|
445
465
|
}, 100)
|
|
446
466
|
}
|
|
447
467
|
},
|
|
448
|
-
beforeMount
|
|
468
|
+
beforeMount() {
|
|
449
469
|
if (this.localConfig) {
|
|
450
470
|
this.config = this.localConfig
|
|
451
471
|
this.configInit()
|
|
452
472
|
} else {
|
|
453
|
-
getConfigByName(this.configName,
|
|
473
|
+
getConfigByName(this.configName, 'af-system', res => {
|
|
454
474
|
this.config = res
|
|
455
475
|
this.configInit()
|
|
456
476
|
})
|
|
@@ -460,10 +480,11 @@ export default {
|
|
|
460
480
|
</script>
|
|
461
481
|
|
|
462
482
|
<style lang="less" scoped>
|
|
463
|
-
.tools{
|
|
483
|
+
.tools {
|
|
464
484
|
text-align: center;
|
|
465
485
|
cursor: pointer;
|
|
466
|
-
|
|
486
|
+
|
|
487
|
+
.toolsItem {
|
|
467
488
|
display: inline-block;
|
|
468
489
|
}
|
|
469
490
|
}
|