star-horse-lowcode 2.7.63 → 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 +1 -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 +19 -19
- package/dist/types/index.d.ts +7 -7
- package/eslint.config.js +37 -0
- package/index.html +14 -0
- package/package-lock.json +8276 -0
- package/package.json +4 -4
- 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,160 @@
|
|
|
1
|
+
<script setup lang="ts" name="ShDynamicForm">
|
|
2
|
+
import { inject, PropType, ref, ShallowReactive, watch } from "vue";
|
|
3
|
+
import { ApiUrls } from "@/components/types/ApiUrls";
|
|
4
|
+
import { error, success, warning } from "@/utils/message";
|
|
5
|
+
import { postRequest } from "@/api/star_horse_apis";
|
|
6
|
+
import { closeLoad, load, loadById } from "@/api/star_horse_utils";
|
|
7
|
+
import { DialogProps } from "@/components/types/DialogProps";
|
|
8
|
+
import { compKey, itemCheck } from "@/api/system";
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
compUrl: { type: Object as PropType<ApiUrls>, required: true },
|
|
12
|
+
fieldList: { type: Object as PropType<any>, required: true },
|
|
13
|
+
formInfo: { type: Object as PropType<any>, required: true },
|
|
14
|
+
rules: { type: Object },
|
|
15
|
+
typeModel: { type: String, default: "normal" },
|
|
16
|
+
});
|
|
17
|
+
const emits = defineEmits(["refresh"]);
|
|
18
|
+
const starHorseFormRef = ref();
|
|
19
|
+
const dataForm = ref<any>({});
|
|
20
|
+
const closeDialog = inject("closeDialog") as Function;
|
|
21
|
+
const dialogOperation = inject("dialogOperation") as ShallowReactive<any>;
|
|
22
|
+
const dialogProps = inject<DialogProps>("dialogProps", {});
|
|
23
|
+
|
|
24
|
+
const assignDefault = () => {
|
|
25
|
+
dataForm.value = {};
|
|
26
|
+
};
|
|
27
|
+
const loadData = async () => {
|
|
28
|
+
dataForm.value = await loadById(props.compUrl!.loadByIdUrl!, dialogProps.ids);
|
|
29
|
+
//解决关闭并再次打开不触发watch监听
|
|
30
|
+
dialogProps.ids = -2;
|
|
31
|
+
};
|
|
32
|
+
const merge = (_type: string) => {
|
|
33
|
+
starHorseFormRef.value.validate((result: boolean) => {
|
|
34
|
+
if (!result) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
doMerge();
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const mergeDraft = (type: string) => {
|
|
41
|
+
console.log("mergeDraft", type);
|
|
42
|
+
doMerge();
|
|
43
|
+
};
|
|
44
|
+
const doMerge = () => {
|
|
45
|
+
load("数据处理中");
|
|
46
|
+
postRequest(props.compUrl.mergeUrl!, dataForm.value)
|
|
47
|
+
.then((res) => {
|
|
48
|
+
closeLoad();
|
|
49
|
+
if (res.data.code != 0) {
|
|
50
|
+
warning(res.data.cnMessage);
|
|
51
|
+
return;
|
|
52
|
+
} else {
|
|
53
|
+
success(res.data.cnMessage);
|
|
54
|
+
}
|
|
55
|
+
emits("refresh");
|
|
56
|
+
resetForm();
|
|
57
|
+
closeDialog();
|
|
58
|
+
//关闭弹窗
|
|
59
|
+
})
|
|
60
|
+
.catch((err) => {
|
|
61
|
+
error("接口调用异常" + err);
|
|
62
|
+
})
|
|
63
|
+
.finally(() => {
|
|
64
|
+
closeLoad();
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
const resetForm = () => {
|
|
68
|
+
assignDefault();
|
|
69
|
+
};
|
|
70
|
+
watch(
|
|
71
|
+
() => dialogOperation,
|
|
72
|
+
(val: any) => {
|
|
73
|
+
if (val["funcName"] == "merge") {
|
|
74
|
+
merge(val["type"]);
|
|
75
|
+
} else if (val["funcName"] == "mergeDraft") {
|
|
76
|
+
mergeDraft(val["type"]);
|
|
77
|
+
} else if (val["funcName"] == "resetForm") {
|
|
78
|
+
resetForm();
|
|
79
|
+
}
|
|
80
|
+
//为了触发多次点击响应
|
|
81
|
+
dialogOperation["funcName"] = "";
|
|
82
|
+
dialogOperation["type"] = "";
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
immediate: false,
|
|
86
|
+
deep: true,
|
|
87
|
+
},
|
|
88
|
+
);
|
|
89
|
+
watch(
|
|
90
|
+
() => dialogProps.ids,
|
|
91
|
+
(val) => {
|
|
92
|
+
if (val == -2) {
|
|
93
|
+
} else if (!val || val == -1) {
|
|
94
|
+
assignDefault();
|
|
95
|
+
} else {
|
|
96
|
+
loadData();
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
immediate: true,
|
|
101
|
+
},
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
defineExpose({
|
|
105
|
+
merge,
|
|
106
|
+
mergeDraft,
|
|
107
|
+
resetForm,
|
|
108
|
+
assignDefault,
|
|
109
|
+
});
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<template>
|
|
113
|
+
<el-form
|
|
114
|
+
:model="dataForm"
|
|
115
|
+
:rules="rules"
|
|
116
|
+
class="data-form"
|
|
117
|
+
ref="starHorseFormRef"
|
|
118
|
+
:disabled="formInfo['disabled'] ?? false"
|
|
119
|
+
:hide-required-asterisk="formInfo['hideRequiredAsterisk'] ?? false"
|
|
120
|
+
:inline="formInfo.inline ?? false"
|
|
121
|
+
:inline-message="formInfo['inlineMessage'] ?? false"
|
|
122
|
+
:label-position="formInfo['labelPosition']"
|
|
123
|
+
:label-suffix="formInfo['labelSuffix']"
|
|
124
|
+
:label-width="formInfo['labelWidth']"
|
|
125
|
+
:require-asterisk-position="formInfo['requireAsteriskPosition']"
|
|
126
|
+
:scroll-to-error="formInfo['scrollToError'] ?? true"
|
|
127
|
+
:show-message="formInfo['showMessage'] ?? true"
|
|
128
|
+
:size="formInfo['size']"
|
|
129
|
+
:status-icon="formInfo['statusIcon'] ?? true"
|
|
130
|
+
:validate-on-rule-change="formInfo['validateOnRuleChange'] ?? true"
|
|
131
|
+
>
|
|
132
|
+
<component
|
|
133
|
+
v-for="(data, key) in fieldList"
|
|
134
|
+
:key="compKey(data, key, false, 'dyform')"
|
|
135
|
+
:field="data"
|
|
136
|
+
:formData="dataForm"
|
|
137
|
+
:is="itemCheck(data)"
|
|
138
|
+
/>
|
|
139
|
+
<el-form-item v-if="typeModel == 'tab'">
|
|
140
|
+
<el-button
|
|
141
|
+
@click="merge"
|
|
142
|
+
style="
|
|
143
|
+
background: var(--star-horse-style);
|
|
144
|
+
color: var(--star-horse-white);
|
|
145
|
+
"
|
|
146
|
+
>
|
|
147
|
+
<star-horse-icon
|
|
148
|
+
icon-class="save"
|
|
149
|
+
style="color: var(--star-horse-white)"
|
|
150
|
+
/>
|
|
151
|
+
提交
|
|
152
|
+
</el-button>
|
|
153
|
+
<el-button @click="resetForm" link>
|
|
154
|
+
<star-horse-icon icon-class="undo" />
|
|
155
|
+
重置
|
|
156
|
+
</el-button>
|
|
157
|
+
</el-form-item>
|
|
158
|
+
</el-form>
|
|
159
|
+
</template>
|
|
160
|
+
<style scoped></style>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
defineProps({
|
|
4
|
+
needScroller: {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
default: true,
|
|
7
|
+
},
|
|
8
|
+
});
|
|
9
|
+
const shFormRef = ref();
|
|
10
|
+
const dataForm = defineModel("dataForm");
|
|
11
|
+
</script>
|
|
12
|
+
<template>
|
|
13
|
+
<slot name="header"></slot>
|
|
14
|
+
<el-form :model="dataForm" v-bind="$attrs" class="data-form" ref="shFormRef">
|
|
15
|
+
<el-scrollbar height="100%" v-if="needScroller">
|
|
16
|
+
<template v-if="$slots.default">
|
|
17
|
+
<slot></slot>
|
|
18
|
+
</template>
|
|
19
|
+
<slot v-else name="empty"></slot>
|
|
20
|
+
</el-scrollbar>
|
|
21
|
+
<template v-else>
|
|
22
|
+
<template v-if="$slots.default">
|
|
23
|
+
<slot></slot>
|
|
24
|
+
</template>
|
|
25
|
+
<slot v-else name="empty"></slot>
|
|
26
|
+
</template>
|
|
27
|
+
</el-form>
|
|
28
|
+
<slot name="button"></slot>
|
|
29
|
+
</template>
|
|
30
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script setup lang="ts" name="ShTableListColumn">
|
|
2
|
+
import { createDatetime } from "@/api/date_utils";
|
|
3
|
+
import { parseListData, validMsg } from "@/api/form_utils";
|
|
4
|
+
import { Config } from "@/api/settings";
|
|
5
|
+
import { PropType } from "vue";
|
|
6
|
+
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
dataForm: { type: Object, required: true },
|
|
9
|
+
index: { type: Object, required: true },
|
|
10
|
+
item: { type: Object as PropType<any>, required: true },
|
|
11
|
+
staticColumn: { type: String, default: "Y" },
|
|
12
|
+
primaryKey: { type: [String, Object] as PropType<string | any> },
|
|
13
|
+
batchName: { type: String, default: "batchDataList" },
|
|
14
|
+
rules: { type: Object },
|
|
15
|
+
size: { type: String, default: Config.compSize },
|
|
16
|
+
source: { type: Number, default: 1 },
|
|
17
|
+
});
|
|
18
|
+
const dataFormat = (val: any) => {
|
|
19
|
+
const type: string = props.item.type;
|
|
20
|
+
if (val) {
|
|
21
|
+
if (type == "date" || type == "datetime") {
|
|
22
|
+
return createDatetime(val);
|
|
23
|
+
}
|
|
24
|
+
if (type == "switch") {
|
|
25
|
+
return val === true || val == "1" || val == "Y" ? "是" : "否";
|
|
26
|
+
}
|
|
27
|
+
if (
|
|
28
|
+
type == "select" ||
|
|
29
|
+
type == "radio" ||
|
|
30
|
+
type == "checkbox" ||
|
|
31
|
+
type == "cascader" ||
|
|
32
|
+
type == "tselect"
|
|
33
|
+
) {
|
|
34
|
+
return parseListData(props.item, val);
|
|
35
|
+
}
|
|
36
|
+
return val;
|
|
37
|
+
}
|
|
38
|
+
return "--";
|
|
39
|
+
};
|
|
40
|
+
</script>
|
|
41
|
+
<template>
|
|
42
|
+
<template v-if="staticColumn == 'Y'">
|
|
43
|
+
{{ dataFormat(dataForm[item.fieldName]) }}
|
|
44
|
+
</template>
|
|
45
|
+
<el-form-item
|
|
46
|
+
v-else
|
|
47
|
+
:size="size"
|
|
48
|
+
:rules="validMsg(item, dataForm)"
|
|
49
|
+
:prop="`${batchName}.${index}.${item.fieldName}`"
|
|
50
|
+
>
|
|
51
|
+
<star-horse-item
|
|
52
|
+
:primaryKey="primaryKey"
|
|
53
|
+
:compSize="size"
|
|
54
|
+
:batchName="batchName"
|
|
55
|
+
:item="item"
|
|
56
|
+
:data-form="dataForm"
|
|
57
|
+
:source="source"
|
|
58
|
+
/>
|
|
59
|
+
</el-form-item>
|
|
60
|
+
</template>
|
|
61
|
+
<style scoped></style>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useVModel } from "@vueuse/core";
|
|
3
|
+
import DataTag from "@/components/comp/utils/DataTag.vue";
|
|
4
|
+
import DataPicker, {
|
|
5
|
+
type ModelValueType,
|
|
6
|
+
} from "@/components/comp/utils/DataPicker.vue";
|
|
7
|
+
import { useFormDisabled } from "element-plus";
|
|
8
|
+
import type { CSSProperties } from "vue";
|
|
9
|
+
import { computed, ref } from "vue";
|
|
10
|
+
import StarHorseIcon from "@/components/comp/StarHorseIcon.vue";
|
|
11
|
+
import { compKey } from "@/api/system";
|
|
12
|
+
|
|
13
|
+
export interface DataSelectorProps {
|
|
14
|
+
modelValue: ModelValueType;
|
|
15
|
+
selectedData?: any;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
dataUrl?: string;
|
|
18
|
+
datas?: Array<any>;
|
|
19
|
+
pageSize?: number;
|
|
20
|
+
title?: string;
|
|
21
|
+
compSize?: string;
|
|
22
|
+
displayName?: string;
|
|
23
|
+
displayValue?: string;
|
|
24
|
+
multiple?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
checkStrictly?: boolean;
|
|
27
|
+
style?: CSSProperties;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const props = withDefaults(defineProps<DataSelectorProps>(), {
|
|
31
|
+
multiple: false,
|
|
32
|
+
disabled: false,
|
|
33
|
+
compSize: "small",
|
|
34
|
+
pageSize: 0,
|
|
35
|
+
displayName: "name",
|
|
36
|
+
displayValue: "value",
|
|
37
|
+
checkStrictly: true,
|
|
38
|
+
placeholder: "请选择数据",
|
|
39
|
+
});
|
|
40
|
+
const emits = defineEmits<{
|
|
41
|
+
(e: "update:modelValue", modelValue: ModelValueType): void;
|
|
42
|
+
(e: "selectedData", selectData: any): void;
|
|
43
|
+
}>();
|
|
44
|
+
const value: any = useVModel(props, "modelValue", emits);
|
|
45
|
+
const emitData: any = useVModel(props, "selectedData", emits);
|
|
46
|
+
const selectData: any = ref<any>();
|
|
47
|
+
const valueArr = computed<string[]>(() => {
|
|
48
|
+
emitData.value = selectData.value;
|
|
49
|
+
if (!selectData.value) return [];
|
|
50
|
+
if (Array.isArray(selectData.value)) {
|
|
51
|
+
value.value = selectData.value.map((v: any) => v[props.displayValue]);
|
|
52
|
+
return selectData.value;
|
|
53
|
+
} else {
|
|
54
|
+
value.value = selectData.value[props.displayValue];
|
|
55
|
+
return [selectData.value];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const dataPickerRef = ref<InstanceType<typeof DataPicker>>();
|
|
59
|
+
const formDisabled = useFormDisabled();
|
|
60
|
+
const disabled = computed<boolean>(() => {
|
|
61
|
+
return formDisabled.value || props.disabled;
|
|
62
|
+
});
|
|
63
|
+
const openDataPicker = () => {
|
|
64
|
+
if (props.disabled) return;
|
|
65
|
+
dataPickerRef.value?.open();
|
|
66
|
+
};
|
|
67
|
+
const onClose = (data: any) => {
|
|
68
|
+
if (!selectData.value) return;
|
|
69
|
+
if (props.multiple && Array.isArray(selectData.value)) {
|
|
70
|
+
selectData.value.splice(selectData.value.indexOf(data), 1);
|
|
71
|
+
value.value.splice(selectData.value.indexOf(data[props.displayValue]), 1);
|
|
72
|
+
} else {
|
|
73
|
+
selectData.value = null;
|
|
74
|
+
value.value = null;
|
|
75
|
+
}
|
|
76
|
+
emits("selectedData", selectData.value);
|
|
77
|
+
};
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<template>
|
|
81
|
+
<data-picker
|
|
82
|
+
ref="dataPickerRef"
|
|
83
|
+
:title="title"
|
|
84
|
+
:datas="datas"
|
|
85
|
+
:data-url="dataUrl"
|
|
86
|
+
:page-size="pageSize"
|
|
87
|
+
:display-name="displayName"
|
|
88
|
+
:display-value="displayValue"
|
|
89
|
+
:checkStrictly="checkStrictly"
|
|
90
|
+
:multiple="multiple"
|
|
91
|
+
v-model="selectData"
|
|
92
|
+
/>
|
|
93
|
+
<div class="data-wrapper">
|
|
94
|
+
<star-horse-icon
|
|
95
|
+
@click="openDataPicker"
|
|
96
|
+
cursor="pointer"
|
|
97
|
+
icon-class="select-data"
|
|
98
|
+
:border="true"
|
|
99
|
+
/>
|
|
100
|
+
<DataTag
|
|
101
|
+
v-for="(item, key) in valueArr"
|
|
102
|
+
:key="compKey(item, key)"
|
|
103
|
+
:closable="!disabled"
|
|
104
|
+
:data="item"
|
|
105
|
+
:display-name="displayName"
|
|
106
|
+
:display-value="displayValue"
|
|
107
|
+
@close="onClose"
|
|
108
|
+
/>
|
|
109
|
+
<el-text v-show="!value || value.length === 0" class="placeholder">
|
|
110
|
+
{{ placeholder }}
|
|
111
|
+
</el-text>
|
|
112
|
+
</div>
|
|
113
|
+
</template>
|
|
114
|
+
|
|
115
|
+
<style scoped lang="scss">
|
|
116
|
+
.el-tag {
|
|
117
|
+
padding: 0 3px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.data-wrapper {
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-wrap: wrap;
|
|
123
|
+
align-items: center;
|
|
124
|
+
grid-gap: 7px;
|
|
125
|
+
gap: 7px;
|
|
126
|
+
|
|
127
|
+
.placeholder {
|
|
128
|
+
color: var(--el-text-color-placeholder);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.data-but-item {
|
|
132
|
+
border-style: dashed;
|
|
133
|
+
|
|
134
|
+
&:hover {
|
|
135
|
+
border-style: solid;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
</style>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<script setup lang="ts" name="StarHorseDataView">
|
|
2
|
+
import { ApiUrls } from "@/components/types/ApiUrls";
|
|
3
|
+
import { inject, nextTick, onMounted, PropType, ref, watch } from "vue";
|
|
4
|
+
import { DialogProps } from "@/components/types/DialogProps";
|
|
5
|
+
import { formFieldMapping, isJson, loadById } from "@/api/star_horse_utils";
|
|
6
|
+
|
|
7
|
+
const dataForm = ref<any>({});
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
compUrl: { type: Object as PropType<ApiUrls> },
|
|
10
|
+
objectName: { type: String },
|
|
11
|
+
subFormFlag: { type: String, default: "N" },
|
|
12
|
+
fieldList: { type: Object, required: true },
|
|
13
|
+
globalCondition: { type: Object },
|
|
14
|
+
outerData: { type: Object },
|
|
15
|
+
dynamicForm: { type: Boolean, default: false },
|
|
16
|
+
primaryKey: {
|
|
17
|
+
type: [String, Object] as PropType<string | any>,
|
|
18
|
+
default: "id",
|
|
19
|
+
},
|
|
20
|
+
batchFieldName: { type: String, default: "batchFieldList" },
|
|
21
|
+
dataFormat: { type: Function, default: null },
|
|
22
|
+
});
|
|
23
|
+
const emits = defineEmits(["dataLoaded"]);
|
|
24
|
+
const dialogProps = inject<DialogProps>("dialogProps");
|
|
25
|
+
watch(
|
|
26
|
+
() => dialogProps?.ids,
|
|
27
|
+
(val) => {
|
|
28
|
+
if (val == -2) {
|
|
29
|
+
} else if (!val || val == -1) {
|
|
30
|
+
dataForm.value = {};
|
|
31
|
+
} else {
|
|
32
|
+
loadData();
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
// immediate: true,
|
|
37
|
+
deep: true,
|
|
38
|
+
},
|
|
39
|
+
);
|
|
40
|
+
onMounted(() => {
|
|
41
|
+
if (dialogProps?.ids) {
|
|
42
|
+
loadData();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const loadData = async () => {
|
|
46
|
+
await nextTick();
|
|
47
|
+
let id = Array.isArray(dialogProps?.ids)
|
|
48
|
+
? dialogProps.ids[0]
|
|
49
|
+
: dialogProps?.ids;
|
|
50
|
+
if (!props.compUrl) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
let objData;
|
|
54
|
+
let params = props.globalCondition || {};
|
|
55
|
+
//如果是Json 对象
|
|
56
|
+
if (isJson(id)) {
|
|
57
|
+
params = { ...params, ...id };
|
|
58
|
+
objData = await loadById(props.compUrl?.loadByIdForViewUrl!, "", params);
|
|
59
|
+
} else {
|
|
60
|
+
objData = await loadById(props.compUrl?.loadByIdForViewUrl!, id, params);
|
|
61
|
+
}
|
|
62
|
+
let data = formFieldMapping(props.fieldList);
|
|
63
|
+
dataForm.value = objData;
|
|
64
|
+
//如果是动态表单
|
|
65
|
+
if (props.dynamicForm) {
|
|
66
|
+
for (let i in params) {
|
|
67
|
+
let temp = params[i];
|
|
68
|
+
if (!temp.subTabFlag) {
|
|
69
|
+
dataForm.value[temp.tableName] = [objData];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
let mapping = data.mappingFields;
|
|
74
|
+
if (mapping) {
|
|
75
|
+
for (let index in mapping) {
|
|
76
|
+
let temp = mapping[index];
|
|
77
|
+
dataForm.value[temp.name] = dataForm.value[temp.alias];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
await nextTick(() => {
|
|
81
|
+
emits("dataLoaded", objData, true);
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
const setData = (data: any) => {
|
|
85
|
+
dataForm.value = data;
|
|
86
|
+
};
|
|
87
|
+
//更新外面传进来的数据
|
|
88
|
+
watch(
|
|
89
|
+
() => props.outerData,
|
|
90
|
+
(val: any) => {
|
|
91
|
+
if (val) {
|
|
92
|
+
dataForm.value = { ...dataForm.value, ...val };
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{ immediate: true, deep: true },
|
|
96
|
+
);
|
|
97
|
+
defineExpose({
|
|
98
|
+
setData,
|
|
99
|
+
});
|
|
100
|
+
</script>
|
|
101
|
+
<template>
|
|
102
|
+
<div class="flex h-full w-full flex-col">
|
|
103
|
+
<star-horse-data-view-items
|
|
104
|
+
:commonFormat="dataFormat"
|
|
105
|
+
:field-list="fieldList"
|
|
106
|
+
v-model:data-form="dataForm"
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
</template>
|
|
110
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script setup lang="ts" name="StarHorseDataViewObject">
|
|
2
|
+
import { ModelRef, PropType } from "vue";
|
|
3
|
+
import { PageFieldInfo } from "@/components/types/PageFieldInfo";
|
|
4
|
+
import { commonParseCodeToName } from "@/api/star_horse_utils";
|
|
5
|
+
import { compKey } from "@/api/system";
|
|
6
|
+
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
// compUrl: {type: Object as PropType<ApiUrls>},
|
|
9
|
+
fieldList: { type: Object as PropType<PageFieldInfo>, required: true },
|
|
10
|
+
objectName: { type: String },
|
|
11
|
+
subFormFlag: { type: String, default: "N" },
|
|
12
|
+
batchName: { type: String, default: "batchDataList" },
|
|
13
|
+
batchFieldName: { type: String, default: "batchFieldList" },
|
|
14
|
+
primaryKey: { type: [String, Object] as PropType<string | any> },
|
|
15
|
+
commonFormat: { type: Function, required: true },
|
|
16
|
+
});
|
|
17
|
+
const dataForm: ModelRef<any> = defineModel("dataForm");
|
|
18
|
+
const _compKey = compKey;
|
|
19
|
+
const itemCommonFormat = (name: string, cellValue: any, row: any) => {
|
|
20
|
+
cellValue = commonParseCodeToName(name, cellValue);
|
|
21
|
+
if (name == "isDel") {
|
|
22
|
+
return cellValue == 1 ? "是" : "否";
|
|
23
|
+
}
|
|
24
|
+
return null == props.commonFormat
|
|
25
|
+
? cellValue
|
|
26
|
+
: props.commonFormat(name, cellValue, row);
|
|
27
|
+
};
|
|
28
|
+
const checkItemType = (item: any) => {
|
|
29
|
+
if (Array.isArray(item)) {
|
|
30
|
+
return "view-box-item";
|
|
31
|
+
} else if (item.cardList?.length > 0) {
|
|
32
|
+
return "view-card-item";
|
|
33
|
+
} else if (item.collapseList?.length > 0) {
|
|
34
|
+
return "view-collapse-item";
|
|
35
|
+
} else if (item.tabList?.length > 0 || item.batchFieldList?.length > 0) {
|
|
36
|
+
return "view-tab-item";
|
|
37
|
+
} else if (item.dytableList?.length > 0) {
|
|
38
|
+
return "view-dytable-item";
|
|
39
|
+
} else {
|
|
40
|
+
return "view-other-item";
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
</script>
|
|
44
|
+
<template>
|
|
45
|
+
<component
|
|
46
|
+
v-for="item in fieldList.fieldList"
|
|
47
|
+
:key="_compKey(item, checkItemType(item))"
|
|
48
|
+
:is="checkItemType(item)"
|
|
49
|
+
:item="item"
|
|
50
|
+
v-model:dataForm="dataForm"
|
|
51
|
+
:commonFormat="itemCommonFormat"
|
|
52
|
+
/>
|
|
53
|
+
<view-table-item
|
|
54
|
+
:item="fieldList"
|
|
55
|
+
:batch-field-name="batchFieldName"
|
|
56
|
+
v-model:dataForm="dataForm"
|
|
57
|
+
:commonFormat="itemCommonFormat"
|
|
58
|
+
/>
|
|
59
|
+
<div class="h-[30px]"></div>
|
|
60
|
+
</template>
|
|
61
|
+
<style lang="scss" scoped></style>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script setup lang="ts" name="StarHorseDataViewObject">
|
|
2
|
+
import { ModelRef, PropType } from "vue";
|
|
3
|
+
import { FieldInfo } from "@/components/types/PageFieldInfo";
|
|
4
|
+
import { rowClassName } from "@/api/star_horse_utils";
|
|
5
|
+
import { Config } from "@/api/settings";
|
|
6
|
+
import { compKey } from "@/api/system";
|
|
7
|
+
|
|
8
|
+
defineProps({
|
|
9
|
+
item: { type: Array as PropType<Array<FieldInfo> | any>, required: true },
|
|
10
|
+
batchName: { type: String, required: true },
|
|
11
|
+
compSize: { type: String, default: Config.compSize },
|
|
12
|
+
commonFormat: { type: Function, required: true },
|
|
13
|
+
});
|
|
14
|
+
const dataForm: ModelRef<any> = defineModel("dataForm");
|
|
15
|
+
</script>
|
|
16
|
+
<template>
|
|
17
|
+
<div
|
|
18
|
+
class="flex justify-between w-full"
|
|
19
|
+
style="border-bottom: var(--star-horse-style) 1px solid"
|
|
20
|
+
>
|
|
21
|
+
<div class="tb_title flex flex-row items-center">
|
|
22
|
+
<star-horse-icon icon-class="info" size="14px" />
|
|
23
|
+
{{ item.title }}
|
|
24
|
+
</div>
|
|
25
|
+
<div class="flex items-center flex-row-reverse"></div>
|
|
26
|
+
</div>
|
|
27
|
+
<el-table
|
|
28
|
+
:data="dataForm ? dataForm[batchName] : []"
|
|
29
|
+
fit
|
|
30
|
+
border
|
|
31
|
+
:stripe="true"
|
|
32
|
+
:row-class-name="rowClassName"
|
|
33
|
+
:highlight-current-row="true"
|
|
34
|
+
:size="compSize"
|
|
35
|
+
:row-style="{
|
|
36
|
+
height: '30px',
|
|
37
|
+
}"
|
|
38
|
+
:cell-style="{
|
|
39
|
+
height: '30px',
|
|
40
|
+
'font-size': '12px',
|
|
41
|
+
}"
|
|
42
|
+
:header-cell-style="{
|
|
43
|
+
background: '#f2f2f2',
|
|
44
|
+
color: '#707070',
|
|
45
|
+
'font-size': '13px',
|
|
46
|
+
'background-image':
|
|
47
|
+
'-webkit-gradient(linear,left 0,left 100%,from(#f8f8f8),to(#ececec))',
|
|
48
|
+
}"
|
|
49
|
+
>
|
|
50
|
+
<el-table-column label="序号" fixed align="center" prop="xh" width="60" />
|
|
51
|
+
<template
|
|
52
|
+
v-for="(aitem, index) in item?.fieldList"
|
|
53
|
+
:key="compKey(aitem, index)"
|
|
54
|
+
>
|
|
55
|
+
<template v-if="Array.isArray(aitem)">
|
|
56
|
+
<star-horse-table-view-column
|
|
57
|
+
:commonFormat="commonFormat"
|
|
58
|
+
:item="sitem"
|
|
59
|
+
v-for="(sitem, key) in aitem"
|
|
60
|
+
:key="compKey(sitem, key)"
|
|
61
|
+
/>
|
|
62
|
+
</template>
|
|
63
|
+
<template v-else-if="aitem.tabList?.length > 0">
|
|
64
|
+
<template
|
|
65
|
+
v-for="(tabItems, key) in aitem.tabList"
|
|
66
|
+
:key="compKey(tabItems, key)"
|
|
67
|
+
>
|
|
68
|
+
<star-horse-table-view-column
|
|
69
|
+
:commonFormat="commonFormat"
|
|
70
|
+
:item="sitem"
|
|
71
|
+
:key="compKey(sitem, skey)"
|
|
72
|
+
v-for="(sitem, skey) in tabItems.fieldList"
|
|
73
|
+
/>
|
|
74
|
+
</template>
|
|
75
|
+
</template>
|
|
76
|
+
<template v-else-if="aitem.batchFieldList?.length > 0">
|
|
77
|
+
<template
|
|
78
|
+
v-for="(batchItems, bkey) in aitem.batchFieldList"
|
|
79
|
+
:key="compKey(batchItems, bkey)"
|
|
80
|
+
>
|
|
81
|
+
<star-horse-table-view-column
|
|
82
|
+
:commonFormat="commonFormat"
|
|
83
|
+
:item="sitem"
|
|
84
|
+
:key="compKey(sitem, skey)"
|
|
85
|
+
v-for="(sitem, skey) in batchItems.fieldList"
|
|
86
|
+
/>
|
|
87
|
+
</template>
|
|
88
|
+
</template>
|
|
89
|
+
<star-horse-table-view-column
|
|
90
|
+
:commonFormat="commonFormat"
|
|
91
|
+
:item="aitem"
|
|
92
|
+
/>
|
|
93
|
+
</template>
|
|
94
|
+
</el-table>
|
|
95
|
+
</template>
|
|
96
|
+
<style lang="scss" scoped>
|
|
97
|
+
.el-table {
|
|
98
|
+
:deep(.cell) {
|
|
99
|
+
color: #000000;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
</style>
|