star-horse-lowcode 2.7.62 → 2.7.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.development +3 -0
- package/.env.production +3 -0
- package/.eslintrc-auto-import.json +77 -0
- package/.gitignore +27 -0
- package/.idea/.gitignore +5 -0
- package/.idea/MarsCodeWorkspaceAppSettings.xml +6 -0
- package/.idea/inspectionProfiles/Project_Default.xml +7 -0
- package/.idea/modules.xml +8 -0
- package/.idea/testcode.iml +12 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/watcherTasks.xml +4 -0
- package/.idea/workspace.xml +207 -0
- package/.npmignore +21 -0
- package/.prettierignore +26 -0
- package/README.md +2 -0
- package/auto-imports.d.ts +137 -0
- package/components.d.ts +189 -0
- package/dist/assets/index.css +1 -1
- package/dist/index.es.js +941 -720
- package/dist/types/index.d.ts +8 -8
- package/eslint.config.js +37 -0
- package/index.html +14 -0
- package/package-lock.json +8276 -0
- package/package.json +6 -6
- package/prettier.config.js +20 -0
- package/public/logo.svg +660 -0
- package/src/App.vue +11 -0
- package/src/api/date_utils.ts +219 -0
- package/src/api/finger_utils.ts +71 -0
- package/src/api/form_utils.ts +281 -0
- package/src/api/jquery.min.js +2 -0
- package/src/api/pcas-code.json +1 -0
- package/src/api/settings.ts +81 -0
- package/src/api/star_horse_apis.ts +196 -0
- package/src/api/star_horse_utils.ts +797 -0
- package/src/api/system.ts +351 -0
- package/src/api/user_func.ts +147 -0
- package/src/api/valid_utils.ts +165 -0
- package/src/assets/css/index.scss +908 -0
- package/src/assets/icons.css +574 -0
- package/src/assets/star-horse-icons.woff +0 -0
- package/src/components/comp/ShDynamicForm.vue +160 -0
- package/src/components/comp/ShForm.vue +30 -0
- package/src/components/comp/ShTableListColumn.vue +61 -0
- package/src/components/comp/StarHorseDataSelector.vue +139 -0
- package/src/components/comp/StarHorseDataView.vue +110 -0
- package/src/components/comp/StarHorseDataViewItems.vue +61 -0
- package/src/components/comp/StarHorseDataViewTable.vue +102 -0
- package/src/components/comp/StarHorseDialog.vue +383 -0
- package/src/components/comp/StarHorseDraggable.vue +401 -0
- package/src/components/comp/StarHorseForm.vue +458 -0
- package/src/components/comp/StarHorseFormItem.vue +82 -0
- package/src/components/comp/StarHorseFormList.vue +516 -0
- package/src/components/comp/StarHorseFormTable.vue +56 -0
- package/src/components/comp/StarHorseIcon.vue +76 -0
- package/src/components/comp/StarHorseItem.vue +302 -0
- package/src/components/comp/StarHorseJsonEditor.vue +115 -0
- package/src/components/comp/StarHorsePopover.vue +66 -0
- package/src/components/comp/StarHorseSearchComp.vue +253 -0
- package/src/components/comp/StarHorseStaticTable.vue +395 -0
- package/src/components/comp/StarHorseTableColumn.vue +249 -0
- package/src/components/comp/StarHorseTableComp.vue +1193 -0
- package/src/components/comp/StarHorseTableViewColumn.vue +61 -0
- package/src/components/comp/StarHorseTree.vue +494 -0
- package/src/components/comp/index.ts +22 -0
- package/src/components/comp/items/UTableColumn.vue +65 -0
- package/src/components/comp/items/boxItem.vue +98 -0
- package/src/components/comp/items/callitem.ts +9 -0
- package/src/components/comp/items/cardItem.vue +152 -0
- package/src/components/comp/items/collapseItem.vue +134 -0
- package/src/components/comp/items/dytableItem.vue +135 -0
- package/src/components/comp/items/otherItem.vue +65 -0
- package/src/components/comp/items/tabItem.vue +155 -0
- package/src/components/comp/items/tabPanelItem.vue +110 -0
- package/src/components/comp/items/tableColumn.vue +129 -0
- package/src/components/comp/items/tableItem.vue +97 -0
- package/src/components/comp/items/tablebtn.vue +158 -0
- package/src/components/comp/items/viewBoxItem.vue +55 -0
- package/src/components/comp/items/viewCardItem.vue +47 -0
- package/src/components/comp/items/viewCollapseItem.vue +71 -0
- package/src/components/comp/items/viewDytableItem.vue +77 -0
- package/src/components/comp/items/viewOtherItem.vue +55 -0
- package/src/components/comp/items/viewTabItem.vue +77 -0
- package/src/components/comp/items/viewTabPanelItem.vue +54 -0
- package/src/components/comp/items/viewTableItem.vue +74 -0
- package/src/components/comp/selfcomp.ts +9 -0
- package/src/components/comp/utils/DataPicker.vue +302 -0
- package/src/components/comp/utils/DataTag.vue +51 -0
- package/src/components/cron/Crontab-Day.vue +230 -0
- package/src/components/cron/Crontab-Hour.vue +165 -0
- package/src/components/cron/Crontab-Min.vue +166 -0
- package/src/components/cron/Crontab-Month.vue +166 -0
- package/src/components/cron/Crontab-Result.vue +615 -0
- package/src/components/cron/Crontab-Second.vue +185 -0
- package/src/components/cron/Crontab-Week.vue +208 -0
- package/src/components/cron/Crontab-Year.vue +183 -0
- package/src/components/cron/Crontab.vue +474 -0
- package/src/components/enums/ModuleEnums.ts +10 -0
- package/src/components/enums/ServiceEnums.ts +18 -0
- package/src/components/formcomp/container/box-container.vue +162 -0
- package/src/components/formcomp/container/callitem.ts +9 -0
- package/src/components/formcomp/container/card-container.vue +170 -0
- package/src/components/formcomp/container/collapse-container.vue +133 -0
- package/src/components/formcomp/container/dytable-col.vue +448 -0
- package/src/components/formcomp/container/dytable-container.vue +57 -0
- package/src/components/formcomp/container/dytableUtils.ts +358 -0
- package/src/components/formcomp/container/group-box-container.vue +331 -0
- package/src/components/formcomp/container/index.ts +6 -0
- package/src/components/formcomp/container/tab-container.vue +153 -0
- package/src/components/formcomp/container/table-container.vue +249 -0
- package/src/components/formcomp/items/allitem.ts +9 -0
- package/src/components/formcomp/items/area-item.vue +116 -0
- package/src/components/formcomp/items/audio-item.vue +163 -0
- package/src/components/formcomp/items/autocomplete-item.vue +118 -0
- package/src/components/formcomp/items/barcode-item.vue +87 -0
- package/src/components/formcomp/items/base-json-item.vue +207 -0
- package/src/components/formcomp/items/button-item.vue +228 -0
- package/src/components/formcomp/items/cascade-item.vue +113 -0
- package/src/components/formcomp/items/checkbox-item.vue +97 -0
- package/src/components/formcomp/items/color-item.vue +70 -0
- package/src/components/formcomp/items/cron-item.vue +115 -0
- package/src/components/formcomp/items/datetime-item.vue +99 -0
- package/src/components/formcomp/items/depart-item.vue +51 -0
- package/src/components/formcomp/items/dialog-input-item.vue +207 -0
- package/src/components/formcomp/items/divider-item.vue +66 -0
- package/src/components/formcomp/items/html-item.vue +65 -0
- package/src/components/formcomp/items/htmleditor-item.vue +104 -0
- package/src/components/formcomp/items/icon-item.vue +195 -0
- package/src/components/formcomp/items/image-item.vue +247 -0
- package/src/components/formcomp/items/index.ts +44 -0
- package/src/components/formcomp/items/input-item.vue +150 -0
- package/src/components/formcomp/items/json-array-item.vue +67 -0
- package/src/components/formcomp/items/json-item.vue +66 -0
- package/src/components/formcomp/items/markdown-item.vue +77 -0
- package/src/components/formcomp/items/number-item.vue +94 -0
- package/src/components/formcomp/items/number-range-item.vue +278 -0
- package/src/components/formcomp/items/page-select-item.vue +407 -0
- package/src/components/formcomp/items/password-item.vue +71 -0
- package/src/components/formcomp/items/qrcode-item.vue +84 -0
- package/src/components/formcomp/items/radio-item.vue +112 -0
- package/src/components/formcomp/items/rate-item.vue +68 -0
- package/src/components/formcomp/items/select-item.vue +133 -0
- package/src/components/formcomp/items/signature-item.vue +216 -0
- package/src/components/formcomp/items/slider-item.vue +68 -0
- package/src/components/formcomp/items/starhorse-form-item.vue +334 -0
- package/src/components/formcomp/items/switch-item.vue +77 -0
- package/src/components/formcomp/items/tag-item.vue +77 -0
- package/src/components/formcomp/items/text-item.vue +75 -0
- package/src/components/formcomp/items/textarea-item.vue +85 -0
- package/src/components/formcomp/items/time-item.vue +77 -0
- package/src/components/formcomp/items/time-picker-item.vue +74 -0
- package/src/components/formcomp/items/transfer-item.vue +93 -0
- package/src/components/formcomp/items/tselect-item.vue +121 -0
- package/src/components/formcomp/items/unknown-item.vue +51 -0
- package/src/components/formcomp/items/upload-item.vue +189 -0
- package/src/components/formcomp/items/user-item.vue +177 -0
- package/src/components/formcomp/items/usercomp-item.vue +85 -0
- package/src/components/formcomp/items/view-markdown-item.vue +77 -0
- package/src/components/formcomp/utils/EditDataDialog.vue +67 -0
- package/src/components/formcomp/utils/FieldList.vue +125 -0
- package/src/components/formcomp/utils/ItemRelationEventUtils.ts +284 -0
- package/src/components/help.vue +31 -0
- package/src/components/menu/MenuItem.vue +95 -0
- package/src/components/menu/SubMenu.vue +68 -0
- package/src/components/menu/SubSystemMenu.vue +142 -0
- package/src/components/register.ts +24 -0
- package/src/components/system/ContentMenu.vue +260 -0
- package/src/components/system/StarHorseButtonList.vue +344 -0
- package/src/components/system/StarHorseMenu.vue +97 -0
- package/src/components/system/StarHorseSvg.vue +62 -0
- package/src/components/system/SystemComp.ts +9 -0
- package/src/components/system/index.ts +4 -0
- package/src/components/types/ApiUrls.ts +168 -0
- package/src/components/types/BtnAction.ts +51 -0
- package/src/components/types/BtnAuth.ts +43 -0
- package/src/components/types/CompInfo.ts +81 -0
- package/src/components/types/DialogProps.ts +55 -0
- package/src/components/types/DyCompField.ts +23 -0
- package/src/components/types/DynamicNode.ts +42 -0
- package/src/components/types/MenusInfo.ts +45 -0
- package/src/components/types/PageFieldInfo.ts +530 -0
- package/src/components/types/PageProps.ts +25 -0
- package/src/components/types/Params.ts +93 -0
- package/src/components/types/RuleType.ts +10 -0
- package/src/components/types/SearchProps.ts +42 -0
- package/src/components/types/ShortKey.ts +30 -0
- package/src/components/types/StarHorseType.ts +18 -0
- package/src/components/types/index.ts +15 -0
- package/src/config/element.ts +15 -0
- package/src/config/styles.ts +4 -0
- package/src/index.ts +98 -0
- package/src/install.ts +33 -0
- package/src/lang/en_US.ts +81 -0
- package/src/lang/index.ts +35 -0
- package/src/lang/zh_CN.ts +84 -0
- package/src/main.ts +57 -0
- package/src/plugins/AblesPlugin.ts +618 -0
- package/src/plugins/registerCompPlugin.ts +15 -0
- package/src/sample/test.vue +9 -0
- package/src/store/ButtonPermission.ts +101 -0
- package/src/store/ConsumerView.ts +52 -0
- package/src/store/ContinusConfig.ts +78 -0
- package/src/store/CopyerOperation.ts +74 -0
- package/src/store/DesignForm.ts +481 -0
- package/src/store/DesignPage.ts +59 -0
- package/src/store/DynamicForm.ts +241 -0
- package/src/store/GlobalConfig.ts +90 -0
- package/src/store/SelfOperation.ts +95 -0
- package/src/store/UserInfo.ts +88 -0
- package/src/store/index.ts +6 -0
- package/src/theme/localStorge.ts +16 -0
- package/src/theme/theme.ts +27 -0
- package/src/utils/FieldOperationUtils.ts +91 -0
- package/src/utils/auth.ts +83 -0
- package/src/utils/message.ts +69 -0
- package/src/utils/preview.ts +125 -0
- package/tsconfig.json +39 -0
- package/tsconfig.node.json +10 -0
- package/vite-env.d.ts +16 -0
- package/vite.config.ts +162 -0
- package/yarn.lock +4627 -0
|
@@ -0,0 +1,516 @@
|
|
|
1
|
+
<script lang="ts" setup name="StarHorseFormList">
|
|
2
|
+
import {inject, ModelRef, nextTick, onMounted, PropType, ref, ShallowReactive, watch,} from "vue";
|
|
3
|
+
import {ApiUrls} from "@/components/types/ApiUrls";
|
|
4
|
+
import StarHorseIcon from "@/components/comp/StarHorseIcon.vue";
|
|
5
|
+
import {rowClassName} from "@/api/star_horse_utils";
|
|
6
|
+
import {error, operationConfirm, success, warning} from "@/utils/message";
|
|
7
|
+
import {download} from "@/api/star_horse_apis";
|
|
8
|
+
import {getToken} from "@/utils/auth";
|
|
9
|
+
import Sortable from "sortablejs";
|
|
10
|
+
import Help from "@/components/help.vue";
|
|
11
|
+
import {compKey, uuid} from "@/api/system";
|
|
12
|
+
import UTableColumn from "@/components/comp/items/UTableColumn.vue";
|
|
13
|
+
import StarHorseForm from "@/components/comp/StarHorseForm.vue";
|
|
14
|
+
import {Config} from "@/api/settings";
|
|
15
|
+
import {FieldInfo} from "@/components/types";
|
|
16
|
+
|
|
17
|
+
let importDialogVisible = ref<boolean>(false);
|
|
18
|
+
let rowDialogVisible = ref<boolean>(false);
|
|
19
|
+
const rowDataFormRef = ref();
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
compUrl: {type: Object as PropType<ApiUrls>},
|
|
22
|
+
fieldList: {type: Object as PropType<FieldInfo[]>, required: true},
|
|
23
|
+
defaultValues: {type: Object, default: {}},
|
|
24
|
+
batchName: {type: String, default: "batchDataList"},
|
|
25
|
+
primaryKey: {type: [String, Object] as PropType<string | any>},
|
|
26
|
+
initRows: {type: Number, default: 0},
|
|
27
|
+
importInfo: {type: Object as PropType<any>},
|
|
28
|
+
title: {type: String, default: ""},
|
|
29
|
+
helpMsg: {type: String, default: ""},
|
|
30
|
+
rules: {type: Object},
|
|
31
|
+
staticColumn: {type: String, default: "Y"},
|
|
32
|
+
size: {type: String, default: Config.compSize},
|
|
33
|
+
source: {type: Number, default: 1},
|
|
34
|
+
showCheckBox: {type: Boolean, default: false},
|
|
35
|
+
selectAll: {type: Boolean, default: false},
|
|
36
|
+
subFlag: {type: Boolean, default: false},
|
|
37
|
+
});
|
|
38
|
+
const emits = defineEmits(["addRow", "removeRow", "inited"]);
|
|
39
|
+
const dataForm: ModelRef<any> = defineModel("dataForm");
|
|
40
|
+
const formFields = inject("formFields", {}) as ShallowReactive<any>;
|
|
41
|
+
const loading = ref(null);
|
|
42
|
+
const starHorseFormListRef = ref(null);
|
|
43
|
+
|
|
44
|
+
const handleAddDetails = (row: any, type: number) => {
|
|
45
|
+
if (props.staticColumn == "Y" && type != 2) {
|
|
46
|
+
dynamicHandleAddForm(row, "add");
|
|
47
|
+
} else {
|
|
48
|
+
dynamicHandleAddRow(row, type);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
let currentRow = ref<any>({});
|
|
52
|
+
/**
|
|
53
|
+
* 编辑当前行的数据
|
|
54
|
+
* @param row
|
|
55
|
+
* @param type
|
|
56
|
+
*/
|
|
57
|
+
const dynamicHandleAddForm = async (row: any, type: string) => {
|
|
58
|
+
currentRow.value = row;
|
|
59
|
+
rowDialogVisible.value = true;
|
|
60
|
+
if (!dataForm.value[props.batchName]) {
|
|
61
|
+
dataForm.value[props.batchName] = [];
|
|
62
|
+
}
|
|
63
|
+
await nextTick();
|
|
64
|
+
rowDataFormRef.value.setFormData(row);
|
|
65
|
+
};
|
|
66
|
+
const mergeData = async (type: string) => {
|
|
67
|
+
let flag = false;
|
|
68
|
+
let formRef = rowDataFormRef.value.$refs.starHorseFormRef;
|
|
69
|
+
await formRef.validate((res: any) => (flag = res));
|
|
70
|
+
if (!flag) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
let formData = rowDataFormRef.value.getFormData().value;
|
|
74
|
+
if (formData.xh) {
|
|
75
|
+
dataForm.value[props.batchName][formData.xh - 1] = formData;
|
|
76
|
+
} else {
|
|
77
|
+
dataForm.value[props.batchName].push(formData);
|
|
78
|
+
}
|
|
79
|
+
if (type == "close") {
|
|
80
|
+
closeAction();
|
|
81
|
+
}else{
|
|
82
|
+
rowDataFormRef.value.resetForm();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const closeAction = () => {
|
|
86
|
+
rowDialogVisible.value = false;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 动态添加行
|
|
91
|
+
* @param row
|
|
92
|
+
* @param type
|
|
93
|
+
*/
|
|
94
|
+
const dynamicHandleAddRow = (row: any, type: number) => {
|
|
95
|
+
if (!dataForm.value[props.batchName]) {
|
|
96
|
+
dataForm.value[props.batchName] = [];
|
|
97
|
+
}
|
|
98
|
+
if (type === 1) {
|
|
99
|
+
let obj = JSON.parse(JSON.stringify(props.defaultValues || {}));
|
|
100
|
+
obj["_uuid"] = uuid();
|
|
101
|
+
dataForm.value[props.batchName].push(obj);
|
|
102
|
+
emits("addRow", row);
|
|
103
|
+
} else {
|
|
104
|
+
let index = row.xh - 1;
|
|
105
|
+
formFields && formFields[props.batchName]?.splice(index, 1);
|
|
106
|
+
dataForm.value[props.batchName].splice(index, 1);
|
|
107
|
+
emits("removeRow", row);
|
|
108
|
+
}
|
|
109
|
+
//将事件传出去
|
|
110
|
+
let fieldList = props.fieldList;
|
|
111
|
+
for (let ind in fieldList) {
|
|
112
|
+
let temp = fieldList[ind];
|
|
113
|
+
if (typeof temp.actions == "function") {
|
|
114
|
+
temp.actions(dataForm, "oper");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// 修改后的滚动逻辑:
|
|
118
|
+
nextTick(() => {
|
|
119
|
+
const tryScroll = (attempt = 0) => {
|
|
120
|
+
const tableEl = starHorseFormListRef.value?.$el;
|
|
121
|
+
const scrollContainer = tableEl?.querySelector(
|
|
122
|
+
".el-table--scrollable-y .el-scrollbar__wrap",
|
|
123
|
+
);
|
|
124
|
+
if (scrollContainer) {
|
|
125
|
+
// 仅在新行添加时滚动(type=1)
|
|
126
|
+
if (type === 1) {
|
|
127
|
+
scrollContainer.scrollTop =
|
|
128
|
+
scrollContainer.scrollHeight - scrollContainer.clientHeight;
|
|
129
|
+
}
|
|
130
|
+
} else if (attempt < 3) {
|
|
131
|
+
// 最多重试3次
|
|
132
|
+
setTimeout(() => tryScroll(attempt + 1), 50);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
tryScroll();
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
const getRowIdentity = (row: any) => {
|
|
140
|
+
return (row.xh || 0) + 1;
|
|
141
|
+
};
|
|
142
|
+
//批量操作
|
|
143
|
+
const excelOperation = () => {
|
|
144
|
+
importDialogVisible.value = true;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* 下载模板
|
|
148
|
+
*/
|
|
149
|
+
const downloadTemplate = () => {
|
|
150
|
+
download(props.importInfo!.downloadTemplateUrl, {}).catch((err) => {
|
|
151
|
+
error("接口不存在或网络异常:" + err);
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* 上传失败
|
|
156
|
+
* @param _err err
|
|
157
|
+
* @param _file file
|
|
158
|
+
* @param _fileList fileList
|
|
159
|
+
*/
|
|
160
|
+
const uploadError = (_err: any, _file: any, _fileList: any) => {
|
|
161
|
+
warning("导入数据失败");
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* 上传成功
|
|
165
|
+
*/
|
|
166
|
+
const uploadSuccess = (response: any, _file: any, _fileList: any) => {
|
|
167
|
+
if (response.code != 0) {
|
|
168
|
+
warning("数据解析异常");
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
success("导入成功");
|
|
172
|
+
dataForm.value[props.batchName] = response.data;
|
|
173
|
+
importDialogVisible.value = false;
|
|
174
|
+
};
|
|
175
|
+
let currentItem = ref<any>({});
|
|
176
|
+
const selectData = (item: any) => {
|
|
177
|
+
currentItem.value = item.row;
|
|
178
|
+
};
|
|
179
|
+
const moveColumn = () => {
|
|
180
|
+
const tableEl = starHorseFormListRef.value?.$el;
|
|
181
|
+
const tbody = tableEl?.querySelector(".el-table__body tbody");
|
|
182
|
+
if (tbody) {
|
|
183
|
+
// 强制清除旧实例
|
|
184
|
+
const oldInstance = Sortable.get(tbody);
|
|
185
|
+
oldInstance?.destroy();
|
|
186
|
+
Sortable.create(tbody, {
|
|
187
|
+
handle: ".move",
|
|
188
|
+
animation: 200,
|
|
189
|
+
ghostClass: "ghost",
|
|
190
|
+
forceFallback: true,
|
|
191
|
+
onStart: () => {
|
|
192
|
+
console.log("开始拖动");
|
|
193
|
+
tbody.style.cursor = "move"; // 拖动时改变光标
|
|
194
|
+
},
|
|
195
|
+
onEnd(event: any) {
|
|
196
|
+
const {oldIndex, newIndex} = event;
|
|
197
|
+
if (oldIndex === newIndex) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
// 新增数据交换逻辑
|
|
201
|
+
const data: any = dataForm.value[props.batchName];
|
|
202
|
+
const movedItem = data.splice(oldIndex, 1)[0];
|
|
203
|
+
data.splice(newIndex, 0, movedItem);
|
|
204
|
+
// 新增序号同步逻辑
|
|
205
|
+
data.forEach((item: any, index: number) => {
|
|
206
|
+
item.xh = index + 1; // 更新序号
|
|
207
|
+
if (formFields && formFields[props.batchName]) {
|
|
208
|
+
const fieldItem = formFields[props.batchName][index];
|
|
209
|
+
if (fieldItem) fieldItem.xh = index + 1; // 同步更新表单字段
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
const clearAll = () => {
|
|
217
|
+
if (dataForm.value[props.batchName].length == 0) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
operationConfirm("确定要清空吗?").then(() => {
|
|
221
|
+
dataForm.value[props.batchName] = [];
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
const init = async () => {
|
|
225
|
+
// console.log(Object.keys(dataForm.value), props.batchName);
|
|
226
|
+
if (!Object.keys(dataForm.value).includes(props.batchName)) {
|
|
227
|
+
dataForm.value[props.batchName] = [];
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* 如果列表为空的情况才初始化行数
|
|
231
|
+
*/
|
|
232
|
+
if (props.staticColumn == "N") {
|
|
233
|
+
if (dataForm.value[props.batchName]?.length == 0) {
|
|
234
|
+
for (let i = 0; i < props.initRows; i++) {
|
|
235
|
+
handleAddDetails(null, 1);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
moveColumn();
|
|
240
|
+
await nextTick();
|
|
241
|
+
emits("inited");
|
|
242
|
+
};
|
|
243
|
+
onMounted(async () => {
|
|
244
|
+
await init();
|
|
245
|
+
});
|
|
246
|
+
watch(
|
|
247
|
+
() => dataForm.value[props.batchName],
|
|
248
|
+
(val) => {
|
|
249
|
+
if (val && val.length > 0 && props.showCheckBox && props.selectAll) {
|
|
250
|
+
nextTick(() => {
|
|
251
|
+
// 改用原生全选方法
|
|
252
|
+
starHorseFormListRef.value?.toggleAllSelection(true);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
immediate: false,
|
|
258
|
+
deep: true,
|
|
259
|
+
},
|
|
260
|
+
);
|
|
261
|
+
</script>
|
|
262
|
+
<template>
|
|
263
|
+
<star-horse-dialog
|
|
264
|
+
:title="'编辑数据'"
|
|
265
|
+
:dialogVisible="rowDialogVisible"
|
|
266
|
+
:boxWidth="'50%'"
|
|
267
|
+
:is-show-btn-continue="true"
|
|
268
|
+
:selfFunc="true"
|
|
269
|
+
@merge="mergeData"
|
|
270
|
+
@closeAction="closeAction"
|
|
271
|
+
>
|
|
272
|
+
<star-horse-form
|
|
273
|
+
:fieldList="{ fieldList: fieldList }"
|
|
274
|
+
ref="rowDataFormRef"
|
|
275
|
+
/>
|
|
276
|
+
</star-horse-dialog>
|
|
277
|
+
<star-horse-dialog
|
|
278
|
+
v-if="!subFlag"
|
|
279
|
+
:title="'导入文件'"
|
|
280
|
+
:dialogVisible="importDialogVisible"
|
|
281
|
+
:boxWidth="'30%'"
|
|
282
|
+
:source="3"
|
|
283
|
+
:draggable="false"
|
|
284
|
+
@closeAction="importDialogVisible = false"
|
|
285
|
+
>
|
|
286
|
+
<el-card>
|
|
287
|
+
<el-upload
|
|
288
|
+
:auto-upload="true"
|
|
289
|
+
:on-error="uploadError"
|
|
290
|
+
:on-success="uploadSuccess"
|
|
291
|
+
:show-file-list="false"
|
|
292
|
+
accept=".xls,.xlsx"
|
|
293
|
+
:action="importInfo!.importDataUrl"
|
|
294
|
+
:headers="{ token: getToken() }"
|
|
295
|
+
class="upload"
|
|
296
|
+
name="file"
|
|
297
|
+
drag
|
|
298
|
+
>
|
|
299
|
+
<el-icon class="el-icon--upload">
|
|
300
|
+
<upload-filled/>
|
|
301
|
+
</el-icon>
|
|
302
|
+
<div class="el-upload__text">
|
|
303
|
+
拖拽文件到这里 or
|
|
304
|
+
<em>点击上传</em>
|
|
305
|
+
</div>
|
|
306
|
+
<template #tip>
|
|
307
|
+
<div class="el-upload__tip">
|
|
308
|
+
只能上传 xls/xlsx 文件类型
|
|
309
|
+
<el-button
|
|
310
|
+
@click="downloadTemplate"
|
|
311
|
+
title=""
|
|
312
|
+
:size="size"
|
|
313
|
+
link
|
|
314
|
+
v-if="importInfo?.downloadTemplateUrl"
|
|
315
|
+
>
|
|
316
|
+
<star-horse-icon
|
|
317
|
+
icon-class="download"
|
|
318
|
+
color="var(--star-horse-white)"
|
|
319
|
+
size="12px"
|
|
320
|
+
/>
|
|
321
|
+
<el-tooltip content="下载模板">下载模板</el-tooltip>
|
|
322
|
+
</el-button>
|
|
323
|
+
</div>
|
|
324
|
+
</template>
|
|
325
|
+
</el-upload>
|
|
326
|
+
</el-card>
|
|
327
|
+
</star-horse-dialog>
|
|
328
|
+
<div class="form-list">
|
|
329
|
+
<div class="dynamic-tools">
|
|
330
|
+
<div class="flex items-center" v-if="!subFlag">
|
|
331
|
+
<star-horse-icon icon-class="config" size="14px"/>
|
|
332
|
+
{{ title }}
|
|
333
|
+
<help v-if="helpMsg" :message="helpMsg" :width="400"/>
|
|
334
|
+
</div>
|
|
335
|
+
<div class="flex items-center">
|
|
336
|
+
<ul class="inner_button" v-if="source != 3">
|
|
337
|
+
<li
|
|
338
|
+
v-if="importInfo?.importDataUrl && !subFlag"
|
|
339
|
+
@click="excelOperation"
|
|
340
|
+
>
|
|
341
|
+
<el-tooltip content="导入Excel">
|
|
342
|
+
<star-horse-icon
|
|
343
|
+
icon-class="upload"
|
|
344
|
+
color="var(--star-horse-style)"
|
|
345
|
+
size="18px"
|
|
346
|
+
/>
|
|
347
|
+
</el-tooltip>
|
|
348
|
+
</li>
|
|
349
|
+
<li @click="clearAll">
|
|
350
|
+
<el-tooltip content="清空列表">
|
|
351
|
+
<star-horse-icon
|
|
352
|
+
icon-class="dustbin"
|
|
353
|
+
color="var(--el-color-danger)"
|
|
354
|
+
size="18px"
|
|
355
|
+
/>
|
|
356
|
+
</el-tooltip>
|
|
357
|
+
</li>
|
|
358
|
+
</ul>
|
|
359
|
+
</div>
|
|
360
|
+
</div>
|
|
361
|
+
<el-table
|
|
362
|
+
v-loading="loading"
|
|
363
|
+
:data="dataForm[batchName]"
|
|
364
|
+
fit
|
|
365
|
+
border
|
|
366
|
+
sortable
|
|
367
|
+
:size="size"
|
|
368
|
+
:strip="true"
|
|
369
|
+
:row-key="getRowIdentity"
|
|
370
|
+
:highlight-current-row="true"
|
|
371
|
+
:row-class-name="rowClassName"
|
|
372
|
+
ref="starHorseFormListRef"
|
|
373
|
+
class="sh-columns"
|
|
374
|
+
:stripe="true"
|
|
375
|
+
:virtual="true"
|
|
376
|
+
:virtual-scroll-threshold="10"
|
|
377
|
+
:virtual-scroll-options="{
|
|
378
|
+
scrollSensitivity: 60,
|
|
379
|
+
scrollDebounce: 20,
|
|
380
|
+
}"
|
|
381
|
+
:use-virtual="dataForm[batchName]?.length > 10"
|
|
382
|
+
:header-cell-style="{
|
|
383
|
+
background: '#f2f2f2',
|
|
384
|
+
color: '#707070',
|
|
385
|
+
'font-size': '12px',
|
|
386
|
+
'background-image':
|
|
387
|
+
'-webkit-gradient(linear,left 0,left 100%,from(#f8f8f8),to(#ececec))',
|
|
388
|
+
}"
|
|
389
|
+
:cell-style="{ 'font-size': '12px' }"
|
|
390
|
+
>
|
|
391
|
+
<el-table-column
|
|
392
|
+
type="selection"
|
|
393
|
+
fixed="left"
|
|
394
|
+
width="50"
|
|
395
|
+
align="center"
|
|
396
|
+
v-if="showCheckBox"
|
|
397
|
+
/>
|
|
398
|
+
<el-table-column label="序号" align="center" prop="xh" width="50"/>
|
|
399
|
+
<el-table-column prop="" label="排序" width="60">
|
|
400
|
+
<template #default="scope">
|
|
401
|
+
<el-tag
|
|
402
|
+
class="move"
|
|
403
|
+
style="cursor: move"
|
|
404
|
+
@mousedown="selectData(scope)"
|
|
405
|
+
>
|
|
406
|
+
<el-icon style="cursor: move">
|
|
407
|
+
<Sort/>
|
|
408
|
+
</el-icon>
|
|
409
|
+
</el-tag>
|
|
410
|
+
</template>
|
|
411
|
+
</el-table-column>
|
|
412
|
+
<template v-for="(item, key) in fieldList" :key="compKey(item, key)">
|
|
413
|
+
<template v-if="Array.isArray(item)">
|
|
414
|
+
<UTableColumn
|
|
415
|
+
:item="temp"
|
|
416
|
+
:key="compKey(temp, skey)"
|
|
417
|
+
v-for="(temp, skey) in item"
|
|
418
|
+
:size="size"
|
|
419
|
+
:rules="rules"
|
|
420
|
+
:source="source"
|
|
421
|
+
:batchName="batchName"
|
|
422
|
+
:primaryKey="primaryKey"
|
|
423
|
+
:staticColumn="staticColumn"
|
|
424
|
+
/>
|
|
425
|
+
</template>
|
|
426
|
+
<template v-else-if="item.formVisible">
|
|
427
|
+
<UTableColumn
|
|
428
|
+
:item="item"
|
|
429
|
+
:size="size"
|
|
430
|
+
:rules="rules"
|
|
431
|
+
:source="source"
|
|
432
|
+
:batchName="batchName"
|
|
433
|
+
:primaryKey="primaryKey"
|
|
434
|
+
:staticColumn="staticColumn"
|
|
435
|
+
/>
|
|
436
|
+
</template>
|
|
437
|
+
</template>
|
|
438
|
+
<el-table-column fixed="right" label="操作" width="80">
|
|
439
|
+
<template #default="scope" v-if="source != 3">
|
|
440
|
+
<star-horse-icon
|
|
441
|
+
icon-class="edit"
|
|
442
|
+
v-if="staticColumn == 'Y'"
|
|
443
|
+
@click="dynamicHandleAddForm(scope.row, 'edit')"
|
|
444
|
+
title="编辑"
|
|
445
|
+
/>
|
|
446
|
+
<star-horse-icon
|
|
447
|
+
icon-class="delete"
|
|
448
|
+
@click="handleAddDetails(scope.row, 2)"
|
|
449
|
+
title="删除当前行"
|
|
450
|
+
color="#f56c6c"
|
|
451
|
+
/>
|
|
452
|
+
</template>
|
|
453
|
+
</el-table-column>
|
|
454
|
+
</el-table>
|
|
455
|
+
<div class="add-row" v-if="source != 3" @click="handleAddDetails(null, 1)">
|
|
456
|
+
<star-horse-icon icon-class="plus" color="var(--star-horse-style)"/>
|
|
457
|
+
{{ staticColumn == "Y" ? "添加数据" : "加一行" }}
|
|
458
|
+
</div>
|
|
459
|
+
</div>
|
|
460
|
+
</template>
|
|
461
|
+
<style lang="scss" scoped>
|
|
462
|
+
:deep(.el-table__cell) {
|
|
463
|
+
padding: 0;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
:deep(.cell) {
|
|
467
|
+
display: flex;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.dynamic-tools {
|
|
471
|
+
display: flex;
|
|
472
|
+
justify-content: space-between;
|
|
473
|
+
width: 100%;
|
|
474
|
+
align-items: center;
|
|
475
|
+
height: 30px;
|
|
476
|
+
border-bottom: var(--star-horse-style) 1px solid;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.form-list {
|
|
480
|
+
display: flex;
|
|
481
|
+
flex-direction: column;
|
|
482
|
+
width: 99%;
|
|
483
|
+
margin: 0 auto;
|
|
484
|
+
flex: 1;
|
|
485
|
+
height: 100%;
|
|
486
|
+
overflow: hidden;
|
|
487
|
+
|
|
488
|
+
.inner_button {
|
|
489
|
+
height: unset;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
.el-table {
|
|
493
|
+
flex: 1;
|
|
494
|
+
min-height: 100px;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
:deep(th.el-table__cell:first-child) {
|
|
499
|
+
padding: 5px 0;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
:deep(.el-form-item) {
|
|
503
|
+
font-size: 11px;
|
|
504
|
+
/* margin-bottom: 1px;*/
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
:deep(.el-input__inner),
|
|
508
|
+
:deep(el-select) {
|
|
509
|
+
height: 25px;
|
|
510
|
+
font-size: 12px;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
:deep(.el-select) {
|
|
514
|
+
line-height: 25px;
|
|
515
|
+
}
|
|
516
|
+
</style>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script setup lang="ts" name="StarHorseFormItem">
|
|
2
|
+
import { Config } from "@/api/settings";
|
|
3
|
+
import { batchFieldDefaultValues } from "@/api/star_horse_utils";
|
|
4
|
+
import { ModelRef, PropType, ref } from "vue";
|
|
5
|
+
|
|
6
|
+
defineProps({
|
|
7
|
+
item: { type: Object as PropType<any>, required: true },
|
|
8
|
+
rules: { type: Object },
|
|
9
|
+
initRows: { type: Number, default: 0 },
|
|
10
|
+
size: { type: String, default: Config.compSize },
|
|
11
|
+
source: { type: Number, default: 1 },
|
|
12
|
+
});
|
|
13
|
+
const emits = defineEmits(["addRow", "removeRow"]);
|
|
14
|
+
const dataForm: ModelRef<any> = defineModel("dataForm");
|
|
15
|
+
const currentTableRef = ref();
|
|
16
|
+
/**
|
|
17
|
+
* 列表添加行数据
|
|
18
|
+
* @param row
|
|
19
|
+
*/
|
|
20
|
+
const addRow = (row: any) => {
|
|
21
|
+
emits("addRow", row);
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* 列表删除行数据
|
|
25
|
+
* @param row
|
|
26
|
+
*/
|
|
27
|
+
const removeRow = (row: any) => {
|
|
28
|
+
emits("removeRow", row);
|
|
29
|
+
};
|
|
30
|
+
</script>
|
|
31
|
+
<template>
|
|
32
|
+
<star-horse-form-list
|
|
33
|
+
style="min-height: 100px"
|
|
34
|
+
v-model:dataForm="dataForm"
|
|
35
|
+
:compUrl="item['compUrl']"
|
|
36
|
+
:primaryKey="item['primaryKey']"
|
|
37
|
+
:batchName="item['batchName']"
|
|
38
|
+
:initRows="item['initRows']"
|
|
39
|
+
:batchUrl="item['batchUrl']"
|
|
40
|
+
:title="item['title']"
|
|
41
|
+
:size="size"
|
|
42
|
+
@addRow="addRow"
|
|
43
|
+
@removeRow="removeRow"
|
|
44
|
+
v-if="Object.keys(item).includes('disVisible') ? item['disVisible'] : true"
|
|
45
|
+
:helpMsg="item['helpMsg']"
|
|
46
|
+
:staticColumn="item.staticColumn ?? 'Y'"
|
|
47
|
+
:downloadTemplateUrl="item['downloadTemplateUrl']"
|
|
48
|
+
:importInfo="item['importInfo']"
|
|
49
|
+
:defaultValues="batchFieldDefaultValues(item, dataForm)"
|
|
50
|
+
ref="currentTableRef"
|
|
51
|
+
:fieldList="item['fieldList']"
|
|
52
|
+
:source="source"
|
|
53
|
+
:rules="item['rules'] || rules"
|
|
54
|
+
/>
|
|
55
|
+
</template>
|
|
56
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script setup lang="ts" name="StarHorseIcon">
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
iconClass: { type: String, required: true },
|
|
6
|
+
className: { type: String },
|
|
7
|
+
title: { type: String, default: "" },
|
|
8
|
+
size: { type: String, default: "20px" },
|
|
9
|
+
marginLeft: { type: String, default: "0.1em" },
|
|
10
|
+
marginRight: { type: String, default: "0.2em" },
|
|
11
|
+
borderRadius: { type: String, default: "5px" },
|
|
12
|
+
borderPadding: { type: String, default: "3px" },
|
|
13
|
+
// 图标是否有边框
|
|
14
|
+
boxShow: { type: Boolean, default: false },
|
|
15
|
+
border: { type: Boolean, default: false },
|
|
16
|
+
color: { type: String, default: "var(--star-horse-style)" },
|
|
17
|
+
cursor: { type: String, default: "default" },
|
|
18
|
+
});
|
|
19
|
+
const iconName = computed(() => `sh-${props.iconClass}`);
|
|
20
|
+
const sizeNumber = computed(() => {
|
|
21
|
+
const numberMatch = props.size.match(/\d+/); // 正则匹配连续数字
|
|
22
|
+
return numberMatch ? Number(numberMatch[0]) : 0; // 转换为数值,无匹配时返回0
|
|
23
|
+
});
|
|
24
|
+
const width = computed(() =>
|
|
25
|
+
sizeNumber.value ? `${sizeNumber.value + 2}px` : props.size,
|
|
26
|
+
);
|
|
27
|
+
const height = computed(() =>
|
|
28
|
+
sizeNumber.value ? `${sizeNumber.value + 2}px` : props.size,
|
|
29
|
+
);
|
|
30
|
+
const svgClass = computed(() => {
|
|
31
|
+
let cls = props.border
|
|
32
|
+
? "sh_icon svg-icon icon-border"
|
|
33
|
+
: props.boxShow
|
|
34
|
+
? "sh_icon svg-icon icon-cls"
|
|
35
|
+
: "sh_icon svg-icon";
|
|
36
|
+
if (props.className) {
|
|
37
|
+
return cls + " " + props.className;
|
|
38
|
+
} else {
|
|
39
|
+
return cls;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
43
|
+
<style lang="scss" scoped>
|
|
44
|
+
.svg-icon {
|
|
45
|
+
cursor: v-bind(cursor);
|
|
46
|
+
width: v-bind(width);
|
|
47
|
+
height: v-bind(height);
|
|
48
|
+
color: v-bind(color);
|
|
49
|
+
font-size: v-bind(size);
|
|
50
|
+
margin-left: v-bind(marginLeft);
|
|
51
|
+
margin-right: v-bind(marginRight);
|
|
52
|
+
vertical-align: -0.15em;
|
|
53
|
+
fill: currentColor;
|
|
54
|
+
overflow: hidden;
|
|
55
|
+
outline: none;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
display: flex;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.icon-border {
|
|
62
|
+
border-radius: v-bind(borderRadius);
|
|
63
|
+
border: 1px solid var(--star-horse-style);
|
|
64
|
+
padding: v-bind(borderPadding);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.icon-cls {
|
|
68
|
+
background: var(--star-horse-style);
|
|
69
|
+
color: var(--star-horse-white);
|
|
70
|
+
border-radius: v-bind(borderRadius);
|
|
71
|
+
padding: v-bind(borderPadding);
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
74
|
+
<template>
|
|
75
|
+
<i aria-hidden="false" :class="[svgClass, iconName]" :title="title" />
|
|
76
|
+
</template>
|