vue2-client 1.8.400 → 1.8.401

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.400",
3
+ "version": "1.8.401",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -26,6 +26,7 @@
26
26
  </template>
27
27
  <script>
28
28
  import { mapState } from 'vuex'
29
+ import { executeStrFunctionByContext } from '@/utils/runEvalFunction'
29
30
  // import XReport from '@vue2-client/pages/XReportGridView/XReport.vue'
30
31
 
31
32
  export default {
@@ -94,8 +95,14 @@ export default {
94
95
  this.$emit('close')
95
96
  },
96
97
  onSubmit () {
97
- this.loading = true
98
- this.close()
98
+ if (this.$refs.main?.config?.confirmFunction) {
99
+ console.info('执行自定义确认逻辑')
100
+ executeStrFunctionByContext(this, this.$refs.main?.config?.confirmFunction, [])
101
+ } else {
102
+ console.warn('未配置modal确认按钮逻辑')
103
+ this.loading = true
104
+ this.close()
105
+ }
99
106
  },
100
107
  updateImg (data) {
101
108
  console.log(data)
@@ -1,40 +1,40 @@
1
- <script>
2
- import XFormGroup from '@vue2-client/base-client/components/common/XFormGroup/XFormGroup.vue'
3
- import { getConfigByNameAsync } from '@vue2-client/services/api/common'
4
-
5
- export default {
6
- name: 'Demo',
7
- components: { XFormGroup },
8
- created () {
9
- getConfigByNameAsync('addUserGeneralInfoFrom', 'af-revenue').then(res => {
10
- this.$refs.xFormGroupDemo.init({
11
- ...res,
12
- serviceName: 'af-revenue',
13
- showLeftTab: true,
14
- })
15
- })
16
- },
17
- methods: {
18
- submitForm () {
19
- this.$refs.xFormGroupDemo.onSubmit().then(res => {
20
- console.log('所有表单的结果', res)
21
- })
22
- }
23
- }
24
- }
25
- </script>
26
-
27
- <template>
28
- <a-modal
29
- :visible="true"
30
- :bodyStyle="{height:'70vh'}"
31
- title="测试表单组"
32
- @ok="submitForm"
33
- width="85vw">
34
- <x-form-group ref="xFormGroupDemo"></x-form-group>
35
- </a-modal>
36
- </template>
37
-
38
- <style scoped lang="less">
39
-
40
- </style>
1
+ <script>
2
+ import XFormGroup from '@vue2-client/base-client/components/common/XFormGroup/XFormGroup.vue'
3
+ import { getConfigByNameAsync } from '@vue2-client/services/api/common'
4
+
5
+ export default {
6
+ name: 'Demo',
7
+ components: { XFormGroup },
8
+ created () {
9
+ getConfigByNameAsync('addUserGeneralInfoFrom', 'af-revenue').then(res => {
10
+ this.$refs.xFormGroupDemo.init({
11
+ ...res,
12
+ serviceName: 'af-revenue',
13
+ showLeftTab: true,
14
+ })
15
+ })
16
+ },
17
+ methods: {
18
+ submitForm () {
19
+ this.$refs.xFormGroupDemo.onSubmit().then(res => {
20
+ console.log('所有表单的结果', res)
21
+ })
22
+ }
23
+ }
24
+ }
25
+ </script>
26
+
27
+ <template>
28
+ <a-modal
29
+ :visible="true"
30
+ :bodyStyle="{height:'70vh'}"
31
+ title="测试表单组"
32
+ @ok="submitForm"
33
+ width="85vw">
34
+ <x-form-group ref="xFormGroupDemo"></x-form-group>
35
+ </a-modal>
36
+ </template>
37
+
38
+ <style scoped lang="less">
39
+
40
+ </style>
@@ -779,6 +779,14 @@ export default {
779
779
  const func = eval('(' + cell.customFunctionForDynamicDataIndex + ')')
780
780
  cell.dataIndex = func(this.config)
781
781
  }
782
+ // 处理 自定义函数的旧逻辑
783
+ if (['action', 'click'].includes(cell.eventType) && cell.customFunction && !cell.events) {
784
+ cell.events = []
785
+ cell.events.push({
786
+ type: cell.eventType,
787
+ customFunction: cell.customFunction
788
+ })
789
+ }
782
790
  })
783
791
  })
784
792
  // 将数据复制到临时数据中,带有@@@的数据,我们将其整体作为一个key保存,当编辑完成后,再将其解析,回填到需要的数据中
@@ -18,14 +18,13 @@
18
18
  :key="cellIndex"
19
19
  :serviceName="cell.serviceName"
20
20
  @selectRow="selectRow"
21
- @[cell.eventType]="(...args)=>executeCustomFunction( cell,...args)"
21
+ v-on="getEventHandlers(cell)"
22
22
  :queryParamsName="cell.slotConfig"/>
23
23
  </template>
24
24
  </template>
25
25
  <!-- button 按钮渲染 -->
26
26
  <template v-else-if="cell.type === 'button'">
27
- <a-button @[cell.eventType]="($event, ...args)=>executeCustomFunction($event, cell,...args)"
28
- >
27
+ <a-button v-on="getEventHandlers(cell)">
29
28
  {{ cell.buttonName }}
30
29
  </a-button>
31
30
  </template>
@@ -478,9 +477,18 @@ export default {
478
477
  },
479
478
  inject: ['openDialog'],
480
479
  methods: {
481
- executeCustomFunction (cell, ...args) {
482
- console.info('Event handled:', cell.eventType, args)
483
- executeStrFunctionByContext(this, cell.customFunction, args)
480
+ getEventHandlers (cell) {
481
+ const handlers = {}
482
+ if (!cell.events && cell.events.length === 0) {
483
+ return handlers
484
+ }
485
+ cell.events.forEach(event => {
486
+ handlers[event.type] = (...args) => {
487
+ console.info('Event handled:', event.type, args)
488
+ executeStrFunctionByContext(this, event.customFunction, args)
489
+ }
490
+ })
491
+ return handlers
484
492
  },
485
493
  getComponentName (queryParamsName, serviceName, componentName) {
486
494
  // const config = await getConfigByName(queryParamsName, serviceName)
@@ -78,7 +78,7 @@ routerResource.example = {
78
78
  {
79
79
  path: 'default',
80
80
  name: '示例页面',
81
- component: () => import('@vue2-client/pages/DefaultExample'),
81
+ component: () => import('@vue2-client/base-client/components/common/XReportGrid/XReportDemo.vue'),
82
82
  meta: {
83
83
  // 菜单中不显示
84
84
  invisible: true,