sun-form-v3 1.0.64 → 1.0.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -5
- package/src/App.vue +9 -0
- package/src/assets/font/YouSheBiaoTiHei-2.ttf +0 -0
- package/src/assets/font/demo.css +539 -0
- package/src/assets/font/demo_index.html +1200 -0
- package/src/assets/font/iconfont.css +191 -0
- package/src/assets/font/iconfont.js +1 -0
- package/src/assets/font/iconfont.json +317 -0
- package/src/assets/font/iconfont.ttf +0 -0
- package/src/assets/font/iconfont.woff +0 -0
- package/src/assets/font/iconfont.woff2 +0 -0
- package/src/assets/img/bg_footer.png +0 -0
- package/src/assets/img/bg_title.png +0 -0
- package/src/assets/img/file.png +0 -0
- package/src/assets/img/logo.png +0 -0
- package/src/assets/img/logo2.png +0 -0
- package/src/assets/img/logo22.png +0 -0
- package/src/assets/img/logo23.png +0 -0
- package/src/assets/img/logo3.png +0 -0
- package/src/assets/img//347/237/251/345/275/242@2x.png +0 -0
- package/src/assets/logo.svg +1 -0
- package/src/assets/styles/element/index.scss +15 -0
- package/src/assets/styles/index.css +3 -0
- package/src/components/a.js +14 -0
- package/src/components/aDesigner/config.vue +127 -0
- package/src/components/aDesigner/design.vue +21 -0
- package/src/components/aDesigner/designer.js +342 -0
- package/src/components/aDesigner/http.js +292 -0
- package/src/components/aDesigner/index.vue +144 -0
- package/src/components/aDesigner/panel.vue +144 -0
- package/src/components/aDesigner/show.vue +24 -0
- package/src/components/widgetCommonComps/commonApiConfig/index.vue +194 -0
- package/src/components/widgetCommonComps/commonCard/index.vue +36 -0
- package/src/components/widgetCommonComps/commonCodeEditor/editor.vue +219 -0
- package/src/components/widgetCommonComps/commonCodeEditor/modalEditor.vue +68 -0
- package/src/components/widgetCommonComps/commonCollapseCard/index.vue +10 -0
- package/src/components/widgetCommonComps/commonContainer/index.vue +95 -0
- package/src/components/widgetCommonComps/commonJsonInput/index.vue +59 -0
- package/src/components/widgetCommonComps/commonLabelContainer/index.vue +39 -0
- package/src/components/widgetCommonComps/commonSidetree/index.vue +61 -0
- package/src/components/widgetCommonComps/commonTypeInput/index.vue +75 -0
- package/src/components/widgetCommonComps/commonWidgetLabelContainer/index.vue +55 -0
- package/src/components/widgetCommonComps/index copy.js +17 -0
- package/src/components/widgetCommonComps/index.js +17 -0
- package/src/components/widgetConfigComps/config-input/index.vue +60 -0
- package/src/components/widgetConfigComps/index copy.js +13 -0
- package/src/components/widgetConfigComps/index.js +17 -0
- package/src/components/widgetShowComps/index.js +29 -0
- package/src/components/widgetShowComps/widget-form/index.vue +43 -0
- package/src/components/widgetShowComps/widget-homepage/index.vue +41 -0
- package/src/components/widgetShowComps/widget-input/index.vue +85 -0
- package/src/components/widgetShowComps/widget-select/index.vue +31 -0
- package/src/designer.js +342 -0
- package/src/http.js +292 -0
- package/src/index.js +24 -0
- package/src/index2.js +23 -0
- package/src/main.js +19 -0
- package/src/remark.js +708 -0
- package/src/testBtn.vue +11 -0
- package/src/testInput.vue +12 -0
- package/src/util/jsformat.js +568 -0
- package/src/widgetConfig.js +1112 -0
- package/dist/abap-DfvySaIJ.js +0 -1404
- package/dist/apex-B__0irD3.js +0 -332
- package/dist/assets/css.worker-OK053IOu.js +0 -84
- package/dist/assets/editor.worker-D9iUZyMP.js +0 -11
- package/dist/assets/html.worker-CL40hqKM.js +0 -458
- package/dist/assets/json.worker-6f9bhSHY.js +0 -42
- package/dist/assets/ts.worker-B6g3wjaE.js +0 -37021
- package/dist/azcli-CDMGhRmx.js +0 -74
- package/dist/bat-0Mk8aqzx.js +0 -106
- package/dist/bicep-BBi_I06Z.js +0 -108
- package/dist/cameligo-D0G_Zm6X.js +0 -180
- package/dist/clojure-o2ZKLeMp.js +0 -767
- package/dist/coffee-DOQff5VC.js +0 -238
- package/dist/cpp-CQGJnWhD.js +0 -395
- package/dist/csharp-C1jLsHl8.js +0 -332
- package/dist/csp-C_ttMQaW.js +0 -59
- package/dist/css-BC202kVV.js +0 -193
- package/dist/cssMode-BJ__hlmh.js +0 -1541
- package/dist/cypher-DwtEH7Fi.js +0 -269
- package/dist/dart-D9XknsP2.js +0 -287
- package/dist/dockerfile-DgsNjqqa.js +0 -136
- package/dist/ecl-BAMCHBl6.js +0 -462
- package/dist/elixir-CegIttP8.js +0 -575
- package/dist/favicon.ico +0 -0
- package/dist/flow9-9608t7UV.js +0 -148
- package/dist/freemarker2-CoLsQjW7.js +0 -995
- package/dist/fsharp-CCtt9-1_.js +0 -223
- package/dist/go-CGUIPbct.js +0 -224
- package/dist/graphql-BNRIFFIn.js +0 -157
- package/dist/handlebars-BX8CH7kP.js +0 -425
- package/dist/hcl-C__KLIXe.js +0 -189
- package/dist/html-CzRNAVFz.js +0 -314
- package/dist/htmlMode-D1rYdg3M.js +0 -1551
- package/dist/index-DmlyKQU2.js +0 -150
- package/dist/index2-CFFJfReU.js +0 -123480
- package/dist/ini-CeKYn_zA.js +0 -77
- package/dist/java-Dm24deQl.js +0 -238
- package/dist/javascript-D8qja2YK.js +0 -76
- package/dist/jsonMode-Ba3FSlH9.js +0 -1957
- package/dist/julia-BImNW7VE.js +0 -517
- package/dist/kotlin-BfE79GEb.js +0 -259
- package/dist/less-DglNOcaC.js +0 -168
- package/dist/lexon-BA0dRz9Q.js +0 -163
- package/dist/liquid-Dk9PEfYJ.js +0 -246
- package/dist/lua-DMkWzJcm.js +0 -168
- package/dist/m3-sA-5shO8.js +0 -216
- package/dist/markdown-OYRB1igA.js +0 -235
- package/dist/mdx-BYQIXNzg.js +0 -171
- package/dist/mips-rRzkJ_7G.js +0 -204
- package/dist/msdax-DoVJdUhd.js +0 -381
- package/dist/mysql-Ty44IHXo.js +0 -884
- package/dist/objective-c-VUfyhYrA.js +0 -189
- package/dist/pascal-DkASiYyw.js +0 -257
- package/dist/pascaligo-p-ELPlVO.js +0 -170
- package/dist/perl-Cjl1FxLZ.js +0 -632
- package/dist/pgsql-DjVenF7s.js +0 -857
- package/dist/php-CwvGzZOO.js +0 -506
- package/dist/pla-Br1iaBIV.js +0 -143
- package/dist/postiats-BaeP8zZY.js +0 -913
- package/dist/powerquery-CLCshuo8.js +0 -896
- package/dist/powershell-CZV50w5N.js +0 -245
- package/dist/protobuf-MV3XTewJ.js +0 -426
- package/dist/pug-DkDg4c4l.js +0 -408
- package/dist/python-nr__0oHi.js +0 -282
- package/dist/qsharp-BAtiKA97.js +0 -291
- package/dist/r-8ocrd-h-.js +0 -249
- package/dist/razor-BhxZaYa0.js +0 -556
- package/dist/redis-9sZiddxc.js +0 -308
- package/dist/redshift-DQfTOGC0.js +0 -815
- package/dist/restructuredtext-DXU-vkgr.js +0 -180
- package/dist/ruby-DotfqwMf.js +0 -517
- package/dist/rust-BIauJ5KN.js +0 -349
- package/dist/sb-CmWMvDEV.js +0 -121
- package/dist/scala-C81brEbk.js +0 -376
- package/dist/scheme-D0pcFz2x.js +0 -114
- package/dist/scss-BOdN2fGG.js +0 -268
- package/dist/shell-6E09eAkU.js +0 -227
- package/dist/solidity-CWStzA1K.js +0 -1373
- package/dist/sophia-76Sb6CWe.js +0 -205
- package/dist/sparql-BmZTkOWT.js +0 -207
- package/dist/sql-Cs9TBAW5.js +0 -859
- package/dist/st-B-rqE1Bu.js +0 -422
- package/dist/style.css +0 -1
- package/dist/sun-form-v3.es.js +0 -4
- package/dist/sun-form-v3.umd.js +0 -1908
- package/dist/swift-Btsj6YxQ.js +0 -318
- package/dist/systemverilog-B3RHBRa2.js +0 -582
- package/dist/tcl-Dpj776pn.js +0 -238
- package/dist/tsMode-B5V7dylO.js +0 -886
- package/dist/twig-Bb9JmBsE.js +0 -398
- package/dist/typescript-Cvb4NK72.js +0 -349
- package/dist/typespec-CDWeg3SU.js +0 -123
- package/dist/vb-DEXnYwEI.js +0 -378
- package/dist/wgsl-D602c1lx.js +0 -445
- package/dist/xml-D833w0Hk.js +0 -101
- package/dist/yaml-BEai5aLa.js +0 -212
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import axios from 'axios'
|
|
2
|
+
import qs from 'qs'
|
|
3
|
+
import {
|
|
4
|
+
ElNotification
|
|
5
|
+
} from 'element-plus'
|
|
6
|
+
/**
|
|
7
|
+
* Http类用于封装HTTP请求
|
|
8
|
+
* 提供了多种请求方法,如GET、POST、PUT、DELETE等
|
|
9
|
+
* 支持设置基础URL、请求头、超时时间等选项
|
|
10
|
+
* 可以自定义请求成功和失败的处理函数
|
|
11
|
+
*/
|
|
12
|
+
class Http {
|
|
13
|
+
/**
|
|
14
|
+
* 构造函数初始化Http对象
|
|
15
|
+
* @param {Object} options 配置选项,包括baseUrl、headers、timeout、httpSuccessHandle、httpErrorHandle、httpBeforeSendHandle
|
|
16
|
+
*/
|
|
17
|
+
constructor({
|
|
18
|
+
baseUrl = "",
|
|
19
|
+
headers = {},
|
|
20
|
+
timeout = 1000000,
|
|
21
|
+
httpSuccessHandle = null,
|
|
22
|
+
httpErrorHandle = null,
|
|
23
|
+
httpBeforeSendHandle = null
|
|
24
|
+
}) {
|
|
25
|
+
this.options = {
|
|
26
|
+
baseUrl,
|
|
27
|
+
headers,
|
|
28
|
+
timeout,
|
|
29
|
+
httpSuccessHandle,
|
|
30
|
+
httpErrorHandle,
|
|
31
|
+
httpBeforeSendHandle
|
|
32
|
+
}
|
|
33
|
+
// 定义不同Content-Type的headers
|
|
34
|
+
this.formDataHeader = {
|
|
35
|
+
'Content-Type': 'application/x-www-form-urlencoded'
|
|
36
|
+
}
|
|
37
|
+
this.formFileHeader = {
|
|
38
|
+
'Content-Type': 'multipart/form-data'
|
|
39
|
+
}
|
|
40
|
+
this.jsonHeader = {
|
|
41
|
+
'Content-Type': 'application/json'
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 处理请求参数
|
|
47
|
+
* @param {any} data 请求参数
|
|
48
|
+
* @returns 处理后的请求参数
|
|
49
|
+
*/
|
|
50
|
+
paramHandle(data) {
|
|
51
|
+
// 如果data是数组,直接返回
|
|
52
|
+
if (data instanceof Array) {
|
|
53
|
+
return data;
|
|
54
|
+
}
|
|
55
|
+
// 如果data不是对象,直接返回
|
|
56
|
+
if (typeof data !== 'object') {
|
|
57
|
+
return data
|
|
58
|
+
}
|
|
59
|
+
// 如果data存在,返回合并后的对象
|
|
60
|
+
if (data) {
|
|
61
|
+
return Object.assign({}, this.httpBeforeSendHandle ? this.httpBeforeSendHandle() || {} : {}, data)
|
|
62
|
+
} else {
|
|
63
|
+
// 如果data不存在,仅返回httpBeforeSendHandle处理的结果
|
|
64
|
+
return this.httpBeforeSendHandle()
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 发送请求
|
|
70
|
+
* @param {Object} config 请求配置,包括url、method、params、data、headers等
|
|
71
|
+
* @returns 返回axios发送请求的Promise
|
|
72
|
+
*/
|
|
73
|
+
send(config) {
|
|
74
|
+
// 创建axios实例
|
|
75
|
+
const api = axios.create({
|
|
76
|
+
baseURL: this.options.baseUrl,
|
|
77
|
+
timeout: this.options.timeout,
|
|
78
|
+
responseType: 'json'
|
|
79
|
+
})
|
|
80
|
+
// 请求拦截器,设置请求头
|
|
81
|
+
api.interceptors.request.use(
|
|
82
|
+
request => {
|
|
83
|
+
if (this.options.headers) {
|
|
84
|
+
for (var key in this.options.headers) {
|
|
85
|
+
request.headers[key] = headers[key]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return request
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
// 响应拦截器,处理请求成功和失败的情况
|
|
92
|
+
api.interceptors.response.use(
|
|
93
|
+
response => {
|
|
94
|
+
if (this.options.httpSuccessHandle) {
|
|
95
|
+
this.options.httpSuccessHandle(response.data)
|
|
96
|
+
}
|
|
97
|
+
return Promise.resolve(response.data)
|
|
98
|
+
},
|
|
99
|
+
error => {
|
|
100
|
+
if (this.options.httpErrorHandle) {
|
|
101
|
+
this.options.httpErrorHandle(error)
|
|
102
|
+
}
|
|
103
|
+
ElNotification({
|
|
104
|
+
title: '消息',
|
|
105
|
+
message: '数据请求失败',
|
|
106
|
+
type: 'error'
|
|
107
|
+
})
|
|
108
|
+
return Promise.reject(error)
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
// 发送请求
|
|
112
|
+
return api(config)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 发送GET请求
|
|
117
|
+
* @param {string} url 请求URL
|
|
118
|
+
* @param {any} data 请求参数
|
|
119
|
+
* @param {Object} headers 请求头
|
|
120
|
+
* @returns 返回发送GET请求的Promise
|
|
121
|
+
*/
|
|
122
|
+
get(url, data, headers) { //get请求
|
|
123
|
+
return this.send({
|
|
124
|
+
url: url,
|
|
125
|
+
method: 'get',
|
|
126
|
+
params: this.paramHandle(data),
|
|
127
|
+
headers: headers
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* 发送GET请求,返回Blob类型数据
|
|
133
|
+
* @param {string} url 请求URL
|
|
134
|
+
* @param {any} data 请求参数
|
|
135
|
+
* @param {Object} headers 请求头
|
|
136
|
+
* @returns 返回发送GET请求的Promise
|
|
137
|
+
*/
|
|
138
|
+
getBlob(url, data, headers) { //get请求
|
|
139
|
+
return this.send({
|
|
140
|
+
url: url,
|
|
141
|
+
method: 'get',
|
|
142
|
+
responseType: 'blob',
|
|
143
|
+
params: this.paramHandle(data),
|
|
144
|
+
headers: headers
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* 发送POST请求
|
|
150
|
+
* @param {string} url 请求URL
|
|
151
|
+
* @param {any} data 请求参数
|
|
152
|
+
* @param {Object} headers 请求头
|
|
153
|
+
* @returns 返回发送POST请求的Promise
|
|
154
|
+
*/
|
|
155
|
+
post(url, data, headers = {}) { //post请求
|
|
156
|
+
return this.send({
|
|
157
|
+
url: url,
|
|
158
|
+
method: 'post',
|
|
159
|
+
data: this.paramHandle(data),
|
|
160
|
+
headers: {
|
|
161
|
+
...headers,
|
|
162
|
+
...this.jsonHeader
|
|
163
|
+
}
|
|
164
|
+
})
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* 发送PUT请求
|
|
169
|
+
* @param {string} url 请求URL
|
|
170
|
+
* @param {any} data 请求参数
|
|
171
|
+
* @param {Object} headers 请求头
|
|
172
|
+
* @returns 返回发送PUT请求的Promise
|
|
173
|
+
*/
|
|
174
|
+
put(url, data, headers) { //put请求
|
|
175
|
+
return this.send({
|
|
176
|
+
url: url,
|
|
177
|
+
method: 'put',
|
|
178
|
+
data: this.paramHandle(data),
|
|
179
|
+
headers: headers
|
|
180
|
+
})
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* 发送PATCH请求
|
|
185
|
+
* @param {string} url 请求URL
|
|
186
|
+
* @param {any} data 请求参数
|
|
187
|
+
* @param {Object} headers 请求头
|
|
188
|
+
* @returns 返回发送PATCH请求的Promise
|
|
189
|
+
*/
|
|
190
|
+
patch(url, data, headers) { //patch请求
|
|
191
|
+
return this.send({
|
|
192
|
+
url: url,
|
|
193
|
+
method: 'patch',
|
|
194
|
+
data: this.paramHandle(data),
|
|
195
|
+
headers: headers
|
|
196
|
+
})
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* 发送DELETE请求
|
|
201
|
+
* @param {string} url 请求URL
|
|
202
|
+
* @param {any} data 请求参数
|
|
203
|
+
* @param {Object} headers 请求头
|
|
204
|
+
* @returns 返回发送DELETE请求的Promise
|
|
205
|
+
*/
|
|
206
|
+
delete(url, data, headers) { //delete请求
|
|
207
|
+
return this.send({
|
|
208
|
+
url: url,
|
|
209
|
+
method: 'delete',
|
|
210
|
+
params: this.paramHandle(data),
|
|
211
|
+
headers: headers
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* 发送使用FormData的POST请求
|
|
217
|
+
* @param {string} url 请求URL
|
|
218
|
+
* @param {any} data 请求参数
|
|
219
|
+
* @param {Object} headers 请求头
|
|
220
|
+
* @returns 返回发送POST请求的Promise
|
|
221
|
+
*/
|
|
222
|
+
postFormData(url, data, headers) { //formdata的post请求
|
|
223
|
+
return this.send({
|
|
224
|
+
url: url,
|
|
225
|
+
method: 'post',
|
|
226
|
+
data: qs.stringify(this.paramHandle(data)),
|
|
227
|
+
headers: {
|
|
228
|
+
...this.formDataHeader,
|
|
229
|
+
...headers
|
|
230
|
+
}
|
|
231
|
+
})
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* 发送上传文件的POST请求
|
|
236
|
+
* @param {string} url 请求URL
|
|
237
|
+
* @param {any} data 请求参数
|
|
238
|
+
* @param {Object} headers 请求头
|
|
239
|
+
* @returns 返回发送POST请求的Promise
|
|
240
|
+
*/
|
|
241
|
+
postFile(url, data, headers) { //formdata的post请求
|
|
242
|
+
return this.send({
|
|
243
|
+
url: url,
|
|
244
|
+
method: 'post',
|
|
245
|
+
data: data,
|
|
246
|
+
headers: {
|
|
247
|
+
...this.formDataHeader,
|
|
248
|
+
...headers
|
|
249
|
+
}
|
|
250
|
+
})
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* 发送使用FormData的PUT请求
|
|
255
|
+
* @param {string} url 请求URL
|
|
256
|
+
* @param {any} data 请求参数
|
|
257
|
+
* @param {Object} headers 请求头
|
|
258
|
+
* @returns 返回发送PUT请求的Promise
|
|
259
|
+
*/
|
|
260
|
+
putFormData(url, data, headers) { //formdata的put请求
|
|
261
|
+
return this.send({
|
|
262
|
+
url: url,
|
|
263
|
+
method: 'put',
|
|
264
|
+
data: qs.stringify(this.paramHandle(data)),
|
|
265
|
+
headers: {
|
|
266
|
+
...this.formDataHeader,
|
|
267
|
+
...headers
|
|
268
|
+
}
|
|
269
|
+
})
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* 发送使用FormData的PATCH请求
|
|
274
|
+
* @param {string} url 请求URL
|
|
275
|
+
* @param {any} data 请求参数
|
|
276
|
+
* @param {Object} headers 请求头
|
|
277
|
+
* @returns 返回发送PATCH请求的Promise
|
|
278
|
+
*/
|
|
279
|
+
patchFormData(url, data, headers) { //formdata的patch请求
|
|
280
|
+
return this.send({
|
|
281
|
+
url: url,
|
|
282
|
+
method: 'patch',
|
|
283
|
+
data: qs.stringify(this.paramHandle(data)),
|
|
284
|
+
headers: {
|
|
285
|
+
...this.formDataHeader,
|
|
286
|
+
...headers
|
|
287
|
+
}
|
|
288
|
+
})
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
}
|
|
292
|
+
export default Http
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="h-[100vh] bg-gray-100 flex flex-col ">
|
|
3
|
+
<div class="head px-4 py-2 bg-gray-50 flex justify-between items-center">
|
|
4
|
+
<div class="logo">
|
|
5
|
+
<img class="h-[32px]" src="../../assets/img/logo.png" alt="">
|
|
6
|
+
</div>
|
|
7
|
+
<div class="menu">
|
|
8
|
+
<el-popover placement="bottom" :width="360" trigger="click">
|
|
9
|
+
<template #reference>
|
|
10
|
+
<el-button class="mr-3">历史记录</el-button>
|
|
11
|
+
</template>
|
|
12
|
+
<el-table :row-style="rowStyleHandle" :data="designer.historyList" @row-click="clickRowHandle"
|
|
13
|
+
max-height="300">
|
|
14
|
+
<el-table-column property="id" label="变更组件">
|
|
15
|
+
<template #default="scope">
|
|
16
|
+
<div>{{ scope.row.widgetConfig.chosenId }}</div>
|
|
17
|
+
</template>
|
|
18
|
+
</el-table-column>
|
|
19
|
+
<el-table-column width="100" property="time" label="操作时间" />
|
|
20
|
+
</el-table>
|
|
21
|
+
</el-popover>
|
|
22
|
+
<el-button-group class="mr-3">
|
|
23
|
+
<el-button @click="goBack" :disabled="designer.historyIndex === 0">
|
|
24
|
+
<i :class="`iconfont icon-xianghou`"></i>
|
|
25
|
+
</el-button>
|
|
26
|
+
<el-button @click="goForward" :disabled="designer.historyIndex === designer.historyList.length - 1">
|
|
27
|
+
<i :class="`iconfont icon-xiangqian`"></i>
|
|
28
|
+
</el-button>
|
|
29
|
+
</el-button-group>
|
|
30
|
+
<el-button @click="clearWidgetConfig">重置</el-button>
|
|
31
|
+
<el-button type="primary" @click="preview">预览</el-button>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="content flex-1 flex border-t border-gray-200 overflow-hidden">
|
|
35
|
+
<!-- 左侧菜单栏 -->
|
|
36
|
+
<div class="left flex bg-gray-50 border-r border-gray-200">
|
|
37
|
+
<div class="w-12 border-r border-gray-200 pt-5">
|
|
38
|
+
<div class="btn_item" :class="{ active: data.activeSidebar === 0 }" @click="data.activeSidebar = 0">
|
|
39
|
+
<i :class="`iconfont icon-zujian`"></i>
|
|
40
|
+
</div>
|
|
41
|
+
<div class="btn_item" :class="{ active: data.activeSidebar === 1 }" @click="data.activeSidebar = 1">
|
|
42
|
+
<i :class="`iconfont icon-dagang`"></i>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="btn_item" :class="{ active: data.activeSidebar === 2 }" @click="data.activeSidebar = 2">
|
|
45
|
+
<i :class="`iconfont icon-yuanma`"></i>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="w-80">
|
|
49
|
+
<panel :designer="designer" :activeSidebar="data.activeSidebar"></panel>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
<!-- 中间操作栏 -->
|
|
53
|
+
<div class="mid flex-1 py-2 px-2 box-border w-full h-full overflow-auto">
|
|
54
|
+
<div class="inner w-full h-full bg-gray-50 ">
|
|
55
|
+
<design :designer="designer"></design>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
<!-- 右侧配置栏 -->
|
|
59
|
+
<div class="right bg-gray-50 w-80 border-l border-gray-200 overflow-y-auto overflow-x-hidden">
|
|
60
|
+
<config v-if="designer.chosenWidget" :designer="designer"></config>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
<vxe-modal transfer v-model="showModal" width="99%" height="99%" show-footer>
|
|
65
|
+
<template #title>
|
|
66
|
+
<span>预览表单</span>
|
|
67
|
+
</template>
|
|
68
|
+
<template #default>
|
|
69
|
+
<show v-if="showModal" :widgetConfig="compWidgetConfig"></show>
|
|
70
|
+
</template>
|
|
71
|
+
<template #footer>
|
|
72
|
+
<el-button icon="Close" size="small" @click="showModal=false">关闭</el-button>
|
|
73
|
+
</template>
|
|
74
|
+
</vxe-modal>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<script setup>
|
|
78
|
+
import { ref, reactive, watch } from 'vue';
|
|
79
|
+
import panel from './panel.vue'
|
|
80
|
+
import design from './design.vue'
|
|
81
|
+
import config from './config.vue'
|
|
82
|
+
import show from './show.vue'
|
|
83
|
+
|
|
84
|
+
import Designer from '../../designer'
|
|
85
|
+
|
|
86
|
+
import widgetConfigPanelData from '../../widgetConfig'
|
|
87
|
+
let initWidgetConfig = widgetConfigPanelData.homepage
|
|
88
|
+
let originInitData = JSON.parse(JSON.stringify(initWidgetConfig))
|
|
89
|
+
let showModal = ref(false)
|
|
90
|
+
let compWidgetConfig = null
|
|
91
|
+
let designer = reactive(new Designer({
|
|
92
|
+
widgetConfig: initWidgetConfig
|
|
93
|
+
}))
|
|
94
|
+
let data = reactive({
|
|
95
|
+
activeSidebar: 0,
|
|
96
|
+
})
|
|
97
|
+
const preview = ()=>{
|
|
98
|
+
compWidgetConfig=designer.$utils.clone(designer.widgetConfig, true)
|
|
99
|
+
showModal.value=true;
|
|
100
|
+
}
|
|
101
|
+
const clearWidgetConfig = () => {
|
|
102
|
+
designer.updateWidget("homepage", designer.$utils.clone(originInitData, true), true)
|
|
103
|
+
}
|
|
104
|
+
const clickRowHandle = (row) => {
|
|
105
|
+
designer.historyIndex = row.index
|
|
106
|
+
designer.updateByHistory(row.widgetConfig)
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
const rowStyleHandle = ({ row, rowIndex }) => {
|
|
110
|
+
if (designer.historyIndex === rowIndex) {
|
|
111
|
+
return {
|
|
112
|
+
color: 'rgb(85, 132, 255)',
|
|
113
|
+
fontWeight: "bold"
|
|
114
|
+
// background: "rgb(85, 132, 255)"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const goBack = () => {
|
|
119
|
+
if (designer.historyIndex > 0) {
|
|
120
|
+
designer.historyIndex--
|
|
121
|
+
designer.updateByHistory(designer.historyList[designer.historyIndex].widgetConfig)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const goForward = () => {
|
|
125
|
+
if (designer.historyIndex < designer.historyList.length - 1) {
|
|
126
|
+
designer.historyIndex++
|
|
127
|
+
designer.updateByHistory(designer.historyList[designer.historyIndex].widgetConfig)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
defineOptions({ name: "designer" })
|
|
131
|
+
</script>
|
|
132
|
+
|
|
133
|
+
<style scoped lang="scss">
|
|
134
|
+
@import url("../../assets/font/iconfont.css");
|
|
135
|
+
|
|
136
|
+
.btn_item {
|
|
137
|
+
transition: all .3s;
|
|
138
|
+
@apply w-full flex items-center box-border border-l-4 border-transparent justify-center h-12 mb-3 cursor-pointer hover:bg-blue-50 hover:text-blue-700;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.active {
|
|
142
|
+
@apply border-blue-700 text-blue-700 bg-blue-50;
|
|
143
|
+
}
|
|
144
|
+
</style>
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex flex-col h-full" v-if="props.activeSidebar === 0">
|
|
3
|
+
<!-- 工具栏 -->
|
|
4
|
+
<div class="px-4 py-2 text-lg text-gray-900 border-b border-gray-200">组件库</div>
|
|
5
|
+
<!-- 组件内容 -->
|
|
6
|
+
<div class="flex-1 overflow-auto select-none">
|
|
7
|
+
<commonCard :title="'容器组件'" class="mb-1">
|
|
8
|
+
<draggable ghostClass="ghost" class="content_wrap flex flex-wrap flex-shrink-0 justify-between "
|
|
9
|
+
:list="panelListContainer" :group="{ name: 'dragGroup', pull: 'clone', put: false }" item-key="id"
|
|
10
|
+
:clone="handleWidgetClone" :sort="false">
|
|
11
|
+
<template #item="{ element }">
|
|
12
|
+
<div @click="handleWidgetClick(element)"
|
|
13
|
+
class="group items w-[47%] flex-shrink-0 px-2 py-2 border border-gray-200 my-2 rounded cursor-pointer hover:shadow-md">
|
|
14
|
+
<i :class="`iconfont icon-${element.type} text-blue-700 group-hover:text-blue-500`"></i>
|
|
15
|
+
<span class="text-sm ml-1 group-hover:text-blue-500"> {{ element.displayName }} </span>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
</draggable>
|
|
19
|
+
</commonCard>
|
|
20
|
+
<commonCard :title="'表单组件'" class="mb-1">
|
|
21
|
+
<draggable ghostClass="ghost" class="content_wrap flex flex-wrap flex-shrink-0 justify-between "
|
|
22
|
+
:list="panelListForm" :group="{ name: 'dragGroup', pull: 'clone', put: false }" item-key="id"
|
|
23
|
+
:clone="handleWidgetClone" :sort="false">
|
|
24
|
+
<template #item="{ element }">
|
|
25
|
+
<div @click="handleWidgetClick(element)"
|
|
26
|
+
class="group items w-[47%] flex-shrink-0 px-2 py-2 border border-gray-200 my-2 rounded cursor-pointer hover:shadow-md">
|
|
27
|
+
<i :class="`iconfont icon-${element.type} text-blue-700 group-hover:text-blue-500`"></i>
|
|
28
|
+
<span class="text-sm ml-1 group-hover:text-blue-500"> {{ element.displayName }} </span>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
</draggable>
|
|
32
|
+
</commonCard>
|
|
33
|
+
<commonCard :title="'其他组件'">
|
|
34
|
+
<draggable ghostClass="ghost" class="content_wrap flex flex-wrap flex-shrink-0 justify-between "
|
|
35
|
+
:list="panelListOrther" :group="{ name: 'dragGroup', pull: 'clone', put: false }" item-key="id"
|
|
36
|
+
:clone="handleWidgetClone" :sort="false">
|
|
37
|
+
<template #item="{ element }">
|
|
38
|
+
<div @click="handleWidgetClick(element)"
|
|
39
|
+
class="group items w-[47%] flex-shrink-0 px-2 py-2 border border-gray-200 my-2 rounded cursor-pointer hover:shadow-md">
|
|
40
|
+
<i :class="`iconfont icon-${element.type} text-blue-700 group-hover:text-blue-500`"></i>
|
|
41
|
+
<span class="text-sm ml-1 group-hover:text-blue-500"> {{ element.displayName }} </span>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
</draggable>
|
|
45
|
+
</commonCard>
|
|
46
|
+
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<!-- 大纲 -->
|
|
50
|
+
<div class="flex flex-col h-full" v-if="props.activeSidebar === 1">
|
|
51
|
+
<common-sidetree :designer="designer"></common-sidetree>
|
|
52
|
+
</div>
|
|
53
|
+
<!-- 源码 -->
|
|
54
|
+
<div class="flex flex-col h-full box-border p-2" v-if="props.activeSidebar === 2">
|
|
55
|
+
<common-code-editor class="flex-1" theme="vs-dark" ref="editor" :tabSize="2" :pure="true" :minimap="false"
|
|
56
|
+
language="json" v-model="codeString"></common-code-editor>
|
|
57
|
+
<el-button @click="updateWidget">立即应用配置</el-button>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
<script setup>
|
|
63
|
+
import draggable from "vuedraggable";
|
|
64
|
+
import commonCodeEditor from '../widgetCommonComps/commonCodeEditor/editor.vue'
|
|
65
|
+
import { ref, reactive, watch, toRaw } from 'vue';
|
|
66
|
+
import widgetConfig from '../../widgetConfig';
|
|
67
|
+
import { js_beautify } from "../../util/jsformat";
|
|
68
|
+
//获取参数props传参
|
|
69
|
+
let props = defineProps({
|
|
70
|
+
designer: {
|
|
71
|
+
type: Object,
|
|
72
|
+
default: {}
|
|
73
|
+
},
|
|
74
|
+
activeSidebar: {
|
|
75
|
+
type: Number,
|
|
76
|
+
default: 0
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
let designer = props.designer
|
|
80
|
+
let panelList = reactive(widgetConfig);
|
|
81
|
+
let panelListContainer = reactive([]);
|
|
82
|
+
let panelListForm = reactive([]);
|
|
83
|
+
let panelListOrther = reactive([]);
|
|
84
|
+
let codeString = ref("")
|
|
85
|
+
let editor = ref()
|
|
86
|
+
let handleWidgetClone = (e) => {
|
|
87
|
+
return designer.getChosenInitData(e)
|
|
88
|
+
}
|
|
89
|
+
let handleWidgetClick = (e) => {
|
|
90
|
+
let chosenWidget = designer.chosenWidget;
|
|
91
|
+
let obj = designer.getChosenInitData(e)
|
|
92
|
+
if (!chosenWidget) {//没有选中时候默认添加到homeWidgetList
|
|
93
|
+
let homeWidgetList = designer.widgetConfig.widgetList;
|
|
94
|
+
homeWidgetList.push(obj)
|
|
95
|
+
} else {//选中时候
|
|
96
|
+
if (chosenWidget.isContainer) {//如果选中组件是容器就添加到容器中
|
|
97
|
+
chosenWidget.widgetList.push(obj)
|
|
98
|
+
} else {//如果选中组件不是容器就添加到选中组件后面
|
|
99
|
+
let { widgetList, index } = designer.getParentWidgetById(chosenWidget.id);
|
|
100
|
+
widgetList.splice(index + 1, 0, obj)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
for (let i in panelList) {
|
|
105
|
+
let item = panelList[i];
|
|
106
|
+
if (item.addToPanel !== false && i != 'homepage') {
|
|
107
|
+
item.type = i;
|
|
108
|
+
if (item.isContainer) {
|
|
109
|
+
panelListContainer.push(item);
|
|
110
|
+
} else if (item.isForm) {
|
|
111
|
+
panelListForm.push(item);
|
|
112
|
+
} else {
|
|
113
|
+
panelListOrther.push(item);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const updateWidget = () => {
|
|
118
|
+
let chosenWidget = designer.chosenWidget;
|
|
119
|
+
designer.updateWidget(chosenWidget.id, JSON.parse(codeString.value))
|
|
120
|
+
|
|
121
|
+
}
|
|
122
|
+
watch(() => designer.widgetConfig, (val) => {
|
|
123
|
+
if (designer.chosenWidget) {
|
|
124
|
+
let str = js_beautify(JSON.stringify(designer.chosenWidget))
|
|
125
|
+
codeString.value = str
|
|
126
|
+
if (props.activeSidebar == 2) {
|
|
127
|
+
editor.value.setValue(str)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}, {
|
|
131
|
+
deep: true,
|
|
132
|
+
immediate: true
|
|
133
|
+
})
|
|
134
|
+
defineOptions({ name: "panel" })
|
|
135
|
+
|
|
136
|
+
</script>
|
|
137
|
+
|
|
138
|
+
<style scoped lang="scss">
|
|
139
|
+
@import url("../../assets/font/iconfont.css");
|
|
140
|
+
|
|
141
|
+
.ghost {
|
|
142
|
+
@apply max-h-0 overflow-hidden border border-blue-700 p-0 w-full;
|
|
143
|
+
}
|
|
144
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<commonContainer class="h-full w-full" :widget="designer.widgetConfig" :designer="designer">
|
|
3
|
+
<widget-homepage :widget="designer.widgetConfig" :designer="designer"></widget-homepage>
|
|
4
|
+
</commonContainer>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup>
|
|
8
|
+
import { ref, reactive } from 'vue';
|
|
9
|
+
import Designer from '../../designer'
|
|
10
|
+
let props = defineProps({
|
|
11
|
+
widgetConfig: {
|
|
12
|
+
type: Object,
|
|
13
|
+
default: {}
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
let designer = reactive(new Designer({
|
|
17
|
+
widgetConfig: props.widgetConfig,
|
|
18
|
+
showMode: true
|
|
19
|
+
}))
|
|
20
|
+
defineOptions({ name: "sunForm" })
|
|
21
|
+
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<style scoped lang="scss"></style>
|