vue2-client 1.8.259 → 1.8.261

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.
Files changed (210) hide show
  1. package/.env +19 -19
  2. package/.eslintrc.js +90 -90
  3. package/CHANGELOG.md +824 -824
  4. package/Components.md +60 -60
  5. package/babel.config.js +21 -21
  6. package/docs/index.md +30 -30
  7. package/docs/lowcode.md +188 -188
  8. package/docs/lowcodeForDeveloper.md +200 -192
  9. package/index.js +31 -31
  10. package/jest-transform-stub.js +8 -8
  11. package/jest.config.js +21 -21
  12. package/jest.setup.js +7 -7
  13. package/package.json +95 -95
  14. package/public/index.html +27 -27
  15. package/src/App.vue +188 -188
  16. package/src/ReportView.js +19 -19
  17. package/src/assets/img/querySlotDemo.svg +15 -15
  18. package/src/assets/svg/badtwo.svg +1 -1
  19. package/src/assets/svg/goodtwo.svg +1 -1
  20. package/src/base-client/components/common/AMisRender/index.js +3 -3
  21. package/src/base-client/components/common/AMisRender/index.vue +263 -263
  22. package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +413 -413
  23. package/src/base-client/components/common/AddressSearchCombobox/demo.vue +36 -36
  24. package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +120 -120
  25. package/src/base-client/components/common/CitySelect/CitySelect.vue +348 -348
  26. package/src/base-client/components/common/CitySelect/index.js +3 -3
  27. package/src/base-client/components/common/CitySelect/index.md +109 -109
  28. package/src/base-client/components/common/CreateQuery/CreateQuery.vue +669 -669
  29. package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +1014 -1014
  30. package/src/base-client/components/common/CreateQuery/index.js +3 -3
  31. package/src/base-client/components/common/CreateQuery/index.md +42 -42
  32. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +452 -452
  33. package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQueryItem.vue +511 -511
  34. package/src/base-client/components/common/CreateSimpleFormQuery/index.js +3 -3
  35. package/src/base-client/components/common/CreateSimpleFormQuery/index.md +42 -42
  36. package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +149 -149
  37. package/src/base-client/components/common/FormGroupEdit/index.js +3 -3
  38. package/src/base-client/components/common/FormGroupEdit/index.md +43 -43
  39. package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +166 -166
  40. package/src/base-client/components/common/FormGroupQuery/index.js +3 -3
  41. package/src/base-client/components/common/FormGroupQuery/index.md +43 -43
  42. package/src/base-client/components/common/JSONToTree/jsontotree.vue +271 -271
  43. package/src/base-client/components/common/LowCodeComponent/LowCodePageOrganization.vue +394 -355
  44. package/src/base-client/components/common/LowCodePageRender/LowCodePageRender.vue +29 -29
  45. package/src/base-client/components/common/LowCodePageRender/editorPageRender.vue +533 -467
  46. package/src/base-client/components/common/LowCodePageRender/index.js +3 -3
  47. package/src/base-client/components/common/PersonSetting/PersonSetting.vue +208 -208
  48. package/src/base-client/components/common/PersonSetting/index.js +3 -3
  49. package/src/base-client/components/common/Tree/Tree.vue +149 -149
  50. package/src/base-client/components/common/Tree/index.js +2 -2
  51. package/src/base-client/components/common/Upload/Upload.vue +197 -197
  52. package/src/base-client/components/common/Upload/index.js +3 -3
  53. package/src/base-client/components/common/XAddForm/XAddForm.vue +98 -98
  54. package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +732 -732
  55. package/src/base-client/components/common/XAddNativeForm/index.md +146 -146
  56. package/src/base-client/components/common/XAddNativeForm/lowcodeEditorRegister.js +16 -12
  57. package/src/base-client/components/common/XAddNativeFormOA/XAddNativeFormOA.vue +303 -303
  58. package/src/base-client/components/common/XAddNativeFormOA/index.js +3 -3
  59. package/src/base-client/components/common/XAddNativeFormOA/index.md +146 -146
  60. package/src/base-client/components/common/XBadge/XBadge.vue +78 -78
  61. package/src/base-client/components/common/XCard/XCard.vue +64 -64
  62. package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +180 -180
  63. package/src/base-client/components/common/XDataDrawer/index.js +3 -3
  64. package/src/base-client/components/common/XDataDrawer/index.md +41 -41
  65. package/src/base-client/components/common/XDescriptions/XDescriptions.vue +167 -167
  66. package/src/base-client/components/common/XDescriptions/XDescriptionsGroup.vue +299 -299
  67. package/src/base-client/components/common/XDescriptions/demo.vue +50 -50
  68. package/src/base-client/components/common/XDescriptions/index.js +3 -3
  69. package/src/base-client/components/common/XDescriptions/index.md +83 -83
  70. package/src/base-client/components/common/XDescriptions/lowcodeEditorRegister.js +15 -5
  71. package/src/base-client/components/common/XDetailsView/XDetailsView.vue +214 -214
  72. package/src/base-client/components/common/XDetailsView/index.js +3 -3
  73. package/src/base-client/components/common/XForm/XForm.vue +281 -281
  74. package/src/base-client/components/common/XForm/XFormItem.vue +807 -807
  75. package/src/base-client/components/common/XForm/XTreeSelect.vue +206 -206
  76. package/src/base-client/components/common/XForm/index.md +178 -178
  77. package/src/base-client/components/common/XFormCol/XFormCol.vue +36 -36
  78. package/src/base-client/components/common/XFormGroup/XFormGroup.vue +241 -241
  79. package/src/base-client/components/common/XFormGroup/demo.vue +40 -40
  80. package/src/base-client/components/common/XFormGroup/index.js +3 -3
  81. package/src/base-client/components/common/XFormGroup/index.md +38 -38
  82. package/src/base-client/components/common/XFormGroupDetails/XFormGroupDetails.vue +72 -72
  83. package/src/base-client/components/common/XFormGroupDetails/index.js +3 -3
  84. package/src/base-client/components/common/XFormTable/XFormTable.vue +519 -519
  85. package/src/base-client/components/common/XFormTable/index.md +98 -98
  86. package/src/base-client/components/common/XFormTable/lowcodeEditorRegister.js +16 -12
  87. package/src/base-client/components/common/XImportExcel/XImportExcel.vue +147 -147
  88. package/src/base-client/components/common/XReport/XReport.vue +843 -843
  89. package/src/base-client/components/common/XReport/XReportDemo.vue +2233 -2233
  90. package/src/base-client/components/common/XReport/XReportDesign.vue +470 -470
  91. package/src/base-client/components/common/XReport/XReportJsonRender.vue +267 -267
  92. package/src/base-client/components/common/XReport/XReportTrGroup.vue +745 -742
  93. package/src/base-client/components/common/XReport/index.js +3 -3
  94. package/src/base-client/components/common/XReport/index.md +44 -44
  95. package/src/base-client/components/common/XReportSlot/XReportSlot.vue +110 -110
  96. package/src/base-client/components/common/XReportSlot/index.js +3 -3
  97. package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
  98. package/src/base-client/components/common/XStepView/index.js +3 -3
  99. package/src/base-client/components/common/XStepView/index.md +31 -31
  100. package/src/base-client/components/common/XTable/XTable.vue +636 -636
  101. package/src/base-client/components/common/XTable/index.md +255 -255
  102. package/src/base-client/components/common/XTree/XTree.vue +318 -318
  103. package/src/base-client/components/common/XTree/index.js +3 -3
  104. package/src/base-client/components/common/XTree/index.md +36 -36
  105. package/src/base-client/components/common/XTreeOne/XTreeOne.vue +114 -114
  106. package/src/base-client/components/common/XTreeOne/lowcodeEditorRegister.js +11 -9
  107. package/src/base-client/components/index.js +51 -51
  108. package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +232 -232
  109. package/src/base-client/components/system/QueryParamsDetailsView/QueryParamsDetailsView.vue +281 -281
  110. package/src/base-client/plugins/AppData.js +115 -115
  111. package/src/base-client/plugins/Config.js +19 -19
  112. package/src/base-client/plugins/GetLoginInfoService.js +183 -183
  113. package/src/base-client/plugins/tabs-page-plugin.js +39 -39
  114. package/src/bootstrap.js +39 -39
  115. package/src/components/CodeMirror/inedx.vue +118 -118
  116. package/src/components/CodeMirror/setting.js +40 -40
  117. package/src/components/FilePreview/FilePreview.vue +166 -166
  118. package/src/components/NumberInfo/NumberInfo.vue +54 -54
  119. package/src/components/STable/index.js +323 -323
  120. package/src/components/checkbox/ColorCheckbox.vue +157 -157
  121. package/src/components/checkbox/ImgCheckbox.vue +163 -163
  122. package/src/components/menu/SideMenu.vue +75 -75
  123. package/src/components/menu/menu.js +273 -273
  124. package/src/components/tool/AStepItem.vue +60 -60
  125. package/src/config/CreateQueryConfig.js +322 -322
  126. package/src/config/default/antd.config.js +89 -89
  127. package/src/config/default/setting.config.js +55 -55
  128. package/src/font-style/font.css +4 -4
  129. package/src/layouts/CommonLayout.vue +56 -56
  130. package/src/layouts/PageLayout.vue +151 -151
  131. package/src/layouts/SinglePageView.vue +138 -138
  132. package/src/layouts/header/AdminHeader.vue +132 -132
  133. package/src/layouts/header/HeaderNotice.vue +177 -177
  134. package/src/layouts/tabs/TabsHead.vue +189 -189
  135. package/src/layouts/tabs/TabsView.vue +387 -387
  136. package/src/lib.js +1 -1
  137. package/src/main.js +26 -26
  138. package/src/mock/extend/index.js +84 -84
  139. package/src/mock/goods/index.js +108 -108
  140. package/src/pages/AMisDemo/AMisDemo.vue +325 -325
  141. package/src/pages/AMisDemo/AMisDemo2.vue +74 -74
  142. package/src/pages/DynamicStatistics/ChartSelector.vue +331 -331
  143. package/src/pages/DynamicStatistics/DataTabs.vue +83 -83
  144. package/src/pages/DynamicStatistics/DynamicTable.vue +128 -128
  145. package/src/pages/DynamicStatistics/EvaluationArea.vue +69 -69
  146. package/src/pages/DynamicStatistics/FavoriteList.vue +51 -51
  147. package/src/pages/DynamicStatistics/QuestionHistoryAndFavorites.vue +591 -591
  148. package/src/pages/DynamicStatistics/SearchBar.vue +192 -192
  149. package/src/pages/DynamicStatistics/index.vue +282 -282
  150. package/src/pages/Example/index.vue +32 -32
  151. package/src/pages/NewDynamicStatistics/ChartSelector.vue +331 -331
  152. package/src/pages/NewDynamicStatistics/DataTabs.vue +122 -122
  153. package/src/pages/NewDynamicStatistics/DynamicTable.vue +128 -128
  154. package/src/pages/NewDynamicStatistics/EvaluationArea.vue +69 -69
  155. package/src/pages/NewDynamicStatistics/FavoriteList.vue +51 -51
  156. package/src/pages/NewDynamicStatistics/QuestionHistoryAndFavorites.vue +289 -289
  157. package/src/pages/NewDynamicStatistics/SearchBar.vue +193 -193
  158. package/src/pages/NewDynamicStatistics/index.vue +258 -258
  159. package/src/pages/ServiceReview/index.vue +284 -284
  160. package/src/pages/XReportView/index.vue +62 -62
  161. package/src/pages/login/Login.vue +378 -378
  162. package/src/pages/login/LoginV3.vue +389 -389
  163. package/src/pages/lowCode/lowCodeEditor.vue +1501 -1285
  164. package/src/pages/lowCode/lowCodeRender.vue +39 -39
  165. package/src/pages/resourceManage/orgListManage.vue +98 -98
  166. package/src/pages/system/dictionary/index.vue +44 -44
  167. package/src/pages/system/monitor/loginInfor/index.vue +37 -37
  168. package/src/pages/system/monitor/operLog/index.vue +37 -37
  169. package/src/pages/system/settings/modifyPassword.vue +117 -117
  170. package/src/pages/system/ticket/index.vue +480 -480
  171. package/src/pages/system/ticket/submitTicketSuccess.vue +484 -484
  172. package/src/router/async/config.async.js +33 -33
  173. package/src/router/async/router.map.js +107 -107
  174. package/src/router/guards.js +220 -220
  175. package/src/router/index.js +27 -27
  176. package/src/router.js +19 -19
  177. package/src/services/api/TicketDetailsViewApi.js +46 -46
  178. package/src/services/api/cas.js +79 -79
  179. package/src/services/api/common.js +284 -284
  180. package/src/services/api/entity.js +18 -18
  181. package/src/services/api/index.js +17 -17
  182. package/src/services/api/restTools.js +46 -46
  183. package/src/services/apiService.js +14 -14
  184. package/src/services/user.js +71 -71
  185. package/src/store/modules/setting.js +119 -119
  186. package/src/theme/default/style.less +57 -57
  187. package/src/theme/global.less +130 -130
  188. package/src/utils/authority-utils.js +85 -85
  189. package/src/utils/errorCode.js +6 -6
  190. package/src/utils/htmlToPDF.js +108 -108
  191. package/src/utils/htmlToPDFApi.js +5 -5
  192. package/src/utils/indexedDB.js +201 -201
  193. package/src/utils/login.js +144 -144
  194. package/src/utils/lowcode/lowcodeComponentMixin.js +112 -78
  195. package/src/utils/lowcode/lowcodeLog.js +29 -29
  196. package/src/utils/lowcode/lowcodeUtils.js +276 -129
  197. package/src/utils/lowcode/registerComponentForEditor.js +11 -11
  198. package/src/utils/lowcode/registerComponentForRender.js +11 -11
  199. package/src/utils/map-utils.js +47 -47
  200. package/src/utils/reg.js +19 -19
  201. package/src/utils/request.js +343 -343
  202. package/src/utils/routerUtil.js +435 -435
  203. package/src/utils/runEvalFunction.js +6 -6
  204. package/src/utils/util.js +241 -241
  205. package/src/utils/waterMark.js +31 -31
  206. package/test/Amis.spec.js +163 -163
  207. package/test/Tree.spec.js +167 -167
  208. package/test/myDialog.spec.js +46 -46
  209. package/vue.config.js +177 -177
  210. package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -15
@@ -1,1285 +1,1501 @@
1
- <template>
2
- <div>
3
- <!-- 标题 -->
4
- <a-card>
5
- <a-page-header
6
- title="奥枫低代码前端编辑器"
7
- sub-title="af-lowcode"
8
- :backIcon="false"
9
- @back="() => null"
10
- >
11
- <template slot="extra">
12
- <a-button @click="test">测试</a-button>
13
- <a-button @click="editModeActive">编辑</a-button>
14
- <a-button @click="previewModeActive">预览</a-button>
15
- <a-button type="primary" @click="exportConfig">导出</a-button>
16
- </template>
17
- </a-page-header>
18
- </a-card>
19
- <!-- 预览模式 -->
20
- <a-card v-if="preview">
21
- <editor-page-render :page-config="config" :edit-mode="false"/>
22
- </a-card>
23
- <!-- 编辑模式 -->
24
- <div v-show="!preview">
25
- <a-row :gutter="2">
26
- <!-- 左侧 -->
27
- <a-col :span="4">
28
- <!-- UI库 -->
29
- <a-card style="margin-bottom: 5%">
30
- <a-page-header
31
- title="UI库"
32
- sub-title="在此选择基础组件"
33
- :backIcon="false"
34
- @back="() => null"
35
- />
36
- <!-- 所有组件 -->
37
- <a-card-grid class="ui-item" @click="addContainer">
38
- 组件容器
39
- </a-card-grid>
40
- <template v-for="(item, index) in getRegisteredComponents()">
41
- <a-card-grid :key="index" class="ui-item" @click="addComponentToContainer(item)">
42
- {{ item }}
43
- </a-card-grid>
44
- </template>
45
- </a-card>
46
- </a-col>
47
- <!-- 中间主体编辑器 -->
48
- <a-col :span="15">
49
- <a-card>
50
- <!-- 切换显示的组件 -->
51
- <div style="margin-bottom: 3%">
52
- <a-menu v-model="mainPageMenu" mode="horizontal" @click="handleMainPageMenuChange">
53
- <template v-for="(page) in config.page">
54
- <a-menu-item :key="page.id">{{ page.title + '(' + determinePageType(page.type) + ')' }}</a-menu-item>
55
- </template>
56
- </a-menu>
57
- </div>
58
- <!-- 渲染器 -->
59
- <div v-if="activeMainPageType === 'page'">
60
- <editor-page-render
61
- v-if="renderPreview"
62
- @spanDrag="handleDrag"
63
- @containerDelete="handleContainerDelete"
64
- @clickComponentInEditor="clickComponentInEditor"
65
- :page-config="{ data: config.data, page: config.page.filter(page => page.id === activeMainPage)}"/>
66
- <a-skeleton v-else/>
67
- </div>
68
- <div v-if="activeMainPageType === 'modal'">
69
- <editor-page-render
70
- v-if="renderModalPreview"
71
- @spanDrag="handleDrag"
72
- @containerDelete="handleContainerDelete"
73
- @clickComponentInEditor="clickComponentInEditor"
74
- :page-config="{ data: config.data, page: config.page.filter(page => page.id === activeMainPage)}"/>
75
- <a-skeleton v-else/>
76
- </div>
77
- <div v-if="activeMainPageType === 'draw'">
78
- <editor-page-render
79
- v-if="renderDrawPreview"
80
- @spanDrag="handleDrag"
81
- @containerDelete="handleContainerDelete"
82
- @clickComponentInEditor="clickComponentInEditor"
83
- :page-config="{ data: config.data, page: config.page.filter(page => page.id === activeMainPage)}"/>
84
- <a-skeleton v-else/>
85
- </div>
86
- </a-card>
87
- </a-col>
88
- <!-- 右侧 -->
89
- <a-col :span="5">
90
- <!-- 页面架构 -->
91
- <a-card style="margin-bottom: 3%">
92
- <a-page-header
93
- title="架构"
94
- sub-title="页面的组织架构"
95
- :backIcon="false"
96
- @back="() => null"
97
- />
98
- <LowCodePageOrganization
99
- :config="config"
100
- v-if="showPageOrganization"
101
- @pasteItem="handlePasteItem"
102
- @componentMove="handleTreeDrag"
103
- @deleteComponent="deleteComponentInTree"
104
- @treeOrganizationClick="treeOrganizationClick"
105
- @addComponent="handleAddComponent"/>
106
- </a-card>
107
- <!-- 属性编辑 -->
108
- <a-card>
109
- <template v-if="editorPropertiesConfig === 'unregistered'">
110
- <p>所选组件并未注册</p>
111
- </template>
112
- <template v-else>
113
- <!-- 组件ID -->
114
- <div v-if="editorPropertiesConfig.id">
115
- <a-statistic title="组件ID" :value="editorPropertiesConfig.id" valueStyle="font-size: 1.2em"/>
116
- </div>
117
- <!-- 切换 -->
118
- <a-menu v-model="editorPanelCurrent" mode="horizontal" @click="() => null">
119
- <a-menu-item key="properties">属性</a-menu-item>
120
- <a-menu-item key="events">事件</a-menu-item>
121
- </a-menu>
122
- <!-- 属性编辑 -->
123
- <div v-if="editorPanelCurrent[0] === 'properties'">
124
- <div v-if="editorPropertiesConfig.props !== undefined">
125
- <div>
126
- 栅格数:<a-input :default-value="editorPropertiesConfig.span" @change="changeSpan"/>
127
- </div>
128
- <template v-for="(value,key) in editorPropertiesConfig.props">
129
- <div :key="editorPropertiesConfig.id + '_' + key">
130
- {{ key }}:<a-input :default-value="value" @change="editorPropertiesInputChange($event, key)"/>
131
- </div>
132
- </template>
133
- </div>
134
- <p v-else>您未选择任何组件</p>
135
- </div>
136
- <!-- 事件编辑 -->
137
- <div v-else-if="editorPanelCurrent[0] === 'events'">
138
- <template v-if="editorPropertiesConfig.onEvent !== undefined">
139
- <a-collapse v-model="eventCollapseActive">
140
- <a-collapse-panel
141
- v-for="(eventConfig,eventType) in editorPropertiesConfig.onEvent"
142
- :key="eventType"
143
- :header="eventType">
144
- <div v-for="(singleEvent,singleEventIndex) in eventConfig" :key="singleEventIndex" class="singleEvent">
145
- <p>
146
- <span style="color:rgb( 24,144,255)">{{ singleEvent.eventType }}</span>
147
- 事件
148
- </p>
149
- <!-- 事件 编辑/删除 按钮 -->
150
- <div style="display: flex; justify-content: space-evenly">
151
- <a-icon type="edit" theme="twoTone" class="edit_icon" @click="editEventIconClick(eventType,singleEventIndex)"/>
152
- <a-popconfirm title="确认删除" ok-text="确认删除" cancel-text="取消" @confirm="removeEventClick(eventType,singleEventIndex)" @cancel="() => null">
153
- <a-icon type="delete" theme="twoTone" class="edit_icon"/>
154
- </a-popconfirm>
155
- </div>
156
- </div>
157
- </a-collapse-panel>
158
- </a-collapse>
159
- </template>
160
- <a-button v-if="editorPropertiesConfig.id !== undefined" @click="addEvent">添加事件</a-button>
161
- <p v-else>您未选择任何组件</p>
162
- </div>
163
- </template>
164
- </a-card>
165
- </a-col>
166
- </a-row>
167
- </div>
168
- <!-- 自定义事件弹框 -->
169
- <a-modal
170
- title="事件编辑器"
171
- width="60%"
172
- :z-index="1001"
173
- :destroyOnClose="true"
174
- @ok="handleEventEditorOk"
175
- @cancel="handleEventEditorCancel"
176
- v-if="showEventEditor"
177
- :visible="showEventEditor">
178
- <a-form :label-col="{ span: 6 }" :wrapper-col="{ span: 14 }">
179
- <!-- 事件触发类型 -->
180
- <a-form-item label="事件触发类型">
181
- <a-select @change="handleEventEditorTypeChange" :default-value="eventEditorContent.emitType">
182
- <a-select-option
183
- v-for="(eventType, eventTypeIndex) in editorPropertiesConfig.selfEvent"
184
- :key="eventTypeIndex"
185
- :value="eventType">
186
- {{ eventType }}
187
- </a-select-option>
188
- <a-select-option value="customEmitType">
189
- 自定义触发类型
190
- </a-select-option>
191
- </a-select>
192
- </a-form-item>
193
- <!-- 自定义事件触发类型 -->
194
- <a-form-item label="自定义事件触发名" v-if="eventEditorContent.emitType === 'customEmitType'">
195
- <a-input v-model="eventEditorContent.customEmitType"/>
196
- </a-form-item>
197
- <!-- 事件类型 -->
198
- <a-form-item label="事件类型">
199
- <a-select @change="handleEventEditorEventTypeChange" :default-value="eventEditorContent.eventType">
200
- <a-select-option value="changeValue">
201
- 修改组件的值
202
- </a-select-option>
203
- <a-select-option value="changeProps">
204
- 修改组件的Props
205
- </a-select-option>
206
- <a-select-option value="runLogic">
207
- 执行Logic
208
- </a-select-option>
209
- <a-select-option value="log">
210
- 打印日志
211
- </a-select-option>
212
- <a-select-option value="showModal" v-if="this.config.page.filter(page => page.type === 'modal').length > 0">
213
- 修改弹框可见
214
- </a-select-option>
215
- <a-select-option value="showDraw" v-if="this.config.page.filter(page => page.type === 'draw').length > 0">
216
- 修改抽屉可见
217
- </a-select-option>
218
- </a-select>
219
- </a-form-item>
220
- <!-- 修改弹框可见 or 修改抽屉可见 -->
221
- <a-form-item label="修改可见" v-if="eventEditorContent.eventType === 'showModal' || eventEditorContent.eventType === 'showDraw'">
222
- <a-radio-group v-model="eventEditorContent.visible" button-style="solid">
223
- <a-radio-button value="open">
224
- 显示
225
- </a-radio-button>
226
- <a-radio-button value="close">
227
- 隐藏
228
- </a-radio-button>
229
- </a-radio-group>
230
- </a-form-item>
231
- <!-- 弹框容器ID -->
232
- <a-form-item label="弹框容器ID" v-if="eventEditorContent.eventType === 'showModal'">
233
- <a-select v-model="eventEditorContent.containerId">
234
- <a-select-option
235
- v-for="(modal) in config.page.filter(page => page.type === 'modal')"
236
- :key="modal.id"
237
- :value="modal.id">
238
- 弹框_{{ modal.id }}
239
- </a-select-option>
240
- </a-select>
241
- </a-form-item>
242
- <!-- 抽屉容器ID -->
243
- <a-form-item label="弹框容器ID" v-if="eventEditorContent.eventType === 'showDraw'">
244
- <a-select v-model="eventEditorContent.containerId">
245
- <a-select-option
246
- v-for="(draw) in config.page.filter(page => page.type === 'draw')"
247
- :key="draw.id"
248
- :value="draw.id">
249
- 抽屉_{{ draw.id }}
250
- </a-select-option>
251
- </a-select>
252
- </a-form-item>
253
- <!-- Logic名 -->
254
- <a-form-item label="Logic名" v-if="eventEditorContent.eventType === 'runLogic'">
255
- <a-input v-model="eventEditorContent.logicName"/>
256
- </a-form-item>
257
- <!-- 服务名 -->
258
- <a-form-item label="服务名" v-if="eventEditorContent.eventType === 'runLogic'">
259
- <a-input v-model="eventEditorContent.serviceName"/>
260
- </a-form-item>
261
- <!-- 自定义Logic参数,由哪些组件传递 -->
262
- <a-form-item label="Logic参数取值组件" v-if="eventEditorContent.eventType === 'runLogic'">
263
- <a-transfer
264
- :data-source="logicParamTransferDataSource"
265
- :render="item => item.title"
266
- :target-keys="eventEditorContent.logicParamTransfer"
267
- @change="handleLogicParamTransferChange"/>
268
- </a-form-item>
269
- <!-- 自定义Logic参数 -->
270
- <a-form-item label="自定义Logic参数" v-if="eventEditorContent.eventType === 'runLogic'">
271
- <a-button type="primary" @click="openLogicParamJSEditor">
272
- 打开编辑器
273
- </a-button>
274
- </a-form-item>
275
- <!-- 自定义Logic回调 -->
276
- <a-form-item label="自定义Logic回调" v-if="eventEditorContent.eventType === 'runLogic'" >
277
- <a-button type="primary" @click="openLogicCallbackEditor">
278
- 打开编辑器
279
- </a-button>
280
- </a-form-item>
281
- <!-- 修改组件的值 才会显示的其余参数 -->
282
- <template v-if="eventEditorContent.eventType === 'changeValue' || eventEditorContent.eventType === 'changeProps'">
283
- <!-- 目标组件 -->
284
- <a-form-item label="目标组件">
285
- <a-select @change="handleEventEditorTargetChange" :default-value="eventEditorContent.target">
286
- <a-select-option
287
- v-for="(targetId, targetIndex) in getAllRenderedComponents()"
288
- :key="targetIndex"
289
- :value="targetId">
290
- {{ targetId }}
291
- </a-select-option>
292
- </a-select>
293
- </a-form-item>
294
- <!-- 目标组件执行事件名 -->
295
- <a-form-item label="目标组件执行事件名" v-if="eventEditorContent.eventName === 'changeValue'">
296
- <a-select @change="handleEventEditorTargetEventTypeChange" :default-value="eventEditorContent.eventName">
297
- <a-select-option :value="eventType" v-for="(eventType,eventTypeIndex) in supportedEventType" :key="'eventType_' + eventTypeIndex">
298
- {{ eventType }}
299
- </a-select-option>
300
- </a-select>
301
- </a-form-item>
302
- <!-- 目标组件修改值对应的key -->
303
- <a-form-item label="目标组件修改值对应的key" v-if="eventEditorContent.target !== undefined">
304
- <a-input v-model="eventEditorContent.targetKey"/>
305
- </a-form-item>
306
- </template>
307
- <!-- 自定义JS方法 -->
308
- <a-form-item label="自定义JS方法">
309
- <a-button type="primary" @click="openEventJSEditor">打开编辑器</a-button>
310
- </a-form-item>
311
- </a-form>
312
- </a-modal>
313
- <!-- 自定义JS事件弹框 -->
314
- <a-modal
315
- title="事件编辑器"
316
- width="60%"
317
- :destroyOnClose="true"
318
- :z-index="1002"
319
- @ok="handleJSEventEditorOk"
320
- @cancel="handleJSEventEditorCancel"
321
- :visible="showJSEventEditor">
322
- <a-popover title="参数说明" style="margin-right: 5%">
323
- <template slot="content">
324
- <p>该方法有以下几个参数:</p>
325
- <p>eventType:事件类型,比如:changeValue代表修改目标组件的值</p>
326
- <p>data:由事件源发出的参数列表</p>
327
- <p>targetKey:修改目标组件值所对应的key</p>
328
- <p>sourceVM:事件源的vue对象</p>
329
- <p>targetVM:目标的vue对象</p>
330
- </template>
331
- <a-button type="primary">
332
- 参数说明
333
- </a-button>
334
- </a-popover>
335
- <a-popover title="返回值说明" style="margin-bottom: 5%">
336
- <template slot="content">
337
- <p>该方法需要的返回值:</p>
338
- <p>eventType:事件类型</p>
339
- <p>data:传递给目标组件的数据</p>
340
- <p>targetKey:修改目标组件值所对应的key</p>
341
- </template>
342
- <a-button type="primary">
343
- 返回值说明
344
- </a-button>
345
- </a-popover>
346
- <code-mirror
347
- :style-obj="{height:'80%',fontSize:'18px',marginBottom:'15px'}"
348
- :mode="'javascript'"
349
- :theme="'monokai'"
350
- v-model="eventEditorContent.JSFunction"
351
- :value="eventEditorContent.JSFunction"/>
352
- </a-modal>
353
- <!-- 自定义Logic参数JS弹框 -->
354
- <a-modal
355
- title="自定义Logic参数JS编辑器"
356
- width="60%"
357
- :destroyOnClose="true"
358
- :z-index="1002"
359
- @ok="() => { showLogicParamJSEditor = false}"
360
- @cancel="() => { showLogicParamJSEditor = false}"
361
- :visible="showLogicParamJSEditor">
362
- <a-popover title="参数说明" style="margin-right: 5%">
363
- <template slot="content">
364
- <p>该方法有以下几个参数:</p>
365
- <p>componentData:Logic参数取值组件中选中的组件,将会把数据打包存在此对象中,key则为组件的id</p>
366
- <p>data:由事件源emit发出的参数</p>
367
- </template>
368
- <a-button type="primary">
369
- 参数说明
370
- </a-button>
371
- </a-popover>
372
- <a-popover title="返回值说明" style="margin-bottom: 5%">
373
- <template slot="content">
374
- <p>该方法需要一个JSON类型的返回值</p>
375
- <p>该返回值就是传递给Logic执行的参数</p>
376
- </template>
377
- <a-button type="primary">
378
- 返回值说明
379
- </a-button>
380
- </a-popover>
381
- <code-mirror
382
- :style-obj="{height:'80%',fontSize:'18px',marginBottom:'15px'}"
383
- :mode="'javascript'"
384
- :theme="'monokai'"
385
- v-model="eventEditorContent.logicParamJSFunction"
386
- :value="eventEditorContent.logicParamJSFunction"/>
387
- </a-modal>
388
- <!-- 自定义Logic回调弹框 -->
389
- <a-modal
390
- title="事件编辑器"
391
- width="60%"
392
- :destroyOnClose="true"
393
- :z-index="1002"
394
- @ok="() => { showLogicCallBackEditor = false}"
395
- @cancel="() => { showLogicCallBackEditor = false}"
396
- :visible="showLogicCallBackEditor">
397
- <a-popover title="参数说明" style="margin-bottom: 5%">
398
- <template slot="content">
399
- <p>该方法有以下几个参数:</p>
400
- <p>componentsMap:所有组件注册的Map</p>
401
- <p>responseData:后端的返回值</p>
402
- </template>
403
- <a-button type="primary">
404
- 参数说明
405
- </a-button>
406
- </a-popover>
407
- <code-mirror
408
- :style-obj="{height:'80%',fontSize:'18px',marginBottom:'15px'}"
409
- :mode="'javascript'"
410
- :theme="'monokai'"
411
- v-model="eventEditorContent.logicCallBackFunction"
412
- :value="eventEditorContent.logicCallBackFunction"/>
413
- </a-modal>
414
- </div>
415
- </template>
416
-
417
- <script>
418
- import editorPageRender from '@vue2-client/base-client/components/common/LowCodePageRender/editorPageRender.vue'
419
- import * as registeredRender from '@vue2-client/utils/lowcode/registerComponentForRender'
420
- import * as lowcodeUtils from '@vue2-client/utils/lowcode/lowcodeUtils'
421
- import codeMirror from '@vue2-client/components/CodeMirror/inedx.vue'
422
- import { nanoid } from 'nanoid'
423
- import lowcodeComponentMixin from '@vue2-client/utils/lowcode/lowcodeComponentMixin'
424
- // eslint-disable-next-line no-unused-vars
425
- import lowcodeLog from '@vue2-client/utils/lowcode/lowcodeLog'
426
- import LowCodePageOrganization from '@vue2-client/base-client/components/common/LowCodeComponent/LowCodePageOrganization.vue'
427
-
428
- // 函数编辑器显示的模板
429
- const JSEventFunctionTemplate = 'function(eventType, data, targetKey, sourceVM, targetVM) {\n \n return {\n "eventType": eventType,\n "data": data,\n "targetKey": targetKey\n }\n}'
430
- const LogicParamFunctionTemplate = 'function(componentData, data) {\n \n return {\n \n }\n}'
431
- const LogicCallBackFunctionTemplate = 'function(componentsMap, responseData) {\n \n}'
432
-
433
- export default {
434
- components: {
435
- LowCodePageOrganization,
436
- editorPageRender,
437
- codeMirror
438
- },
439
- props: {
440
- // 页面原始的配置,用于从琉璃中读取
441
- originalConfig: {
442
- type: Object,
443
- default: () => {
444
- return {
445
- page: []
446
- }
447
- }
448
- }
449
- },
450
- data () {
451
- return {
452
- // 主体窗口选择的标签
453
- mainPageMenu: ['none'],
454
- // 默认的配置
455
- config: { page: [] },
456
- // 选中的容器
457
- targetContainer: undefined,
458
- // 控制是否渲染页面
459
- preview: false,
460
- // 控制架构树显隐,用于刷新组件
461
- showPageOrganization: true,
462
- // 用于保存右侧编辑组件的属性
463
- editorPropertiesConfig: {},
464
- // 编辑属性时用到的定时器
465
- inputTimeout: undefined,
466
- // 当前激活的是组件事件中哪一类触发属性,对应事件编辑中的手风琴面板
467
- eventCollapseActive: undefined,
468
- // 控制事件编辑器弹框显隐
469
- showEventEditor: false,
470
- // 控制自定义JS函数弹框显隐
471
- showJSEventEditor: false,
472
- // 控制页面显隐,用于属性面板编辑后,触发页面更新
473
- renderPreview: true,
474
- // 控制弹框显隐,用于属性面板编辑后,触发页面更新
475
- renderModalPreview: true,
476
- // 控制抽屉显隐,用于属性面板编辑后,触发页面更新
477
- renderDrawPreview: true,
478
- // 控制右侧编辑器切换标签页
479
- editorPanelCurrent: ['properties'],
480
- // 事件编辑内容的缓存
481
- eventEditorContent: {},
482
- // 用于事件编辑的回显,在点击事件编辑按钮后,会将此变量赋值
483
- eventEditorCurrent: undefined,
484
- // 保存目标组件可以触发哪些事件
485
- supportedEventType: undefined,
486
- // 控制自定义Logic参数自定义JS函数弹框显隐
487
- showLogicParamJSEditor: false,
488
- // 控制自定义Logic回调弹框显隐
489
- showLogicCallBackEditor: false,
490
- // 保存主体中,当前激活的标签栏ID
491
- activeMainPage: undefined,
492
- // 保存主体中,当前激活的标签栏类型
493
- activeMainPageType: undefined,
494
- // 定义Logic参数从哪些组件获取
495
- logicParamTransferDataSource: []
496
- }
497
- },
498
- provide () {
499
- return {
500
- // 将注册的组件传递给子组件
501
- componentsMap: {}
502
- }
503
- },
504
- methods: {
505
- // 复制粘贴组件
506
- handlePasteItem (id, copyCache, type) {
507
- const target = lowcodeUtils.getConfig(id, this.config)
508
- // 页面中插入行
509
- if (type === 'page-row') {
510
- const content = copyCache.content
511
- const contentKeys = Object.keys(content)
512
- const result = []
513
- contentKeys.forEach(key => {
514
- result.push(content[key])
515
- })
516
- target.body.push(result)
517
- } else if (type === 'row-item') {
518
- // 行中插入组件
519
- target.push(copyCache.content)
520
- } else if (type === 'page') {
521
- // 复制页面
522
- this.config.page.push(copyCache)
523
- this.$message.success('复制成功!')
524
- }
525
- this.refreshOrganization()
526
- },
527
- // span属性通过input框修改
528
- changeSpan (event) {
529
- this.editorPropertiesConfig.span = event.target.value
530
- },
531
- // logic从组件中取值穿梭框改变事件
532
- handleLogicParamTransferChange (targetKeys, direction, moveKeys) {
533
- this.eventEditorContent.logicParamTransfer = targetKeys
534
- this.$forceUpdate()
535
- },
536
- // 点击架构树
537
- treeOrganizationClick (id, type) {
538
- // 如果类型是page证明,选中的是最外层容器
539
- if (type === 'page') {
540
- this.mainPageMenu[0] = id
541
- this.activeMainPage = id
542
- for (let i = 0; i < this.config.page.length; i++) {
543
- if (this.config.page[i].id === this.activeMainPage) {
544
- this.activeMainPageType = this.config.page[i].type
545
- break
546
- }
547
- }
548
- this.$forceUpdate()
549
- } else if (type === 'component') {
550
- this.config.page.forEach(page => {
551
- page.body.forEach(row => {
552
- row.forEach(item => {
553
- if (item.id === id) {
554
- this.mainPageMenu[0] = page.id
555
- this.activeMainPage = page.id
556
- this.activeMainPageType = page.type
557
- this.$forceUpdate()
558
- }
559
- })
560
- })
561
- })
562
- // 将组件选中
563
- const target = lowcodeUtils.getComponentConfig(id, this.config)
564
- this.clickComponentInEditor(target)
565
- }
566
- },
567
- // 架构树拖拽事件
568
- handleTreeDrag (dragKey, dropKey, dropLevel, dropPosition) {
569
- let dragElement
570
- // 如果被拖拽的id小于等于5位则为行
571
- if (dragKey.length <= 5) {
572
- const targetPageId = dragKey.split('_')[0]
573
- const targetRowId = dragKey.split('_')[1] - 1
574
- for (let i = 0; i < this.config.page.length; i++) {
575
- const page = this.config.page[i]
576
- if (page.id === targetPageId) {
577
- dragElement = page.body[targetRowId]
578
- }
579
- }
580
- this.deleteRow(dragKey)
581
- } else {
582
- // 组件的拖拽
583
- dragElement = JSON.parse(JSON.stringify(lowcodeUtils.getComponentConfig(dragKey, this.config)))
584
- this.deleteComponent(dragKey, false)
585
- }
586
-
587
- // position有三种状态,-1表示在目标前,0表示插入,1表示在目标之后
588
- if (dropPosition === 0) {
589
- const target = lowcodeUtils.getComponentConfig(dropKey, this.config)
590
- target.unshift(dragElement)
591
- this.refreshOrganization()
592
- this.$forceUpdate()
593
- } else {
594
- // 如果目标是一行
595
- if (dropLevel === 'row') {
596
- const targetPageId = dropKey.split('_')[0]
597
- const targetRowId = dropKey.split('_')[1] - 1
598
- for (let i = 0; i < this.config.page.length; i++) {
599
- const page = this.config.page[i]
600
- if (page.id === targetPageId) {
601
- if (dropPosition > 0) {
602
- page.body.splice(targetRowId + 1, 0, dragElement)
603
- } else {
604
- page.body.splice(targetRowId, 0, dragElement)
605
- }
606
- this.refreshOrganization()
607
- this.$forceUpdate()
608
- return
609
- }
610
- }
611
- // 如果目标是组件
612
- } else if (dropLevel === 'item') {
613
- for (let i = 0; i < this.config.page.length; i++) {
614
- const page = this.config.page[i]
615
- for (let j = 0; j < page.body.length; j++) {
616
- const row = page.body[j]
617
- for (let k = 0; k < row.length; k++) {
618
- const item = row[k]
619
- if (item.id === dropKey) {
620
- if (dropPosition > 0) {
621
- row.splice(k + 1, 0, dragElement)
622
- } else {
623
- row.splice(k, 0, dragElement)
624
- }
625
- this.refreshOrganization()
626
- this.$forceUpdate()
627
- return
628
- }
629
- }
630
- }
631
- }
632
- }
633
- }
634
- },
635
- // 主页面标签切换
636
- handleMainPageMenuChange (value) {
637
- this.activeMainPage = value.key
638
- for (let i = 0; i < this.config.page.length; i++) {
639
- if (this.config.page[i].id === this.activeMainPage) {
640
- this.activeMainPageType = this.config.page[i].type
641
- return
642
- }
643
- }
644
- },
645
- // 将页面标签类型渲染为对应的文字
646
- determinePageType (type) {
647
- return lowcodeUtils.resolvePageType(type)
648
- },
649
- // 架构添加组件后,将配置添加到config中
650
- handleAddComponent (config) {
651
- this.config.page.push(config)
652
- this.refreshOrganization()
653
- },
654
- // 打开logic回调编辑弹框
655
- openLogicCallbackEditor () {
656
- if (!this.eventEditorContent.logicCallBackFunction) {
657
- this.eventEditorContent.logicCallBackFunction = LogicCallBackFunctionTemplate
658
- }
659
- this.showLogicCallBackEditor = true
660
- },
661
- // 打开logic参数JS编辑器弹框
662
- openLogicParamJSEditor () {
663
- if (!this.eventEditorContent.logicParamJSFunction) {
664
- this.eventEditorContent.logicParamJSFunction = LogicParamFunctionTemplate
665
- }
666
- this.showLogicParamJSEditor = true
667
- },
668
- // 刷新架构
669
- refreshOrganization () {
670
- this.showPageOrganization = false
671
- this.$nextTick(() => {
672
- this.showPageOrganization = true
673
- })
674
- },
675
- // 拖拽完成后,将新的span赋值
676
- handleDrag (targetEle, nextEle) {
677
- const target = lowcodeUtils.getComponentConfig(targetEle.id, this.config.page)
678
- const targetNext = lowcodeUtils.getComponentConfig(nextEle.id, this.config.page)
679
- target.span = targetEle.span
680
- targetNext.span = nextEle.span
681
- },
682
- // 删除组件
683
- deleteComponentInTree (id, type) {
684
- if (type === 'page') {
685
- this.deletePage(id)
686
- } else if (type === 'component') {
687
- this.deleteComponent(id)
688
- } else if (type === 'row') {
689
- this.deleteRow(id)
690
- }
691
- },
692
- // 删除行
693
- deleteRow (id) {
694
- const arr = id.split('_')
695
- for (let i = 0; i < this.config.page.length; i++) {
696
- const page = this.config.page[i]
697
- if (page.id === arr[0]) {
698
- page.body.splice(arr[1] - 1, 1)
699
- this.targetContainer = undefined
700
- this.editorPropertiesConfig = {}
701
- this.refreshOrganization()
702
- }
703
- }
704
- },
705
- // 删除页面容器
706
- deletePage (id) {
707
- for (let i = 0; i < this.config.page.length; i++) {
708
- const page = this.config.page[i]
709
- if (page.id === id) {
710
- // 将该容器中所有已注册的组件全部删除
711
- page.body.forEach(item => {
712
- delete this.$children[0]._provided.componentsMap[item.id]
713
- })
714
- this.targetContainer = undefined
715
- this.editorPropertiesConfig = {}
716
- this.refreshOrganization()
717
- this.config.page.splice(i, 1)
718
- return
719
- }
720
- }
721
- },
722
- // 删除组件
723
- deleteComponent (id, addOnSpan = true) {
724
- this.config.page.forEach(page => {
725
- for (let i = 0; i < page.body.length; i++) {
726
- const row = page.body[i]
727
- for (let j = 0; j < row.length; j++) {
728
- const item = row[j]
729
- if (item.id === id) {
730
- // 记录被删除的组件span
731
- const deletedSpan = item.span
732
- // 删除
733
- row.splice(j, 1)
734
- if (addOnSpan) {
735
- // 如果该组件之前还有组件,将该组件的span加给之前的组件
736
- if (j !== 0) {
737
- row[j - 1].span += deletedSpan
738
- } else if (row.length > 0) {
739
- row[0].span += deletedSpan
740
- }
741
- }
742
- // 从注册的全局Map中删除
743
- delete this.$children[0]._provided.componentsMap[this.editorPropertiesConfig.id]
744
- this.targetContainer = undefined
745
- this.editorPropertiesConfig = {}
746
- this.refreshOrganization()
747
- return
748
- }
749
- }
750
- }
751
- })
752
- },
753
- // 打开JS函数编辑器
754
- openEventJSEditor () {
755
- if (!this.eventEditorContent.JSFunction) {
756
- this.eventEditorContent.JSFunction = JSEventFunctionTemplate
757
- }
758
- this.showJSEventEditor = true
759
- },
760
- // 事件编辑器中,点击编辑按钮
761
- editEventIconClick (eventType, eventIndex) {
762
- // 找到目标配置
763
- const targetConfig = lowcodeUtils.getComponentConfig(this.editorPropertiesConfig.id, this.config.page)
764
- // 将目标对应的配置赋值到事件编辑器缓存
765
- this.eventEditorContent = { ...targetConfig.onEvent[eventType][eventIndex] }
766
- this.eventEditorContent.emitType = eventType
767
- this.eventEditorCurrent = {
768
- type: eventType,
769
- index: eventIndex
770
- }
771
- this.showEventEditor = true
772
- },
773
- // 删除事件
774
- removeEventClick (eventType, eventIndex) {
775
- const targetConfig = lowcodeUtils.getComponentConfig(this.editorPropertiesConfig.id, this.config.page)
776
- targetConfig.onEvent[eventType].splice(eventIndex, 1)
777
- if (targetConfig.onEvent[eventType].length === 0) {
778
- delete targetConfig.onEvent[eventType]
779
- }
780
- this.$forceUpdate()
781
- },
782
- // 添加事件
783
- addEvent () {
784
- this.showEventEditor = true
785
- },
786
- // 获取所有注册组件
787
- getAllRenderedComponents () {
788
- return Object.keys(this.$children[0]._provided.componentsMap)
789
- },
790
- // 容器删除
791
- handleContainerDelete (id) {
792
- let target
793
- let pageIndex
794
- // 找到目标page
795
- for (let i = 0; i < this.config.page.length; i++) {
796
- const tempPage = this.config.page[i].body
797
- for (let j = 0; j < tempPage.length; j++) {
798
- const row = tempPage[j]
799
- for (let k = 0; k < row.length; k++) {
800
- const item = row[k]
801
- if (item.id === id) {
802
- target = this.config.page[i]
803
- // eslint-disable-next-line no-unused-vars
804
- pageIndex = i
805
- }
806
- }
807
- }
808
- }
809
- // 找到该page下对应的item
810
- let targetIndex
811
- let rowIndex
812
- for (let i = 0; i < target.body.length; i++) {
813
- const row = target.body[i]
814
- for (let j = 0; j < row.length; j++) {
815
- const item = row[j]
816
- if (item.id === id) {
817
- targetIndex = j
818
- rowIndex = i
819
- break
820
- }
821
- }
822
- }
823
- target.body[rowIndex].splice(targetIndex, 1)
824
- this.targetContainer = undefined
825
- // 如果删除后只剩一个容器,将该容器span设置为24
826
- if (target.body[rowIndex].length === 1) {
827
- target.body[rowIndex][0].span = 24
828
- }
829
- this.refreshOrganization()
830
- },
831
- // 事件编辑器点击完成
832
- handleEventEditorOk () {
833
- let emitTypeKey = this.eventEditorContent.emitType
834
- // 是否是自定义事件触发
835
- if (this.eventEditorContent.customEmitType) {
836
- emitTypeKey = this.eventEditorContent.customEmitType
837
- }
838
- // 如果当前是回显事件
839
- if (this.eventEditorCurrent) {
840
- const targetConfig = lowcodeUtils.getComponentConfig(this.editorPropertiesConfig.id, this.config.page)
841
- targetConfig.onEvent[this.eventEditorCurrent.type][this.eventEditorCurrent.index] = { ...this.eventEditorContent }
842
- } else {
843
- // 当前是新增事件
844
- const target = lowcodeUtils.getComponentConfig(this.editorPropertiesConfig.id, this.config.page)
845
- // 如果没有onEvent属性则初始化
846
- if (!target.onEvent) {
847
- target.onEvent = {}
848
- }
849
- // 如果当前触发类型没有初始化,则初始化
850
- if (!target.onEvent[emitTypeKey]) {
851
- target.onEvent[emitTypeKey] = []
852
- }
853
- // 将缓存的事件属性赋值
854
- target.onEvent[emitTypeKey].push({
855
- ...this.eventEditorContent
856
- })
857
- }
858
- this.showEventEditor = false
859
- this.eventEditorContent = {}
860
- this.eventEditorCurrent = undefined
861
- },
862
- // 关闭事件编辑器弹框
863
- handleEventEditorCancel () {
864
- this.showEventEditor = false
865
- this.eventEditorContent = {}
866
- this.eventEditorCurrent = undefined
867
- },
868
- // 事件编辑器中,触发类型改变
869
- handleEventEditorTypeChange (type) {
870
- this.eventEditorContent.emitType = type
871
- this.$forceUpdate()
872
- },
873
- // 事件编辑器中,目标组件改变
874
- handleEventEditorTargetChange (target) {
875
- this.eventEditorContent.target = target
876
- this.$forceUpdate()
877
- },
878
- // 事件编辑器中,事件类型改变
879
- handleEventEditorEventTypeChange (type) {
880
- this.eventEditorContent.eventType = type
881
- this.logicParamTransferDataSource = []
882
- // 如果事件为运行Logic将组件加入穿梭框
883
- if (type === 'runLogic') {
884
- this.config.page.forEach(page => {
885
- page.body.forEach(row => {
886
- row.forEach(item => {
887
- if (!item.id.startsWith('container')) {
888
- this.logicParamTransferDataSource.push({
889
- key: item.id,
890
- title: item.id
891
- })
892
- }
893
- })
894
- })
895
- })
896
- this.eventEditorContent.logicParamTransfer = []
897
- }
898
- this.$forceUpdate()
899
- },
900
- // 事件编辑器中,目标组件执行事件类型改变
901
- handleEventEditorTargetEventTypeChange (type) {
902
- this.eventEditorContent.eventName = type
903
- this.$forceUpdate()
904
- },
905
- // 自定义JS方法弹框确认
906
- handleJSEventEditorOk () {
907
- this.showJSEventEditor = false
908
- },
909
- // 自定义JS方法弹框关闭
910
- handleJSEventEditorCancel () {
911
- this.showJSEventEditor = false
912
- },
913
- // 添加组件到容器中
914
- addComponentToContainer (type) {
915
- // 如果没有选中容器
916
- if (!this.targetContainer) {
917
- // 并且配置中没有任何其他组件,则认为是单组件页面,直接将组件添加到页面
918
- if (this.config.page.length === 0) {
919
- this.config.page.push({
920
- id: nanoid(2),
921
- type: 'page',
922
- body: [
923
- {
924
- span: 24,
925
- type: type,
926
- id: type + '_' + nanoid(6),
927
- }
928
- ]
929
- })
930
- this.refreshOrganization()
931
- } else {
932
- this.$message.error('如需多个组件请先添加组件容器!')
933
- }
934
- this.targetContainer = undefined
935
- return
936
- }
937
- // 获取选中的容器
938
- const target = lowcodeUtils.getComponentConfig(this.targetContainer.id, this.config.page)
939
- // 将容器的类型和id改变
940
- target.type = type
941
- target.id = target.type + '_' + nanoid(6)
942
- this.targetContainer = undefined
943
- this.refreshOrganization()
944
- },
945
- // 添加容器
946
- addContainer () {
947
- // 如果目标不是一个容器
948
- if (!this.targetContainer) {
949
- // 如果没有指定页面容器,则直接报错
950
- if (this.activeMainPage === undefined) {
951
- this.$message.error('未选中任何工作空间!')
952
- return
953
- }
954
- // 获取当前选中的页面容器
955
- let targetIndex = this.activeMainPage
956
- for (let i = 0; i < this.config.page.length; i++) {
957
- if (this.config.page[i].id === this.activeMainPage) {
958
- targetIndex = i
959
- break
960
- }
961
- }
962
- // 如果是page类型,添加两个容器。其他类型添加一个容器
963
- if (this.config.page[targetIndex].type === 'page') {
964
- this.config.page[targetIndex].body.push([
965
- {
966
- type: 'container',
967
- span: 12,
968
- id: 'container_' + nanoid(6)
969
- },
970
- {
971
- type: 'container',
972
- span: 12,
973
- id: 'container_' + nanoid(6)
974
- }
975
- ])
976
- } else {
977
- this.config.page[targetIndex].body.push([{
978
- type: 'container',
979
- span: 24,
980
- id: 'container_' + nanoid(6)
981
- }])
982
- }
983
- } else {
984
- // 如果目标是容器
985
- let targetIndex = -1
986
- let maxWidth = -1
987
- let targetPageIndex = -1
988
- let targetRowIndex = -1
989
- // 获取目标的配置
990
- for (let i = 0; i < this.config.page.length; i++) {
991
- const page = this.config.page[i]
992
- for (let j = 0; j < page.body.length; j++) {
993
- const row = page.body[j]
994
- for (let k = 0; k < row.length; k++) {
995
- const item = row[k]
996
- if (item.id === this.targetContainer.id) {
997
- targetIndex = k
998
- maxWidth = item.span
999
- targetPageIndex = i
1000
- targetRowIndex = j
1001
- }
1002
- }
1003
- }
1004
- }
1005
- // 将目标容器一分为二
1006
- this.config.page[targetPageIndex].body[targetRowIndex].splice(targetIndex, 1, {
1007
- type: 'container',
1008
- span: Math.floor(maxWidth / 2),
1009
- id: 'container_' + nanoid(6)
1010
- }, {
1011
- type: 'container',
1012
- span: Math.ceil(maxWidth / 2),
1013
- id: 'container_' + nanoid(6)
1014
- })
1015
- this.targetContainer = undefined
1016
- }
1017
- this.refreshOrganization()
1018
- },
1019
- // 获取所有已注册组件,用于添加至UI库
1020
- getRegisteredComponents () {
1021
- return Object.keys(registeredRender)
1022
- },
1023
- // 组件属性编辑
1024
- editorPropertiesInputChange (event, key) {
1025
- this.renderPreview = false
1026
- this.renderModalPreview = false
1027
- this.renderDrawPreview = false
1028
- // 如果当前有定时器,清除该定时器,并设置新的定时器
1029
- // 也就是说:每次操作间隔指定时间后才会触发更新
1030
- // 如果在此期间又进行了操作,则重新开始计时
1031
- if (this.inputTimeout) {
1032
- clearTimeout(this.inputTimeout)
1033
- }
1034
- this.inputTimeout = setTimeout(() => {
1035
- const target = lowcodeUtils.getComponentConfig(this.editorPropertiesConfig.id, this.config.page)
1036
- lowcodeLog('组件属性修改', '触发更新', target.id, true, false)
1037
- // 拿到组件注册的配置
1038
- const editorConfig = lowcodeUtils.getEditorConfigById(this.editorPropertiesConfig.id, this.config.page)
1039
- // 根据类型,将input框中的内容赋值
1040
- if (editorConfig.properties[key].type === 'object') {
1041
- target.props[key] = JSON.parse(event.target.value)
1042
- } else if (editorConfig.properties[key].type === 'string') {
1043
- target.props[key] = event.target.value
1044
- } else if (editorConfig.properties[key].type === 'boolean') {
1045
- const input = event.target.value.toLowerCase()
1046
- if (input === 'true' || input !== '0') {
1047
- target.props[key] = true
1048
- } else {
1049
- target.props[key] = false
1050
- }
1051
- }
1052
- this.renderPreview = true
1053
- this.renderModalPreview = true
1054
- this.renderDrawPreview = true
1055
- }, 1500)
1056
- },
1057
- // 切换预览模式
1058
- previewModeActive () {
1059
- this.preview = true
1060
- },
1061
- // 切换编辑模式
1062
- editModeActive () {
1063
- this.preview = false
1064
- },
1065
- // 选中某个组件
1066
- clickComponentInEditor (configItem) {
1067
- this.editorPropertiesConfig = {}
1068
- // 如果选中的是容器
1069
- if (configItem.type === 'container') {
1070
- // 如果已经选中,则反选,selected属性用于改变容器样式
1071
- if (configItem.selected) {
1072
- configItem.selected = false
1073
- this.targetContainer = undefined
1074
- } else {
1075
- // 将所有已选中组件取消选择
1076
- this.config.page.forEach(page => {
1077
- page.body.forEach(row => {
1078
- row.forEach(item => {
1079
- item.selected = false
1080
- })
1081
- })
1082
- })
1083
- // 将目标设置为选定
1084
- configItem.selected = true
1085
- this.targetContainer = configItem
1086
- }
1087
- return
1088
- }
1089
- // 如果是组件对象
1090
- // 拿注册的配置
1091
- const configInJson = lowcodeUtils.getEditorConfigByType(configItem.type)
1092
- if (configInJson) {
1093
- this.editorPropertiesConfig = configItem
1094
- // 为编辑器变量初始化
1095
- if (configInJson.properties) {
1096
- if (!this.editorPropertiesConfig.props) {
1097
- this.editorPropertiesConfig.props = {}
1098
- }
1099
- const editableKeys = Object.keys(configInJson.properties)
1100
- editableKeys.forEach(editableKey => {
1101
- // 如果该值并不存在,则初始化
1102
- if (!this.editorPropertiesConfig.props[editableKey]) {
1103
- this.editorPropertiesConfig.props[editableKey] = ''
1104
- } else {
1105
- if (typeof this.editorPropertiesConfig.props[editableKey] === 'object') {
1106
- this.editorPropertiesConfig.props[editableKey] = JSON.stringify(this.editorPropertiesConfig.props[editableKey])
1107
- }
1108
- }
1109
- })
1110
- }
1111
- // 为编辑器事件初始化
1112
- if (configInJson.selfEvent) {
1113
- if (!this.editorPropertiesConfig.selfEvent) {
1114
- this.editorPropertiesConfig.selfEvent = []
1115
- configInJson.selfEvent.forEach(everyEvent => {
1116
- this.editorPropertiesConfig.selfEvent.push(everyEvent)
1117
- })
1118
- }
1119
- }
1120
- } else {
1121
- this.editorPropertiesConfig = 'unregistered'
1122
- }
1123
- },
1124
- // 点击测试按钮
1125
- test () {
1126
- // 输出当前配置,和组件注册Map
1127
- console.warn('config', this.config)
1128
- console.warn('map', this.$children[0]._provided.componentsMap)
1129
- },
1130
- // 点击导出按钮
1131
- exportConfig () {
1132
- console.warn('导出', this.config)
1133
- this.$emit('exportConfig', this.config)
1134
- }
1135
- },
1136
- mounted () {
1137
- // 将mixin中已经实现的通用响应方法添加
1138
- this.supportedEventType = [...lowcodeComponentMixin.supportedEventType]
1139
- // 深拷贝外侧传来的配置
1140
- this.config = JSON.parse(JSON.stringify(this.originalConfig))
1141
- // this.config = {
1142
- // page: [
1143
- // {
1144
- // id: 'KB',
1145
- // type: 'page',
1146
- // title: '111',
1147
- // body: [
1148
- // [
1149
- // {
1150
- // type: 'XFormTable',
1151
- // span: 12,
1152
- // id: 'XFormTable_BV6Nwk',
1153
- // selected: false,
1154
- // props: {
1155
- // queryParamsName: '',
1156
- // serviceName: ''
1157
- // },
1158
- // selfEvent: [
1159
- // 'action'
1160
- // ]
1161
- // },
1162
- // {
1163
- // type: 'XAddNativeForm',
1164
- // span: 12,
1165
- // id: 'XAddNativeForm_ekihTp',
1166
- // selected: false,
1167
- // props: {
1168
- // configNameForLowCode: '',
1169
- // systemNameForLowCode: ''
1170
- // },
1171
- // selfEvent: [
1172
- // 'onSubmit'
1173
- // ]
1174
- // }
1175
- // ],
1176
- // [
1177
- // {
1178
- // type: 'XTreeOne',
1179
- // span: 12,
1180
- // id: 'XTreeOne_szu7Al',
1181
- // selected: false
1182
- // },
1183
- // {
1184
- // type: 'XDescriptions',
1185
- // span: 12,
1186
- // id: 'XDescriptions_DTkbEg',
1187
- // selected: false,
1188
- // props: {
1189
- // title: '111',
1190
- // content: {
1191
- // c_f_user_phone: '2323',
1192
- // c_f_total_fee: 33356,
1193
- // c_f_address: '22',
1194
- // c_f_meterlen: 2,
1195
- // c_f_bank_card_number: '23',
1196
- // c_f_create_user: '超级管理员',
1197
- // c_f_customer: '23',
1198
- // c_f_balance: 33356,
1199
- // c_f_create_date: '2024-06-23 21:31:24',
1200
- // c_f_operator_date: '2024-06-23 21:31:24',
1201
- // c_f_total_times: 2,
1202
- // c_f_user_name: '23',
1203
- // c_f_comments: '323',
1204
- // c_id: 39,
1205
- // c_f_operatorid: '15',
1206
- // c_f_operator: '超级管理员',
1207
- // c_f_orgid: '9'
1208
- // },
1209
- // configName: 'Unit_Desc_Config',
1210
- // serviceName: 'af-revenue',
1211
- // getRealData: true
1212
- // },
1213
- // selfEvent: []
1214
- // }
1215
- // ]
1216
- // ]
1217
- // },
1218
- // {
1219
- // id: 'Fg',
1220
- // type: 'page',
1221
- // title: '22',
1222
- // body: [
1223
- // [
1224
- // {
1225
- // type: 'container',
1226
- // span: 4,
1227
- // id: 'container_ir2gR2',
1228
- // selected: false
1229
- // },
1230
- // {
1231
- // type: 'container',
1232
- // span: 10,
1233
- // id: 'container_xIRHGg'
1234
- // },
1235
- // {
1236
- // type: 'container',
1237
- // span: 10,
1238
- // id: 'container_PT9n3Q'
1239
- // }
1240
- // ],
1241
- // [
1242
- // {
1243
- // type: 'container',
1244
- // span: 18,
1245
- // id: 'container_q04vQr',
1246
- // selected: false
1247
- // },
1248
- // {
1249
- // type: 'container',
1250
- // span: 6,
1251
- // id: 'container_MKwNvz',
1252
- // selected: false
1253
- // }
1254
- // ]
1255
- // ]
1256
- // }
1257
- // ]
1258
- // }
1259
- this.refreshOrganization()
1260
- }
1261
- }
1262
- </script>
1263
-
1264
- <style scoped lang="less">
1265
- .ui-item:hover {
1266
- cursor: pointer;
1267
- }
1268
-
1269
- .ui-item{
1270
- width: 100%;
1271
- height:10%;
1272
- text-align: center;
1273
- overflow-wrap: break-word;
1274
- padding: 7%
1275
- }
1276
-
1277
- .singleEvent {
1278
- border: black dashed 1px;
1279
- padding: 10%;
1280
- }
1281
-
1282
- .edit_icon:hover {
1283
- cursor: pointer;
1284
- }
1285
- </style>
1
+ <template>
2
+ <div>
3
+ <!-- 标题 -->
4
+ <a-card>
5
+ <a-page-header
6
+ title="奥枫低代码前端编辑器"
7
+ sub-title="af-lowcode"
8
+ :backIcon="false"
9
+ @back="() => null"
10
+ >
11
+ <template slot="extra">
12
+ <a-button @click="test">测试</a-button>
13
+ <a-button @click="editModeActive">编辑</a-button>
14
+ <a-button @click="previewModeActive">预览</a-button>
15
+ <a-button type="primary" @click="exportConfig">导出</a-button>
16
+ </template>
17
+ </a-page-header>
18
+ </a-card>
19
+ <!-- 预览模式 -->
20
+ <a-card v-if="preview">
21
+ <editor-page-render :page-config="config" :edit-mode="false"/>
22
+ </a-card>
23
+ <!-- 编辑模式 -->
24
+ <div v-show="!preview">
25
+ <a-row :gutter="2">
26
+ <!-- 左侧 -->
27
+ <a-col :span="4">
28
+ <a-card>
29
+ <a-tabs>
30
+ <!-- UI库 -->
31
+ <a-tab-pane key="1" tab="UI库">
32
+ <a-card style="margin-bottom: 5%">
33
+ <!-- 所有组件 -->
34
+ <a-card-grid class="ui-item" @click="addContainer">
35
+ 组件容器
36
+ </a-card-grid>
37
+ <template v-for="(item, index) in getRegisteredComponents()">
38
+ <a-card-grid :key="index" class="ui-item" @click="addComponentToContainer(item)">
39
+ {{ item }}
40
+ </a-card-grid>
41
+ </template>
42
+ </a-card>
43
+ </a-tab-pane>
44
+ <!-- 页面架构 -->
45
+ <a-tab-pane key="2" tab="架构">
46
+ <div style="margin-bottom: 3%">
47
+ <LowCodePageOrganization
48
+ :config="config"
49
+ v-if="showPageOrganization"
50
+ @rename="rename"
51
+ @pasteItem="handlePasteItem"
52
+ @componentMove="handleTreeDrag"
53
+ @deleteComponent="deleteComponentInTree"
54
+ @treeOrganizationClick="treeOrganizationClick"/>
55
+ </div>
56
+ </a-tab-pane>
57
+ </a-tabs>
58
+ </a-card>
59
+ </a-col>
60
+ <!-- 中间主体编辑器 -->
61
+ <a-col :span="15">
62
+ <a-card>
63
+ <!-- 切换显示的组件 -->
64
+ <div style="margin-bottom: 3%">
65
+ <!-- 添加页面组件按钮 -->
66
+ <div style="float: right">
67
+ <a-popover>
68
+ <template slot="content">
69
+ <p>添加页面组件</p>
70
+ </template>
71
+ <a-button @click="addPageContainer" >
72
+ <a-icon type="plus"/>
73
+ </a-button>
74
+ </a-popover>
75
+ </div>
76
+ <!-- 每个页面按钮切换栏 -->
77
+ <a-menu v-model="mainPageMenu" mode="horizontal" @click="handleMainPageMenuChange">
78
+ <template v-for="(page) in config.page">
79
+ <a-menu-item :key="page.id">{{ page.title + '(' + determinePageType(page.type) + ')' }}</a-menu-item>
80
+ </template>
81
+ </a-menu>
82
+ </div>
83
+ <!-- 渲染器 -->
84
+ <div v-if="activeMainPageType === 'page'">
85
+ <editor-page-render
86
+ v-if="renderPreview"
87
+ @spanDrag="handleDrag"
88
+ @containerDelete="handleContainerDelete"
89
+ @clickComponentInEditor="clickComponentInEditor"
90
+ :page-config="{ data: config.data, page: config.page.filter(page => page.id === activeMainPage)}"/>
91
+ <a-skeleton v-else/>
92
+ </div>
93
+ <div v-if="activeMainPageType === 'modal'">
94
+ <editor-page-render
95
+ v-if="renderModalPreview"
96
+ @spanDrag="handleDrag"
97
+ @containerDelete="handleContainerDelete"
98
+ @clickComponentInEditor="clickComponentInEditor"
99
+ :page-config="{ data: config.data, page: config.page.filter(page => page.id === activeMainPage)}"/>
100
+ <a-skeleton v-else/>
101
+ </div>
102
+ <div v-if="activeMainPageType === 'draw'">
103
+ <editor-page-render
104
+ v-if="renderDrawPreview"
105
+ @spanDrag="handleDrag"
106
+ @containerDelete="handleContainerDelete"
107
+ @clickComponentInEditor="clickComponentInEditor"
108
+ :page-config="{ data: config.data, page: config.page.filter(page => page.id === activeMainPage)}"/>
109
+ <a-skeleton v-else/>
110
+ </div>
111
+ </a-card>
112
+ </a-col>
113
+ <!-- 右侧 -->
114
+ <a-col :span="5">
115
+ <!-- 属性编辑 -->
116
+ <a-card>
117
+ <template v-if="editorPropertiesConfig === 'unregistered'">
118
+ <p>所选组件并未注册</p>
119
+ </template>
120
+ <template v-else>
121
+ <!-- 组件名 -->
122
+ <template v-if="editorPropertiesConfig.name">
123
+ <h3>组件名</h3>
124
+ <h4>{{ editorPropertiesConfig.name }}</h4>
125
+ </template>
126
+ <template v-else-if="editorPropertiesConfig.id">
127
+ <h3>组件ID</h3>
128
+ <h4>{{ editorPropertiesConfig.id }}</h4>
129
+ </template>
130
+ <!-- 切换 -->
131
+ <a-menu v-model="editorPanelCurrent" mode="horizontal" @click="() => null">
132
+ <a-menu-item key="properties">属性</a-menu-item>
133
+ <a-menu-item key="events">事件</a-menu-item>
134
+ </a-menu>
135
+ <!-- 属性编辑 -->
136
+ <div v-if="editorPanelCurrent[0] === 'properties'">
137
+ <div v-if="editorPropertiesConfig.props !== undefined">
138
+ <div>
139
+ 栅格数:<a-input :default-value="editorPropertiesConfig.span" @change="changeSpan"/>
140
+ </div>
141
+ <template v-for="(value,key) in editorPropertiesConfig.props">
142
+ <div :key="editorPropertiesConfig.id + '_' + key">
143
+ <a-tooltip>
144
+ <template slot="title" v-if="resolveEditorPropsLabel(editorPropertiesConfig.type, key).desc">
145
+ {{ resolveEditorPropsLabel(editorPropertiesConfig.type, key).desc }}
146
+ </template>
147
+ {{ resolveEditorPropsLabel(editorPropertiesConfig.type, key).label }}:
148
+ </a-tooltip>
149
+ <a-input :default-value="value" @change="editorPropertiesInputChange($event, key)"/>
150
+ </div>
151
+ </template>
152
+ </div>
153
+ <p v-else>您未选择任何组件</p>
154
+ </div>
155
+ <!-- 事件编辑 -->
156
+ <div v-else-if="editorPanelCurrent[0] === 'events'">
157
+ <template v-if="editorPropertiesConfig.onEvent !== undefined">
158
+ <a-collapse v-model="eventCollapseActive">
159
+ <a-collapse-panel
160
+ v-for="(eventConfig,eventType) in editorPropertiesConfig.onEvent"
161
+ :key="eventType"
162
+ :header="eventType">
163
+ <div v-for="(singleEvent,singleEventIndex) in eventConfig" :key="singleEventIndex" class="singleEvent">
164
+ <p>
165
+ <span style="color:rgb( 24,144,255)">{{ singleEvent.eventType }}</span>
166
+ 事件
167
+ </p>
168
+ <!-- 事件 编辑/删除 按钮 -->
169
+ <div style="display: flex; justify-content: space-evenly">
170
+ <a-icon type="edit" theme="twoTone" class="edit_icon" @click="editEventIconClick(eventType,singleEventIndex)"/>
171
+ <a-popconfirm title="确认删除" ok-text="确认删除" cancel-text="取消" @confirm="removeEventClick(eventType,singleEventIndex)" @cancel="() => null">
172
+ <a-icon type="delete" theme="twoTone" class="edit_icon"/>
173
+ </a-popconfirm>
174
+ </div>
175
+ </div>
176
+ </a-collapse-panel>
177
+ </a-collapse>
178
+ </template>
179
+ <a-button v-if="editorPropertiesConfig.id !== undefined" @click="addEvent">添加事件</a-button>
180
+ <p v-else>您未选择任何组件</p>
181
+ </div>
182
+ </template>
183
+ </a-card>
184
+ </a-col>
185
+ </a-row>
186
+ </div>
187
+ <!-- 自定义事件弹框 -->
188
+ <a-modal
189
+ title="事件编辑器"
190
+ width="60%"
191
+ :z-index="1001"
192
+ :destroyOnClose="true"
193
+ @ok="handleEventEditorOk"
194
+ @cancel="handleEventEditorCancel"
195
+ v-if="showEventEditor"
196
+ :visible="showEventEditor">
197
+ <a-form :label-col="{ span: 6 }" :wrapper-col="{ span: 14 }">
198
+ <!-- 事件触发类型 -->
199
+ <a-form-item label="事件触发类型">
200
+ <a-select @change="handleEventEditorTypeChange" :default-value="eventEditorContent.emitType">
201
+ <a-select-option
202
+ v-for="(eventType, eventTypeIndex) in editorPropertiesConfig.selfEvent"
203
+ :key="eventTypeIndex"
204
+ :value="eventType">
205
+ {{ eventType }}
206
+ </a-select-option>
207
+ <a-select-option value="customEmitType">
208
+ 自定义触发类型
209
+ </a-select-option>
210
+ <a-select-option value="lifeCycle">
211
+ 生命周期函数
212
+ </a-select-option>
213
+ </a-select>
214
+ </a-form-item>
215
+ <!-- 自定义事件触发类型 -->
216
+ <a-form-item label="自定义事件触发名" v-if="eventEditorContent.emitType === 'customEmitType'">
217
+ <a-input v-model="eventEditorContent.customEmitType"/>
218
+ </a-form-item>
219
+ <!-- 事件类型 -->
220
+ <a-form-item label="事件类型" v-if="eventEditorContent.emitType !== 'lifeCycle'">
221
+ <a-select @change="handleEventEditorEventTypeChange" :default-value="eventEditorContent.eventType">
222
+ <a-select-option value="changeValue">
223
+ 修改组件的值
224
+ </a-select-option>
225
+ <a-select-option value="changeProps">
226
+ 修改组件的Props
227
+ </a-select-option>
228
+ <a-select-option value="runLogic">
229
+ 执行Logic
230
+ </a-select-option>
231
+ <a-select-option value="log">
232
+ 打印日志
233
+ </a-select-option>
234
+ <a-select-option value="showModal" v-if="this.config.page.filter(page => page.type === 'modal').length > 0">
235
+ 修改弹框可见
236
+ </a-select-option>
237
+ <a-select-option value="showDraw" v-if="this.config.page.filter(page => page.type === 'draw').length > 0">
238
+ 修改抽屉可见
239
+ </a-select-option>
240
+ </a-select>
241
+ </a-form-item>
242
+ <!-- 生命周期函数 -->
243
+ <a-form-item label="生命周期名" v-if="eventEditorContent.emitType === 'lifeCycle'">
244
+ <a-select @change="handleEventEditorLifeCycleChange" :default-value="eventEditorContent.lifeCycle">
245
+ <a-select-option value="created">
246
+ created
247
+ </a-select-option>
248
+ <a-select-option value="beforeMount">
249
+ beforeMount
250
+ </a-select-option>
251
+ <a-select-option value="mounted">
252
+ mounted
253
+ </a-select-option>
254
+ <a-select-option value="beforeUpdate">
255
+ beforeUpdate
256
+ </a-select-option>
257
+ <a-select-option value="updated">
258
+ updated
259
+ </a-select-option>
260
+ <a-select-option value="beforeDestroy">
261
+ beforeDestroy
262
+ </a-select-option>
263
+ <a-select-option value="destroyed">
264
+ destroyed
265
+ </a-select-option>
266
+ </a-select>
267
+ </a-form-item>
268
+ <!-- 修改弹框可见 or 修改抽屉可见 -->
269
+ <a-form-item label="修改可见" v-if="eventEditorContent.eventType === 'showModal' || eventEditorContent.eventType === 'showDraw'">
270
+ <a-radio-group v-model="eventEditorContent.visible" button-style="solid">
271
+ <a-radio-button value="open">
272
+ 显示
273
+ </a-radio-button>
274
+ <a-radio-button value="close">
275
+ 隐藏
276
+ </a-radio-button>
277
+ </a-radio-group>
278
+ </a-form-item>
279
+ <!-- 弹框容器ID -->
280
+ <a-form-item label="弹框容器ID" v-if="eventEditorContent.eventType === 'showModal'">
281
+ <a-select v-model="eventEditorContent.containerId">
282
+ <a-select-option
283
+ v-for="(modal) in config.page.filter(page => page.type === 'modal')"
284
+ :key="modal.id"
285
+ :value="modal.id">
286
+ 弹框_{{ modal.id }}
287
+ </a-select-option>
288
+ </a-select>
289
+ </a-form-item>
290
+ <!-- 抽屉容器ID -->
291
+ <a-form-item label="抽屉容器ID" v-if="eventEditorContent.eventType === 'showDraw'">
292
+ <a-select v-model="eventEditorContent.containerId">
293
+ <a-select-option
294
+ v-for="(draw) in config.page.filter(page => page.type === 'draw')"
295
+ :key="draw.id"
296
+ :value="draw.id">
297
+ 抽屉_{{ draw.id }}
298
+ </a-select-option>
299
+ </a-select>
300
+ </a-form-item>
301
+ <!-- Logic名 -->
302
+ <a-form-item label="Logic名" v-if="eventEditorContent.eventType === 'runLogic'">
303
+ <a-input v-model="eventEditorContent.logicName"/>
304
+ </a-form-item>
305
+ <!-- 服务名 -->
306
+ <a-form-item label="服务名" v-if="eventEditorContent.eventType === 'runLogic'">
307
+ <a-input v-model="eventEditorContent.serviceName"/>
308
+ </a-form-item>
309
+ <!-- 自定义Logic参数,由哪些组件传递 -->
310
+ <a-form-item label="Logic参数取值组件" v-if="eventEditorContent.eventType === 'runLogic'">
311
+ <a-transfer
312
+ :data-source="logicParamTransferDataSource"
313
+ :render="item => item.title"
314
+ :target-keys="eventEditorContent.logicParamTransfer"
315
+ @change="handleLogicParamTransferChange"/>
316
+ </a-form-item>
317
+ <!-- 自定义Logic参数 -->
318
+ <a-form-item label="自定义Logic参数" v-if="eventEditorContent.eventType === 'runLogic'">
319
+ <a-button type="primary" @click="openLogicParamJSEditor">
320
+ 打开编辑器
321
+ </a-button>
322
+ </a-form-item>
323
+ <!-- 自定义Logic回调 -->
324
+ <a-form-item label="自定义Logic回调" v-if="eventEditorContent.eventType === 'runLogic'" >
325
+ <a-button type="primary" @click="openLogicCallbackEditor">
326
+ 打开编辑器
327
+ </a-button>
328
+ </a-form-item>
329
+ <!-- 修改组件的值 才会显示的其余参数 -->
330
+ <template v-if="eventEditorContent.eventType === 'changeValue' || eventEditorContent.eventType === 'changeProps'">
331
+ <!-- 目标组件 -->
332
+ <a-form-item label="目标组件">
333
+ <a-select @change="handleEventEditorTargetChange" :default-value="eventEditorContent.target">
334
+ <a-select-option
335
+ v-for="(targetId, targetIndex) in getAllRenderedComponents()"
336
+ :key="targetIndex"
337
+ :value="targetId">
338
+ {{ targetId }}
339
+ </a-select-option>
340
+ </a-select>
341
+ </a-form-item>
342
+ <!-- 目标组件执行事件名 -->
343
+ <a-form-item label="目标组件执行事件名" v-if="eventEditorContent.eventName === 'changeValue'">
344
+ <a-select @change="handleEventEditorTargetEventTypeChange" :default-value="eventEditorContent.eventName">
345
+ <a-select-option :value="eventType" v-for="(eventType,eventTypeIndex) in supportedEventType" :key="'eventType_' + eventTypeIndex">
346
+ {{ eventType }}
347
+ </a-select-option>
348
+ </a-select>
349
+ </a-form-item>
350
+ <!-- 目标组件修改值对应的key -->
351
+ <a-form-item label="目标组件修改值对应的key" v-if="eventEditorContent.target !== undefined">
352
+ <a-input v-model="eventEditorContent.targetKey"/>
353
+ </a-form-item>
354
+ </template>
355
+ <!-- 自定义JS方法 -->
356
+ <a-form-item label="自定义JS方法" v-if="eventEditorContent.emitType !== 'lifeCycle'">
357
+ <a-button type="primary" @click="openEventJSEditor">打开编辑器</a-button>
358
+ </a-form-item>
359
+ <!-- 自定义钩子函数 -->
360
+ <a-form-item label="自定义生命周期函数" v-if="eventEditorContent.emitType === 'lifeCycle'">
361
+ <a-button type="primary" @click="openEventLifeCycleJSEditor">打开编辑器</a-button>
362
+ </a-form-item>
363
+ </a-form>
364
+ </a-modal>
365
+ <!-- 自定义JS事件弹框 -->
366
+ <a-modal
367
+ title="事件编辑器"
368
+ width="60%"
369
+ :destroyOnClose="true"
370
+ :z-index="1002"
371
+ @ok="handleJSEventEditorOk"
372
+ @cancel="handleJSEventEditorCancel"
373
+ :visible="showJSEventEditor">
374
+ <a-popover title="参数说明" style="margin-right: 5%">
375
+ <template slot="content">
376
+ <p>该方法有以下几个参数:</p>
377
+ <p>eventType:事件类型,比如:changeValue代表修改目标组件的值</p>
378
+ <p>data:由事件源发出的参数列表</p>
379
+ <p>targetKey:修改目标组件值所对应的key</p>
380
+ <p>sourceVM:事件源的vue对象</p>
381
+ <p>targetVM:目标的vue对象</p>
382
+ </template>
383
+ <a-button type="primary">
384
+ 参数说明
385
+ </a-button>
386
+ </a-popover>
387
+ <a-popover title="返回值说明" style="margin-bottom: 5%">
388
+ <template slot="content">
389
+ <p>该方法需要的返回值:</p>
390
+ <p>eventType:事件类型</p>
391
+ <p>data:传递给目标组件的数据</p>
392
+ <p>targetKey:修改目标组件值所对应的key</p>
393
+ </template>
394
+ <a-button type="primary">
395
+ 返回值说明
396
+ </a-button>
397
+ </a-popover>
398
+ <code-mirror
399
+ :style-obj="{height:'80%',fontSize:'18px',marginBottom:'15px'}"
400
+ :mode="'javascript'"
401
+ :theme="'monokai'"
402
+ v-model="eventEditorContent.JSFunction"
403
+ :value="eventEditorContent.JSFunction"/>
404
+ </a-modal>
405
+ <!-- 自定义Logic参数JS弹框 -->
406
+ <a-modal
407
+ title="自定义Logic参数JS编辑器"
408
+ width="60%"
409
+ :destroyOnClose="true"
410
+ :z-index="1002"
411
+ @ok="() => { showLogicParamJSEditor = false}"
412
+ @cancel="() => { showLogicParamJSEditor = false}"
413
+ :visible="showLogicParamJSEditor">
414
+ <a-popover title="参数说明" style="margin-right: 5%">
415
+ <template slot="content">
416
+ <p>该方法有以下几个参数:</p>
417
+ <p>componentData:Logic参数取值组件中选中的组件,将会把数据打包存在此对象中,key则为组件的id</p>
418
+ <p>data:由事件源emit发出的参数</p>
419
+ </template>
420
+ <a-button type="primary">
421
+ 参数说明
422
+ </a-button>
423
+ </a-popover>
424
+ <a-popover title="返回值说明" style="margin-bottom: 5%">
425
+ <template slot="content">
426
+ <p>该方法需要一个JSON类型的返回值</p>
427
+ <p>该返回值就是传递给Logic执行的参数</p>
428
+ </template>
429
+ <a-button type="primary">
430
+ 返回值说明
431
+ </a-button>
432
+ </a-popover>
433
+ <code-mirror
434
+ :style-obj="{height:'80%',fontSize:'18px',marginBottom:'15px'}"
435
+ :mode="'javascript'"
436
+ :theme="'monokai'"
437
+ v-model="eventEditorContent.logicParamJSFunction"
438
+ :value="eventEditorContent.logicParamJSFunction"/>
439
+ </a-modal>
440
+ <!-- 自定义Logic回调弹框 -->
441
+ <a-modal
442
+ title="事件编辑器"
443
+ width="60%"
444
+ :destroyOnClose="true"
445
+ :z-index="1002"
446
+ @ok="() => { showLogicCallBackEditor = false}"
447
+ @cancel="() => { showLogicCallBackEditor = false}"
448
+ :visible="showLogicCallBackEditor">
449
+ <a-popover title="参数说明" style="margin-bottom: 5%">
450
+ <template slot="content">
451
+ <p>该方法有以下几个参数:</p>
452
+ <p>componentsMap:所有组件注册的Map</p>
453
+ <p>responseData:后端的返回值</p>
454
+ </template>
455
+ <a-button type="primary">
456
+ 参数说明
457
+ </a-button>
458
+ </a-popover>
459
+ <code-mirror
460
+ :style-obj="{height:'80%',fontSize:'18px',marginBottom:'15px'}"
461
+ :mode="'javascript'"
462
+ :theme="'monokai'"
463
+ v-model="eventEditorContent.logicCallBackFunction"
464
+ :value="eventEditorContent.logicCallBackFunction"/>
465
+ </a-modal>
466
+ <!-- 自定义生命周期函数弹框 -->
467
+ <a-modal
468
+ title="生命周期函数编辑器"
469
+ width="60%"
470
+ :destroyOnClose="true"
471
+ :z-index="1002"
472
+ @ok="() => { showLifeCycleFunctionEditor = false}"
473
+ @cancel="() => { showLifeCycleFunctionEditor = false}"
474
+ :visible="showLifeCycleFunctionEditor">
475
+ <a-popover title="参数说明" style="margin-bottom: 5%">
476
+ <template slot="content">
477
+ <p>该方法有以下几个参数:</p>
478
+ <p>vm:VUE组件对象(this)</p>
479
+ </template>
480
+ <a-button type="primary">
481
+ 参数说明
482
+ </a-button>
483
+ </a-popover>
484
+ <code-mirror
485
+ :style-obj="{height:'80%',fontSize:'18px',marginBottom:'15px'}"
486
+ :mode="'javascript'"
487
+ :theme="'monokai'"
488
+ v-model="eventEditorContent.LifeCycleFunction"
489
+ :value="eventEditorContent.LifeCycleFunction"/>
490
+ </a-modal>
491
+ <!-- 新增页面容器弹框 -->
492
+ <a-modal
493
+ title="新增页面容器"
494
+ width="60%"
495
+ :z-index="1001"
496
+ :destroyOnClose="true"
497
+ @ok="handleAddPageContainerModalOk"
498
+ @cancel="() => { showPageContainerAddModal = false }"
499
+ :visible="showPageContainerAddModal">
500
+ <a-form :label-col="{ span: 7 }" :wrapper-col="{ span: 12 }">
501
+ <!-- 容器类型 -->
502
+ <a-form-item label="容器类型">
503
+ <a-select v-model="addComponentTemp.type" @change="pageContainerAddTypeChange">
504
+ <a-select-option value="page">
505
+ 页面
506
+ </a-select-option>
507
+ <a-select-option value="modal">
508
+ 弹框
509
+ </a-select-option>
510
+ <a-select-option value="draw">
511
+ 抽屉
512
+ </a-select-option>
513
+ </a-select>
514
+ </a-form-item>
515
+ <!-- 标题 -->
516
+ <a-form-item label="标题">
517
+ <a-input v-model="addComponentTemp.title"/>
518
+ </a-form-item>
519
+ <template v-if="addComponentTemp.type !== 'page'">
520
+ <!-- 宽度 -->
521
+ <a-form-item label="宽度">
522
+ <a-input v-model="addComponentTemp.width"/>
523
+ </a-form-item>
524
+ </template>
525
+ </a-form>
526
+ </a-modal>
527
+ </div>
528
+ </template>
529
+
530
+ <script>
531
+ import editorPageRender from '@vue2-client/base-client/components/common/LowCodePageRender/editorPageRender.vue'
532
+ import * as registeredRender from '@vue2-client/utils/lowcode/registerComponentForRender'
533
+ import * as lowcodeUtils from '@vue2-client/utils/lowcode/lowcodeUtils'
534
+ import codeMirror from '@vue2-client/components/CodeMirror/inedx.vue'
535
+ import lowcodeComponentMixin from '@vue2-client/utils/lowcode/lowcodeComponentMixin'
536
+ // eslint-disable-next-line no-unused-vars
537
+ import lowcodeLog from '@vue2-client/utils/lowcode/lowcodeLog'
538
+ import LowCodePageOrganization from '@vue2-client/base-client/components/common/LowCodeComponent/LowCodePageOrganization.vue'
539
+
540
+ // 函数编辑器显示的模板
541
+ const JSEventFunctionTemplate = 'function(eventType, data, targetKey, sourceVM, targetVM) {\n \n return {\n "eventType": eventType,\n "data": data,\n "targetKey": targetKey\n }\n}'
542
+ const LogicParamFunctionTemplate = 'function(componentData, data) {\n \n return {\n \n }\n}'
543
+ const LogicCallBackFunctionTemplate = 'function(componentsMap, responseData) {\n \n}'
544
+ const LifeCycleFunctionTemplate = 'function(vm) {\n \n}'
545
+
546
+ export default {
547
+ components: {
548
+ LowCodePageOrganization,
549
+ editorPageRender,
550
+ codeMirror
551
+ },
552
+ props: {
553
+ // 页面原始的配置,用于从琉璃中读取
554
+ originalConfig: {
555
+ type: Object,
556
+ default: () => {
557
+ return {
558
+ page: []
559
+ }
560
+ }
561
+ }
562
+ },
563
+ data () {
564
+ return {
565
+ // 主体窗口选择的标签
566
+ mainPageMenu: ['none'],
567
+ // 默认的配置
568
+ config: { page: [] },
569
+ // 选中的容器
570
+ targetContainer: undefined,
571
+ // 控制是否渲染页面
572
+ preview: false,
573
+ // 控制架构树显隐,用于刷新组件
574
+ showPageOrganization: true,
575
+ // 用于保存右侧编辑组件的属性
576
+ editorPropertiesConfig: {},
577
+ // 编辑属性时用到的定时器
578
+ inputTimeout: undefined,
579
+ // 当前激活的是组件事件中哪一类触发属性,对应事件编辑中的手风琴面板
580
+ eventCollapseActive: undefined,
581
+ // 控制事件编辑器弹框显隐
582
+ showEventEditor: false,
583
+ // 控制自定义JS函数弹框显隐
584
+ showJSEventEditor: false,
585
+ // 控制页面显隐,用于属性面板编辑后,触发页面更新
586
+ renderPreview: true,
587
+ // 控制弹框显隐,用于属性面板编辑后,触发页面更新
588
+ renderModalPreview: true,
589
+ // 控制抽屉显隐,用于属性面板编辑后,触发页面更新
590
+ renderDrawPreview: true,
591
+ // 控制右侧编辑器切换标签页
592
+ editorPanelCurrent: ['properties'],
593
+ // 事件编辑内容的缓存
594
+ eventEditorContent: {},
595
+ // 用于事件编辑的回显,在点击事件编辑按钮后,会将此变量赋值
596
+ eventEditorCurrent: undefined,
597
+ // 保存目标组件可以触发哪些事件
598
+ supportedEventType: undefined,
599
+ // 控制自定义Logic参数自定义JS函数弹框显隐
600
+ showLogicParamJSEditor: false,
601
+ // 控制自定义Logic回调弹框显隐
602
+ showLogicCallBackEditor: false,
603
+ // 保存主体中,当前激活的标签栏ID
604
+ activeMainPage: undefined,
605
+ // 保存主体中,当前激活的标签栏类型
606
+ activeMainPageType: undefined,
607
+ // 定义Logic参数从哪些组件获取
608
+ logicParamTransferDataSource: [],
609
+ // 添加页面容器参数
610
+ addComponentTemp: { type: 'page' },
611
+ // 控制添加页面容器弹框显隐
612
+ showPageContainerAddModal: false,
613
+ showLifeCycleFunctionEditor: false
614
+ }
615
+ },
616
+ provide () {
617
+ return {
618
+ // 将注册的组件传递给子组件
619
+ componentsMap: {}
620
+ }
621
+ },
622
+ methods: {
623
+ refreshRender () {
624
+ this.renderPreview = false
625
+ this.renderModalPreview = false
626
+ this.renderDrawPreview = false
627
+ this.$nextTick(() => {
628
+ this.renderPreview = true
629
+ this.renderModalPreview = true
630
+ this.renderDrawPreview = true
631
+ })
632
+ },
633
+ // 添加页面容器弹框确认
634
+ handleAddPageContainerModalOk () {
635
+ const result = {
636
+ id: 'page_' + lowcodeUtils.nanoidWithoutSymbol(6),
637
+ type: this.addComponentTemp.type,
638
+ title: this.addComponentTemp.title,
639
+ width: this.addComponentTemp.width,
640
+ body: []
641
+ }
642
+ this.addComponentTemp = { type: 'page' }
643
+ this.config.page.push(result)
644
+ this.refreshOrganization()
645
+ this.showPageContainerAddModal = false
646
+ },
647
+ // 添加页面容器类型修改
648
+ pageContainerAddTypeChange (value) {
649
+ if (value !== 'page') {
650
+ this.addComponentTemp = { width: '70%', type: value }
651
+ } else {
652
+ this.addComponentTemp = { type: value }
653
+ }
654
+ },
655
+ // 添加页面容器
656
+ addPageContainer () {
657
+ this.addComponentTemp = { type: 'page' }
658
+ this.showPageContainerAddModal = true
659
+ },
660
+ // 通过组件类型和key解析出该key对应的中文定义
661
+ resolveEditorPropsLabel (type, key) {
662
+ const def = lowcodeUtils.getEditorConfigByType(type)
663
+ const propsDef = def.properties
664
+ const targetDef = propsDef[key]
665
+ if (!targetDef.label) {
666
+ targetDef.label = key
667
+ targetDef.desc = '未配置该参数的说明!'
668
+ } else if (!targetDef.desc) {
669
+ targetDef.desc = '未配置该参数的说明!'
670
+ }
671
+ return targetDef
672
+ },
673
+ // 架构重命名
674
+ rename (id, newName) {
675
+ const target = lowcodeUtils.getConfig(id, this.config)
676
+ if (id.length <= 2) {
677
+ target.title = newName
678
+ } else {
679
+ target.name = newName
680
+ }
681
+ this.refreshOrganization()
682
+ },
683
+ // 复制粘贴组件
684
+ handlePasteItem (id, copyCache, type) {
685
+ const target = lowcodeUtils.getConfig(id, this.config)
686
+ // 页面中插入行
687
+ if (type === 'page-row') {
688
+ const content = copyCache.content
689
+ const contentKeys = Object.keys(content)
690
+ const result = []
691
+ contentKeys.forEach(key => {
692
+ result.push(content[key])
693
+ })
694
+ target.body.push(result)
695
+ } else if (type === 'row-item') {
696
+ // 行中插入组件
697
+ target.push(copyCache.content)
698
+ } else if (type === 'page') {
699
+ // 复制页面
700
+ this.config.page.push(copyCache)
701
+ this.$message.success('复制成功!')
702
+ }
703
+ this.refreshOrganization()
704
+ },
705
+ // span属性通过input框修改
706
+ changeSpan (event) {
707
+ this.editorPropertiesConfig.span = event.target.value
708
+ },
709
+ // logic从组件中取值穿梭框改变事件
710
+ handleLogicParamTransferChange (targetKeys, direction, moveKeys) {
711
+ this.eventEditorContent.logicParamTransfer = targetKeys
712
+ this.$forceUpdate()
713
+ },
714
+ // 点击架构树
715
+ treeOrganizationClick (id) {
716
+ // 如果类型是page证明,选中的是最外层容器
717
+ // if (type === 'page') {
718
+ // this.mainPageMenu[0] = id
719
+ // this.activeMainPage = id
720
+ // for (let i = 0; i < this.config.page.length; i++) {
721
+ // if (this.config.page[i].id === this.activeMainPage) {
722
+ // this.activeMainPageType = this.config.page[i].type
723
+ // break
724
+ // }
725
+ // }
726
+ // this.$forceUpdate()
727
+ // } else if (type === 'component') {
728
+ // this.config.page.forEach(page => {
729
+ // page.body.forEach(row => {
730
+ // row.forEach(item => {
731
+ // if (item.id === id) {
732
+ // this.mainPageMenu[0] = page.id
733
+ // this.activeMainPage = page.id
734
+ // this.activeMainPageType = page.type
735
+ // this.$forceUpdate()
736
+ // }
737
+ // })
738
+ // })
739
+ // })
740
+ // 将组件选中
741
+ const target = lowcodeUtils.getComponentConfig(id, this.config)
742
+ this.clickComponentInEditor(target)
743
+ },
744
+ // 架构树拖拽事件
745
+ handleTreeDrag (dragKey, dropKey, dropLevel, dropPosition) {
746
+ let dragElement
747
+ // 如果被拖拽的id小于等于5位则为行
748
+ if (dragKey.length <= 5) {
749
+ const targetPageId = dragKey.split('_')[0]
750
+ const targetRowId = dragKey.split('_')[1] - 1
751
+ for (let i = 0; i < this.config.page.length; i++) {
752
+ const page = this.config.page[i]
753
+ if (page.id === targetPageId) {
754
+ dragElement = page.body[targetRowId]
755
+ }
756
+ }
757
+ this.deleteRow(dragKey)
758
+ } else {
759
+ // 组件的拖拽
760
+ dragElement = JSON.parse(JSON.stringify(lowcodeUtils.getComponentConfig(dragKey, this.config)))
761
+ this.deleteComponent(dragKey, false)
762
+ }
763
+
764
+ // position有三种状态,-1表示在目标前,0表示插入,1表示在目标之后
765
+ if (dropPosition === 0) {
766
+ const target = lowcodeUtils.getComponentConfig(dropKey, this.config)
767
+ target.unshift(dragElement)
768
+ this.refreshOrganization()
769
+ this.$forceUpdate()
770
+ } else {
771
+ // 如果目标是一行
772
+ if (dropLevel === 'row') {
773
+ const targetPageId = dropKey.split('_')[0]
774
+ const targetRowId = dropKey.split('_')[1] - 1
775
+ for (let i = 0; i < this.config.page.length; i++) {
776
+ const page = this.config.page[i]
777
+ if (page.id === targetPageId) {
778
+ if (dropPosition > 0) {
779
+ page.body.splice(targetRowId + 1, 0, dragElement)
780
+ } else {
781
+ page.body.splice(targetRowId, 0, dragElement)
782
+ }
783
+ this.refreshOrganization()
784
+ this.$forceUpdate()
785
+ return
786
+ }
787
+ }
788
+ // 如果目标是组件
789
+ } else if (dropLevel === 'item') {
790
+ for (let i = 0; i < this.config.page.length; i++) {
791
+ const page = this.config.page[i]
792
+ for (let j = 0; j < page.body.length; j++) {
793
+ const row = page.body[j]
794
+ for (let k = 0; k < row.length; k++) {
795
+ const item = row[k]
796
+ if (item.id === dropKey) {
797
+ if (dropPosition > 0) {
798
+ row.splice(k + 1, 0, dragElement)
799
+ } else {
800
+ row.splice(k, 0, dragElement)
801
+ }
802
+ this.refreshOrganization()
803
+ this.$forceUpdate()
804
+ return
805
+ }
806
+ }
807
+ }
808
+ }
809
+ }
810
+ }
811
+ },
812
+ // 主页面标签切换
813
+ handleMainPageMenuChange (value) {
814
+ this.activeMainPage = value.key
815
+ for (let i = 0; i < this.config.page.length; i++) {
816
+ if (this.config.page[i].id === this.activeMainPage) {
817
+ this.activeMainPageType = this.config.page[i].type
818
+ return
819
+ }
820
+ }
821
+ },
822
+ // 将页面标签类型渲染为对应的文字
823
+ determinePageType (type) {
824
+ return lowcodeUtils.resolvePageType(type)
825
+ },
826
+ // 架构添加组件后,将配置添加到config中
827
+ handleAddComponent (config) {
828
+ this.config.page.push(config)
829
+ this.refreshOrganization()
830
+ },
831
+ // 打开logic回调编辑弹框
832
+ openLogicCallbackEditor () {
833
+ if (!this.eventEditorContent.logicCallBackFunction) {
834
+ this.eventEditorContent.logicCallBackFunction = LogicCallBackFunctionTemplate
835
+ }
836
+ this.showLogicCallBackEditor = true
837
+ },
838
+ // 打开logic参数JS编辑器弹框
839
+ openLogicParamJSEditor () {
840
+ if (!this.eventEditorContent.logicParamJSFunction) {
841
+ this.eventEditorContent.logicParamJSFunction = LogicParamFunctionTemplate
842
+ }
843
+ this.showLogicParamJSEditor = true
844
+ },
845
+ // 刷新架构
846
+ refreshOrganization () {
847
+ this.showPageOrganization = false
848
+ this.$nextTick(() => {
849
+ this.showPageOrganization = true
850
+ })
851
+ },
852
+ // 拖拽完成后,将新的span赋值
853
+ handleDrag (targetEle, nextEle) {
854
+ const target = lowcodeUtils.getComponentConfig(targetEle.id, this.config.page)
855
+ const targetNext = lowcodeUtils.getComponentConfig(nextEle.id, this.config.page)
856
+ target.span = targetEle.span
857
+ targetNext.span = nextEle.span
858
+ },
859
+ // 删除组件
860
+ deleteComponentInTree (id, type) {
861
+ if (type === 'page') {
862
+ const page = lowcodeUtils.getPageConfigById(id, this.config)
863
+ this.deletePage(page)
864
+ } else if (type === 'component') {
865
+ this.deleteComponent(id)
866
+ } else if (type === 'row') {
867
+ this.deleteRow(id)
868
+ } else if (type === 'container_page') {
869
+ this.deleteContainerPage(id)
870
+ }
871
+ },
872
+ deleteContainerPage (id) {
873
+ console.warn('id', id)
874
+ const target = lowcodeUtils.getContainerPageOuterByContainerPageId(id, this.config)
875
+ console.warn('target', target)
876
+ target.type = 'container'
877
+ delete target.page
878
+ this.targetContainer = undefined
879
+ this.editorPropertiesConfig = {}
880
+ this.refreshOrganization()
881
+ },
882
+ // 删除行
883
+ deleteRow (id) {
884
+ const pageId = id.substring(0, id.length - 2)
885
+ const rowId = id.substring(id.length - 1)
886
+ const page = lowcodeUtils.getPageConfigById(pageId, this.config)
887
+ page.body.splice(rowId - 1, 1)
888
+ this.targetContainer = undefined
889
+ this.editorPropertiesConfig = {}
890
+ this.refreshOrganization()
891
+ },
892
+ // 删除页面容器
893
+ deletePage (page) {
894
+ console.warn('123', page)
895
+ page.body.forEach(row => {
896
+ row.forEach(item => {
897
+ if (item.type === 'container_page') {
898
+ this.deletePage(item.page)
899
+ } else {
900
+ delete this.$children[0]._provided.componentsMap[item.id]
901
+ }
902
+ })
903
+ })
904
+ for (let i = 0; i < this.config.page.length; i++) {
905
+ if (this.config.page[i].id === page.id) {
906
+ this.config.page.splice(i, 1)
907
+ this.targetContainer = undefined
908
+ this.editorPropertiesConfig = {}
909
+ this.refreshOrganization()
910
+ return
911
+ }
912
+ }
913
+ },
914
+ // 删除组件
915
+ deleteComponent (id, addOnSpan = true) {
916
+ const row = lowcodeUtils.getRowConfigByComponentId(id, this.config)
917
+ const target = lowcodeUtils.getComponentConfig(id, this.config)
918
+ const deletedSpan = target.span
919
+ let index
920
+ for (let i = 0; i < row.length; i++) {
921
+ if (target.id === row[i].id) {
922
+ index = i
923
+ break
924
+ }
925
+ }
926
+ row.splice(index, 1)
927
+ if (addOnSpan) {
928
+ // 如果该组件之前还有组件,将该组件的span加给之前的组件
929
+ if (index !== 0) {
930
+ row[index - 1].span += deletedSpan
931
+ } else if (row.length > 0) {
932
+ row[0].span += deletedSpan
933
+ }
934
+ }
935
+ // 从注册的全局Map中删除
936
+ delete this.$children[0]._provided.componentsMap[id]
937
+ this.targetContainer = undefined
938
+ this.editorPropertiesConfig = {}
939
+ this.refreshOrganization()
940
+ },
941
+ // 打开JS函数编辑器
942
+ openEventJSEditor () {
943
+ if (!this.eventEditorContent.JSFunction) {
944
+ this.eventEditorContent.JSFunction = JSEventFunctionTemplate
945
+ }
946
+ this.showJSEventEditor = true
947
+ },
948
+ openEventLifeCycleJSEditor () {
949
+ if (!this.eventEditorContent.LifeCycleFunction) {
950
+ this.eventEditorContent.LifeCycleFunction = LifeCycleFunctionTemplate
951
+ }
952
+ this.showLifeCycleFunctionEditor = true
953
+ },
954
+ // 事件编辑器中,点击编辑按钮
955
+ editEventIconClick (eventType, eventIndex) {
956
+ // 找到目标配置
957
+ const targetConfig = lowcodeUtils.getComponentConfig(this.editorPropertiesConfig.id, this.config.page)
958
+ // 将目标对应的配置赋值到事件编辑器缓存
959
+ this.eventEditorContent = { ...targetConfig.onEvent[eventType][eventIndex] }
960
+ this.eventEditorContent.emitType = eventType
961
+ this.eventEditorCurrent = {
962
+ type: eventType,
963
+ index: eventIndex
964
+ }
965
+ this.showEventEditor = true
966
+ },
967
+ // 删除事件
968
+ removeEventClick (eventType, eventIndex) {
969
+ const targetConfig = lowcodeUtils.getComponentConfig(this.editorPropertiesConfig.id, this.config.page)
970
+ targetConfig.onEvent[eventType].splice(eventIndex, 1)
971
+ if (targetConfig.onEvent[eventType].length === 0) {
972
+ delete targetConfig.onEvent[eventType]
973
+ }
974
+ this.$forceUpdate()
975
+ },
976
+ // 添加事件
977
+ addEvent () {
978
+ this.showEventEditor = true
979
+ },
980
+ // 获取所有注册组件
981
+ getAllRenderedComponents () {
982
+ const IDs = Object.keys(this.$children[0]._provided.componentsMap)
983
+ const result = []
984
+ IDs.forEach(id => {
985
+ const config = lowcodeUtils.getConfig(id, this.config)
986
+ if (config.name) {
987
+ result.push(config.name)
988
+ } else {
989
+ result.push(config.id)
990
+ }
991
+ })
992
+ return result
993
+ },
994
+ // 容器删除
995
+ handleContainerDelete (id) {
996
+ let index
997
+ const row = lowcodeUtils.getRowConfigByComponentId(id, this.config)
998
+ for (let i = 0; i < row.length; i++) {
999
+ const item = row[i]
1000
+ if (item.id === id) {
1001
+ index = i
1002
+ break
1003
+ }
1004
+ }
1005
+ row.splice(index, 1)
1006
+ this.targetContainer = undefined
1007
+ // 如果删除后只剩一个容器,将该容器span设置为24
1008
+ if (row.length === 1) {
1009
+ row[0].span = 24
1010
+ }
1011
+ this.refreshOrganization()
1012
+ },
1013
+ // 事件编辑器点击完成
1014
+ handleEventEditorOk () {
1015
+ let emitTypeKey = this.eventEditorContent.emitType
1016
+ // 是否是自定义事件触发
1017
+ if (this.eventEditorContent.customEmitType) {
1018
+ emitTypeKey = this.eventEditorContent.customEmitType
1019
+ }
1020
+ // 如果当前是回显事件
1021
+ if (this.eventEditorCurrent) {
1022
+ const targetConfig = lowcodeUtils.getComponentConfig(this.editorPropertiesConfig.id, this.config.page)
1023
+ targetConfig.onEvent[this.eventEditorCurrent.type][this.eventEditorCurrent.index] = { ...this.eventEditorContent }
1024
+ } else {
1025
+ // 当前是新增事件
1026
+ const target = lowcodeUtils.getComponentConfig(this.editorPropertiesConfig.id, this.config.page)
1027
+ // 如果没有onEvent属性则初始化
1028
+ if (!target.onEvent) {
1029
+ target.onEvent = {}
1030
+ }
1031
+ // 如果当前触发类型没有初始化,则初始化
1032
+ if (!target.onEvent[emitTypeKey]) {
1033
+ target.onEvent[emitTypeKey] = []
1034
+ }
1035
+ // 将缓存的事件属性赋值
1036
+ target.onEvent[emitTypeKey].push({
1037
+ ...this.eventEditorContent
1038
+ })
1039
+ }
1040
+ this.showEventEditor = false
1041
+ this.eventEditorContent = {}
1042
+ this.eventEditorCurrent = undefined
1043
+ },
1044
+ // 关闭事件编辑器弹框
1045
+ handleEventEditorCancel () {
1046
+ this.showEventEditor = false
1047
+ this.eventEditorContent = {}
1048
+ this.eventEditorCurrent = undefined
1049
+ },
1050
+ // 事件编辑器中,触发类型改变
1051
+ handleEventEditorTypeChange (type) {
1052
+ this.eventEditorContent.emitType = type
1053
+ this.$forceUpdate()
1054
+ },
1055
+ // 事件编辑器中,目标组件改变
1056
+ handleEventEditorTargetChange (target) {
1057
+ this.eventEditorContent.target = target
1058
+ this.$forceUpdate()
1059
+ },
1060
+ handleEventEditorLifeCycleChange (lifeCycleName) {
1061
+ this.eventEditorContent.lifeCycle = lifeCycleName
1062
+ },
1063
+ // 事件编辑器中,事件类型改变
1064
+ handleEventEditorEventTypeChange (type) {
1065
+ const componentsMap = this.$children[0]._provided.componentsMap
1066
+ this.eventEditorContent.eventType = type
1067
+ this.logicParamTransferDataSource = []
1068
+ // 如果事件为运行Logic将组件加入穿梭框
1069
+ if (type === 'runLogic') {
1070
+ const keys = Object.keys(componentsMap)
1071
+ keys.forEach(key => {
1072
+ const name = lowcodeUtils.getComponentNameById(key, this.config)
1073
+ this.logicParamTransferDataSource.push({
1074
+ key: key,
1075
+ title: name,
1076
+ })
1077
+ })
1078
+ this.eventEditorContent.logicParamTransfer = []
1079
+ }
1080
+ this.$forceUpdate()
1081
+ },
1082
+ // 事件编辑器中,目标组件执行事件类型改变
1083
+ handleEventEditorTargetEventTypeChange (type) {
1084
+ this.eventEditorContent.eventName = type
1085
+ this.$forceUpdate()
1086
+ },
1087
+ // 自定义JS方法弹框确认
1088
+ handleJSEventEditorOk () {
1089
+ this.showJSEventEditor = false
1090
+ },
1091
+ // 自定义JS方法弹框关闭
1092
+ handleJSEventEditorCancel () {
1093
+ this.showJSEventEditor = false
1094
+ },
1095
+ // 添加组件到容器中
1096
+ addComponentToContainer (type) {
1097
+ // 如果没有选中容器
1098
+ if (!this.targetContainer) {
1099
+ this.$message.error('请先选择目标容器!')
1100
+ this.targetContainer = undefined
1101
+ return
1102
+ }
1103
+ // 获取选中的容器
1104
+ const target = lowcodeUtils.getComponentConfig(this.targetContainer.id, this.config.page)
1105
+ // 将容器的类型和id改变
1106
+ target.type = type
1107
+ target.id = target.type + '_' + lowcodeUtils.nanoidWithoutSymbol(6)
1108
+ this.targetContainer = undefined
1109
+ this.refreshOrganization()
1110
+ },
1111
+ // 添加容器
1112
+ addContainer () {
1113
+ // 如果目标不是一个容器
1114
+ if (!this.targetContainer) {
1115
+ // 如果没有指定页面容器,则直接报错
1116
+ if (this.activeMainPage === undefined) {
1117
+ this.$message.error('未选中任何工作空间!')
1118
+ return
1119
+ }
1120
+ // 获取当前选中的页面容器
1121
+ let targetIndex = this.activeMainPage
1122
+ for (let i = 0; i < this.config.page.length; i++) {
1123
+ if (this.config.page[i].id === this.activeMainPage) {
1124
+ targetIndex = i
1125
+ break
1126
+ }
1127
+ }
1128
+ // 如果是page类型,添加两个容器。其他类型添加一个容器
1129
+ if (this.config.page[targetIndex].type === 'page') {
1130
+ this.config.page[targetIndex].body.push([
1131
+ {
1132
+ type: 'container_page',
1133
+ span: 24,
1134
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6),
1135
+ page: [
1136
+ {
1137
+ id: 'container_page_' + lowcodeUtils.nanoidWithoutSymbol(6),
1138
+ type: 'page',
1139
+ body: [
1140
+ [
1141
+ {
1142
+ type: 'container',
1143
+ span: 12,
1144
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
1145
+ },
1146
+ {
1147
+ type: 'container',
1148
+ span: 12,
1149
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
1150
+ },
1151
+ ]
1152
+ ]
1153
+ }
1154
+ ]
1155
+ }
1156
+ ])
1157
+ } else {
1158
+ this.config.page[targetIndex].body.push([{
1159
+ type: 'container',
1160
+ span: 24,
1161
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
1162
+ }])
1163
+ }
1164
+ } else {
1165
+ // 如果目标是容器
1166
+ const row = lowcodeUtils.getRowConfigByComponentId(this.targetContainer.id, this.config)
1167
+ const targetInRowIndex = lowcodeUtils.getComponentInRowIndex(this.targetContainer.id, this.config)
1168
+ const targetItem = lowcodeUtils.getComponentConfig(this.targetContainer.id, this.config)
1169
+ const maxWidth = targetItem.span
1170
+ // 确认是水平拆分还是垂直拆分
1171
+ this.$confirm({
1172
+ content: '是否为水平拆分',
1173
+ onOk: () => {
1174
+ // 将目标容器一分为二
1175
+ row.splice(targetInRowIndex, 1, {
1176
+ type: 'container',
1177
+ span: Math.floor(maxWidth / 2),
1178
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
1179
+ }, {
1180
+ type: 'container',
1181
+ span: Math.ceil(maxWidth / 2),
1182
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
1183
+ })
1184
+ this.targetContainer = undefined
1185
+ this.refreshOrganization()
1186
+ },
1187
+ onCancel: () => {
1188
+ targetItem.type = 'container_page'
1189
+ targetItem.page = [{
1190
+ id: 'container_page_' + lowcodeUtils.nanoidWithoutSymbol(6),
1191
+ type: 'page',
1192
+ body: [
1193
+ [{
1194
+ type: 'container',
1195
+ span: 24,
1196
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
1197
+ }],
1198
+ [{
1199
+ type: 'container',
1200
+ span: 24,
1201
+ id: 'container_' + lowcodeUtils.nanoidWithoutSymbol(6)
1202
+ }]
1203
+ ]
1204
+ }]
1205
+ this.targetContainer = undefined
1206
+ this.refreshOrganization()
1207
+ }
1208
+ })
1209
+ }
1210
+ this.refreshOrganization()
1211
+ },
1212
+ // 获取所有已注册组件,用于添加至UI库
1213
+ getRegisteredComponents () {
1214
+ return Object.keys(registeredRender)
1215
+ },
1216
+ // 组件属性编辑
1217
+ editorPropertiesInputChange (event, key) {
1218
+ this.renderPreview = false
1219
+ this.renderModalPreview = false
1220
+ this.renderDrawPreview = false
1221
+ // 如果当前有定时器,清除该定时器,并设置新的定时器
1222
+ // 也就是说:每次操作间隔指定时间后才会触发更新
1223
+ // 如果在此期间又进行了操作,则重新开始计时
1224
+ if (this.inputTimeout) {
1225
+ clearTimeout(this.inputTimeout)
1226
+ }
1227
+ this.inputTimeout = setTimeout(() => {
1228
+ const target = lowcodeUtils.getComponentConfig(this.editorPropertiesConfig.id, this.config.page)
1229
+ lowcodeLog('组件属性修改', '触发更新', target.id, true, false)
1230
+ // 拿到组件注册的配置
1231
+ const editorConfig = lowcodeUtils.getEditorConfigById(this.editorPropertiesConfig.id, this.config.page)
1232
+ // 根据类型,将input框中的内容赋值
1233
+ if (editorConfig.properties[key].type === 'object') {
1234
+ target.props[key] = JSON.parse(event.target.value)
1235
+ } else if (editorConfig.properties[key].type === 'string') {
1236
+ target.props[key] = event.target.value
1237
+ } else if (editorConfig.properties[key].type === 'boolean') {
1238
+ const input = event.target.value.toLowerCase()
1239
+ target.props[key] = input === 'true' || input !== '0'
1240
+ }
1241
+ this.renderPreview = true
1242
+ this.renderModalPreview = true
1243
+ this.renderDrawPreview = true
1244
+ }, 1500)
1245
+ },
1246
+ // 切换预览模式
1247
+ previewModeActive () {
1248
+ // TODO 新标签页中预览
1249
+ // const params = {
1250
+ // config: this.config
1251
+ // }
1252
+ // const routeData = this.$router.resolve({
1253
+ // path: '/lowCodeReview',
1254
+ // query: params
1255
+ // })
1256
+ // window.open(routeData.location.path, '_blank')
1257
+ this.preview = true
1258
+ },
1259
+ // 切换编辑模式
1260
+ editModeActive () {
1261
+ this.preview = false
1262
+ },
1263
+ // 选中某个组件
1264
+ clickComponentInEditor (configItem) {
1265
+ this.editorPropertiesConfig = {}
1266
+ // 如果选中的是容器
1267
+ if (configItem.type === 'container') {
1268
+ // 如果已经选中,则反选,selected属性用于改变容器样式
1269
+ if (configItem.selected) {
1270
+ configItem.selected = false
1271
+ this.targetContainer = undefined
1272
+ } else {
1273
+ // 将所有已选中组件取消选择
1274
+ lowcodeUtils.unCheckAll(this.config)
1275
+ // 将目标设置为选定
1276
+ configItem.selected = true
1277
+ this.targetContainer = configItem
1278
+ }
1279
+ return
1280
+ }
1281
+ // 如果是组件对象
1282
+ // 拿注册的配置
1283
+ const configInJson = lowcodeUtils.getEditorConfigByType(configItem.type)
1284
+ if (configInJson) {
1285
+ this.editorPropertiesConfig = configItem
1286
+ // 为编辑器变量初始化
1287
+ if (configInJson.properties) {
1288
+ if (!this.editorPropertiesConfig.props) {
1289
+ this.editorPropertiesConfig.props = {}
1290
+ }
1291
+ const editableKeys = Object.keys(configInJson.properties)
1292
+ editableKeys.forEach(editableKey => {
1293
+ // 如果该值并不存在,则初始化
1294
+ if (!this.editorPropertiesConfig.props[editableKey]) {
1295
+ this.editorPropertiesConfig.props[editableKey] = ''
1296
+ } else {
1297
+ if (typeof this.editorPropertiesConfig.props[editableKey] === 'object') {
1298
+ this.editorPropertiesConfig.props[editableKey] = JSON.stringify(this.editorPropertiesConfig.props[editableKey])
1299
+ }
1300
+ }
1301
+ })
1302
+ }
1303
+ // 为编辑器事件初始化
1304
+ if (configInJson.selfEvent) {
1305
+ if (!this.editorPropertiesConfig.selfEvent) {
1306
+ this.editorPropertiesConfig.selfEvent = []
1307
+ configInJson.selfEvent.forEach(everyEvent => {
1308
+ this.editorPropertiesConfig.selfEvent.push(everyEvent)
1309
+ })
1310
+ }
1311
+ }
1312
+ } else {
1313
+ this.editorPropertiesConfig = 'unregistered'
1314
+ }
1315
+ },
1316
+ // 点击测试按钮
1317
+ test () {
1318
+ // 输出当前配置,和组件注册Map
1319
+ console.warn('config', this.config)
1320
+ console.warn('map', this.$children[0]._provided.componentsMap)
1321
+ },
1322
+ // 点击导出按钮
1323
+ exportConfig () {
1324
+ console.warn('导出', this.config)
1325
+ this.$emit('exportConfig', this.config)
1326
+ }
1327
+ },
1328
+ mounted () {
1329
+ // 将mixin中已经实现的通用响应方法添加
1330
+ this.supportedEventType = [...lowcodeComponentMixin.supportedEventType]
1331
+ // 深拷贝外侧传来的配置
1332
+ this.config = JSON.parse(JSON.stringify(this.originalConfig))
1333
+ // this.config = {
1334
+ // page: [
1335
+ // {
1336
+ // id: 'page_KBjw2i',
1337
+ // type: 'page',
1338
+ // title: '111',
1339
+ // body: [
1340
+ // [
1341
+ // {
1342
+ // type: 'XFormTable',
1343
+ // span: 12,
1344
+ // id: 'XFormTable_BV6Nwk',
1345
+ // selected: false,
1346
+ // props: {
1347
+ // queryParamsName: '',
1348
+ // serviceName: ''
1349
+ // },
1350
+ // selfEvent: [
1351
+ // 'action'
1352
+ // ]
1353
+ // },
1354
+ // {
1355
+ // type: 'XAddNativeForm',
1356
+ // span: 12,
1357
+ // id: 'XAddNativeForm_ekihTp',
1358
+ // selected: false,
1359
+ // props: {
1360
+ // configNameForLowCode: '',
1361
+ // systemNameForLowCode: ''
1362
+ // },
1363
+ // selfEvent: [
1364
+ // 'onSubmit'
1365
+ // ]
1366
+ // }
1367
+ // ],
1368
+ // [
1369
+ // {
1370
+ // type: 'XTreeOne',
1371
+ // span: 12,
1372
+ // id: 'XTreeOne_szu7Al',
1373
+ // selected: false
1374
+ // },
1375
+ // {
1376
+ // type: 'XDescriptions',
1377
+ // span: 12,
1378
+ // id: 'XDescriptions_DTkbEg',
1379
+ // selected: false,
1380
+ // props: {
1381
+ // title: '111',
1382
+ // content: {
1383
+ // c_f_user_phone: '2323',
1384
+ // c_f_total_fee: 33356,
1385
+ // c_f_address: '22',
1386
+ // c_f_meterlen: 2,
1387
+ // c_f_bank_card_number: '23',
1388
+ // c_f_create_user: '超级管理员',
1389
+ // c_f_customer: '23',
1390
+ // c_f_balance: 33356,
1391
+ // c_f_create_date: '2024-06-23 21:31:24',
1392
+ // c_f_operator_date: '2024-06-23 21:31:24',
1393
+ // c_f_total_times: 2,
1394
+ // c_f_user_name: '23',
1395
+ // c_f_comments: '323',
1396
+ // c_id: 39,
1397
+ // c_f_operatorid: '15',
1398
+ // c_f_operator: '超级管理员',
1399
+ // c_f_orgid: '9'
1400
+ // },
1401
+ // configName: 'Unit_Desc_Config',
1402
+ // serviceName: 'af-revenue',
1403
+ // getRealData: true
1404
+ // },
1405
+ // selfEvent: []
1406
+ // }
1407
+ // ]
1408
+ // ]
1409
+ // },
1410
+ // {
1411
+ // id: 'page_FgItf6',
1412
+ // type: 'page',
1413
+ // title: '22',
1414
+ // body: [
1415
+ // [
1416
+ // {
1417
+ // type: 'container',
1418
+ // span: 4,
1419
+ // id: 'container_ir2gR2',
1420
+ // selected: false
1421
+ // },
1422
+ // {
1423
+ // type: 'container_page',
1424
+ // span: 10,
1425
+ // id: 'container_xIRHGg',
1426
+ // selected: true,
1427
+ // page: [
1428
+ // {
1429
+ // id: 'container_page_IgYw9u',
1430
+ // type: 'page',
1431
+ // body: [
1432
+ // [
1433
+ // {
1434
+ // type: 'container',
1435
+ // span: 24,
1436
+ // id: 'container_tqVFCL'
1437
+ // }
1438
+ // ],
1439
+ // [
1440
+ // {
1441
+ // type: 'container',
1442
+ // span: 24,
1443
+ // id: 'container_i8VXCZ'
1444
+ // }
1445
+ // ]
1446
+ // ]
1447
+ // }
1448
+ // ]
1449
+ // },
1450
+ // {
1451
+ // type: 'container',
1452
+ // span: 10,
1453
+ // id: 'container_PT9n3Q',
1454
+ // selected: false
1455
+ // }
1456
+ // ],
1457
+ // [
1458
+ // {
1459
+ // type: 'container',
1460
+ // span: 18,
1461
+ // id: 'container_q04vQr',
1462
+ // selected: false
1463
+ // },
1464
+ // {
1465
+ // type: 'container',
1466
+ // span: 6,
1467
+ // id: 'container_MKwNvz',
1468
+ // selected: false
1469
+ // }
1470
+ // ]
1471
+ // ]
1472
+ // }
1473
+ // ]
1474
+ // }
1475
+ this.refreshOrganization()
1476
+ }
1477
+ }
1478
+ </script>
1479
+
1480
+ <style scoped lang="less">
1481
+ .ui-item:hover {
1482
+ cursor: pointer;
1483
+ }
1484
+
1485
+ .ui-item{
1486
+ width: 100%;
1487
+ height:10%;
1488
+ text-align: center;
1489
+ overflow-wrap: break-word;
1490
+ padding: 7%
1491
+ }
1492
+
1493
+ .singleEvent {
1494
+ border: black dashed 1px;
1495
+ padding: 10%;
1496
+ }
1497
+
1498
+ .edit_icon:hover {
1499
+ cursor: pointer;
1500
+ }
1501
+ </style>