vue2-client 1.9.52 → 1.9.54
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/docs//345/207/275/346/225/260/344/275/277/347/224/250/347/233/270/345/205/263.md +2 -0
- package/package.json +1 -1
- package/src/base-client/components/common/XReportDrawer/XReportDrawer.vue +198 -0
- package/src/base-client/components/common/XReportDrawer/index.js +3 -0
- package/src/base-client/components/common/XReportGrid/XReport.vue +18 -1
- package/src/base-client/components/common/XReportGrid/XReportDemo.vue +1 -1
- package/src/base-client/components/common/XTab/XTab.vue +6 -2
- package/src/router/async/router.map.js +2 -2
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
# 通过this可以调用的函数
|
|
7
7
|
- openDialog(configName, selectedId, mixinData):打开一个对话框,例如:this.openDialog('xxx', 5, {})
|
|
8
8
|
- openDialog(configName, selectedId, mixinData, outEnv, attr):打开一个对话框:
|
|
9
|
+
- openDrawer(configName, selectedId, mixinData):打开一个对话框,例如:this.openDialog('xxx', 5, {})
|
|
10
|
+
- openDrawer(configName, selectedId, mixinData, outEnv, attr):打开一个对话框:
|
|
9
11
|
* selectId:id号,formtable选择时,用selectId过滤数据 可以传递 json {a_id: 1} 或者 传递 1 ,传递数值会默认拼接查询条件 {selected_id:1}
|
|
10
12
|
* mixinData: form表单需要的数据
|
|
11
13
|
* outEnv: 传递给打开的界面的数据,在打开界面的js中通过this.outEnv可以访问
|
package/package.json
CHANGED
|
@@ -0,0 +1,198 @@
|
|
|
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
|
+
|
|
29
|
+
export default {
|
|
30
|
+
name: 'XReportDrawer',
|
|
31
|
+
components: {
|
|
32
|
+
XReport: () => import('@vue2-client/base-client/components/common/XReportGrid/XReport.vue'),
|
|
33
|
+
},
|
|
34
|
+
props: {
|
|
35
|
+
env: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: 'prod'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
data () {
|
|
41
|
+
return {
|
|
42
|
+
// 业务类型
|
|
43
|
+
businessType: '',
|
|
44
|
+
configName: '',
|
|
45
|
+
displayOnly: true,
|
|
46
|
+
serverName: '',
|
|
47
|
+
// 业务标题
|
|
48
|
+
title: '',
|
|
49
|
+
// 自定义标题
|
|
50
|
+
resolvedTitle: '',
|
|
51
|
+
// 新增或修改业务是否执行中
|
|
52
|
+
loading: false,
|
|
53
|
+
// 是否显示新增/修改模态框
|
|
54
|
+
visible: false,
|
|
55
|
+
// 选中的处理对象的id号
|
|
56
|
+
selectedId: null,
|
|
57
|
+
// 混入插槽组件的数据
|
|
58
|
+
mixinData: {},
|
|
59
|
+
// 打开窗口接收到的外部环境数据
|
|
60
|
+
outEnv: {},
|
|
61
|
+
// 外部传递来的 modal 参数
|
|
62
|
+
attr: {},
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
provide () {
|
|
66
|
+
return {
|
|
67
|
+
getSelectedId: () => this.getSelectedId(),
|
|
68
|
+
getSelectedData: () => {
|
|
69
|
+
return this.selectedId
|
|
70
|
+
},
|
|
71
|
+
getMixinData: () => {
|
|
72
|
+
return this.mixinData
|
|
73
|
+
},
|
|
74
|
+
getOutEnv: () => {
|
|
75
|
+
return this.outEnv
|
|
76
|
+
},
|
|
77
|
+
isInAModal: () => {
|
|
78
|
+
return true
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
inject: ['getParentComponentByName'],
|
|
83
|
+
computed: {
|
|
84
|
+
businessTitle () {
|
|
85
|
+
return this.businessType + this.title
|
|
86
|
+
},
|
|
87
|
+
...mapState('account', { currUser: 'user' })
|
|
88
|
+
},
|
|
89
|
+
methods: {
|
|
90
|
+
getWindow,
|
|
91
|
+
isMicroAppEnv,
|
|
92
|
+
microDispatch,
|
|
93
|
+
getMicroData,
|
|
94
|
+
runLogic,
|
|
95
|
+
init (params) {
|
|
96
|
+
console.log('params', params)
|
|
97
|
+
const {
|
|
98
|
+
configName = '',
|
|
99
|
+
serverName = process.env.VUE_APP_SYSTEM_NAME,
|
|
100
|
+
displayOnly = true,
|
|
101
|
+
selectedId = null,
|
|
102
|
+
outEnv = {},
|
|
103
|
+
mixinData = {},
|
|
104
|
+
attr = {}
|
|
105
|
+
} = params
|
|
106
|
+
this.configName = configName
|
|
107
|
+
this.serverName = serverName
|
|
108
|
+
this.displayOnly = displayOnly
|
|
109
|
+
this.visible = true
|
|
110
|
+
this.attr = attr
|
|
111
|
+
// 有选中项,给选中项赋值
|
|
112
|
+
if (selectedId) {
|
|
113
|
+
this.selectedId = selectedId
|
|
114
|
+
}
|
|
115
|
+
// 当有些组件需要外部传数据时 使用这个混入
|
|
116
|
+
this.mixinData = mixinData
|
|
117
|
+
// 把打开时的环境传递给打开窗口,以便js脚本中使用
|
|
118
|
+
this.outEnv = outEnv
|
|
119
|
+
},
|
|
120
|
+
getSelectedId () {
|
|
121
|
+
if (typeof this.selectedId === 'object') {
|
|
122
|
+
if (this.selectedId.selectedId) {
|
|
123
|
+
return this.selectedId.selectedId
|
|
124
|
+
}
|
|
125
|
+
if (Object.keys(this.selectedId) > 0) {
|
|
126
|
+
return this.selectedId[Object.keys(this.selectedId)[0]]
|
|
127
|
+
}
|
|
128
|
+
} else {
|
|
129
|
+
return this.selectedId
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
selectRow (selectedRowKeys, selectedRows) {
|
|
133
|
+
this.table_selectedRowKeys = selectedRowKeys
|
|
134
|
+
this.table_selectedRows = selectedRows
|
|
135
|
+
console.log('XAddReport')
|
|
136
|
+
this.$emit('selectRow', selectedRowKeys, selectedRows)
|
|
137
|
+
},
|
|
138
|
+
close () {
|
|
139
|
+
this.loading = false
|
|
140
|
+
this.visible = false
|
|
141
|
+
this.$emit('close')
|
|
142
|
+
},
|
|
143
|
+
getComponentByName (name) {
|
|
144
|
+
const innerRef = this.getParentComponentByName(name)
|
|
145
|
+
if (innerRef) {
|
|
146
|
+
return innerRef
|
|
147
|
+
} else {
|
|
148
|
+
return this.$refs.main.getComponentByName(name)
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
async onSubmit () {
|
|
152
|
+
if (this.$refs.main?.config?.confirmFunction) {
|
|
153
|
+
console.info('执行自定义确认逻辑')
|
|
154
|
+
let func = this.$refs.main?.config?.confirmFunction
|
|
155
|
+
if (func && func.startsWith('function')) {
|
|
156
|
+
func = func.replace('function', 'async function')
|
|
157
|
+
}
|
|
158
|
+
const result = executeStrFunctionByContext(this, func, [])
|
|
159
|
+
if (result instanceof Promise) {
|
|
160
|
+
result.then((res) => {
|
|
161
|
+
if (!res) {
|
|
162
|
+
this.close()
|
|
163
|
+
return
|
|
164
|
+
}
|
|
165
|
+
let messageType = 'success'
|
|
166
|
+
// 如果传递了组件名字 自动调用刷新
|
|
167
|
+
if (res?.name) {
|
|
168
|
+
const waitRefreshRef = this.getComponentByName(res.name)
|
|
169
|
+
if (waitRefreshRef) {
|
|
170
|
+
waitRefreshRef.refresh()
|
|
171
|
+
} else {
|
|
172
|
+
console.warn(`未找到组件${res.name}无法刷新`)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// 如果传递消息类型 自动调用消息
|
|
176
|
+
if (res?.messageType) {
|
|
177
|
+
messageType = res.messageType
|
|
178
|
+
}
|
|
179
|
+
// 如果传递了提示信息自动调用提示
|
|
180
|
+
if (res?.message) {
|
|
181
|
+
this.$message[messageType](res?.message)
|
|
182
|
+
}
|
|
183
|
+
this.close()
|
|
184
|
+
})
|
|
185
|
+
} else {
|
|
186
|
+
this.close()
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
console.warn('未配置modal确认按钮逻辑')
|
|
190
|
+
this.close()
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
updateImg (data) {
|
|
194
|
+
console.log(data)
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
</script>
|
|
@@ -77,6 +77,11 @@
|
|
|
77
77
|
:env="env"
|
|
78
78
|
ref="xAddReport"
|
|
79
79
|
/>
|
|
80
|
+
<!-- 弹出框 -->
|
|
81
|
+
<x-report-drawer
|
|
82
|
+
:env="env"
|
|
83
|
+
ref="xReportDrawer"
|
|
84
|
+
/>
|
|
80
85
|
</div>
|
|
81
86
|
</template>
|
|
82
87
|
|
|
@@ -189,6 +194,7 @@ export default {
|
|
|
189
194
|
},
|
|
190
195
|
components: {
|
|
191
196
|
XAddReport: () => import('@vue2-client/base-client/components/common/XAddReport'),
|
|
197
|
+
XReportDrawer: () => import('@vue2-client/base-client/components/common/XReportDrawer'),
|
|
192
198
|
XReportDesign
|
|
193
199
|
},
|
|
194
200
|
data () {
|
|
@@ -285,7 +291,18 @@ export default {
|
|
|
285
291
|
configName: configName,
|
|
286
292
|
selectedId: selectedId,
|
|
287
293
|
mixinData: mixinData,
|
|
288
|
-
outEnv: outEnv
|
|
294
|
+
outEnv: outEnv,
|
|
295
|
+
attr
|
|
296
|
+
})
|
|
297
|
+
},
|
|
298
|
+
openDrawer (configName, selectedId, mixinData, outEnv = {}, attr = {}) {
|
|
299
|
+
console.log('openDialog', configName, selectedId)
|
|
300
|
+
this.$refs.xReportDrawer.init({
|
|
301
|
+
configName,
|
|
302
|
+
selectedId,
|
|
303
|
+
mixinData,
|
|
304
|
+
outEnv,
|
|
305
|
+
attr
|
|
289
306
|
})
|
|
290
307
|
},
|
|
291
308
|
// 向外暴露图片修改后的数据,某些外部需要自己管理图片的保存与修改
|
|
@@ -59,7 +59,6 @@ export default {
|
|
|
59
59
|
return
|
|
60
60
|
}
|
|
61
61
|
const oldKey = this.activeKey
|
|
62
|
-
this.activeKey = newKey
|
|
63
62
|
if (this.config.changeFunc) {
|
|
64
63
|
const args = [
|
|
65
64
|
oldKey,
|
|
@@ -74,7 +73,12 @@ export default {
|
|
|
74
73
|
args.push(this.$refs[`tab_com_${this.config.data[newKey].slotType}_${newKey}`][0])
|
|
75
74
|
this.$nextTick(() => {
|
|
76
75
|
// fromKey,toKey,fromConfig,toConfig,fromRef,toRef
|
|
77
|
-
executeStrFunctionByContext(this, this.config.changeFunc, args)
|
|
76
|
+
const result = executeStrFunctionByContext(this, this.config.changeFunc, args)
|
|
77
|
+
if (result && result.noChange) {
|
|
78
|
+
console.info('不切换页签作为按钮使用')
|
|
79
|
+
} else {
|
|
80
|
+
this.activeKey = newKey
|
|
81
|
+
}
|
|
78
82
|
})
|
|
79
83
|
}
|
|
80
84
|
}
|
|
@@ -85,9 +85,9 @@ routerResource.example = {
|
|
|
85
85
|
name: '示例页面',
|
|
86
86
|
// component: () => import('@vue2-client/base-client/components/common/XAddNativeForm/demo.vue'),
|
|
87
87
|
// component: () => import('@vue2-client/base-client/components/common/XReport/XReportDemo.vue'),
|
|
88
|
-
component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
|
|
88
|
+
// component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
|
|
89
89
|
// component: () => import('@vue2-client/base-client/components/common/XTab/XTabDemo.vue'),
|
|
90
|
-
|
|
90
|
+
component: () => import('@vue2-client/base-client/components/common/XReportGrid/XReportDemo.vue'),
|
|
91
91
|
// component: () => import('@vue2-client/pages/WorkflowDetail/WorkFlowDemo.vue'),
|
|
92
92
|
meta: {
|
|
93
93
|
// 菜单中不显示
|