vue2-client 1.9.22 → 1.9.24

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.9.22",
3
+ "version": "1.9.24",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -29,6 +29,7 @@
29
29
  import { mapState } from 'vuex'
30
30
  import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
31
31
  import { runLogic } from '@vue2-client/services/api/common'
32
+ import { getMicroData, getWindow, isMicroAppEnv, microDispatch } from '@/utils/microAppUtils'
32
33
 
33
34
  export default {
34
35
  name: 'XAddReport',
@@ -92,6 +93,10 @@ export default {
92
93
  ...mapState('account', { currUser: 'user' })
93
94
  },
94
95
  methods: {
96
+ getWindow,
97
+ isMicroAppEnv,
98
+ microDispatch,
99
+ getMicroData,
95
100
  runLogic,
96
101
  init (params) {
97
102
  console.log('params', params)
@@ -4,7 +4,7 @@
4
4
  <XReport
5
5
  ref="main"
6
6
  :use-oss-for-img="false"
7
- config-name="medicalRecordCover"
7
+ config-name="templateManageView2"
8
8
  server-name="af-his"
9
9
  :show-img-in-cell="true"
10
10
  :display-only="true"
@@ -12,7 +12,8 @@
12
12
  :span="cell.colSpan ? cell.colSpan * 2 : undefined">
13
13
  <!-- 插槽渲染 -->
14
14
  <template v-if="cell.type === 'slot'">
15
- <template v-if="['x-form-table','x-add-native-form','x-tree-pro', 'x-his-editor', 'x-tab', 'x-form-group'].includes(cell.slotType)">
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
17
  <component
17
18
  :is="getComponentName(cell.slotConfig, cell.serviceName, cell.slotType)"
18
19
  :key="cellIndex"
@@ -393,6 +394,7 @@ import { formatDate } from '@vue2-client/utils/util'
393
394
  import { nanoid } from 'nanoid'
394
395
  import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
395
396
  import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
397
+ import { getMicroData, getWindow, isMicroAppEnv, microDispatch } from '@/utils/microAppUtils'
396
398
 
397
399
  export default {
398
400
  name: 'XReportTrGroup',
@@ -492,6 +494,10 @@ export default {
492
494
  },
493
495
  inject: ['openDialog', 'registerComponent', 'getComponentByName', 'runLogic', 'getMixinData', 'getSelectedId', 'isInAModal', 'getConfigByName', 'getSelectedData', 'getOutEnv'],
494
496
  methods: {
497
+ getWindow,
498
+ isMicroAppEnv,
499
+ microDispatch,
500
+ getMicroData,
495
501
  onComponentMounted (h, cell, cellIndex) {
496
502
  if (this.getMixinData && this.getMixinData()) {
497
503
  this.mixinData = this.getMixinData()
@@ -28,6 +28,7 @@
28
28
  <script>
29
29
  import { getConfigByName, getConfigByNameAsync, runLogic } from '@vue2-client/services/api/common'
30
30
  import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
31
+ import { getMicroData, getWindow, isMicroAppEnv, microDispatch } from '@/utils/microAppUtils'
31
32
 
32
33
  export default {
33
34
  name: 'XTab',
@@ -45,6 +46,10 @@ export default {
45
46
  }
46
47
  },
47
48
  methods: {
49
+ getWindow,
50
+ isMicroAppEnv,
51
+ microDispatch,
52
+ getMicroData,
48
53
  initConfig () {
49
54
  if (this.configName) {
50
55
  this.getConfig()
@@ -52,6 +52,7 @@
52
52
  @check-change="handleCheckChange"
53
53
  :default-expanded-keys="expandedKeys"
54
54
  @node-expand="nodeExpand"
55
+ @node-collapse="nodeCollapse"
55
56
  @node-click="handleNodeClick"
56
57
  :filter-node-method="filterNode"
57
58
  :props="props"
@@ -207,6 +208,7 @@ export default {
207
208
  }
208
209
  },
209
210
  methods: {
211
+ // 节点展开暂存
210
212
  nodeExpand (node) {
211
213
  if (this.expandedKeys.includes(node[this.replaceFields.key])) {
212
214
  this.expandedKeys = this.expandedKeys.filter(item => item !== node[this.replaceFields.key])
@@ -214,6 +216,10 @@ export default {
214
216
  this.expandedKeys.push(node[this.replaceFields.key])
215
217
  }
216
218
  },
219
+ // 节点关闭
220
+ nodeCollapse (node) {
221
+ this.expandedKeys = this.expandedKeys.filter(item => item !== node[this.replaceFields.key])
222
+ },
217
223
  highlightKeyword (label, keyword) {
218
224
  const maxLen = this.config.deepNodeMaxWidth
219
225
 
@@ -0,0 +1,40 @@
1
+ /**
2
+ * 获取 window 对象
3
+ * @returns {Window} window 对象
4
+ */
5
+ export function getWindow () {
6
+ return window
7
+ }
8
+
9
+ /**
10
+ * 判断是否处于 microApp 环境
11
+ * @returns {boolean} 如果在 microApp 环境下返回 true,否则返回 false
12
+ */
13
+ export function isMicroAppEnv () {
14
+ return window.__MICRO_APP_ENVIRONMENT__
15
+ }
16
+
17
+ /**
18
+ * 发送事件给基座应用
19
+ * @param {Object} data 要传递的数据
20
+ * @param {Function} callBack 如果不是 microApp 环境时的回调函数
21
+ * @returns {*} 在 microApp 环境下返回 dispatch 的结果,否则执行 callBack
22
+ */
23
+ export function microDispatch (data, callBack) {
24
+ if (window.__MICRO_APP_ENVIRONMENT__) {
25
+ return window.microApp.dispatch(data)
26
+ }
27
+ if (callBack) {
28
+ return callBack()
29
+ }
30
+ }
31
+
32
+ /**
33
+ * 获取 microApp 的数据
34
+ * @returns {*} microApp 的数据,如果不在 microApp 环境下返回 undefined
35
+ */
36
+ export function getMicroData () {
37
+ if (window.__MICRO_APP_ENVIRONMENT__) {
38
+ return window.microApp.getData()
39
+ }
40
+ }