vue2-client 1.8.449 → 1.8.451

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.449",
3
+ "version": "1.8.451",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -108,24 +108,31 @@ export default {
108
108
  onSubmit () {
109
109
  if (this.$refs.main?.config?.confirmFunction) {
110
110
  console.info('执行自定义确认逻辑')
111
- const result = executeStrFunctionByContext(this, this.$refs.main?.config?.confirmFunction, [])
111
+ let func = this.$refs.main?.config?.confirmFunction
112
+ if (func && func.startsWith('function')) {
113
+ func = func.replace('function', 'async function')
114
+ }
115
+ const result = executeStrFunctionByContext(this, func, [])
112
116
  if (result instanceof Promise) {
113
117
  result.then((res) => {
114
- let message = '操作成功'
115
118
  let messageType = 'success'
116
119
  // 如果传递了组件名字 自动调用刷新
117
120
  if (res?.name) {
118
- this.getComponentByName(res.name).refresh()
119
- }
120
- // 如果传递了提示信息自动调用提示
121
- if (res?.message) {
122
- message = res.message
121
+ const waitRefreshRef = this.getComponentByName(res.name)
122
+ if (waitRefreshRef) {
123
+ waitRefreshRef.refresh()
124
+ } else {
125
+ console.warn(`未找到组件${res.name}无法刷新`)
126
+ }
123
127
  }
124
128
  // 如果传递消息类型 自动调用消息
125
129
  if (res?.messageType) {
126
130
  messageType = res.messageType
127
131
  }
128
- this.$message[messageType](message)
132
+ // 如果传递了提示信息自动调用提示
133
+ if (res?.message) {
134
+ this.$message[messageType](res?.message)
135
+ }
129
136
  this.close()
130
137
  })
131
138
  } else {
@@ -532,25 +532,31 @@ export default {
532
532
  cell.events.forEach(event => {
533
533
  handlers[event.type] = (...args) => {
534
534
  console.info('Event handled:', event.type, args)
535
- const result = executeStrFunctionByContext(this, event.customFunction, args)
535
+ let func = event.customFunction
536
+ if (func && func.startsWith('function')) {
537
+ func = func.replace('function', 'async function')
538
+ }
539
+ const result = executeStrFunctionByContext(this, func, args)
536
540
  if (result instanceof Promise) {
537
541
  result.then((res) => {
538
- let message = '操作成功'
539
542
  let messageType = 'success'
540
543
  // 如果传递了组件名字 自动调用刷新
541
544
  if (res?.name) {
542
- this.getComponentByName(res.name).refresh()
543
- }
544
- // 如果传递了提示信息自动调用提示
545
- if (res?.message) {
546
- message = res.message
545
+ const waitRefreshRef = this.getComponentByName(res.name)
546
+ if (waitRefreshRef) {
547
+ waitRefreshRef.refresh()
548
+ } else {
549
+ console.warn(`未找到组件${res.name}无法刷新`)
550
+ }
547
551
  }
548
552
  // 如果传递消息类型 自动调用消息
549
553
  if (res?.messageType) {
550
554
  messageType = res.messageType
551
555
  }
552
- this.$message[messageType](message)
553
- this.close()
556
+ // 如果传递了提示信息自动调用提示
557
+ if (res?.message) {
558
+ this.$message[messageType](res?.message)
559
+ }
554
560
  })
555
561
  }
556
562
  }