vue2-client 1.22.28 → 1.22.30
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/.env.his +19 -19
- package/.idea/af-vue2-client.iml +2 -3
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/package.json +1 -1
- package/src/base-client/components/common/HIS/HButtons/HButtons.vue +775 -775
- package/src/base-client/components/common/HIS/HForm/HForm.vue +1708 -1708
- package/src/base-client/components/common/HIS/HTab/HTab.vue +790 -790
- package/src/base-client/components/common/XInspectionDetailDrawer/components/HazardPhotos.vue +18 -0
- package/src/base-client/components/common/XInspectionDetailDrawer/index.vue +6 -1
- package/src/base-client/components/common/XMarkdownViewer/demo.vue +102 -102
- package/src/base-client/components/his/XTransfer/index.md +327 -327
- package/.history/.eslintrc_20260521171150.js +0 -74
- package/.history/.eslintrc_20260521171213.js +0 -74
- package/.history/src/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm_20260601154443.vue +0 -726
- package/.history/src/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm_20260601154700.vue +0 -478
- package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260611152602.vue +0 -755
- package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260702161223.vue +0 -748
- package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260702163310.vue +0 -832
- package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260702163324.vue +0 -748
- package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260702165416.vue +0 -748
- package/.history/src/base-client/components/common/HIS/HButtons/HButtons_20260702174939.vue +0 -793
- package/.history/src/base-client/components/common/HIS/HForm/HForm_20260702115430.vue +0 -1463
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260310142713.vue +0 -512
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260310145118.vue +0 -511
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260311094834.vue +0 -696
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260320143028.vue +0 -693
- package/.history/src/base-client/components/common/HIS/HFormTable/HFormTable_20260409101450.vue +0 -677
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260625173703.vue +0 -767
- package/.history/src/base-client/components/common/HIS/HTab/HTab_20260626112425.vue +0 -803
- package/.history/src/base-client/components/common/XAddNativeForm/XAddNativeForm_20260626173854.vue +0 -1522
- package/.history/src/base-client/components/common/XCollapse/XCollapse_20260703180349.vue +0 -862
- package/.history/src/base-client/components/common/XCollapse/XCollapse_20260703180623.vue +0 -862
- package/.history/src/base-client/components/common/XCollapse/XCollapse_20260703180702.vue +0 -842
- package/.history/src/base-client/components/common/XForm/XFormItem_20260703101840.vue +0 -1621
- package/.history/src/base-client/components/common/XMarkdownViewer/XMarkdownViewer_20260519140403.vue +0 -643
- package/.history/src/base-client/components/common/XMarkdownViewer/XMarkdownViewer_20260519140829.vue +0 -628
- package/.history/src/base-client/components/common/XMarkdownViewer/demo_20260519142824.vue +0 -104
- package/.history/src/base-client/components/common/XMarkdownViewer/demo_20260519143155.vue +0 -102
- package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20260703180412.vue +0 -1102
- package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20260703180623.vue +0 -1093
- package/.history/src/base-client/components/common/XReportGrid/XReport_20260309171231.vue +0 -1241
- package/.history/src/base-client/components/common/XReportGrid/XReport_20260309171441.vue +0 -1223
- package/.history/src/base-client/components/his/HAi/HAi_20260612174826.vue +0 -472
- package/.history/src/base-client/components/his/HAi/HAi_20260612175839.vue +0 -538
- package/.history/src/base-client/components/his/HAi/HAi_20260615103331.vue +0 -650
- package/.history/src/base-client/components/his/HAi/HAi_20260618140214.vue +0 -1396
- package/.history/src/base-client/components/his/HAi/HAi_20260618140556.vue +0 -1396
- package/.history/src/base-client/components/his/XHDescriptions/XHDescriptions_20260424134504.vue +0 -1469
- package/.history/src/base-client/components/his/XRadio/XRadio_20260702140351.vue +0 -774
- package/.history/src/base-client/components/his/XRadio/XRadio_20260702140441.vue +0 -774
- package/.history/src/base-client/components/his/XSidebar/XSidebar_20260610171133.vue +0 -788
- package/.history/src/base-client/components/his/XSidebar/XSidebar_20260610171151.vue +0 -780
- package/.history/src/base-client/components/his/XTransfer/XTransfer_20260511170841.vue +0 -585
- package/.history/src/base-client/components/his/XTransfer/XTransfer_20260511171138.vue +0 -787
- package/.history/src/base-client/components/his/XTransfer/XTransfer_20260512141830.vue +0 -739
- package/.history/src/components/STable/index_20260409155138.js +0 -806
- package/.history/src/components/STable/index_20260409155218.js +0 -814
- package/.history/src/expression/core/Expression_20260305164427.js +0 -1371
- package/.history/src/expression/core/Expression_20260305170258.js +0 -1358
- package/.history/src/expression/core/Program_20260305111830.js +0 -944
- package/.history/src/expression/core/Program_20260305112041.js +0 -931
- package/.history/src/logic/LogicRunner_20260304154306.js +0 -170
- package/.history/src/logic/LogicRunner_20260304155553.js +0 -112
- package/.history/src/logic/LogicRunner_20260305105834.js +0 -112
- package/.history/src/logic/LogicRunner_20260305112718.js +0 -129
- package/.history/src/logic/LogicRunner_20260305182436.js +0 -133
- package/.history/src/logic/LogicRunner_20260306151301.js +0 -213
- package/.history/src/logic/LogicRunner_20260306152419.js +0 -213
- package/.history/src/logic/plugins/common/DateTools_20260305154159.js +0 -61
- package/.history/src/logic/plugins/common/DateTools_20260305154217.js +0 -44
- package/.history/src/logic/plugins/common/DateTools_20260305161014.js +0 -44
- package/.history/src/logic/plugins/common/HttpTools_20260305164352.js +0 -80
- package/.history/src/logic/plugins/common/HttpTools_20260305170258.js +0 -75
- package/.history/src/logic/plugins/common/HttpTools_20260305171634.js +0 -75
- package/.history/src/logic/plugins/common/HttpTools_20260306152419.js +0 -72
- package/.history/src/services/api/restTools_20260427142149.js +0 -245
- package/.history/src/services/api/restTools_20260427142853.js +0 -230
- package/.history/src/services/api/restTools_20260519135558.js +0 -230
- package/.history/src/services/api/restTools_20260519140825.js +0 -230
- package/.history/src/services/api/restTools_20260519151223.js +0 -230
- package/.history/src/theme/global_20260703101634.less +0 -370
- package/.history/src/theme/global_20260703101840.less +0 -337
- package/.history/src/theme/global_20260703104511.less +0 -337
- package/.history/src/utils/indexedDB_20260306150918.js +0 -593
- package/.history/src/utils/indexedDB_20260306151301.js +0 -586
- package/.idea/codeStyles/Project.xml +0 -62
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/misc.xml +0 -6
- package/docs/XCollapse/345/261/225/345/274/200/347/251/272/347/231/275/346/216/222/346/237/245/350/256/260/345/275/225.md +0 -153
- package/preview-input-box.html +0 -180
package/.history/src/base-client/components/common/XReportGrid/XReportTrGroup_20260703180412.vue
DELETED
|
@@ -1,1102 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<a-row id="has_row" type="flex" :gutter="dynamicGutter" :style="isWidget ? {margin: '0px'} : {'margin-bottom': '.5rem'}">
|
|
3
|
-
<template v-for="(cell, cellIndex) in columns">
|
|
4
|
-
<a-col
|
|
5
|
-
name="trGroup"
|
|
6
|
-
v-if="Array.isArray(cell) || !cell.dontShowRow"
|
|
7
|
-
:key="cellIndex"
|
|
8
|
-
:ref="`trGroup_${ cell.slotRef || cellIndex}`"
|
|
9
|
-
@hook:mounted="(h)=>applyAllStyles(cell,cellIndex)"
|
|
10
|
-
:span="calculateColSpan(cell, columns)">
|
|
11
|
-
<div id="report_widget" v-if="isWidget">
|
|
12
|
-
<!-- 插槽渲染 -->
|
|
13
|
-
<template v-if="Array.isArray(cell)">
|
|
14
|
-
<!-- 处理 cell 是数组的情况 -->
|
|
15
|
-
<div v-for="(item, index) in cell" :key="index">
|
|
16
|
-
<x-report-tr-group
|
|
17
|
-
:env="env"
|
|
18
|
-
:key="index"
|
|
19
|
-
:columns="recalculateItem(item)"
|
|
20
|
-
:config-data="configData"
|
|
21
|
-
:config="config"
|
|
22
|
-
:display="true">
|
|
23
|
-
</x-report-tr-group>
|
|
24
|
-
</div>
|
|
25
|
-
</template>
|
|
26
|
-
<template v-else-if="cell.type === 'slot'">
|
|
27
|
-
<template
|
|
28
|
-
v-if="[
|
|
29
|
-
'x-form-table',
|
|
30
|
-
'h-form-table',
|
|
31
|
-
'x-add-native-form',
|
|
32
|
-
'h-add-native-form',
|
|
33
|
-
'x-tree-pro',
|
|
34
|
-
'x-his-editor',
|
|
35
|
-
'h-form',
|
|
36
|
-
'x-tab',
|
|
37
|
-
'h-tab',
|
|
38
|
-
'x-form-group',
|
|
39
|
-
'h-form-group',
|
|
40
|
-
'x-report',
|
|
41
|
-
'x-buttons',
|
|
42
|
-
'h-buttons',
|
|
43
|
-
'x-label-select',
|
|
44
|
-
'x-conversation',
|
|
45
|
-
'x-check-list',
|
|
46
|
-
'x-cardSet',
|
|
47
|
-
'x-collapse',
|
|
48
|
-
'x-h-descriptions',
|
|
49
|
-
'x-sidebar',
|
|
50
|
-
'x-list',
|
|
51
|
-
'x-input',
|
|
52
|
-
'x-time-line',
|
|
53
|
-
'x-radio',
|
|
54
|
-
'x-calendar',
|
|
55
|
-
'x-time-select',
|
|
56
|
-
'x-checkbox',
|
|
57
|
-
'x-title',
|
|
58
|
-
'x-select',
|
|
59
|
-
'x-tree-rows',
|
|
60
|
-
'x-three-test-orders',
|
|
61
|
-
'x-shift-schedule',
|
|
62
|
-
'x-charge',
|
|
63
|
-
'x-questionnaire',
|
|
64
|
-
'x-import-excel-button',
|
|
65
|
-
'x-chart',
|
|
66
|
-
'h-chart',
|
|
67
|
-
'x-simple-table',
|
|
68
|
-
'x-workflow-progress',
|
|
69
|
-
'h-ai',
|
|
70
|
-
'x-markdown',
|
|
71
|
-
'x-markdown-section',
|
|
72
|
-
'x-transfer'
|
|
73
|
-
].includes(cell.slotType)">
|
|
74
|
-
<component
|
|
75
|
-
:is="getComponentName(cell.slotConfig, cell.serviceName, cell.slotType)"
|
|
76
|
-
:key="cellIndex"
|
|
77
|
-
:ref="`dynamicComponent_${ cell.slotRef || cellIndex}`"
|
|
78
|
-
v-bind="cell.attrs"
|
|
79
|
-
:serviceName="cell.serviceName"
|
|
80
|
-
:serverName="cell.serviceName"
|
|
81
|
-
v-on="getEventHandlers(cell, cellIndex)"
|
|
82
|
-
@configEnd="onSlotConfigEnd(cellIndex)"
|
|
83
|
-
@hook:mounted="(h)=>onComponentMounted(h,cell,cellIndex)"
|
|
84
|
-
@beforeDataChange="beforeDataChange"
|
|
85
|
-
@rowClick="handleRowClick"
|
|
86
|
-
@onExpand="onExpand"
|
|
87
|
-
:queryParamsName="cell.slotConfig"
|
|
88
|
-
:configName="cell.slotConfig"
|
|
89
|
-
:countVisible="false"
|
|
90
|
-
:env="env"
|
|
91
|
-
/>
|
|
92
|
-
</template>
|
|
93
|
-
</template>
|
|
94
|
-
</div>
|
|
95
|
-
<a-card v-else class="flexItem" :bordered="false" :body-style="{ padding: 0 }">
|
|
96
|
-
<!-- 插槽渲染 -->
|
|
97
|
-
<template v-if="Array.isArray(cell)">
|
|
98
|
-
<!-- 处理 cell 是数组的情况 -->
|
|
99
|
-
<div v-for="(item, index) in cell" :key="index">
|
|
100
|
-
<x-report-tr-group
|
|
101
|
-
:server-name="serverName"
|
|
102
|
-
:env="env"
|
|
103
|
-
:key="index"
|
|
104
|
-
:columns="recalculateItem(item)"
|
|
105
|
-
:config-data="configData"
|
|
106
|
-
:config="config"
|
|
107
|
-
:display="true">
|
|
108
|
-
</x-report-tr-group>
|
|
109
|
-
</div>
|
|
110
|
-
</template>
|
|
111
|
-
<template v-else-if="cell.type === 'slot'">
|
|
112
|
-
<template
|
|
113
|
-
v-if="[
|
|
114
|
-
'x-form-table',
|
|
115
|
-
'h-form-table',
|
|
116
|
-
'x-add-native-form',
|
|
117
|
-
'h-add-native-form',
|
|
118
|
-
'h-form',
|
|
119
|
-
'x-tree-pro',
|
|
120
|
-
'x-his-editor',
|
|
121
|
-
'x-tab',
|
|
122
|
-
'h-tab',
|
|
123
|
-
'x-form-group',
|
|
124
|
-
'h-form-group',
|
|
125
|
-
'x-report',
|
|
126
|
-
'x-buttons',
|
|
127
|
-
'h-buttons',
|
|
128
|
-
'x-label-select',
|
|
129
|
-
'x-conversation',
|
|
130
|
-
'x-check-list',
|
|
131
|
-
'x-cardSet',
|
|
132
|
-
'x-collapse',
|
|
133
|
-
'x-h-descriptions',
|
|
134
|
-
'x-sidebar',
|
|
135
|
-
'x-list',
|
|
136
|
-
'x-input',
|
|
137
|
-
'x-time-line',
|
|
138
|
-
'x-radio',
|
|
139
|
-
'x-calendar',
|
|
140
|
-
'x-time-select',
|
|
141
|
-
'x-checkbox',
|
|
142
|
-
'x-title',
|
|
143
|
-
'x-select',
|
|
144
|
-
'x-tree-rows',
|
|
145
|
-
'x-three-test-orders',
|
|
146
|
-
'x-shift-schedule',
|
|
147
|
-
'x-charge',
|
|
148
|
-
'x-questionnaire',
|
|
149
|
-
'x-import-excel-button',
|
|
150
|
-
'x-chart',
|
|
151
|
-
'h-chart',
|
|
152
|
-
'x-simple-table',
|
|
153
|
-
'x-workflow-progress',
|
|
154
|
-
'h-ai',
|
|
155
|
-
'x-markdown',
|
|
156
|
-
'x-markdown-section',
|
|
157
|
-
'x-transfer'
|
|
158
|
-
].includes(cell.slotType)">
|
|
159
|
-
<component
|
|
160
|
-
:is="getComponentName(cell.slotConfig, cell.serviceName, cell.slotType)"
|
|
161
|
-
:key="cellIndex"
|
|
162
|
-
:ref="`dynamicComponent_${ cell.slotRef || cellIndex}`"
|
|
163
|
-
v-bind="cell.attrs"
|
|
164
|
-
:serviceName="cell.serviceName"
|
|
165
|
-
:serverName="cell.serviceName"
|
|
166
|
-
v-on="getEventHandlers(cell, cellIndex)"
|
|
167
|
-
@configEnd="onSlotConfigEnd(cellIndex)"
|
|
168
|
-
@hook:mounted="(h)=>onComponentMounted(h,cell,cellIndex)"
|
|
169
|
-
@beforeDataChange="beforeDataChange"
|
|
170
|
-
@rowClick="handleRowClick"
|
|
171
|
-
@onExpand="onExpand"
|
|
172
|
-
:queryParamsName="cell.slotConfig"
|
|
173
|
-
:configName="cell.slotConfig"
|
|
174
|
-
:countVisible="false"
|
|
175
|
-
:env="env"
|
|
176
|
-
/>
|
|
177
|
-
</template>
|
|
178
|
-
</template>
|
|
179
|
-
</a-card>
|
|
180
|
-
</a-col>
|
|
181
|
-
</template>
|
|
182
|
-
</a-row>
|
|
183
|
-
</template>
|
|
184
|
-
|
|
185
|
-
<script>
|
|
186
|
-
import Upload from '@vue2-client/base-client/components/common/Upload'
|
|
187
|
-
import { getRealKeyData } from '@vue2-client/utils/util'
|
|
188
|
-
import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
|
|
189
|
-
import { getConfigByName, runLogic } from '@vue2-client/services/api/common'
|
|
190
|
-
import { getMicroData, getWindow, isMicroAppEnv, microDispatch } from '@vue2-client/utils/microAppUtils'
|
|
191
|
-
import { shortcutMixin } from '@vue2-client/base-client/plugins/shortcutMixin'
|
|
192
|
-
|
|
193
|
-
export default {
|
|
194
|
-
name: 'XReportTrGroup',
|
|
195
|
-
mixins: [shortcutMixin],
|
|
196
|
-
components: {
|
|
197
|
-
Upload,
|
|
198
|
-
XFormTable: () => import('@vue2-client/base-client/components/common/XFormTable/XFormTable.vue'),
|
|
199
|
-
HFormTable: () => import('@vue2-client/base-client/components/common/HIS/HFormTable/HFormTable.vue'),
|
|
200
|
-
HForm: () => import('@vue2-client/base-client/components/common/HIS/HForm/HForm.vue'),
|
|
201
|
-
XAddNativeForm: () => import('@vue2-client/base-client/components/common/XAddNativeForm/XAddNativeForm.vue'),
|
|
202
|
-
HAddNativeForm: () => import('@vue2-client/base-client/components/common/HIS/HAddNativeForm/HAddNativeForm.vue'),
|
|
203
|
-
XFormGroup: () => import('@vue2-client/base-client/components/common/XFormGroup/XFormGroup.vue'),
|
|
204
|
-
HFormGroup: () => import('@vue2-client/base-client/components/common/HIS/HFormGroup/HFormGroup.vue'),
|
|
205
|
-
XTreePro: () => import('@vue2-client/base-client/components/common/XTree/XTreePro.vue'),
|
|
206
|
-
XHisEditor: () => import('@vue2-client/base-client/components/his/XHisEditor/XHisEditor.vue'),
|
|
207
|
-
XTab: () => import('@vue2-client/base-client/components/common/XTab/XTab.vue'),
|
|
208
|
-
HTab: () => import('@vue2-client/base-client/components/common/HIS/HTab/HTab.vue'),
|
|
209
|
-
XReport: () => import('@vue2-client/base-client/components/common/XReport/XReport.vue'),
|
|
210
|
-
XButtons: () => import('@vue2-client/base-client/components/common/XButtons/XButtons.vue'),
|
|
211
|
-
HButtons: () => import('@vue2-client/base-client/components/common/HIS/HButtons/HButtons.vue'),
|
|
212
|
-
XLabelSelect: () => import('@vue2-client/base-client/components/common/XLabelSelect/XLabelSelect.vue'),
|
|
213
|
-
XConversation: () => import('@vue2-client/base-client/components/common/XConversation/XConversation.vue'),
|
|
214
|
-
XCheckList: () => import('@vue2-client/base-client/components/common/XCheckList/XCheckList.vue'),
|
|
215
|
-
XCardSet: () => import('@vue2-client/base-client/components/common/XCardSet/XCardSet.vue'),
|
|
216
|
-
XCollapse: () => import('@vue2-client/base-client/components/common/XCollapse/XCollapse.vue'),
|
|
217
|
-
XHDescriptions: () => import('@vue2-client/base-client/components/his/XHDescriptions/XHDescriptions.vue'),
|
|
218
|
-
XSidebar: () => import('@vue2-client/base-client/components/his/XSidebar/XSidebar.vue'),
|
|
219
|
-
XList: () => import('@vue2-client/base-client/components/his/XList/XList.vue'),
|
|
220
|
-
XInput: () => import('@vue2-client/base-client/components/common/XInput/XInput.vue'),
|
|
221
|
-
XTimeLine: () => import('@vue2-client/base-client/components/common/XTimeline/XTimeline.vue'),
|
|
222
|
-
XRadio: () => import('@vue2-client/base-client/components/his/XRadio/XRadio.vue'),
|
|
223
|
-
XCalendar: () => import('@vue2-client/base-client/components/common/XCalendar/XCalendar.vue'),
|
|
224
|
-
XTimeSelect: () => import('@vue2-client/base-client/components/his/XTimeSelect/XTimeSelect.vue'),
|
|
225
|
-
XCheckbox: () => import('@vue2-client/base-client/components/his/XCheckbox/XCheckbox.vue'),
|
|
226
|
-
XTitle: () => import('@vue2-client/base-client/components/his/XTitle/XTitle.vue'),
|
|
227
|
-
XSelect: () => import('@vue2-client/base-client/components/his/XSelect/XSelect.vue'),
|
|
228
|
-
XTreeRows: () => import('@vue2-client/base-client/components/his/XTreeRows/XTreeRows.vue'),
|
|
229
|
-
XThreeTestOrders: () => import('@vue2-client/base-client/components/his/threeTestOrders/threeTestOrders.vue'),
|
|
230
|
-
XShiftSchedule: () => import('@vue2-client/base-client/components/his/XShiftSchedule/XShiftSchedule.vue'),
|
|
231
|
-
XCharge: () => import('@vue2-client/base-client/components/his/XCharge/XCharge.vue'),
|
|
232
|
-
XQuestionnaire: () => import('@vue2-client/base-client/components/his/XQuestionnaire/XQuestionnaire.vue'),
|
|
233
|
-
XImportExcelButton: () => import('@vue2-client/base-client/components/his/XImportExcelButton/XImportExcelButton.vue'),
|
|
234
|
-
XChart: () => import('@vue2-client/base-client/components/his/XChart/XChart.vue'),
|
|
235
|
-
HChart: () => import('@vue2-client/base-client/components/his/HChart/HChart.vue'),
|
|
236
|
-
XSimpleTable: () => import('@vue2-client/base-client/components/his/XSimpleTable/XSimpleTable.vue'),
|
|
237
|
-
XWorkflowProgress: () => import('@vue2-client/base-client/components/his/XWorkflowProgress/XWorkflowProgress.vue'),
|
|
238
|
-
HAi: () => import('@vue2-client/base-client/components/his/HAi/HAi.vue'),
|
|
239
|
-
XMarkdown: () => import('@vue2-client/base-client/components/common/XMarkdownViewer/XMarkdownViewer.vue'),
|
|
240
|
-
XMarkdownSection: () => import('@vue2-client/base-client/components/common/XMarkdownSectionExtractor/XMarkdownSectionExtractor.vue'),
|
|
241
|
-
XTransfer: () => import('@vue2-client/base-client/components/his/XTransfer/XTransfer.vue')
|
|
242
|
-
},
|
|
243
|
-
props: {
|
|
244
|
-
// 每一行的配置
|
|
245
|
-
columns: {
|
|
246
|
-
type: Array,
|
|
247
|
-
required: true
|
|
248
|
-
},
|
|
249
|
-
showImgInCell: {
|
|
250
|
-
type: Boolean,
|
|
251
|
-
default: false
|
|
252
|
-
},
|
|
253
|
-
config: {
|
|
254
|
-
type: Object,
|
|
255
|
-
default: function () {
|
|
256
|
-
return {}
|
|
257
|
-
}
|
|
258
|
-
},
|
|
259
|
-
// 命名空间
|
|
260
|
-
serverName: {
|
|
261
|
-
type: String,
|
|
262
|
-
default: process.env.VUE_APP_SYSTEM_NAME
|
|
263
|
-
},
|
|
264
|
-
// 环境
|
|
265
|
-
env: {
|
|
266
|
-
type: String,
|
|
267
|
-
default: 'prod'
|
|
268
|
-
},
|
|
269
|
-
// 原始配置
|
|
270
|
-
configData: {
|
|
271
|
-
type: Object,
|
|
272
|
-
required: true
|
|
273
|
-
},
|
|
274
|
-
// 是否为展示行
|
|
275
|
-
display: {
|
|
276
|
-
type: Boolean,
|
|
277
|
-
default: false
|
|
278
|
-
},
|
|
279
|
-
},
|
|
280
|
-
computed: {
|
|
281
|
-
allSlotSum () {
|
|
282
|
-
// 计算总共有多少个Slot
|
|
283
|
-
let sum = 0
|
|
284
|
-
this.columns.forEach((item) => {
|
|
285
|
-
if (Array.isArray(item)) {
|
|
286
|
-
item.forEach((cell) => {
|
|
287
|
-
if (cell.type === 'slot') {
|
|
288
|
-
sum++
|
|
289
|
-
}
|
|
290
|
-
})
|
|
291
|
-
} else if (item.type && item.type === 'slot') {
|
|
292
|
-
sum++
|
|
293
|
-
}
|
|
294
|
-
})
|
|
295
|
-
return sum
|
|
296
|
-
},
|
|
297
|
-
// 动态 gutter 配置:当包含 x-sidebar 时禁用 gutter
|
|
298
|
-
dynamicGutter () {
|
|
299
|
-
if (this.config.enableGutter === false || this.config.enableGutter === 'false') {
|
|
300
|
-
return 0
|
|
301
|
-
}
|
|
302
|
-
if (!this.config || !this.config.columns || !Array.isArray(this.config.columns)) {
|
|
303
|
-
return this.gutter
|
|
304
|
-
}
|
|
305
|
-
// 检查是否包含 x-sidebar 组件
|
|
306
|
-
const hasXSidebar = this.config.columns.some(row => {
|
|
307
|
-
if (!Array.isArray(row)) return false
|
|
308
|
-
return row.some(cell => {
|
|
309
|
-
if (Array.isArray(cell)) {
|
|
310
|
-
const found = cell.some(item => item.slotType === 'x-sidebar')
|
|
311
|
-
return found
|
|
312
|
-
}
|
|
313
|
-
const found = cell.slotType === 'x-sidebar'
|
|
314
|
-
return found
|
|
315
|
-
})
|
|
316
|
-
})
|
|
317
|
-
const result = !hasXSidebar
|
|
318
|
-
return result ? this.gutter : 0
|
|
319
|
-
}
|
|
320
|
-
},
|
|
321
|
-
data () {
|
|
322
|
-
return {
|
|
323
|
-
// 快捷键作用域类型:grid 表示栅格类组件
|
|
324
|
-
shortcutScopeType: 'grid',
|
|
325
|
-
gutter: [8, { xs: 8, sm: 16, md: 24, lg: 32 }], // 设置水槽大小
|
|
326
|
-
maxColSpan: 12,
|
|
327
|
-
uploadParams: {
|
|
328
|
-
type: 'image',
|
|
329
|
-
accept: ['*'],
|
|
330
|
-
resUploadStock: 1,
|
|
331
|
-
pathKey: 'cs'
|
|
332
|
-
},
|
|
333
|
-
mixinData: {},
|
|
334
|
-
flexItemBodyState: {},
|
|
335
|
-
// 已经渲染得插槽得数量
|
|
336
|
-
slotRendered: 0,
|
|
337
|
-
// 已发出 configEnd 的 slot 的 cellIndex 集合,用于统计「所有 slot 配置结束」
|
|
338
|
-
slotConfigEnded: {},
|
|
339
|
-
// tableConfig: {}
|
|
340
|
-
}
|
|
341
|
-
},
|
|
342
|
-
watch: {
|
|
343
|
-
columns: {
|
|
344
|
-
deep: true,
|
|
345
|
-
immediate: true,
|
|
346
|
-
handler (newVal) {
|
|
347
|
-
// 使用nextTick确保DOM更新
|
|
348
|
-
this.$nextTick(() => {
|
|
349
|
-
this.$forceUpdate()
|
|
350
|
-
})
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
inject: {
|
|
355
|
-
openDialog: { default: false },
|
|
356
|
-
openDrawer: { default: false },
|
|
357
|
-
emitEvent: { default: false },
|
|
358
|
-
registerComponent: { default: false },
|
|
359
|
-
setColSpanByName: { default: false },
|
|
360
|
-
setGlobalData: { default: false },
|
|
361
|
-
getGlobalData: { default: false },
|
|
362
|
-
getComponentByName: { default: false },
|
|
363
|
-
getParentComponentByName: { default: false },
|
|
364
|
-
runLogic: { default: false },
|
|
365
|
-
getMixinData: { default: false },
|
|
366
|
-
getSelectedId: { default: false },
|
|
367
|
-
isInAModal: { default: false },
|
|
368
|
-
getConfigByName: { default: false },
|
|
369
|
-
getSelectedData: { default: false },
|
|
370
|
-
getOutEnv: { default: false },
|
|
371
|
-
currUser: { default: false },
|
|
372
|
-
isWidget: { default: false },
|
|
373
|
-
findComponentByName: { default: false },
|
|
374
|
-
closeAddReport: { default: false },
|
|
375
|
-
setData: { default: false },
|
|
376
|
-
getRootReport: { default: false },
|
|
377
|
-
// 注入来自父组件(XReport)的栅格完整作用域路径(XReport已拼接完整)
|
|
378
|
-
getGridScopePath: { default: null }
|
|
379
|
-
},
|
|
380
|
-
beforeDestroy() {
|
|
381
|
-
this.unregisterShortcuts()
|
|
382
|
-
},
|
|
383
|
-
methods: {
|
|
384
|
-
getWindow,
|
|
385
|
-
isMicroAppEnv,
|
|
386
|
-
microDispatch,
|
|
387
|
-
getMicroData,
|
|
388
|
-
getRealKeyData,
|
|
389
|
-
// ========== Mixin 覆盖方法 ==========
|
|
390
|
-
/**
|
|
391
|
-
* 获取快捷键配置(覆盖mixin)
|
|
392
|
-
* 验证当前激活的配置名是否匹配当前组件的配置名
|
|
393
|
-
*/
|
|
394
|
-
getShortcutConfig() {
|
|
395
|
-
try {
|
|
396
|
-
let parent = ''
|
|
397
|
-
if (typeof this.getGridScopePath === 'function') {
|
|
398
|
-
parent = this.getGridScopePath()
|
|
399
|
-
}
|
|
400
|
-
const parts = parent.split('/')
|
|
401
|
-
return { columns: this.columns, configName: parts[parts.length - 1], scopeType: 'grid' }
|
|
402
|
-
}catch (e){
|
|
403
|
-
console.log('=============---->',e)
|
|
404
|
-
}
|
|
405
|
-
},
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* 获取组件实例(覆盖mixin,供快捷键上下文使用)
|
|
410
|
-
*/
|
|
411
|
-
getScopePath() {
|
|
412
|
-
// 1. 获取路由
|
|
413
|
-
const route = this.$route?.path || 'unknown-route'
|
|
414
|
-
|
|
415
|
-
// 2. 获取 Tab 容器名称(来自 XTab)
|
|
416
|
-
let tabInfo = 'no-tab'
|
|
417
|
-
if (typeof this.getTabPath === 'function') {
|
|
418
|
-
const tabPath = this.getTabPath()
|
|
419
|
-
if (tabPath) {
|
|
420
|
-
tabInfo = tabPath
|
|
421
|
-
}
|
|
422
|
-
} else if (typeof this.getCurrentTabIndex === 'function') {
|
|
423
|
-
const tabIndex = this.getCurrentTabIndex()
|
|
424
|
-
if (tabIndex !== undefined && tabIndex !== null) {
|
|
425
|
-
tabInfo = `tab[${tabIndex}]`
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
// 3. 获取栅格配置名称 - 优先使用根组件的 configName,否则尝试 config 上的属性
|
|
430
|
-
let gridName = 'unknown-grid'
|
|
431
|
-
if (this._rootConfigName) {
|
|
432
|
-
gridName = this._rootConfigName
|
|
433
|
-
} else if (this.config) {
|
|
434
|
-
// 尝试 configName
|
|
435
|
-
if (this.config.configName) {
|
|
436
|
-
gridName = this.config.configName
|
|
437
|
-
}
|
|
438
|
-
// 尝试 configKey
|
|
439
|
-
else if (this.config.configKey) {
|
|
440
|
-
gridName = this.config.configKey
|
|
441
|
-
}
|
|
442
|
-
// 尝试 slotConfigName
|
|
443
|
-
else if (this.config.slotConfigName) {
|
|
444
|
-
gridName = this.config.slotConfigName
|
|
445
|
-
}
|
|
446
|
-
// 尝试 name
|
|
447
|
-
else if (this.config.name) {
|
|
448
|
-
gridName = this.config.name
|
|
449
|
-
}
|
|
450
|
-
// 尝试 title
|
|
451
|
-
else if (this.config.title) {
|
|
452
|
-
gridName = this.config.title
|
|
453
|
-
}
|
|
454
|
-
// 尝试从 columns 中的第一个 slot 获取 slotConfig(槽位名)
|
|
455
|
-
else if (this.config.columns && this.config.columns.length > 0) {
|
|
456
|
-
const firstRow = this.config.columns[0]
|
|
457
|
-
if (Array.isArray(firstRow) && firstRow.length > 0) {
|
|
458
|
-
const firstCell = firstRow[0]
|
|
459
|
-
if (firstCell?.slotConfig) {
|
|
460
|
-
gridName = `slot:${firstCell.slotConfig}`
|
|
461
|
-
} else if (firstCell?.slotRef) {
|
|
462
|
-
gridName = `ref:${firstCell.slotRef}`
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
// 调试:打印 config 的可用属性
|
|
469
|
-
if (this._scopePathDebugCount === undefined) {
|
|
470
|
-
this._scopePathDebugCount = 0
|
|
471
|
-
}
|
|
472
|
-
if (this._scopePathDebugCount < 3 && this.config) {
|
|
473
|
-
console.log(`[XReportTrGroup getScopePath] config keys:`, Object.keys(this.config), 'configName:', this.config.configName)
|
|
474
|
-
this._scopePathDebugCount++
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
// 完整路径:路由 -> Tab容器名称 -> 栅格配置名称
|
|
478
|
-
return `${route} -> ${tabInfo} -> ${gridName}`
|
|
479
|
-
},
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* 获取组件实例(覆盖mixin,供快捷键上下文使用)
|
|
483
|
-
*/
|
|
484
|
-
shortcutGetComponent(ref) {
|
|
485
|
-
// 通过 $refs 查找动态组件
|
|
486
|
-
const refName = `dynamicComponent_${ref}`
|
|
487
|
-
const component = this.$refs[refName]?.[0]
|
|
488
|
-
console.log('【获取组件实例】',component)
|
|
489
|
-
if (component) {
|
|
490
|
-
// 尝试获取实例方法
|
|
491
|
-
if (component.getXTabInstance) return component.getXTabInstance()
|
|
492
|
-
if (component.getXFormTableInstance) return component.getXFormTableInstance()
|
|
493
|
-
if (component.getXAddNativeFormInstance) return component.getXAddNativeFormInstance()
|
|
494
|
-
return component
|
|
495
|
-
}
|
|
496
|
-
return null
|
|
497
|
-
},
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* 查找组件(覆盖mixin)
|
|
501
|
-
*/
|
|
502
|
-
shortcutFindComponent(ref) {
|
|
503
|
-
console.log('【查找组件】', this)
|
|
504
|
-
console.log('【查找组件】', ref)
|
|
505
|
-
if (this.findComponentByName) {
|
|
506
|
-
return this.findComponentByName(this, ref, 10, 'parent')
|
|
507
|
-
}
|
|
508
|
-
return this.shortcutGetComponent(ref)
|
|
509
|
-
},
|
|
510
|
-
// ========== Mixin 覆盖方法结束 ==========
|
|
511
|
-
handleRowClick (record) {
|
|
512
|
-
this.$emit('rowClick', record)
|
|
513
|
-
},
|
|
514
|
-
beforeDataChange (record) {
|
|
515
|
-
this.$emit('beforeDataChange', record)
|
|
516
|
-
},
|
|
517
|
-
onExpand (expanded, record) {
|
|
518
|
-
this.$emit('expand', expanded, record)
|
|
519
|
-
},
|
|
520
|
-
listClick (data) {
|
|
521
|
-
this.$emit('listClick', data)
|
|
522
|
-
},
|
|
523
|
-
calculateColSpan (cell, columns) {
|
|
524
|
-
// 1. 获取当前 cell 的原始 colSpan 值
|
|
525
|
-
const currentColSpan = Array.isArray(cell)
|
|
526
|
-
? (Array.isArray(cell[0]) ? cell[0][0]?.colSpan || 1 : (cell[0]?.colSpan || 1))
|
|
527
|
-
: (cell?.colSpan ?? cell?.def?.colSpan ?? 1)
|
|
528
|
-
|
|
529
|
-
// 2. 计算整行所有 cell 的 colSpan 总和
|
|
530
|
-
const totalColSpan = (Array.isArray(columns) ? columns : []).reduce((sum, c) => {
|
|
531
|
-
const span = Array.isArray(c)
|
|
532
|
-
? (Array.isArray(c[0]) ? c[0][0]?.colSpan || 1 : (c[0]?.colSpan || 1))
|
|
533
|
-
: (c?.colSpan ?? c?.def?.colSpan ?? 1)
|
|
534
|
-
return sum + span
|
|
535
|
-
}, 0)
|
|
536
|
-
|
|
537
|
-
// 3. 智能判断:总和 > 12 为新配置(24份),≤ 12 为旧配置(12份需要×2)
|
|
538
|
-
const multiplier = totalColSpan > 12 ? 1 : 2
|
|
539
|
-
|
|
540
|
-
return currentColSpan * multiplier
|
|
541
|
-
},
|
|
542
|
-
applyAllStyles (cell, cellIndex) {
|
|
543
|
-
// 应用组件样式
|
|
544
|
-
const component = this.$refs[`trGroup_${ cell.slotRef || cellIndex}`][0]
|
|
545
|
-
// 确保组件已经完全挂载
|
|
546
|
-
this.$nextTick(() => {
|
|
547
|
-
this.applyComponentStyles(component, cell, cellIndex)
|
|
548
|
-
})
|
|
549
|
-
},
|
|
550
|
-
onSlotConfigEnd (cellIndex) {
|
|
551
|
-
if (this.slotConfigEnded[cellIndex]) return
|
|
552
|
-
this.$set(this.slotConfigEnded, cellIndex, true)
|
|
553
|
-
if (Object.keys(this.slotConfigEnded).length >= this.allSlotSum) {
|
|
554
|
-
this.$emit('slotsConfigEnded')
|
|
555
|
-
// 所有 slot 配置结束后,完整扫描一次快捷键
|
|
556
|
-
this.$nextTick(() => {
|
|
557
|
-
console.log('【所有 slot 配置结束后】 完整扫描一次快捷键')
|
|
558
|
-
this.rescanShortcuts()
|
|
559
|
-
})
|
|
560
|
-
}
|
|
561
|
-
},
|
|
562
|
-
onComponentMounted (h, cell, cellIndex) {
|
|
563
|
-
this.slotRendered += 1
|
|
564
|
-
if (this.slotRendered >= this.allSlotSum) {
|
|
565
|
-
this.$emit('slotRendered')
|
|
566
|
-
}
|
|
567
|
-
if (this.getMixinData && this.getMixinData()) {
|
|
568
|
-
this.mixinData = this.getMixinData()
|
|
569
|
-
}
|
|
570
|
-
if (cell.slotRef && this.registerComponent) {
|
|
571
|
-
this.registerComponent(cell.slotRef, this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0], {
|
|
572
|
-
globalRegistryName: cell.globalRegistryName,
|
|
573
|
-
mountedLogicName: cell.mountedLogicName,
|
|
574
|
-
mountedLogicMode: cell.mountedLogicMode,
|
|
575
|
-
mountedLogicParam: cell.mountedLogicParam
|
|
576
|
-
})}
|
|
577
|
-
// 子组件挂载后,触发其快捷键注册
|
|
578
|
-
const component = this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`]?.[0]
|
|
579
|
-
console.log('【子组件挂载后,触发其快捷键注册】', component)
|
|
580
|
-
if (component && typeof component.onShortcutMixinReady === 'function') {
|
|
581
|
-
component.onShortcutMixinReady()
|
|
582
|
-
}
|
|
583
|
-
// 传递给祖先组件
|
|
584
|
-
const shouldInit = cell.shouldInit == null ? true : cell.shouldInit
|
|
585
|
-
if (shouldInit) {
|
|
586
|
-
if (cell.slotType === 'x-add-native-form' || cell.slotType === 'h-form') {
|
|
587
|
-
// 简易表单需要主动调用初始化方法
|
|
588
|
-
getConfigByName(cell.slotConfig, cell.serviceName, async (res) => {
|
|
589
|
-
// 如果配置了 表单初始化logic
|
|
590
|
-
// 调用 logic 获取参数
|
|
591
|
-
let param = { ...this.mixinData }
|
|
592
|
-
let selectedId
|
|
593
|
-
if (res.paramLogicName) {
|
|
594
|
-
if (!!this.getSelectedId) {
|
|
595
|
-
selectedId = this.getSelectedId()
|
|
596
|
-
if (typeof selectedId !== 'object') {
|
|
597
|
-
selectedId = { selectedId: selectedId }
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
param = Object.assign(param, await runLogic(res.paramLogicName, selectedId, cell.serviceName))
|
|
601
|
-
}
|
|
602
|
-
this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
|
|
603
|
-
serviceName: cell.serviceName,
|
|
604
|
-
configName: cell.slotConfig,
|
|
605
|
-
formItems: res.formJson,
|
|
606
|
-
showSubmitBtn: !this.isInAModal,
|
|
607
|
-
businessType: param.businessType || '新增',
|
|
608
|
-
layout: res.xAddFormLayout,
|
|
609
|
-
primaryKey: res.primaryKey,
|
|
610
|
-
...res,
|
|
611
|
-
fixedAddForm: param,
|
|
612
|
-
modifyModelData: {
|
|
613
|
-
files: param.files,
|
|
614
|
-
images: param.images
|
|
615
|
-
}
|
|
616
|
-
})
|
|
617
|
-
}, this.env === 'dev')
|
|
618
|
-
} else if (cell.slotType === 'x-form-group') {
|
|
619
|
-
// 简易表单需要主动调用初始化方法
|
|
620
|
-
getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
|
|
621
|
-
// 如果配置了 表单初始化logic
|
|
622
|
-
// 调用 logic 获取参数
|
|
623
|
-
const param = { ...this.mixinData }
|
|
624
|
-
this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
|
|
625
|
-
...res,
|
|
626
|
-
serviceName: cell.serviceName,
|
|
627
|
-
showSubmitBtn: !this.isInAModal,
|
|
628
|
-
businessType: param.businessType || '新增',
|
|
629
|
-
modifyModelData: param,
|
|
630
|
-
showLeftTab: true,
|
|
631
|
-
})
|
|
632
|
-
}, this.env === 'dev')
|
|
633
|
-
} else if (cell.slotType === 'x-label-select') {
|
|
634
|
-
// 按钮组需要主动调用初始化方法
|
|
635
|
-
getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
|
|
636
|
-
this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
|
|
637
|
-
...res,
|
|
638
|
-
serviceName: cell.serviceName,
|
|
639
|
-
})
|
|
640
|
-
}, this.env === 'dev')
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
if (cell.slotType === 'x-report') {
|
|
644
|
-
const param = { ...this.mixinData }
|
|
645
|
-
this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
|
|
646
|
-
configName: cell.slotConfig,
|
|
647
|
-
configData: param
|
|
648
|
-
})
|
|
649
|
-
}
|
|
650
|
-
if (cell.slotType === 'x-conversation') {
|
|
651
|
-
getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
|
|
652
|
-
this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
|
|
653
|
-
serviceName: cell.serviceName,
|
|
654
|
-
...res,
|
|
655
|
-
})
|
|
656
|
-
}, this.env === 'dev')
|
|
657
|
-
}
|
|
658
|
-
if (cell.slotType === 'x-check-list') {
|
|
659
|
-
getConfigByName(cell.slotConfig, cell.serviceName, (res) => {
|
|
660
|
-
this.$refs[`dynamicComponent_${cell.slotRef || cellIndex}`][0].init({
|
|
661
|
-
serviceName: cell.serviceName,
|
|
662
|
-
...res,
|
|
663
|
-
})
|
|
664
|
-
}, this.env === 'dev')
|
|
665
|
-
}
|
|
666
|
-
},
|
|
667
|
-
recalculateItem (item) {
|
|
668
|
-
if (!Array.isArray(item)) {
|
|
669
|
-
console.warn('[XReportTrGroup] recalculateItem 期望接收数组,当前数据异常,跳过该列渲染。', item)
|
|
670
|
-
return []
|
|
671
|
-
}
|
|
672
|
-
const validCells = item.filter(cell => cell && typeof cell === 'object')
|
|
673
|
-
if (validCells.length === 0) {
|
|
674
|
-
console.warn('[XReportTrGroup] recalculateItem 列数据均为非对象,跳过该列渲染。', item)
|
|
675
|
-
return []
|
|
676
|
-
}
|
|
677
|
-
const totalColSpan = validCells.reduce((sum, cell) => {
|
|
678
|
-
// 保留手动设置的colSpan
|
|
679
|
-
return sum + (cell._isManualColSpan ? 0 : (cell.colSpan || 1))
|
|
680
|
-
}, 0)
|
|
681
|
-
return validCells.map(cell => {
|
|
682
|
-
// 跳过已手动设置的单元格
|
|
683
|
-
if (cell._isManualColSpan) return cell
|
|
684
|
-
const newColSpan = Math.round((cell.colSpan || 1) / totalColSpan * 12)
|
|
685
|
-
return {
|
|
686
|
-
...cell,
|
|
687
|
-
colSpan: newColSpan,
|
|
688
|
-
// 标记自动计算的单元格
|
|
689
|
-
_isAutoCalculated: true
|
|
690
|
-
}
|
|
691
|
-
})
|
|
692
|
-
},
|
|
693
|
-
|
|
694
|
-
getEventHandlers (cell, cellIndex) {
|
|
695
|
-
const handlers = {}
|
|
696
|
-
if (!cell?.events || cell?.events?.length === 0) {
|
|
697
|
-
return handlers
|
|
698
|
-
}
|
|
699
|
-
cell.events.forEach(event => {
|
|
700
|
-
handlers[event.type] = async (...args) => {
|
|
701
|
-
let func = event.customFunction
|
|
702
|
-
if (func && func.startsWith('function')) {
|
|
703
|
-
func = func.replace('function', 'async function')
|
|
704
|
-
}
|
|
705
|
-
const result = await executeStrFunctionByContext(this, func, args)
|
|
706
|
-
if (result instanceof Promise) {
|
|
707
|
-
result.then((res) => {
|
|
708
|
-
if (!res) return
|
|
709
|
-
let messageType = 'success'
|
|
710
|
-
// 如果传递了组件名字 自动调用刷新(getComponentByName 由根 XReport 注入并绑定,指向根 $refs)
|
|
711
|
-
if (res?.name && this.getComponentByName) {
|
|
712
|
-
const waitRefreshRef = this.getComponentByName(res.name)
|
|
713
|
-
if (waitRefreshRef) {
|
|
714
|
-
waitRefreshRef.refresh()
|
|
715
|
-
} else {
|
|
716
|
-
console.warn(`未找到组件${res.name}无法刷新`)
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
// 如果传递消息类型 自动调用消息
|
|
720
|
-
if (res?.messageType) {
|
|
721
|
-
messageType = res.messageType
|
|
722
|
-
}
|
|
723
|
-
// 如果传递了提示信息自动调用提示
|
|
724
|
-
if (res?.message) {
|
|
725
|
-
this.$message[messageType](res?.message)
|
|
726
|
-
}
|
|
727
|
-
})
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
})
|
|
731
|
-
return handlers
|
|
732
|
-
},
|
|
733
|
-
getComponentName (queryParamsName, serviceName, componentName) {
|
|
734
|
-
return componentName
|
|
735
|
-
},
|
|
736
|
-
// 判断单元格样式
|
|
737
|
-
determineCellStyle (cell, color = '#000', borderWidth = '1px') {
|
|
738
|
-
// 如果声明了borderColor
|
|
739
|
-
if (this.config.style.borderColor) {
|
|
740
|
-
color = this.config.style.borderColor
|
|
741
|
-
}
|
|
742
|
-
let result = {}
|
|
743
|
-
// 如果表格也声明了样式,用表格样式将样式覆盖
|
|
744
|
-
if (cell.style) {
|
|
745
|
-
if (cell.noBorder) {
|
|
746
|
-
result = { ...cell.style }
|
|
747
|
-
} else {
|
|
748
|
-
if (this.noTopBorder) {
|
|
749
|
-
result = { ...cell.style }
|
|
750
|
-
} else {
|
|
751
|
-
result = { ...cell.style }
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
return result
|
|
755
|
-
}
|
|
756
|
-
return result
|
|
757
|
-
},
|
|
758
|
-
// 把用户定义的组件,传递到整个杉格中,方便调用
|
|
759
|
-
passComponentNamesToAncestor (refs) {
|
|
760
|
-
const findCellBySlotRef = (cols, slotRef) => {
|
|
761
|
-
if (!Array.isArray(cols)) return cols && cols.slotRef === slotRef ? cols : null
|
|
762
|
-
for (const c of cols) {
|
|
763
|
-
if (c && !Array.isArray(c) && c.slotRef === slotRef) return c
|
|
764
|
-
if (Array.isArray(c)) {
|
|
765
|
-
const found = findCellBySlotRef(c, slotRef)
|
|
766
|
-
if (found) return found
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
return null
|
|
770
|
-
}
|
|
771
|
-
Object.entries(refs).forEach(([refKey, refValue]) => {
|
|
772
|
-
if (refKey.startsWith('dynamicComponent_')) {
|
|
773
|
-
const componentRef = refValue[0]
|
|
774
|
-
if (componentRef && this.registerComponent) {
|
|
775
|
-
const index = refKey.replace('dynamicComponent_', '')
|
|
776
|
-
const cell = findCellBySlotRef(this.columns, index)
|
|
777
|
-
this.registerComponent(index, componentRef, {
|
|
778
|
-
globalRegistryName: cell?.globalRegistryName,
|
|
779
|
-
mountedLogicName: cell?.mountedLogicName,
|
|
780
|
-
mountedLogicMode: cell?.mountedLogicMode,
|
|
781
|
-
mountedLogicParam: cell?.mountedLogicParam
|
|
782
|
-
})
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
})
|
|
786
|
-
},
|
|
787
|
-
// 获取组件样式配置
|
|
788
|
-
async getComponentStyleConfig (componentType) {
|
|
789
|
-
try {
|
|
790
|
-
// 从配置中获取样式定义
|
|
791
|
-
const publicStyleConfig = this.$appdata.getStylesByKey('public') || {}
|
|
792
|
-
const styleConfig = this.$appdata.getStylesByKey(componentType) || {}
|
|
793
|
-
Object.assign(publicStyleConfig, styleConfig)
|
|
794
|
-
return publicStyleConfig
|
|
795
|
-
} catch (error) {
|
|
796
|
-
console.error('获取组件样式配置失败:', error)
|
|
797
|
-
return {}
|
|
798
|
-
}
|
|
799
|
-
},
|
|
800
|
-
|
|
801
|
-
// 解析组件样式配置
|
|
802
|
-
async parseComponentStyles (cell) {
|
|
803
|
-
if (!cell.class) return { rootStyles: {}, childStyles: {} }
|
|
804
|
-
|
|
805
|
-
const styleConfig = await this.getComponentStyleConfig(cell.slotType)
|
|
806
|
-
if (!styleConfig) return { rootStyles: {}, childStyles: {} }
|
|
807
|
-
|
|
808
|
-
const rootStyles = {}
|
|
809
|
-
const childStyles = new Map()
|
|
810
|
-
|
|
811
|
-
// 处理每个class配置
|
|
812
|
-
cell.class.split(' ').forEach(className => {
|
|
813
|
-
const classConfig = styleConfig[className]
|
|
814
|
-
if (!classConfig) return
|
|
815
|
-
|
|
816
|
-
// 处理根节点样式
|
|
817
|
-
Object.entries(classConfig).forEach(([key, value]) => {
|
|
818
|
-
if (!key.startsWith('*') && typeof key !== 'object') {
|
|
819
|
-
rootStyles[key] = value
|
|
820
|
-
}
|
|
821
|
-
})
|
|
822
|
-
|
|
823
|
-
// 处理子节点样式
|
|
824
|
-
this.parseNestedStyles(classConfig, childStyles)
|
|
825
|
-
})
|
|
826
|
-
return {
|
|
827
|
-
rootStyles,
|
|
828
|
-
childStyles
|
|
829
|
-
}
|
|
830
|
-
},
|
|
831
|
-
|
|
832
|
-
// 递归解析嵌套的样式配置
|
|
833
|
-
parseNestedStyles (config, styleMap, parentKey = '') {
|
|
834
|
-
Object.entries(config).forEach(([key, value]) => {
|
|
835
|
-
if (!key.startsWith('*')) return
|
|
836
|
-
|
|
837
|
-
const className = key.replace('*', '.')
|
|
838
|
-
|
|
839
|
-
// 如果值是对象,检查是否包含样式和子节点
|
|
840
|
-
if (typeof value === 'object') {
|
|
841
|
-
const { style = {}, children = {} } = this.separateStyleAndChildren(value)
|
|
842
|
-
|
|
843
|
-
// 创建或获取当前节点的样式配置
|
|
844
|
-
if (!styleMap.has(className)) {
|
|
845
|
-
styleMap.set(className, {
|
|
846
|
-
styles: {},
|
|
847
|
-
children: new Map()
|
|
848
|
-
})
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
const nodeData = styleMap.get(className)
|
|
852
|
-
|
|
853
|
-
// 合并样式
|
|
854
|
-
Object.assign(nodeData.styles, style)
|
|
855
|
-
|
|
856
|
-
// 递归处理子节点
|
|
857
|
-
this.parseNestedStyles(children, nodeData.children, className)
|
|
858
|
-
}
|
|
859
|
-
})
|
|
860
|
-
},
|
|
861
|
-
|
|
862
|
-
// 分离样式属性和子节点配置
|
|
863
|
-
separateStyleAndChildren (obj) {
|
|
864
|
-
const style = {}
|
|
865
|
-
const children = {}
|
|
866
|
-
|
|
867
|
-
Object.entries(obj).forEach(([key, value]) => {
|
|
868
|
-
if (key.startsWith('*')) {
|
|
869
|
-
// 子节点配置
|
|
870
|
-
children[key] = value
|
|
871
|
-
} else {
|
|
872
|
-
// 样式属性
|
|
873
|
-
style[key] = value
|
|
874
|
-
}
|
|
875
|
-
})
|
|
876
|
-
|
|
877
|
-
return { style, children }
|
|
878
|
-
},
|
|
879
|
-
|
|
880
|
-
// 应用组件样式
|
|
881
|
-
async applyComponentStyles (component, cell, cellIndex) {
|
|
882
|
-
if (!component || !component.$el) return
|
|
883
|
-
|
|
884
|
-
const { rootStyles, childStyles } = await this.parseComponentStyles(cell)
|
|
885
|
-
|
|
886
|
-
// 应用根节点样式
|
|
887
|
-
if (Object.keys(rootStyles).length > 0) {
|
|
888
|
-
Object.entries(rootStyles).forEach(([property, value]) => {
|
|
889
|
-
// 兼容 Ant Row gutter 在列上写入的行内 padding-left/right,
|
|
890
|
-
// 这里同时写入四个方向的长属性,确保覆盖。
|
|
891
|
-
if (property === 'padding') {
|
|
892
|
-
component.$el.style.setProperty('padding', value, 'important')
|
|
893
|
-
component.$el.style.setProperty('padding-left', value, 'important')
|
|
894
|
-
component.$el.style.setProperty('padding-right', value, 'important')
|
|
895
|
-
component.$el.style.setProperty('padding-top', value, 'important')
|
|
896
|
-
component.$el.style.setProperty('padding-bottom', value, 'important')
|
|
897
|
-
} else {
|
|
898
|
-
component.$el.style.setProperty(property, value, 'important')
|
|
899
|
-
}
|
|
900
|
-
})
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
// 如果没有子节点样式,直接返回
|
|
904
|
-
if (childStyles.size === 0) return
|
|
905
|
-
|
|
906
|
-
let retryCount = 0
|
|
907
|
-
const maxRetries = 5
|
|
908
|
-
const retryInterval = 100 // 100ms
|
|
909
|
-
|
|
910
|
-
const applyStyles = () => {
|
|
911
|
-
this.applyChildStylesOptimized(component.$el, childStyles)
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
// 首次应用样式
|
|
915
|
-
applyStyles()
|
|
916
|
-
|
|
917
|
-
// 创建重试机制
|
|
918
|
-
const retryApplyStyles = () => {
|
|
919
|
-
if (retryCount >= maxRetries) return
|
|
920
|
-
|
|
921
|
-
setTimeout(() => {
|
|
922
|
-
applyStyles()
|
|
923
|
-
retryCount++
|
|
924
|
-
retryApplyStyles()
|
|
925
|
-
}, retryInterval)
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
// 开始重试
|
|
929
|
-
retryApplyStyles()
|
|
930
|
-
|
|
931
|
-
// 创建 MutationObserver 用于动态内容
|
|
932
|
-
const observer = new MutationObserver((mutations) => {
|
|
933
|
-
// 检查是否有新增节点
|
|
934
|
-
const hasNewNodes = mutations.some(mutation =>
|
|
935
|
-
mutation.type === 'childList' && mutation.addedNodes.length > 0
|
|
936
|
-
)
|
|
937
|
-
const styleChanged = mutations.some(mutation =>
|
|
938
|
-
mutation.type === 'attributes' && mutation.attributeName === 'style'
|
|
939
|
-
)
|
|
940
|
-
|
|
941
|
-
if (hasNewNodes || styleChanged) {
|
|
942
|
-
// 重新应用根样式(处理 gutter 改写列 padding 的情况)
|
|
943
|
-
if (Object.keys(rootStyles).length > 0) {
|
|
944
|
-
Object.entries(rootStyles).forEach(([property, value]) => {
|
|
945
|
-
if (property === 'padding') {
|
|
946
|
-
component.$el.style.setProperty('padding', value, 'important')
|
|
947
|
-
component.$el.style.setProperty('padding-left', value, 'important')
|
|
948
|
-
component.$el.style.setProperty('padding-right', value, 'important')
|
|
949
|
-
component.$el.style.setProperty('padding-top', value, 'important')
|
|
950
|
-
component.$el.style.setProperty('padding-bottom', value, 'important')
|
|
951
|
-
} else {
|
|
952
|
-
component.$el.style.setProperty(property, value, 'important')
|
|
953
|
-
}
|
|
954
|
-
})
|
|
955
|
-
}
|
|
956
|
-
applyStyles()
|
|
957
|
-
}
|
|
958
|
-
})
|
|
959
|
-
|
|
960
|
-
// 配置 observer
|
|
961
|
-
observer.observe(component.$el, {
|
|
962
|
-
childList: true,
|
|
963
|
-
subtree: true,
|
|
964
|
-
attributes: true,
|
|
965
|
-
attributeFilter: ['style']
|
|
966
|
-
})
|
|
967
|
-
|
|
968
|
-
// 3秒后停止观察
|
|
969
|
-
// setTimeout(() => {
|
|
970
|
-
// observer.disconnect()
|
|
971
|
-
// }, 3000)
|
|
972
|
-
|
|
973
|
-
// 组件销毁时清理
|
|
974
|
-
this.$once('hook:beforeDestroy', () => {
|
|
975
|
-
observer.disconnect()
|
|
976
|
-
})
|
|
977
|
-
},
|
|
978
|
-
|
|
979
|
-
// 优化后的子节点样式应用方法
|
|
980
|
-
applyChildStylesOptimized (rootElement, styleMap, parentSelector = '') {
|
|
981
|
-
if (!rootElement) return
|
|
982
|
-
|
|
983
|
-
// 处理样式映射
|
|
984
|
-
try {
|
|
985
|
-
for (const [selector, data] of styleMap.entries()) {
|
|
986
|
-
const currentSelector = parentSelector ? `${parentSelector} ${selector}` : selector
|
|
987
|
-
|
|
988
|
-
try {
|
|
989
|
-
// 查找匹配的元素
|
|
990
|
-
const elements = Array.from(rootElement.querySelectorAll(currentSelector))
|
|
991
|
-
|
|
992
|
-
if (!elements.length) continue
|
|
993
|
-
|
|
994
|
-
// 应用当前层级样式
|
|
995
|
-
if (data.styles) {
|
|
996
|
-
elements.forEach(element => {
|
|
997
|
-
if (!element) return
|
|
998
|
-
|
|
999
|
-
// 应用每个样式属性
|
|
1000
|
-
Object.entries(data.styles).forEach(([property, value]) => {
|
|
1001
|
-
try {
|
|
1002
|
-
element.style.setProperty(property, value, 'important')
|
|
1003
|
-
} catch (err) {
|
|
1004
|
-
console.warn(`设置样式失败: ${property}=${value}`, err)
|
|
1005
|
-
}
|
|
1006
|
-
})
|
|
1007
|
-
})
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
// 处理子层级
|
|
1011
|
-
if (data.children && data.children.size > 0) {
|
|
1012
|
-
elements.forEach(element => {
|
|
1013
|
-
if (element) {
|
|
1014
|
-
this.applyChildStylesOptimized(element, data.children, currentSelector)
|
|
1015
|
-
}
|
|
1016
|
-
})
|
|
1017
|
-
}
|
|
1018
|
-
} catch (err) {
|
|
1019
|
-
console.warn(`处理选择器失败: ${currentSelector}`, err)
|
|
1020
|
-
continue
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
} catch (err) {}
|
|
1024
|
-
}
|
|
1025
|
-
},
|
|
1026
|
-
beforeMount () {
|
|
1027
|
-
if (this.useOssForImg) {
|
|
1028
|
-
this.uploadParams.resUploadMode = 'oss'
|
|
1029
|
-
}
|
|
1030
|
-
},
|
|
1031
|
-
mounted () {
|
|
1032
|
-
this.$nextTick(() => {
|
|
1033
|
-
if (this.allSlotSum === 0) this.$emit('slotsConfigEnded')
|
|
1034
|
-
// 挂载后注册快捷键
|
|
1035
|
-
this.registerShortcutsIfNeeded()
|
|
1036
|
-
})
|
|
1037
|
-
},
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
</script>
|
|
1041
|
-
|
|
1042
|
-
<style scoped lang="less">
|
|
1043
|
-
.inputsDiv {
|
|
1044
|
-
display: flex;
|
|
1045
|
-
justify-content: space-between;
|
|
1046
|
-
|
|
1047
|
-
.inputsDivItem {
|
|
1048
|
-
display: flex;
|
|
1049
|
-
align-items: center;
|
|
1050
|
-
padding: 0 4px;
|
|
1051
|
-
white-space: nowrap;
|
|
1052
|
-
|
|
1053
|
-
.inputsDivItemLabel {
|
|
1054
|
-
padding: 0 4px;
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
.tdNoBorder {
|
|
1060
|
-
border-left: 1px solid #000;
|
|
1061
|
-
border-right: 1px solid #000;
|
|
1062
|
-
padding: 8px;
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
.tdWithBorder {
|
|
1066
|
-
border: 1px solid #000;
|
|
1067
|
-
padding: 8px;
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
.tdWithNoTopBorder {
|
|
1071
|
-
border-top-style: none;
|
|
1072
|
-
border-left: 1px solid #000;
|
|
1073
|
-
border-right: 1px solid #000;
|
|
1074
|
-
border-bottom: 1px solid #000;
|
|
1075
|
-
padding: 8px;
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
.grid-content {
|
|
1079
|
-
border-radius: 4px;
|
|
1080
|
-
min-height: 36px;
|
|
1081
|
-
text-align: center;
|
|
1082
|
-
color: #fff;
|
|
1083
|
-
background-color: #606266;
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
.bg-purple {
|
|
1087
|
-
background: #9254de;
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
.bg-purple-light {
|
|
1091
|
-
background: #b37feb;
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
.flexItem {
|
|
1095
|
-
border-radius: 8px;
|
|
1096
|
-
height: 100%;
|
|
1097
|
-
:deep(.ant-card-body) {
|
|
1098
|
-
padding: 0 !important;
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
</style>
|