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.
- package/README.md +1 -0
- package/dist/assets/index.css +1 -1
- package/dist/index.es.js +491 -253
- package/package.json +1 -1
- 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,458 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts" name="StarHorseForm">
|
|
2
|
-
import {
|
|
3
|
-
inject,
|
|
4
|
-
nextTick,
|
|
5
|
-
onActivated,
|
|
6
|
-
onBeforeUnmount,
|
|
7
|
-
onDeactivated,
|
|
8
|
-
onMounted,
|
|
9
|
-
PropType,
|
|
10
|
-
ref,
|
|
11
|
-
ShallowReactive,
|
|
12
|
-
unref,
|
|
13
|
-
watch,
|
|
14
|
-
} from "vue";
|
|
15
|
-
import {ApiUrls} from "@/components/types/ApiUrls";
|
|
16
|
-
import {error, success, warning} from "@/utils/message";
|
|
17
|
-
import {postRequest} from "@/api/star_horse_apis";
|
|
18
|
-
import {closeLoad, formFieldMapping, isJson, load, loadById,} from "@/api/star_horse_utils";
|
|
19
|
-
import {DialogProps} from "@/components/types/DialogProps";
|
|
20
|
-
import {BatchFieldInfo, FieldInfo, PageFieldInfo,} from "@/components/types/PageFieldInfo";
|
|
21
|
-
import StarHorseFormItem from "@/components/comp/StarHorseFormItem.vue";
|
|
22
|
-
import piniaInstance from "@/store";
|
|
23
|
-
import {useSelfOperationStore} from "@/store/SelfOperation";
|
|
24
|
-
import {SelectOption} from "@/components/types/SearchProps";
|
|
25
|
-
import {Config} from "@/api/settings";
|
|
26
|
-
|
|
27
|
-
const props = defineProps({
|
|
28
|
-
compUrl: {type: Object as PropType<ApiUrls>},
|
|
29
|
-
fieldList: {type: Object as PropType<PageFieldInfo>, required: true},
|
|
30
|
-
batchName: {type: String, default: "batchDataList"},
|
|
31
|
-
batchFieldName: {type: String, default: "batchFieldList"},
|
|
32
|
-
outerFormData: {type: Object as PropType<any>},
|
|
33
|
-
primaryKey: {type: [String, Object] as PropType<string | any>},
|
|
34
|
-
globalCondition: {type: Object},
|
|
35
|
-
rules: {type: Object},
|
|
36
|
-
formSize: {type: String, default: Config.compSize},
|
|
37
|
-
labelPosition: {type: String, default: "left"},
|
|
38
|
-
typeModel: {type: String},
|
|
39
|
-
dynamicForm: {type: Boolean, default: false},
|
|
40
|
-
|
|
41
|
-
selectData: {
|
|
42
|
-
type: Array<SelectOption>,
|
|
43
|
-
default: () => {
|
|
44
|
-
return [
|
|
45
|
-
{name: "正常", value: "1"},
|
|
46
|
-
{name: "禁用", value: "2"},
|
|
47
|
-
];
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
let userOperation = useSelfOperationStore(piniaInstance);
|
|
52
|
-
//刷新事件,数据已加载事件,导出数据更新数据
|
|
53
|
-
const emits = defineEmits([
|
|
54
|
-
"refresh",
|
|
55
|
-
"dataLoaded",
|
|
56
|
-
"exportData",
|
|
57
|
-
"removeRow",
|
|
58
|
-
"addRow",
|
|
59
|
-
"inited",
|
|
60
|
-
]);
|
|
61
|
-
const starHorseFormRef = ref(null);
|
|
62
|
-
const dataForm = ref<any>({});
|
|
63
|
-
// source:{type:Number,default:1},
|
|
64
|
-
const source = ref<number>(1);
|
|
65
|
-
//更新外面传进来的数据
|
|
66
|
-
|
|
67
|
-
const exportData = () => {
|
|
68
|
-
emits("exportData", dataForm.value);
|
|
69
|
-
};
|
|
70
|
-
//向外实时导出数据
|
|
71
|
-
|
|
72
|
-
const closeDialog = inject("closeDialog") as Function;
|
|
73
|
-
let dialogOperation = inject("dialogOperation") as ShallowReactive<any>;
|
|
74
|
-
const dialogProps = inject<DialogProps>("dialogProps", {});
|
|
75
|
-
const formFields = inject("formFields", {}) as ShallowReactive<any>;
|
|
76
|
-
|
|
77
|
-
const loadData = async () => {
|
|
78
|
-
if (!props.compUrl || !props.compUrl.loadByIdUrl || !dialogProps.ids) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
await nextTick();
|
|
82
|
-
let id = Array.isArray(dialogProps?.ids)
|
|
83
|
-
? dialogProps.ids[0]
|
|
84
|
-
: dialogProps?.ids;
|
|
85
|
-
let objData;
|
|
86
|
-
let params = props.globalCondition || {};
|
|
87
|
-
//如果是Json 对象
|
|
88
|
-
if (isJson(id)) {
|
|
89
|
-
params = {...params, ...id};
|
|
90
|
-
objData = await loadById(props.compUrl?.loadByIdUrl!, "", params);
|
|
91
|
-
} else {
|
|
92
|
-
objData = await loadById(props.compUrl?.loadByIdUrl!, id, params);
|
|
93
|
-
}
|
|
94
|
-
let data = formFieldMapping(props.fieldList);
|
|
95
|
-
dataForm.value = objData;
|
|
96
|
-
//如果是动态表单
|
|
97
|
-
if (props.dynamicForm) {
|
|
98
|
-
for (let i in params) {
|
|
99
|
-
let temp = params[i];
|
|
100
|
-
if (!temp.subTabFlag) {
|
|
101
|
-
let subTemp = {...objData};
|
|
102
|
-
delete subTemp[temp.tableName];
|
|
103
|
-
dataForm.value[temp.tableName] = [subTemp];
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
let mapping = data.mappingFields;
|
|
108
|
-
if (mapping) {
|
|
109
|
-
for (let index in mapping) {
|
|
110
|
-
let temp = mapping[index];
|
|
111
|
-
if (!Object.keys(objData).includes(temp.name)) {
|
|
112
|
-
dataForm.value[temp.name] = dataForm.value[temp.alias];
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
let actions = data.actions;
|
|
117
|
-
if (actions && actions.length > 0) {
|
|
118
|
-
for (let index in actions) {
|
|
119
|
-
let temp = actions[index];
|
|
120
|
-
// let tempFunc: any = objData;
|
|
121
|
-
if (temp.actionNames == "change") {
|
|
122
|
-
temp.actions(objData);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
nextTick(() => {
|
|
127
|
-
emits("dataLoaded", objData);
|
|
128
|
-
checkActionRelation();
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
/**
|
|
132
|
-
* 加载了数据,检查是否有数据联动的相关方法
|
|
133
|
-
*/
|
|
134
|
-
const checkActionRelation = () => {
|
|
135
|
-
for (let key in formFields) {
|
|
136
|
-
let temp = formFields[key];
|
|
137
|
-
let preps = temp?.preps;
|
|
138
|
-
|
|
139
|
-
if (preps?.actions) {
|
|
140
|
-
temp.preps["actions"](dataForm.value);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
const merge = (type: string) => {
|
|
145
|
-
starHorseFormRef.value!.validate((result: boolean) => {
|
|
146
|
-
if (!result) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
doMerge(type);
|
|
150
|
-
});
|
|
151
|
-
};
|
|
152
|
-
/**
|
|
153
|
-
* 对状态名称赋值
|
|
154
|
-
*/
|
|
155
|
-
const assignStatusName = () => {
|
|
156
|
-
if (dataForm.value.statusCode) {
|
|
157
|
-
let sData = props.selectData.find(
|
|
158
|
-
(item: any) => item.value === dataForm.value.statusCode,
|
|
159
|
-
);
|
|
160
|
-
if (sData) {
|
|
161
|
-
dataForm.value["statusName"] = sData.name;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
let batchFields = props.fieldList?.batchFieldList || [];
|
|
165
|
-
batchFields?.forEach((item: BatchFieldInfo) => {
|
|
166
|
-
if (dataForm.value[item.batchName]) {
|
|
167
|
-
for (
|
|
168
|
-
let index = 0;
|
|
169
|
-
index < dataForm.value[item.batchName]?.length;
|
|
170
|
-
index++
|
|
171
|
-
) {
|
|
172
|
-
let temp = dataForm.value[item.batchName][index];
|
|
173
|
-
let sData = props.selectData.find(
|
|
174
|
-
(sitem: any) => sitem.value === temp.statusCode,
|
|
175
|
-
);
|
|
176
|
-
if (sData) {
|
|
177
|
-
dataForm.value[item.batchName][index]["statusName"] = sData.name;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
};
|
|
183
|
-
const mergeDraft = (type: string) => {
|
|
184
|
-
doMerge(type);
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
const analysisSameToParentField = (): Array<string> => {
|
|
188
|
-
let batchName: Array<string> = [];
|
|
189
|
-
let batchFields = props.fieldList?.batchFieldList ||[];
|
|
190
|
-
const analysis = (batchFields: BatchFieldInfo[]) => {
|
|
191
|
-
batchFields?.forEach((item: BatchFieldInfo) => {
|
|
192
|
-
if (false === item.subFormFlag || "N" == item.subFormFlag) {
|
|
193
|
-
batchName.push(item.batchName);
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
};
|
|
197
|
-
//单独定义的批量属性
|
|
198
|
-
analysis(batchFields);
|
|
199
|
-
//嵌入fieldList里的批量属性
|
|
200
|
-
let fieldList = props.fieldList?.fieldList || [];
|
|
201
|
-
const arrayFieldList = (fieldList: FieldInfo[]) => {
|
|
202
|
-
for (let index in fieldList) {
|
|
203
|
-
let temp: any = fieldList[index];
|
|
204
|
-
if (temp instanceof Array) {
|
|
205
|
-
arrayFieldList(temp);
|
|
206
|
-
} else if (temp.batchFieldList) {
|
|
207
|
-
analysis(temp.batchFieldList);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
arrayFieldList(fieldList);
|
|
212
|
-
return batchName;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
const doMerge = (type: string) => {
|
|
216
|
-
assignStatusName();
|
|
217
|
-
let tempForm: any = [];
|
|
218
|
-
let tempDatas: any = JSON.parse(JSON.stringify(dataForm.value));
|
|
219
|
-
let mergeUrl = props.compUrl?.mergeUrl;
|
|
220
|
-
let flag = true;
|
|
221
|
-
//单独批量数据和嵌入fieldList 里的批量数据
|
|
222
|
-
//原则上只支持1个批量表格,多个存在数据对称问题
|
|
223
|
-
let sameBatchNames = analysisSameToParentField();
|
|
224
|
-
if (sameBatchNames?.length > 0) {
|
|
225
|
-
flag = false;
|
|
226
|
-
mergeUrl = props.compUrl?.batchMergeUrl;
|
|
227
|
-
tempForm = [];
|
|
228
|
-
sameBatchNames.forEach((batchName: string) => {
|
|
229
|
-
let batchDatas = tempDatas[batchName];
|
|
230
|
-
delete tempDatas[batchName];
|
|
231
|
-
for (let i in batchDatas) {
|
|
232
|
-
//保留第一条数据的ID
|
|
233
|
-
if (parseInt(i) > 0) {
|
|
234
|
-
delete tempDatas[props.primaryKey];
|
|
235
|
-
}
|
|
236
|
-
let temp = {...tempDatas, ...batchDatas[i]};
|
|
237
|
-
tempForm.push(temp);
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
let dydata: any = {
|
|
242
|
-
relationTables: props.globalCondition,
|
|
243
|
-
};
|
|
244
|
-
//props.globalCondition 有属性不是子表,需要额外封装
|
|
245
|
-
|
|
246
|
-
if (flag) {
|
|
247
|
-
tempForm = dataForm.value;
|
|
248
|
-
dydata["dataMap"] = tempForm;
|
|
249
|
-
} else {
|
|
250
|
-
dydata["dataListsMap"] = tempForm;
|
|
251
|
-
}
|
|
252
|
-
// console.log(sameBatchNames, tempForm, dydata);
|
|
253
|
-
load("数据处理中");
|
|
254
|
-
//dynamicForm 如果为true 表示动态表单,动态表单需额外封装数据对象
|
|
255
|
-
let formData = props.dynamicForm ? dydata : tempForm;
|
|
256
|
-
postRequest(mergeUrl!, formData)
|
|
257
|
-
.then((res) => {
|
|
258
|
-
closeLoad();
|
|
259
|
-
if (res.data.code != 0) {
|
|
260
|
-
warning(res.data.cnMessage);
|
|
261
|
-
return;
|
|
262
|
-
} else {
|
|
263
|
-
success(res.data.cnMessage);
|
|
264
|
-
}
|
|
265
|
-
emits("refresh", formData, res.data);
|
|
266
|
-
resetForm();
|
|
267
|
-
if (type == "close") {
|
|
268
|
-
closeDialog();
|
|
269
|
-
}
|
|
270
|
-
dialogProps.ids = -1;
|
|
271
|
-
//关闭弹窗
|
|
272
|
-
})
|
|
273
|
-
.catch((err) => {
|
|
274
|
-
error("接口调用异常" + err);
|
|
275
|
-
})
|
|
276
|
-
.finally(() => {
|
|
277
|
-
closeLoad();
|
|
278
|
-
});
|
|
279
|
-
};
|
|
280
|
-
const resetForm = () => {
|
|
281
|
-
dataForm.value = formFieldMapping(props.fieldList)?.defaultDatas;
|
|
282
|
-
let data = unref(props.outerFormData);
|
|
283
|
-
if (Object.keys(data||{}).length > 0) {
|
|
284
|
-
dataForm.value = {...dataForm.value, ...data};
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
/**
|
|
288
|
-
* 返回表单数据
|
|
289
|
-
*/
|
|
290
|
-
const getFormData = () => {
|
|
291
|
-
return dataForm;
|
|
292
|
-
};
|
|
293
|
-
/**
|
|
294
|
-
* 设置表单数据
|
|
295
|
-
* @param data
|
|
296
|
-
*/
|
|
297
|
-
const setFormData = (data: any) => {
|
|
298
|
-
let mappingData = formFieldMapping(props.fieldList);
|
|
299
|
-
let defaultDatas = mappingData.defaultDatas;
|
|
300
|
-
dataForm.value = {...defaultDatas, ...data};
|
|
301
|
-
};
|
|
302
|
-
/**
|
|
303
|
-
* 更新数据
|
|
304
|
-
* @param data
|
|
305
|
-
*/
|
|
306
|
-
const updateFormData = (data: any) => {
|
|
307
|
-
dataForm.value = {...dataForm.value, ...data};
|
|
308
|
-
};
|
|
309
|
-
/**
|
|
310
|
-
* 列表添加行数据
|
|
311
|
-
* @param row
|
|
312
|
-
*/
|
|
313
|
-
const addRow = (row: any) => {
|
|
314
|
-
emits("addRow", row);
|
|
315
|
-
};
|
|
316
|
-
/**
|
|
317
|
-
* 列表删除行数据
|
|
318
|
-
* @param row
|
|
319
|
-
*/
|
|
320
|
-
const removeRow = (row: any) => {
|
|
321
|
-
emits("removeRow", row);
|
|
322
|
-
};
|
|
323
|
-
/**
|
|
324
|
-
* 记录当前表单的信息
|
|
325
|
-
*/
|
|
326
|
-
const recordFieldInfo = async () => {
|
|
327
|
-
await nextTick();
|
|
328
|
-
userOperation.init(props.fieldList, dataForm, starHorseFormRef);
|
|
329
|
-
await nextTick();
|
|
330
|
-
emits("inited");
|
|
331
|
-
};
|
|
332
|
-
const tableListRef = ref<any>([]);
|
|
333
|
-
onActivated(() => {
|
|
334
|
-
recordFieldInfo();
|
|
335
|
-
});
|
|
336
|
-
onDeactivated(() => {
|
|
337
|
-
// userOperation.clearAll();
|
|
338
|
-
});
|
|
339
|
-
onBeforeUnmount(() => {
|
|
340
|
-
userOperation.clearAll();
|
|
341
|
-
});
|
|
342
|
-
onMounted(() => {
|
|
343
|
-
recordFieldInfo();
|
|
344
|
-
});
|
|
345
|
-
watch(
|
|
346
|
-
() => dataForm.value,
|
|
347
|
-
() => {
|
|
348
|
-
exportData();
|
|
349
|
-
},
|
|
350
|
-
{immediate: false, deep: true},
|
|
351
|
-
);
|
|
352
|
-
watch(
|
|
353
|
-
() => props.outerFormData,
|
|
354
|
-
(val: any) => {
|
|
355
|
-
if (val) {
|
|
356
|
-
resetForm();
|
|
357
|
-
}
|
|
358
|
-
},
|
|
359
|
-
{immediate: true, deep: true},
|
|
360
|
-
);
|
|
361
|
-
watch(
|
|
362
|
-
() => dialogOperation,
|
|
363
|
-
(val: any) => {
|
|
364
|
-
const handlers: any = {
|
|
365
|
-
merge: () => merge(val.type),
|
|
366
|
-
mergeDraft: () => mergeDraft(val.type),
|
|
367
|
-
resetForm: () => resetForm(),
|
|
368
|
-
};
|
|
369
|
-
handlers[val.funcName]?.();
|
|
370
|
-
dialogOperation.funcName = "";
|
|
371
|
-
dialogOperation["type"] = "";
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
immediate: false,
|
|
375
|
-
deep: true,
|
|
376
|
-
},
|
|
377
|
-
);
|
|
378
|
-
watch(
|
|
379
|
-
() => dialogProps.ids,
|
|
380
|
-
(val) => {
|
|
381
|
-
console.log("ids", val);
|
|
382
|
-
if (!val || val == -1) {
|
|
383
|
-
source.value = 1;
|
|
384
|
-
setFormData(dataForm.value);
|
|
385
|
-
} else {
|
|
386
|
-
source.value = 2;
|
|
387
|
-
loadData();
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
{
|
|
391
|
-
immediate: true,
|
|
392
|
-
deep: true,
|
|
393
|
-
},
|
|
394
|
-
);
|
|
395
|
-
|
|
396
|
-
defineExpose({
|
|
397
|
-
merge,
|
|
398
|
-
mergeDraft,
|
|
399
|
-
resetForm,
|
|
400
|
-
setFormData,
|
|
401
|
-
getFormData,
|
|
402
|
-
updateFormData,
|
|
403
|
-
starHorseFormRef,
|
|
404
|
-
tableListRef,
|
|
405
|
-
});
|
|
406
|
-
</script>
|
|
407
|
-
<template>
|
|
408
|
-
<el-scrollbar height="100%">
|
|
409
|
-
<el-form
|
|
410
|
-
:model="dataForm"
|
|
411
|
-
:size="formSize"
|
|
412
|
-
:rules="rules"
|
|
413
|
-
:scroll-to-error="true"
|
|
414
|
-
:scroll-into-view-options="true"
|
|
415
|
-
:inline-message="false"
|
|
416
|
-
:status-icon="true"
|
|
417
|
-
:label-position="labelPosition"
|
|
418
|
-
require-asterisk-position="right"
|
|
419
|
-
label-width="auto"
|
|
420
|
-
class="data-form"
|
|
421
|
-
ref="starHorseFormRef"
|
|
422
|
-
>
|
|
423
|
-
<star-horse-form-item
|
|
424
|
-
:primaryKey="primaryKey"
|
|
425
|
-
:compUrl="compUrl"
|
|
426
|
-
:fieldList="fieldList"
|
|
427
|
-
:rules="rules"
|
|
428
|
-
:compSize="formSize"
|
|
429
|
-
v-model:dataForm="dataForm"
|
|
430
|
-
:source="source"
|
|
431
|
-
@addRow="addRow"
|
|
432
|
-
@removeRow="removeRow"
|
|
433
|
-
:batchName="batchName"
|
|
434
|
-
:batchFieldName="batchFieldName"
|
|
435
|
-
/>
|
|
436
|
-
</el-form>
|
|
437
|
-
</el-scrollbar>
|
|
438
|
-
<el-form-item v-if="typeModel == 'form'" :size="formSize">
|
|
439
|
-
<el-button
|
|
440
|
-
@click="merge"
|
|
441
|
-
style="
|
|
442
|
-
background: var(--star-horse-style);
|
|
443
|
-
color: var(--star-horse-white);
|
|
444
|
-
"
|
|
445
|
-
>
|
|
446
|
-
<star-horse-icon
|
|
447
|
-
icon-class="save"
|
|
448
|
-
style="color: var(--star-horse-white)"
|
|
449
|
-
/>
|
|
450
|
-
提交
|
|
451
|
-
</el-button>
|
|
452
|
-
<el-button @click="resetForm" link>
|
|
453
|
-
<star-horse-icon icon-class="undo"/>
|
|
454
|
-
重置
|
|
455
|
-
</el-button>
|
|
456
|
-
</el-form-item>
|
|
457
|
-
</template>
|
|
458
|
-
<style lang="scss" scoped></style>
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts" name="StarHorseFormItem">
|
|
2
|
-
import { Config } from "@/api/settings";
|
|
3
|
-
import { compKey } from "@/api/system";
|
|
4
|
-
import { ApiUrls } from "@/components/types/ApiUrls";
|
|
5
|
-
import { PageFieldInfo } from "@/components/types/PageFieldInfo";
|
|
6
|
-
import { ModelRef, PropType } from "vue";
|
|
7
|
-
|
|
8
|
-
defineProps({
|
|
9
|
-
compUrl: { type: Object as PropType<ApiUrls> },
|
|
10
|
-
fieldList: { type: Object as PropType<PageFieldInfo | any>, required: true },
|
|
11
|
-
objectName: { type: String },
|
|
12
|
-
subFormFlag: { type: String, default: "N" },
|
|
13
|
-
// 数据索引
|
|
14
|
-
dataIndex: { type: Number, default: -1 },
|
|
15
|
-
// 父节点名称
|
|
16
|
-
propPrefix: { type: String, default: "" },
|
|
17
|
-
batchName: { type: String, default: "batchDataList" },
|
|
18
|
-
batchFieldName: { type: String, default: "batchFieldList" },
|
|
19
|
-
primaryKey: { type: [String, Object] as PropType<string | any> },
|
|
20
|
-
compSize: { type: String, default: Config.compSize },
|
|
21
|
-
rules: { type: Object },
|
|
22
|
-
source: { type: Number, default: 1 },
|
|
23
|
-
});
|
|
24
|
-
const dataForm: ModelRef<any> = defineModel("dataForm");
|
|
25
|
-
const checkItemType = (item: any) => {
|
|
26
|
-
if (Array.isArray(item)) {
|
|
27
|
-
return "box-item";
|
|
28
|
-
} else if (item.cardList?.length > 0) {
|
|
29
|
-
return "card-item";
|
|
30
|
-
} else if (item.collapseList?.length > 0) {
|
|
31
|
-
return "collapse-item";
|
|
32
|
-
} else if (item.dytableList?.length > 0) {
|
|
33
|
-
return "dytable-item";
|
|
34
|
-
} else if (item.tabList?.length > 0 || item.batchFieldList?.length > 0) {
|
|
35
|
-
return "tab-item";
|
|
36
|
-
} else {
|
|
37
|
-
return "other-item";
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
</script>
|
|
41
|
-
<template>
|
|
42
|
-
<template
|
|
43
|
-
v-for="(item, index) in fieldList.fieldList"
|
|
44
|
-
:key="compKey(item, index, false, 'form')"
|
|
45
|
-
>
|
|
46
|
-
<component
|
|
47
|
-
:Key="compKey(item, index, true)"
|
|
48
|
-
:is="checkItemType(item)"
|
|
49
|
-
:primary-key="primaryKey"
|
|
50
|
-
:item="item"
|
|
51
|
-
:rules="rules"
|
|
52
|
-
:batchFieldName="batchFieldName"
|
|
53
|
-
:batchName="batchName"
|
|
54
|
-
:compSize="compSize"
|
|
55
|
-
:compUrl="compUrl"
|
|
56
|
-
:subFormFlag="subFormFlag"
|
|
57
|
-
:source="source"
|
|
58
|
-
:objectName="objectName"
|
|
59
|
-
:dataIndex="dataIndex"
|
|
60
|
-
:propPrefix="propPrefix"
|
|
61
|
-
v-model:dataForm="dataForm"
|
|
62
|
-
:parentPreps="fieldList.preps"
|
|
63
|
-
/>
|
|
64
|
-
</template>
|
|
65
|
-
<table-item
|
|
66
|
-
:primary-key="primaryKey"
|
|
67
|
-
:item="fieldList"
|
|
68
|
-
:rules="rules"
|
|
69
|
-
:batchFieldName="batchFieldName"
|
|
70
|
-
:batchName="batchName"
|
|
71
|
-
:compSize="compSize"
|
|
72
|
-
:compUrl="compUrl"
|
|
73
|
-
:subFormFlag="subFormFlag"
|
|
74
|
-
:source="source"
|
|
75
|
-
:objectName="objectName"
|
|
76
|
-
:dataIndex="dataIndex"
|
|
77
|
-
:propPrefix="propPrefix"
|
|
78
|
-
v-model:dataForm="dataForm"
|
|
79
|
-
:parentPreps="fieldList.preps"
|
|
80
|
-
/>
|
|
81
|
-
</template>
|
|
82
|
-
<style lang="scss" scoped></style>
|