star-horse-lowcode 2.7.65 → 2.7.67
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/README.md +3 -0
- package/dist/assets/index.css +1 -1
- package/dist/index.es.js +597 -188
- package/dist/types/index.d.ts +30 -0
- package/package.json +3 -3
- package/.env.development +0 -3
- package/.env.production +0 -3
- package/.eslintrc-auto-import.json +0 -77
- package/.gitignore +0 -27
- package/.idea/.gitignore +0 -5
- package/.idea/MarsCodeWorkspaceAppSettings.xml +0 -6
- package/.idea/inspectionProfiles/Project_Default.xml +0 -7
- package/.idea/modules.xml +0 -8
- package/.idea/testcode.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/.idea/watcherTasks.xml +0 -4
- package/.idea/workspace.xml +0 -207
- package/.npmignore +0 -21
- package/.prettierignore +0 -26
- package/auto-imports.d.ts +0 -137
- package/components.d.ts +0 -189
- package/eslint.config.js +0 -37
- package/index.html +0 -14
- package/package-lock.json +0 -8276
- package/prettier.config.js +0 -20
- package/public/logo.svg +0 -660
- package/src/App.vue +0 -11
- package/src/api/date_utils.ts +0 -219
- package/src/api/finger_utils.ts +0 -71
- package/src/api/form_utils.ts +0 -281
- package/src/api/jquery.min.js +0 -2
- package/src/api/pcas-code.json +0 -1
- package/src/api/settings.ts +0 -81
- package/src/api/star_horse_apis.ts +0 -196
- package/src/api/star_horse_utils.ts +0 -797
- package/src/api/system.ts +0 -351
- package/src/api/user_func.ts +0 -147
- package/src/api/valid_utils.ts +0 -165
- package/src/assets/css/index.scss +0 -908
- package/src/assets/icons.css +0 -574
- package/src/assets/star-horse-icons.woff +0 -0
- package/src/components/comp/ShDynamicForm.vue +0 -160
- package/src/components/comp/ShForm.vue +0 -30
- package/src/components/comp/ShTableListColumn.vue +0 -61
- package/src/components/comp/StarHorseDataSelector.vue +0 -139
- package/src/components/comp/StarHorseDataView.vue +0 -110
- package/src/components/comp/StarHorseDataViewItems.vue +0 -61
- package/src/components/comp/StarHorseDataViewTable.vue +0 -102
- package/src/components/comp/StarHorseDialog.vue +0 -383
- package/src/components/comp/StarHorseDraggable.vue +0 -401
- package/src/components/comp/StarHorseForm.vue +0 -458
- package/src/components/comp/StarHorseFormItem.vue +0 -82
- package/src/components/comp/StarHorseFormList.vue +0 -516
- package/src/components/comp/StarHorseFormTable.vue +0 -56
- package/src/components/comp/StarHorseIcon.vue +0 -76
- package/src/components/comp/StarHorseItem.vue +0 -302
- package/src/components/comp/StarHorseJsonEditor.vue +0 -115
- package/src/components/comp/StarHorsePopover.vue +0 -66
- package/src/components/comp/StarHorseSearchComp.vue +0 -253
- package/src/components/comp/StarHorseStaticTable.vue +0 -395
- package/src/components/comp/StarHorseTableColumn.vue +0 -249
- package/src/components/comp/StarHorseTableComp.vue +0 -1193
- package/src/components/comp/StarHorseTableViewColumn.vue +0 -61
- package/src/components/comp/StarHorseTree.vue +0 -494
- package/src/components/comp/index.ts +0 -22
- package/src/components/comp/items/UTableColumn.vue +0 -65
- package/src/components/comp/items/boxItem.vue +0 -98
- package/src/components/comp/items/callitem.ts +0 -9
- package/src/components/comp/items/cardItem.vue +0 -152
- package/src/components/comp/items/collapseItem.vue +0 -134
- package/src/components/comp/items/dytableItem.vue +0 -135
- package/src/components/comp/items/otherItem.vue +0 -65
- package/src/components/comp/items/tabItem.vue +0 -155
- package/src/components/comp/items/tabPanelItem.vue +0 -110
- package/src/components/comp/items/tableColumn.vue +0 -129
- package/src/components/comp/items/tableItem.vue +0 -97
- package/src/components/comp/items/tablebtn.vue +0 -158
- package/src/components/comp/items/viewBoxItem.vue +0 -55
- package/src/components/comp/items/viewCardItem.vue +0 -47
- package/src/components/comp/items/viewCollapseItem.vue +0 -71
- package/src/components/comp/items/viewDytableItem.vue +0 -77
- package/src/components/comp/items/viewOtherItem.vue +0 -55
- package/src/components/comp/items/viewTabItem.vue +0 -77
- package/src/components/comp/items/viewTabPanelItem.vue +0 -54
- package/src/components/comp/items/viewTableItem.vue +0 -74
- package/src/components/comp/selfcomp.ts +0 -9
- package/src/components/comp/utils/DataPicker.vue +0 -302
- package/src/components/comp/utils/DataTag.vue +0 -51
- package/src/components/cron/Crontab-Day.vue +0 -230
- package/src/components/cron/Crontab-Hour.vue +0 -165
- package/src/components/cron/Crontab-Min.vue +0 -166
- package/src/components/cron/Crontab-Month.vue +0 -166
- package/src/components/cron/Crontab-Result.vue +0 -615
- package/src/components/cron/Crontab-Second.vue +0 -185
- package/src/components/cron/Crontab-Week.vue +0 -208
- package/src/components/cron/Crontab-Year.vue +0 -183
- package/src/components/cron/Crontab.vue +0 -474
- package/src/components/enums/ModuleEnums.ts +0 -10
- package/src/components/enums/ServiceEnums.ts +0 -18
- package/src/components/formcomp/container/box-container.vue +0 -162
- package/src/components/formcomp/container/callitem.ts +0 -9
- package/src/components/formcomp/container/card-container.vue +0 -170
- package/src/components/formcomp/container/collapse-container.vue +0 -133
- package/src/components/formcomp/container/dytable-col.vue +0 -448
- package/src/components/formcomp/container/dytable-container.vue +0 -57
- package/src/components/formcomp/container/dytableUtils.ts +0 -358
- package/src/components/formcomp/container/group-box-container.vue +0 -331
- package/src/components/formcomp/container/index.ts +0 -6
- package/src/components/formcomp/container/tab-container.vue +0 -153
- package/src/components/formcomp/container/table-container.vue +0 -249
- package/src/components/formcomp/items/allitem.ts +0 -9
- package/src/components/formcomp/items/area-item.vue +0 -116
- package/src/components/formcomp/items/audio-item.vue +0 -163
- package/src/components/formcomp/items/autocomplete-item.vue +0 -118
- package/src/components/formcomp/items/barcode-item.vue +0 -87
- package/src/components/formcomp/items/base-json-item.vue +0 -207
- package/src/components/formcomp/items/button-item.vue +0 -228
- package/src/components/formcomp/items/cascade-item.vue +0 -113
- package/src/components/formcomp/items/checkbox-item.vue +0 -97
- package/src/components/formcomp/items/color-item.vue +0 -70
- package/src/components/formcomp/items/cron-item.vue +0 -115
- package/src/components/formcomp/items/datetime-item.vue +0 -99
- package/src/components/formcomp/items/depart-item.vue +0 -51
- package/src/components/formcomp/items/dialog-input-item.vue +0 -207
- package/src/components/formcomp/items/divider-item.vue +0 -66
- package/src/components/formcomp/items/html-item.vue +0 -65
- package/src/components/formcomp/items/htmleditor-item.vue +0 -104
- package/src/components/formcomp/items/icon-item.vue +0 -195
- package/src/components/formcomp/items/image-item.vue +0 -247
- package/src/components/formcomp/items/index.ts +0 -44
- package/src/components/formcomp/items/input-item.vue +0 -150
- package/src/components/formcomp/items/json-array-item.vue +0 -67
- package/src/components/formcomp/items/json-item.vue +0 -66
- package/src/components/formcomp/items/markdown-item.vue +0 -77
- package/src/components/formcomp/items/number-item.vue +0 -94
- package/src/components/formcomp/items/number-range-item.vue +0 -278
- package/src/components/formcomp/items/page-select-item.vue +0 -407
- package/src/components/formcomp/items/password-item.vue +0 -71
- package/src/components/formcomp/items/qrcode-item.vue +0 -84
- package/src/components/formcomp/items/radio-item.vue +0 -112
- package/src/components/formcomp/items/rate-item.vue +0 -68
- package/src/components/formcomp/items/select-item.vue +0 -133
- package/src/components/formcomp/items/signature-item.vue +0 -216
- package/src/components/formcomp/items/slider-item.vue +0 -68
- package/src/components/formcomp/items/starhorse-form-item.vue +0 -334
- package/src/components/formcomp/items/switch-item.vue +0 -77
- package/src/components/formcomp/items/tag-item.vue +0 -77
- package/src/components/formcomp/items/text-item.vue +0 -75
- package/src/components/formcomp/items/textarea-item.vue +0 -85
- package/src/components/formcomp/items/time-item.vue +0 -77
- package/src/components/formcomp/items/time-picker-item.vue +0 -74
- package/src/components/formcomp/items/transfer-item.vue +0 -93
- package/src/components/formcomp/items/tselect-item.vue +0 -121
- package/src/components/formcomp/items/unknown-item.vue +0 -51
- package/src/components/formcomp/items/upload-item.vue +0 -189
- package/src/components/formcomp/items/user-item.vue +0 -177
- package/src/components/formcomp/items/usercomp-item.vue +0 -85
- package/src/components/formcomp/items/view-markdown-item.vue +0 -77
- package/src/components/formcomp/utils/EditDataDialog.vue +0 -67
- package/src/components/formcomp/utils/FieldList.vue +0 -125
- package/src/components/formcomp/utils/ItemRelationEventUtils.ts +0 -284
- package/src/components/help.vue +0 -31
- package/src/components/menu/MenuItem.vue +0 -95
- package/src/components/menu/SubMenu.vue +0 -68
- package/src/components/menu/SubSystemMenu.vue +0 -142
- package/src/components/register.ts +0 -24
- package/src/components/system/ContentMenu.vue +0 -260
- package/src/components/system/StarHorseButtonList.vue +0 -344
- package/src/components/system/StarHorseMenu.vue +0 -97
- package/src/components/system/StarHorseSvg.vue +0 -62
- package/src/components/system/SystemComp.ts +0 -9
- package/src/components/system/index.ts +0 -4
- package/src/components/types/ApiUrls.ts +0 -168
- package/src/components/types/BtnAction.ts +0 -51
- package/src/components/types/BtnAuth.ts +0 -43
- package/src/components/types/CompInfo.ts +0 -81
- package/src/components/types/DialogProps.ts +0 -55
- package/src/components/types/DyCompField.ts +0 -23
- package/src/components/types/DynamicNode.ts +0 -42
- package/src/components/types/MenusInfo.ts +0 -45
- package/src/components/types/PageFieldInfo.ts +0 -530
- package/src/components/types/PageProps.ts +0 -25
- package/src/components/types/Params.ts +0 -93
- package/src/components/types/RuleType.ts +0 -10
- package/src/components/types/SearchProps.ts +0 -42
- package/src/components/types/ShortKey.ts +0 -30
- package/src/components/types/StarHorseType.ts +0 -18
- package/src/components/types/index.ts +0 -15
- package/src/config/element.ts +0 -15
- package/src/config/styles.ts +0 -4
- package/src/index.ts +0 -98
- package/src/install.ts +0 -33
- package/src/lang/en_US.ts +0 -81
- package/src/lang/index.ts +0 -35
- package/src/lang/zh_CN.ts +0 -84
- package/src/main.ts +0 -57
- package/src/plugins/AblesPlugin.ts +0 -618
- package/src/plugins/registerCompPlugin.ts +0 -15
- package/src/sample/test.vue +0 -9
- package/src/store/ButtonPermission.ts +0 -101
- package/src/store/ConsumerView.ts +0 -52
- package/src/store/ContinusConfig.ts +0 -78
- package/src/store/CopyerOperation.ts +0 -74
- package/src/store/DesignForm.ts +0 -481
- package/src/store/DesignPage.ts +0 -59
- package/src/store/DynamicForm.ts +0 -241
- package/src/store/GlobalConfig.ts +0 -90
- package/src/store/SelfOperation.ts +0 -95
- package/src/store/UserInfo.ts +0 -88
- package/src/store/index.ts +0 -6
- package/src/theme/localStorge.ts +0 -16
- package/src/theme/theme.ts +0 -27
- package/src/utils/FieldOperationUtils.ts +0 -91
- package/src/utils/auth.ts +0 -83
- package/src/utils/message.ts +0 -69
- package/src/utils/preview.ts +0 -125
- package/tsconfig.json +0 -39
- package/tsconfig.node.json +0 -10
- package/vite-env.d.ts +0 -16
- package/vite.config.ts +0 -162
- package/yarn.lock +0 -4627
|
@@ -1,516 +0,0 @@
|
|
|
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>
|
|
@@ -1,56 +0,0 @@
|
|
|
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>
|
|
@@ -1,76 +0,0 @@
|
|
|
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>
|