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.
Files changed (221) hide show
  1. package/.env.development +3 -0
  2. package/.env.production +3 -0
  3. package/.eslintrc-auto-import.json +77 -0
  4. package/.gitignore +27 -0
  5. package/.idea/.gitignore +5 -0
  6. package/.idea/MarsCodeWorkspaceAppSettings.xml +6 -0
  7. package/.idea/inspectionProfiles/Project_Default.xml +7 -0
  8. package/.idea/modules.xml +8 -0
  9. package/.idea/testcode.iml +12 -0
  10. package/.idea/vcs.xml +6 -0
  11. package/.idea/watcherTasks.xml +4 -0
  12. package/.idea/workspace.xml +207 -0
  13. package/.npmignore +21 -0
  14. package/.prettierignore +26 -0
  15. package/README.md +2 -0
  16. package/auto-imports.d.ts +137 -0
  17. package/components.d.ts +189 -0
  18. package/dist/assets/index.css +1 -1
  19. package/dist/index.es.js +941 -720
  20. package/dist/types/index.d.ts +8 -8
  21. package/eslint.config.js +37 -0
  22. package/index.html +14 -0
  23. package/package-lock.json +8276 -0
  24. package/package.json +6 -6
  25. package/prettier.config.js +20 -0
  26. package/public/logo.svg +660 -0
  27. package/src/App.vue +11 -0
  28. package/src/api/date_utils.ts +219 -0
  29. package/src/api/finger_utils.ts +71 -0
  30. package/src/api/form_utils.ts +281 -0
  31. package/src/api/jquery.min.js +2 -0
  32. package/src/api/pcas-code.json +1 -0
  33. package/src/api/settings.ts +81 -0
  34. package/src/api/star_horse_apis.ts +196 -0
  35. package/src/api/star_horse_utils.ts +797 -0
  36. package/src/api/system.ts +351 -0
  37. package/src/api/user_func.ts +147 -0
  38. package/src/api/valid_utils.ts +165 -0
  39. package/src/assets/css/index.scss +908 -0
  40. package/src/assets/icons.css +574 -0
  41. package/src/assets/star-horse-icons.woff +0 -0
  42. package/src/components/comp/ShDynamicForm.vue +160 -0
  43. package/src/components/comp/ShForm.vue +30 -0
  44. package/src/components/comp/ShTableListColumn.vue +61 -0
  45. package/src/components/comp/StarHorseDataSelector.vue +139 -0
  46. package/src/components/comp/StarHorseDataView.vue +110 -0
  47. package/src/components/comp/StarHorseDataViewItems.vue +61 -0
  48. package/src/components/comp/StarHorseDataViewTable.vue +102 -0
  49. package/src/components/comp/StarHorseDialog.vue +383 -0
  50. package/src/components/comp/StarHorseDraggable.vue +401 -0
  51. package/src/components/comp/StarHorseForm.vue +458 -0
  52. package/src/components/comp/StarHorseFormItem.vue +82 -0
  53. package/src/components/comp/StarHorseFormList.vue +516 -0
  54. package/src/components/comp/StarHorseFormTable.vue +56 -0
  55. package/src/components/comp/StarHorseIcon.vue +76 -0
  56. package/src/components/comp/StarHorseItem.vue +302 -0
  57. package/src/components/comp/StarHorseJsonEditor.vue +115 -0
  58. package/src/components/comp/StarHorsePopover.vue +66 -0
  59. package/src/components/comp/StarHorseSearchComp.vue +253 -0
  60. package/src/components/comp/StarHorseStaticTable.vue +395 -0
  61. package/src/components/comp/StarHorseTableColumn.vue +249 -0
  62. package/src/components/comp/StarHorseTableComp.vue +1193 -0
  63. package/src/components/comp/StarHorseTableViewColumn.vue +61 -0
  64. package/src/components/comp/StarHorseTree.vue +494 -0
  65. package/src/components/comp/index.ts +22 -0
  66. package/src/components/comp/items/UTableColumn.vue +65 -0
  67. package/src/components/comp/items/boxItem.vue +98 -0
  68. package/src/components/comp/items/callitem.ts +9 -0
  69. package/src/components/comp/items/cardItem.vue +152 -0
  70. package/src/components/comp/items/collapseItem.vue +134 -0
  71. package/src/components/comp/items/dytableItem.vue +135 -0
  72. package/src/components/comp/items/otherItem.vue +65 -0
  73. package/src/components/comp/items/tabItem.vue +155 -0
  74. package/src/components/comp/items/tabPanelItem.vue +110 -0
  75. package/src/components/comp/items/tableColumn.vue +129 -0
  76. package/src/components/comp/items/tableItem.vue +97 -0
  77. package/src/components/comp/items/tablebtn.vue +158 -0
  78. package/src/components/comp/items/viewBoxItem.vue +55 -0
  79. package/src/components/comp/items/viewCardItem.vue +47 -0
  80. package/src/components/comp/items/viewCollapseItem.vue +71 -0
  81. package/src/components/comp/items/viewDytableItem.vue +77 -0
  82. package/src/components/comp/items/viewOtherItem.vue +55 -0
  83. package/src/components/comp/items/viewTabItem.vue +77 -0
  84. package/src/components/comp/items/viewTabPanelItem.vue +54 -0
  85. package/src/components/comp/items/viewTableItem.vue +74 -0
  86. package/src/components/comp/selfcomp.ts +9 -0
  87. package/src/components/comp/utils/DataPicker.vue +302 -0
  88. package/src/components/comp/utils/DataTag.vue +51 -0
  89. package/src/components/cron/Crontab-Day.vue +230 -0
  90. package/src/components/cron/Crontab-Hour.vue +165 -0
  91. package/src/components/cron/Crontab-Min.vue +166 -0
  92. package/src/components/cron/Crontab-Month.vue +166 -0
  93. package/src/components/cron/Crontab-Result.vue +615 -0
  94. package/src/components/cron/Crontab-Second.vue +185 -0
  95. package/src/components/cron/Crontab-Week.vue +208 -0
  96. package/src/components/cron/Crontab-Year.vue +183 -0
  97. package/src/components/cron/Crontab.vue +474 -0
  98. package/src/components/enums/ModuleEnums.ts +10 -0
  99. package/src/components/enums/ServiceEnums.ts +18 -0
  100. package/src/components/formcomp/container/box-container.vue +162 -0
  101. package/src/components/formcomp/container/callitem.ts +9 -0
  102. package/src/components/formcomp/container/card-container.vue +170 -0
  103. package/src/components/formcomp/container/collapse-container.vue +133 -0
  104. package/src/components/formcomp/container/dytable-col.vue +448 -0
  105. package/src/components/formcomp/container/dytable-container.vue +57 -0
  106. package/src/components/formcomp/container/dytableUtils.ts +358 -0
  107. package/src/components/formcomp/container/group-box-container.vue +331 -0
  108. package/src/components/formcomp/container/index.ts +6 -0
  109. package/src/components/formcomp/container/tab-container.vue +153 -0
  110. package/src/components/formcomp/container/table-container.vue +249 -0
  111. package/src/components/formcomp/items/allitem.ts +9 -0
  112. package/src/components/formcomp/items/area-item.vue +116 -0
  113. package/src/components/formcomp/items/audio-item.vue +163 -0
  114. package/src/components/formcomp/items/autocomplete-item.vue +118 -0
  115. package/src/components/formcomp/items/barcode-item.vue +87 -0
  116. package/src/components/formcomp/items/base-json-item.vue +207 -0
  117. package/src/components/formcomp/items/button-item.vue +228 -0
  118. package/src/components/formcomp/items/cascade-item.vue +113 -0
  119. package/src/components/formcomp/items/checkbox-item.vue +97 -0
  120. package/src/components/formcomp/items/color-item.vue +70 -0
  121. package/src/components/formcomp/items/cron-item.vue +115 -0
  122. package/src/components/formcomp/items/datetime-item.vue +99 -0
  123. package/src/components/formcomp/items/depart-item.vue +51 -0
  124. package/src/components/formcomp/items/dialog-input-item.vue +207 -0
  125. package/src/components/formcomp/items/divider-item.vue +66 -0
  126. package/src/components/formcomp/items/html-item.vue +65 -0
  127. package/src/components/formcomp/items/htmleditor-item.vue +104 -0
  128. package/src/components/formcomp/items/icon-item.vue +195 -0
  129. package/src/components/formcomp/items/image-item.vue +247 -0
  130. package/src/components/formcomp/items/index.ts +44 -0
  131. package/src/components/formcomp/items/input-item.vue +150 -0
  132. package/src/components/formcomp/items/json-array-item.vue +67 -0
  133. package/src/components/formcomp/items/json-item.vue +66 -0
  134. package/src/components/formcomp/items/markdown-item.vue +77 -0
  135. package/src/components/formcomp/items/number-item.vue +94 -0
  136. package/src/components/formcomp/items/number-range-item.vue +278 -0
  137. package/src/components/formcomp/items/page-select-item.vue +407 -0
  138. package/src/components/formcomp/items/password-item.vue +71 -0
  139. package/src/components/formcomp/items/qrcode-item.vue +84 -0
  140. package/src/components/formcomp/items/radio-item.vue +112 -0
  141. package/src/components/formcomp/items/rate-item.vue +68 -0
  142. package/src/components/formcomp/items/select-item.vue +133 -0
  143. package/src/components/formcomp/items/signature-item.vue +216 -0
  144. package/src/components/formcomp/items/slider-item.vue +68 -0
  145. package/src/components/formcomp/items/starhorse-form-item.vue +334 -0
  146. package/src/components/formcomp/items/switch-item.vue +77 -0
  147. package/src/components/formcomp/items/tag-item.vue +77 -0
  148. package/src/components/formcomp/items/text-item.vue +75 -0
  149. package/src/components/formcomp/items/textarea-item.vue +85 -0
  150. package/src/components/formcomp/items/time-item.vue +77 -0
  151. package/src/components/formcomp/items/time-picker-item.vue +74 -0
  152. package/src/components/formcomp/items/transfer-item.vue +93 -0
  153. package/src/components/formcomp/items/tselect-item.vue +121 -0
  154. package/src/components/formcomp/items/unknown-item.vue +51 -0
  155. package/src/components/formcomp/items/upload-item.vue +189 -0
  156. package/src/components/formcomp/items/user-item.vue +177 -0
  157. package/src/components/formcomp/items/usercomp-item.vue +85 -0
  158. package/src/components/formcomp/items/view-markdown-item.vue +77 -0
  159. package/src/components/formcomp/utils/EditDataDialog.vue +67 -0
  160. package/src/components/formcomp/utils/FieldList.vue +125 -0
  161. package/src/components/formcomp/utils/ItemRelationEventUtils.ts +284 -0
  162. package/src/components/help.vue +31 -0
  163. package/src/components/menu/MenuItem.vue +95 -0
  164. package/src/components/menu/SubMenu.vue +68 -0
  165. package/src/components/menu/SubSystemMenu.vue +142 -0
  166. package/src/components/register.ts +24 -0
  167. package/src/components/system/ContentMenu.vue +260 -0
  168. package/src/components/system/StarHorseButtonList.vue +344 -0
  169. package/src/components/system/StarHorseMenu.vue +97 -0
  170. package/src/components/system/StarHorseSvg.vue +62 -0
  171. package/src/components/system/SystemComp.ts +9 -0
  172. package/src/components/system/index.ts +4 -0
  173. package/src/components/types/ApiUrls.ts +168 -0
  174. package/src/components/types/BtnAction.ts +51 -0
  175. package/src/components/types/BtnAuth.ts +43 -0
  176. package/src/components/types/CompInfo.ts +81 -0
  177. package/src/components/types/DialogProps.ts +55 -0
  178. package/src/components/types/DyCompField.ts +23 -0
  179. package/src/components/types/DynamicNode.ts +42 -0
  180. package/src/components/types/MenusInfo.ts +45 -0
  181. package/src/components/types/PageFieldInfo.ts +530 -0
  182. package/src/components/types/PageProps.ts +25 -0
  183. package/src/components/types/Params.ts +93 -0
  184. package/src/components/types/RuleType.ts +10 -0
  185. package/src/components/types/SearchProps.ts +42 -0
  186. package/src/components/types/ShortKey.ts +30 -0
  187. package/src/components/types/StarHorseType.ts +18 -0
  188. package/src/components/types/index.ts +15 -0
  189. package/src/config/element.ts +15 -0
  190. package/src/config/styles.ts +4 -0
  191. package/src/index.ts +98 -0
  192. package/src/install.ts +33 -0
  193. package/src/lang/en_US.ts +81 -0
  194. package/src/lang/index.ts +35 -0
  195. package/src/lang/zh_CN.ts +84 -0
  196. package/src/main.ts +57 -0
  197. package/src/plugins/AblesPlugin.ts +618 -0
  198. package/src/plugins/registerCompPlugin.ts +15 -0
  199. package/src/sample/test.vue +9 -0
  200. package/src/store/ButtonPermission.ts +101 -0
  201. package/src/store/ConsumerView.ts +52 -0
  202. package/src/store/ContinusConfig.ts +78 -0
  203. package/src/store/CopyerOperation.ts +74 -0
  204. package/src/store/DesignForm.ts +481 -0
  205. package/src/store/DesignPage.ts +59 -0
  206. package/src/store/DynamicForm.ts +241 -0
  207. package/src/store/GlobalConfig.ts +90 -0
  208. package/src/store/SelfOperation.ts +95 -0
  209. package/src/store/UserInfo.ts +88 -0
  210. package/src/store/index.ts +6 -0
  211. package/src/theme/localStorge.ts +16 -0
  212. package/src/theme/theme.ts +27 -0
  213. package/src/utils/FieldOperationUtils.ts +91 -0
  214. package/src/utils/auth.ts +83 -0
  215. package/src/utils/message.ts +69 -0
  216. package/src/utils/preview.ts +125 -0
  217. package/tsconfig.json +39 -0
  218. package/tsconfig.node.json +10 -0
  219. package/vite-env.d.ts +16 -0
  220. package/vite.config.ts +162 -0
  221. package/yarn.lock +4627 -0
@@ -0,0 +1,207 @@
1
+ <script setup lang="ts">
2
+ import { nextTick, onMounted, PropType, ref, shallowRef } from "vue";
3
+ import { warning } from "@/utils/message";
4
+ import { FieldInfo, FieldMapping } from "@/components/types/PageFieldInfo";
5
+ import { isJson } from "@/api/star_horse_utils";
6
+ import {
7
+ allAction,
8
+ checkIsDisabled,
9
+ initCompCallEvent,
10
+ } from "@/components/formcomp/utils/ItemRelationEventUtils";
11
+ import { SearchFields } from "@/components/types";
12
+ import { getDynamicEvents } from "@/api/system";
13
+
14
+ const props = defineProps({
15
+ isDesign: {
16
+ type: Boolean,
17
+ default: false,
18
+ },
19
+ disabled: {
20
+ type: Boolean,
21
+ default: false,
22
+ },
23
+ showFormItem: {
24
+ type: Boolean,
25
+ default: false,
26
+ },
27
+ bareFlag: {
28
+ type: Boolean,
29
+ default: false,
30
+ },
31
+ isSearch: {
32
+ type: Boolean,
33
+ default: false,
34
+ },
35
+ field: {
36
+ type: Object as PropType<any>,
37
+ required: true,
38
+ },
39
+ parentField: {
40
+ type: Object as PropType<any>,
41
+ },
42
+ formInfo: {
43
+ type: Object as PropType<any>,
44
+ },
45
+ });
46
+ const emits = defineEmits(["selfFunc", "selectItem"]);
47
+ const formData = defineModel("formData");
48
+ const dialogInputTableRef = ref();
49
+ let dialogInputVisible = shallowRef(false);
50
+ const itemAction = (prep: any) => {
51
+ allAction(props, emits, formData, prep);
52
+ };
53
+ const selectItem = (row: any) => {
54
+ let data = "";
55
+ let needField = props.field.preps?.needField;
56
+ if (!row || !isJson(row)) {
57
+ let selectDatas = dialogInputTableRef.value.multipleSelection;
58
+ if (!selectDatas) {
59
+ warning("请选择数据");
60
+ return;
61
+ }
62
+ data = selectDatas[0];
63
+ } else {
64
+ data = row;
65
+ }
66
+ //如果没有指定属性,则默认取相同的属性
67
+ let name = props.field.fieldName;
68
+ if (!needField) {
69
+ formData.value[name] = data[name];
70
+ } else {
71
+ needField.forEach((item: FieldMapping) => {
72
+ if (needField.length == 1) {
73
+ formData.value[name] = data[item.sourceField];
74
+ } else {
75
+ formData.value[item.distField] = data[item.sourceField];
76
+ }
77
+ });
78
+ }
79
+ if (props.field.preps?.recall) {
80
+ props.field.preps?.["recall"](row);
81
+ }
82
+ closeAction();
83
+ };
84
+ const closeAction = () => {
85
+ dialogInputVisible.value = false;
86
+ };
87
+ const showVisible = () => {
88
+ dialogInputVisible.value = true;
89
+ nextTick(() => {
90
+ let fields = props.field.preps?.needField;
91
+ let name = props.field.fieldName;
92
+ let realName = name;
93
+ if (props.field.aliasName) {
94
+ realName = props.field?.aliasName;
95
+ }
96
+ if (fields) {
97
+ name = fields.map((item: FieldMapping) => item.sourceField)[0];
98
+ }
99
+ dialogInputTableRef.value?.setDataInfo(name, formData.value[realName]);
100
+ });
101
+ };
102
+
103
+ onMounted(async () => {
104
+ await nextTick();
105
+ let inputPreps = props.field?.preps;
106
+ if (!inputPreps) {
107
+ warning("属性" + props.field?.label + "需要配置params 信息");
108
+ return;
109
+ }
110
+ if (inputPreps.searchFieldList?.length === 0) {
111
+ let searchFieldList: Array<SearchFields> = [];
112
+ inputPreps.fieldList?.forEach((item: FieldInfo) => {
113
+ if (item.searchVisible) {
114
+ let temp: any = {
115
+ ...item,
116
+ };
117
+ if (item.prefix) {
118
+ temp["fieldName"] = item.prefix + "." + temp["fieldName"];
119
+ }
120
+ temp["defaultVisible"] = true;
121
+ if (item?.type == "input" && !item["matchType"]) {
122
+ temp["matchType"] = "lk";
123
+ }
124
+ searchFieldList.push(temp);
125
+ }
126
+ });
127
+ inputPreps.searchFieldList = { fieldList: searchFieldList };
128
+ }
129
+ initCompCallEvent(props, emits, formData);
130
+ });
131
+ </script>
132
+ <template>
133
+ <star-horse-dialog
134
+ :title="field.label + '数据选择'"
135
+ :self-func="true"
136
+ :dialog-visible="dialogInputVisible"
137
+ @merge="selectItem"
138
+ @closeAction="closeAction"
139
+ >
140
+ <el-card class="inner_content">
141
+ <div class="search-content">
142
+ <div class="search_btn">
143
+ <star-horse-search-comp
144
+ @searchData="
145
+ (data: any) => dialogInputTableRef.createSearchParams(data)
146
+ "
147
+ :formData="field.preps?.['searchFieldList']"
148
+ :compUrl="field.preps?.['dataUrl']"
149
+ />
150
+ </div>
151
+ </div>
152
+ <star-horse-table-comp
153
+ :fieldList="{
154
+ cellEditable: false,
155
+ fieldList: field.preps?.['fieldList'],
156
+ }"
157
+
158
+ :primaryKey="field.preps?.['primaryKey']"
159
+ :compUrl="field.preps?.['dataUrl']"
160
+ ref="dialogInputTableRef"
161
+ :dialogInput="true"
162
+ height="400px"
163
+ :filterCondition="field.preps?.['filterCondition']"
164
+ :orderBy="field.preps?.['orderBy']"
165
+ @selectItem="selectItem"
166
+ :dataFormat="field.preps?.['dataFormat']"
167
+ :disableAction="true"
168
+ />
169
+ </el-card>
170
+ </star-horse-dialog>
171
+ <starhorse-form-item
172
+ :showFormItem="showFormItem"
173
+ :isDesign="isDesign"
174
+ :disabled="disabled"
175
+ :bareFlag="bareFlag"
176
+ :formItem="field"
177
+ :parentField="parentField"
178
+ >
179
+ <el-input
180
+ :disabled="checkIsDisabled(props)"
181
+ type="text"
182
+ v-bind="field.preps"
183
+ :fid="field.fieldName"
184
+ v-on="getDynamicEvents(props, itemAction)"
185
+ v-model="formData[field.fieldName]"
186
+ >
187
+ <template #append>
188
+ <el-button
189
+ icon="Search"
190
+ @click="showVisible"
191
+ :disabled="checkIsDisabled(props)"
192
+ />
193
+ </template>
194
+ </el-input>
195
+ </starhorse-form-item>
196
+ </template>
197
+ <style lang="scss" scoped>
198
+ :deep(.el-input-group__append) {
199
+ padding: 0 20px !important;
200
+ }
201
+
202
+ .cell.el-tooltip {
203
+ display: flex;
204
+ align-items: center;
205
+ justify-content: center;
206
+ }
207
+ </style>
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <starhorse-form-item
3
+ :showFormItem="showFormItem"
4
+ :isDesign="isDesign"
5
+ :disabled="disabled"
6
+ :bareFlag="bareFlag"
7
+ :formItem="field"
8
+ :parentField="parentField"
9
+ >
10
+ <el-divider
11
+ :direction="field.preps?.direction || 'horizontal'"
12
+ v-on="getDynamicEvents(props, itemAction)"
13
+ :content-position="field.preps?.contentPosition || 'center'"
14
+ >
15
+ {{ field.preps?.content }}
16
+ </el-divider>
17
+ </starhorse-form-item>
18
+ </template>
19
+ <script setup lang="ts">
20
+ import { onMounted, PropType } from "vue";
21
+ import { allAction } from "@/components/formcomp/utils/ItemRelationEventUtils";
22
+ import { getDynamicEvents } from "@/api/system";
23
+
24
+ const props = defineProps({
25
+ isDesign: {
26
+ type: Boolean,
27
+ default: false,
28
+ },
29
+ disabled: {
30
+ type: Boolean,
31
+ default: false,
32
+ },
33
+ showFormItem: {
34
+ type: Boolean,
35
+ default: false,
36
+ },
37
+ bareFlag: {
38
+ type: Boolean,
39
+ default: false,
40
+ },
41
+ isSearch: {
42
+ type: Boolean,
43
+ default: false,
44
+ },
45
+ field: {
46
+ type: Object as PropType<any>,
47
+ required: true,
48
+ },
49
+ parentField: {
50
+ type: Object as PropType<any>,
51
+ },
52
+ formInfo: {
53
+ type: Object as PropType<any>,
54
+ },
55
+ });
56
+ const emits = defineEmits(["selfFunc", "selectItem"]);
57
+ const formData = defineModel("formData");
58
+
59
+ const itemAction = (prep: any) => {
60
+ allAction(props, emits, formData, prep);
61
+ };
62
+ onMounted(() => {
63
+ formData.value[props.field.fieldName] = props.field.preps?.content;
64
+ });
65
+ </script>
66
+ <style scoped></style>
@@ -0,0 +1,65 @@
1
+ <template>
2
+ <starhorse-form-item
3
+ :showFormItem="showFormItem"
4
+ :isDesign="isDesign"
5
+ :disabled="disabled"
6
+ :bareFlag="bareFlag"
7
+ :formItem="field"
8
+ :parentField="parentField"
9
+ >
10
+ <div
11
+ class="user_html"
12
+ v-html="formData[field.fieldName] || field.preps?.content"
13
+ />
14
+ </starhorse-form-item>
15
+ </template>
16
+ <script setup lang="ts">
17
+ import { onMounted, PropType } from "vue";
18
+
19
+ const props = defineProps({
20
+ isDesign: {
21
+ type: Boolean,
22
+ default: false,
23
+ },
24
+ disabled: {
25
+ type: Boolean,
26
+ default: false,
27
+ },
28
+ showFormItem: {
29
+ type: Boolean,
30
+ default: false,
31
+ },
32
+ bareFlag: {
33
+ type: Boolean,
34
+ default: false,
35
+ },
36
+ isSearch: {
37
+ type: Boolean,
38
+ default: false,
39
+ },
40
+ field: {
41
+ type: Object as PropType<any>,
42
+ required: true,
43
+ },
44
+ parentField: {
45
+ type: Object as PropType<any>,
46
+ },
47
+ formInfo: {
48
+ type: Object as PropType<any>,
49
+ },
50
+ });
51
+ const emits = defineEmits(["selfFunc", "selectItem"]);
52
+ const formData = defineModel("formData");
53
+
54
+ onMounted(() => {
55
+ formData.value[props.field.fieldName] =
56
+ formData.value[props.field.fieldName] || props.field.preps?.content;
57
+ });
58
+ </script>
59
+ <style lang="scss" scoped>
60
+ .user_html {
61
+ width: 100%;
62
+ min-height: 30px;
63
+ height: auto;
64
+ }
65
+ </style>
@@ -0,0 +1,104 @@
1
+ <template>
2
+ <starhorse-form-item
3
+ :showFormItem="showFormItem"
4
+ :isDesign="isDesign"
5
+ :disabled="disabled"
6
+ :bareFlag="bareFlag"
7
+ :formItem="field"
8
+ :parentField="parentField"
9
+ >
10
+ <div style="border: 1px solid #ccc">
11
+ <QuillEditor
12
+ :style="{
13
+ height: field.preps?.height || '300px',
14
+ 'overflow-y': 'hidden',
15
+ }"
16
+ :modules="modules"
17
+ v-on="getDynamicEvents(props, itemAction)"
18
+ v-model="formData[field.fieldName]"
19
+ theme="snow"
20
+ toolbar="full"
21
+ :fid="field.fieldName"
22
+ @onCreated="handleCreated"
23
+ />
24
+ </div>
25
+ </starhorse-form-item>
26
+ </template>
27
+ <script setup lang="ts">
28
+ import { onMounted, PropType, shallowRef } from "vue";
29
+ import { QuillEditor } from "@vueup/vue-quill";
30
+ import "@vueup/vue-quill/dist/vue-quill.snow.css";
31
+ import { allAction } from "@/components/formcomp/utils/ItemRelationEventUtils";
32
+ import { postRequest } from "@/api/star_horse_apis";
33
+ import ImageUploader from "quill-image-uploader";
34
+ import { getDynamicEvents } from "@/api/system";
35
+
36
+ const props = defineProps({
37
+ isDesign: {
38
+ type: Boolean,
39
+ default: false,
40
+ },
41
+ disabled: {
42
+ type: Boolean,
43
+ default: false,
44
+ },
45
+ showFormItem: {
46
+ type: Boolean,
47
+ default: false,
48
+ },
49
+ bareFlag: {
50
+ type: Boolean,
51
+ default: false,
52
+ },
53
+ isSearch: {
54
+ type: Boolean,
55
+ default: false,
56
+ },
57
+ field: {
58
+ type: Object as PropType<any>,
59
+ required: true,
60
+ },
61
+ parentField: {
62
+ type: Object as PropType<any>,
63
+ },
64
+ formInfo: {
65
+ type: Object as PropType<any>,
66
+ },
67
+ });
68
+ const emits = defineEmits(["selfFunc", "selectItem"]);
69
+ const formData = defineModel("formData");
70
+
71
+ const editorRef = shallowRef(); // 编辑器实例,必须用 shallowRef
72
+
73
+ const itemAction = (prep: any) => {
74
+ allAction(props, emits, formData, prep);
75
+ };
76
+
77
+ const handleCreated = (editor: any) => {
78
+ editorRef.value = editor; // 记录 editor 实例,重要!
79
+ };
80
+ const modules: any = {
81
+ name: "imageUploader",
82
+ module: ImageUploader,
83
+ options: {
84
+ upload: (file) => {
85
+ return new Promise((resolve, reject) => {
86
+ const formData = new FormData();
87
+ formData.append("image", file);
88
+
89
+ postRequest("/upload-image", formData)
90
+ .then((res) => {
91
+ console.log(res);
92
+ resolve(res.data.url);
93
+ })
94
+ .catch((err) => {
95
+ reject("Upload failed");
96
+ console.error("Error:", err);
97
+ });
98
+ });
99
+ },
100
+ },
101
+ };
102
+ onMounted(() => {});
103
+ </script>
104
+ <style scoped></style>
@@ -0,0 +1,195 @@
1
+ <template>
2
+ <starhorse-form-item
3
+ :showFormItem="showFormItem"
4
+ :isDesign="isDesign"
5
+ :disabled="disabled"
6
+ :bareFlag="bareFlag"
7
+ :formItem="field"
8
+ :parentField="parentField"
9
+ >
10
+ <el-popover
11
+ :popper-style="{ width: 'inherit !important' }"
12
+ ref="popoverRef"
13
+ :placement="field.preps?.placement ?? 'bottom-start'"
14
+ :disabled="checkIsDisabled(props) || field.preps?.listView"
15
+ trigger="click"
16
+ >
17
+ <template #reference>
18
+ <el-avatar
19
+ v-if="iconType == 'system'"
20
+ fit="fill"
21
+ shape="square"
22
+ :style="{
23
+ 'font-size': field.preps?.listView ? '22px' : '24px',
24
+ background: field.preps?.listView
25
+ ? 'unset'
26
+ : 'var(--el-avatar-bg-color)',
27
+ }"
28
+ :icon="formData[field.fieldName]"
29
+ />
30
+ <star-horse-icon
31
+ :icon-class="formData[field.fieldName]"
32
+ v-else
33
+ size="30px"
34
+ style="
35
+ color: var(--star-horse-style);
36
+ border-radius: 3px;
37
+ border: 1px solid var(--star-horse-light-gray);
38
+ "
39
+ cursor="pointer"
40
+ />
41
+ </template>
42
+ <div class="icon-items">
43
+ <div class="search-box">
44
+ <el-input
45
+ v-model="searchName"
46
+ @keydown.enter="dataSearch"
47
+ clearable
48
+ placeholder="请输入要搜索的图标"
49
+ >
50
+ <template #prefix>
51
+ <star-horse-icon icon-class="search" @click="dataSearch" />
52
+ </template>
53
+ </el-input>
54
+ </div>
55
+ <ul class="system-icon">
56
+ <li
57
+ v-for="sdata in iconList"
58
+ @click="assignIcon(sdata.value)"
59
+ :title="sdata.name"
60
+ :key="sdata.value"
61
+ :class="{ 'icon-active': sdata.value == formData[field.fieldName] }"
62
+ >
63
+ <el-icon
64
+ class="star-icon"
65
+ style="font-size: 35px; color: var(--star-horse-style)"
66
+ v-if="iconType == 'system'"
67
+ >
68
+ <component :is="sdata.value" :key="sdata.value + '_comp'" />
69
+ </el-icon>
70
+ <star-horse-icon
71
+ :icon-class="sdata.value"
72
+ v-else
73
+ size="30px"
74
+ width="30px"
75
+ height="30px"
76
+ style="color: var(--star-horse-style)"
77
+ cursor="pointer"
78
+ />
79
+ </li>
80
+ </ul>
81
+ </div>
82
+ </el-popover>
83
+ </starhorse-form-item>
84
+ </template>
85
+ <script setup lang="ts">
86
+ import { onMounted, PropType, ref, shallowRef, unref, watch } from "vue";
87
+ import {
88
+ checkIsDisabled,
89
+ initCompCallEvent,
90
+ } from "@/components/formcomp/utils/ItemRelationEventUtils";
91
+ import StarHorseIcon from "@/components/comp/StarHorseIcon.vue";
92
+ import StarhorseFormItem from "@/components/formcomp/items/starhorse-form-item.vue";
93
+ import { compDynamicData } from "@/api/star_horse_utils";
94
+
95
+ const props = defineProps({
96
+ isDesign: {
97
+ type: Boolean,
98
+ default: false,
99
+ },
100
+ disabled: {
101
+ type: Boolean,
102
+ default: false,
103
+ },
104
+ showFormItem: {
105
+ type: Boolean,
106
+ default: false,
107
+ },
108
+ bareFlag: {
109
+ type: Boolean,
110
+ default: false,
111
+ },
112
+ isSearch: {
113
+ type: Boolean,
114
+ default: false,
115
+ },
116
+ field: {
117
+ type: Object as PropType<any>,
118
+ required: true,
119
+ },
120
+ parentField: {
121
+ type: Object as PropType<any>,
122
+ },
123
+ formInfo: {
124
+ type: Object as PropType<any>,
125
+ },
126
+ });
127
+ const emits = defineEmits(["selfFunc", "selectItem"]);
128
+ const formData = defineModel("formData");
129
+
130
+ let searchName = ref<string>("");
131
+ let iconList = ref<any>([]);
132
+ let allIconList = ref<any>([]);
133
+ let iconType = ref<string>("system");
134
+ const popoverRef = shallowRef();
135
+ const assignIcon = (iconName: string) => {
136
+ formData.value[props.field.fieldName] = iconName;
137
+ unref(popoverRef).popperRef?.delayHide?.();
138
+ itemAction("blur");
139
+ };
140
+ const dataSearch = () => {
141
+ if (!searchName.value) {
142
+ iconList.value = allIconList.value;
143
+ } else {
144
+ iconList.value = allIconList.value.filter((item: any) => {
145
+ return (
146
+ item.name.toLowerCase().indexOf(searchName.value.toLowerCase()) > -1
147
+ );
148
+ });
149
+ }
150
+ };
151
+ const itemAction = (prep: any) => {
152
+ if (Object.keys(props.field.actions ?? {}).includes("change")) {
153
+ emits("selfFunc", prep, formData.value);
154
+ }
155
+ };
156
+ const init = async () => {
157
+ const dataa = await compDynamicData(props.field);
158
+ if (dataa?.length) {
159
+ allIconList.value = dataa;
160
+ }
161
+ iconType.value = props.field.preps?.iconType ?? "system";
162
+ iconList.value = allIconList.value;
163
+ };
164
+ onMounted(() => {
165
+ init();
166
+ initCompCallEvent(props, emits, formData);
167
+ });
168
+ watch(
169
+ () => formData.value[props.field.fieldName],
170
+ (newVal, oldVal) => {
171
+ itemAction("change");
172
+ },
173
+ );
174
+ </script>
175
+ <style scoped>
176
+ .icon-items {
177
+ width: 100%;
178
+ display: flex;
179
+ flex-direction: column;
180
+
181
+ .system-icon {
182
+ margin-top: 5px;
183
+ justify-content: center;
184
+
185
+ li {
186
+ margin: 1px;
187
+ }
188
+ }
189
+ }
190
+
191
+ .search-box {
192
+ width: 90%;
193
+ margin: 0 auto;
194
+ }
195
+ </style>