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,118 +0,0 @@
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-autocomplete
11
- :fid="field.fieldName"
12
- :disabled="checkIsDisabled(props)"
13
- :fetch-suggestions="querySearch"
14
- v-bind="field.preps"
15
- v-on="getDynamicEvents(props, itemAction)"
16
- v-model="formData[field.fieldName]"
17
- />
18
- </starhorse-form-item>
19
- </template>
20
- <script setup lang="ts">
21
- import { onMounted, PropType, watch } from "vue";
22
- import {
23
- compDynamicData,
24
- createFilter,
25
- dynamicUrlOperation,
26
- } from "@/api/star_horse_utils";
27
- import { SearchParams } from "@/components/types/Params";
28
- import {
29
- allAction,
30
- checkIsDisabled,
31
- initCompCallEvent,
32
- } from "@/components/formcomp/utils/ItemRelationEventUtils";
33
- import { getDynamicEvents } from "@/api/system";
34
-
35
- const props = defineProps({
36
- isDesign: {
37
- type: Boolean,
38
- default: false,
39
- },
40
- disabled: {
41
- type: Boolean,
42
- default: false,
43
- },
44
- showFormItem: {
45
- type: Boolean,
46
- default: false,
47
- },
48
- bareFlag: {
49
- type: Boolean,
50
- default: false,
51
- },
52
- isSearch: {
53
- type: Boolean,
54
- default: false,
55
- },
56
- field: {
57
- type: Object as PropType<any>,
58
- required: true,
59
- },
60
- parentField: {
61
- type: Object as PropType<any>,
62
- },
63
- formInfo: {
64
- type: Object as PropType<any>,
65
- },
66
- });
67
- const emits = defineEmits(["selfFunc", "selectItem"]);
68
- const formData = defineModel("formData");
69
-
70
- const itemAction = (prep: any) => {
71
- allAction(props, emits, formData, prep);
72
- };
73
- /**
74
- * 动态获取数据
75
- */
76
- const initData = async () => {
77
- const data = await compDynamicData(props.field);
78
- if (data?.length) {
79
- props.field.preps["values"] = data;
80
- }
81
- };
82
- onMounted(() => {
83
- if (!props.field.preps) {
84
- props.field.preps = {};
85
- }
86
- initData();
87
- initCompCallEvent(props, emits, formData);
88
- });
89
- const querySearch = async (queryString: string, cb: (arg: any) => void) => {
90
- let temp = props.field.preps;
91
- let dataSource = temp["dataSource"];
92
- if (dataSource == "url") {
93
- let searchParams: SearchParams[] = [];
94
- searchParams.push({
95
- propertyName: temp["selectLabel"],
96
- value: queryString,
97
- operation: "lk",
98
- });
99
- temp["values"] = await dynamicUrlOperation(temp, searchParams);
100
- cb(temp["values"]);
101
- } else {
102
- const results = queryString
103
- ? temp["values"].filter(createFilter(queryString))
104
- : temp["values"];
105
- cb(results);
106
- }
107
- };
108
- watch(
109
- () => formData.value[props.field.fieldName + "OptionList"],
110
- (val) => {
111
- if (val?.length > 0) {
112
- props.field.preps["data"] = val;
113
- }
114
- },
115
- { immediate: true },
116
- );
117
- </script>
118
- <style scoped></style>
@@ -1,87 +0,0 @@
1
- <script setup lang="ts">
2
- import Vue3Barcode from "vue3-barcode";
3
- import { computed, nextTick, onMounted, PropType, ref, watch } from "vue";
4
- import { allAction } from "../utils/ItemRelationEventUtils";
5
-
6
- const props = defineProps({
7
- isDesign: {
8
- type: Boolean,
9
- default: false,
10
- },
11
- disabled: {
12
- type: Boolean,
13
- default: false,
14
- },
15
- showFormItem: {
16
- type: Boolean,
17
- default: false,
18
- },
19
- bareFlag: {
20
- type: Boolean,
21
- default: false,
22
- },
23
- isSearch: {
24
- type: Boolean,
25
- default: false,
26
- },
27
- field: {
28
- type: Object as PropType<any>,
29
- required: true,
30
- },
31
- parentField: {
32
- type: Object as PropType<any>,
33
- },
34
- formInfo: {
35
- type: Object as PropType<any>,
36
- },
37
- });
38
- const barcodeRef = ref();
39
- const emits = defineEmits(["selfFunc", "selectItem"]);
40
- const formData = defineModel("formData");
41
- const dataValue = computed(() => formData.value[props.field.preps?.name]);
42
- const createCode = () => {
43
- barcodeRef.value = {
44
- format: props.field.preps?.format ?? "CODE39", //选择要使用的条形码类型
45
- width: props.field.preps?.width ?? 1, //设置条之间的宽度
46
- height: props.field.preps?.height ?? 40, //高度
47
- displayValue: props.field.preps?.displayValue ?? true, //是否在条形码下方显示文字
48
- // text: dataValue.value,//覆盖显示的文本
49
- fontOptions: props.field.preps?.fontOptions, //使文字加粗体或变斜体
50
- font: props.field.preps?.font, //设置文本的字体
51
- textAlign: props.field.preps?.textAlign ?? "center", //设置文本的水平对齐方式
52
- textPosition: props.field.preps?.textPosition ?? "bottom", //设置文本的垂直位置
53
- textMargin: props.field.preps?.textMargin ?? 5, //设置条形码和文本之间的间距
54
- fontSize: props.field.preps?.fontSize ?? 15, //设置文本的大小
55
- background: props.field.preps?.fontSize ?? "#fff", //设置条形码的背景
56
- lineColor: props.field.preps?.fontSize ?? "#000", //设置条和文本的颜色。
57
- margin: props.field.preps?.margin ?? 15, //设置条形码周围的空白边距
58
- };
59
- };
60
- onMounted(() => {
61
- nextTick(() => {
62
- createCode();
63
- allAction(props, emits, formData, "change", true);
64
- });
65
- });
66
- watch(
67
- () => [dataValue.value, props.field.preps],
68
- () => {
69
- createCode();
70
- allAction(props, emits, formData, "change", false);
71
- },
72
- { immediate: false, deep: true },
73
- );
74
- </script>
75
- <template>
76
- <starhorse-form-item
77
- :showFormItem="showFormItem"
78
- :isDesign="isDesign"
79
- :disabled="disabled"
80
- :bareFlag="bareFlag"
81
- :formItem="field"
82
- :parentField="parentField"
83
- >
84
- <Vue3Barcode :value="dataValue" :options="barcodeRef" />
85
- </starhorse-form-item>
86
- </template>
87
- <style scoped></style>
@@ -1,207 +0,0 @@
1
- <template>
2
- <!-- 对话框部分(与原 json-item.vue 完全一致) -->
3
- <star-horse-dialog
4
- :title="field.label + 'JSON编辑'"
5
- :self-func="true"
6
- :dialog-visible="dialogInputVisible"
7
- @merge="selectItem"
8
- @resetForm="resetForm"
9
- @closeAction="closeAction"
10
- >
11
- <star-horse-json-editor
12
- v-if="field.preps?.devType"
13
- v-model:modelValue="jsonData"
14
- style="height: 100vh"
15
- />
16
- <star-horse-form v-else :field-list="jsonTableField" ref="jsonFormRef" />
17
- </star-horse-dialog>
18
-
19
- <!-- 输入框+按钮部分(与原 json-item.vue 完全一致) -->
20
- <starhorse-form-item
21
- :isDesign="isDesign"
22
- :disabled="disabled"
23
- :showFormItem="showFormItem"
24
- :bareFlag="bareFlag"
25
- :formItem="field"
26
- :parentField="parentField"
27
- >
28
- <div class="json-comp">
29
- <div class="json-box">
30
- <el-input
31
- :fid="field.fieldName"
32
- :disabled="checkIsDisabled(props)"
33
- :rows="field.preps?.rows || 3"
34
- type="textarea"
35
- resize="vertical"
36
- readonly
37
- v-on="getDynamicEvents(props, itemAction)"
38
- v-model="formData[field.fieldName]"
39
- />
40
- </div>
41
- <div class="json-btn">
42
- <star-horse-icon
43
- class="w-full"
44
- @click="editJsonData(false)"
45
- icon-class="edit"
46
- style="cursor: pointer"
47
- title="设计模式编辑"
48
- />
49
- <div class="h-[10px]" />
50
- <star-horse-icon
51
- @click="editJsonData(true)"
52
- icon-class="code"
53
- style="cursor: pointer"
54
- title="开发模式编辑"
55
- />
56
- </div>
57
- </div>
58
- </starhorse-form-item>
59
- </template>
60
-
61
- <script setup lang="ts">
62
- import { nextTick, PropType, reactive, shallowRef } from "vue";
63
- import { PageFieldInfo } from "@/components/types/PageFieldInfo";
64
- import {
65
- allAction,
66
- checkIsDisabled,
67
- } from "@/components/formcomp/utils/ItemRelationEventUtils";
68
- import { isJson } from "@/api/star_horse_utils";
69
- import { getDynamicEvents } from "@/api/system";
70
- import JSON5 from "json5";
71
-
72
- // 公共 props(两个组件原有的 props 完全一致)
73
- const props = defineProps({
74
- isDesign: { type: Boolean, default: false },
75
- showFormItem: { type: Boolean, default: false },
76
- disabled: { type: Boolean, default: false },
77
- bareFlag: { type: Boolean, default: false },
78
- isSearch: { type: Boolean, default: false },
79
- field: { type: Object as PropType<any>, required: true },
80
- parentField: { type: Object as PropType<any> },
81
- formInfo: { type: Object as PropType<any> },
82
- // 新增:区分 JSON 对象/数组的关键参数
83
- dataType: {
84
- type: String,
85
- default: "object",
86
- validator: (v) => ["object", "array"].includes(v),
87
- },
88
- });
89
-
90
- const emits = defineEmits(["selfFunc", "selectItem"]);
91
- const formData = defineModel("formData");
92
- const dialogInputVisible = shallowRef(false);
93
- const jsonFormRef = shallowRef();
94
- const jsonData = shallowRef<any>({}); // 统一存储解析后的 JSON 数据(对象或数组)
95
-
96
- // 公共的表格字段配置(两个组件原有的 jsonTableField 完全一致)
97
- const jsonTableField = reactive<PageFieldInfo>({
98
- batchFieldList: [
99
- {
100
- batchName: "jsonDatas",
101
- fieldList: [
102
- {
103
- label: "Name/名称",
104
- fieldName: "name",
105
- required: true,
106
- formVisible: true,
107
- },
108
- {
109
- label: "Value/值",
110
- fieldName: "value",
111
- required: true,
112
- formVisible: true,
113
- },
114
- ],
115
- },
116
- ],
117
- });
118
-
119
- // 公共事件方法
120
- const itemAction = (prep: any) => allAction(props, emits, formData, prep);
121
-
122
- // 关键差异逻辑:根据 dataType 动态处理
123
- const editJsonData = async (devType: boolean) => {
124
- props.field.preps["devType"] = devType;
125
- const jsonStr = formData.value[props.field.fieldName];
126
- const temp: any = {};
127
-
128
- if (jsonStr && isJson(jsonStr)) {
129
- // 根据 dataType 解析为对象或数组
130
- const parsedData = JSON5.parse(jsonStr);
131
- jsonData.value = parsedData;
132
-
133
- // 对象需要转换为键值对数组,数组直接使用
134
- temp["jsonDatas"] =
135
- props.dataType === "object"
136
- ? Object.entries(parsedData).map(([name, value]) => ({ name, value }))
137
- : parsedData;
138
- } else {
139
- temp["jsonDatas"] = props.dataType === "object" ? [{}] : [];
140
- }
141
-
142
- dialogInputVisible.value = true;
143
- await nextTick();
144
- if (!devType) jsonFormRef.value.setFormData(temp);
145
- };
146
-
147
- const selectItem = async () => {
148
- if (props.field.preps["devType"]) {
149
- // 开发模式直接序列化当前 jsonData
150
- formData.value[props.field.fieldName] = JSON5.stringify(
151
- jsonData.value,
152
- null,
153
- 4,
154
- );
155
- } else {
156
- // 设计模式根据 dataType 转换数据
157
- let flag = false;
158
- await jsonFormRef.value.$refs.starHorseFormRef.validate(
159
- (res) => (flag = res),
160
- );
161
- if (!flag) return;
162
-
163
- const temp = jsonFormRef.value.getFormData().value;
164
- const dataList = temp["jsonDatas"];
165
-
166
- // 数组直接使用,对象需要转换为键值对对象
167
- formData.value[props.field.fieldName] =
168
- props.dataType === "object"
169
- ? JSON5.stringify(
170
- Object.fromEntries(
171
- dataList.map(({ name, value }) => [name, value]),
172
- ),
173
- null,
174
- 4,
175
- )
176
- : JSON5.stringify(dataList, null, 4);
177
- }
178
- closeAction();
179
- };
180
-
181
- // 公共方法(与原组件一致)
182
- const resetForm = () => jsonFormRef.value.setFormData({ jsonDatas: [{}] });
183
- const closeAction = () => (dialogInputVisible.value = false);
184
- </script>
185
-
186
- <style lang="scss" scoped>
187
- /* 与原 json-item.vue 样式完全一致 */
188
- .json-comp {
189
- width: 100%;
190
- display: flex;
191
- align-items: center;
192
-
193
- .json-box {
194
- flex: 1;
195
- margin-right: 5px;
196
- }
197
-
198
- .json-btn {
199
- cursor: pointer;
200
- flex-direction: column;
201
- width: 50px;
202
- display: flex;
203
- align-items: center;
204
- justify-content: center;
205
- }
206
- }
207
- </style>
@@ -1,228 +0,0 @@
1
- <template>
2
- <star-horse-dialog
3
- :title="field.preps?.dialogTitle || '配置按钮事件'"
4
- :selfFunc="true"
5
- @merge="operResultAction"
6
- :dialogVisible="btnDialogVisible"
7
- :boxWidth="field.preps?.boxWidth || '50%'"
8
- :isShowReset="field.preps?.isShowReset ?? false"
9
- @closeAction="close"
10
- :btnText="field.preps?.dialogBtn ?? '确定'"
11
- >
12
- <star-horse-form
13
- ref="btnFormRef"
14
- :fieldList="{
15
- fieldList: field.preps?.fieldList,
16
- }"
17
- v-if="field.preps?.viewType == 'form'"
18
- />
19
- <component
20
- :is="field.preps?.componentName"
21
- ref="btnCompRef"
22
- v-else-if="field.preps?.viewType == 'usercomp'"
23
- :params="field.preps?.params"
24
- />
25
- <star-horse-editor
26
- v-else-if="field.preps?.viewType == 'code'"
27
- ref="btnCompRef"
28
- />
29
- </star-horse-dialog>
30
- <starhorse-form-item
31
- :showFormItem="showFormItem"
32
- :isDesign="isDesign"
33
- :disabled="disabled"
34
- :bareFlag="bareFlag"
35
- :formItem="field"
36
- :parentField="parentField"
37
- >
38
- <el-button
39
- :disabled="checkIsDisabled(props)"
40
- v-bind="field.preps"
41
- @click="dynamicFunc(field.preps?.code)"
42
- >
43
- <star-horse-icon
44
- v-if="field.preps?.icon"
45
- :icon-class="field.preps.icon"
46
- style="vertical-align: middle; color: var(--star-horse-style)"
47
- />
48
- {{ field?.label }}
49
- </el-button>
50
- </starhorse-form-item>
51
- </template>
52
- <script setup lang="ts" name="buttonItem">
53
- import { onMounted, PropType, shallowRef, unref } from "vue";
54
- import {
55
- buttonAction,
56
- checkIsDisabled,
57
- initCompCallEvent,
58
- } from "@/components/formcomp/utils/ItemRelationEventUtils";
59
- import { httpRequest } from "@/api/star_horse_apis";
60
- import { operationConfirm, warning } from "@/utils/message";
61
- import { BtnAction, DynamicParamField } from "@/components/types/BtnAction";
62
- import { SearchParams } from "@/components/types/Params";
63
- import { createCondition } from "@/api/star_horse_utils";
64
-
65
- const props = defineProps({
66
- isDesign: {
67
- type: Boolean,
68
- default: false,
69
- },
70
- disabled: {
71
- type: Boolean,
72
- default: false,
73
- },
74
- showFormItem: {
75
- type: Boolean,
76
- default: false,
77
- },
78
- bareFlag: {
79
- type: Boolean,
80
- default: false,
81
- },
82
- isSearch: {
83
- type: Boolean,
84
- default: false,
85
- },
86
- field: {
87
- type: Object as PropType<any>,
88
- required: true,
89
- },
90
- parentField: {
91
- type: Object as PropType<any>,
92
- },
93
- formInfo: {
94
- type: Object as PropType<any>,
95
- },
96
- });
97
- const emits = defineEmits(["selfFunc", "selectItem"]);
98
- const formData = defineModel("formData");
99
-
100
- let btnDialogVisible = shallowRef<boolean>(false);
101
- const btnCompRef = shallowRef();
102
-
103
- const operResultAction = async () => {
104
- let action: BtnAction = props.field.preps;
105
- let formData: any = {};
106
- if (action?.viewType == "comp") {
107
- formData = await btnCompRef.value?.getFormData("请先填写表单数据");
108
- if (!formData) {
109
- return;
110
- }
111
- } else {
112
- formData = await btnCompRef.value?.getFormData().value;
113
- }
114
- formData.value[props.field.fieldName] = JSON.stringify(unref(formData));
115
- close();
116
- };
117
- //打开对话框
118
- const openDialog = async () => {
119
- /**
120
- * 1、调用公共的方法
121
- * --2、调用公共的组件
122
- * --3、调用指定接口
123
- * --4、执行程序块
124
- * --5、传入表单参数,生成表单
125
- *
126
- */
127
- let action: BtnAction = props.field.preps;
128
- //执行代码块
129
- if (action?.needConfirm) {
130
- let result = operationConfirm(action.confirmMsg ?? "确定要执行此操作吗");
131
- if (!result) {
132
- return;
133
- }
134
- }
135
- if (action?.viewType == "inter") {
136
- //如果参数是动态参数,则在当前form中寻找对应名称的值
137
- let urlParam: any = {};
138
- if (action.isDynamicParam == "Y") {
139
- let dynamicParams: SearchParams[] | DynamicParamField[] | any =
140
- action.params;
141
- let params: SearchParams[] = [];
142
- dynamicParams?.forEach((dynamicParam: any) => {
143
- let value =
144
- formData.value[dynamicParam.paramName] ?? dynamicParam.defaultValue;
145
- params.push(
146
- createCondition(
147
- dynamicParam.paramName,
148
- value,
149
- dynamicParam.matchType,
150
- ),
151
- );
152
- });
153
- urlParam["fieldList"] = params;
154
- } else {
155
- urlParam = action.params;
156
- }
157
- if (!action.url) {
158
- warning("请提供需要调用的接口");
159
- return;
160
- }
161
- httpRequest(action.url!, action.method ?? "POST", urlParam).then(
162
- (res: any) => {
163
- //仅仅执行,则直接调用接口
164
- console.log(res);
165
- let reData = res.data;
166
- if (reData.code) {
167
- warning(reData.cnMessage);
168
- return;
169
- }
170
- let datas = reData?.data;
171
- if (action?.afterAction) {
172
- if (!datas) {
173
- warning("返回数据为空,无法赋值");
174
- return;
175
- }
176
- if (Array.isArray(datas)) {
177
- warning("返回数据为数组,无法赋值");
178
- return;
179
- }
180
- //执行后搜集返回结果
181
- if (action?.afterAction == "assignCurrentName") {
182
- formData.value[props.field.fieldName] = datas;
183
- } else if (action?.afterAction == "assignForm") {
184
- let entries = Object.entries(datas);
185
- entries.forEach(([key, value]) => {
186
- formData.value[key] = value;
187
- });
188
- }
189
- }
190
- },
191
- );
192
- } else if (action?.viewType == "code") {
193
- if (!action.code) {
194
- warning("请提供需要执行的代码");
195
- return;
196
- }
197
- buttonAction(props, emits, formData, action.code);
198
- } else if (action?.viewType == "method") {
199
- if (!action.actions) {
200
- warning("请提供需要执行的函数");
201
- return;
202
- }
203
- action.actions(formData);
204
- } else {
205
- btnDialogVisible.value = true;
206
- }
207
- };
208
- const close = () => {
209
- btnDialogVisible.value = false;
210
- };
211
- const dynamicFunc = (code: any) => {
212
- // openDialog();
213
- //如果是配置的标准操作
214
- if (props.field.preps?.viewType) {
215
- openDialog();
216
- } else {
217
- buttonAction(props, emits, formData, code);
218
- }
219
- };
220
- onMounted(() => {
221
- initCompCallEvent(props, emits, formData);
222
- });
223
- </script>
224
- <style lang="scss" scoped>
225
- :deep(.el-icon) {
226
- display: none;
227
- }
228
- </style>