vue2-client 1.9.15 → 1.9.16

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.
@@ -5,13 +5,14 @@
5
5
 
6
6
  # 通过this可以调用的函数
7
7
  - openDialog(configName, selectedId, mixinData):打开一个对话框,例如:this.openDialog('xxx', 5, {})
8
- - openDialog(configName, selectedId, mixinData, outEnv):打开一个对话框:
9
- * selectId:id号,formtable选择时,用selectId过滤数据 可以传递 json {a_id: 1} 或者 传递 1 ,传递数值会默认拼接查询条件 {selected_id:1}
10
- * mixinData: form表单需要的数据
11
- * outEnv: 传递给打开的界面的数据,在打开界面的js中通过this.outEnv可以访问
12
- * getOutEnv 获取获取 outEnv
8
+ - openDialog(configName, selectedId, mixinData, outEnv, attr):打开一个对话框:
9
+ * selectId:id号,formtable选择时,用selectId过滤数据 可以传递 json {a_id: 1} 或者 传递 1 ,传递数值会默认拼接查询条件 {selected_id:1}
10
+ * mixinData: form表单需要的数据
11
+ * outEnv: 传递给打开的界面的数据,在打开界面的js中通过this.outEnv可以访问
12
+ * attr: 用于传递参数绑定到 modal 弹框上
13
+ - getOutEnv 获取获取 outEnv
13
14
  ```js
14
- this.openDialog('xxx', 5, {}, {})
15
+ this.openDialog('xxx', 5, {}, {}, {})
15
16
  ```
16
17
  - runLogic(logicName, parameter): 运行业务逻辑, 例如: this.runLogic('xxx', {})
17
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.9.15",
3
+ "version": "1.9.16",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -2,13 +2,13 @@
2
2
  <a-modal
3
3
  :confirm-loading="loading"
4
4
  :destroyOnClose="true"
5
- :title="resolvedTitle? resolvedTitle : businessTitle"
6
5
  :visible="visible"
7
6
  width="80%"
8
7
  height="60%"
9
8
  okText="提交"
10
9
  @cancel="close"
11
- @ok="onSubmit">
10
+ @ok="onSubmit"
11
+ v-bind="attr">
12
12
  <div style="max-height: 70vh; overflow-y: auto;" v-if="showReport">
13
13
  <x-report
14
14
  @updateImg="updateImg"
@@ -29,152 +29,168 @@
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 XReport from '@vue2-client/pages/XReportGridView/XReport.vue'
33
32
 
34
33
  export default {
35
- name: 'XAddReport',
36
- components: {
37
- XReport: () => import('@vue2-client/base-client/components/common/XReportGrid/XReport.vue'),
38
- },
39
- props: {
40
- env: {
41
- type: String,
42
- default: 'prod'
34
+ name: 'XAddReport',
35
+ components: {
36
+ XReport: () => import('@vue2-client/base-client/components/common/XReportGrid/XReport.vue'),
37
+ },
38
+ props: {
39
+ env: {
40
+ type: String,
41
+ default: 'prod'
42
+ }
43
+ },
44
+ data () {
45
+ return {
46
+ // 业务类型
47
+ businessType: '',
48
+ showReport: true,
49
+ configName: '',
50
+ displayOnly: true,
51
+ serverName: '',
52
+ // 业务标题
53
+ title: '',
54
+ // 自定义标题
55
+ resolvedTitle: '',
56
+ // 新增或修改业务是否执行中
57
+ loading: false,
58
+ // 是否显示新增/修改模态框
59
+ visible: false,
60
+ // 选中的处理对象的id号
61
+ selectedId: null,
62
+ // 混入插槽组件的数据
63
+ mixinData: {},
64
+ // 打开窗口接收到的外部环境数据
65
+ outEnv: {},
66
+ // 外部传递来的 modal 参数
67
+ attr: {},
68
+ }
69
+ },
70
+ provide () {
71
+ return {
72
+ getSelectedId: () => this.getSelectedId(),
73
+ getSelectedData: () => {
74
+ return this.selectedId
75
+ },
76
+ getMixinData: () => {
77
+ return this.mixinData
78
+ },
79
+ getOutEnv: () => {
80
+ return this.outEnv
81
+ },
82
+ isInAModal: () => {
83
+ return true
43
84
  }
85
+ }
86
+ },
87
+ inject: ['getParentComponentByName'],
88
+ computed: {
89
+ businessTitle () {
90
+ return this.businessType + this.title
44
91
  },
45
- data () {
46
- return {
47
- // 业务类型
48
- businessType: '',
49
- showReport: true,
50
- configName: '',
51
- displayOnly: true,
52
- serverName: '',
53
- // 业务标题
54
- title: '',
55
- // 自定义标题
56
- resolvedTitle: '选择',
57
- // 新增或修改业务是否执行中
58
- loading: false,
59
- // 是否显示新增/修改模态框
60
- visible: false,
61
- // 选中的处理对象的id号
62
- selectedId: null,
63
- // 混入插槽组件的数据
64
- mixinData: {},
65
- // 打开窗口接收到的外部环境数据
66
- outEnv: {},
92
+ ...mapState('account', { currUser: 'user' })
93
+ },
94
+ methods: {
95
+ runLogic,
96
+ init (params) {
97
+ console.log('params', params)
98
+ const {
99
+ configName = 'medicalRecordCover',
100
+ serverName = process.env.VUE_APP_SYSTEM_NAME,
101
+ displayOnly = true,
102
+ selectedId = null,
103
+ outEnv = {},
104
+ mixinData = {},
105
+ attr = {}
106
+ } = params
107
+ this.configName = configName
108
+ this.serverName = serverName
109
+ this.displayOnly = displayOnly
110
+ this.visible = true
111
+ this.attr = attr
112
+ // 有选中项,给选中项赋值
113
+ if (selectedId) {
114
+ this.selectedId = selectedId
67
115
  }
116
+ // 当有些组件需要外部传数据时 使用这个混入
117
+ this.mixinData = mixinData
118
+ // 把打开时的环境传递给打开窗口,以便js脚本中使用
119
+ this.outEnv = outEnv
68
120
  },
69
- provide () {
70
- return {
71
- getSelectedId: () => this.getSelectedId(),
72
- getSelectedData: () => { return this.selectedId },
73
- getMixinData: () => { return this.mixinData },
74
- getOutEnv: () => { return this.outEnv },
75
- isInAModal: () => { return true }
121
+ getSelectedId () {
122
+ if (typeof this.selectedId === 'object') {
123
+ if (Object.keys(this.selectedId) > 0) {
124
+ return this.selectedId[Object.keys(this.selectedId)[0]]
125
+ }
126
+ } else {
127
+ return this.selectedId
76
128
  }
77
129
  },
78
- inject: ['getParentComponentByName'],
79
- computed: {
80
- businessTitle () {
81
- return this.businessType + this.title
82
- },
83
- ...mapState('account', { currUser: 'user' })
130
+ selectRow (selectedRowKeys, selectedRows) {
131
+ this.table_selectedRowKeys = selectedRowKeys
132
+ this.table_selectedRows = selectedRows
133
+ console.log('XAddReport')
134
+ this.$emit('selectRow', selectedRowKeys, selectedRows)
84
135
  },
85
- methods: {
86
- runLogic,
87
- init (params) {
88
- console.log('params', params)
89
- const {
90
- configName = 'medicalRecordCover', serverName = process.env.VUE_APP_SYSTEM_NAME, displayOnly = true, selectedId = null, outEnv = {}, mixinData = {}
91
- } = params
92
- this.configName = configName
93
- this.serverName = serverName
94
- this.displayOnly = displayOnly
95
- this.visible = true
96
- // 有选中项,给选中项赋值
97
- if (selectedId) {
98
- this.selectedId = selectedId
99
- }
100
- // 当有些组件需要外部传数据时 使用这个混入
101
- this.mixinData = mixinData
102
- // 把打开时的环境传递给打开窗口,以便js脚本中使用
103
- this.outEnv = outEnv
104
- },
105
- getSelectedId () {
106
- if (typeof this.selectedId === 'object') {
107
- if (Object.keys(this.selectedId) > 0) {
108
- return this.selectedId[Object.keys(this.selectedId)[0]]
109
- }
110
- } else {
111
- return this.selectedId
112
- }
113
- },
114
- selectRow (selectedRowKeys, selectedRows) {
115
- this.table_selectedRowKeys = selectedRowKeys
116
- this.table_selectedRows = selectedRows
117
- console.log('XAddReport')
118
- this.$emit('selectRow', selectedRowKeys, selectedRows)
119
- },
120
- close () {
121
- this.loading = false
122
- this.visible = false
123
- this.$emit('close')
124
- },
125
- getComponentByName (name) {
126
- const innerRef = this.getParentComponentByName(name)
127
- if (innerRef) {
128
- return innerRef
129
- } else {
130
- return this.$refs.main.getComponentByName(name)
136
+ close () {
137
+ this.loading = false
138
+ this.visible = false
139
+ this.$emit('close')
140
+ },
141
+ getComponentByName (name) {
142
+ const innerRef = this.getParentComponentByName(name)
143
+ if (innerRef) {
144
+ return innerRef
145
+ } else {
146
+ return this.$refs.main.getComponentByName(name)
147
+ }
148
+ },
149
+ async onSubmit () {
150
+ if (this.$refs.main?.config?.confirmFunction) {
151
+ console.info('执行自定义确认逻辑')
152
+ let func = this.$refs.main?.config?.confirmFunction
153
+ if (func && func.startsWith('function')) {
154
+ func = func.replace('function', 'async function')
131
155
  }
132
- },
133
- async onSubmit () {
134
- if (this.$refs.main?.config?.confirmFunction) {
135
- console.info('执行自定义确认逻辑')
136
- let func = this.$refs.main?.config?.confirmFunction
137
- if (func && func.startsWith('function')) {
138
- func = func.replace('function', 'async function')
139
- }
140
- const result = executeStrFunctionByContext(this, func, [])
141
- if (result instanceof Promise) {
142
- result.then((res) => {
143
- if (!res) {
144
- this.close()
145
- return
146
- }
147
- let messageType = 'success'
148
- // 如果传递了组件名字 自动调用刷新
149
- if (res?.name) {
150
- const waitRefreshRef = this.getComponentByName(res.name)
151
- if (waitRefreshRef) {
152
- waitRefreshRef.refresh()
153
- } else {
154
- console.warn(`未找到组件${res.name}无法刷新`)
155
- }
156
- }
157
- // 如果传递消息类型 自动调用消息
158
- if (res?.messageType) {
159
- messageType = res.messageType
160
- }
161
- // 如果传递了提示信息自动调用提示
162
- if (res?.message) {
163
- this.$message[messageType](res?.message)
164
- }
156
+ const result = executeStrFunctionByContext(this, func, [])
157
+ if (result instanceof Promise) {
158
+ result.then((res) => {
159
+ if (!res) {
165
160
  this.close()
166
- })
167
- } else {
161
+ return
162
+ }
163
+ let messageType = 'success'
164
+ // 如果传递了组件名字 自动调用刷新
165
+ if (res?.name) {
166
+ const waitRefreshRef = this.getComponentByName(res.name)
167
+ if (waitRefreshRef) {
168
+ waitRefreshRef.refresh()
169
+ } else {
170
+ console.warn(`未找到组件${res.name}无法刷新`)
171
+ }
172
+ }
173
+ // 如果传递消息类型 自动调用消息
174
+ if (res?.messageType) {
175
+ messageType = res.messageType
176
+ }
177
+ // 如果传递了提示信息自动调用提示
178
+ if (res?.message) {
179
+ this.$message[messageType](res?.message)
180
+ }
168
181
  this.close()
169
- }
182
+ })
170
183
  } else {
171
- console.warn('未配置modal确认按钮逻辑')
172
184
  this.close()
173
185
  }
174
- },
175
- updateImg (data) {
176
- console.log(data)
186
+ } else {
187
+ console.warn('未配置modal确认按钮逻辑')
188
+ this.close()
177
189
  }
190
+ },
191
+ updateImg (data) {
192
+ console.log(data)
178
193
  }
179
194
  }
195
+ }
180
196
  </script>
@@ -276,9 +276,10 @@ export default {
276
276
  * @param configName 栅格配置名称
277
277
  * @param selectedId 选中得id
278
278
  * @param mixinData 需要混入得数据
279
- * @param env 其他传递给打开窗口的数据
279
+ * @param outEnv 其他传递给打开窗口的数据
280
+ * @param attr 传递给Modal弹框用的信息
280
281
  */
281
- openDialog (configName, selectedId, mixinData, outEnv) {
282
+ openDialog (configName, selectedId, mixinData, outEnv = {}, attr = {}) {
282
283
  console.log('openDialog', configName, selectedId)
283
284
  this.$refs.xAddReport.init({
284
285
  configName: configName,
@@ -67,13 +67,17 @@
67
67
  </a-tooltip>
68
68
  </span>
69
69
  <a-space style="float:right;margin-right: .2rem">
70
- <a-icon
71
- v-for="icon in config.btn"
72
- @click.stop="action(data, icon.func)"
70
+ <a-tooltip
71
+ :title="icon.title"
73
72
  :key="icon.func"
74
- v-if="executeStrFunction( icon.customFunction,[data])"
75
- :type="icon.icon"
76
- :style="{color:icon.color}"></a-icon>
73
+ v-for="icon in config.btn"
74
+ >
75
+ <a-icon
76
+ @click.stop="action(data, icon.func)"
77
+ v-if="executeStrFunction( icon.customFunction,[data])"
78
+ :type="icon.icon"
79
+ :style="{color:icon.color}"></a-icon>
80
+ </a-tooltip>
77
81
  </a-space>
78
82
  </span>
79
83
  </vue-easy-tree>