vue2-client 1.9.30 → 1.9.32

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.
@@ -32,6 +32,20 @@ this.openDialog('xxx', 5, {}, {}, {})
32
32
  afterDelete( res (删除接口返回数据)) 删除后触发
33
33
  action(record (当前记录), id (当前记录主键), actionType (操作类型)) 操作按钮触发
34
34
 
35
+ # x-report 插槽 使用说明
36
+ - init(configName,configData) 配置名称 / 报表数据
37
+ - setData(configData) 主动设置数据
38
+ - 当使用 openDialog 打开报表时,会自动调用 init 方法,传递参数为打开弹框时传递的 **mixinData**
39
+ ```js
40
+ this.$refs.main.openDialog('ceshishange',
41
+ -1,
42
+ {
43
+ configData: { arr: [{ 'defect@@@drug_name': '111' }, { 'defect@@@drug_name': '121', 'defect@@@num': '1' }] }
44
+ }
45
+ )
46
+ ```
47
+ - 当没有 openDialog 打开报表时,需要手动调用 init 方法 或者 setData,传递参数为需要的数据
48
+
35
49
  # form 简易表单
36
50
 
37
51
  - asyncSubmit().then(res=>{}) 手动提交表单
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.9.30",
3
+ "version": "1.9.32",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -30,7 +30,12 @@
30
30
  <!-- 用以包裹整个页面 -->
31
31
  <a-card v-if="!showSkeleton">
32
32
  <!-- 切换菜单 -->
33
- <a-radio-group v-model="type" default-value="a" button-style="solid" @change="tabChanged" v-show="!onlyDisplay && editMode">
33
+ <a-radio-group
34
+ v-model="type"
35
+ default-value="a"
36
+ button-style="solid"
37
+ @change="tabChanged"
38
+ v-show="!onlyDisplay && editMode">
34
39
  <a-radio-button value="design" v-if="!onlyDisplay">
35
40
  设计
36
41
  </a-radio-button>
@@ -798,6 +803,36 @@ export default {
798
803
  })
799
804
  }
800
805
  },
806
+ initByConfigName () {
807
+ getConfigByName(this.configName, this.serverName, res => {
808
+ this.config = res
809
+ if (this.config.designMode === 'json') {
810
+ if (this.configData !== undefined) {
811
+ this.config.data = Object.assign(this.config.data, this.configData)
812
+ }
813
+ this.jsonConfigInit()
814
+ } else {
815
+ if (this.configData !== undefined) {
816
+ this.config.data = Object.assign(this.config.data, this.configData)
817
+ }
818
+ if (this.config.data.images === undefined) {
819
+ this.config.data.images = {}
820
+ }
821
+ this.configInit()
822
+ }
823
+ })
824
+ },
825
+ // 提供主动让外部调用的初始化方法
826
+ async init ({ configName, configData }) {
827
+ this.configName = configName
828
+ this.configData = configData
829
+ await this.initByConfigName()
830
+ },
831
+ // 提供主动赋值方法
832
+ setData (data) {
833
+ this.config.data = data
834
+ this.configInit()
835
+ }
801
836
  },
802
837
  beforeMount () {
803
838
  // 如果只是展示
@@ -825,25 +860,9 @@ export default {
825
860
  }
826
861
  this.configInit()
827
862
  }
828
- } else {
863
+ } else if (this.configName) {
829
864
  // 如果本地配置没有值,则从琉璃中获取
830
- getConfigByName(this.configName, this.serverName, res => {
831
- this.config = res
832
- if (this.config.designMode === 'json') {
833
- if (this.configData !== undefined) {
834
- this.config.data = Object.assign(this.config.data, this.configData)
835
- }
836
- this.jsonConfigInit()
837
- } else {
838
- if (this.configData !== undefined) {
839
- this.config.data = Object.assign(this.config.data, this.configData)
840
- }
841
- if (this.config.data.images === undefined) {
842
- this.config.data.images = {}
843
- }
844
- this.configInit()
845
- }
846
- })
865
+ this.initByConfigName()
847
866
  }
848
867
  },
849
868
  mounted () {
@@ -854,7 +873,7 @@ export default {
854
873
  // 将原始数据备份保存
855
874
  if (this.configData) {
856
875
  this.dataCache = JSON.parse(JSON.stringify(this.configData))
857
- } else {
876
+ } else if (this.config) {
858
877
  this.dataCache = JSON.parse(JSON.stringify(this.config.data))
859
878
  }
860
879
  }
@@ -12,7 +12,9 @@
12
12
  :config="activatedConfig"/>
13
13
  </template>
14
14
  <template v-else>
15
- <div :class=" noPadding ? 'reportMainNoPadding' : 'reportMain'" :style="activatedConfig.width > 0 ? ('width:' + activatedConfig.width + 'px') : undefined">
15
+ <div
16
+ :class=" noPadding ? 'reportMainNoPadding' : 'reportMain'"
17
+ :style="activatedConfig.width > 0 ? ('width:' + activatedConfig.width + 'px') : undefined">
16
18
  <!-- 大标题 -->
17
19
  <h2 class="reportTitle" v-if="showTitle && activatedConfig.title" v-html="activatedConfig.title"></h2>
18
20
  <!-- 小标题 / 介乎于标题与表格之间的内容 -->
@@ -25,14 +27,11 @@
25
27
  <div class="inputsDiv">
26
28
  <div class="inputsDivItem" v-for="(num, index) of calcFormatInputNum(item.format)" :key="index">
27
29
  <span class="inputsDivItemLabel">{{ displayFormatStartText(item.format) }}</span>
28
- <template v-if="!forDisplay">
29
- <template v-if="item.inputReadOnly === true">
30
- <a-input v-model="data[item.dataIndex][index]" :style="'width:' + (item.inputWidth ? item.inputWidth : '100') + '%'" :disabled="true"/>
31
- </template>
32
- <template v-else>
33
- <a-input v-model="data[item.dataIndex][index]" :style="'width:' + (item.inputWidth ? item.inputWidth : '100') + '%'"/>
34
- </template>
35
- </template>
30
+ <a-input
31
+ v-if="!forDisplay"
32
+ v-model="data[item.dataIndex][index]"
33
+ :style="'width:' + (item.inputWidth ? item.inputWidth : '100') + '%'"
34
+ :disabled="item.inputReadOnly"/>
36
35
  <template v-else>
37
36
  {{ activatedConfig.data[item.dataIndex][index] }}
38
37
  </template>
@@ -46,112 +45,56 @@
46
45
  <table class="reportTable" v-if="render" :style="activatedConfig.style ? activatedConfig.style : undefined">
47
46
  <tbody class="reportTable">
48
47
  <template v-for="(row, rowIndex) in activatedConfig.columns">
49
- <!-- 插槽展示 -->
50
- <!-- <template v-if="row[0].type === 'slot'">-->
51
- <!-- <XReportSlot :config="activatedConfig" v-if="render" :slot-config-name="row[0].slotConfig" :key="rowIndex" :for-display="forDisplay"></XReportSlot>-->
52
- <!-- </template>-->
53
48
  <!-- 普通行 -->
54
- <template v-if="row[0].type !== 'inputColumns' && row[0].type !== 'list'">
55
- <template v-if="!forDisplay">
56
- <x-report-tr-group
57
- @updateImg="updateImg"
58
- :show-img-in-cell="showImgInCell"
59
- :img-prefix="imgPrefix"
60
- :server-name="serverName"
61
- :use-oss-for-img="useOssForImg"
62
- :key="rowIndex"
63
- :columns="row"
64
- :no-top-border="noTopBorder"
65
- :config-data="activatedConfig.data"
66
- :config="activatedConfig">
67
- </x-report-tr-group>
68
- </template>
69
- <template v-else>
70
- <x-report-tr-group
71
- @updateImg="updateImg"
72
- :show-img-in-cell="showImgInCell"
73
- :img-prefix="imgPrefix"
74
- :server-name="serverName"
75
- :use-oss-for-img="useOssForImg"
76
- :config="activatedConfig"
77
- :key="rowIndex"
78
- :columns="row"
79
- :no-top-border="noTopBorder"
80
- :config-data="activatedConfig.data"
81
- :display="true">
82
- </x-report-tr-group>
83
- </template>
84
- </template>
49
+ <x-report-tr-group
50
+ v-if="row[0].type !== 'inputColumns' && row[0].type !== 'list'"
51
+ @updateImg="updateImg"
52
+ :show-img-in-cell="showImgInCell"
53
+ :img-prefix="imgPrefix"
54
+ :server-name="serverName"
55
+ :use-oss-for-img="useOssForImg"
56
+ :key="rowIndex"
57
+ :columns="row"
58
+ :no-top-border="noTopBorder"
59
+ :config-data="activatedConfig.data"
60
+ :config="activatedConfig"
61
+ :display="forDisplay">
62
+ </x-report-tr-group>
85
63
  <!-- 列表 -->
86
- <template v-else-if="row[0].type === 'list'" >
87
- <template v-for="(num, listIndex) in row[0].listLength + 1">
88
- <template v-if="!forDisplay">
89
- <x-report-tr-group
90
- @updateImg="updateImg"
91
- :show-img-in-cell="showImgInCell"
92
- :img-prefix="imgPrefix"
93
- :server-name="serverName"
94
- :use-oss-for-img="useOssForImg"
95
- :config="activatedConfig"
96
- :key="rowIndex + listIndex"
97
- :columns="row"
98
- :no-top-border="noTopBorder"
99
- :config-data="activatedConfig.data"
100
- :list-index="listIndex">
101
- </x-report-tr-group>
102
- </template>
103
- <template v-else>
104
- <x-report-tr-group
105
- @updateImg="updateImg"
106
- :show-img-in-cell="showImgInCell"
107
- :img-prefix="imgPrefix"
108
- :server-name="serverName"
109
- :use-oss-for-img="useOssForImg"
110
- :config="activatedConfig"
111
- :key="rowIndex + listIndex"
112
- :columns="row"
113
- :no-top-border="noTopBorder"
114
- :config-data="activatedConfig.data"
115
- :list-index="listIndex"
116
- :display="true">
117
- </x-report-tr-group>
118
- </template>
119
- </template>
120
- </template>
64
+ <x-report-tr-group
65
+ v-else-if="row[0].type === 'list'"
66
+ v-for="(num, listIndex) in row[0].listLength + 1"
67
+ @updateImg="updateImg"
68
+ :show-img-in-cell="showImgInCell"
69
+ :img-prefix="imgPrefix"
70
+ :server-name="serverName"
71
+ :use-oss-for-img="useOssForImg"
72
+ :config="activatedConfig"
73
+ :key="rowIndex + listIndex"
74
+ :columns="row"
75
+ :no-top-border="noTopBorder"
76
+ :config-data="activatedConfig.data"
77
+ :list-index="listIndex"
78
+ :display="forDisplay">
79
+ </x-report-tr-group>
121
80
  <!-- 动态行 -->
122
81
  <template v-else>
123
- <template v-if="forDisplay">
124
- <x-report-tr-group
125
- @updateImg="updateImg"
126
- :show-img-in-cell="showImgInCell"
127
- :img-prefix="imgPrefix"
128
- :server-name="serverName"
129
- :use-oss-for-img="useOssForImg"
130
- :config="activatedConfig"
131
- :columns="row[0].definition"
132
- :config-data="{arr: activatedConfig.data[row[0].dataIndex]}"
133
- :input-columns="true"
134
- :no-top-border="noTopBorder"
135
- v-for="(item, definitionIndex) in activatedConfig.data[row[0].dataIndex]"
136
- :input-columns-definition-index="definitionIndex"
137
- :display="true"
138
- :key="row[0].dataIndex + definitionIndex + rowIndex"></x-report-tr-group>
139
- </template>
82
+ <x-report-tr-group
83
+ @updateImg="updateImg"
84
+ :show-img-in-cell="showImgInCell"
85
+ :img-prefix="imgPrefix"
86
+ :server-name="serverName"
87
+ :use-oss-for-img="useOssForImg"
88
+ :config="activatedConfig"
89
+ :columns="row[0].definition"
90
+ :config-data="{arr: activatedConfig.data[row[0].dataIndex]}"
91
+ :input-columns="true"
92
+ :no-top-border="noTopBorder"
93
+ v-for="(item, definitionIndex) in activatedConfig.data[row[0].dataIndex]"
94
+ :input-columns-definition-index="definitionIndex"
95
+ :display="forDisplay"
96
+ :key="row[0].dataIndex + definitionIndex + rowIndex"></x-report-tr-group>
140
97
  <template v-if="!forDisplay">
141
- <x-report-tr-group
142
- @updateImg="updateImg"
143
- :show-img-in-cell="showImgInCell"
144
- :img-prefix="imgPrefix"
145
- :server-name="serverName"
146
- :use-oss-for-img="useOssForImg"
147
- :config="activatedConfig"
148
- :columns="row[0].definition"
149
- :config-data="{arr: activatedConfig.data[row[0].dataIndex]}"
150
- :input-columns="true"
151
- :no-top-border="noTopBorder"
152
- v-for="(item, definitionIndex) in activatedConfig.data[row[0].dataIndex]"
153
- :input-columns-definition-index="definitionIndex"
154
- :key="row[0].dataIndex + definitionIndex + rowIndex"></x-report-tr-group>
155
98
  <!-- 动态行交互按钮 -->
156
99
  <x-report-tr-group
157
100
  @updateImg="updateImg"
@@ -196,7 +139,8 @@ export default {
196
139
  config: {
197
140
  type: Object,
198
141
  require: true,
199
- default: () => {}
142
+ default: () => {
143
+ }
200
144
  },
201
145
  showImgInCell: {
202
146
  type: Boolean,
@@ -359,11 +303,12 @@ export default {
359
303
  </script>
360
304
 
361
305
  <style lang="less" scoped>
362
- .img{
306
+ .img {
363
307
  width: 95%;
364
308
  height: 180px;
365
309
  object-fit: cover;
366
310
  }
311
+
367
312
  .reportMain {
368
313
  text-align: center;
369
314
  margin: 0 auto;
@@ -390,11 +335,13 @@ export default {
390
335
  .inputsDiv {
391
336
  display: flex;
392
337
  justify-content: space-between;
338
+
393
339
  .inputsDivItem {
394
340
  display: flex;
395
341
  align-items: center;
396
342
  padding: 0 4px;
397
343
  white-space: nowrap;
344
+
398
345
  .inputsDivItemLabel {
399
346
  padding: 0 4px;
400
347
  }
@@ -404,10 +351,11 @@ export default {
404
351
  .reportTable {
405
352
  width: 100%;
406
353
  border-collapse: collapse;
407
- table-layout:fixed;
408
- word-break:break-all;
354
+ table-layout: fixed;
355
+ word-break: break-all;
409
356
  }
410
357
  }
358
+
411
359
  .reportMainForDisplay {
412
360
  text-align: center;
413
361
  margin: 10% auto;
@@ -433,11 +381,13 @@ export default {
433
381
  .inputsDiv {
434
382
  display: flex;
435
383
  justify-content: space-around;
384
+
436
385
  .inputsDivItem {
437
386
  display: flex;
438
387
  align-items: center;
439
388
  padding: 0 4px;
440
389
  white-space: nowrap;
390
+
441
391
  .inputsDivItemLabel {
442
392
  padding: 0 4px;
443
393
  }
@@ -447,10 +397,11 @@ export default {
447
397
  .reportTable {
448
398
  width: 100%;
449
399
  border-collapse: collapse;
450
- table-layout:fixed;
451
- word-break:break-all;
400
+ table-layout: fixed;
401
+ word-break: break-all;
452
402
  }
453
403
  }
404
+
454
405
  .reportMainNoPadding {
455
406
  text-align: center;
456
407
  margin: 0 auto;
@@ -475,11 +426,13 @@ export default {
475
426
  .inputsDiv {
476
427
  display: flex;
477
428
  justify-content: space-between;
429
+
478
430
  .inputsDivItem {
479
431
  display: flex;
480
432
  align-items: center;
481
433
  padding: 0 4px;
482
434
  white-space: nowrap;
435
+
483
436
  .inputsDivItemLabel {
484
437
  padding: 0 4px;
485
438
  }
@@ -489,17 +442,19 @@ export default {
489
442
  .reportTable {
490
443
  width: 100%;
491
444
  border-collapse: collapse;
492
- table-layout:fixed;
493
- word-break:break-all;
445
+ table-layout: fixed;
446
+ word-break: break-all;
494
447
  }
495
448
  }
496
- .tools{
449
+
450
+ .tools {
497
451
  position: fixed;
498
452
  right: 2%;
499
453
  text-align: right;
500
454
  width: 60%;
501
455
  cursor: pointer;
502
- .toolsItem{
456
+
457
+ .toolsItem {
503
458
  width: 15%;
504
459
  margin-right: 3%;
505
460
  display: inline-block;
@@ -251,7 +251,10 @@
251
251
  </template>
252
252
  </template>
253
253
  <template v-else-if="cell.type === 'list'">
254
- <template v-if="cell.listType === 'input'">
254
+ <template v-if="listIndex === 0">
255
+ <span style="font-weight: bold">{{ cell.listHead }}</span>
256
+ </template>
257
+ <template v-else-if="cell.listType === 'input'">
255
258
  <a-input
256
259
  v-model="configData[cell.dataIndex][listIndex]"
257
260
  :style="'width:' + (cell.inputWidth ? cell.inputWidth : '100') + '%'"/>
@@ -259,6 +262,9 @@
259
262
  <template v-else-if="cell.listType === 'value'">
260
263
  {{ cell.content[listIndex] }}
261
264
  </template>
265
+ <template v-else-if="cell.listType === 'variable'">
266
+ {{ configData[cell.dataIndex][listIndex - 1][cell.listDataIndex] }}
267
+ </template>
262
268
  </template>
263
269
  <template v-else-if="cell.type === 'images'">
264
270
  <div>
@@ -20,7 +20,6 @@
20
20
  import XReport from './XReport'
21
21
  import XAddReport from '../XAddReport/XAddReport.vue'
22
22
  // eslint-disable-next-line no-unused-vars
23
- import { exportHTMLNodeToPDF } from '@vue2-client/utils/htmlToPDFApi'
24
23
 
25
24
  export default {
26
25
  name: 'XReportDemo',
@@ -28,13 +27,15 @@ export default {
28
27
  XReport, XAddReport
29
28
  },
30
29
  mounted () {
31
- // this.$refs.main.openDialog('skinTestExecuActionCover',
32
- // {
33
- // selectedId: 1,
34
- // name: '皮肤测试执行单'
35
- // },
36
- // {}
37
- // )
30
+ this.$refs.main.openDialog('ceshishange',
31
+ {
32
+ selectedId: 1,
33
+ name: '皮肤测试执行单'
34
+ },
35
+ {
36
+ configData: { arr: [{ 'defect@@@drug_name': '111' }, { 'defect@@@drug_name': '121', 'defect@@@num': '1' }] }
37
+ }
38
+ )
38
39
  },
39
40
  data () {
40
41
  return {
@@ -13,7 +13,7 @@
13
13
  <!-- 插槽渲染 -->
14
14
  <template v-if="cell.type === 'slot'">
15
15
  <template
16
- v-if="['x-form-table','x-add-native-form','x-tree-pro', 'x-his-editor', 'x-tab', 'x-form-group'].includes(cell.slotType)">
16
+ v-if="['x-form-table','x-add-native-form','x-tree-pro', 'x-his-editor', 'x-tab', 'x-form-group', 'x-report'].includes(cell.slotType)">
17
17
  <component
18
18
  :is="getComponentName(cell.slotConfig, cell.serviceName, cell.slotType)"
19
19
  :key="cellIndex"
@@ -404,7 +404,8 @@ export default {
404
404
  XAddNativeForm: () => import('@vue2-client/base-client/components/common/XAddNativeForm/XAddNativeForm.vue'),
405
405
  XTreePro: () => import('@vue2-client/base-client/components/common/XTree/XTreePro.vue'),
406
406
  XHisEditor: () => import('@vue2-client/base-client/components/his/XHisEditor/XHisEditor.vue'),
407
- XTab: () => import('@vue2-client/base-client/components/common/XTab/XTab.vue')
407
+ XTab: () => import('@vue2-client/base-client/components/common/XTab/XTab.vue'),
408
+ XReport: () => import('@vue2-client/base-client/components/common/XReport/XReport.vue')
408
409
  },
409
410
  props: {
410
411
  // 每一行的配置
@@ -556,6 +557,10 @@ export default {
556
557
  }, this.env === 'dev')
557
558
  }
558
559
  }
560
+ if (cell.slotType === 'x-report') {
561
+ const param = { ...this.mixinData }
562
+ this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init(param)
563
+ }
559
564
  },
560
565
  getEventHandlers (cell) {
561
566
  const handlers = {}
@@ -46,6 +46,7 @@ export default {
46
46
  }
47
47
  },
48
48
  methods: {
49
+ // 自定义函数中调用的方法 这个不能删
49
50
  getWindow,
50
51
  isMicroAppEnv,
51
52
  microDispatch,
@@ -83,9 +83,10 @@ routerResource.example = {
83
83
  {
84
84
  path: 'default',
85
85
  name: '示例页面',
86
- component: () => import('@vue2-client/base-client/components/common/XAddNativeForm/demo.vue'),
86
+ // component: () => import('@vue2-client/base-client/components/common/XAddNativeForm/demo.vue'),
87
+ // component: () => import('@vue2-client/base-client/components/common/XReport/XReportDemo.vue'),
87
88
  // component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
88
- // component: () => import('@vue2-client/base-client/components/common/XReportGrid/XReportDemo.vue'),
89
+ component: () => import('@vue2-client/base-client/components/common/XReportGrid/XReportDemo.vue'),
89
90
  // component: () => import('@vue2-client/pages/WorkflowDetail/WorkFlowDemo.vue'),
90
91
  meta: {
91
92
  // 菜单中不显示