star-horse-lowcode 2.7.65 → 2.7.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/README.md +1 -0
  2. package/dist/assets/index.css +1 -1
  3. package/dist/index.es.js +491 -253
  4. package/package.json +1 -1
  5. package/.env.development +0 -3
  6. package/.env.production +0 -3
  7. package/.eslintrc-auto-import.json +0 -77
  8. package/.gitignore +0 -27
  9. package/.idea/.gitignore +0 -5
  10. package/.idea/MarsCodeWorkspaceAppSettings.xml +0 -6
  11. package/.idea/inspectionProfiles/Project_Default.xml +0 -7
  12. package/.idea/modules.xml +0 -8
  13. package/.idea/testcode.iml +0 -12
  14. package/.idea/vcs.xml +0 -6
  15. package/.idea/watcherTasks.xml +0 -4
  16. package/.idea/workspace.xml +0 -207
  17. package/.npmignore +0 -21
  18. package/.prettierignore +0 -26
  19. package/auto-imports.d.ts +0 -137
  20. package/components.d.ts +0 -189
  21. package/eslint.config.js +0 -37
  22. package/index.html +0 -14
  23. package/package-lock.json +0 -8276
  24. package/prettier.config.js +0 -20
  25. package/public/logo.svg +0 -660
  26. package/src/App.vue +0 -11
  27. package/src/api/date_utils.ts +0 -219
  28. package/src/api/finger_utils.ts +0 -71
  29. package/src/api/form_utils.ts +0 -281
  30. package/src/api/jquery.min.js +0 -2
  31. package/src/api/pcas-code.json +0 -1
  32. package/src/api/settings.ts +0 -81
  33. package/src/api/star_horse_apis.ts +0 -196
  34. package/src/api/star_horse_utils.ts +0 -797
  35. package/src/api/system.ts +0 -351
  36. package/src/api/user_func.ts +0 -147
  37. package/src/api/valid_utils.ts +0 -165
  38. package/src/assets/css/index.scss +0 -908
  39. package/src/assets/icons.css +0 -574
  40. package/src/assets/star-horse-icons.woff +0 -0
  41. package/src/components/comp/ShDynamicForm.vue +0 -160
  42. package/src/components/comp/ShForm.vue +0 -30
  43. package/src/components/comp/ShTableListColumn.vue +0 -61
  44. package/src/components/comp/StarHorseDataSelector.vue +0 -139
  45. package/src/components/comp/StarHorseDataView.vue +0 -110
  46. package/src/components/comp/StarHorseDataViewItems.vue +0 -61
  47. package/src/components/comp/StarHorseDataViewTable.vue +0 -102
  48. package/src/components/comp/StarHorseDialog.vue +0 -383
  49. package/src/components/comp/StarHorseDraggable.vue +0 -401
  50. package/src/components/comp/StarHorseForm.vue +0 -458
  51. package/src/components/comp/StarHorseFormItem.vue +0 -82
  52. package/src/components/comp/StarHorseFormList.vue +0 -516
  53. package/src/components/comp/StarHorseFormTable.vue +0 -56
  54. package/src/components/comp/StarHorseIcon.vue +0 -76
  55. package/src/components/comp/StarHorseItem.vue +0 -302
  56. package/src/components/comp/StarHorseJsonEditor.vue +0 -115
  57. package/src/components/comp/StarHorsePopover.vue +0 -66
  58. package/src/components/comp/StarHorseSearchComp.vue +0 -253
  59. package/src/components/comp/StarHorseStaticTable.vue +0 -395
  60. package/src/components/comp/StarHorseTableColumn.vue +0 -249
  61. package/src/components/comp/StarHorseTableComp.vue +0 -1193
  62. package/src/components/comp/StarHorseTableViewColumn.vue +0 -61
  63. package/src/components/comp/StarHorseTree.vue +0 -494
  64. package/src/components/comp/index.ts +0 -22
  65. package/src/components/comp/items/UTableColumn.vue +0 -65
  66. package/src/components/comp/items/boxItem.vue +0 -98
  67. package/src/components/comp/items/callitem.ts +0 -9
  68. package/src/components/comp/items/cardItem.vue +0 -152
  69. package/src/components/comp/items/collapseItem.vue +0 -134
  70. package/src/components/comp/items/dytableItem.vue +0 -135
  71. package/src/components/comp/items/otherItem.vue +0 -65
  72. package/src/components/comp/items/tabItem.vue +0 -155
  73. package/src/components/comp/items/tabPanelItem.vue +0 -110
  74. package/src/components/comp/items/tableColumn.vue +0 -129
  75. package/src/components/comp/items/tableItem.vue +0 -97
  76. package/src/components/comp/items/tablebtn.vue +0 -158
  77. package/src/components/comp/items/viewBoxItem.vue +0 -55
  78. package/src/components/comp/items/viewCardItem.vue +0 -47
  79. package/src/components/comp/items/viewCollapseItem.vue +0 -71
  80. package/src/components/comp/items/viewDytableItem.vue +0 -77
  81. package/src/components/comp/items/viewOtherItem.vue +0 -55
  82. package/src/components/comp/items/viewTabItem.vue +0 -77
  83. package/src/components/comp/items/viewTabPanelItem.vue +0 -54
  84. package/src/components/comp/items/viewTableItem.vue +0 -74
  85. package/src/components/comp/selfcomp.ts +0 -9
  86. package/src/components/comp/utils/DataPicker.vue +0 -302
  87. package/src/components/comp/utils/DataTag.vue +0 -51
  88. package/src/components/cron/Crontab-Day.vue +0 -230
  89. package/src/components/cron/Crontab-Hour.vue +0 -165
  90. package/src/components/cron/Crontab-Min.vue +0 -166
  91. package/src/components/cron/Crontab-Month.vue +0 -166
  92. package/src/components/cron/Crontab-Result.vue +0 -615
  93. package/src/components/cron/Crontab-Second.vue +0 -185
  94. package/src/components/cron/Crontab-Week.vue +0 -208
  95. package/src/components/cron/Crontab-Year.vue +0 -183
  96. package/src/components/cron/Crontab.vue +0 -474
  97. package/src/components/enums/ModuleEnums.ts +0 -10
  98. package/src/components/enums/ServiceEnums.ts +0 -18
  99. package/src/components/formcomp/container/box-container.vue +0 -162
  100. package/src/components/formcomp/container/callitem.ts +0 -9
  101. package/src/components/formcomp/container/card-container.vue +0 -170
  102. package/src/components/formcomp/container/collapse-container.vue +0 -133
  103. package/src/components/formcomp/container/dytable-col.vue +0 -448
  104. package/src/components/formcomp/container/dytable-container.vue +0 -57
  105. package/src/components/formcomp/container/dytableUtils.ts +0 -358
  106. package/src/components/formcomp/container/group-box-container.vue +0 -331
  107. package/src/components/formcomp/container/index.ts +0 -6
  108. package/src/components/formcomp/container/tab-container.vue +0 -153
  109. package/src/components/formcomp/container/table-container.vue +0 -249
  110. package/src/components/formcomp/items/allitem.ts +0 -9
  111. package/src/components/formcomp/items/area-item.vue +0 -116
  112. package/src/components/formcomp/items/audio-item.vue +0 -163
  113. package/src/components/formcomp/items/autocomplete-item.vue +0 -118
  114. package/src/components/formcomp/items/barcode-item.vue +0 -87
  115. package/src/components/formcomp/items/base-json-item.vue +0 -207
  116. package/src/components/formcomp/items/button-item.vue +0 -228
  117. package/src/components/formcomp/items/cascade-item.vue +0 -113
  118. package/src/components/formcomp/items/checkbox-item.vue +0 -97
  119. package/src/components/formcomp/items/color-item.vue +0 -70
  120. package/src/components/formcomp/items/cron-item.vue +0 -115
  121. package/src/components/formcomp/items/datetime-item.vue +0 -99
  122. package/src/components/formcomp/items/depart-item.vue +0 -51
  123. package/src/components/formcomp/items/dialog-input-item.vue +0 -207
  124. package/src/components/formcomp/items/divider-item.vue +0 -66
  125. package/src/components/formcomp/items/html-item.vue +0 -65
  126. package/src/components/formcomp/items/htmleditor-item.vue +0 -104
  127. package/src/components/formcomp/items/icon-item.vue +0 -195
  128. package/src/components/formcomp/items/image-item.vue +0 -247
  129. package/src/components/formcomp/items/index.ts +0 -44
  130. package/src/components/formcomp/items/input-item.vue +0 -150
  131. package/src/components/formcomp/items/json-array-item.vue +0 -67
  132. package/src/components/formcomp/items/json-item.vue +0 -66
  133. package/src/components/formcomp/items/markdown-item.vue +0 -77
  134. package/src/components/formcomp/items/number-item.vue +0 -94
  135. package/src/components/formcomp/items/number-range-item.vue +0 -278
  136. package/src/components/formcomp/items/page-select-item.vue +0 -407
  137. package/src/components/formcomp/items/password-item.vue +0 -71
  138. package/src/components/formcomp/items/qrcode-item.vue +0 -84
  139. package/src/components/formcomp/items/radio-item.vue +0 -112
  140. package/src/components/formcomp/items/rate-item.vue +0 -68
  141. package/src/components/formcomp/items/select-item.vue +0 -133
  142. package/src/components/formcomp/items/signature-item.vue +0 -216
  143. package/src/components/formcomp/items/slider-item.vue +0 -68
  144. package/src/components/formcomp/items/starhorse-form-item.vue +0 -334
  145. package/src/components/formcomp/items/switch-item.vue +0 -77
  146. package/src/components/formcomp/items/tag-item.vue +0 -77
  147. package/src/components/formcomp/items/text-item.vue +0 -75
  148. package/src/components/formcomp/items/textarea-item.vue +0 -85
  149. package/src/components/formcomp/items/time-item.vue +0 -77
  150. package/src/components/formcomp/items/time-picker-item.vue +0 -74
  151. package/src/components/formcomp/items/transfer-item.vue +0 -93
  152. package/src/components/formcomp/items/tselect-item.vue +0 -121
  153. package/src/components/formcomp/items/unknown-item.vue +0 -51
  154. package/src/components/formcomp/items/upload-item.vue +0 -189
  155. package/src/components/formcomp/items/user-item.vue +0 -177
  156. package/src/components/formcomp/items/usercomp-item.vue +0 -85
  157. package/src/components/formcomp/items/view-markdown-item.vue +0 -77
  158. package/src/components/formcomp/utils/EditDataDialog.vue +0 -67
  159. package/src/components/formcomp/utils/FieldList.vue +0 -125
  160. package/src/components/formcomp/utils/ItemRelationEventUtils.ts +0 -284
  161. package/src/components/help.vue +0 -31
  162. package/src/components/menu/MenuItem.vue +0 -95
  163. package/src/components/menu/SubMenu.vue +0 -68
  164. package/src/components/menu/SubSystemMenu.vue +0 -142
  165. package/src/components/register.ts +0 -24
  166. package/src/components/system/ContentMenu.vue +0 -260
  167. package/src/components/system/StarHorseButtonList.vue +0 -344
  168. package/src/components/system/StarHorseMenu.vue +0 -97
  169. package/src/components/system/StarHorseSvg.vue +0 -62
  170. package/src/components/system/SystemComp.ts +0 -9
  171. package/src/components/system/index.ts +0 -4
  172. package/src/components/types/ApiUrls.ts +0 -168
  173. package/src/components/types/BtnAction.ts +0 -51
  174. package/src/components/types/BtnAuth.ts +0 -43
  175. package/src/components/types/CompInfo.ts +0 -81
  176. package/src/components/types/DialogProps.ts +0 -55
  177. package/src/components/types/DyCompField.ts +0 -23
  178. package/src/components/types/DynamicNode.ts +0 -42
  179. package/src/components/types/MenusInfo.ts +0 -45
  180. package/src/components/types/PageFieldInfo.ts +0 -530
  181. package/src/components/types/PageProps.ts +0 -25
  182. package/src/components/types/Params.ts +0 -93
  183. package/src/components/types/RuleType.ts +0 -10
  184. package/src/components/types/SearchProps.ts +0 -42
  185. package/src/components/types/ShortKey.ts +0 -30
  186. package/src/components/types/StarHorseType.ts +0 -18
  187. package/src/components/types/index.ts +0 -15
  188. package/src/config/element.ts +0 -15
  189. package/src/config/styles.ts +0 -4
  190. package/src/index.ts +0 -98
  191. package/src/install.ts +0 -33
  192. package/src/lang/en_US.ts +0 -81
  193. package/src/lang/index.ts +0 -35
  194. package/src/lang/zh_CN.ts +0 -84
  195. package/src/main.ts +0 -57
  196. package/src/plugins/AblesPlugin.ts +0 -618
  197. package/src/plugins/registerCompPlugin.ts +0 -15
  198. package/src/sample/test.vue +0 -9
  199. package/src/store/ButtonPermission.ts +0 -101
  200. package/src/store/ConsumerView.ts +0 -52
  201. package/src/store/ContinusConfig.ts +0 -78
  202. package/src/store/CopyerOperation.ts +0 -74
  203. package/src/store/DesignForm.ts +0 -481
  204. package/src/store/DesignPage.ts +0 -59
  205. package/src/store/DynamicForm.ts +0 -241
  206. package/src/store/GlobalConfig.ts +0 -90
  207. package/src/store/SelfOperation.ts +0 -95
  208. package/src/store/UserInfo.ts +0 -88
  209. package/src/store/index.ts +0 -6
  210. package/src/theme/localStorge.ts +0 -16
  211. package/src/theme/theme.ts +0 -27
  212. package/src/utils/FieldOperationUtils.ts +0 -91
  213. package/src/utils/auth.ts +0 -83
  214. package/src/utils/message.ts +0 -69
  215. package/src/utils/preview.ts +0 -125
  216. package/tsconfig.json +0 -39
  217. package/tsconfig.node.json +0 -10
  218. package/vite-env.d.ts +0 -16
  219. package/vite.config.ts +0 -162
  220. package/yarn.lock +0 -4627
@@ -1,458 +0,0 @@
1
- <script setup lang="ts" name="StarHorseForm">
2
- import {
3
- inject,
4
- nextTick,
5
- onActivated,
6
- onBeforeUnmount,
7
- onDeactivated,
8
- onMounted,
9
- PropType,
10
- ref,
11
- ShallowReactive,
12
- unref,
13
- watch,
14
- } from "vue";
15
- import {ApiUrls} from "@/components/types/ApiUrls";
16
- import {error, success, warning} from "@/utils/message";
17
- import {postRequest} from "@/api/star_horse_apis";
18
- import {closeLoad, formFieldMapping, isJson, load, loadById,} from "@/api/star_horse_utils";
19
- import {DialogProps} from "@/components/types/DialogProps";
20
- import {BatchFieldInfo, FieldInfo, PageFieldInfo,} from "@/components/types/PageFieldInfo";
21
- import StarHorseFormItem from "@/components/comp/StarHorseFormItem.vue";
22
- import piniaInstance from "@/store";
23
- import {useSelfOperationStore} from "@/store/SelfOperation";
24
- import {SelectOption} from "@/components/types/SearchProps";
25
- import {Config} from "@/api/settings";
26
-
27
- const props = defineProps({
28
- compUrl: {type: Object as PropType<ApiUrls>},
29
- fieldList: {type: Object as PropType<PageFieldInfo>, required: true},
30
- batchName: {type: String, default: "batchDataList"},
31
- batchFieldName: {type: String, default: "batchFieldList"},
32
- outerFormData: {type: Object as PropType<any>},
33
- primaryKey: {type: [String, Object] as PropType<string | any>},
34
- globalCondition: {type: Object},
35
- rules: {type: Object},
36
- formSize: {type: String, default: Config.compSize},
37
- labelPosition: {type: String, default: "left"},
38
- typeModel: {type: String},
39
- dynamicForm: {type: Boolean, default: false},
40
-
41
- selectData: {
42
- type: Array<SelectOption>,
43
- default: () => {
44
- return [
45
- {name: "正常", value: "1"},
46
- {name: "禁用", value: "2"},
47
- ];
48
- },
49
- },
50
- });
51
- let userOperation = useSelfOperationStore(piniaInstance);
52
- //刷新事件,数据已加载事件,导出数据更新数据
53
- const emits = defineEmits([
54
- "refresh",
55
- "dataLoaded",
56
- "exportData",
57
- "removeRow",
58
- "addRow",
59
- "inited",
60
- ]);
61
- const starHorseFormRef = ref(null);
62
- const dataForm = ref<any>({});
63
- // source:{type:Number,default:1},
64
- const source = ref<number>(1);
65
- //更新外面传进来的数据
66
-
67
- const exportData = () => {
68
- emits("exportData", dataForm.value);
69
- };
70
- //向外实时导出数据
71
-
72
- const closeDialog = inject("closeDialog") as Function;
73
- let dialogOperation = inject("dialogOperation") as ShallowReactive<any>;
74
- const dialogProps = inject<DialogProps>("dialogProps", {});
75
- const formFields = inject("formFields", {}) as ShallowReactive<any>;
76
-
77
- const loadData = async () => {
78
- if (!props.compUrl || !props.compUrl.loadByIdUrl || !dialogProps.ids) {
79
- return;
80
- }
81
- await nextTick();
82
- let id = Array.isArray(dialogProps?.ids)
83
- ? dialogProps.ids[0]
84
- : dialogProps?.ids;
85
- let objData;
86
- let params = props.globalCondition || {};
87
- //如果是Json 对象
88
- if (isJson(id)) {
89
- params = {...params, ...id};
90
- objData = await loadById(props.compUrl?.loadByIdUrl!, "", params);
91
- } else {
92
- objData = await loadById(props.compUrl?.loadByIdUrl!, id, params);
93
- }
94
- let data = formFieldMapping(props.fieldList);
95
- dataForm.value = objData;
96
- //如果是动态表单
97
- if (props.dynamicForm) {
98
- for (let i in params) {
99
- let temp = params[i];
100
- if (!temp.subTabFlag) {
101
- let subTemp = {...objData};
102
- delete subTemp[temp.tableName];
103
- dataForm.value[temp.tableName] = [subTemp];
104
- }
105
- }
106
- }
107
- let mapping = data.mappingFields;
108
- if (mapping) {
109
- for (let index in mapping) {
110
- let temp = mapping[index];
111
- if (!Object.keys(objData).includes(temp.name)) {
112
- dataForm.value[temp.name] = dataForm.value[temp.alias];
113
- }
114
- }
115
- }
116
- let actions = data.actions;
117
- if (actions && actions.length > 0) {
118
- for (let index in actions) {
119
- let temp = actions[index];
120
- // let tempFunc: any = objData;
121
- if (temp.actionNames == "change") {
122
- temp.actions(objData);
123
- }
124
- }
125
- }
126
- nextTick(() => {
127
- emits("dataLoaded", objData);
128
- checkActionRelation();
129
- });
130
- };
131
- /**
132
- * 加载了数据,检查是否有数据联动的相关方法
133
- */
134
- const checkActionRelation = () => {
135
- for (let key in formFields) {
136
- let temp = formFields[key];
137
- let preps = temp?.preps;
138
-
139
- if (preps?.actions) {
140
- temp.preps["actions"](dataForm.value);
141
- }
142
- }
143
- };
144
- const merge = (type: string) => {
145
- starHorseFormRef.value!.validate((result: boolean) => {
146
- if (!result) {
147
- return;
148
- }
149
- doMerge(type);
150
- });
151
- };
152
- /**
153
- * 对状态名称赋值
154
- */
155
- const assignStatusName = () => {
156
- if (dataForm.value.statusCode) {
157
- let sData = props.selectData.find(
158
- (item: any) => item.value === dataForm.value.statusCode,
159
- );
160
- if (sData) {
161
- dataForm.value["statusName"] = sData.name;
162
- }
163
- }
164
- let batchFields = props.fieldList?.batchFieldList || [];
165
- batchFields?.forEach((item: BatchFieldInfo) => {
166
- if (dataForm.value[item.batchName]) {
167
- for (
168
- let index = 0;
169
- index < dataForm.value[item.batchName]?.length;
170
- index++
171
- ) {
172
- let temp = dataForm.value[item.batchName][index];
173
- let sData = props.selectData.find(
174
- (sitem: any) => sitem.value === temp.statusCode,
175
- );
176
- if (sData) {
177
- dataForm.value[item.batchName][index]["statusName"] = sData.name;
178
- }
179
- }
180
- }
181
- });
182
- };
183
- const mergeDraft = (type: string) => {
184
- doMerge(type);
185
- };
186
-
187
- const analysisSameToParentField = (): Array<string> => {
188
- let batchName: Array<string> = [];
189
- let batchFields = props.fieldList?.batchFieldList ||[];
190
- const analysis = (batchFields: BatchFieldInfo[]) => {
191
- batchFields?.forEach((item: BatchFieldInfo) => {
192
- if (false === item.subFormFlag || "N" == item.subFormFlag) {
193
- batchName.push(item.batchName);
194
- }
195
- });
196
- };
197
- //单独定义的批量属性
198
- analysis(batchFields);
199
- //嵌入fieldList里的批量属性
200
- let fieldList = props.fieldList?.fieldList || [];
201
- const arrayFieldList = (fieldList: FieldInfo[]) => {
202
- for (let index in fieldList) {
203
- let temp: any = fieldList[index];
204
- if (temp instanceof Array) {
205
- arrayFieldList(temp);
206
- } else if (temp.batchFieldList) {
207
- analysis(temp.batchFieldList);
208
- }
209
- }
210
- };
211
- arrayFieldList(fieldList);
212
- return batchName;
213
- };
214
-
215
- const doMerge = (type: string) => {
216
- assignStatusName();
217
- let tempForm: any = [];
218
- let tempDatas: any = JSON.parse(JSON.stringify(dataForm.value));
219
- let mergeUrl = props.compUrl?.mergeUrl;
220
- let flag = true;
221
- //单独批量数据和嵌入fieldList 里的批量数据
222
- //原则上只支持1个批量表格,多个存在数据对称问题
223
- let sameBatchNames = analysisSameToParentField();
224
- if (sameBatchNames?.length > 0) {
225
- flag = false;
226
- mergeUrl = props.compUrl?.batchMergeUrl;
227
- tempForm = [];
228
- sameBatchNames.forEach((batchName: string) => {
229
- let batchDatas = tempDatas[batchName];
230
- delete tempDatas[batchName];
231
- for (let i in batchDatas) {
232
- //保留第一条数据的ID
233
- if (parseInt(i) > 0) {
234
- delete tempDatas[props.primaryKey];
235
- }
236
- let temp = {...tempDatas, ...batchDatas[i]};
237
- tempForm.push(temp);
238
- }
239
- });
240
- }
241
- let dydata: any = {
242
- relationTables: props.globalCondition,
243
- };
244
- //props.globalCondition 有属性不是子表,需要额外封装
245
-
246
- if (flag) {
247
- tempForm = dataForm.value;
248
- dydata["dataMap"] = tempForm;
249
- } else {
250
- dydata["dataListsMap"] = tempForm;
251
- }
252
- // console.log(sameBatchNames, tempForm, dydata);
253
- load("数据处理中");
254
- //dynamicForm 如果为true 表示动态表单,动态表单需额外封装数据对象
255
- let formData = props.dynamicForm ? dydata : tempForm;
256
- postRequest(mergeUrl!, formData)
257
- .then((res) => {
258
- closeLoad();
259
- if (res.data.code != 0) {
260
- warning(res.data.cnMessage);
261
- return;
262
- } else {
263
- success(res.data.cnMessage);
264
- }
265
- emits("refresh", formData, res.data);
266
- resetForm();
267
- if (type == "close") {
268
- closeDialog();
269
- }
270
- dialogProps.ids = -1;
271
- //关闭弹窗
272
- })
273
- .catch((err) => {
274
- error("接口调用异常" + err);
275
- })
276
- .finally(() => {
277
- closeLoad();
278
- });
279
- };
280
- const resetForm = () => {
281
- dataForm.value = formFieldMapping(props.fieldList)?.defaultDatas;
282
- let data = unref(props.outerFormData);
283
- if (Object.keys(data||{}).length > 0) {
284
- dataForm.value = {...dataForm.value, ...data};
285
- }
286
- };
287
- /**
288
- * 返回表单数据
289
- */
290
- const getFormData = () => {
291
- return dataForm;
292
- };
293
- /**
294
- * 设置表单数据
295
- * @param data
296
- */
297
- const setFormData = (data: any) => {
298
- let mappingData = formFieldMapping(props.fieldList);
299
- let defaultDatas = mappingData.defaultDatas;
300
- dataForm.value = {...defaultDatas, ...data};
301
- };
302
- /**
303
- * 更新数据
304
- * @param data
305
- */
306
- const updateFormData = (data: any) => {
307
- dataForm.value = {...dataForm.value, ...data};
308
- };
309
- /**
310
- * 列表添加行数据
311
- * @param row
312
- */
313
- const addRow = (row: any) => {
314
- emits("addRow", row);
315
- };
316
- /**
317
- * 列表删除行数据
318
- * @param row
319
- */
320
- const removeRow = (row: any) => {
321
- emits("removeRow", row);
322
- };
323
- /**
324
- * 记录当前表单的信息
325
- */
326
- const recordFieldInfo = async () => {
327
- await nextTick();
328
- userOperation.init(props.fieldList, dataForm, starHorseFormRef);
329
- await nextTick();
330
- emits("inited");
331
- };
332
- const tableListRef = ref<any>([]);
333
- onActivated(() => {
334
- recordFieldInfo();
335
- });
336
- onDeactivated(() => {
337
- // userOperation.clearAll();
338
- });
339
- onBeforeUnmount(() => {
340
- userOperation.clearAll();
341
- });
342
- onMounted(() => {
343
- recordFieldInfo();
344
- });
345
- watch(
346
- () => dataForm.value,
347
- () => {
348
- exportData();
349
- },
350
- {immediate: false, deep: true},
351
- );
352
- watch(
353
- () => props.outerFormData,
354
- (val: any) => {
355
- if (val) {
356
- resetForm();
357
- }
358
- },
359
- {immediate: true, deep: true},
360
- );
361
- watch(
362
- () => dialogOperation,
363
- (val: any) => {
364
- const handlers: any = {
365
- merge: () => merge(val.type),
366
- mergeDraft: () => mergeDraft(val.type),
367
- resetForm: () => resetForm(),
368
- };
369
- handlers[val.funcName]?.();
370
- dialogOperation.funcName = "";
371
- dialogOperation["type"] = "";
372
- },
373
- {
374
- immediate: false,
375
- deep: true,
376
- },
377
- );
378
- watch(
379
- () => dialogProps.ids,
380
- (val) => {
381
- console.log("ids", val);
382
- if (!val || val == -1) {
383
- source.value = 1;
384
- setFormData(dataForm.value);
385
- } else {
386
- source.value = 2;
387
- loadData();
388
- }
389
- },
390
- {
391
- immediate: true,
392
- deep: true,
393
- },
394
- );
395
-
396
- defineExpose({
397
- merge,
398
- mergeDraft,
399
- resetForm,
400
- setFormData,
401
- getFormData,
402
- updateFormData,
403
- starHorseFormRef,
404
- tableListRef,
405
- });
406
- </script>
407
- <template>
408
- <el-scrollbar height="100%">
409
- <el-form
410
- :model="dataForm"
411
- :size="formSize"
412
- :rules="rules"
413
- :scroll-to-error="true"
414
- :scroll-into-view-options="true"
415
- :inline-message="false"
416
- :status-icon="true"
417
- :label-position="labelPosition"
418
- require-asterisk-position="right"
419
- label-width="auto"
420
- class="data-form"
421
- ref="starHorseFormRef"
422
- >
423
- <star-horse-form-item
424
- :primaryKey="primaryKey"
425
- :compUrl="compUrl"
426
- :fieldList="fieldList"
427
- :rules="rules"
428
- :compSize="formSize"
429
- v-model:dataForm="dataForm"
430
- :source="source"
431
- @addRow="addRow"
432
- @removeRow="removeRow"
433
- :batchName="batchName"
434
- :batchFieldName="batchFieldName"
435
- />
436
- </el-form>
437
- </el-scrollbar>
438
- <el-form-item v-if="typeModel == 'form'" :size="formSize">
439
- <el-button
440
- @click="merge"
441
- style="
442
- background: var(--star-horse-style);
443
- color: var(--star-horse-white);
444
- "
445
- >
446
- <star-horse-icon
447
- icon-class="save"
448
- style="color: var(--star-horse-white)"
449
- />
450
- 提交
451
- </el-button>
452
- <el-button @click="resetForm" link>
453
- <star-horse-icon icon-class="undo"/>
454
- 重置
455
- </el-button>
456
- </el-form-item>
457
- </template>
458
- <style lang="scss" scoped></style>
@@ -1,82 +0,0 @@
1
- <script setup lang="ts" name="StarHorseFormItem">
2
- import { Config } from "@/api/settings";
3
- import { compKey } from "@/api/system";
4
- import { ApiUrls } from "@/components/types/ApiUrls";
5
- import { PageFieldInfo } from "@/components/types/PageFieldInfo";
6
- import { ModelRef, PropType } from "vue";
7
-
8
- defineProps({
9
- compUrl: { type: Object as PropType<ApiUrls> },
10
- fieldList: { type: Object as PropType<PageFieldInfo | any>, required: true },
11
- objectName: { type: String },
12
- subFormFlag: { type: String, default: "N" },
13
- // 数据索引
14
- dataIndex: { type: Number, default: -1 },
15
- // 父节点名称
16
- propPrefix: { type: String, default: "" },
17
- batchName: { type: String, default: "batchDataList" },
18
- batchFieldName: { type: String, default: "batchFieldList" },
19
- primaryKey: { type: [String, Object] as PropType<string | any> },
20
- compSize: { type: String, default: Config.compSize },
21
- rules: { type: Object },
22
- source: { type: Number, default: 1 },
23
- });
24
- const dataForm: ModelRef<any> = defineModel("dataForm");
25
- const checkItemType = (item: any) => {
26
- if (Array.isArray(item)) {
27
- return "box-item";
28
- } else if (item.cardList?.length > 0) {
29
- return "card-item";
30
- } else if (item.collapseList?.length > 0) {
31
- return "collapse-item";
32
- } else if (item.dytableList?.length > 0) {
33
- return "dytable-item";
34
- } else if (item.tabList?.length > 0 || item.batchFieldList?.length > 0) {
35
- return "tab-item";
36
- } else {
37
- return "other-item";
38
- }
39
- };
40
- </script>
41
- <template>
42
- <template
43
- v-for="(item, index) in fieldList.fieldList"
44
- :key="compKey(item, index, false, 'form')"
45
- >
46
- <component
47
- :Key="compKey(item, index, true)"
48
- :is="checkItemType(item)"
49
- :primary-key="primaryKey"
50
- :item="item"
51
- :rules="rules"
52
- :batchFieldName="batchFieldName"
53
- :batchName="batchName"
54
- :compSize="compSize"
55
- :compUrl="compUrl"
56
- :subFormFlag="subFormFlag"
57
- :source="source"
58
- :objectName="objectName"
59
- :dataIndex="dataIndex"
60
- :propPrefix="propPrefix"
61
- v-model:dataForm="dataForm"
62
- :parentPreps="fieldList.preps"
63
- />
64
- </template>
65
- <table-item
66
- :primary-key="primaryKey"
67
- :item="fieldList"
68
- :rules="rules"
69
- :batchFieldName="batchFieldName"
70
- :batchName="batchName"
71
- :compSize="compSize"
72
- :compUrl="compUrl"
73
- :subFormFlag="subFormFlag"
74
- :source="source"
75
- :objectName="objectName"
76
- :dataIndex="dataIndex"
77
- :propPrefix="propPrefix"
78
- v-model:dataForm="dataForm"
79
- :parentPreps="fieldList.preps"
80
- />
81
- </template>
82
- <style lang="scss" scoped></style>