vue2-client 1.9.31 → 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.31",
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
  }
@@ -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,
@@ -84,9 +84,9 @@ routerResource.example = {
84
84
  path: 'default',
85
85
  name: '示例页面',
86
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
+ // component: () => import('@vue2-client/base-client/components/common/XReport/XReportDemo.vue'),
88
88
  // component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
89
- // component: () => import('@vue2-client/base-client/components/common/XReportGrid/XReportDemo.vue'),
89
+ component: () => import('@vue2-client/base-client/components/common/XReportGrid/XReportDemo.vue'),
90
90
  // component: () => import('@vue2-client/pages/WorkflowDetail/WorkFlowDemo.vue'),
91
91
  meta: {
92
92
  // 菜单中不显示