vue2-client 1.8.163 → 1.8.165

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.163",
3
+ "version": "1.8.165",
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: {
@@ -617,6 +644,7 @@ export default {
617
644
  }
618
645
  if (this.localConfig) {
619
646
  if (this.localConfig.designMode === 'json') {
647
+ this.config = this.localConfig
620
648
  if (this.configData !== undefined) {
621
649
  this.config.data = this.configData
622
650
  }
@@ -1,10 +1,13 @@
1
1
  <template>
2
2
  <div>
3
3
  <template v-if="this.activatedConfig.designMode === 'json'">
4
- <XReportJsonRender :config="activatedConfig"/>
4
+ <XReportJsonRender
5
+ :no-padding="noPadding"
6
+ :no-top-border="noTopBorder"
7
+ :config="activatedConfig"/>
5
8
  </template>
6
9
  <template v-else>
7
- <div class="reportMain" :style="activatedConfig.width > 0 ? ('width:' + activatedConfig.width + 'px') : undefined">
10
+ <div :class=" noPadding ? 'reportMainNoPadding' : 'reportMain'" :style="activatedConfig.width > 0 ? ('width:' + activatedConfig.width + 'px') : undefined">
8
11
  <!-- 大标题 -->
9
12
  <h2 class="reportTitle" v-if="activatedConfig.title" v-html="activatedConfig.title"></h2>
10
13
  <!-- 小标题 / 介乎于标题与表格之间的内容 -->
@@ -45,10 +48,23 @@
45
48
  <!-- 普通行 -->
46
49
  <template v-if="row[0].type !== 'inputColumns' && row[0].type !== 'list'">
47
50
  <template v-if="!forDisplay">
48
- <x-report-tr-group :key="rowIndex" :columns="row" :config-data="activatedConfig.data" :config="activatedConfig"></x-report-tr-group>
51
+ <x-report-tr-group
52
+ :key="rowIndex"
53
+ :columns="row"
54
+ :no-top-border="noTopBorder"
55
+ :config-data="activatedConfig.data"
56
+ :config="activatedConfig">
57
+ </x-report-tr-group>
49
58
  </template>
50
59
  <template v-else>
51
- <x-report-tr-group :config="activatedConfig" :key="rowIndex" :columns="row" :config-data="activatedConfig.data" :display="true"></x-report-tr-group>
60
+ <x-report-tr-group
61
+ :config="activatedConfig"
62
+ :key="rowIndex"
63
+ :columns="row"
64
+ :no-top-border="noTopBorder"
65
+ :config-data="activatedConfig.data"
66
+ :display="true">
67
+ </x-report-tr-group>
52
68
  </template>
53
69
  </template>
54
70
  <!-- 列表 -->
@@ -58,6 +74,7 @@
58
74
  :config="activatedConfig"
59
75
  :key="rowIndex + listIndex"
60
76
  :columns="row"
77
+ :no-top-border="noTopBorder"
61
78
  :config-data="activatedConfig.data"
62
79
  :list-index="listIndex">
63
80
  </x-report-tr-group>
@@ -67,6 +84,7 @@
67
84
  :config="activatedConfig"
68
85
  :key="rowIndex + listIndex"
69
86
  :columns="row"
87
+ :no-top-border="noTopBorder"
70
88
  :config-data="activatedConfig.data"
71
89
  :list-index="listIndex"
72
90
  :display="true">
@@ -81,6 +99,7 @@
81
99
  :columns="row[0].definition"
82
100
  :config-data="{arr: activatedConfig.data[row[0].dataIndex]}"
83
101
  :input-columns="true"
102
+ :no-top-border="noTopBorder"
84
103
  v-for="(item, definitionIndex) in activatedConfig.data[row[0].dataIndex]"
85
104
  :input-columns-definition-index="definitionIndex"
86
105
  :display="true"
@@ -92,6 +111,7 @@
92
111
  :columns="row[0].definition"
93
112
  :config-data="{arr: activatedConfig.data[row[0].dataIndex]}"
94
113
  :input-columns="true"
114
+ :no-top-border="noTopBorder"
95
115
  v-for="(item, definitionIndex) in activatedConfig.data[row[0].dataIndex]"
96
116
  :input-columns-definition-index="definitionIndex"
97
117
  :key="row[0].dataIndex + definitionIndex + rowIndex"></x-report-tr-group>
@@ -100,6 +120,7 @@
100
120
  :config="activatedConfig"
101
121
  :key="rowIndex"
102
122
  :columns="row"
123
+ :no-top-border="noTopBorder"
103
124
  :config-data="activatedConfig.data"
104
125
  :input-columns-button="true"
105
126
  :input-columns="true">
@@ -151,6 +172,14 @@ export default {
151
172
  imageList: {
152
173
  type: Array,
153
174
  default: undefined
175
+ },
176
+ noPadding: {
177
+ type: Boolean,
178
+ default: false
179
+ },
180
+ noTopBorder: {
181
+ type: Boolean,
182
+ default: false
154
183
  }
155
184
  },
156
185
  components: {
@@ -328,6 +357,48 @@ export default {
328
357
  word-break:break-all;
329
358
  }
330
359
  }
360
+ .reportMainNoPadding {
361
+ text-align: center;
362
+ margin: 0 auto;
363
+ font-size: 16px;
364
+ color: #000;
365
+ background-color: #fff;
366
+ border-radius: 8px;
367
+
368
+ .reportTitle {
369
+ font-weight: bold;
370
+ }
371
+
372
+ .subTitle {
373
+ display: flex;
374
+ justify-content: space-between;
375
+
376
+ .subTitleItems {
377
+ max-width: 30%;
378
+ }
379
+ }
380
+
381
+ .inputsDiv {
382
+ display: flex;
383
+ justify-content: space-between;
384
+ .inputsDivItem {
385
+ display: flex;
386
+ align-items: center;
387
+ padding: 0 4px;
388
+ white-space: nowrap;
389
+ .inputsDivItemLabel {
390
+ padding: 0 4px;
391
+ }
392
+ }
393
+ }
394
+
395
+ .reportTable {
396
+ width: 100%;
397
+ border-collapse: collapse;
398
+ table-layout:fixed;
399
+ word-break:break-all;
400
+ }
401
+ }
331
402
  .tools{
332
403
  position: fixed;
333
404
  right: 2%;
@@ -1,22 +1,22 @@
1
1
  <template>
2
- <div class="reportMain">
2
+ <div :class="noPadding ? 'reportMainNoPadding' : 'reportMain'">
3
3
  <table class="reportTable">
4
4
  <tbody class="reportTable">
5
5
  <tr v-if="config.title.type && config.title.type !== ''">
6
- <th class="tdWithBorder" colspan="12">
6
+ <td :class="noTopBorder ? 'tdWithNoTopBorder' : 'tdWithBorder'" colspan="12">
7
7
  <template v-if="config.title.type === 'titleKey'">
8
8
  {{ config.data[config.title.value] }}
9
9
  </template>
10
10
  <template v-else-if="config.title.type === 'titleValue'">
11
11
  {{ config.title.value }}
12
12
  </template>
13
- </th>
13
+ </td>
14
14
  </tr>
15
15
  <template v-for="(row, rowIndex) in config.content">
16
16
  <template v-if="row.type === 'jsonKey'">
17
17
  <tr :key="rowIndex">
18
18
  <!-- 表头 -->
19
- <td class="tdWithBorder" colspan="6">
19
+ <td :class="noTopBorder ? 'tdWithNoTopBorder' : 'tdWithBorder'" colspan="6">
20
20
  <template v-if="receivedFunction[rowIndex].labelFunction(config).type === 'key'">
21
21
  {{ config.data[receivedFunction[rowIndex].labelFunction(config).content] }}
22
22
  </template>
@@ -25,7 +25,7 @@
25
25
  </template>
26
26
  </td>
27
27
  <!-- 内容 -->
28
- <td class="tdWithBorder" colspan="6">
28
+ <td :class="noTopBorder ? 'tdWithNoTopBorder' : 'tdWithBorder'" colspan="6">
29
29
  <template v-if="receivedFunction[rowIndex].valueFunction(config).type === 'key'">
30
30
  {{ config.data[receivedFunction[rowIndex].valueFunction(config).content] }}
31
31
  </template>
@@ -47,7 +47,7 @@
47
47
  <template v-else-if="row.type === 'jsonArray'">
48
48
  <tr :key="rowIndex + '' + jsonArrayItemIndex" v-for="(item, jsonArrayItemIndex) in config.data[row.jsonArrayDataIndex]">
49
49
  <!-- 表头 -->
50
- <td class="tdWithBorder" colspan="6">
50
+ <td :class="noTopBorder ? 'tdWithNoTopBorder' : 'tdWithBorder'" colspan="6">
51
51
  <template v-if="receivedFunction[rowIndex].labelFunction(config, item).type === 'key'">
52
52
  {{ item[receivedFunction[rowIndex].labelFunction(config, item).content] }}
53
53
  </template>
@@ -56,7 +56,7 @@
56
56
  </template>
57
57
  </td>
58
58
  <!-- 内容 -->
59
- <td class="tdWithBorder" colspan="6">
59
+ <td :class="noTopBorder ? 'tdWithNoTopBorder' : 'tdWithBorder'" colspan="6">
60
60
  <template v-if="receivedFunction[rowIndex].valueFunction(config, item).type === 'key'">
61
61
  {{ item[receivedFunction[rowIndex].valueFunction(config, item).content] }}
62
62
  </template>
@@ -92,6 +92,14 @@ export default {
92
92
  config: {
93
93
  type: Object,
94
94
  required: true
95
+ },
96
+ noPadding: {
97
+ type: Boolean,
98
+ default: false
99
+ },
100
+ noTopBorder: {
101
+ type: Boolean,
102
+ default: false
95
103
  }
96
104
  },
97
105
  data () {
@@ -141,6 +149,14 @@ export default {
141
149
  padding: 15px;
142
150
  border-radius: 8px;
143
151
  }
152
+ .reportMainNoPadding {
153
+ text-align: center;
154
+ margin: 0 auto;
155
+ font-size: 16px;
156
+ color: #000;
157
+ background-color: #fff;
158
+ border-radius: 8px;
159
+ }
144
160
  .reportTitle {
145
161
  font-weight: bold;
146
162
  }
@@ -158,4 +174,11 @@ export default {
158
174
  color: rgb( 24,144,255);
159
175
  cursor: pointer;
160
176
  }
177
+ .tdWithNoTopBorder {
178
+ border-top-style: none;
179
+ border-left: 1px solid #000;
180
+ border-right: 1px solid #000;
181
+ border-bottom: 1px solid #000;
182
+ padding: 8px;
183
+ }
161
184
  </style>
@@ -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,28 @@
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
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"/>
7
+ <XReport :config-name="'test_tableConfig'" :local-config="test_upload" :dont-format="true" :no-padding="true"/>
8
+ <XReport
9
+ :config-name="'test_tableConfig'"
10
+ :local-config="test_yangchun_json"
11
+ :config-data="test_yangchun_jsonData"
12
+ :dont-format="true"
13
+ :no-padding="true"
14
+ :no-top-border="true"/>
15
+ <XReport :config-name="'test_tableConfig'" :local-config="test_upload" :dont-format="true" :no-padding="true" :no-top-border="true"/>
16
+ <!-- <XReport :config-name="'test_table_config_forEditor'" :dont-format="true"/>-->
8
17
  <!-- <XReport :config-name="'test_table_config_forEditor'" :dont-format="true"/>-->
9
18
  <!-- <XReport config-name="test_tableConfig" :local-config="test_config_json" :config-data="test_config_json_data"/>-->
19
+ <a-button @click="testExport">导出</a-button>
10
20
  </div>
11
21
  </template>
12
22
 
13
23
  <script>
14
24
  import XReport from '@vue2-client/base-client/components/common/XReport'
25
+ import { exportHTMLNodeToPDF } from '@vue2-client/utils/htmlToPDFApi'
15
26
 
16
27
  export default {
17
28
  name: 'Example',
@@ -1282,6 +1293,11 @@ export default {
1282
1293
  }
1283
1294
  }
1284
1295
  },
1296
+ methods: {
1297
+ testExport () {
1298
+ exportHTMLNodeToPDF('123', '#test')
1299
+ }
1300
+ }
1285
1301
  }
1286
1302
  </script>
1287
1303
  <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
+ }