vue2-client 1.8.447 → 1.8.449

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.
@@ -57,3 +57,53 @@ function() {
57
57
  // 把组件当前选中的项及select_id传给后台业务逻辑
58
58
  this.runLogic('logic', {select_id: main.getSelectedId(), rows: main.refreshTable()})
59
59
  }
60
+
61
+ ## 执行自定义函数之后 刷新和提示说明
62
+
63
+ ### 前端函数写法
64
+ ```js
65
+ function () {
66
+ if (id) {
67
+ return this.runLogic('omtwCheckIn', { id })
68
+ } else {
69
+ return new Promise((resolve) => {
70
+ resolve({ message: '未提供 ID,无法登记' ,messageType:'warn'})
71
+ })
72
+ }
73
+ }
74
+ // return this.runLogic('omtwCheckIn', { id })
75
+ // this.runLogic 所调用 logic 的 返回结果 为 Promise 对象 Promise对象内容 就是logic返回内容
76
+ // logic 返回内容写法参考下面的 logic 写法
77
+ // 如果不调用 this.runLogic 直接返回一个 Promise 对象,Promise对象内容就是提示内容
78
+ // 返回结果参数说明
79
+ // {
80
+ // name :"插槽实例名字", 如果传递了 name 或自动调用 该插槽的 refresh 方法 进行刷新
81
+ // message : "提示内容", 默认值为 ”操作成功“ 可自定义传
82
+ // messageType : "提示级别", 默认值为 "success" 可自定义传 success | warn | info | error
83
+ // }
84
+ ```
85
+ ### Logic 写法
86
+ ```go
87
+ validate {
88
+ id: {
89
+ required: true
90
+ }
91
+ },
92
+ entity.partialSave("dms_non_drug_item_record", data),
93
+ {
94
+ message:"登记成功",
95
+ messageType: "success",
96
+ name:"omtwCheckInCRUD"
97
+ }
98
+
99
+ ```
100
+ 或者
101
+ ```go
102
+ data.a == 3 : (
103
+ return {
104
+ message:"登记成功",
105
+ messageType: "success",
106
+ name:"omtwCheckInCRUD"
107
+ }
108
+ ),null
109
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.447",
3
+ "version": "1.8.449",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -532,7 +532,27 @@ export default {
532
532
  cell.events.forEach(event => {
533
533
  handlers[event.type] = (...args) => {
534
534
  console.info('Event handled:', event.type, args)
535
- executeStrFunctionByContext(this, event.customFunction, args)
535
+ const result = executeStrFunctionByContext(this, event.customFunction, args)
536
+ if (result instanceof Promise) {
537
+ result.then((res) => {
538
+ let message = '操作成功'
539
+ let messageType = 'success'
540
+ // 如果传递了组件名字 自动调用刷新
541
+ if (res?.name) {
542
+ this.getComponentByName(res.name).refresh()
543
+ }
544
+ // 如果传递了提示信息自动调用提示
545
+ if (res?.message) {
546
+ message = res.message
547
+ }
548
+ // 如果传递消息类型 自动调用消息
549
+ if (res?.messageType) {
550
+ messageType = res.messageType
551
+ }
552
+ this.$message[messageType](message)
553
+ this.close()
554
+ })
555
+ }
536
556
  }
537
557
  })
538
558
  return handlers