star-horse-lowcode 2.7.62 → 2.7.65
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/.env.development +3 -0
- package/.env.production +3 -0
- package/.eslintrc-auto-import.json +77 -0
- package/.gitignore +27 -0
- package/.idea/.gitignore +5 -0
- package/.idea/MarsCodeWorkspaceAppSettings.xml +6 -0
- package/.idea/inspectionProfiles/Project_Default.xml +7 -0
- package/.idea/modules.xml +8 -0
- package/.idea/testcode.iml +12 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/watcherTasks.xml +4 -0
- package/.idea/workspace.xml +207 -0
- package/.npmignore +21 -0
- package/.prettierignore +26 -0
- package/README.md +2 -0
- package/auto-imports.d.ts +137 -0
- package/components.d.ts +189 -0
- package/dist/assets/index.css +1 -1
- package/dist/index.es.js +941 -720
- package/dist/types/index.d.ts +8 -8
- package/eslint.config.js +37 -0
- package/index.html +14 -0
- package/package-lock.json +8276 -0
- package/package.json +6 -6
- package/prettier.config.js +20 -0
- package/public/logo.svg +660 -0
- package/src/App.vue +11 -0
- package/src/api/date_utils.ts +219 -0
- package/src/api/finger_utils.ts +71 -0
- package/src/api/form_utils.ts +281 -0
- package/src/api/jquery.min.js +2 -0
- package/src/api/pcas-code.json +1 -0
- package/src/api/settings.ts +81 -0
- package/src/api/star_horse_apis.ts +196 -0
- package/src/api/star_horse_utils.ts +797 -0
- package/src/api/system.ts +351 -0
- package/src/api/user_func.ts +147 -0
- package/src/api/valid_utils.ts +165 -0
- package/src/assets/css/index.scss +908 -0
- package/src/assets/icons.css +574 -0
- package/src/assets/star-horse-icons.woff +0 -0
- package/src/components/comp/ShDynamicForm.vue +160 -0
- package/src/components/comp/ShForm.vue +30 -0
- package/src/components/comp/ShTableListColumn.vue +61 -0
- package/src/components/comp/StarHorseDataSelector.vue +139 -0
- package/src/components/comp/StarHorseDataView.vue +110 -0
- package/src/components/comp/StarHorseDataViewItems.vue +61 -0
- package/src/components/comp/StarHorseDataViewTable.vue +102 -0
- package/src/components/comp/StarHorseDialog.vue +383 -0
- package/src/components/comp/StarHorseDraggable.vue +401 -0
- package/src/components/comp/StarHorseForm.vue +458 -0
- package/src/components/comp/StarHorseFormItem.vue +82 -0
- package/src/components/comp/StarHorseFormList.vue +516 -0
- package/src/components/comp/StarHorseFormTable.vue +56 -0
- package/src/components/comp/StarHorseIcon.vue +76 -0
- package/src/components/comp/StarHorseItem.vue +302 -0
- package/src/components/comp/StarHorseJsonEditor.vue +115 -0
- package/src/components/comp/StarHorsePopover.vue +66 -0
- package/src/components/comp/StarHorseSearchComp.vue +253 -0
- package/src/components/comp/StarHorseStaticTable.vue +395 -0
- package/src/components/comp/StarHorseTableColumn.vue +249 -0
- package/src/components/comp/StarHorseTableComp.vue +1193 -0
- package/src/components/comp/StarHorseTableViewColumn.vue +61 -0
- package/src/components/comp/StarHorseTree.vue +494 -0
- package/src/components/comp/index.ts +22 -0
- package/src/components/comp/items/UTableColumn.vue +65 -0
- package/src/components/comp/items/boxItem.vue +98 -0
- package/src/components/comp/items/callitem.ts +9 -0
- package/src/components/comp/items/cardItem.vue +152 -0
- package/src/components/comp/items/collapseItem.vue +134 -0
- package/src/components/comp/items/dytableItem.vue +135 -0
- package/src/components/comp/items/otherItem.vue +65 -0
- package/src/components/comp/items/tabItem.vue +155 -0
- package/src/components/comp/items/tabPanelItem.vue +110 -0
- package/src/components/comp/items/tableColumn.vue +129 -0
- package/src/components/comp/items/tableItem.vue +97 -0
- package/src/components/comp/items/tablebtn.vue +158 -0
- package/src/components/comp/items/viewBoxItem.vue +55 -0
- package/src/components/comp/items/viewCardItem.vue +47 -0
- package/src/components/comp/items/viewCollapseItem.vue +71 -0
- package/src/components/comp/items/viewDytableItem.vue +77 -0
- package/src/components/comp/items/viewOtherItem.vue +55 -0
- package/src/components/comp/items/viewTabItem.vue +77 -0
- package/src/components/comp/items/viewTabPanelItem.vue +54 -0
- package/src/components/comp/items/viewTableItem.vue +74 -0
- package/src/components/comp/selfcomp.ts +9 -0
- package/src/components/comp/utils/DataPicker.vue +302 -0
- package/src/components/comp/utils/DataTag.vue +51 -0
- package/src/components/cron/Crontab-Day.vue +230 -0
- package/src/components/cron/Crontab-Hour.vue +165 -0
- package/src/components/cron/Crontab-Min.vue +166 -0
- package/src/components/cron/Crontab-Month.vue +166 -0
- package/src/components/cron/Crontab-Result.vue +615 -0
- package/src/components/cron/Crontab-Second.vue +185 -0
- package/src/components/cron/Crontab-Week.vue +208 -0
- package/src/components/cron/Crontab-Year.vue +183 -0
- package/src/components/cron/Crontab.vue +474 -0
- package/src/components/enums/ModuleEnums.ts +10 -0
- package/src/components/enums/ServiceEnums.ts +18 -0
- package/src/components/formcomp/container/box-container.vue +162 -0
- package/src/components/formcomp/container/callitem.ts +9 -0
- package/src/components/formcomp/container/card-container.vue +170 -0
- package/src/components/formcomp/container/collapse-container.vue +133 -0
- package/src/components/formcomp/container/dytable-col.vue +448 -0
- package/src/components/formcomp/container/dytable-container.vue +57 -0
- package/src/components/formcomp/container/dytableUtils.ts +358 -0
- package/src/components/formcomp/container/group-box-container.vue +331 -0
- package/src/components/formcomp/container/index.ts +6 -0
- package/src/components/formcomp/container/tab-container.vue +153 -0
- package/src/components/formcomp/container/table-container.vue +249 -0
- package/src/components/formcomp/items/allitem.ts +9 -0
- package/src/components/formcomp/items/area-item.vue +116 -0
- package/src/components/formcomp/items/audio-item.vue +163 -0
- package/src/components/formcomp/items/autocomplete-item.vue +118 -0
- package/src/components/formcomp/items/barcode-item.vue +87 -0
- package/src/components/formcomp/items/base-json-item.vue +207 -0
- package/src/components/formcomp/items/button-item.vue +228 -0
- package/src/components/formcomp/items/cascade-item.vue +113 -0
- package/src/components/formcomp/items/checkbox-item.vue +97 -0
- package/src/components/formcomp/items/color-item.vue +70 -0
- package/src/components/formcomp/items/cron-item.vue +115 -0
- package/src/components/formcomp/items/datetime-item.vue +99 -0
- package/src/components/formcomp/items/depart-item.vue +51 -0
- package/src/components/formcomp/items/dialog-input-item.vue +207 -0
- package/src/components/formcomp/items/divider-item.vue +66 -0
- package/src/components/formcomp/items/html-item.vue +65 -0
- package/src/components/formcomp/items/htmleditor-item.vue +104 -0
- package/src/components/formcomp/items/icon-item.vue +195 -0
- package/src/components/formcomp/items/image-item.vue +247 -0
- package/src/components/formcomp/items/index.ts +44 -0
- package/src/components/formcomp/items/input-item.vue +150 -0
- package/src/components/formcomp/items/json-array-item.vue +67 -0
- package/src/components/formcomp/items/json-item.vue +66 -0
- package/src/components/formcomp/items/markdown-item.vue +77 -0
- package/src/components/formcomp/items/number-item.vue +94 -0
- package/src/components/formcomp/items/number-range-item.vue +278 -0
- package/src/components/formcomp/items/page-select-item.vue +407 -0
- package/src/components/formcomp/items/password-item.vue +71 -0
- package/src/components/formcomp/items/qrcode-item.vue +84 -0
- package/src/components/formcomp/items/radio-item.vue +112 -0
- package/src/components/formcomp/items/rate-item.vue +68 -0
- package/src/components/formcomp/items/select-item.vue +133 -0
- package/src/components/formcomp/items/signature-item.vue +216 -0
- package/src/components/formcomp/items/slider-item.vue +68 -0
- package/src/components/formcomp/items/starhorse-form-item.vue +334 -0
- package/src/components/formcomp/items/switch-item.vue +77 -0
- package/src/components/formcomp/items/tag-item.vue +77 -0
- package/src/components/formcomp/items/text-item.vue +75 -0
- package/src/components/formcomp/items/textarea-item.vue +85 -0
- package/src/components/formcomp/items/time-item.vue +77 -0
- package/src/components/formcomp/items/time-picker-item.vue +74 -0
- package/src/components/formcomp/items/transfer-item.vue +93 -0
- package/src/components/formcomp/items/tselect-item.vue +121 -0
- package/src/components/formcomp/items/unknown-item.vue +51 -0
- package/src/components/formcomp/items/upload-item.vue +189 -0
- package/src/components/formcomp/items/user-item.vue +177 -0
- package/src/components/formcomp/items/usercomp-item.vue +85 -0
- package/src/components/formcomp/items/view-markdown-item.vue +77 -0
- package/src/components/formcomp/utils/EditDataDialog.vue +67 -0
- package/src/components/formcomp/utils/FieldList.vue +125 -0
- package/src/components/formcomp/utils/ItemRelationEventUtils.ts +284 -0
- package/src/components/help.vue +31 -0
- package/src/components/menu/MenuItem.vue +95 -0
- package/src/components/menu/SubMenu.vue +68 -0
- package/src/components/menu/SubSystemMenu.vue +142 -0
- package/src/components/register.ts +24 -0
- package/src/components/system/ContentMenu.vue +260 -0
- package/src/components/system/StarHorseButtonList.vue +344 -0
- package/src/components/system/StarHorseMenu.vue +97 -0
- package/src/components/system/StarHorseSvg.vue +62 -0
- package/src/components/system/SystemComp.ts +9 -0
- package/src/components/system/index.ts +4 -0
- package/src/components/types/ApiUrls.ts +168 -0
- package/src/components/types/BtnAction.ts +51 -0
- package/src/components/types/BtnAuth.ts +43 -0
- package/src/components/types/CompInfo.ts +81 -0
- package/src/components/types/DialogProps.ts +55 -0
- package/src/components/types/DyCompField.ts +23 -0
- package/src/components/types/DynamicNode.ts +42 -0
- package/src/components/types/MenusInfo.ts +45 -0
- package/src/components/types/PageFieldInfo.ts +530 -0
- package/src/components/types/PageProps.ts +25 -0
- package/src/components/types/Params.ts +93 -0
- package/src/components/types/RuleType.ts +10 -0
- package/src/components/types/SearchProps.ts +42 -0
- package/src/components/types/ShortKey.ts +30 -0
- package/src/components/types/StarHorseType.ts +18 -0
- package/src/components/types/index.ts +15 -0
- package/src/config/element.ts +15 -0
- package/src/config/styles.ts +4 -0
- package/src/index.ts +98 -0
- package/src/install.ts +33 -0
- package/src/lang/en_US.ts +81 -0
- package/src/lang/index.ts +35 -0
- package/src/lang/zh_CN.ts +84 -0
- package/src/main.ts +57 -0
- package/src/plugins/AblesPlugin.ts +618 -0
- package/src/plugins/registerCompPlugin.ts +15 -0
- package/src/sample/test.vue +9 -0
- package/src/store/ButtonPermission.ts +101 -0
- package/src/store/ConsumerView.ts +52 -0
- package/src/store/ContinusConfig.ts +78 -0
- package/src/store/CopyerOperation.ts +74 -0
- package/src/store/DesignForm.ts +481 -0
- package/src/store/DesignPage.ts +59 -0
- package/src/store/DynamicForm.ts +241 -0
- package/src/store/GlobalConfig.ts +90 -0
- package/src/store/SelfOperation.ts +95 -0
- package/src/store/UserInfo.ts +88 -0
- package/src/store/index.ts +6 -0
- package/src/theme/localStorge.ts +16 -0
- package/src/theme/theme.ts +27 -0
- package/src/utils/FieldOperationUtils.ts +91 -0
- package/src/utils/auth.ts +83 -0
- package/src/utils/message.ts +69 -0
- package/src/utils/preview.ts +125 -0
- package/tsconfig.json +39 -0
- package/tsconfig.node.json +10 -0
- package/vite-env.d.ts +16 -0
- package/vite.config.ts +162 -0
- package/yarn.lock +4627 -0
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
import { defineStore } from "pinia";
|
|
2
|
+
import { SelectOption } from "@/components/types/SearchProps";
|
|
3
|
+
import { Config } from "@/api/settings";
|
|
4
|
+
import { ref, unref } from "vue";
|
|
5
|
+
|
|
6
|
+
export const useDesignFormStore = defineStore("designForm", () => {
|
|
7
|
+
const containerList = ref<Array<any>>([]);
|
|
8
|
+
const formDataList = ref<Array<any>>([]);
|
|
9
|
+
const selfFormDataList = ref<Array<any>>([]);
|
|
10
|
+
const allFormDataList = ref<Array<any>>([]);
|
|
11
|
+
const formInfo = ref<any>({});
|
|
12
|
+
const compList = ref<Array<any>>([]);
|
|
13
|
+
const compListNoLayer = ref<any>([]);
|
|
14
|
+
const formData = ref<any>({});
|
|
15
|
+
const currentComp = ref<Array<any> | any>();
|
|
16
|
+
const currentItemType = ref<string>("");
|
|
17
|
+
const currentCompCategory = ref<string>("");
|
|
18
|
+
const parentCompType = ref<string>("");
|
|
19
|
+
const currentItemId = ref<string>("");
|
|
20
|
+
const currentSubItemId = ref<string>("");
|
|
21
|
+
const currentSubTabName = ref<string>("");
|
|
22
|
+
const isEdit = ref<boolean>(false);
|
|
23
|
+
const componentVisible = ref<boolean>(false);
|
|
24
|
+
const batchEditFieldVisible = ref<boolean>(false);
|
|
25
|
+
const previewVisible = ref<boolean>(false);
|
|
26
|
+
const refresh = ref<number>(0);
|
|
27
|
+
const currentFormPreps = ref<any>({});
|
|
28
|
+
const draggingItem = ref<any>({});
|
|
29
|
+
const isDragging = ref<boolean>(false);
|
|
30
|
+
const shortKeyDisabled = ref<boolean>(false);
|
|
31
|
+
const historyRecord = ref<any>({
|
|
32
|
+
index: -1,
|
|
33
|
+
maxStep: 20,
|
|
34
|
+
datas: [],
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 添加历史记录
|
|
39
|
+
* @param reOrUnDoFlag 是否点击按钮时触发
|
|
40
|
+
*/
|
|
41
|
+
const addHistoryRecord = (reOrUnDoFlag: boolean) => {
|
|
42
|
+
//不需要添加历史记录
|
|
43
|
+
if (reOrUnDoFlag || compList.value.length == 0) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const record = historyRecord;
|
|
47
|
+
const recordData: any = {
|
|
48
|
+
complist: unref(compList),
|
|
49
|
+
currentCompCategory: unref(currentCompCategory),
|
|
50
|
+
currentItemId: unref(currentItemId),
|
|
51
|
+
parentCompType: unref(parentCompType),
|
|
52
|
+
currentItemType: unref(currentItemType),
|
|
53
|
+
currentFormPreps: unref(currentFormPreps),
|
|
54
|
+
};
|
|
55
|
+
record.value.index = -1;
|
|
56
|
+
record.value.datas.splice(0, 0, JSON.stringify(recordData));
|
|
57
|
+
//数据只存20条,当大于20条时,删除最旧的一条
|
|
58
|
+
if (record.value.datas.length > record.value.maxStep) {
|
|
59
|
+
record.value.datas.splice(record.value.datas.length - 1, 1);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* 下一步
|
|
64
|
+
*/
|
|
65
|
+
const redo = () => {
|
|
66
|
+
//数据本身就是最新的
|
|
67
|
+
if (historyRecord.value.index < 0) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
historyRecord.value.index = historyRecord.value.index - 1;
|
|
71
|
+
reAndUnDo();
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const reAndUnDo = () => {
|
|
75
|
+
const record = unref(historyRecord);
|
|
76
|
+
if (!record.datas[record.index]) {
|
|
77
|
+
currentFormPreps.value = {};
|
|
78
|
+
currentItemType.value = "";
|
|
79
|
+
currentComp.value = {};
|
|
80
|
+
currentItemId.value = "";
|
|
81
|
+
parentCompType.value = "";
|
|
82
|
+
currentCompCategory.value = "";
|
|
83
|
+
compList.value = [];
|
|
84
|
+
} else {
|
|
85
|
+
const data = JSON.parse(record.datas[record.index]);
|
|
86
|
+
setCompList(data.complist);
|
|
87
|
+
currentCompCategory.value = data.currentCompCategory;
|
|
88
|
+
currentItemId.value = data.currentItemId;
|
|
89
|
+
parentCompType.value = data.parentCompType;
|
|
90
|
+
currentItemType.value = data.currentItemType;
|
|
91
|
+
currentFormPreps.value = data.currentFormPreps;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 上一步
|
|
97
|
+
*/
|
|
98
|
+
const undo = () => {
|
|
99
|
+
const record = unref(historyRecord);
|
|
100
|
+
historyRecord.value.index = record.index < 0 ? 1 : record.index + 1;
|
|
101
|
+
//上一步大于已存在的数据量
|
|
102
|
+
if (historyRecord.value.index > record.datas.length) {
|
|
103
|
+
historyRecord.value.index = record.datas.length - 1;
|
|
104
|
+
}
|
|
105
|
+
//达到最大步骤,取允许的最大数据
|
|
106
|
+
if (historyRecord.value.index > record.maxStep) {
|
|
107
|
+
historyRecord.value.index = record.maxStep;
|
|
108
|
+
}
|
|
109
|
+
reAndUnDo();
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* 激活组件的数下
|
|
113
|
+
* @param data 数据
|
|
114
|
+
* @param itemType 数据类型
|
|
115
|
+
* @param parentType 父组件类型
|
|
116
|
+
*/
|
|
117
|
+
const selectItem = (data: any, itemType: string, parentType: string) => {
|
|
118
|
+
currentCompCategory.value = data.compType;
|
|
119
|
+
currentItemId.value = data?.id;
|
|
120
|
+
parentCompType.value = parentType;
|
|
121
|
+
currentComp.value = data;
|
|
122
|
+
currentItemType.value = itemType || data.itemType;
|
|
123
|
+
currentFormPreps.value = data.preps || data;
|
|
124
|
+
setIsDragging(false);
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* 刷新页面
|
|
128
|
+
*/
|
|
129
|
+
const setRefresh = () => {
|
|
130
|
+
refresh.value++;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* 选中子组件
|
|
134
|
+
* @param subItemId
|
|
135
|
+
*/
|
|
136
|
+
const setSubItemId = (subItemId: string) => {
|
|
137
|
+
currentSubItemId.value = subItemId;
|
|
138
|
+
};
|
|
139
|
+
const setCurrentSubTabName = (tabName: string) => {
|
|
140
|
+
currentSubTabName.value = tabName;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* 设置表单信息
|
|
144
|
+
* @param formData
|
|
145
|
+
*/
|
|
146
|
+
const setFormInfo = (formData: any) => {
|
|
147
|
+
formInfo.value = {
|
|
148
|
+
...unref(formInfo),
|
|
149
|
+
...formData,
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
const setCompList = (comps: Array<any>) => {
|
|
153
|
+
compList.value = comps;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* 通过组件Id查找数据
|
|
157
|
+
* @param itemId 组件Id
|
|
158
|
+
* @returns
|
|
159
|
+
*/
|
|
160
|
+
const selectItemById = (itemId: string) => {
|
|
161
|
+
if (compListNoLayer.value?.length == 0) {
|
|
162
|
+
loadCompNames();
|
|
163
|
+
}
|
|
164
|
+
return compListNoLayer.value?.find((item: any) => item.id == itemId);
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* 获取属性列表,
|
|
168
|
+
* 如果要使用compListNoLayer 必须先调用loadCompNames 方法
|
|
169
|
+
*/
|
|
170
|
+
const loadCompNames = () => {
|
|
171
|
+
const innerFunc = (datas: Array<any>, tabName?: string) => {
|
|
172
|
+
const selectList: Array<any> = [];
|
|
173
|
+
const compList: Array<any> = [];
|
|
174
|
+
for (const index in datas) {
|
|
175
|
+
const temp: any = datas[index];
|
|
176
|
+
if (temp.itemType == "box" || temp.itemType == "dytable") {
|
|
177
|
+
const elements = temp.preps.elements;
|
|
178
|
+
const children: SelectOption[] = [];
|
|
179
|
+
for (const sindex in elements) {
|
|
180
|
+
const columns = elements[sindex].columns;
|
|
181
|
+
for (const ssindex in columns) {
|
|
182
|
+
const column = columns[ssindex];
|
|
183
|
+
if (column.items && column.items.length > 0) {
|
|
184
|
+
children.push(
|
|
185
|
+
...column.items
|
|
186
|
+
?.map((item: any) => ({
|
|
187
|
+
name: item.preps?.label,
|
|
188
|
+
id: item.preps?.id,
|
|
189
|
+
compType: "item",
|
|
190
|
+
tabName,
|
|
191
|
+
type: item.preps?.itemType,
|
|
192
|
+
value: item.preps?.name,
|
|
193
|
+
}))
|
|
194
|
+
.filter((item: SelectOption) => item.name),
|
|
195
|
+
);
|
|
196
|
+
compList.push(...column.items);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
selectList.push({
|
|
201
|
+
name: temp.preps?.label ?? temp.preps?.itemNameLabel,
|
|
202
|
+
value: temp.preps?.name,
|
|
203
|
+
id: temp.preps?.id,
|
|
204
|
+
tabName,
|
|
205
|
+
type: temp.itemType,
|
|
206
|
+
compType: "container",
|
|
207
|
+
children: children,
|
|
208
|
+
});
|
|
209
|
+
} else if (temp.itemType == "table") {
|
|
210
|
+
const elements = temp.preps.elements;
|
|
211
|
+
const children: SelectOption[] = [];
|
|
212
|
+
for (const index in elements) {
|
|
213
|
+
const element = elements[index];
|
|
214
|
+
if (element.items?.length > 0) {
|
|
215
|
+
children.push(
|
|
216
|
+
...element.items
|
|
217
|
+
?.map((item: any) => ({
|
|
218
|
+
name: item.preps?.label,
|
|
219
|
+
id: item.preps?.id,
|
|
220
|
+
compType: "item",
|
|
221
|
+
tabName,
|
|
222
|
+
type: item.itemType ?? item.preps?.itemType,
|
|
223
|
+
value: item.preps?.name,
|
|
224
|
+
}))
|
|
225
|
+
.filter((item: SelectOption) => item.name),
|
|
226
|
+
);
|
|
227
|
+
compList.push(...element.items);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
selectList.push({
|
|
231
|
+
name: temp.preps?.label,
|
|
232
|
+
value: temp.preps?.batchFieldName,
|
|
233
|
+
tabName,
|
|
234
|
+
id: temp.id,
|
|
235
|
+
type: temp.itemType,
|
|
236
|
+
compType: "container",
|
|
237
|
+
children: children,
|
|
238
|
+
});
|
|
239
|
+
} else if (
|
|
240
|
+
temp.itemType == "tab" ||
|
|
241
|
+
temp.itemType == "collapse" ||
|
|
242
|
+
temp.itemType == "card"
|
|
243
|
+
) {
|
|
244
|
+
const elements = temp.preps?.elements;
|
|
245
|
+
for (const index in elements) {
|
|
246
|
+
const element = elements[index];
|
|
247
|
+
const tempTabName = tabName
|
|
248
|
+
? tabName + "__" + element.tabName
|
|
249
|
+
: tabName;
|
|
250
|
+
const subItems = innerFunc(element.items, tempTabName);
|
|
251
|
+
selectList.push({
|
|
252
|
+
name: element.label,
|
|
253
|
+
value: element.objectName,
|
|
254
|
+
tabName: tempTabName,
|
|
255
|
+
id: temp.id,
|
|
256
|
+
type: temp.itemType,
|
|
257
|
+
compType: "container",
|
|
258
|
+
children: subItems.selectList,
|
|
259
|
+
});
|
|
260
|
+
compList.push(...subItems.compList);
|
|
261
|
+
}
|
|
262
|
+
} else {
|
|
263
|
+
selectList.push({
|
|
264
|
+
name: temp.preps?.label,
|
|
265
|
+
value: temp.preps?.name,
|
|
266
|
+
tabName,
|
|
267
|
+
compType: "item",
|
|
268
|
+
id: temp.preps?.id,
|
|
269
|
+
type: temp.itemType ?? temp.preps?.itemType,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
compList.push(temp);
|
|
273
|
+
}
|
|
274
|
+
return { selectList, compList };
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
const resultDatas = innerFunc(compList.value);
|
|
278
|
+
compListNoLayer.value = resultDatas.compList;
|
|
279
|
+
return resultDatas.selectList;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* 手动添加组件
|
|
284
|
+
* @param comp
|
|
285
|
+
*/
|
|
286
|
+
const addComp = (comp: any) => {
|
|
287
|
+
//如果已存在,则要过滤掉,不能重复添加
|
|
288
|
+
if (Array.isArray(comp)) {
|
|
289
|
+
compList.value = [...compList.value, ...comp];
|
|
290
|
+
} else {
|
|
291
|
+
compList.value.push(comp);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
const setFormData = (data: any) => {
|
|
295
|
+
formData.value = data;
|
|
296
|
+
};
|
|
297
|
+
const setIsEdit = (editFlag: boolean) => {
|
|
298
|
+
isEdit.value = editFlag;
|
|
299
|
+
};
|
|
300
|
+
const setCurrentComp = (currComp: object) => {
|
|
301
|
+
currentComp.value = currComp;
|
|
302
|
+
};
|
|
303
|
+
const setCurrentItemType = (currItemType: string) => {
|
|
304
|
+
currentItemType.value = currItemType;
|
|
305
|
+
};
|
|
306
|
+
const setParentCompType = (parentType: string) => {
|
|
307
|
+
parentCompType.value = parentType;
|
|
308
|
+
};
|
|
309
|
+
const setCurrentItemId = (currItemId: string) => {
|
|
310
|
+
currentItemId.value = currItemId;
|
|
311
|
+
};
|
|
312
|
+
const setCurrentFormPreps = (currFormPreps: any) => {
|
|
313
|
+
currentFormPreps.value = currFormPreps["preps"] || currFormPreps;
|
|
314
|
+
};
|
|
315
|
+
const setContainerList = (list: any) => {
|
|
316
|
+
containerList.value = list;
|
|
317
|
+
};
|
|
318
|
+
const setFormDataList = (list: any) => {
|
|
319
|
+
formDataList.value = list;
|
|
320
|
+
};
|
|
321
|
+
const setSelfFormDataList = (list: any) => {
|
|
322
|
+
selfFormDataList.value = list;
|
|
323
|
+
};
|
|
324
|
+
const setAllFormDataList = (list: any) => {
|
|
325
|
+
allFormDataList.value = list;
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* 正在拖动中的组件
|
|
329
|
+
* @param dragItem
|
|
330
|
+
*/
|
|
331
|
+
const setDraggingItem = (dragItem: any) => {
|
|
332
|
+
draggingItem.value = dragItem;
|
|
333
|
+
setIsDragging(true);
|
|
334
|
+
};
|
|
335
|
+
/**
|
|
336
|
+
* 设置是否正在拖动
|
|
337
|
+
*/
|
|
338
|
+
const setIsDragging = (flag: boolean) => {
|
|
339
|
+
isDragging.value = flag;
|
|
340
|
+
};
|
|
341
|
+
/**
|
|
342
|
+
* 删除数据
|
|
343
|
+
*/
|
|
344
|
+
const removePromise = () => {
|
|
345
|
+
const comps = unref(compList);
|
|
346
|
+
for (let i = 0; i < comps.length; i++) {
|
|
347
|
+
const temp = comps[i];
|
|
348
|
+
if (temp instanceof Promise) {
|
|
349
|
+
temp.then((res) => {
|
|
350
|
+
if (Array.isArray(res)) {
|
|
351
|
+
comps.splice(i, 1, ...res);
|
|
352
|
+
} else {
|
|
353
|
+
comps.splice(i, 1, res);
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
// compList = [...JSON.parse(JSON.stringify(comps))];
|
|
359
|
+
};
|
|
360
|
+
/**
|
|
361
|
+
* 清除所有数据
|
|
362
|
+
*/
|
|
363
|
+
const clearAll = (_initComp: boolean = true) => {
|
|
364
|
+
const ms = new Date().getTime();
|
|
365
|
+
isEdit.value = true;
|
|
366
|
+
isDragging.value = false;
|
|
367
|
+
currentFormPreps.value = {};
|
|
368
|
+
currentItemType.value = "";
|
|
369
|
+
currentComp.value = {};
|
|
370
|
+
currentItemId.value = "";
|
|
371
|
+
currentItemType.value = "";
|
|
372
|
+
parentCompType.value = "";
|
|
373
|
+
currentCompCategory.value = "";
|
|
374
|
+
formInfo.value = {
|
|
375
|
+
rules: "",
|
|
376
|
+
inline: "N",
|
|
377
|
+
labelPosition: "left",
|
|
378
|
+
labelWidth: "",
|
|
379
|
+
labelSuffix: "",
|
|
380
|
+
hideRequiredAsterisk: "N",
|
|
381
|
+
requireAsteriskPosition: "left",
|
|
382
|
+
showMessage: "Y",
|
|
383
|
+
inlineMessage: "N",
|
|
384
|
+
statusIcon: "N",
|
|
385
|
+
primaryKeyPolicy: "manual",
|
|
386
|
+
createTable: "Y",
|
|
387
|
+
validateOnRuleChange: "Y",
|
|
388
|
+
size: Config.compSize,
|
|
389
|
+
disabled: "N",
|
|
390
|
+
dataIndex: 1,
|
|
391
|
+
scrollToError: "N",
|
|
392
|
+
formId: "id" + ms,
|
|
393
|
+
tbName: "tb" + ms,
|
|
394
|
+
};
|
|
395
|
+
compList.value = [];
|
|
396
|
+
formData.value = { index: 1 };
|
|
397
|
+
historyRecord.value = {
|
|
398
|
+
index: -1,
|
|
399
|
+
maxStep: 20,
|
|
400
|
+
datas: [],
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
const setComponentVisible = (visible: boolean) => {
|
|
404
|
+
componentVisible.value = visible;
|
|
405
|
+
};
|
|
406
|
+
const setBatchEditFieldVisible = (visible: boolean) => {
|
|
407
|
+
batchEditFieldVisible.value = visible;
|
|
408
|
+
};
|
|
409
|
+
const setPreviewVisible = (visible: boolean) => {
|
|
410
|
+
previewVisible.value = visible;
|
|
411
|
+
};
|
|
412
|
+
const setShortKeyDisabled = (disabled: boolean) => {
|
|
413
|
+
shortKeyDisabled.value = disabled;
|
|
414
|
+
};
|
|
415
|
+
/**
|
|
416
|
+
* 获取字段索引
|
|
417
|
+
*/
|
|
418
|
+
const getFieldDataIndex = () => {
|
|
419
|
+
if (!formInfo.value["dataIndex"]) {
|
|
420
|
+
formInfo.value["dataIndex"] = 1;
|
|
421
|
+
}
|
|
422
|
+
return formInfo.value["dataIndex"]++;
|
|
423
|
+
};
|
|
424
|
+
return {
|
|
425
|
+
formData,
|
|
426
|
+
formInfo,
|
|
427
|
+
compList,
|
|
428
|
+
containerList,
|
|
429
|
+
formDataList,
|
|
430
|
+
selfFormDataList,
|
|
431
|
+
allFormDataList,
|
|
432
|
+
currentCompCategory,
|
|
433
|
+
currentItemId,
|
|
434
|
+
parentCompType,
|
|
435
|
+
currentItemType,
|
|
436
|
+
currentFormPreps,
|
|
437
|
+
currentSubItemId,
|
|
438
|
+
isEdit,
|
|
439
|
+
isDragging,
|
|
440
|
+
currentComp,
|
|
441
|
+
draggingItem,
|
|
442
|
+
refresh,
|
|
443
|
+
historyRecord,
|
|
444
|
+
componentVisible,
|
|
445
|
+
batchEditFieldVisible,
|
|
446
|
+
previewVisible,
|
|
447
|
+
shortKeyDisabled,
|
|
448
|
+
setCurrentSubTabName,
|
|
449
|
+
selectItemById,
|
|
450
|
+
setAllFormDataList,
|
|
451
|
+
setSelfFormDataList,
|
|
452
|
+
setFormDataList,
|
|
453
|
+
setContainerList,
|
|
454
|
+
addHistoryRecord,
|
|
455
|
+
redo,
|
|
456
|
+
undo,
|
|
457
|
+
selectItem,
|
|
458
|
+
setRefresh,
|
|
459
|
+
setSubItemId,
|
|
460
|
+
setFormInfo,
|
|
461
|
+
setCompList,
|
|
462
|
+
loadCompNames,
|
|
463
|
+
addComp,
|
|
464
|
+
setIsDragging,
|
|
465
|
+
setFormData,
|
|
466
|
+
setIsEdit,
|
|
467
|
+
setCurrentComp,
|
|
468
|
+
setCurrentItemType,
|
|
469
|
+
setParentCompType,
|
|
470
|
+
setCurrentItemId,
|
|
471
|
+
setCurrentFormPreps,
|
|
472
|
+
setDraggingItem,
|
|
473
|
+
removePromise,
|
|
474
|
+
clearAll,
|
|
475
|
+
setComponentVisible,
|
|
476
|
+
setBatchEditFieldVisible,
|
|
477
|
+
setPreviewVisible,
|
|
478
|
+
setShortKeyDisabled,
|
|
479
|
+
getFieldDataIndex,
|
|
480
|
+
};
|
|
481
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { defineStore } from "pinia";
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
import { DynamicNode } from "@/components/types/DynamicNode";
|
|
4
|
+
|
|
5
|
+
export const useDesignPageStore = defineStore("designPage", () => {
|
|
6
|
+
const nodeList = ref<Array<DynamicNode>>([]);
|
|
7
|
+
const currentNode = ref<DynamicNode>(null);
|
|
8
|
+
const isEdit = ref<boolean>(false);
|
|
9
|
+
const defaultZindex = ref<number>(100);
|
|
10
|
+
/**
|
|
11
|
+
* 清除所有数据
|
|
12
|
+
*/
|
|
13
|
+
const clearAll = () => {
|
|
14
|
+
isEdit.value = false;
|
|
15
|
+
nodeList.value = [];
|
|
16
|
+
currentNode.value = null;
|
|
17
|
+
};
|
|
18
|
+
const removeNode = (id: string) => {
|
|
19
|
+
nodeList.value = nodeList.value.filter((node: DynamicNode) => {
|
|
20
|
+
return node.id != id;
|
|
21
|
+
});
|
|
22
|
+
currentNode.value = id == currentNode.value.id ? null : currentNode.value;
|
|
23
|
+
};
|
|
24
|
+
const setNodeList = (list: Array<DynamicNode>) => {
|
|
25
|
+
nodeList.value = list;
|
|
26
|
+
};
|
|
27
|
+
const addNode = (node: DynamicNode) => {
|
|
28
|
+
nodeList.value.push(node);
|
|
29
|
+
};
|
|
30
|
+
const selectNode = (node: DynamicNode) => {
|
|
31
|
+
currentNode.value = node;
|
|
32
|
+
};
|
|
33
|
+
const setIsEdit = (edit: boolean) => {
|
|
34
|
+
isEdit.value = edit;
|
|
35
|
+
};
|
|
36
|
+
const maxZIndex = () => {
|
|
37
|
+
nodeList.value.sort((a: DynamicNode, b: DynamicNode) => {
|
|
38
|
+
return (
|
|
39
|
+
(a.zIndex || defaultZindex.value) - (b.zIndex || defaultZindex.value)
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
return nodeList.value[0].zIndex || defaultZindex.value;
|
|
43
|
+
};
|
|
44
|
+
const init = () => {};
|
|
45
|
+
return {
|
|
46
|
+
nodeList,
|
|
47
|
+
currentNode,
|
|
48
|
+
isEdit,
|
|
49
|
+
defaultZindex,
|
|
50
|
+
setNodeList,
|
|
51
|
+
removeNode,
|
|
52
|
+
addNode,
|
|
53
|
+
selectNode,
|
|
54
|
+
clearAll,
|
|
55
|
+
setIsEdit,
|
|
56
|
+
maxZIndex,
|
|
57
|
+
init,
|
|
58
|
+
};
|
|
59
|
+
});
|