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,302 +0,0 @@
1
- <script setup lang="ts">
2
- import {useVModel} from "@vueuse/core";
3
- import {reactive, ref, watch} from "vue";
4
- import {postRequest} from "@/api/star_horse_apis";
5
- import StarHorseDialog from "@/components/comp/StarHorseDialog.vue";
6
- import {closeLoad} from "@/api/star_horse_utils";
7
- import {PageProps} from "@/components/types/PageProps";
8
-
9
- export type ModelValueType = any;
10
-
11
- export interface DataDropdownProps {
12
- modelValue: ModelValueType;
13
- dataUrl?: string;
14
- pageSize?: number;
15
- datas?: Array<any>;
16
- title?: string;
17
- compSize?: string;
18
- displayName?: string;
19
- displayValue?: string;
20
- multiple?: boolean;
21
- checkStrictly?: boolean;
22
- }
23
-
24
- const props = withDefaults(defineProps<DataDropdownProps>(), {
25
- displayName: "name",
26
- displayValue: "value",
27
- compSize: "small",
28
- pageSize: 0,
29
- multiple: false,
30
- checkStrictly: true,
31
- });
32
-
33
- const emits = defineEmits<{
34
- (e: "update:modelValue", modelValue: ModelValueType): void;
35
- }>();
36
- const treeProps = {
37
- label: props.displayName,
38
- children: "children",
39
- value: props.displayValue,
40
- isLeaf: "leaf",
41
- class: (data: any) => renderClass(data),
42
- };
43
- const value: any = useVModel(props, "modelValue", emits);
44
-
45
- const dataOptions = ref<Array<any>>([]);
46
- const dataOrgOptions = ref<Array<any>>([]);
47
- const orgTreeRef = ref<InstanceType<any>>();
48
- const expandedKeys = ref<string[]>([]);
49
-
50
- const renderClass = (
51
- data: any,
52
- ):
53
- | string
54
- | {
55
- [key: string]: boolean;
56
- } => {
57
- let value = props.displayValue || "value";
58
- const val = dataOptions.value.find((e) => e[value] === data[value]);
59
- if (val) {
60
- return "is-active";
61
- } else {
62
- return "";
63
- }
64
- };
65
-
66
- const onNodeClick = (data: any) => {
67
- let value = props.displayValue || "value";
68
- if (props.multiple) {
69
- const index = dataOptions.value.findIndex((e) => e[value] === data[value]);
70
- if (index === -1) {
71
- dataOptions.value.push(data);
72
- dataOptions.value.sort((a, b) => a[value].localeCompare(b[value]));
73
- } else {
74
- dataOptions.value.splice(index, 1);
75
- }
76
- } else {
77
- const index = dataOptions.value.findIndex((e) => e[value] === data[value]);
78
- if (index === -1) {
79
- dataOptions.value = [data];
80
- } else {
81
- dataOptions.value.splice(index, 1);
82
- }
83
- }
84
- // console.log("onNodeClick", dataOptions.value);
85
- };
86
- const dialogVisible = ref(false);
87
- const queryForm = reactive({
88
- name: null,
89
- });
90
-
91
- watch(
92
- () => queryForm.name,
93
- (val) => {
94
- orgTreeRef.value?.filter(val);
95
- },
96
- );
97
- const filterNode = (value: string, data: any): boolean => {
98
- if (!value) return true;
99
- return data[props.displayName].includes(value);
100
- };
101
- let pageInfo = reactive<PageProps>({
102
- pageSize: 20,
103
- currentPage: 1,
104
- totalData: 0,
105
- totalPage: 0,
106
- dataList: [],
107
- });
108
- const loadData = () => {
109
- let params: any = {
110
- currentPage: pageInfo.currentPage,
111
- pageSize: props.pageSize || 0,
112
- fieldList: [],
113
- orderBy: [],
114
- };
115
- postRequest(props.dataUrl!, params)
116
- .then((res) => {
117
- if (res?.data?.code) {
118
- res && console.error(res?.data?.cnMessage);
119
- return;
120
- }
121
- let redata = res?.data?.data;
122
- //如果不是分页之间显示返回的所有数据
123
- dataOrgOptions.value = redata?.dataList || redata;
124
- pageInfo.totalPage = redata?.totalPages;
125
- pageInfo.totalData = redata?.totalDatas;
126
- })
127
- .catch((err: any) => {
128
- console.log(err);
129
- })
130
- .finally(() => {
131
- closeLoad();
132
- });
133
- };
134
- const open = () => {
135
- dialogVisible.value = true;
136
- };
137
- const onOpen = () => {
138
- if (props.datas && props.datas.length > 0) {
139
- dataOrgOptions.value = props.datas;
140
- } else {
141
- loadData();
142
- }
143
- let dataIds: string[] = [];
144
- if (Array.isArray(value.value)) {
145
- dataIds.push(...value.value);
146
- } else if (value.value) {
147
- dataIds.push(value.value);
148
- }
149
- if (dataIds.length > 0) {
150
- } else {
151
- dataOptions.value = [];
152
- }
153
- console.log("onOpen", dataOrgOptions);
154
- };
155
- const handelConfirm = () => {
156
- if (props.multiple) {
157
- value.value = dataOptions.value;
158
- } else {
159
- if (dataOptions.value.length > 0) {
160
- value.value = dataOptions.value[0];
161
- } else {
162
- value.value = null;
163
- }
164
- }
165
- dialogVisible.value = false;
166
- };
167
- const resetData = () => {
168
- dataOptions.value = [];
169
- };
170
- const pageChangeClick = (val: number) => {
171
- pageInfo.currentPage = val;
172
- loadData();
173
- };
174
- const pageSizeClick = (val: number) => {
175
- pageInfo.pageSize = val;
176
- pageInfo.currentPage = 1;
177
- loadData();
178
- };
179
- defineExpose({
180
- open,
181
- });
182
- </script>
183
-
184
- <template>
185
- <star-horse-dialog
186
- :self-func="true"
187
- :dialog-visible="dialogVisible"
188
- :hideFullScreenIcon="true"
189
- @open="onOpen"
190
- @merge="handelConfirm"
191
- @resetForm="resetData"
192
- @closeAction="dialogVisible = false"
193
- draggable
194
- :title="title || '选择数据'"
195
- boxWidth="30%"
196
- >
197
- <el-card shadow="never" class="org-card dialog-body">
198
- <template #header>
199
- <el-input
200
- v-model="queryForm.name"
201
- placeholder="输入关键字进行查询"
202
- :style="{ width: '100%' }"
203
- suffix-icon="search"
204
- clearable
205
- >
206
- </el-input>
207
- </template>
208
-
209
- <el-scrollbar tag="div" class="org-tree">
210
- <el-tree
211
- ref="orgTreeRef"
212
- :node-key="displayValue"
213
- :data="dataOrgOptions"
214
- :default-expanded-keys="expandedKeys"
215
- :props="treeProps"
216
- :check-strictly="checkStrictly"
217
- :filter-node-method="filterNode"
218
- @node-click="onNodeClick"
219
- >
220
- <template #default="{ data }">
221
- <div class="data-line">
222
- <div class="menu-title">
223
- <div class=" flex flex-row items-center">
224
- <star-horse-icon
225
- :icon-class="
226
- data.children?.length > 0 ? 'folder' : 'document'
227
- "
228
- />
229
- &nbsp;{{ data[displayName] }}
230
- </div>
231
- </div>
232
- <el-icon class="is-selected">
233
- <Check/>
234
- </el-icon>
235
- </div>
236
- </template>
237
- </el-tree>
238
- </el-scrollbar>
239
- <el-pagination
240
- v-if="pageSize > 0"
241
- :total="pageInfo.totalData"
242
- @current-change="pageChangeClick"
243
- @size-change="pageSizeClick"
244
- :size="compSize"
245
- layout="total, sizes, prev, pager, next, jumper"
246
- v-model:currentPage="pageInfo.currentPage"
247
- v-model:page-size="pageInfo.pageSize"
248
- v-model:pageCount="pageInfo.totalPage"
249
- />
250
- </el-card>
251
- </star-horse-dialog>
252
- </template>
253
-
254
- <style scoped lang="scss">
255
- :deep {
256
- .el-tree {
257
- --el-tree-node-content-height: 40px;
258
-
259
- .el-tree-node__content {
260
- border-radius: 8px;
261
- margin: 2px 0 2px 0;
262
- }
263
-
264
- .is-active {
265
- color: var(--el-color-primary);
266
-
267
- .is-selected {
268
- display: block;
269
- }
270
- }
271
- }
272
- }
273
-
274
- .el-card {
275
- background-color: transparent;
276
-
277
- :deep(.el-card__header) {
278
- padding: 10px !important;
279
- }
280
-
281
- :deep(.el-card__body) {
282
- padding: 0 !important;
283
- }
284
- }
285
-
286
- .org-tree {
287
- height: 270px;
288
- padding: 5px;
289
- }
290
-
291
- .data-line {
292
- display: flex;
293
- flex: 1;
294
- align-items: center;
295
- justify-content: space-between;
296
- }
297
-
298
- .is-selected {
299
- display: none;
300
- padding-right: 15px;
301
- }
302
- </style>
@@ -1,51 +0,0 @@
1
- <script setup lang="ts">
2
- import { onMounted } from "vue";
3
-
4
- export interface DataTagProps {
5
- data: any;
6
- displayName?: string;
7
- displayValue?: string;
8
- type?: "success" | "info" | "warning" | "danger";
9
- closable?: boolean;
10
- }
11
-
12
- const props = withDefaults(defineProps<DataTagProps>(), {
13
- closable: false,
14
- displayName: "name",
15
- displayValue: "value",
16
- type: "info",
17
- });
18
- const emits = defineEmits<{
19
- (e: "close", id: string): void;
20
- }>();
21
-
22
- onMounted(() => {
23
- if (!props.data) {
24
- throw new Error("username is required");
25
- }
26
- });
27
- const onClose = () => {
28
- emits("close", props.data);
29
- };
30
- </script>
31
- <template>
32
- <el-tag
33
- round
34
- :closable="closable"
35
- :type="type"
36
- effect="light"
37
- @close="onClose"
38
- >
39
- <div class="flex-center" style="gap: 4px; grid-gap: 4px">
40
- <span>{{ data[displayName] }}</span>
41
- </div>
42
- </el-tag>
43
- </template>
44
-
45
- <style scoped lang="scss">
46
- :deep {
47
- .el-tag__content:only-child {
48
- margin-right: 4px;
49
- }
50
- }
51
- </style>
@@ -1,230 +0,0 @@
1
- <template>
2
- <div class="cron-content">
3
- <div class="cron-item">
4
- <el-radio size="small" v-model="radioValue" :label="1" border>
5
- 日,允许的通配符[, - * / L M]</el-radio
6
- >
7
- </div>
8
- <div class="cron-item">
9
- <el-radio size="small" v-model="radioValue" :label="2" border>
10
- 不指定</el-radio
11
- >
12
- </div>
13
- <div class="cron-item">
14
- <el-radio size="small" v-model="radioValue" :label="3" border>
15
- 周期</el-radio
16
- >
17
- <span style="margin-left: 10px; margin-right: 5px">从</span>
18
- <el-input-number
19
- size="small"
20
- v-model="cycle01"
21
- :min="0"
22
- :max="31"
23
- controls-position="right"
24
- />
25
- <span style="margin-left: 10px; margin-right: 5px">至</span>
26
- <el-input-number
27
- size="small"
28
- v-model="cycle02"
29
- :min="0"
30
- :max="31"
31
- controls-position="right"
32
- />
33
- <span style="margin-left: 10px; margin-right: 5px">日</span>
34
- </div>
35
- <div class="cron-item">
36
- <el-radio size="small" v-model="radioValue" :label="4" border
37
- >循环</el-radio
38
- >
39
- <span style="margin-left: 10px; margin-right: 5px">从</span>
40
- <el-input-number
41
- size="small"
42
- v-model="average01"
43
- :min="0"
44
- :max="31"
45
- controls-position="right"
46
- />
47
- <span style="margin-left: 10px; margin-right: 5px">号开始,每</span>
48
- <el-input-number
49
- size="small"
50
- v-model="average02"
51
- :min="0"
52
- :max="31"
53
- controls-position="right"
54
- />
55
- <span style="margin-left: 10px; margin-right: 5px">日执行一次</span>
56
- </div>
57
- <div class="cron-item">
58
- <el-radio size="small" v-model="radioValue" :label="5" border
59
- >工作日</el-radio
60
- >
61
- <span style="margin-left: 10px; margin-right: 5px">每月</span>
62
- <el-input-number
63
- size="small"
64
- v-model="workday"
65
- :min="0"
66
- :max="31"
67
- controls-position="right"
68
- />
69
- <span style="margin-left: 10px; margin-right: 5px"
70
- >号最近的那个工作日</span
71
- >
72
- </div>
73
- <div class="cron-item">
74
- <el-radio size="small" v-model="radioValue" :label="6" border>
75
- 本月最后一天</el-radio
76
- >
77
- </div>
78
- <div class="cron-item">
79
- <el-radio size="small" v-model="radioValue" :label="7" border>
80
- 指定</el-radio
81
- >
82
- <el-checkbox-group size="small" v-model="checkboxList">
83
- <el-checkbox
84
- class="my-[5px]"
85
- :border="true"
86
- v-for="item in 31"
87
- :key="item"
88
- :value="item - 1"
89
- :label="item < 11 ? '0' + (item - 1) : item - 1"
90
- />
91
- </el-checkbox-group>
92
- </div>
93
- </div>
94
- </template>
95
- <style lang="scss" scoped></style>
96
- <script setup lang="ts">
97
- import { computed, ref, watch } from "vue";
98
-
99
- defineOptions({
100
- name: "crontab-day",
101
- });
102
- let radioValue = ref(1);
103
- let workday = ref(1);
104
- let cycle01 = ref(1);
105
- let cycle02 = ref(2);
106
- let average01 = ref(1);
107
- let average02 = ref(1);
108
-
109
- let checkboxList = ref([]);
110
- const props = defineProps({
111
- check: { type: Function },
112
- cron: { type: Object },
113
- });
114
-
115
- const emits = defineEmits(["update"]);
116
- // 计算两个周期值
117
- const cycleTotalFun = () => {
118
- cycle01.value = props.check?.(cycle01.value, 1, 31);
119
- cycle02.value = props.check?.(cycle02.value, 1, 31);
120
- return cycle01.value + "-" + cycle02.value;
121
- };
122
- // 计算平均用到的值
123
- const averageTotalFun = () => {
124
- average01.value = props.check?.(average01.value, 1, 31);
125
- average02.value = props.check?.(average02.value, 1, 31);
126
- return average01.value + "/" + average02.value;
127
- };
128
- // 计算工作日格式
129
- const workdayCheckFun = () => {
130
- workday.value = props.check?.(workday.value, 1, 31);
131
- return workday.value;
132
- };
133
- // 计算勾选的checkbox值合集
134
- const checkboxStringFun = () => {
135
- let str = checkboxList.value.join();
136
- return str == "" ? "?" : str;
137
- };
138
- let cycleTotal = computed(() => cycleTotalFun());
139
- let averageTotal = computed(() => averageTotalFun());
140
- let workdayCheck = computed(() => workdayCheckFun());
141
- let checkboxString = computed(() => checkboxStringFun());
142
- // 单选按钮值变化时
143
- const radioChange = () => {
144
- switch (radioValue.value) {
145
- case 1:
146
- emits("update", "day", "*", "day");
147
- break;
148
- case 2:
149
- emits("update", "day", "?");
150
- break;
151
- case 3:
152
- emits("update", "day", cycle01.value + "-" + cycle02.value);
153
- break;
154
- case 4:
155
- emits("update", "day", average01.value + "/" + average02.value);
156
- break;
157
- case 5:
158
- emits("update", "day", workday.value + "W");
159
- break;
160
- case 6:
161
- emits("update", "day", "L");
162
- break;
163
- case 7:
164
- emits("update", "day", checkboxString.value);
165
- break;
166
- }
167
- };
168
- // 周期两个值变化时
169
- const cycleChange = () => {
170
- if (radioValue.value == 3) {
171
- emits("update", "day", cycleTotal.value);
172
- }
173
- };
174
- // 平均两个值变化时
175
- const averageChange = () => {
176
- if (radioValue.value == 4) {
177
- emits("update", "day", averageTotal.value);
178
- }
179
- };
180
- // 最近工作日值变化时
181
- const workdayChange = () => {
182
- if (radioValue.value == 5) {
183
- emits("update", "day", workday.value + "W");
184
- }
185
- };
186
- // checkbox值变化时
187
- const checkboxChange = () => {
188
- if (radioValue.value == 7) {
189
- emits("update", "day", checkboxString.value);
190
- }
191
- };
192
- // // 父组件传递的week发生变化触发
193
- // const weekChange = () => {
194
- // //判断week值与day不能同时为“?”
195
- // if (props.cron?.week == '?' && radioValue.value == 2) {
196
- // radioValue.value = 1;
197
- // } else if (props.cron?.week !== '?' && radioValue.value != 2) {
198
- // radioValue.value = 2;
199
- // }
200
- // };
201
- watch(
202
- () => radioValue.value,
203
- (_val) => radioChange(),
204
- );
205
- watch(
206
- () => cycleTotal.value,
207
- (_val) => cycleChange(),
208
- );
209
- watch(
210
- () => averageTotal.value,
211
- (_val) => averageChange(),
212
- );
213
- watch(
214
- () => workdayCheck.value,
215
- (_val) => workdayChange(),
216
- );
217
- watch(
218
- () => checkboxString.value,
219
- (_val) => checkboxChange(),
220
- );
221
- defineExpose({
222
- cycle01,
223
- cycle02,
224
- average01,
225
- average02,
226
- checkboxList,
227
- workday,
228
- radioValue,
229
- });
230
- </script>