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.
- package/README.md +3 -0
- package/dist/assets/index.css +1 -1
- package/dist/index.es.js +597 -188
- package/dist/types/index.d.ts +30 -0
- package/package.json +3 -3
- package/.env.development +0 -3
- package/.env.production +0 -3
- package/.eslintrc-auto-import.json +0 -77
- package/.gitignore +0 -27
- package/.idea/.gitignore +0 -5
- package/.idea/MarsCodeWorkspaceAppSettings.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -7
- package/.idea/modules.xml +0 -8
- package/.idea/testcode.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/.idea/watcherTasks.xml +0 -4
- package/.idea/workspace.xml +0 -207
- package/.npmignore +0 -21
- package/.prettierignore +0 -26
- package/auto-imports.d.ts +0 -137
- package/components.d.ts +0 -189
- package/eslint.config.js +0 -37
- package/index.html +0 -14
- package/package-lock.json +0 -8276
- package/prettier.config.js +0 -20
- package/public/logo.svg +0 -660
- package/src/App.vue +0 -11
- package/src/api/date_utils.ts +0 -219
- package/src/api/finger_utils.ts +0 -71
- package/src/api/form_utils.ts +0 -281
- package/src/api/jquery.min.js +0 -2
- package/src/api/pcas-code.json +0 -1
- package/src/api/settings.ts +0 -81
- package/src/api/star_horse_apis.ts +0 -196
- package/src/api/star_horse_utils.ts +0 -797
- package/src/api/system.ts +0 -351
- package/src/api/user_func.ts +0 -147
- package/src/api/valid_utils.ts +0 -165
- package/src/assets/css/index.scss +0 -908
- package/src/assets/icons.css +0 -574
- package/src/assets/star-horse-icons.woff +0 -0
- package/src/components/comp/ShDynamicForm.vue +0 -160
- package/src/components/comp/ShForm.vue +0 -30
- package/src/components/comp/ShTableListColumn.vue +0 -61
- package/src/components/comp/StarHorseDataSelector.vue +0 -139
- package/src/components/comp/StarHorseDataView.vue +0 -110
- package/src/components/comp/StarHorseDataViewItems.vue +0 -61
- package/src/components/comp/StarHorseDataViewTable.vue +0 -102
- package/src/components/comp/StarHorseDialog.vue +0 -383
- package/src/components/comp/StarHorseDraggable.vue +0 -401
- package/src/components/comp/StarHorseForm.vue +0 -458
- package/src/components/comp/StarHorseFormItem.vue +0 -82
- package/src/components/comp/StarHorseFormList.vue +0 -516
- package/src/components/comp/StarHorseFormTable.vue +0 -56
- package/src/components/comp/StarHorseIcon.vue +0 -76
- package/src/components/comp/StarHorseItem.vue +0 -302
- package/src/components/comp/StarHorseJsonEditor.vue +0 -115
- package/src/components/comp/StarHorsePopover.vue +0 -66
- package/src/components/comp/StarHorseSearchComp.vue +0 -253
- package/src/components/comp/StarHorseStaticTable.vue +0 -395
- package/src/components/comp/StarHorseTableColumn.vue +0 -249
- package/src/components/comp/StarHorseTableComp.vue +0 -1193
- package/src/components/comp/StarHorseTableViewColumn.vue +0 -61
- package/src/components/comp/StarHorseTree.vue +0 -494
- package/src/components/comp/index.ts +0 -22
- package/src/components/comp/items/UTableColumn.vue +0 -65
- package/src/components/comp/items/boxItem.vue +0 -98
- package/src/components/comp/items/callitem.ts +0 -9
- package/src/components/comp/items/cardItem.vue +0 -152
- package/src/components/comp/items/collapseItem.vue +0 -134
- package/src/components/comp/items/dytableItem.vue +0 -135
- package/src/components/comp/items/otherItem.vue +0 -65
- package/src/components/comp/items/tabItem.vue +0 -155
- package/src/components/comp/items/tabPanelItem.vue +0 -110
- package/src/components/comp/items/tableColumn.vue +0 -129
- package/src/components/comp/items/tableItem.vue +0 -97
- package/src/components/comp/items/tablebtn.vue +0 -158
- package/src/components/comp/items/viewBoxItem.vue +0 -55
- package/src/components/comp/items/viewCardItem.vue +0 -47
- package/src/components/comp/items/viewCollapseItem.vue +0 -71
- package/src/components/comp/items/viewDytableItem.vue +0 -77
- package/src/components/comp/items/viewOtherItem.vue +0 -55
- package/src/components/comp/items/viewTabItem.vue +0 -77
- package/src/components/comp/items/viewTabPanelItem.vue +0 -54
- package/src/components/comp/items/viewTableItem.vue +0 -74
- package/src/components/comp/selfcomp.ts +0 -9
- package/src/components/comp/utils/DataPicker.vue +0 -302
- package/src/components/comp/utils/DataTag.vue +0 -51
- package/src/components/cron/Crontab-Day.vue +0 -230
- package/src/components/cron/Crontab-Hour.vue +0 -165
- package/src/components/cron/Crontab-Min.vue +0 -166
- package/src/components/cron/Crontab-Month.vue +0 -166
- package/src/components/cron/Crontab-Result.vue +0 -615
- package/src/components/cron/Crontab-Second.vue +0 -185
- package/src/components/cron/Crontab-Week.vue +0 -208
- package/src/components/cron/Crontab-Year.vue +0 -183
- package/src/components/cron/Crontab.vue +0 -474
- package/src/components/enums/ModuleEnums.ts +0 -10
- package/src/components/enums/ServiceEnums.ts +0 -18
- package/src/components/formcomp/container/box-container.vue +0 -162
- package/src/components/formcomp/container/callitem.ts +0 -9
- package/src/components/formcomp/container/card-container.vue +0 -170
- package/src/components/formcomp/container/collapse-container.vue +0 -133
- package/src/components/formcomp/container/dytable-col.vue +0 -448
- package/src/components/formcomp/container/dytable-container.vue +0 -57
- package/src/components/formcomp/container/dytableUtils.ts +0 -358
- package/src/components/formcomp/container/group-box-container.vue +0 -331
- package/src/components/formcomp/container/index.ts +0 -6
- package/src/components/formcomp/container/tab-container.vue +0 -153
- package/src/components/formcomp/container/table-container.vue +0 -249
- package/src/components/formcomp/items/allitem.ts +0 -9
- package/src/components/formcomp/items/area-item.vue +0 -116
- package/src/components/formcomp/items/audio-item.vue +0 -163
- package/src/components/formcomp/items/autocomplete-item.vue +0 -118
- package/src/components/formcomp/items/barcode-item.vue +0 -87
- package/src/components/formcomp/items/base-json-item.vue +0 -207
- package/src/components/formcomp/items/button-item.vue +0 -228
- package/src/components/formcomp/items/cascade-item.vue +0 -113
- package/src/components/formcomp/items/checkbox-item.vue +0 -97
- package/src/components/formcomp/items/color-item.vue +0 -70
- package/src/components/formcomp/items/cron-item.vue +0 -115
- package/src/components/formcomp/items/datetime-item.vue +0 -99
- package/src/components/formcomp/items/depart-item.vue +0 -51
- package/src/components/formcomp/items/dialog-input-item.vue +0 -207
- package/src/components/formcomp/items/divider-item.vue +0 -66
- package/src/components/formcomp/items/html-item.vue +0 -65
- package/src/components/formcomp/items/htmleditor-item.vue +0 -104
- package/src/components/formcomp/items/icon-item.vue +0 -195
- package/src/components/formcomp/items/image-item.vue +0 -247
- package/src/components/formcomp/items/index.ts +0 -44
- package/src/components/formcomp/items/input-item.vue +0 -150
- package/src/components/formcomp/items/json-array-item.vue +0 -67
- package/src/components/formcomp/items/json-item.vue +0 -66
- package/src/components/formcomp/items/markdown-item.vue +0 -77
- package/src/components/formcomp/items/number-item.vue +0 -94
- package/src/components/formcomp/items/number-range-item.vue +0 -278
- package/src/components/formcomp/items/page-select-item.vue +0 -407
- package/src/components/formcomp/items/password-item.vue +0 -71
- package/src/components/formcomp/items/qrcode-item.vue +0 -84
- package/src/components/formcomp/items/radio-item.vue +0 -112
- package/src/components/formcomp/items/rate-item.vue +0 -68
- package/src/components/formcomp/items/select-item.vue +0 -133
- package/src/components/formcomp/items/signature-item.vue +0 -216
- package/src/components/formcomp/items/slider-item.vue +0 -68
- package/src/components/formcomp/items/starhorse-form-item.vue +0 -334
- package/src/components/formcomp/items/switch-item.vue +0 -77
- package/src/components/formcomp/items/tag-item.vue +0 -77
- package/src/components/formcomp/items/text-item.vue +0 -75
- package/src/components/formcomp/items/textarea-item.vue +0 -85
- package/src/components/formcomp/items/time-item.vue +0 -77
- package/src/components/formcomp/items/time-picker-item.vue +0 -74
- package/src/components/formcomp/items/transfer-item.vue +0 -93
- package/src/components/formcomp/items/tselect-item.vue +0 -121
- package/src/components/formcomp/items/unknown-item.vue +0 -51
- package/src/components/formcomp/items/upload-item.vue +0 -189
- package/src/components/formcomp/items/user-item.vue +0 -177
- package/src/components/formcomp/items/usercomp-item.vue +0 -85
- package/src/components/formcomp/items/view-markdown-item.vue +0 -77
- package/src/components/formcomp/utils/EditDataDialog.vue +0 -67
- package/src/components/formcomp/utils/FieldList.vue +0 -125
- package/src/components/formcomp/utils/ItemRelationEventUtils.ts +0 -284
- package/src/components/help.vue +0 -31
- package/src/components/menu/MenuItem.vue +0 -95
- package/src/components/menu/SubMenu.vue +0 -68
- package/src/components/menu/SubSystemMenu.vue +0 -142
- package/src/components/register.ts +0 -24
- package/src/components/system/ContentMenu.vue +0 -260
- package/src/components/system/StarHorseButtonList.vue +0 -344
- package/src/components/system/StarHorseMenu.vue +0 -97
- package/src/components/system/StarHorseSvg.vue +0 -62
- package/src/components/system/SystemComp.ts +0 -9
- package/src/components/system/index.ts +0 -4
- package/src/components/types/ApiUrls.ts +0 -168
- package/src/components/types/BtnAction.ts +0 -51
- package/src/components/types/BtnAuth.ts +0 -43
- package/src/components/types/CompInfo.ts +0 -81
- package/src/components/types/DialogProps.ts +0 -55
- package/src/components/types/DyCompField.ts +0 -23
- package/src/components/types/DynamicNode.ts +0 -42
- package/src/components/types/MenusInfo.ts +0 -45
- package/src/components/types/PageFieldInfo.ts +0 -530
- package/src/components/types/PageProps.ts +0 -25
- package/src/components/types/Params.ts +0 -93
- package/src/components/types/RuleType.ts +0 -10
- package/src/components/types/SearchProps.ts +0 -42
- package/src/components/types/ShortKey.ts +0 -30
- package/src/components/types/StarHorseType.ts +0 -18
- package/src/components/types/index.ts +0 -15
- package/src/config/element.ts +0 -15
- package/src/config/styles.ts +0 -4
- package/src/index.ts +0 -98
- package/src/install.ts +0 -33
- package/src/lang/en_US.ts +0 -81
- package/src/lang/index.ts +0 -35
- package/src/lang/zh_CN.ts +0 -84
- package/src/main.ts +0 -57
- package/src/plugins/AblesPlugin.ts +0 -618
- package/src/plugins/registerCompPlugin.ts +0 -15
- package/src/sample/test.vue +0 -9
- package/src/store/ButtonPermission.ts +0 -101
- package/src/store/ConsumerView.ts +0 -52
- package/src/store/ContinusConfig.ts +0 -78
- package/src/store/CopyerOperation.ts +0 -74
- package/src/store/DesignForm.ts +0 -481
- package/src/store/DesignPage.ts +0 -59
- package/src/store/DynamicForm.ts +0 -241
- package/src/store/GlobalConfig.ts +0 -90
- package/src/store/SelfOperation.ts +0 -95
- package/src/store/UserInfo.ts +0 -88
- package/src/store/index.ts +0 -6
- package/src/theme/localStorge.ts +0 -16
- package/src/theme/theme.ts +0 -27
- package/src/utils/FieldOperationUtils.ts +0 -91
- package/src/utils/auth.ts +0 -83
- package/src/utils/message.ts +0 -69
- package/src/utils/preview.ts +0 -125
- package/tsconfig.json +0 -39
- package/tsconfig.node.json +0 -10
- package/vite-env.d.ts +0 -16
- package/vite.config.ts +0 -162
- package/yarn.lock +0 -4627
package/src/App.vue
DELETED
package/src/api/date_utils.ts
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 日期类型
|
|
3
|
-
* @type {string[]}
|
|
4
|
-
*/
|
|
5
|
-
export const dateTypes = [
|
|
6
|
-
"year",
|
|
7
|
-
"years",
|
|
8
|
-
"month",
|
|
9
|
-
"months",
|
|
10
|
-
"date",
|
|
11
|
-
"dates",
|
|
12
|
-
"datetime",
|
|
13
|
-
"week",
|
|
14
|
-
"datetimerange",
|
|
15
|
-
"daterange",
|
|
16
|
-
"monthrange",
|
|
17
|
-
"yearrange",
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* 创建日期
|
|
22
|
-
* @param val
|
|
23
|
-
* @returns {string}
|
|
24
|
-
*/
|
|
25
|
-
export function createDate(val: any) {
|
|
26
|
-
if (!val) {
|
|
27
|
-
return "--";
|
|
28
|
-
}
|
|
29
|
-
return dateParse(val, false);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* 当前日期
|
|
34
|
-
* @param split
|
|
35
|
-
*/
|
|
36
|
-
export function currentDate(split: string = "-") {
|
|
37
|
-
const date = new Date();
|
|
38
|
-
return dateParse(date, false, split);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* 获取当月的开始和结束时间
|
|
43
|
-
*/
|
|
44
|
-
export function currentMonthRange() {
|
|
45
|
-
// 获取当前日期
|
|
46
|
-
return monthRange(new Date());
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function monthRange(date: Date) {
|
|
50
|
-
if (!date) {
|
|
51
|
-
return {};
|
|
52
|
-
}
|
|
53
|
-
// 获取当前月份
|
|
54
|
-
const currentMonth = date.getMonth();
|
|
55
|
-
// 获取当前月份的第一天
|
|
56
|
-
date.setDate(1);
|
|
57
|
-
const firstDay = new Date(date.getTime());
|
|
58
|
-
// 获取当前月份的最后一天
|
|
59
|
-
date.setMonth(currentMonth + 1, 0);
|
|
60
|
-
const lastDay = new Date(date.getTime());
|
|
61
|
-
const year = date.getFullYear();
|
|
62
|
-
let month: number | string = currentMonth + 1;
|
|
63
|
-
month = month < 10 ? "0" + month : month;
|
|
64
|
-
return {
|
|
65
|
-
startDate: firstDay,
|
|
66
|
-
starDateStr: year + "-" + month + "-01",
|
|
67
|
-
lastDate: lastDay,
|
|
68
|
-
lastDateStr: year + "-" + month + "-" + lastDay.getDate(),
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* 将日期解析为字符串
|
|
74
|
-
* @param date
|
|
75
|
-
* @param needTime
|
|
76
|
-
* @param split
|
|
77
|
-
* @param needSecond
|
|
78
|
-
*/
|
|
79
|
-
export function dateParse(
|
|
80
|
-
date: Date,
|
|
81
|
-
needTime: boolean = true,
|
|
82
|
-
split: string = "-",
|
|
83
|
-
needSecond: boolean = false,
|
|
84
|
-
) {
|
|
85
|
-
if (!date) {
|
|
86
|
-
return "";
|
|
87
|
-
}
|
|
88
|
-
const m = date.getMonth() + 1;
|
|
89
|
-
const m1 = m < 10 ? "0" + m : m;
|
|
90
|
-
const day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
|
|
91
|
-
const hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
|
|
92
|
-
const minute =
|
|
93
|
-
date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
|
|
94
|
-
const second =
|
|
95
|
-
date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
|
|
96
|
-
let restr = date.getFullYear() + split + m1 + split + day;
|
|
97
|
-
const tm = hour + ":" + minute;
|
|
98
|
-
if (needTime) {
|
|
99
|
-
restr += " " + tm;
|
|
100
|
-
}
|
|
101
|
-
if (needSecond) {
|
|
102
|
-
restr += ":" + second;
|
|
103
|
-
}
|
|
104
|
-
return restr;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* 创建年月日时分秒
|
|
109
|
-
* @param val
|
|
110
|
-
* @param isDateTime
|
|
111
|
-
* @param needSecond
|
|
112
|
-
* @param split
|
|
113
|
-
*/
|
|
114
|
-
export function createDatetime(
|
|
115
|
-
val: any,
|
|
116
|
-
isDateTime: boolean = true,
|
|
117
|
-
needSecond: boolean = false,
|
|
118
|
-
split: string = "-",
|
|
119
|
-
) {
|
|
120
|
-
if (!val || val == "undefined" || val == "-") {
|
|
121
|
-
return "--";
|
|
122
|
-
}
|
|
123
|
-
try {
|
|
124
|
-
const date = new Date(val);
|
|
125
|
-
return dateParse(date, isDateTime, split, needSecond);
|
|
126
|
-
} catch (e) {
|
|
127
|
-
return val;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// 新增周数计算函数
|
|
132
|
-
function getWeek(date: Date) {
|
|
133
|
-
const target = new Date(date.valueOf());
|
|
134
|
-
const dayNr = (date.getDay() + 6) % 7;
|
|
135
|
-
target.setDate(target.getDate() - dayNr + 3);
|
|
136
|
-
const firstThursday = target.valueOf();
|
|
137
|
-
target.setMonth(0, 1);
|
|
138
|
-
if (target.getDay() !== 4) {
|
|
139
|
-
target.setMonth(0, 1 + ((4 - target.getDay() + 7) % 7));
|
|
140
|
-
}
|
|
141
|
-
return 1 + Math.ceil((firstThursday - target.valueOf()) / 604800000);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* 创建年月日时分秒
|
|
146
|
-
* @param val
|
|
147
|
-
* @param type
|
|
148
|
-
* @param needSecond
|
|
149
|
-
* @param split
|
|
150
|
-
*/
|
|
151
|
-
export function parseDateByType(
|
|
152
|
-
val: any,
|
|
153
|
-
type: string,
|
|
154
|
-
needSecond: boolean = false,
|
|
155
|
-
split: string = "-",
|
|
156
|
-
) {
|
|
157
|
-
if (!val || val == "undefined" || val == "-") {
|
|
158
|
-
return "--";
|
|
159
|
-
}
|
|
160
|
-
try {
|
|
161
|
-
// 处理日期范围数组
|
|
162
|
-
if (Array.isArray(val) && type.includes("range")) {
|
|
163
|
-
const start = val[0];
|
|
164
|
-
const end = val[1];
|
|
165
|
-
const formatStart = parseDateByType(
|
|
166
|
-
start,
|
|
167
|
-
type.replace("range", ""),
|
|
168
|
-
needSecond,
|
|
169
|
-
split,
|
|
170
|
-
);
|
|
171
|
-
const formatEnd = parseDateByType(
|
|
172
|
-
end,
|
|
173
|
-
type.replace("range", ""),
|
|
174
|
-
needSecond,
|
|
175
|
-
split,
|
|
176
|
-
);
|
|
177
|
-
return `${formatStart} 至 ${formatEnd}`;
|
|
178
|
-
}
|
|
179
|
-
// 统一转换日期对象
|
|
180
|
-
let date = val;
|
|
181
|
-
if (!(val instanceof Date)) {
|
|
182
|
-
if (typeof val === "string" && /^\d+$/.test(val)) {
|
|
183
|
-
date = new Date(Number(val));
|
|
184
|
-
} else {
|
|
185
|
-
date = new Date(val);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
// 根据不同类型设置不同格式
|
|
189
|
-
switch (type) {
|
|
190
|
-
case "year":
|
|
191
|
-
case "years":
|
|
192
|
-
return date.getFullYear().toString(); // 返回纯年份
|
|
193
|
-
case "month":
|
|
194
|
-
case "months":
|
|
195
|
-
return (
|
|
196
|
-
date.getFullYear() +
|
|
197
|
-
split +
|
|
198
|
-
(date.getMonth() + 1).toString().padStart(2, "0")
|
|
199
|
-
); // 年月
|
|
200
|
-
case "date":
|
|
201
|
-
case "dates":
|
|
202
|
-
return dateParse(date, false, split); // 年月日
|
|
203
|
-
case "datetime":
|
|
204
|
-
return dateParse(date, true, split, needSecond); // 日期+时间
|
|
205
|
-
case "week":
|
|
206
|
-
return `${date.getFullYear()}年第${getWeek(date)}周`; // 年份和周数
|
|
207
|
-
case "datetimerange":
|
|
208
|
-
return dateParse(date, true, split, needSecond); // 时间范围返回完整时间
|
|
209
|
-
case "daterange":
|
|
210
|
-
case "monthrange":
|
|
211
|
-
case "yearrange":
|
|
212
|
-
return dateParse(date, false, split); // 日期范围返回基础日期
|
|
213
|
-
default:
|
|
214
|
-
return dateParse(date, type.includes("time"), split, needSecond);
|
|
215
|
-
}
|
|
216
|
-
} catch (e) {
|
|
217
|
-
return val;
|
|
218
|
-
}
|
|
219
|
-
}
|
package/src/api/finger_utils.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 客户端生成唯一指纹
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
function getLocalIp() {
|
|
6
|
-
return new Promise((resolve) => {
|
|
7
|
-
const pc = new RTCPeerConnection({ iceServers: [] });
|
|
8
|
-
pc.createDataChannel("");
|
|
9
|
-
|
|
10
|
-
pc.createOffer()
|
|
11
|
-
.then((offer) => pc.setLocalDescription(offer))
|
|
12
|
-
.catch((err) => console.error(err));
|
|
13
|
-
|
|
14
|
-
pc.onicecandidate = (ice: any) => {
|
|
15
|
-
if (ice.candidate) {
|
|
16
|
-
const ip =
|
|
17
|
-
ice.candidate.address ||
|
|
18
|
-
ice.candidate.ip ||
|
|
19
|
-
/([0-9]{1,3}(\.[0-9]{1,3}){3})/.exec(ice.candidate.candidate)?.[1];
|
|
20
|
-
resolve(ip);
|
|
21
|
-
pc.close();
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// 获取硬件信息
|
|
28
|
-
function getHardwareInfo() {
|
|
29
|
-
const hardwareInfo = {
|
|
30
|
-
cpuCores: navigator.hardwareConcurrency,
|
|
31
|
-
deviceMemory: navigator["deviceMemory"] || "unknown",
|
|
32
|
-
screenSize: { width: window.screen.width, height: window.screen.height },
|
|
33
|
-
gpuInfo: {},
|
|
34
|
-
};
|
|
35
|
-
getLocalIp().then((ip) => console.log("本地IP:", ip));
|
|
36
|
-
// 获取 GPU 信息
|
|
37
|
-
const canvas = document.createElement("canvas");
|
|
38
|
-
const gl = canvas.getContext("webgl");
|
|
39
|
-
if (gl) {
|
|
40
|
-
const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
|
|
41
|
-
if (debugInfo) {
|
|
42
|
-
hardwareInfo.gpuInfo = {
|
|
43
|
-
vendor: gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL),
|
|
44
|
-
renderer: gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return hardwareInfo;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* 生成设备 ID
|
|
53
|
-
* @param userIp
|
|
54
|
-
*/
|
|
55
|
-
export async function generateDeviceId(userIp: string) {
|
|
56
|
-
let hardwareInfo = getHardwareInfo();
|
|
57
|
-
if (!userIp) {
|
|
58
|
-
userIp = window.location.hostname;
|
|
59
|
-
}
|
|
60
|
-
const data = { hardwareInfo, userIp };
|
|
61
|
-
let deviceId = btoa(JSON.stringify(data));
|
|
62
|
-
sessionStorage.setItem("deviceId", deviceId);
|
|
63
|
-
return deviceId; // 使用 Base64 编码生成设备 ID
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* 获取设备 ID
|
|
68
|
-
*/
|
|
69
|
-
export function getFingerId() {
|
|
70
|
-
return sessionStorage.getItem("deviceId");
|
|
71
|
-
}
|
package/src/api/form_utils.ts
DELETED
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
import { getValidType } from "@/api/valid_utils";
|
|
2
|
-
import { unref } from "vue";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 解析动态表单中的子节点数据是否需要合并到父节点中
|
|
6
|
-
* @param props
|
|
7
|
-
* @param dataForm
|
|
8
|
-
*/
|
|
9
|
-
export function dynamicFormAnalysis(props: any, dataForm: any) {
|
|
10
|
-
//props.globalCondition 有属性不是子表,需要额外封装
|
|
11
|
-
const globalCondition = props.globalCondition;
|
|
12
|
-
let dataList: any = {};
|
|
13
|
-
if (!globalCondition || globalCondition.length == 0) {
|
|
14
|
-
return dataList;
|
|
15
|
-
}
|
|
16
|
-
for (const key in globalCondition) {
|
|
17
|
-
const temp = globalCondition[key];
|
|
18
|
-
//如果非子表
|
|
19
|
-
if ("N" == temp.subFormFlag) {
|
|
20
|
-
const data = dataForm[temp.tableName];
|
|
21
|
-
delete dataForm[temp.tableName];
|
|
22
|
-
if (Array.isArray(data)) {
|
|
23
|
-
dataList = [];
|
|
24
|
-
data.forEach((item) => {
|
|
25
|
-
dataList.push({ ...item, ...dataForm });
|
|
26
|
-
});
|
|
27
|
-
} else {
|
|
28
|
-
dataList = { ...dataList, ...data, ...dataForm };
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return dataList;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* 创建验证规则
|
|
37
|
-
* @param item
|
|
38
|
-
* @param dataForm
|
|
39
|
-
*/
|
|
40
|
-
export function validMsg(item: any, dataForm: any) {
|
|
41
|
-
const rules = [];
|
|
42
|
-
if (item.required && !item.disabled) {
|
|
43
|
-
rules.push({
|
|
44
|
-
required: true,
|
|
45
|
-
message: `${item.label}不能为空`,
|
|
46
|
-
trigger: "blur",
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
if (item.type == "number-range") {
|
|
50
|
-
const splitName = item.preps?.splitName ?? "-";
|
|
51
|
-
const escapedSplit = splitName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
52
|
-
rules.push({
|
|
53
|
-
pattern: new RegExp(`^\\d+${escapedSplit}\\d+$`),
|
|
54
|
-
message: '格式应为"最小值-最大值"(如:2-3)',
|
|
55
|
-
trigger: "blur",
|
|
56
|
-
});
|
|
57
|
-
rules.push({
|
|
58
|
-
validator: (rule: any, value: string, callback: any) => {
|
|
59
|
-
const minName = item.preps?.minName ?? item.fieldName + "Min";
|
|
60
|
-
const maxName = item.preps?.maxName ?? item.fieldName + "Max";
|
|
61
|
-
// 从formData中获取min和max的实际数值(通过fieldName+Min/Max)
|
|
62
|
-
const minValue = unref(dataForm)[`${minName}`];
|
|
63
|
-
const maxValue = unref(dataForm)[`${maxName}`];
|
|
64
|
-
|
|
65
|
-
if (minValue === undefined || maxValue === undefined) {
|
|
66
|
-
callback(); // 由required规则处理空值
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (maxValue < minValue) {
|
|
70
|
-
callback(new Error("最大值不能小于最小值"));
|
|
71
|
-
} else {
|
|
72
|
-
callback();
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
trigger: "blur", // 输入变化时触发验证
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const itemRules: any = item.rules || item.preps?.rules;
|
|
80
|
-
const innerFun = (itemRules: any) => {
|
|
81
|
-
if (itemRules?.length > 0) {
|
|
82
|
-
if (Array.isArray(itemRules)) {
|
|
83
|
-
itemRules?.forEach((rule: any) => {
|
|
84
|
-
if (rule?.name?.length > 0) {
|
|
85
|
-
rules.push(getValidType(rule.name, rule.options));
|
|
86
|
-
} else {
|
|
87
|
-
if (typeof rule == "string") {
|
|
88
|
-
rules.push(getValidType(rule));
|
|
89
|
-
} else {
|
|
90
|
-
rules.push(rule);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
} else {
|
|
95
|
-
if (itemRules?.name?.length > 0) {
|
|
96
|
-
rules.push(getValidType(itemRules.name, itemRules.options));
|
|
97
|
-
} else {
|
|
98
|
-
if (typeof itemRules == "string") {
|
|
99
|
-
rules.push(getValidType(itemRules));
|
|
100
|
-
} else {
|
|
101
|
-
rules.push(itemRules);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
//解决某些非标准的规则
|
|
108
|
-
innerFun(itemRules);
|
|
109
|
-
return rules;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* 检查对象是否需要创建
|
|
114
|
-
* @param dataForm 数据对象
|
|
115
|
-
* @param item 表单属性
|
|
116
|
-
* @param index 索引
|
|
117
|
-
* @param parentIndex 父索引
|
|
118
|
-
* @param prefix 前缀
|
|
119
|
-
*/
|
|
120
|
-
export function checkObject(
|
|
121
|
-
dataForm: any,
|
|
122
|
-
item: any,
|
|
123
|
-
index: number,
|
|
124
|
-
parentIndex: number,
|
|
125
|
-
prefix: string,
|
|
126
|
-
) {
|
|
127
|
-
return index + 1;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function getFormData(
|
|
131
|
-
item: any,
|
|
132
|
-
dataForm: any,
|
|
133
|
-
prefix: string,
|
|
134
|
-
parentIndex: any,
|
|
135
|
-
index: any,
|
|
136
|
-
) {
|
|
137
|
-
if (item.subFormFlag == "Y") {
|
|
138
|
-
if (item && item.objectName) {
|
|
139
|
-
if (!Object.keys(dataForm).includes(item.objectName)) {
|
|
140
|
-
dataForm[item.objectName] = [{}];
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
let dataIndex = getDataIndex(item, prefix, parentIndex, index);
|
|
144
|
-
let len = dataForm[item.objectName].length;
|
|
145
|
-
if (dataIndex >= len) {
|
|
146
|
-
dataForm[item.objectName].push({});
|
|
147
|
-
dataIndex = len - 1;
|
|
148
|
-
}
|
|
149
|
-
return dataForm[item.objectName][dataIndex];
|
|
150
|
-
}
|
|
151
|
-
return dataForm;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* 获取表单数据索引
|
|
156
|
-
* @param data
|
|
157
|
-
* @param prefix
|
|
158
|
-
* @param parentIndex
|
|
159
|
-
* @param index
|
|
160
|
-
*/
|
|
161
|
-
export function getDataIndex(
|
|
162
|
-
data: any,
|
|
163
|
-
prefix: string,
|
|
164
|
-
parentIndex: any,
|
|
165
|
-
index: any,
|
|
166
|
-
) {
|
|
167
|
-
let pronPrefix: number = 0;
|
|
168
|
-
if (prefix?.length > 0) {
|
|
169
|
-
if (data.subFormFlag == "Y") {
|
|
170
|
-
pronPrefix = parentIndex > -1 ? 0 : index;
|
|
171
|
-
} else {
|
|
172
|
-
pronPrefix = parentIndex;
|
|
173
|
-
}
|
|
174
|
-
} else if (data.subFormFlag == "Y") {
|
|
175
|
-
//如果父表大于0,说明当前是父表的子表,应该用父表的索引
|
|
176
|
-
pronPrefix = parentIndex > 0 ? parentIndex : index;
|
|
177
|
-
} else {
|
|
178
|
-
pronPrefix = -1;
|
|
179
|
-
}
|
|
180
|
-
return pronPrefix;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* 生成验证属性
|
|
185
|
-
* @param prefix 父表标识
|
|
186
|
-
* @param fieldName 字段名称
|
|
187
|
-
* @param parentIndex 父索引
|
|
188
|
-
* @param currentIndex 当前索引
|
|
189
|
-
*/
|
|
190
|
-
export function loadProp(
|
|
191
|
-
prefix: string,
|
|
192
|
-
fieldName: string,
|
|
193
|
-
parentIndex: number,
|
|
194
|
-
currentIndex: number,
|
|
195
|
-
) {
|
|
196
|
-
if (prefix && prefix.length > 0) {
|
|
197
|
-
return (
|
|
198
|
-
prefix +
|
|
199
|
-
"." +
|
|
200
|
-
fieldName +
|
|
201
|
-
(currentIndex > -1
|
|
202
|
-
? "." + currentIndex
|
|
203
|
-
: parentIndex > -1
|
|
204
|
-
? "." + parentIndex
|
|
205
|
-
: "")
|
|
206
|
-
);
|
|
207
|
-
} else if (parentIndex >= 0) {
|
|
208
|
-
return fieldName + "." + parentIndex;
|
|
209
|
-
} else if (currentIndex >= 0) {
|
|
210
|
-
return fieldName + "." + currentIndex;
|
|
211
|
-
} else {
|
|
212
|
-
return fieldName;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* 计算表单Pron
|
|
218
|
-
* @param data
|
|
219
|
-
* @param prefix
|
|
220
|
-
* @param parentIndex
|
|
221
|
-
* @param index
|
|
222
|
-
*/
|
|
223
|
-
export function getPrefix(
|
|
224
|
-
data: any,
|
|
225
|
-
prefix: string,
|
|
226
|
-
parentIndex: any,
|
|
227
|
-
index: any,
|
|
228
|
-
) {
|
|
229
|
-
let pronPrefix = "";
|
|
230
|
-
if (prefix && prefix.length > 0) {
|
|
231
|
-
if (data.subFormFlag == "Y") {
|
|
232
|
-
pronPrefix =
|
|
233
|
-
prefix + "." + data.objectName + "." + (parentIndex > -1 ? 0 : index);
|
|
234
|
-
} else {
|
|
235
|
-
pronPrefix = prefix;
|
|
236
|
-
}
|
|
237
|
-
} else if (data.subFormFlag == "Y") {
|
|
238
|
-
//如果父表大于0,说明当前是父表的子表,应该用父表的索引
|
|
239
|
-
pronPrefix =
|
|
240
|
-
data.objectName + "." + (parentIndex > 0 ? parentIndex : index);
|
|
241
|
-
} else {
|
|
242
|
-
pronPrefix = "";
|
|
243
|
-
}
|
|
244
|
-
return pronPrefix;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* 检查是否可见
|
|
249
|
-
* @param item
|
|
250
|
-
* @param dataForm
|
|
251
|
-
*/
|
|
252
|
-
export function checkVisible(item: any, dataForm: any) {
|
|
253
|
-
return item.formVisible || dataForm["_" + item.fieldName + "Visible"];
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* 解析列表数据
|
|
258
|
-
* @param item
|
|
259
|
-
* @param val
|
|
260
|
-
*/
|
|
261
|
-
export function parseListData(item: any, val: any) {
|
|
262
|
-
return (
|
|
263
|
-
unref(item.preps?.values)?.find((temp: any) => temp.value == val)?.name ||
|
|
264
|
-
unref(item.preps?.data)?.find((temp: any) => temp.value == val)?.name ||
|
|
265
|
-
unref(item.optionList)?.find((temp: any) => temp.value == val)?.name ||
|
|
266
|
-
val
|
|
267
|
-
);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* 过滤对象属性
|
|
272
|
-
* @param obj 要过滤的对象
|
|
273
|
-
* @param keysToRemove 要移除的属性键数组
|
|
274
|
-
*/
|
|
275
|
-
export function filterProperties(obj: any, keysToRemove: string[]) {
|
|
276
|
-
Object.keys(obj).forEach((key) => {
|
|
277
|
-
if (keysToRemove.includes(key)) {
|
|
278
|
-
delete obj[key];
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
}
|