vue2-client 1.8.162 → 1.8.164

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.162",
3
+ "version": "1.8.164",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -3,20 +3,7 @@
3
3
  <a-card v-if="showSkeleton">
4
4
  <a-skeleton active/>
5
5
  </a-card>
6
- <!-- 用以包裹整个页面 -->
7
- <a-card v-else>
8
- <!-- 切换菜单 -->
9
- <a-radio-group v-model="type" default-value="a" button-style="solid" @change="tabChanged">
10
- <a-radio-button value="design" v-if="!onlyDisplay">
11
- 设计
12
- </a-radio-button>
13
- <a-radio-button value="display" style="border-radius: 0">
14
- 预览
15
- </a-radio-button>
16
- </a-radio-group>
17
- <a-radio-button @click="saveConfig" style="border-radius: 0 4px 4px 0" v-if="!onlyDisplay">
18
- 保存
19
- </a-radio-button>
6
+ <template v-if="noPadding">
20
7
  <!-- 主体表格 -->
21
8
  <XReportDesign
22
9
  v-if="scanFinish"
@@ -25,20 +12,52 @@
25
12
  :for-display="type === 'display'"
26
13
  ref="XReportDesign"
27
14
  id="printReady"
15
+ :no-padding="noPadding"
16
+ :no-top-border="noTopBorder"
28
17
  :show-images="hasImages"
29
18
  :image-list="imageList">
30
19
  </XReportDesign>
31
- <!-- 导出按钮 -->
32
- <template v-if="type === 'display'">
33
- <div class="tools">
34
- <div class="toolsItem" @click="exportPDF">
35
- <a-button type="primary">
36
- 导出PDF
37
- </a-button>
20
+ </template>
21
+ <template v-else>
22
+ <!-- 用以包裹整个页面 -->
23
+ <a-card v-if="!showSkeleton">
24
+ <!-- 切换菜单 -->
25
+ <a-radio-group v-model="type" default-value="a" button-style="solid" @change="tabChanged">
26
+ <a-radio-button value="design" v-if="!onlyDisplay">
27
+ 设计
28
+ </a-radio-button>
29
+ <a-radio-button value="display" style="border-radius: 0">
30
+ 预览
31
+ </a-radio-button>
32
+ </a-radio-group>
33
+ <a-radio-button @click="saveConfig" style="border-radius: 0 4px 4px 0" v-if="!onlyDisplay">
34
+ 保存
35
+ </a-radio-button>
36
+ <!-- 主体表格 -->
37
+ <XReportDesign
38
+ v-if="scanFinish"
39
+ :config="type === 'display' ? originalConfig : activeConfig"
40
+ :slot-config-name="type === 'display' ? undefined : activatedSlotName"
41
+ :for-display="type === 'display'"
42
+ :no-padding="noPadding"
43
+ :no-top-border="noTopBorder"
44
+ ref="XReportDesign"
45
+ id="printReady"
46
+ :show-images="hasImages"
47
+ :image-list="imageList">
48
+ </XReportDesign>
49
+ <!-- 导出按钮 -->
50
+ <template v-if="type === 'display'">
51
+ <div class="tools">
52
+ <div class="toolsItem" @click="exportPDF">
53
+ <a-button type="primary">
54
+ 导出PDF
55
+ </a-button>
56
+ </div>
38
57
  </div>
39
- </div>
40
- </template>
41
- </a-card>
58
+ </template>
59
+ </a-card>
60
+ </template>
42
61
  </div>
43
62
  </template>
44
63
 
@@ -88,6 +107,14 @@ export default {
88
107
  displayOnly: {
89
108
  type: Boolean,
90
109
  default: false
110
+ },
111
+ noPadding: {
112
+ type: Boolean,
113
+ default: false
114
+ },
115
+ noTopBorder: {
116
+ type: Boolean,
117
+ default: false
91
118
  }
92
119
  },
93
120
  components: {
@@ -599,7 +626,7 @@ export default {
599
626
  if (this.configData === undefined) {
600
627
  console.error('未找到数据!')
601
628
  } else {
602
- this.originalConfig = Object.assign({}, this.localConfig)
629
+ this.originalConfig = Object.assign({}, this.config)
603
630
  this.originalConfig.data = JSON.parse(JSON.stringify(this.configData))
604
631
  this.type = 'display'
605
632
  this.onlyDisplay = true
@@ -613,9 +640,13 @@ export default {
613
640
  beforeMount () {
614
641
  if (this.displayOnly) {
615
642
  this.onlyDisplay = true
643
+ this.type = 'display'
616
644
  }
617
645
  if (this.localConfig) {
618
646
  if (this.localConfig.designMode === 'json') {
647
+ if (this.configData !== undefined) {
648
+ this.config.data = this.configData
649
+ }
619
650
  this.jsonConfigInit()
620
651
  } else {
621
652
  this.config = this.localConfig
@@ -631,6 +662,9 @@ export default {
631
662
  getConfigByName(this.configName, this.serverName, res => {
632
663
  this.config = res
633
664
  if (this.config.designMode === 'json') {
665
+ if (this.configData !== undefined) {
666
+ this.config.data = this.configData
667
+ }
634
668
  this.jsonConfigInit()
635
669
  } else {
636
670
  if (this.configData !== undefined) {
@@ -4,7 +4,7 @@
4
4
  <XReportJsonRender :config="activatedConfig"/>
5
5
  </template>
6
6
  <template v-else>
7
- <div class="reportMain" :style="activatedConfig.width > 0 ? ('width:' + activatedConfig.width + 'px') : undefined">
7
+ <div :class=" noPadding ? 'reportMainNoPadding' : 'reportMain'" :style="activatedConfig.width > 0 ? ('width:' + activatedConfig.width + 'px') : undefined">
8
8
  <!-- 大标题 -->
9
9
  <h2 class="reportTitle" v-if="activatedConfig.title" v-html="activatedConfig.title"></h2>
10
10
  <!-- 小标题 / 介乎于标题与表格之间的内容 -->
@@ -45,10 +45,23 @@
45
45
  <!-- 普通行 -->
46
46
  <template v-if="row[0].type !== 'inputColumns' && row[0].type !== 'list'">
47
47
  <template v-if="!forDisplay">
48
- <x-report-tr-group :key="rowIndex" :columns="row" :config-data="activatedConfig.data" :config="activatedConfig"></x-report-tr-group>
48
+ <x-report-tr-group
49
+ :key="rowIndex"
50
+ :columns="row"
51
+ :no-top-border="noTopBorder"
52
+ :config-data="activatedConfig.data"
53
+ :config="activatedConfig">
54
+ </x-report-tr-group>
49
55
  </template>
50
56
  <template v-else>
51
- <x-report-tr-group :config="activatedConfig" :key="rowIndex" :columns="row" :config-data="activatedConfig.data" :display="true"></x-report-tr-group>
57
+ <x-report-tr-group
58
+ :config="activatedConfig"
59
+ :key="rowIndex"
60
+ :columns="row"
61
+ :no-top-border="noTopBorder"
62
+ :config-data="activatedConfig.data"
63
+ :display="true">
64
+ </x-report-tr-group>
52
65
  </template>
53
66
  </template>
54
67
  <!-- 列表 -->
@@ -58,6 +71,7 @@
58
71
  :config="activatedConfig"
59
72
  :key="rowIndex + listIndex"
60
73
  :columns="row"
74
+ :no-top-border="noTopBorder"
61
75
  :config-data="activatedConfig.data"
62
76
  :list-index="listIndex">
63
77
  </x-report-tr-group>
@@ -67,6 +81,7 @@
67
81
  :config="activatedConfig"
68
82
  :key="rowIndex + listIndex"
69
83
  :columns="row"
84
+ :no-top-border="noTopBorder"
70
85
  :config-data="activatedConfig.data"
71
86
  :list-index="listIndex"
72
87
  :display="true">
@@ -81,6 +96,7 @@
81
96
  :columns="row[0].definition"
82
97
  :config-data="{arr: activatedConfig.data[row[0].dataIndex]}"
83
98
  :input-columns="true"
99
+ :no-top-border="noTopBorder"
84
100
  v-for="(item, definitionIndex) in activatedConfig.data[row[0].dataIndex]"
85
101
  :input-columns-definition-index="definitionIndex"
86
102
  :display="true"
@@ -92,6 +108,7 @@
92
108
  :columns="row[0].definition"
93
109
  :config-data="{arr: activatedConfig.data[row[0].dataIndex]}"
94
110
  :input-columns="true"
111
+ :no-top-border="noTopBorder"
95
112
  v-for="(item, definitionIndex) in activatedConfig.data[row[0].dataIndex]"
96
113
  :input-columns-definition-index="definitionIndex"
97
114
  :key="row[0].dataIndex + definitionIndex + rowIndex"></x-report-tr-group>
@@ -100,6 +117,7 @@
100
117
  :config="activatedConfig"
101
118
  :key="rowIndex"
102
119
  :columns="row"
120
+ :no-top-border="noTopBorder"
103
121
  :config-data="activatedConfig.data"
104
122
  :input-columns-button="true"
105
123
  :input-columns="true">
@@ -151,6 +169,14 @@ export default {
151
169
  imageList: {
152
170
  type: Array,
153
171
  default: undefined
172
+ },
173
+ noPadding: {
174
+ type: Boolean,
175
+ default: false
176
+ },
177
+ noTopBorder: {
178
+ type: Boolean,
179
+ default: false
154
180
  }
155
181
  },
156
182
  components: {
@@ -328,6 +354,48 @@ export default {
328
354
  word-break:break-all;
329
355
  }
330
356
  }
357
+ .reportMainNoPadding {
358
+ text-align: center;
359
+ margin: 0 auto;
360
+ font-size: 16px;
361
+ color: #000;
362
+ background-color: #fff;
363
+ border-radius: 8px;
364
+
365
+ .reportTitle {
366
+ font-weight: bold;
367
+ }
368
+
369
+ .subTitle {
370
+ display: flex;
371
+ justify-content: space-between;
372
+
373
+ .subTitleItems {
374
+ max-width: 30%;
375
+ }
376
+ }
377
+
378
+ .inputsDiv {
379
+ display: flex;
380
+ justify-content: space-between;
381
+ .inputsDivItem {
382
+ display: flex;
383
+ align-items: center;
384
+ padding: 0 4px;
385
+ white-space: nowrap;
386
+ .inputsDivItemLabel {
387
+ padding: 0 4px;
388
+ }
389
+ }
390
+ }
391
+
392
+ .reportTable {
393
+ width: 100%;
394
+ border-collapse: collapse;
395
+ table-layout:fixed;
396
+ word-break:break-all;
397
+ }
398
+ }
331
399
  .tools{
332
400
  position: fixed;
333
401
  right: 2%;
@@ -7,7 +7,7 @@
7
7
  v-for="(cell, cellIndex) in columns"
8
8
  v-if="!cell.dontShowRow"
9
9
  :key="cellIndex"
10
- :class=" cell.noBoarder ? 'tdNoBorder' : 'tdWithBorder'"
10
+ :class=" calcTDBorder(cell.noBoarder) "
11
11
  :style="cell.style ? cell.style : undefined"
12
12
  :colspan="cell.colSpan ? cell.colSpan : undefined">
13
13
  <template v-if="cell.type === 'column'">
@@ -57,6 +57,9 @@
57
57
  <template v-for="(img,imgIndex) in getDeepObject(configData.images, cell.dataIndex)">
58
58
  <span :key="imgIndex" style="margin-right: 5%">{{ img.name }}</span>
59
59
  </template>
60
+ <template v-if="getDeepObject(configData.images, cell.dataIndex).length === 0">
61
+ <span>无</span>
62
+ </template>
60
63
  </template>
61
64
  </td>
62
65
  </template>
@@ -64,7 +67,7 @@
64
67
  <td
65
68
  v-for="(cell, cellIndex) in columns"
66
69
  :key="cellIndex"
67
- :class=" cell.noBoarder ? 'tdNoBorder' : 'tdWithBorder'"
70
+ :class=" calcTDBorder(cell.noBoarder) "
68
71
  :colspan="cell.colSpan ? cell.colSpan : undefined"
69
72
  :style="cell.style ? cell.style : undefined"
70
73
  :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
@@ -117,7 +120,7 @@
117
120
  <td
118
121
  v-for="(cell, cellIndex) in columns"
119
122
  :key="cellIndex"
120
- :class=" cell.noBoarder ? 'tdNoBorder' : 'tdWithBorder'"
123
+ :class=" calcTDBorder(cell.noBoarder) "
121
124
  :colspan="cell.colSpan ? cell.colSpan : undefined"
122
125
  :style="cell.style ? cell.style : undefined"
123
126
  :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
@@ -244,7 +247,7 @@
244
247
  </template>
245
248
  <!-- 动态行插入按钮 -->
246
249
  <template v-else-if="inputColumnsButton">
247
- <td :colspan="maxColSpan" class="tdWithBorder">
250
+ <td :colspan="maxColSpan" :class="calcTDBorder()">
248
251
  <a-button-group>
249
252
  <a-button @click="addData(columns[0].dataIndex, columns)">
250
253
  <a-icon type="plus"/>
@@ -260,7 +263,7 @@
260
263
  <td
261
264
  v-for="(cell, cellIndex) in columns"
262
265
  :key="cellIndex"
263
- :class=" cell.noBoarder ? 'tdNoBorder' : 'tdWithBorder'"
266
+ :class=" calcTDBorder(cell.noBoarder) "
264
267
  :colspan="cell.colSpan ? cell.colSpan : undefined"
265
268
  :style="cell.style ? cell.style : undefined"
266
269
  :rowspan="cell.rowSpan ? cell.rowSpan : undefined">
@@ -365,6 +368,10 @@ export default {
365
368
  listIndex: {
366
369
  type: Number,
367
370
  default: undefined
371
+ },
372
+ noTopBorder: {
373
+ type: Boolean,
374
+ default: false
368
375
  }
369
376
  },
370
377
  data () {
@@ -481,6 +488,17 @@ export default {
481
488
  }
482
489
  }
483
490
  },
491
+ calcTDBorder (cellNoBorder = false) {
492
+ if (cellNoBorder) {
493
+ return 'tdNoBorder'
494
+ } else {
495
+ if (this.noTopBorder) {
496
+ return 'tdWithNoTopBorder'
497
+ } else {
498
+ return 'tdWithBorder'
499
+ }
500
+ }
501
+ },
484
502
  // 根据format计算输入框之前的文字显示
485
503
  displayFormatStartText (formatStr) {
486
504
  let count = 0
@@ -567,4 +585,12 @@ export default {
567
585
  border: 1px solid #000;
568
586
  padding: 8px;
569
587
  }
588
+
589
+ .tdWithNoTopBorder {
590
+ border-top-style: none;
591
+ border-left: 1px solid #000;
592
+ border-right: 1px solid #000;
593
+ border-bottom: 1px solid #000;
594
+ padding: 8px;
595
+ }
570
596
  </style>
@@ -1,17 +1,20 @@
1
1
  <template>
2
- <div>
2
+ <div id="test">
3
3
  <!-- <XReport :config-name="'test_tableConfig'" :activated-slot-name="'test_tableConfig_slot'"/>-->
4
4
  <!-- <XReport :config-name="'test_tableConfig'" :local-config="test_config_withoutSlot" :config-data="test_config_data"/>-->
5
5
  <!-- <XReport :config-name="'test_tableConfig'" :local-config="test_yangchun_json" :config-data="test_yangchun_data" :dont-format="true"/>-->
6
- <!-- <XReport :config-name="'test_tableConfig'" :local-config="test_yangchun_json" :config-data="test_yangchun_jsonData" :dont-format="true"/>-->
7
- <XReport :config-name="'test_tableConfig'" :local-config="test_upload" :dont-format="true"/>
6
+ <!-- <XReport :config-name="'test_tableConfig'" :local-config="test_yangchun_json" :config-data="test_yangchun_jsonData" :dont-format="true"/>-->
7
+ <XReport :config-name="'test_tableConfig'" :local-config="test_upload" :dont-format="true" :no-padding="true"/>
8
+ <XReport :config-name="'test_tableConfig'" :local-config="test_upload" :dont-format="true" :no-padding="true" :no-top-border="true"/>
8
9
  <!-- <XReport :config-name="'test_table_config_forEditor'" :dont-format="true"/>-->
9
10
  <!-- <XReport config-name="test_tableConfig" :local-config="test_config_json" :config-data="test_config_json_data"/>-->
11
+ <a-button @click="testExport">导出</a-button>
10
12
  </div>
11
13
  </template>
12
14
 
13
15
  <script>
14
16
  import XReport from '@vue2-client/base-client/components/common/XReport'
17
+ import { exportHTMLNodeToPDF } from '@vue2-client/utils/htmlToPDFApi'
15
18
 
16
19
  export default {
17
20
  name: 'Example',
@@ -1282,6 +1285,11 @@ export default {
1282
1285
  }
1283
1286
  }
1284
1287
  },
1288
+ methods: {
1289
+ testExport () {
1290
+ exportHTMLNodeToPDF('123', '#test')
1291
+ }
1292
+ }
1285
1293
  }
1286
1294
  </script>
1287
1295
  <style scoped>
@@ -0,0 +1,5 @@
1
+ import HtmlToPdf from '@vue2-client/utils/htmlToPDF'
2
+
3
+ export function exportHTMLNodeToPDF (fileName, nodeId) {
4
+ HtmlToPdf.getPdf(fileName, nodeId)
5
+ }