star-horse-lowcode 2.7.65 → 2.7.67

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 (221) hide show
  1. package/README.md +3 -0
  2. package/dist/assets/index.css +1 -1
  3. package/dist/index.es.js +597 -188
  4. package/dist/types/index.d.ts +30 -0
  5. package/package.json +3 -3
  6. package/.env.development +0 -3
  7. package/.env.production +0 -3
  8. package/.eslintrc-auto-import.json +0 -77
  9. package/.gitignore +0 -27
  10. package/.idea/.gitignore +0 -5
  11. package/.idea/MarsCodeWorkspaceAppSettings.xml +0 -6
  12. package/.idea/inspectionProfiles/Project_Default.xml +0 -7
  13. package/.idea/modules.xml +0 -8
  14. package/.idea/testcode.iml +0 -12
  15. package/.idea/vcs.xml +0 -6
  16. package/.idea/watcherTasks.xml +0 -4
  17. package/.idea/workspace.xml +0 -207
  18. package/.npmignore +0 -21
  19. package/.prettierignore +0 -26
  20. package/auto-imports.d.ts +0 -137
  21. package/components.d.ts +0 -189
  22. package/eslint.config.js +0 -37
  23. package/index.html +0 -14
  24. package/package-lock.json +0 -8276
  25. package/prettier.config.js +0 -20
  26. package/public/logo.svg +0 -660
  27. package/src/App.vue +0 -11
  28. package/src/api/date_utils.ts +0 -219
  29. package/src/api/finger_utils.ts +0 -71
  30. package/src/api/form_utils.ts +0 -281
  31. package/src/api/jquery.min.js +0 -2
  32. package/src/api/pcas-code.json +0 -1
  33. package/src/api/settings.ts +0 -81
  34. package/src/api/star_horse_apis.ts +0 -196
  35. package/src/api/star_horse_utils.ts +0 -797
  36. package/src/api/system.ts +0 -351
  37. package/src/api/user_func.ts +0 -147
  38. package/src/api/valid_utils.ts +0 -165
  39. package/src/assets/css/index.scss +0 -908
  40. package/src/assets/icons.css +0 -574
  41. package/src/assets/star-horse-icons.woff +0 -0
  42. package/src/components/comp/ShDynamicForm.vue +0 -160
  43. package/src/components/comp/ShForm.vue +0 -30
  44. package/src/components/comp/ShTableListColumn.vue +0 -61
  45. package/src/components/comp/StarHorseDataSelector.vue +0 -139
  46. package/src/components/comp/StarHorseDataView.vue +0 -110
  47. package/src/components/comp/StarHorseDataViewItems.vue +0 -61
  48. package/src/components/comp/StarHorseDataViewTable.vue +0 -102
  49. package/src/components/comp/StarHorseDialog.vue +0 -383
  50. package/src/components/comp/StarHorseDraggable.vue +0 -401
  51. package/src/components/comp/StarHorseForm.vue +0 -458
  52. package/src/components/comp/StarHorseFormItem.vue +0 -82
  53. package/src/components/comp/StarHorseFormList.vue +0 -516
  54. package/src/components/comp/StarHorseFormTable.vue +0 -56
  55. package/src/components/comp/StarHorseIcon.vue +0 -76
  56. package/src/components/comp/StarHorseItem.vue +0 -302
  57. package/src/components/comp/StarHorseJsonEditor.vue +0 -115
  58. package/src/components/comp/StarHorsePopover.vue +0 -66
  59. package/src/components/comp/StarHorseSearchComp.vue +0 -253
  60. package/src/components/comp/StarHorseStaticTable.vue +0 -395
  61. package/src/components/comp/StarHorseTableColumn.vue +0 -249
  62. package/src/components/comp/StarHorseTableComp.vue +0 -1193
  63. package/src/components/comp/StarHorseTableViewColumn.vue +0 -61
  64. package/src/components/comp/StarHorseTree.vue +0 -494
  65. package/src/components/comp/index.ts +0 -22
  66. package/src/components/comp/items/UTableColumn.vue +0 -65
  67. package/src/components/comp/items/boxItem.vue +0 -98
  68. package/src/components/comp/items/callitem.ts +0 -9
  69. package/src/components/comp/items/cardItem.vue +0 -152
  70. package/src/components/comp/items/collapseItem.vue +0 -134
  71. package/src/components/comp/items/dytableItem.vue +0 -135
  72. package/src/components/comp/items/otherItem.vue +0 -65
  73. package/src/components/comp/items/tabItem.vue +0 -155
  74. package/src/components/comp/items/tabPanelItem.vue +0 -110
  75. package/src/components/comp/items/tableColumn.vue +0 -129
  76. package/src/components/comp/items/tableItem.vue +0 -97
  77. package/src/components/comp/items/tablebtn.vue +0 -158
  78. package/src/components/comp/items/viewBoxItem.vue +0 -55
  79. package/src/components/comp/items/viewCardItem.vue +0 -47
  80. package/src/components/comp/items/viewCollapseItem.vue +0 -71
  81. package/src/components/comp/items/viewDytableItem.vue +0 -77
  82. package/src/components/comp/items/viewOtherItem.vue +0 -55
  83. package/src/components/comp/items/viewTabItem.vue +0 -77
  84. package/src/components/comp/items/viewTabPanelItem.vue +0 -54
  85. package/src/components/comp/items/viewTableItem.vue +0 -74
  86. package/src/components/comp/selfcomp.ts +0 -9
  87. package/src/components/comp/utils/DataPicker.vue +0 -302
  88. package/src/components/comp/utils/DataTag.vue +0 -51
  89. package/src/components/cron/Crontab-Day.vue +0 -230
  90. package/src/components/cron/Crontab-Hour.vue +0 -165
  91. package/src/components/cron/Crontab-Min.vue +0 -166
  92. package/src/components/cron/Crontab-Month.vue +0 -166
  93. package/src/components/cron/Crontab-Result.vue +0 -615
  94. package/src/components/cron/Crontab-Second.vue +0 -185
  95. package/src/components/cron/Crontab-Week.vue +0 -208
  96. package/src/components/cron/Crontab-Year.vue +0 -183
  97. package/src/components/cron/Crontab.vue +0 -474
  98. package/src/components/enums/ModuleEnums.ts +0 -10
  99. package/src/components/enums/ServiceEnums.ts +0 -18
  100. package/src/components/formcomp/container/box-container.vue +0 -162
  101. package/src/components/formcomp/container/callitem.ts +0 -9
  102. package/src/components/formcomp/container/card-container.vue +0 -170
  103. package/src/components/formcomp/container/collapse-container.vue +0 -133
  104. package/src/components/formcomp/container/dytable-col.vue +0 -448
  105. package/src/components/formcomp/container/dytable-container.vue +0 -57
  106. package/src/components/formcomp/container/dytableUtils.ts +0 -358
  107. package/src/components/formcomp/container/group-box-container.vue +0 -331
  108. package/src/components/formcomp/container/index.ts +0 -6
  109. package/src/components/formcomp/container/tab-container.vue +0 -153
  110. package/src/components/formcomp/container/table-container.vue +0 -249
  111. package/src/components/formcomp/items/allitem.ts +0 -9
  112. package/src/components/formcomp/items/area-item.vue +0 -116
  113. package/src/components/formcomp/items/audio-item.vue +0 -163
  114. package/src/components/formcomp/items/autocomplete-item.vue +0 -118
  115. package/src/components/formcomp/items/barcode-item.vue +0 -87
  116. package/src/components/formcomp/items/base-json-item.vue +0 -207
  117. package/src/components/formcomp/items/button-item.vue +0 -228
  118. package/src/components/formcomp/items/cascade-item.vue +0 -113
  119. package/src/components/formcomp/items/checkbox-item.vue +0 -97
  120. package/src/components/formcomp/items/color-item.vue +0 -70
  121. package/src/components/formcomp/items/cron-item.vue +0 -115
  122. package/src/components/formcomp/items/datetime-item.vue +0 -99
  123. package/src/components/formcomp/items/depart-item.vue +0 -51
  124. package/src/components/formcomp/items/dialog-input-item.vue +0 -207
  125. package/src/components/formcomp/items/divider-item.vue +0 -66
  126. package/src/components/formcomp/items/html-item.vue +0 -65
  127. package/src/components/formcomp/items/htmleditor-item.vue +0 -104
  128. package/src/components/formcomp/items/icon-item.vue +0 -195
  129. package/src/components/formcomp/items/image-item.vue +0 -247
  130. package/src/components/formcomp/items/index.ts +0 -44
  131. package/src/components/formcomp/items/input-item.vue +0 -150
  132. package/src/components/formcomp/items/json-array-item.vue +0 -67
  133. package/src/components/formcomp/items/json-item.vue +0 -66
  134. package/src/components/formcomp/items/markdown-item.vue +0 -77
  135. package/src/components/formcomp/items/number-item.vue +0 -94
  136. package/src/components/formcomp/items/number-range-item.vue +0 -278
  137. package/src/components/formcomp/items/page-select-item.vue +0 -407
  138. package/src/components/formcomp/items/password-item.vue +0 -71
  139. package/src/components/formcomp/items/qrcode-item.vue +0 -84
  140. package/src/components/formcomp/items/radio-item.vue +0 -112
  141. package/src/components/formcomp/items/rate-item.vue +0 -68
  142. package/src/components/formcomp/items/select-item.vue +0 -133
  143. package/src/components/formcomp/items/signature-item.vue +0 -216
  144. package/src/components/formcomp/items/slider-item.vue +0 -68
  145. package/src/components/formcomp/items/starhorse-form-item.vue +0 -334
  146. package/src/components/formcomp/items/switch-item.vue +0 -77
  147. package/src/components/formcomp/items/tag-item.vue +0 -77
  148. package/src/components/formcomp/items/text-item.vue +0 -75
  149. package/src/components/formcomp/items/textarea-item.vue +0 -85
  150. package/src/components/formcomp/items/time-item.vue +0 -77
  151. package/src/components/formcomp/items/time-picker-item.vue +0 -74
  152. package/src/components/formcomp/items/transfer-item.vue +0 -93
  153. package/src/components/formcomp/items/tselect-item.vue +0 -121
  154. package/src/components/formcomp/items/unknown-item.vue +0 -51
  155. package/src/components/formcomp/items/upload-item.vue +0 -189
  156. package/src/components/formcomp/items/user-item.vue +0 -177
  157. package/src/components/formcomp/items/usercomp-item.vue +0 -85
  158. package/src/components/formcomp/items/view-markdown-item.vue +0 -77
  159. package/src/components/formcomp/utils/EditDataDialog.vue +0 -67
  160. package/src/components/formcomp/utils/FieldList.vue +0 -125
  161. package/src/components/formcomp/utils/ItemRelationEventUtils.ts +0 -284
  162. package/src/components/help.vue +0 -31
  163. package/src/components/menu/MenuItem.vue +0 -95
  164. package/src/components/menu/SubMenu.vue +0 -68
  165. package/src/components/menu/SubSystemMenu.vue +0 -142
  166. package/src/components/register.ts +0 -24
  167. package/src/components/system/ContentMenu.vue +0 -260
  168. package/src/components/system/StarHorseButtonList.vue +0 -344
  169. package/src/components/system/StarHorseMenu.vue +0 -97
  170. package/src/components/system/StarHorseSvg.vue +0 -62
  171. package/src/components/system/SystemComp.ts +0 -9
  172. package/src/components/system/index.ts +0 -4
  173. package/src/components/types/ApiUrls.ts +0 -168
  174. package/src/components/types/BtnAction.ts +0 -51
  175. package/src/components/types/BtnAuth.ts +0 -43
  176. package/src/components/types/CompInfo.ts +0 -81
  177. package/src/components/types/DialogProps.ts +0 -55
  178. package/src/components/types/DyCompField.ts +0 -23
  179. package/src/components/types/DynamicNode.ts +0 -42
  180. package/src/components/types/MenusInfo.ts +0 -45
  181. package/src/components/types/PageFieldInfo.ts +0 -530
  182. package/src/components/types/PageProps.ts +0 -25
  183. package/src/components/types/Params.ts +0 -93
  184. package/src/components/types/RuleType.ts +0 -10
  185. package/src/components/types/SearchProps.ts +0 -42
  186. package/src/components/types/ShortKey.ts +0 -30
  187. package/src/components/types/StarHorseType.ts +0 -18
  188. package/src/components/types/index.ts +0 -15
  189. package/src/config/element.ts +0 -15
  190. package/src/config/styles.ts +0 -4
  191. package/src/index.ts +0 -98
  192. package/src/install.ts +0 -33
  193. package/src/lang/en_US.ts +0 -81
  194. package/src/lang/index.ts +0 -35
  195. package/src/lang/zh_CN.ts +0 -84
  196. package/src/main.ts +0 -57
  197. package/src/plugins/AblesPlugin.ts +0 -618
  198. package/src/plugins/registerCompPlugin.ts +0 -15
  199. package/src/sample/test.vue +0 -9
  200. package/src/store/ButtonPermission.ts +0 -101
  201. package/src/store/ConsumerView.ts +0 -52
  202. package/src/store/ContinusConfig.ts +0 -78
  203. package/src/store/CopyerOperation.ts +0 -74
  204. package/src/store/DesignForm.ts +0 -481
  205. package/src/store/DesignPage.ts +0 -59
  206. package/src/store/DynamicForm.ts +0 -241
  207. package/src/store/GlobalConfig.ts +0 -90
  208. package/src/store/SelfOperation.ts +0 -95
  209. package/src/store/UserInfo.ts +0 -88
  210. package/src/store/index.ts +0 -6
  211. package/src/theme/localStorge.ts +0 -16
  212. package/src/theme/theme.ts +0 -27
  213. package/src/utils/FieldOperationUtils.ts +0 -91
  214. package/src/utils/auth.ts +0 -83
  215. package/src/utils/message.ts +0 -69
  216. package/src/utils/preview.ts +0 -125
  217. package/tsconfig.json +0 -39
  218. package/tsconfig.node.json +0 -10
  219. package/vite-env.d.ts +0 -16
  220. package/vite.config.ts +0 -162
  221. package/yarn.lock +0 -4627
@@ -1,797 +0,0 @@
1
- import { SearchInfo, SearchParams } from "@/components/types/Params";
2
- import { reactive, Reactive, unref } from "vue";
3
- import { ElLoading } from "element-plus";
4
- import JSON5 from "json5";
5
- import {
6
- download,
7
- getRequest,
8
- postRequest,
9
- uploadRequest,
10
- } from "@/api/star_horse_apis";
11
- import { error, operationConfirm, success, warning } from "@/utils/message";
12
- import { SelectOption } from "@/components/types/SearchProps";
13
- import {
14
- BatchFieldInfo,
15
- FieldInfo,
16
- OrderByInfo,
17
- PageFieldInfo,
18
- TabFieldInfo,
19
- } from "@/components/types/PageFieldInfo";
20
- import { ApiUrls } from "@/components/types/ApiUrls";
21
- import { DialogProps } from "@/components/types/DialogProps";
22
- import { createDatetime } from "@/api/date_utils";
23
- import { ServiceEnums } from "@/components/enums/ServiceEnums";
24
-
25
- let loading: any = null;
26
-
27
- /**
28
- * 字典接口
29
- */
30
- const dictUrl: string = `${ServiceEnums.SYSTEM_PREFIX}dictinfoEntity/getAllByCondition`;
31
-
32
- /**
33
- * 加载Post 数据
34
- * @param url 接口地址
35
- * @param params 参数
36
- * @param orderBy 排序
37
- */
38
- export async function loadData(
39
- url: string,
40
- params: SearchParams[] | any,
41
- orderBy: OrderByInfo[] = [],
42
- ) {
43
- let data: any = null;
44
- let error = "";
45
- let cond = params;
46
- if (Array.isArray(params)) {
47
- cond = {
48
- fieldList: params,
49
- orderBy: orderBy,
50
- };
51
- }
52
- await postRequest(url, cond)
53
- .then((res: any) => {
54
- const redata = res.data;
55
- if (redata.code) {
56
- error = redata.cnMessage;
57
- } else {
58
- //先去分页数据,没有再去非分页数据
59
- data = redata.data.dataList || redata.data;
60
- }
61
- })
62
- .catch((err) => {
63
- error = err;
64
- });
65
- return {
66
- data,
67
- error,
68
- };
69
- }
70
-
71
- /**
72
- * 加载Get 数据
73
- * @param url 接口地址
74
- * @param params 参数
75
- */
76
- export async function loadGetData(url: string) {
77
- let data = reactive<any>([]);
78
- let error: string = "";
79
- await getRequest(url)
80
- .then((res) => {
81
- const redata = res.data;
82
- if (redata.code != 0) {
83
- error = redata.cnMessage;
84
- } else {
85
- data = redata.data;
86
- }
87
- })
88
- .catch((err) => {
89
- error = err;
90
- });
91
- return {
92
- data,
93
- error,
94
- };
95
- }
96
-
97
- /**
98
- * 构建菜单树
99
- * @param data
100
- * @param valField 字符串值
101
- * @param name
102
- * @param val 数字值
103
- */
104
- export function createTree(
105
- data: any,
106
- valField: string,
107
- name: string,
108
- val: string,
109
- ) {
110
- const list: SelectOption[] = [];
111
- data.forEach((item: any) => {
112
- const temp: any = {};
113
- temp["value"] = valField ? item[valField] : parseInt(item[val]);
114
- temp["name"] = item[name];
115
- if (item.children && item.children.length > 0) {
116
- temp["children"] = createTree(item.children, valField, name, val);
117
- }
118
- list.push(temp);
119
- });
120
- return list;
121
- }
122
-
123
- /**
124
- * 加载框
125
- * @param msg
126
- * @param defaultTarget
127
- */
128
- export function load(msg: string, defaultTarget?: string) {
129
- closeLoad();
130
- loading = ElLoading.service({
131
- lock: true,
132
- target: defaultTarget ?? "#app",
133
- text: msg || "Loading...",
134
- customClass: "star-horse-loading",
135
- background: "rgba(0, 0, 0, 0.7)",
136
- });
137
- }
138
-
139
- /**
140
- * 关闭加载框
141
- */
142
- export function closeLoad() {
143
- if (loading) {
144
- loading.close();
145
- loading = null;
146
- document.querySelectorAll(".el-loading-mask").forEach((el) => el.remove());
147
- }
148
- }
149
-
150
- /**
151
- * 下划线转驼峰
152
- * @param str
153
- */
154
- export function convertToCamelCase(str: string) {
155
- if (!str) {
156
- return undefined;
157
- }
158
- str = str.toLowerCase();
159
- return str.replace(/_(\w)/g, (_match, p1) => {
160
- return p1.toUpperCase();
161
- });
162
- }
163
-
164
- /**
165
- * 驼峰转下划线
166
- * @param str
167
- */
168
- export function camelCaseToUnderline(str: string) {
169
- if (!str) {
170
- return undefined;
171
- }
172
- return str.replace(/[A-Z]/g, (match, _p1) => {
173
- return "_" + match.toLowerCase();
174
- });
175
- }
176
-
177
- /**
178
- * 数据格式化
179
- * @param name
180
- * @param cellValue
181
- */
182
- export function commonParseCodeToName(name: string, cellValue: any) {
183
- if (!cellValue && cellValue != 0) {
184
- return "-";
185
- }
186
- if (name == "isDel" || name.includes("&isDel")) {
187
- return cellValue == 1 ? "是" : "否";
188
- }
189
- if (name == "state" || name.includes("&state")) {
190
- return cellValue == 1 ? "正常" : "异常";
191
- }
192
- const preps: Array<string> = [
193
- "createdTime",
194
- "updatedTime",
195
- "createdTime",
196
- "updatedTime",
197
- "createTime",
198
- "editTime",
199
- ];
200
- const result = preps.find(
201
- (item) =>
202
- name?.includes("&" + item) ||
203
- convertToCamelCase(name)?.toLowerCase() === item.toLowerCase(),
204
- );
205
- if (result) {
206
- return createDatetime(cellValue);
207
- } else {
208
- return cellValue;
209
- }
210
- }
211
-
212
- /**
213
- * 加载Id数据
214
- * @param url
215
- * @param id
216
- * @param params
217
- */
218
- export async function loadById(url: string, id: any, params: any = {}) {
219
- if (!url || "undefined" == id) {
220
- warning("请提供正确的数据");
221
- return;
222
- }
223
- let objData: any = {};
224
- const suffix: string = id ? "/" + id : "";
225
- await postRequest(url + suffix, params).then((res) => {
226
- const redata = res.data.data;
227
- if (!redata) {
228
- warning("未找到对应数据");
229
- } else {
230
- objData = redata;
231
- }
232
- });
233
- return objData;
234
- }
235
-
236
- /**
237
- * 根据Id删除数据
238
- * @param url
239
- * @param ids
240
- * @param msg 删除提示
241
- */
242
- export async function deleteByIds(
243
- url: string,
244
- ids: any,
245
- msg: string = "确认需要删除选择的数据吗?",
246
- ) {
247
- if (!url) {
248
- warning("请提供正确的数据");
249
- return;
250
- }
251
- if (!ids || ids.length == 0) {
252
- warning("请选择要删除的数据");
253
- return;
254
- }
255
- let objData: boolean = false;
256
- const confirmFlag: boolean = await operationConfirm(msg);
257
- if (!confirmFlag) {
258
- return;
259
- }
260
- await postRequest(url, ids)
261
- .then((res) => {
262
- if (res.data.code == 0) {
263
- success(res.data.cnMessage);
264
- } else {
265
- warning(res.data.cnMessage);
266
- }
267
- closeLoad();
268
- objData = true;
269
- })
270
- .catch((err) => {
271
- error("接口不存在或网络异常:" + err);
272
- objData = false;
273
- })
274
- .finally(() => {
275
- closeLoad();
276
- });
277
- return objData;
278
- }
279
-
280
- /**
281
- * 根据字典类别获取字典数据
282
- * @param dictType 字典类别
283
- * @param exclusion 排除字典项
284
- * @param userUrl 用户自定义接口
285
- */
286
- export async function dictData(
287
- dictType: string,
288
- exclusion: Array<string> = [],
289
- userUrl?: string,
290
- ) {
291
- const query = [];
292
- query.push({
293
- propertyName: "dictType",
294
- value: dictType,
295
- });
296
- const dicts: SelectOption[] = [];
297
- await postRequest(userUrl ?? dictUrl, { fieldList: query })
298
- .then((res) => {
299
- const redata = res.data;
300
- if (redata.code == 0) {
301
- redata.data?.forEach((item: any) => {
302
- if (exclusion?.includes(item.dictCode)) {
303
- return;
304
- }
305
- dicts.push({ name: item.dictName, value: item.dictCode });
306
- });
307
- }
308
- })
309
- .catch((err: any) => {
310
- console.log("接口不存在或网络异常", err);
311
- });
312
- return dicts;
313
- }
314
-
315
- /**
316
- * 数据匹配方式
317
- */
318
- export function searchMatchList(): SelectOption[] {
319
- const data: SelectOption[] = [];
320
- data.push({ name: "等于", value: "eq" });
321
- data.push({ name: "不等于", value: "ne" });
322
- data.push({ name: "模糊", value: "lk" });
323
- data.push({ name: "为空", value: "ul" });
324
- data.push({ name: "不为空", value: "nu" });
325
- data.push({ name: "左模糊", value: "llk" });
326
- data.push({ name: "右模糊", value: "rlk" });
327
- data.push({ name: "不匹配", value: "nlk" });
328
- data.push({ name: "小于", value: "lt" });
329
- data.push({ name: "小于或等于", value: "lte" });
330
- data.push({ name: "大于", value: "gt" });
331
- data.push({ name: "大于或等于", value: "gte" });
332
- data.push({ name: "范围", value: "bt" });
333
- return data;
334
- }
335
-
336
- /**
337
- * 复制数据
338
- * @param msg
339
- */
340
- export function copy(msg: string) {
341
- navigator.clipboard
342
- .writeText(msg)
343
- .then(() => {
344
- success("已复制");
345
- })
346
- .catch(() => {
347
- error("复制失败");
348
- });
349
- }
350
-
351
- /**
352
- * 表格序号
353
- * @param row
354
- * @param rowIndex
355
- */
356
- export function rowClassName({ row, rowIndex }: any) {
357
- if (row) {
358
- row.xh = rowIndex + 1;
359
- }
360
- }
361
-
362
- /**
363
- * 创建条件
364
- */
365
- export function createCondition(
366
- name: string,
367
- val: any,
368
- matchType: string = "eq",
369
- ): SearchParams {
370
- return { propertyName: name, value: val, operation: matchType };
371
- }
372
-
373
- /**
374
- * 判断是不是Json
375
- * @param v
376
- */
377
- export function isJson(v: any) {
378
- if (!v) {
379
- return false;
380
- }
381
- if (
382
- v &&
383
- typeof v === "string" &&
384
- (/^\{[\s\S]*\}$/.test(v) || /^\[[\s\S]*\]$/.test(v))
385
- ) {
386
- try {
387
- JSON5.parse(v);
388
- return true;
389
- } catch (e) {
390
- console.log(e);
391
- return false;
392
- }
393
- }
394
- if (
395
- typeof v === "object" &&
396
- Object.prototype.toString.call(v).toLowerCase() === "[object object]" &&
397
- !v.length
398
- ) {
399
- return true;
400
- }
401
- return false;
402
- }
403
-
404
- /**
405
- * 解析表单字段映射
406
- * @param fieldList
407
- */
408
- export function formFieldMapping(fieldList: PageFieldInfo) {
409
- let defaultDatas: any = {};
410
- const actions: Array<any> = [];
411
- //解析出字段之间的映射关系
412
- const mappingFields: Array<any> = [];
413
- const tempList = fieldList?.fieldList;
414
- const batchDefaultValues: any = {};
415
- const tabOperation = (data: TabFieldInfo) => {
416
- const fieldList = data.fieldList as Array<FieldInfo>;
417
- if ("Y" == data.subFormFlag) {
418
- defaultDatas[data.tabName] = {};
419
- //如果是子表
420
- fieldsOperation(fieldList, defaultDatas[data.tabName]);
421
- } else {
422
- fieldsOperation(fieldList, defaultDatas);
423
- }
424
- };
425
- const tableOperation = (batchTempList: Array<BatchFieldInfo>) => {
426
- for (const key in batchTempList) {
427
- const temp = batchTempList[key];
428
- if (!defaultDatas[temp.batchName]) {
429
- defaultDatas[temp.batchName] = [];
430
- }
431
- if (!batchDefaultValues[temp.batchName + "DefaultValue"]) {
432
- batchDefaultValues[temp.batchName + "DefaultValue"] = [];
433
- }
434
- const fieldList = temp.fieldList as Array<FieldInfo>;
435
- let tempData: any = {};
436
- fieldList?.forEach((item) => {
437
- if (item.defaultValue) {
438
- if (isJson(item.defaultValue)) {
439
- let subTemp = {
440
- ...batchDefaultValues[temp.batchName],
441
- ...item.defaultValue,
442
- };
443
- Object.entries(subTemp).forEach(([key, value]) => {
444
- tempData[key] = value;
445
- });
446
- } else {
447
- tempData[item.fieldName] = item.defaultValue;
448
- }
449
- }
450
- if (item.aliasName) {
451
- mappingFields.push({ name: item.fieldName, alias: item.aliasName });
452
- }
453
- if (item.actions) {
454
- actions.push({
455
- batchName: temp.batchName,
456
- actions: item.actions,
457
- fieldName: item.fieldName,
458
- });
459
- }
460
- });
461
- batchDefaultValues[temp.batchName + "DefaultValue"].push(tempData);
462
- }
463
- };
464
- const fieldsOperation = (dataList: any, defaultData: any) => {
465
- for (const key in dataList) {
466
- const temp = dataList[key];
467
- if (temp instanceof Array) {
468
- temp.forEach((item: FieldInfo) => {
469
- if (item.defaultValue) {
470
- if (isJson(item.defaultValue)) {
471
- for (const key in item.defaultValue) {
472
- defaultData[key] = item.defaultValue[key];
473
- }
474
- } else {
475
- defaultData[item.fieldName] = item.defaultValue;
476
- }
477
- }
478
- if (item.aliasName) {
479
- mappingFields.push({ name: item.fieldName, alias: item.aliasName });
480
- }
481
- if (item.actions) {
482
- actions.push({
483
- actions: item.actions,
484
- fieldName: item.fieldName,
485
- });
486
- }
487
- });
488
- } else if (temp["tabList"] || temp["collapseList"] || temp["cardList"]) {
489
- //如果是tabList
490
- const tabList =
491
- temp["tabList"] || temp["collapseList"] || temp["cardList"];
492
- for (const index in tabList) {
493
- const temp = tabList[index];
494
- tabOperation(temp);
495
- }
496
- } else if (temp["batchFieldList"]) {
497
- //如果是tableList
498
- const tableList = temp["batchFieldList"] as Array<BatchFieldInfo>;
499
- tableOperation(tableList);
500
- } else {
501
- if (temp.defaultValue) {
502
- if (isJson(temp.defaultValue)) {
503
- for (const key in temp.defaultValue) {
504
- defaultData[key] = temp.defaultValue[key];
505
- }
506
- } else {
507
- defaultData[temp.fieldName] = temp.defaultValue;
508
- }
509
- }
510
- if (temp.aliasName) {
511
- mappingFields.push({ name: temp.fieldName, alias: temp.aliasName });
512
- }
513
- if (temp.actions) {
514
- actions.push({
515
- actions: temp.actions,
516
- fieldName: temp.fieldName,
517
- });
518
- }
519
- }
520
- }
521
- };
522
- fieldsOperation(tempList, defaultDatas);
523
- const batchTempList = fieldList?.batchFieldList!;
524
- tableOperation(batchTempList);
525
- defaultDatas = { ...defaultDatas, ...batchDefaultValues };
526
- // debugger;
527
- return { defaultDatas, mappingFields, batchDefaultValues, actions };
528
- }
529
-
530
- /**
531
- * 批量列表数据默认值
532
- * @param datas
533
- * @param dataForm
534
- */
535
- export function batchFieldDefaultValues(datas: BatchFieldInfo, dataForm: any) {
536
- let defaultValues: any = {};
537
- if (datas["batchDefaultData"]) {
538
- defaultValues = { ...datas["batchDefaultData"] };
539
- }
540
- const fieldList = datas["fieldList"];
541
- for (const inde in fieldList) {
542
- const temp = fieldList[inde];
543
- if (temp.defaultValue) {
544
- if (isJson(temp.defaultValue)) {
545
- for (const key in temp.defaultValue) {
546
- defaultValues[key] = temp.defaultValue[key];
547
- }
548
- } else {
549
- defaultValues[temp.fieldName] = temp.defaultValue;
550
- }
551
- }
552
- }
553
- if (dataForm) {
554
- let temp = unref(dataForm)[datas.batchName];
555
- if (temp) {
556
- defaultValues = { ...temp, ...defaultValues };
557
- }
558
- }
559
- return defaultValues;
560
- }
561
-
562
- /**
563
- * 动态组件数据
564
- * @param field 组件参数信息
565
- */
566
- export async function compDynamicData(field: any) {
567
- const temp = field;
568
- let reDataList: SelectOption[] = [];
569
- const dataSource = temp.preps?.dataSource;
570
- const urlOrDictName = temp.preps?.urlOrDictName;
571
- //如果已经有数据了,就不再请求
572
- if (unref(field.preps?.values)?.length > 0) {
573
- return unref(field.preps?.values);
574
- }
575
- if (unref(field.preps?.data)?.length > 0) {
576
- return unref(field.preps?.data);
577
- }
578
- if (unref(field?.optionList)?.length > 0) {
579
- return unref(field.optionList);
580
- }
581
- if (dataSource == "url") {
582
- reDataList = await dynamicUrlOperation(field);
583
- } else if (dataSource == "dict") {
584
- const dicts = await dictData(urlOrDictName);
585
- if (Object.keys(dicts).length == 0) {
586
- error("数据字典可能未配置");
587
- } else {
588
- reDataList = dicts;
589
- }
590
- } else {
591
- reDataList = [];
592
- }
593
- return reDataList;
594
- }
595
-
596
- /**
597
- *
598
- * @param preps 组件参数信息
599
- * @param queryInfo 查询条件
600
- * @param proxyUrl 代理接口,为空时,默认使用/system-config/redirect/execute
601
- */
602
- export async function dynamicUrlOperation(
603
- preps: any,
604
- queryInfo?: SearchParams[],
605
- proxyUrl?: string,
606
- ) {
607
- const temp = preps.preps || preps;
608
- const reDataList: SelectOption[] = [];
609
- const requestParams: any = [];
610
- const queryParams = temp?.queryParams;
611
- queryParams?.forEach((item: any) => {
612
- if (!item.name) {
613
- return;
614
- }
615
- requestParams.push({
616
- propertyName: item.name,
617
- value: item.value,
618
- operation: item.matchType,
619
- });
620
- });
621
- //自定义查询
622
- if (queryInfo) {
623
- requestParams.push(...queryInfo);
624
- }
625
- let url = temp["preinterfaceUrl"] + temp["interfaceUrl"];
626
- const params: any = {
627
- url: temp["interfaceUrl"],
628
- host: temp["host"],
629
- port: temp["port"],
630
- protocol: temp["protocol"],
631
- env: temp["env"],
632
- httpMethod: temp.httpMethod || "POST",
633
- dataType: temp.dataType || "JSON",
634
- searchInfo: {
635
- fieldList: requestParams,
636
- },
637
- };
638
- url = proxyUrl ?? "/system-config/redirect/execute";
639
- const validResult = await loadData(url, params);
640
- if (validResult.error) {
641
- error(validResult.error);
642
- } else {
643
- const childrenOperation = (list: Array<any>) => {
644
- const options: SelectOption[] = [];
645
- list?.forEach((item: any) => {
646
- const option: SelectOption = {
647
- name: item[temp["selectLabel"]],
648
- value: item[temp["selectValue"]],
649
- };
650
- if (item.children && item.children.length > 0) {
651
- option.children = childrenOperation(item.children);
652
- }
653
- options.push(option);
654
- });
655
- return options;
656
- };
657
- validResult.data.forEach((item: any) => {
658
- const option: SelectOption = {
659
- name: item[temp["selectLabel"]],
660
- value: item[temp["selectValue"]],
661
- };
662
- if (item.children && item.children.length > 0) {
663
- option.children = childrenOperation(item.children);
664
- }
665
- reDataList.push(option);
666
- });
667
- }
668
- return reDataList;
669
- }
670
-
671
- /**
672
- * 创建过滤器
673
- * @param queryString 查询参数
674
- */
675
- export async function createFilter(queryString: string) {
676
- return (data: SelectOption) => {
677
- return (
678
- data?.name?.toLowerCase().search(queryString?.toLowerCase()) ||
679
- data?.value?.toString()?.toLowerCase().search(queryString?.toLowerCase())
680
- );
681
- };
682
- }
683
-
684
- /**
685
- * 公共Api接口
686
- * @param appName 应用名称
687
- * @param urlPrefix api接口前缀
688
- * @param condition 条件
689
- */
690
- export function apiInstance(
691
- appName: string,
692
- urlPrefix: string,
693
- condition: Array<any> = [],
694
- ): ApiUrls {
695
- const prefix: string = `/${appName}/${urlPrefix}`;
696
- const apiUrls: ApiUrls = {
697
- basePrefix: prefix,
698
- appName: appName,
699
- pageListUrl: `${prefix}/pageList`,
700
- mergeUrl: `${prefix}/merge`,
701
- mergeDraftUrl: `${prefix}/mergeDraft`,
702
- batchMergeUrl: `${prefix}/mergeBatch`,
703
- batchMergeDraftUrl: `${prefix}/mergeBatchDraft`,
704
- loadByIdUrl: `${prefix}/getById`,
705
- loadByIdForViewUrl: `${prefix}/getByIdForView`,
706
- deleteUrl: `${prefix}/batchDeleteById`,
707
- deleteByConditionUrl: `${prefix}/deleteByCondition`,
708
- exportAllUrl: `${prefix}/exportData`,
709
- downloadTemplateUrl: `${prefix}/downloadTemplate`,
710
- listConditionUrl: `${prefix}/getAllByCondition`,
711
- oneConditionUrl: `${prefix}/getOneByCondition`,
712
- importUrl: `${prefix}/importData`,
713
- uploadUrl: `${appName}/annex/upload/common`,
714
- modifyColumnsUrl: `${prefix}/modifyColumns`,
715
- condition: condition,
716
- };
717
- apiUrls.pageAction = (params: SearchInfo) => {
718
- return postRequest(apiUrls.pageListUrl!, params);
719
- };
720
- apiUrls.mergeAction = (param: any) => {
721
- return postRequest(apiUrls.mergeUrl!, param);
722
- };
723
- apiUrls.mergeDraftAction = (param: any) => {
724
- return postRequest(apiUrls.mergeDraftUrl!, param);
725
- };
726
- apiUrls.batchMergeAction = (param: any) => {
727
- return postRequest(apiUrls.batchMergeUrl!, param);
728
- };
729
- apiUrls.batchMergeDraftAction = (param: any) => {
730
- return postRequest(apiUrls.batchMergeDraftUrl!, param);
731
- };
732
- apiUrls.loadByIdAction = (id: any, isView: boolean, params: any = {}) => {
733
- return loadById(
734
- isView ? apiUrls.loadByIdForViewUrl! : apiUrls.loadByIdUrl!,
735
- id,
736
- params,
737
- );
738
- };
739
- apiUrls.deleteAction = (params: any) => {
740
- return deleteByIds(apiUrls.deleteUrl!, params);
741
- };
742
- apiUrls.deleteByConditionAction = (params: any) => {
743
- return postRequest(apiUrls.deleteByConditionUrl!, params);
744
- };
745
- apiUrls.exportDataAction = async (param: any) => {
746
- return await download(apiUrls.exportAllUrl!, param);
747
- };
748
- apiUrls.downloadTemplateAction = async (param: any) => {
749
- return await download(apiUrls.downloadTemplateUrl!, param || {});
750
- };
751
- apiUrls.queryConditionAction = (
752
- params: SearchParams[] | any,
753
- orderBy: OrderByInfo[] = [],
754
- ) => {
755
- return loadData(apiUrls.listConditionUrl!, params, orderBy);
756
- };
757
- apiUrls.queryOneByConditionAction = (
758
- params: SearchParams[] | any,
759
- orderBy: OrderByInfo[] = [],
760
- ) => {
761
- return loadData(apiUrls.oneConditionUrl!, params, orderBy);
762
- };
763
- apiUrls.importAction = (param: any) => {
764
- return uploadRequest(apiUrls.importUrl!, param);
765
- };
766
- apiUrls.uploadAction = (param: any) => {
767
- return uploadRequest(apiUrls.uploadUrl!, param);
768
- };
769
- apiUrls.executeAction = (param: any) => {
770
- return postRequest(apiUrls.executeUrl!, param);
771
- };
772
- apiUrls.modifyColumnsAction = (param: any) => {
773
- return postRequest(apiUrls.modifyColumnsUrl!, param);
774
- };
775
- return apiUrls;
776
- }
777
-
778
- /**
779
- * 模态窗口相关属性
780
- */
781
- export function dialogPreps(
782
- title: string = "编辑",
783
- batchTitle: string = "批量编辑",
784
- ): Reactive<DialogProps> {
785
- return reactive<DialogProps>({
786
- bakeVisible1: false,
787
- bakeVisible2: false,
788
- bakeVisible3: false,
789
- ids: 0,
790
- batchDialogTitle: batchTitle,
791
- dialogTitle: title,
792
- batchEditVisible: false,
793
- editVisible: false,
794
- uploadVisible: false,
795
- viewVisible: false,
796
- });
797
- }