af-mobile-client-vue3 1.0.83 → 1.0.84-2
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 +1 -1
- package/src/components/data/XCellList/XCellList.md +275 -275
- package/src/components/data/XFormItem/index.vue +0 -3
- package/src/components/data/XReportGrid/XAddReport/XAddReport.vue +208 -0
- package/src/components/data/XReportGrid/XAddReport/index.js +3 -0
- package/src/components/data/XReportGrid/XAddReport/index.md +56 -0
- package/src/components/data/XReportGrid/XAddReport/index.ts +10 -0
- package/src/components/data/XReportGrid/XReport.vue +972 -0
- package/src/components/data/XReportGrid/XReportDemo.vue +33 -0
- package/src/components/data/XReportGrid/XReportDesign.vue +597 -0
- package/src/components/data/XReportGrid/XReportDrawer/XReportDrawer.vue +154 -0
- package/src/components/data/XReportGrid/XReportDrawer/index.js +3 -0
- package/src/components/data/XReportGrid/XReportDrawer/index.ts +10 -0
- package/src/components/data/XReportGrid/XReportJsonRender.vue +386 -0
- package/src/components/data/XReportGrid/XReportTrGroup.vue +589 -0
- package/src/components/data/XReportGrid/index.md +44 -0
- package/src/components/data/XReportGrid/index.ts +10 -0
- package/src/components/data/XReportGrid/print.js +184 -0
- package/src/router/routes.ts +13 -1
- package/src/views/component/XCellListView/index.vue +10 -18
- package/src/views/component/XFormGroupView/index.vue +6 -15
- package/src/views/component/XReportGridView/index.vue +14 -0
- package/src/views/component/index.vue +4 -0
- package/src/views/component/test/index.vue +52 -0
- package/tsconfig.json +43 -43
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<van-dialog
|
|
3
|
+
v-model:show="visible"
|
|
4
|
+
:before-close="close"
|
|
5
|
+
:confirm-loading="loading"
|
|
6
|
+
width="80%"
|
|
7
|
+
:show-confirm-button="true"
|
|
8
|
+
confirm-text="提交"
|
|
9
|
+
@confirm="onSubmit"
|
|
10
|
+
v-bind="attr"
|
|
11
|
+
>
|
|
12
|
+
<div v-if="showReport" style="max-height: 70vh; overflow-y: auto; overflow-x: hidden;">
|
|
13
|
+
<XReport
|
|
14
|
+
ref="mainRef"
|
|
15
|
+
:env="env"
|
|
16
|
+
:use-oss-for-img="false"
|
|
17
|
+
:config-name="configName"
|
|
18
|
+
:show-img-in-cell="true"
|
|
19
|
+
:display-only="displayOnly"
|
|
20
|
+
:edit-mode="false"
|
|
21
|
+
:show-save-button="false"
|
|
22
|
+
:dont-format="true"
|
|
23
|
+
@update-img="updateImg"
|
|
24
|
+
@select-row="selectRow"
|
|
25
|
+
/>
|
|
26
|
+
</div>
|
|
27
|
+
</van-dialog>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import { ref, provide, inject, computed } from 'vue'
|
|
32
|
+
import { storeToRefs } from 'pinia'
|
|
33
|
+
import { useUserStore } from '@/stores/modules/user'
|
|
34
|
+
import { Dialog as VanDialog, showDialog } from 'vant'
|
|
35
|
+
import { executeStrFunctionByContext } from '@/utils/runEvalFunction'
|
|
36
|
+
import { runLogic } from '@/services/api/common'
|
|
37
|
+
import { getMicroData, getWindow, isMicroAppEnv, microDispatch } from '@/utils/microAppUtils'
|
|
38
|
+
import { getRealKeyData } from '@/utils/util'
|
|
39
|
+
import XReport from '../XReport.vue'
|
|
40
|
+
|
|
41
|
+
// Props
|
|
42
|
+
const props = defineProps({
|
|
43
|
+
env: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: 'prod'
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
// 状态管理
|
|
50
|
+
const showReport = ref(true)
|
|
51
|
+
const configName = ref('')
|
|
52
|
+
const displayOnly = ref(true)
|
|
53
|
+
const serverName = ref(process.env.VUE_APP_SYSTEM_NAME)
|
|
54
|
+
const loading = ref(false)
|
|
55
|
+
const visible = ref(false)
|
|
56
|
+
const selectedId = ref(null)
|
|
57
|
+
const mixinData = ref({})
|
|
58
|
+
const outEnv = ref({})
|
|
59
|
+
const attr = ref({})
|
|
60
|
+
|
|
61
|
+
// Store
|
|
62
|
+
const userStore = useUserStore()
|
|
63
|
+
const { user: currUser } = storeToRefs(userStore)
|
|
64
|
+
|
|
65
|
+
// Refs
|
|
66
|
+
const mainRef = ref()
|
|
67
|
+
|
|
68
|
+
// 注入
|
|
69
|
+
const getParentComponentByName = inject<Function>('getParentComponentByName')
|
|
70
|
+
const setGlobalData = inject<Function>('setGlobalData')
|
|
71
|
+
const getGlobalData = inject<Function>('getGlobalData')
|
|
72
|
+
|
|
73
|
+
// 提供依赖
|
|
74
|
+
provide('getSelectedId', () => getSelectedId())
|
|
75
|
+
provide('getSelectedData', () => selectedId.value)
|
|
76
|
+
provide('getMixinData', () => mixinData.value)
|
|
77
|
+
provide('getOutEnv', () => outEnv.value)
|
|
78
|
+
provide('isInAModal', () => true)
|
|
79
|
+
provide('currUser', currUser)
|
|
80
|
+
|
|
81
|
+
// Methods
|
|
82
|
+
const init = (params: {
|
|
83
|
+
configName?: string
|
|
84
|
+
serverName?: string
|
|
85
|
+
displayOnly?: boolean
|
|
86
|
+
selectedId?: any
|
|
87
|
+
outEnv?: Record<string, any>
|
|
88
|
+
mixinData?: Record<string, any>
|
|
89
|
+
attr?: Record<string, any>
|
|
90
|
+
}) => {
|
|
91
|
+
const {
|
|
92
|
+
configName: initConfigName = 'medicalRecordCover',
|
|
93
|
+
serverName: initServerName = process.env.VUE_APP_SYSTEM_NAME,
|
|
94
|
+
displayOnly: initDisplayOnly = true,
|
|
95
|
+
selectedId: initSelectedId = null,
|
|
96
|
+
outEnv: initOutEnv = {},
|
|
97
|
+
mixinData: initMixinData = {},
|
|
98
|
+
attr: initAttr = {}
|
|
99
|
+
} = params
|
|
100
|
+
|
|
101
|
+
configName.value = initConfigName
|
|
102
|
+
serverName.value = initServerName
|
|
103
|
+
displayOnly.value = initDisplayOnly
|
|
104
|
+
visible.value = true
|
|
105
|
+
attr.value = initAttr
|
|
106
|
+
|
|
107
|
+
if (initSelectedId) {
|
|
108
|
+
selectedId.value = initSelectedId
|
|
109
|
+
}
|
|
110
|
+
mixinData.value = initMixinData
|
|
111
|
+
outEnv.value = initOutEnv
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const getSelectedId = () => {
|
|
115
|
+
if (typeof selectedId.value === 'object') {
|
|
116
|
+
if (selectedId.value?.selectedId) {
|
|
117
|
+
return selectedId.value.selectedId
|
|
118
|
+
}
|
|
119
|
+
if (Object.keys(selectedId.value).length > 0) {
|
|
120
|
+
return selectedId.value[Object.keys(selectedId.value)[0]]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return selectedId.value
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const selectRow = (selectedRowKeys: any[], selectedRows: any[]) => {
|
|
127
|
+
console.log('XAddReport')
|
|
128
|
+
emit('selectRow', selectedRowKeys, selectedRows)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const close = () => {
|
|
132
|
+
loading.value = false
|
|
133
|
+
visible.value = false
|
|
134
|
+
emit('close')
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const getComponentByName = (name: string) => {
|
|
138
|
+
const innerRef = getParentComponentByName?.(name)
|
|
139
|
+
if (innerRef) {
|
|
140
|
+
return innerRef
|
|
141
|
+
}
|
|
142
|
+
return mainRef.value?.getComponentByName(name)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const onSubmit = async () => {
|
|
146
|
+
if (mainRef.value?.config?.confirmFunction) {
|
|
147
|
+
console.info('执行自定义确认逻辑')
|
|
148
|
+
let func = mainRef.value.config.confirmFunction
|
|
149
|
+
if (func && func.startsWith('function')) {
|
|
150
|
+
func = func.replace('function', 'async function')
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
try {
|
|
154
|
+
const result = await executeStrFunctionByContext(null, func, [])
|
|
155
|
+
if (!result) {
|
|
156
|
+
close()
|
|
157
|
+
return
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
let messageType = 'success'
|
|
161
|
+
|
|
162
|
+
if (result?.name) {
|
|
163
|
+
const waitRefreshRef = getComponentByName(result.name)
|
|
164
|
+
if (waitRefreshRef) {
|
|
165
|
+
waitRefreshRef.refresh()
|
|
166
|
+
} else {
|
|
167
|
+
console.warn(`未找到组件${result.name}无法刷新`)
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (result?.messageType) {
|
|
172
|
+
messageType = result.messageType
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (result?.message) {
|
|
176
|
+
showDialog({
|
|
177
|
+
message: result.message,
|
|
178
|
+
type: messageType
|
|
179
|
+
})
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
close()
|
|
183
|
+
} catch (error) {
|
|
184
|
+
console.error('确认逻辑执行失败:', error)
|
|
185
|
+
close()
|
|
186
|
+
}
|
|
187
|
+
} else {
|
|
188
|
+
console.warn('未配置modal确认按钮逻辑')
|
|
189
|
+
close()
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const updateImg = (data: any) => {
|
|
194
|
+
console.log(data)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Emits
|
|
198
|
+
const emit = defineEmits<{
|
|
199
|
+
(e: 'close'): void
|
|
200
|
+
(e: 'selectRow', keys: any[], rows: any[]): void
|
|
201
|
+
}>()
|
|
202
|
+
|
|
203
|
+
// 暴露方法
|
|
204
|
+
defineExpose({
|
|
205
|
+
init,
|
|
206
|
+
getComponentByName
|
|
207
|
+
})
|
|
208
|
+
</script>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# XAddForm
|
|
2
|
+
|
|
3
|
+
动态新增/修改表单控件,根据JSON配置生成一个完整的可供新增/修改数据的动态表单
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## 何时使用
|
|
7
|
+
|
|
8
|
+
当需要一个可供新增/修改数据的动态生成的表单时
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
引用方式:
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
import XAddReport from '@vue2-client/base-client/components/XAddReport/XAddReport'
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
components: {
|
|
18
|
+
XAddReport
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## 代码演示
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<x-add-report
|
|
29
|
+
|
|
30
|
+
>
|
|
31
|
+
</x-add-report>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## API
|
|
35
|
+
|
|
36
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
37
|
+
|-----------------|--------------------------|---------|-------|
|
|
38
|
+
| businessTitle | 业务标题 | String | '' |
|
|
39
|
+
| businessType | 业务类型 | String | '' |
|
|
40
|
+
| visible | 是否显示模态框 | Boolean | false |
|
|
41
|
+
| jsonData | JSON配置,根据[工具>查询配置生成]功能生成 | Object | {} |
|
|
42
|
+
| modifyModelData | 修改操作前查询出的业务数据 | Object | {} |
|
|
43
|
+
| loading | 新增或修改业务是否执行中 | Boolean | false |
|
|
44
|
+
| fixedAddForm | 固定新增表单,会和新增表单合并 | Object | {} |
|
|
45
|
+
| getDataParams | 调用logic获取数据源的追加参数 | Object | - |
|
|
46
|
+
| @onSubmit | 表单的提交事件 | event | - |
|
|
47
|
+
|
|
48
|
+
## 例子1
|
|
49
|
+
----
|
|
50
|
+
参考XFormTable组件
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
注意事项
|
|
54
|
+
----
|
|
55
|
+
|
|
56
|
+
> 本组件已经实现了自适应布局,在不同分辨率下的设备均可得到基本理想的展示效果
|