vue2-client 1.10.35 → 1.11.1

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.
@@ -1,201 +1,201 @@
1
- <template>
2
- <a-drawer
3
- :destroyOnClose="true"
4
- :visible="visible"
5
- placement="right"
6
- width="85vw"
7
- @close="visible=false"
8
- v-bind="attr">
9
- <x-report
10
- @updateImg="updateImg"
11
- @selectRow="selectRow"
12
- ref="main"
13
- :env="env"
14
- :use-oss-for-img="false"
15
- :config-name="configName"
16
- :show-img-in-cell="true"
17
- :display-only="displayOnly"
18
- :edit-mode="false"
19
- :show-save-button="false"
20
- :dont-format="true"/>
21
- </a-drawer>
22
- </template>
23
- <script>
24
- import { mapState } from 'vuex'
25
- import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
26
- import { runLogic } from '@vue2-client/services/api/common'
27
- import { getMicroData, getWindow, isMicroAppEnv, microDispatch } from '@vue2-client/utils/microAppUtils'
28
- import { getRealKeyData } from '@vue2-client/utils/util'
29
-
30
- export default {
31
- name: 'XReportDrawer',
32
- components: {
33
- XReport: () => import('@vue2-client/base-client/components/common/XReportGrid/XReport.vue'),
34
- },
35
- props: {
36
- env: {
37
- type: String,
38
- default: 'prod'
39
- }
40
- },
41
- data () {
42
- return {
43
- // 业务类型
44
- businessType: '',
45
- configName: '',
46
- displayOnly: true,
47
- serverName: '',
48
- // 业务标题
49
- title: '',
50
- // 自定义标题
51
- resolvedTitle: '',
52
- // 新增或修改业务是否执行中
53
- loading: false,
54
- // 是否显示新增/修改模态框
55
- visible: false,
56
- // 选中的处理对象的id号
57
- selectedId: null,
58
- // 混入插槽组件的数据
59
- mixinData: {},
60
- // 打开窗口接收到的外部环境数据
61
- outEnv: {},
62
- // 外部传递来的 modal 参数
63
- attr: {},
64
- }
65
- },
66
- provide () {
67
- return {
68
- getSelectedId: () => this.getSelectedId(),
69
- getSelectedData: () => {
70
- return this.selectedId
71
- },
72
- getMixinData: () => {
73
- return this.mixinData
74
- },
75
- getOutEnv: () => {
76
- return this.outEnv
77
- },
78
- isInAModal: () => {
79
- return true
80
- },
81
- currUser: this.currUser
82
- }
83
- },
84
- inject: ['getParentComponentByName', 'setGlobalData', 'getGlobalData'],
85
- computed: {
86
- businessTitle () {
87
- return this.businessType + this.title
88
- },
89
- ...mapState('account', { currUser: 'user' })
90
- },
91
- methods: {
92
- getWindow,
93
- isMicroAppEnv,
94
- microDispatch,
95
- getMicroData,
96
- getRealKeyData,
97
- runLogic,
98
- init (params) {
99
- console.log('params', params)
100
- const {
101
- configName = '',
102
- serverName = process.env.VUE_APP_SYSTEM_NAME,
103
- displayOnly = true,
104
- selectedId = null,
105
- outEnv = {},
106
- mixinData = {},
107
- attr = {}
108
- } = params
109
- this.configName = configName
110
- this.serverName = serverName
111
- this.displayOnly = displayOnly
112
- this.visible = true
113
- this.attr = attr
114
- // 有选中项,给选中项赋值
115
- if (selectedId) {
116
- this.selectedId = selectedId
117
- }
118
- // 当有些组件需要外部传数据时 使用这个混入
119
- this.mixinData = mixinData
120
- // 把打开时的环境传递给打开窗口,以便js脚本中使用
121
- this.outEnv = outEnv
122
- },
123
- getSelectedId () {
124
- if (typeof this.selectedId === 'object') {
125
- if (this.selectedId.selectedId) {
126
- return this.selectedId.selectedId
127
- }
128
- if (Object.keys(this.selectedId) > 0) {
129
- return this.selectedId[Object.keys(this.selectedId)[0]]
130
- }
131
- } else {
132
- return this.selectedId
133
- }
134
- },
135
- selectRow (selectedRowKeys, selectedRows) {
136
- this.table_selectedRowKeys = selectedRowKeys
137
- this.table_selectedRows = selectedRows
138
- console.log('XAddReport')
139
- this.$emit('selectRow', selectedRowKeys, selectedRows)
140
- },
141
- close () {
142
- this.loading = false
143
- this.visible = false
144
- this.$emit('close')
145
- },
146
- getComponentByName (name) {
147
- const innerRef = this.getParentComponentByName(name)
148
- if (innerRef) {
149
- return innerRef
150
- } else {
151
- return this.$refs.main.getComponentByName(name)
152
- }
153
- },
154
- async onSubmit () {
155
- if (this.$refs.main?.config?.confirmFunction) {
156
- console.info('执行自定义确认逻辑')
157
- let func = this.$refs.main?.config?.confirmFunction
158
- if (func && func.startsWith('function')) {
159
- func = func.replace('function', 'async function')
160
- }
161
- const result = executeStrFunctionByContext(this, func, [])
162
- if (result instanceof Promise) {
163
- result.then((res) => {
164
- if (!res) {
165
- this.close()
166
- return
167
- }
168
- let messageType = 'success'
169
- // 如果传递了组件名字 自动调用刷新
170
- if (res?.name) {
171
- const waitRefreshRef = this.getComponentByName(res.name)
172
- if (waitRefreshRef) {
173
- waitRefreshRef.refresh()
174
- } else {
175
- console.warn(`未找到组件${res.name}无法刷新`)
176
- }
177
- }
178
- // 如果传递消息类型 自动调用消息
179
- if (res?.messageType) {
180
- messageType = res.messageType
181
- }
182
- // 如果传递了提示信息自动调用提示
183
- if (res?.message) {
184
- this.$message[messageType](res?.message)
185
- }
186
- this.close()
187
- })
188
- } else {
189
- this.close()
190
- }
191
- } else {
192
- console.warn('未配置modal确认按钮逻辑')
193
- this.close()
194
- }
195
- },
196
- updateImg (data) {
197
- console.log(data)
198
- }
199
- }
200
- }
201
- </script>
1
+ <template>
2
+ <a-drawer
3
+ :destroyOnClose="true"
4
+ :visible="visible"
5
+ placement="right"
6
+ width="85vw"
7
+ @close="visible=false"
8
+ v-bind="attr">
9
+ <x-report
10
+ @updateImg="updateImg"
11
+ @selectRow="selectRow"
12
+ ref="main"
13
+ :env="env"
14
+ :use-oss-for-img="false"
15
+ :config-name="configName"
16
+ :show-img-in-cell="true"
17
+ :display-only="displayOnly"
18
+ :edit-mode="false"
19
+ :show-save-button="false"
20
+ :dont-format="true"/>
21
+ </a-drawer>
22
+ </template>
23
+ <script>
24
+ import { mapState } from 'vuex'
25
+ import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
26
+ import { runLogic } from '@vue2-client/services/api/common'
27
+ import { getMicroData, getWindow, isMicroAppEnv, microDispatch } from '@vue2-client/utils/microAppUtils'
28
+ import { getRealKeyData } from '@vue2-client/utils/util'
29
+
30
+ export default {
31
+ name: 'XReportDrawer',
32
+ components: {
33
+ XReport: () => import('@vue2-client/base-client/components/common/XReportGrid/XReport.vue'),
34
+ },
35
+ props: {
36
+ env: {
37
+ type: String,
38
+ default: 'prod'
39
+ }
40
+ },
41
+ data () {
42
+ return {
43
+ // 业务类型
44
+ businessType: '',
45
+ configName: '',
46
+ displayOnly: true,
47
+ serverName: '',
48
+ // 业务标题
49
+ title: '',
50
+ // 自定义标题
51
+ resolvedTitle: '',
52
+ // 新增或修改业务是否执行中
53
+ loading: false,
54
+ // 是否显示新增/修改模态框
55
+ visible: false,
56
+ // 选中的处理对象的id号
57
+ selectedId: null,
58
+ // 混入插槽组件的数据
59
+ mixinData: {},
60
+ // 打开窗口接收到的外部环境数据
61
+ outEnv: {},
62
+ // 外部传递来的 modal 参数
63
+ attr: {},
64
+ }
65
+ },
66
+ provide () {
67
+ return {
68
+ getSelectedId: () => this.getSelectedId(),
69
+ getSelectedData: () => {
70
+ return this.selectedId
71
+ },
72
+ getMixinData: () => {
73
+ return this.mixinData
74
+ },
75
+ getOutEnv: () => {
76
+ return this.outEnv
77
+ },
78
+ isInAModal: () => {
79
+ return true
80
+ },
81
+ currUser: this.currUser
82
+ }
83
+ },
84
+ inject: ['getParentComponentByName', 'setGlobalData', 'getGlobalData'],
85
+ computed: {
86
+ businessTitle () {
87
+ return this.businessType + this.title
88
+ },
89
+ ...mapState('account', { currUser: 'user' })
90
+ },
91
+ methods: {
92
+ getWindow,
93
+ isMicroAppEnv,
94
+ microDispatch,
95
+ getMicroData,
96
+ getRealKeyData,
97
+ runLogic,
98
+ init (params) {
99
+ console.log('params', params)
100
+ const {
101
+ configName = '',
102
+ serverName = process.env.VUE_APP_SYSTEM_NAME,
103
+ displayOnly = true,
104
+ selectedId = null,
105
+ outEnv = {},
106
+ mixinData = {},
107
+ attr = {}
108
+ } = params
109
+ this.configName = configName
110
+ this.serverName = serverName
111
+ this.displayOnly = displayOnly
112
+ this.visible = true
113
+ this.attr = attr
114
+ // 有选中项,给选中项赋值
115
+ if (selectedId) {
116
+ this.selectedId = selectedId
117
+ }
118
+ // 当有些组件需要外部传数据时 使用这个混入
119
+ this.mixinData = mixinData
120
+ // 把打开时的环境传递给打开窗口,以便js脚本中使用
121
+ this.outEnv = outEnv
122
+ },
123
+ getSelectedId () {
124
+ if (typeof this.selectedId === 'object') {
125
+ if (this.selectedId.selectedId) {
126
+ return this.selectedId.selectedId
127
+ }
128
+ if (Object.keys(this.selectedId) > 0) {
129
+ return this.selectedId[Object.keys(this.selectedId)[0]]
130
+ }
131
+ } else {
132
+ return this.selectedId
133
+ }
134
+ },
135
+ selectRow (selectedRowKeys, selectedRows) {
136
+ this.table_selectedRowKeys = selectedRowKeys
137
+ this.table_selectedRows = selectedRows
138
+ console.log('XAddReport')
139
+ this.$emit('selectRow', selectedRowKeys, selectedRows)
140
+ },
141
+ close () {
142
+ this.loading = false
143
+ this.visible = false
144
+ this.$emit('close')
145
+ },
146
+ getComponentByName (name) {
147
+ const innerRef = this.getParentComponentByName(name)
148
+ if (innerRef) {
149
+ return innerRef
150
+ } else {
151
+ return this.$refs.main.getComponentByName(name)
152
+ }
153
+ },
154
+ async onSubmit () {
155
+ if (this.$refs.main?.config?.confirmFunction) {
156
+ console.info('执行自定义确认逻辑')
157
+ let func = this.$refs.main?.config?.confirmFunction
158
+ if (func && func.startsWith('function')) {
159
+ func = func.replace('function', 'async function')
160
+ }
161
+ const result = executeStrFunctionByContext(this, func, [])
162
+ if (result instanceof Promise) {
163
+ result.then((res) => {
164
+ if (!res) {
165
+ this.close()
166
+ return
167
+ }
168
+ let messageType = 'success'
169
+ // 如果传递了组件名字 自动调用刷新
170
+ if (res?.name) {
171
+ const waitRefreshRef = this.getComponentByName(res.name)
172
+ if (waitRefreshRef) {
173
+ waitRefreshRef.refresh()
174
+ } else {
175
+ console.warn(`未找到组件${res.name}无法刷新`)
176
+ }
177
+ }
178
+ // 如果传递消息类型 自动调用消息
179
+ if (res?.messageType) {
180
+ messageType = res.messageType
181
+ }
182
+ // 如果传递了提示信息自动调用提示
183
+ if (res?.message) {
184
+ this.$message[messageType](res?.message)
185
+ }
186
+ this.close()
187
+ })
188
+ } else {
189
+ this.close()
190
+ }
191
+ } else {
192
+ console.warn('未配置modal确认按钮逻辑')
193
+ this.close()
194
+ }
195
+ },
196
+ updateImg (data) {
197
+ console.log(data)
198
+ }
199
+ }
200
+ }
201
+ </script>