@fecp/designer 5.5.5 → 5.5.6
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/es/_virtual/app.mjs +5 -0
- package/es/_virtual/app2.mjs +4 -0
- package/es/designer/package.json.mjs +1 -1
- package/es/designer/src/api/index.mjs +30 -31
- package/es/designer/src/components/DocumentParam.vue.mjs +5 -3
- package/es/designer/src/components/RiskSchemeDialog.vue2.mjs +5 -3
- package/es/designer/src/components/TemplateDialog.vue.mjs +5 -3
- package/es/designer/src/layout/header/index.vue.mjs +4 -2
- package/es/designer/src/layout/index.vue.mjs +6 -4
- package/es/designer/src/packages/advancedFilter/ValueInput.vue2.mjs +5 -3
- package/es/designer/src/packages/dataLinkage/index.vue.mjs +0 -3
- package/es/designer/src/packages/dialog/index.vue2.mjs +6 -4
- package/es/designer/src/packages/dialog/useDialogDialog.mjs +1 -1
- package/es/designer/src/packages/dialogGlobal/index.vue2.mjs +9 -7
- package/es/designer/src/packages/dialogGlobal/useDialogGlobalDialog.mjs +1 -1
- package/es/designer/src/packages/eventFlow/dialog/action/Dialog.vue.mjs +5 -3
- package/es/designer/src/packages/eventFlow/dialog/action/TableChildSelection.vue2.mjs +5 -3
- package/es/designer/src/packages/form/components/ComponentPreviewWrapper.vue.mjs +5 -3
- package/es/designer/src/packages/form/components/DefaultValueEditor.vue.mjs +2 -2
- package/es/designer/src/packages/form/property/contract.vue.mjs +5 -3
- package/es/designer/src/packages/form/property/subTable.vue.mjs +5 -3
- package/es/designer/src/packages/form/property/widgets.vue.mjs +8 -6
- package/es/designer/src/packages/prod/index.vue.mjs +5 -3
- package/es/designer/src/packages/table/headerBtn.vue.mjs +1 -4
- package/es/designer/src/utils/optionLoader.mjs +8 -7
- package/es/designer.css +214 -185
- package/es/node_modules/element-china-category-data/dist/app.mjs +77 -0
- package/es/packages/mobile/index.mjs +4 -0
- package/es/packages/mobile/src/components/all.mjs +4 -0
- package/es/packages/mobile/src/components/form/checkboxGroup/CheckboxGroup.vue.mjs +2 -2
- package/es/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.mjs +29 -25
- package/es/packages/mobile/src/components/form/fieldIndustry/FieldIndustry.vue.mjs +195 -0
- package/es/packages/mobile/src/components/form/fieldIndustry/index.mjs +10 -0
- package/es/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.mjs +3 -25
- package/es/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.mjs +34 -7
- package/es/packages/mobile/src/components/form/fieldSubTitle/FieldSubTitle.vue.mjs +27 -0
- package/es/packages/mobile/src/components/form/fieldSubTitle/index.mjs +10 -0
- package/es/packages/mobile/src/components/form/radioGroup/RadioGroup.vue.mjs +1 -1
- package/es/packages/mobile/src/components/navigation/actionBar/ActionBar.vue.mjs +35 -16
- package/es/packages/mobile/src/components/navigation/tabbar/Tabbar.vue.mjs +2 -1
- package/es/packages/mobile/src/utils/common.mjs +28 -0
- package/es/packages/mobile/src/utils/datasource.mjs +354 -0
- package/es/packages/mobile/src/utils/optionUtil.mjs +63 -40
- package/es/packages/mobile/src/utils/parseRouteParams.mjs +41 -0
- package/es/packages/vue/src/components/dialog/DialogRenderer.vue2.mjs +1 -1
- package/es/packages/vue/src/components/forms/text/Text.vue.mjs +1 -1
- package/es/packages/vue/src/components/table/TableColumn.vue.mjs +1 -1
- package/es/packages/vue/src/composables/usePageEvents.mjs +1 -1
- package/es/packages/vue/src/utils/datasource.mjs +1 -1
- package/lib/_virtual/app.js +5 -0
- package/lib/_virtual/app2.js +4 -0
- package/lib/designer/package.json.js +1 -1
- package/lib/designer/src/api/index.js +30 -31
- package/lib/designer/src/components/DocumentParam.vue.js +4 -2
- package/lib/designer/src/components/RiskSchemeDialog.vue2.js +4 -2
- package/lib/designer/src/components/TemplateDialog.vue.js +4 -2
- package/lib/designer/src/layout/header/index.vue.js +3 -1
- package/lib/designer/src/layout/index.vue.js +5 -3
- package/lib/designer/src/packages/advancedFilter/ValueInput.vue2.js +4 -2
- package/lib/designer/src/packages/dataLinkage/index.vue.js +0 -3
- package/lib/designer/src/packages/dialog/index.vue2.js +5 -3
- package/lib/designer/src/packages/dialog/useDialogDialog.js +1 -1
- package/lib/designer/src/packages/dialogGlobal/index.vue2.js +8 -6
- package/lib/designer/src/packages/dialogGlobal/useDialogGlobalDialog.js +1 -1
- package/lib/designer/src/packages/eventFlow/dialog/action/Dialog.vue.js +4 -2
- package/lib/designer/src/packages/eventFlow/dialog/action/TableChildSelection.vue2.js +4 -2
- package/lib/designer/src/packages/form/components/ComponentPreviewWrapper.vue.js +4 -2
- package/lib/designer/src/packages/form/components/DefaultValueEditor.vue.js +2 -2
- package/lib/designer/src/packages/form/property/contract.vue.js +4 -2
- package/lib/designer/src/packages/form/property/subTable.vue.js +4 -2
- package/lib/designer/src/packages/form/property/widgets.vue.js +7 -5
- package/lib/designer/src/packages/prod/index.vue.js +4 -2
- package/lib/designer/src/packages/table/headerBtn.vue.js +1 -4
- package/lib/designer/src/utils/optionLoader.js +8 -7
- package/lib/designer.css +214 -185
- package/lib/node_modules/element-china-category-data/dist/app.js +77 -0
- package/lib/packages/mobile/index.js +48 -44
- package/lib/packages/mobile/src/components/all.js +48 -44
- package/lib/packages/mobile/src/components/form/checkboxGroup/CheckboxGroup.vue.js +2 -2
- package/lib/packages/mobile/src/components/form/fieldCheckbox/FieldCheckbox.vue.js +28 -24
- package/lib/packages/mobile/src/components/form/fieldIndustry/FieldIndustry.vue.js +195 -0
- package/lib/packages/mobile/src/components/form/fieldIndustry/index.js +10 -0
- package/lib/packages/mobile/src/components/form/fieldPicker/FieldPicker.vue.js +2 -24
- package/lib/packages/mobile/src/components/form/fieldRadio/FieldRadio.vue.js +33 -6
- package/lib/packages/mobile/src/components/form/fieldSubTitle/FieldSubTitle.vue.js +27 -0
- package/lib/packages/mobile/src/components/form/fieldSubTitle/index.js +10 -0
- package/lib/packages/mobile/src/components/form/radioGroup/RadioGroup.vue.js +1 -1
- package/lib/packages/mobile/src/components/navigation/actionBar/ActionBar.vue.js +34 -15
- package/lib/packages/mobile/src/components/navigation/tabbar/Tabbar.vue.js +2 -1
- package/lib/packages/mobile/src/utils/common.js +28 -0
- package/lib/packages/mobile/src/utils/datasource.js +354 -0
- package/lib/packages/mobile/src/utils/optionUtil.js +64 -41
- package/lib/packages/mobile/src/utils/parseRouteParams.js +41 -0
- package/lib/packages/vue/src/components/dialog/DialogRenderer.vue2.js +1 -1
- package/lib/packages/vue/src/components/forms/text/Text.vue.js +1 -1
- package/lib/packages/vue/src/components/table/TableColumn.vue.js +1 -1
- package/lib/packages/vue/src/composables/usePageEvents.js +1 -1
- package/lib/packages/vue/src/utils/datasource.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const vue = require("vue");
|
|
4
|
+
const parseRouteParams = require("./parseRouteParams.js");
|
|
5
|
+
require("../../../../node_modules/element-plus/es/index.js");
|
|
6
|
+
;/* empty css */
|
|
7
|
+
;/* empty css */
|
|
8
|
+
;/* empty css */
|
|
9
|
+
;/* empty css */
|
|
10
|
+
const index = require("../../../../node_modules/element-plus/es/components/loading/index.js");
|
|
11
|
+
const index$1 = require("../../../../node_modules/element-plus/es/components/message/index.js");
|
|
12
|
+
class DataSourceManager {
|
|
13
|
+
constructor(options = {}) {
|
|
14
|
+
this.templateId = options.templateId;
|
|
15
|
+
this.http = options.http;
|
|
16
|
+
this.params = options.params || {};
|
|
17
|
+
this.initSearchData = options.initSearchData || {};
|
|
18
|
+
this.dataSources = options.dataSources || [];
|
|
19
|
+
this.currentDataSourceId = options.currentDataSourceId;
|
|
20
|
+
this.pagination = options.pagination || false;
|
|
21
|
+
this.sortRules = vue.reactive(options.sortRules || []);
|
|
22
|
+
this.originalSortRules = JSON.parse(
|
|
23
|
+
JSON.stringify(options.sortRules || [])
|
|
24
|
+
);
|
|
25
|
+
this.showSuccessMessage = options.showSuccessMessage || false;
|
|
26
|
+
this.loading = false;
|
|
27
|
+
this.error = null;
|
|
28
|
+
this.data = vue.reactive({});
|
|
29
|
+
this.contextData = options.data || null;
|
|
30
|
+
this.fields = options.fields || [];
|
|
31
|
+
this.events = {
|
|
32
|
+
loaded: [],
|
|
33
|
+
error: []
|
|
34
|
+
};
|
|
35
|
+
this.LoadingInstance = {
|
|
36
|
+
target: null,
|
|
37
|
+
// 保存Loading实例
|
|
38
|
+
count: 0
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 获取当前数据源配置
|
|
43
|
+
*/
|
|
44
|
+
getCurrentDataSource() {
|
|
45
|
+
if (!this.currentDataSourceId || !this.dataSources.length) return null;
|
|
46
|
+
return this.dataSources.find((ds) => ds.id == this.currentDataSourceId);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 构建请求参数
|
|
50
|
+
*/
|
|
51
|
+
buildRequestParams(extraParams = {}) {
|
|
52
|
+
const currentDs = this.getCurrentDataSource();
|
|
53
|
+
if (!currentDs) return {};
|
|
54
|
+
const params = { ...this.params };
|
|
55
|
+
if (this.templateId) {
|
|
56
|
+
params.tableId = this.templateId;
|
|
57
|
+
}
|
|
58
|
+
if (currentDs.params && Array.isArray(currentDs.params)) {
|
|
59
|
+
const parsedParams = parseRouteParams.parseRouteParams(
|
|
60
|
+
currentDs.params,
|
|
61
|
+
this.contextData,
|
|
62
|
+
this.fields
|
|
63
|
+
);
|
|
64
|
+
Object.assign(params, parsedParams);
|
|
65
|
+
}
|
|
66
|
+
if (this.pagination) {
|
|
67
|
+
params.pageNo = this.pagination.pageNo;
|
|
68
|
+
params.pageSize = this.pagination.pageSize;
|
|
69
|
+
}
|
|
70
|
+
if (this.sortRules && this.sortRules.length > 0) {
|
|
71
|
+
params.sortRules = JSON.stringify(this.sortRules);
|
|
72
|
+
}
|
|
73
|
+
return { ...this.initSearchData, ...params, ...extraParams };
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 根据内容类型处理请求数据
|
|
77
|
+
*/
|
|
78
|
+
prepareRequestData(params, contentType) {
|
|
79
|
+
switch (contentType) {
|
|
80
|
+
case "formData":
|
|
81
|
+
const formData = new FormData();
|
|
82
|
+
Object.keys(params).forEach((key) => {
|
|
83
|
+
formData.append(key, params[key]);
|
|
84
|
+
});
|
|
85
|
+
return formData;
|
|
86
|
+
case "formUrlencoded":
|
|
87
|
+
const urlencoded = new URLSearchParams();
|
|
88
|
+
Object.keys(params).forEach((key) => {
|
|
89
|
+
urlencoded.append(key, params[key]);
|
|
90
|
+
});
|
|
91
|
+
return urlencoded;
|
|
92
|
+
case "json":
|
|
93
|
+
default:
|
|
94
|
+
return JSON.stringify(params);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* 获取请求配置
|
|
99
|
+
*/
|
|
100
|
+
getRequestConfig() {
|
|
101
|
+
const currentDs = this.getCurrentDataSource();
|
|
102
|
+
if (!currentDs) return {};
|
|
103
|
+
const config = {
|
|
104
|
+
url: `/${currentDs.serverName}${currentDs.url}`,
|
|
105
|
+
method: currentDs.method
|
|
106
|
+
};
|
|
107
|
+
if (currentDs.contentType === "formData") {
|
|
108
|
+
config.headers = {
|
|
109
|
+
"Content-Type": "multipart/form-data"
|
|
110
|
+
};
|
|
111
|
+
} else if (currentDs.contentType === "formUrlencoded") {
|
|
112
|
+
config.headers = {
|
|
113
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
114
|
+
};
|
|
115
|
+
} else {
|
|
116
|
+
config.headers = {
|
|
117
|
+
"Content-Type": "application/json"
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return config;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* 发起请求
|
|
124
|
+
*/
|
|
125
|
+
async fetch(extraParams = {}) {
|
|
126
|
+
const currentDs = this.getCurrentDataSource();
|
|
127
|
+
if (!currentDs) {
|
|
128
|
+
console.warn("未找到当前数据源配置");
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (!this.http) {
|
|
132
|
+
console.warn("未配置 HTTP 实例");
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
this.loading = true;
|
|
136
|
+
this.error = null;
|
|
137
|
+
this.LoadingInstance.count++;
|
|
138
|
+
if (this.LoadingInstance.count === 1) {
|
|
139
|
+
this.LoadingInstance.target = index.ElLoading.service({
|
|
140
|
+
fullscreen: true,
|
|
141
|
+
lock: true,
|
|
142
|
+
text: "拼命加载中",
|
|
143
|
+
// spinner: loadingSvg,
|
|
144
|
+
background: "rgba(0, 0, 0, 0)",
|
|
145
|
+
customClass: "h-loading"
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
try {
|
|
149
|
+
const params = this.buildRequestParams(extraParams);
|
|
150
|
+
const requestConfig = this.getRequestConfig();
|
|
151
|
+
let response;
|
|
152
|
+
const { url, method } = requestConfig;
|
|
153
|
+
switch (method.toLowerCase()) {
|
|
154
|
+
case "get":
|
|
155
|
+
response = await this.http.get(url, { params });
|
|
156
|
+
break;
|
|
157
|
+
case "post":
|
|
158
|
+
if (currentDs.contentType === "formData") {
|
|
159
|
+
response = await this.http.postForm(url, params, requestConfig);
|
|
160
|
+
} else if (currentDs.contentType === "download") {
|
|
161
|
+
await this.http.download(url, params, requestConfig);
|
|
162
|
+
} else if (currentDs.contentType === "upload") {
|
|
163
|
+
response = await this.http.upload(url, params, requestConfig);
|
|
164
|
+
} else {
|
|
165
|
+
response = await this.http.post(url, params, requestConfig);
|
|
166
|
+
}
|
|
167
|
+
break;
|
|
168
|
+
case "put":
|
|
169
|
+
if (currentDs.contentType === "formData") {
|
|
170
|
+
response = await this.http.putForm(url, params, requestConfig);
|
|
171
|
+
} else {
|
|
172
|
+
response = await this.http.put(url, params, requestConfig);
|
|
173
|
+
}
|
|
174
|
+
break;
|
|
175
|
+
case "delete":
|
|
176
|
+
response = await this.http.delete(url, { params });
|
|
177
|
+
break;
|
|
178
|
+
default:
|
|
179
|
+
response = await this.http.get(url, { params });
|
|
180
|
+
}
|
|
181
|
+
if (response && typeof response === "object" && "code" in response) {
|
|
182
|
+
if (response.code == 0) {
|
|
183
|
+
const responseData = response.data;
|
|
184
|
+
const responseMessage = response.message;
|
|
185
|
+
if (this.pagination) {
|
|
186
|
+
this.data.list = (responseData == null ? void 0 : responseData.records) || responseData;
|
|
187
|
+
this.data.total = (responseData == null ? void 0 : responseData.total) || (responseData == null ? void 0 : responseData.length);
|
|
188
|
+
} else {
|
|
189
|
+
this.data = responseData;
|
|
190
|
+
}
|
|
191
|
+
this.emit("loaded", this.data);
|
|
192
|
+
if (this.showSuccessMessage && responseMessage) {
|
|
193
|
+
index$1.ElMessage.success(responseMessage);
|
|
194
|
+
}
|
|
195
|
+
return this.data;
|
|
196
|
+
} else {
|
|
197
|
+
this.error = response.message || "请求失败";
|
|
198
|
+
this.emit("error", this.error);
|
|
199
|
+
throw new Error(this.error);
|
|
200
|
+
}
|
|
201
|
+
} else {
|
|
202
|
+
const responseData = response;
|
|
203
|
+
if (this.pagination) {
|
|
204
|
+
this.data.list = (responseData == null ? void 0 : responseData.records) || responseData;
|
|
205
|
+
this.data.total = (responseData == null ? void 0 : responseData.total) || (responseData == null ? void 0 : responseData.length);
|
|
206
|
+
} else {
|
|
207
|
+
this.data = responseData;
|
|
208
|
+
}
|
|
209
|
+
this.emit("loaded", this.data);
|
|
210
|
+
return this.data;
|
|
211
|
+
}
|
|
212
|
+
} catch (err) {
|
|
213
|
+
this.error = err.message || "请求失败";
|
|
214
|
+
this.emit("error", err);
|
|
215
|
+
throw err;
|
|
216
|
+
} finally {
|
|
217
|
+
this.closeLoading();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* 事件监听
|
|
222
|
+
*/
|
|
223
|
+
on(event, callback) {
|
|
224
|
+
if (this.events[event]) {
|
|
225
|
+
this.events[event].push(callback);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* 移除事件监听
|
|
230
|
+
*/
|
|
231
|
+
off(event, callback) {
|
|
232
|
+
if (this.events[event]) {
|
|
233
|
+
const index2 = this.events[event].indexOf(callback);
|
|
234
|
+
if (index2 > -1) {
|
|
235
|
+
this.events[event].splice(index2, 1);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* 触发事件
|
|
241
|
+
*/
|
|
242
|
+
emit(event, data) {
|
|
243
|
+
if (this.events[event]) {
|
|
244
|
+
this.events[event].forEach((callback) => {
|
|
245
|
+
callback(data);
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* 更新分页
|
|
251
|
+
*/
|
|
252
|
+
updatePagination(pageNo, pageSize) {
|
|
253
|
+
this.pagination.pageNo = pageNo;
|
|
254
|
+
this.pagination.pageSize = pageSize;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* 更新排序
|
|
258
|
+
*/
|
|
259
|
+
updateSort(field, order) {
|
|
260
|
+
const existingIndex = this.sortRules.findIndex((rule) => rule.field === field);
|
|
261
|
+
if (!order) {
|
|
262
|
+
if (existingIndex > -1) {
|
|
263
|
+
this.sortRules.splice(existingIndex, 1);
|
|
264
|
+
}
|
|
265
|
+
} else {
|
|
266
|
+
if (existingIndex > -1) {
|
|
267
|
+
this.sortRules.splice(existingIndex, 1);
|
|
268
|
+
}
|
|
269
|
+
this.sortRules.unshift({ field, order });
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* 清空排序规则 - 重置为原始配置
|
|
274
|
+
*/
|
|
275
|
+
clearSort() {
|
|
276
|
+
this.sortRules.splice(0, this.sortRules.length);
|
|
277
|
+
this.originalSortRules.forEach((rule) => {
|
|
278
|
+
this.sortRules.push({ ...rule });
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* 切换数据源
|
|
283
|
+
*/
|
|
284
|
+
switchDataSource(dataSourceId) {
|
|
285
|
+
this.currentDataSourceId = dataSourceId;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* 获取当前数据
|
|
289
|
+
*/
|
|
290
|
+
getData() {
|
|
291
|
+
return this.data;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* 获取加载状态
|
|
295
|
+
*/
|
|
296
|
+
getLoading() {
|
|
297
|
+
return this.loading;
|
|
298
|
+
}
|
|
299
|
+
closeLoading() {
|
|
300
|
+
if (this.LoadingInstance.count > 0) {
|
|
301
|
+
this.LoadingInstance.count--;
|
|
302
|
+
}
|
|
303
|
+
if (this.LoadingInstance.count === 0 && this.LoadingInstance.target) {
|
|
304
|
+
this.LoadingInstance.target.close();
|
|
305
|
+
this.LoadingInstance.target = null;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* 获取错误信息
|
|
310
|
+
*/
|
|
311
|
+
getError() {
|
|
312
|
+
return this.error;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* 获取分页信息
|
|
316
|
+
*/
|
|
317
|
+
getPagination() {
|
|
318
|
+
return this.pagination;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* 获取当前请求参数
|
|
322
|
+
*/
|
|
323
|
+
getParams() {
|
|
324
|
+
return this.params;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* 更新请求参数
|
|
328
|
+
*/
|
|
329
|
+
updateParams(newParams) {
|
|
330
|
+
this.params = { ...this.params, ...newParams };
|
|
331
|
+
}
|
|
332
|
+
updateInitSearchData(newParams) {
|
|
333
|
+
this.initSearchData = newParams;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* 清空请求参数
|
|
337
|
+
*/
|
|
338
|
+
clearParams() {
|
|
339
|
+
this.params = {};
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* 销毁
|
|
343
|
+
*/
|
|
344
|
+
destroy() {
|
|
345
|
+
this.events.loaded = [];
|
|
346
|
+
this.events.error = [];
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function createDataSource(options = {}) {
|
|
350
|
+
return new DataSourceManager(options);
|
|
351
|
+
}
|
|
352
|
+
exports.DataSourceManager = DataSourceManager;
|
|
353
|
+
exports.createDataSource = createDataSource;
|
|
354
|
+
exports.default = DataSourceManager;
|
|
@@ -1,56 +1,79 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const index = require("../axios/index.js");
|
|
4
|
-
const
|
|
4
|
+
const datasource = require("./datasource.js");
|
|
5
5
|
const env = require("./env.js");
|
|
6
6
|
const baseUrl = env.default.api_base_url;
|
|
7
7
|
const getOptions = ({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
staticOptions,
|
|
14
|
-
|
|
8
|
+
ctx,
|
|
9
|
+
dataSources,
|
|
10
|
+
formData = [],
|
|
11
|
+
fields = [],
|
|
12
|
+
optionSource,
|
|
13
|
+
options: staticOptions,
|
|
14
|
+
dataSourceValue,
|
|
15
|
+
displayField,
|
|
16
|
+
valueField,
|
|
17
|
+
dictionaryValue
|
|
15
18
|
}) => {
|
|
16
|
-
return new Promise((resolve, reject) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
return new Promise(async (resolve, reject) => {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
switch (optionSource) {
|
|
22
|
+
case "custom":
|
|
19
23
|
resolve(staticOptions);
|
|
20
24
|
break;
|
|
21
|
-
case "
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
case "dictionary":
|
|
26
|
+
if (!dictionaryValue) {
|
|
27
|
+
resolve([]);
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
const response = await ctx.$http.postForm(
|
|
31
|
+
"/base-server/parm/sysParmDic/getDicListByKey",
|
|
32
|
+
{
|
|
33
|
+
keyName: dictionaryValue
|
|
34
|
+
},
|
|
35
|
+
false
|
|
36
|
+
);
|
|
37
|
+
const dictionaryData = response;
|
|
38
|
+
const dictItems = dictionaryData[dictionaryValue];
|
|
39
|
+
if (dictItems) {
|
|
40
|
+
const labelField2 = "optName";
|
|
41
|
+
const keyField2 = "optCode";
|
|
42
|
+
const options2 = dictItems.map((item) => ({
|
|
43
|
+
label: item[labelField2],
|
|
44
|
+
value: item[keyField2],
|
|
45
|
+
disabled: item.disabled || false
|
|
46
|
+
}));
|
|
47
|
+
resolve(options2);
|
|
32
48
|
} else {
|
|
33
|
-
|
|
34
|
-
const option = dicListToOption(data[dicKey]);
|
|
35
|
-
resolve(option);
|
|
36
|
-
});
|
|
49
|
+
resolve([]);
|
|
37
50
|
}
|
|
38
51
|
break;
|
|
39
|
-
case "
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
value: item[optionsFieldNames.value] + ""
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
resolve(option);
|
|
51
|
-
}).catch((err) => {
|
|
52
|
-
console.error(err);
|
|
52
|
+
case "dataSource":
|
|
53
|
+
const dsManager = datasource.createDataSource({
|
|
54
|
+
http: ctx.$http,
|
|
55
|
+
dataSources,
|
|
56
|
+
currentDataSourceId: dataSourceValue,
|
|
57
|
+
data: formData,
|
|
58
|
+
// fields: [...fieldsData.value, ...hiddenFields.value],
|
|
59
|
+
fields
|
|
53
60
|
});
|
|
61
|
+
const data = await dsManager.fetch();
|
|
62
|
+
let options = [];
|
|
63
|
+
if (Array.isArray(data)) {
|
|
64
|
+
options = data;
|
|
65
|
+
} else if (typeof data === "object") {
|
|
66
|
+
options = Array.isArray(data.data) ? data.data : ((_a = data.data) == null ? void 0 : _a.records) || ((_b = data.data) == null ? void 0 : _b.list) || [];
|
|
67
|
+
}
|
|
68
|
+
const labelField = displayField || "label";
|
|
69
|
+
const keyField = valueField || "value";
|
|
70
|
+
options = options.map((item) => ({
|
|
71
|
+
label: item[labelField],
|
|
72
|
+
value: item[keyField],
|
|
73
|
+
disabled: item.disabled || false,
|
|
74
|
+
...item
|
|
75
|
+
}));
|
|
76
|
+
resolve(options);
|
|
54
77
|
break;
|
|
55
78
|
}
|
|
56
79
|
});
|
|
@@ -67,7 +90,7 @@ const getTreeOptions = ({
|
|
|
67
90
|
case "static":
|
|
68
91
|
resolve(staticOptions);
|
|
69
92
|
case "library":
|
|
70
|
-
const dataSourceRef =
|
|
93
|
+
const dataSourceRef = useDataSource(dataSource);
|
|
71
94
|
dataSourceRef == null ? void 0 : dataSourceRef.load(dataSourceParams || {}).then((res) => {
|
|
72
95
|
var _a;
|
|
73
96
|
const data = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.records) || (res == null ? void 0 : res.data) || res || [];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const common = require("./common.js");
|
|
4
|
+
function parseSingleParamValue(value, data, fields) {
|
|
5
|
+
if (typeof value !== "object" || value === null) {
|
|
6
|
+
return value;
|
|
7
|
+
}
|
|
8
|
+
if (Array.isArray(value)) {
|
|
9
|
+
return value.map((item) => parseSingleParamValue(item, data, fields));
|
|
10
|
+
}
|
|
11
|
+
const type = value.type;
|
|
12
|
+
if (type === "field") {
|
|
13
|
+
const field = fields.find((f) => f.id == value.value);
|
|
14
|
+
if (field) {
|
|
15
|
+
return data[field.fieldName];
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
} else if (type === "userInfo") {
|
|
19
|
+
console.warn("[parseRouteParams] userInfo 类型暂未实现");
|
|
20
|
+
return {};
|
|
21
|
+
} else if (type === "urlParam") {
|
|
22
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
23
|
+
return urlParams.get(value.value) || null;
|
|
24
|
+
} else {
|
|
25
|
+
return value.value !== void 0 ? value.value : value;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function parseRouteParams(routeParams, data, fields) {
|
|
29
|
+
if (!routeParams || !Array.isArray(routeParams)) {
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
const params = {};
|
|
33
|
+
routeParams.forEach((param) => {
|
|
34
|
+
const key = param.key;
|
|
35
|
+
if (!key) return;
|
|
36
|
+
params[key] = parseSingleParamValue(param.value, data, fields);
|
|
37
|
+
});
|
|
38
|
+
return common.removeEmptyValues(params);
|
|
39
|
+
}
|
|
40
|
+
exports.parseRouteParams = parseRouteParams;
|
|
41
|
+
exports.parseSingleParamValue = parseSingleParamValue;
|
|
@@ -9,9 +9,9 @@ const vue = require("vue");
|
|
|
9
9
|
const parseRouteParams = require("../../utils/parseRouteParams.js");
|
|
10
10
|
const calculate = require("../../utils/formulajs/calculate.js");
|
|
11
11
|
const eventFlowHandler = require("../../utils/eventFlow/eventFlowHandler.js");
|
|
12
|
-
;/* empty css */
|
|
13
12
|
;/* empty css */
|
|
14
13
|
;/* empty css */
|
|
14
|
+
;/* empty css */
|
|
15
15
|
const common = require("../../utils/common.js");
|
|
16
16
|
;/* empty css */
|
|
17
17
|
const _pluginVue_exportHelper = require("../../../../../_virtual/_plugin-vue_export-helper.js");
|
|
@@ -5,9 +5,9 @@ require("../../../../../../node_modules/element-plus/es/index.js");
|
|
|
5
5
|
;/* empty css */
|
|
6
6
|
;/* empty css */
|
|
7
7
|
const vue = require("vue");
|
|
8
|
-
;/* empty css */
|
|
9
8
|
;/* empty css */
|
|
10
9
|
;/* empty css */
|
|
10
|
+
;/* empty css */
|
|
11
11
|
const index$3 = require("../../dialog/index.js");
|
|
12
12
|
;/* empty css */
|
|
13
13
|
;/* empty css */
|
|
@@ -9,10 +9,10 @@ require("../../../../../node_modules/vxe-table/es/components.js");
|
|
|
9
9
|
const index$3 = require("../../../../../node_modules/@element-plus/icons-vue/dist/index.js");
|
|
10
10
|
const parseFilterConfig = require("../../utils/parseFilterConfig.js");
|
|
11
11
|
const common = require("../../utils/common.js");
|
|
12
|
-
;/* empty css */
|
|
13
12
|
;/* empty css */
|
|
14
13
|
;/* empty css */
|
|
15
14
|
;/* empty css */
|
|
15
|
+
;/* empty css */
|
|
16
16
|
;/* empty css */
|
|
17
17
|
require("../../utils/formulajs/functionCore.js");
|
|
18
18
|
const eventFlowHandler = require("../../utils/eventFlow/eventFlowHandler.js");
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const vue = require("vue");
|
|
4
4
|
;/* empty css */
|
|
5
|
-
;/* empty css */
|
|
6
5
|
;/* empty css */
|
|
7
6
|
;/* empty css */
|
|
8
7
|
;/* empty css */
|
|
8
|
+
;/* empty css */
|
|
9
9
|
;/* empty css */
|
|
10
10
|
;/* empty css */
|
|
11
11
|
require("../utils/formulajs/functionCore.js");
|
|
@@ -4,9 +4,9 @@ const vue = require("vue");
|
|
|
4
4
|
const parseRouteParams = require("./parseRouteParams.js");
|
|
5
5
|
require("../../../../node_modules/element-plus/es/index.js");
|
|
6
6
|
;/* empty css */
|
|
7
|
-
;/* empty css */
|
|
8
7
|
;/* empty css */
|
|
9
8
|
;/* empty css */
|
|
9
|
+
;/* empty css */
|
|
10
10
|
const index = require("../../../../node_modules/element-plus/es/components/loading/index.js");
|
|
11
11
|
const index$1 = require("../../../../node_modules/element-plus/es/components/message/index.js");
|
|
12
12
|
class DataSourceManager {
|