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,153 @@
|
|
|
1
|
+
<script setup lang="ts" name="tab-container">
|
|
2
|
+
import { computed, onMounted, PropType, ref, watch } from "vue";
|
|
3
|
+
import { useDesignFormStore } from "@/store/DesignForm";
|
|
4
|
+
import piniaInstance from "@/store/index";
|
|
5
|
+
import { compKey, itemCheck, uuid } from "@/api/system";
|
|
6
|
+
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
parentField: { type: String },
|
|
9
|
+
isDesign: { type: Boolean, default: false },
|
|
10
|
+
showFormItem: { type: Boolean, default: false },
|
|
11
|
+
disabled: { type: Object as PropType<Boolean | String> },
|
|
12
|
+
formInfo: { type: Object as PropType<any> },
|
|
13
|
+
field: { type: Object as PropType<any> },
|
|
14
|
+
});
|
|
15
|
+
let designForm = useDesignFormStore(piniaInstance);
|
|
16
|
+
const isDragging = computed(() => designForm.isDragging);
|
|
17
|
+
const formData = defineModel("formData");
|
|
18
|
+
let containerType: Array<string> = [
|
|
19
|
+
"tab",
|
|
20
|
+
"box",
|
|
21
|
+
"table",
|
|
22
|
+
"card",
|
|
23
|
+
"dytable",
|
|
24
|
+
"collapse",
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const isContainer = (data: any) => {
|
|
28
|
+
return containerType.includes(data.itemType);
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* 如果没有items,动态添加
|
|
32
|
+
* @param adata
|
|
33
|
+
*/
|
|
34
|
+
const checkItem = (adata: any) => {
|
|
35
|
+
if (!adata["items"]) {
|
|
36
|
+
adata["items"] = [];
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const onDragAdd = (evt: Event | any, dataList: any) => {
|
|
40
|
+
let newIndex = evt.newIndex;
|
|
41
|
+
if (newIndex != null && newIndex != "undefined") {
|
|
42
|
+
let dataInfo = dataList[newIndex];
|
|
43
|
+
// designForm.setDraggingItem({});
|
|
44
|
+
designForm.selectItem(dataInfo, dataInfo.itemType, "");
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const activeTabName = ref();
|
|
48
|
+
onMounted(() => {
|
|
49
|
+
if (!props.field["preps"]["elements"]) {
|
|
50
|
+
props.field["preps"]["elements"] = [
|
|
51
|
+
{
|
|
52
|
+
label: "Tab1",
|
|
53
|
+
tabName: "tab1",
|
|
54
|
+
objectName: "tab1",
|
|
55
|
+
subFormFlag: "Y",
|
|
56
|
+
items: [],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: "Tab2",
|
|
60
|
+
tabName: "tab2",
|
|
61
|
+
objectName: "tab2",
|
|
62
|
+
subFormFlag: "Y",
|
|
63
|
+
items: [],
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
props.field["stretch"] = "N";
|
|
67
|
+
}
|
|
68
|
+
activeTabName.value = props.field.preps.elements[0].tabName;
|
|
69
|
+
});
|
|
70
|
+
watch(
|
|
71
|
+
() => activeTabName.value,
|
|
72
|
+
(val) => {
|
|
73
|
+
props.field["activeItemName"] = val;
|
|
74
|
+
},
|
|
75
|
+
{ immediate: true, deep: true },
|
|
76
|
+
);
|
|
77
|
+
const dynamicFunc = (funcType: string, funcCode: any) => {
|
|
78
|
+
let func = new Function(funcCode);
|
|
79
|
+
func.call(this);
|
|
80
|
+
};
|
|
81
|
+
const addTab = () => {};
|
|
82
|
+
</script>
|
|
83
|
+
<template>
|
|
84
|
+
<group-box-container
|
|
85
|
+
class="star-horse-form-container"
|
|
86
|
+
:showFormItem="showFormItem"
|
|
87
|
+
:isDesign="isDesign"
|
|
88
|
+
:disabled="disabled"
|
|
89
|
+
:parentField="parentField"
|
|
90
|
+
:form-item="field"
|
|
91
|
+
>
|
|
92
|
+
<el-tabs
|
|
93
|
+
class="tab-container"
|
|
94
|
+
:tab-position="field.preps['tablePosition'] || 'top'"
|
|
95
|
+
:type="field.preps['type'] || ''"
|
|
96
|
+
:closable="field.preps['closable']"
|
|
97
|
+
:addable="field.preps['addable']"
|
|
98
|
+
:editable="field.preps['editable']"
|
|
99
|
+
:stretch="field.preps['stretch']"
|
|
100
|
+
v-model="activeTabName"
|
|
101
|
+
@tab-add="addTab()"
|
|
102
|
+
@tab-click="dynamicFunc('tabClick', field['tabClick'])"
|
|
103
|
+
@tab-change="dynamicFunc('tabChange', field['tabChange'])"
|
|
104
|
+
@tab-remove="dynamicFunc('tabRemove', field['tabRemove'])"
|
|
105
|
+
>
|
|
106
|
+
<el-tab-pane
|
|
107
|
+
v-for="(adata, key) in field['preps']['elements']"
|
|
108
|
+
:key="compKey(adata, key)"
|
|
109
|
+
:label="adata['label']"
|
|
110
|
+
:name="adata['tabName']"
|
|
111
|
+
>
|
|
112
|
+
<el-scrollbar height="100%" :class="{ 'dragging-area': isDragging }">
|
|
113
|
+
<draggable
|
|
114
|
+
@add="(evt: Event) => onDragAdd(evt, adata['items'])"
|
|
115
|
+
@dragover="checkItem(adata)"
|
|
116
|
+
class="tab-design"
|
|
117
|
+
group="starHorseGroup"
|
|
118
|
+
animation="100"
|
|
119
|
+
:item-key="uuid()"
|
|
120
|
+
ghostClass="ghost"
|
|
121
|
+
:list="adata['items']"
|
|
122
|
+
>
|
|
123
|
+
<template #item="{ element: data }">
|
|
124
|
+
<div
|
|
125
|
+
class="comp-item"
|
|
126
|
+
:style="{ marginTop: isContainer(data) ? '25px' : '10px' }"
|
|
127
|
+
>
|
|
128
|
+
<component
|
|
129
|
+
:key="data.id"
|
|
130
|
+
:field="data"
|
|
131
|
+
:isDesign="isDesign"
|
|
132
|
+
:disabled="disabled"
|
|
133
|
+
:showFormItem="showFormItem"
|
|
134
|
+
:formInfo="formInfo"
|
|
135
|
+
:is="itemCheck(data)"
|
|
136
|
+
:parentField="field"
|
|
137
|
+
v-model:formData="formData"
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
</template>
|
|
141
|
+
</draggable>
|
|
142
|
+
</el-scrollbar>
|
|
143
|
+
</el-tab-pane>
|
|
144
|
+
</el-tabs>
|
|
145
|
+
</group-box-container>
|
|
146
|
+
</template>
|
|
147
|
+
<style lang="scss" scoped>
|
|
148
|
+
.tab-design {
|
|
149
|
+
height: 100%;
|
|
150
|
+
min-height: 200px;
|
|
151
|
+
overflow-y: auto;
|
|
152
|
+
}
|
|
153
|
+
</style>
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
<script setup lang="ts" name="table-container">
|
|
2
|
+
// 右键菜单组件
|
|
3
|
+
import { computed, PropType, ref } from "vue";
|
|
4
|
+
import { operationConfirm, warning } from "@/utils/message";
|
|
5
|
+
import { useDesignFormStore } from "@/store/DesignForm";
|
|
6
|
+
import piniaInstance from "@/store/index";
|
|
7
|
+
import StarHorseIcon from "@/components/comp/StarHorseIcon.vue";
|
|
8
|
+
import { itemCheck, uuid } from "@/api/system";
|
|
9
|
+
|
|
10
|
+
let containerTableRef = ref(); // 强制刷新表格
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
parentField: { type: String },
|
|
13
|
+
isDesign: { type: Boolean, default: false },
|
|
14
|
+
showFormItem: { type: Boolean, default: false },
|
|
15
|
+
disabled: { type: Object as PropType<Boolean | String> },
|
|
16
|
+
formInfo: { type: Object as PropType<any> },
|
|
17
|
+
field: { type: Object as PropType<any> },
|
|
18
|
+
});
|
|
19
|
+
let designForm = useDesignFormStore(piniaInstance);
|
|
20
|
+
let draggingItem = computed(() => designForm.draggingItem);
|
|
21
|
+
let excludeContainerType: Array<string> = [
|
|
22
|
+
"box",
|
|
23
|
+
"tab",
|
|
24
|
+
"table",
|
|
25
|
+
"dytable",
|
|
26
|
+
"collapse",
|
|
27
|
+
"card",
|
|
28
|
+
];
|
|
29
|
+
let isEdit = computed(() => props.isDesign);
|
|
30
|
+
const isDragging = computed(() => designForm.isDragging);
|
|
31
|
+
const formData = defineModel("formData");
|
|
32
|
+
const onDragAdd = (evt: Event | any, dataList: any) => {
|
|
33
|
+
let newIndex = evt.newIndex;
|
|
34
|
+
if (excludeContainerType.includes(draggingItem.value.itemType)) {
|
|
35
|
+
warning("容器不能嵌套容器");
|
|
36
|
+
let elements = props.field.preps.elements;
|
|
37
|
+
for (let inde in elements) {
|
|
38
|
+
let element = elements[inde];
|
|
39
|
+
for (let sind in element?.columns) {
|
|
40
|
+
let column = element.columns[sind];
|
|
41
|
+
for (let i in column?.items) {
|
|
42
|
+
let item = column.items[i];
|
|
43
|
+
if (draggingItem.value.id == item.id) {
|
|
44
|
+
column.items.splice(i, 1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
if (newIndex != null && newIndex != "undefined") {
|
|
52
|
+
let dataInfo = dataList[newIndex];
|
|
53
|
+
designForm.selectItem(dataInfo, dataInfo.itemType, "");
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const analysisData = (index: number) => {
|
|
57
|
+
let field = props.field?.preps;
|
|
58
|
+
let elements = field?.elements;
|
|
59
|
+
let f = elements.find((item: any) => item.colIndex == index);
|
|
60
|
+
if (index > 1) {
|
|
61
|
+
if (!f) {
|
|
62
|
+
elements.push({
|
|
63
|
+
colIndex: index,
|
|
64
|
+
items: [],
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return f?.items[0]?.preps?.label || `Title${index}`;
|
|
69
|
+
};
|
|
70
|
+
let currentIndex = ref<number>(-1);
|
|
71
|
+
const tdOver = (evt: MouseEvent, index: number) => {
|
|
72
|
+
evt.preventDefault();
|
|
73
|
+
evt.stopPropagation();
|
|
74
|
+
if (currentIndex.value == index) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
currentIndex.value = index;
|
|
78
|
+
};
|
|
79
|
+
const tdOut = (evt: MouseEvent, _index: number) => {
|
|
80
|
+
evt.preventDefault();
|
|
81
|
+
evt.stopPropagation();
|
|
82
|
+
currentIndex.value = 0;
|
|
83
|
+
};
|
|
84
|
+
const deleteCol = (index: number) => {
|
|
85
|
+
operationConfirm("列删除后,对应的组件也会删除,确认删除吗?").then(
|
|
86
|
+
(res: boolean) => {
|
|
87
|
+
if (res) {
|
|
88
|
+
let elements = props.field.preps.elements;
|
|
89
|
+
elements.splice(index - 1, 1);
|
|
90
|
+
for (let index in elements) {
|
|
91
|
+
elements[index].colIndex = parseInt(index) + 1;
|
|
92
|
+
}
|
|
93
|
+
props.field.preps.columns = props.field.preps.columns - 1;
|
|
94
|
+
currentIndex.value = 0;
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
</script>
|
|
100
|
+
<template>
|
|
101
|
+
<group-box-container
|
|
102
|
+
class="star-horse-form-container"
|
|
103
|
+
:showFormItem="showFormItem"
|
|
104
|
+
:isDesign="isDesign"
|
|
105
|
+
:disabled="disabled"
|
|
106
|
+
:parentField="parentField"
|
|
107
|
+
:form-item="field"
|
|
108
|
+
>
|
|
109
|
+
<table
|
|
110
|
+
ref="containerTableRef"
|
|
111
|
+
class="dynamic-table"
|
|
112
|
+
:style="{
|
|
113
|
+
border: isEdit && isDesign ? '1px solid #dfe6ec' : 'none',
|
|
114
|
+
}"
|
|
115
|
+
>
|
|
116
|
+
<thead class="container-thead">
|
|
117
|
+
<tr>
|
|
118
|
+
<th
|
|
119
|
+
v-for="td of parseInt(field.preps.columns || 1)"
|
|
120
|
+
@mouseenter="(evt) => tdOver(evt, td)"
|
|
121
|
+
@mouseleave="(evt) => tdOut(evt, td)"
|
|
122
|
+
>
|
|
123
|
+
<div class="td-operator" v-if="currentIndex == td && isDesign">
|
|
124
|
+
<el-tooltip content="删除列">
|
|
125
|
+
<star-horse-icon
|
|
126
|
+
icon-class="delete"
|
|
127
|
+
cursor="pointer"
|
|
128
|
+
@click="deleteCol(td)"
|
|
129
|
+
/>
|
|
130
|
+
</el-tooltip>
|
|
131
|
+
</div>
|
|
132
|
+
{{ analysisData(td) }}
|
|
133
|
+
</th>
|
|
134
|
+
</tr>
|
|
135
|
+
</thead>
|
|
136
|
+
<tbody>
|
|
137
|
+
<tr>
|
|
138
|
+
<template v-for="td of parseInt(field.preps.columns || 1)">
|
|
139
|
+
<td
|
|
140
|
+
:style="{
|
|
141
|
+
width: 100 / parseInt(field.preps.columns || 1) + '%',
|
|
142
|
+
'margin-top': '5px',
|
|
143
|
+
}"
|
|
144
|
+
class="td-clz"
|
|
145
|
+
:class="{ 'dragging-area': isDragging }"
|
|
146
|
+
@mouseenter="(evt) => tdOver(evt, td)"
|
|
147
|
+
@mouseleave="(evt) => tdOut(evt, td)"
|
|
148
|
+
>
|
|
149
|
+
<draggable
|
|
150
|
+
@add="
|
|
151
|
+
(evt: Event) =>
|
|
152
|
+
onDragAdd(evt, field.preps.elements[td - 1].items)
|
|
153
|
+
"
|
|
154
|
+
class="smain-design"
|
|
155
|
+
tag="div"
|
|
156
|
+
group="starHorseGroup"
|
|
157
|
+
ghostClass="ghost"
|
|
158
|
+
animation="200"
|
|
159
|
+
:item-key="uuid()"
|
|
160
|
+
:list="field.preps.elements[td - 1].items"
|
|
161
|
+
>
|
|
162
|
+
<template #item="{ element: data }">
|
|
163
|
+
<div class="comp-item">
|
|
164
|
+
<component
|
|
165
|
+
:key="data?.id"
|
|
166
|
+
:field="data"
|
|
167
|
+
:showFormItem="showFormItem"
|
|
168
|
+
:isDesign="isDesign"
|
|
169
|
+
:disabled="disabled"
|
|
170
|
+
:formInfo="formInfo"
|
|
171
|
+
:is="itemCheck(data)"
|
|
172
|
+
:parentField="field"
|
|
173
|
+
v-model:formData="formData"
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
176
|
+
</template>
|
|
177
|
+
</draggable>
|
|
178
|
+
</td>
|
|
179
|
+
</template>
|
|
180
|
+
</tr>
|
|
181
|
+
</tbody>
|
|
182
|
+
</table>
|
|
183
|
+
</group-box-container>
|
|
184
|
+
</template>
|
|
185
|
+
<style lang="scss" scoped>
|
|
186
|
+
table {
|
|
187
|
+
display: table;
|
|
188
|
+
border-collapse: separate;
|
|
189
|
+
box-sizing: border-box;
|
|
190
|
+
text-indent: initial;
|
|
191
|
+
unicode-bidi: isolate;
|
|
192
|
+
border-spacing: 2px;
|
|
193
|
+
border-color: gray;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
tr {
|
|
197
|
+
display: table-row;
|
|
198
|
+
vertical-align: inherit;
|
|
199
|
+
unicode-bidi: isolate;
|
|
200
|
+
border-color: inherit;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.container-thead tr {
|
|
204
|
+
background: var(--star-horse-shadow);
|
|
205
|
+
height: 35px;
|
|
206
|
+
border-radius: 3px;
|
|
207
|
+
margin-bottom: 5px;
|
|
208
|
+
border: 1px solid #dfe6ec;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
th {
|
|
212
|
+
position: relative;
|
|
213
|
+
border: 1px solid #dfe6ec;
|
|
214
|
+
|
|
215
|
+
.td-operator {
|
|
216
|
+
position: absolute;
|
|
217
|
+
right: 0;
|
|
218
|
+
top: 0;
|
|
219
|
+
z-index: 9999;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
tr {
|
|
224
|
+
width: 100%;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.td-clz {
|
|
228
|
+
flex-direction: row;
|
|
229
|
+
padding: 5px;
|
|
230
|
+
border: 1px solid #dfe6ec;
|
|
231
|
+
border-top: none;
|
|
232
|
+
height: 35px;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.comp-item {
|
|
236
|
+
margin: unset;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.dynamic-table {
|
|
240
|
+
width: 100%;
|
|
241
|
+
border-collapse: collapse;
|
|
242
|
+
|
|
243
|
+
thead {
|
|
244
|
+
background: var(--star-horse-font-color);
|
|
245
|
+
height: 30px;
|
|
246
|
+
font-size: 14px;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { App, defineAsyncComponent } from "vue";
|
|
2
|
+
|
|
3
|
+
const items = import.meta.glob("@/components/formcomp/items/*.vue");
|
|
4
|
+
export default function install(app: App<Element>) {
|
|
5
|
+
for (const [key, value] of Object.entries(items)) {
|
|
6
|
+
const name = key.slice(key.lastIndexOf("/") + 1, key.lastIndexOf("."));
|
|
7
|
+
app.component(name, defineAsyncComponent(value as any));
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<starhorse-form-item
|
|
3
|
+
:showFormItem="showFormItem"
|
|
4
|
+
:isDesign="isDesign"
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
:bareFlag="bareFlag"
|
|
7
|
+
:formItem="field"
|
|
8
|
+
:parentField="parentField"
|
|
9
|
+
>
|
|
10
|
+
<el-cascader
|
|
11
|
+
:fid="field.fieldName"
|
|
12
|
+
v-bind="field.preps"
|
|
13
|
+
:disabled="checkIsDisabled(props)"
|
|
14
|
+
v-on="getDynamicEvents(props, itemAction)"
|
|
15
|
+
v-model="formData[field.fieldName]"
|
|
16
|
+
/>
|
|
17
|
+
</starhorse-form-item>
|
|
18
|
+
</template>
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { nextTick, onMounted, PropType, watch } from "vue";
|
|
21
|
+
import { compDynamicData } from "@/api/star_horse_utils";
|
|
22
|
+
import areaData from "@/api/pcas-code.json";
|
|
23
|
+
import {
|
|
24
|
+
allAction,
|
|
25
|
+
checkIsDisabled,
|
|
26
|
+
initCompCallEvent,
|
|
27
|
+
} from "@/components/formcomp/utils/ItemRelationEventUtils";
|
|
28
|
+
import { getDynamicEvents } from "@/api/system";
|
|
29
|
+
|
|
30
|
+
const props = defineProps({
|
|
31
|
+
isDesign: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false,
|
|
34
|
+
},
|
|
35
|
+
disabled: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false,
|
|
38
|
+
},
|
|
39
|
+
showFormItem: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
bareFlag: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false,
|
|
46
|
+
},
|
|
47
|
+
isSearch: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false,
|
|
50
|
+
},
|
|
51
|
+
field: {
|
|
52
|
+
type: Object as PropType<any>,
|
|
53
|
+
required: true,
|
|
54
|
+
},
|
|
55
|
+
parentField: {
|
|
56
|
+
type: Object as PropType<any>,
|
|
57
|
+
},
|
|
58
|
+
formInfo: {
|
|
59
|
+
type: Object as PropType<any>,
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
const emits = defineEmits(["selfFunc", "selectItem"]);
|
|
63
|
+
const formData = defineModel("formData");
|
|
64
|
+
const itemAction = (prep: any) => {
|
|
65
|
+
allAction(props, emits, formData, prep);
|
|
66
|
+
};
|
|
67
|
+
const initData = async () => {
|
|
68
|
+
if (!props.field.preps) {
|
|
69
|
+
props.field.preps = {};
|
|
70
|
+
}
|
|
71
|
+
if (props.field.preps.user) {
|
|
72
|
+
const data = await compDynamicData(props.field);
|
|
73
|
+
if (data?.length) {
|
|
74
|
+
props.field.preps["options"] = data;
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
props.field.preps["props"] = {
|
|
78
|
+
label: "name",
|
|
79
|
+
value: "code",
|
|
80
|
+
};
|
|
81
|
+
props.field.preps["options"] = areaData;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
await nextTick();
|
|
85
|
+
let data: any = formData.value[props.field.fieldName];
|
|
86
|
+
if (data) {
|
|
87
|
+
formData.value[props.field.fieldName] = JSON.parse(data);
|
|
88
|
+
} else {
|
|
89
|
+
//解决加载慢问题,导致数据没法回显
|
|
90
|
+
setTimeout(() => {
|
|
91
|
+
let data: any = formData.value[props.field.fieldName];
|
|
92
|
+
formData.value[props.field.fieldName] = data ? JSON.parse(data) : [];
|
|
93
|
+
}, 200);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
onMounted(() => {
|
|
97
|
+
initData();
|
|
98
|
+
initCompCallEvent(props, emits, formData);
|
|
99
|
+
});
|
|
100
|
+
watch(
|
|
101
|
+
() => formData.value[props.field.fieldName + "OptionList"],
|
|
102
|
+
(val) => {
|
|
103
|
+
if (val?.length > 0) {
|
|
104
|
+
props.field.preps["options"] = val;
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
immediate: true,
|
|
109
|
+
},
|
|
110
|
+
);
|
|
111
|
+
</script>
|
|
112
|
+
<style lang="scss" scoped>
|
|
113
|
+
:deep(.el-cascader) {
|
|
114
|
+
width: 100%;
|
|
115
|
+
}
|
|
116
|
+
</style>
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<starhorse-form-item
|
|
3
|
+
:showFormItem="showFormItem"
|
|
4
|
+
:isDesign="isDesign"
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
:bareFlag="bareFlag"
|
|
7
|
+
:formItem="field"
|
|
8
|
+
:parentField="parentField"
|
|
9
|
+
>
|
|
10
|
+
<audio :fid="field.fieldName" ref="audio" controls></audio>
|
|
11
|
+
</starhorse-form-item>
|
|
12
|
+
</template>
|
|
13
|
+
<script setup lang="ts" name="audioItem">
|
|
14
|
+
import { onMounted, PropType, ref } from "vue";
|
|
15
|
+
import { blobData } from "@/api/star_horse_apis";
|
|
16
|
+
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
isDesign: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
22
|
+
disabled: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false,
|
|
25
|
+
},
|
|
26
|
+
showFormItem: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false,
|
|
29
|
+
},
|
|
30
|
+
bareFlag: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false,
|
|
33
|
+
},
|
|
34
|
+
isSearch: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false,
|
|
37
|
+
},
|
|
38
|
+
field: {
|
|
39
|
+
type: Object as PropType<any>,
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
42
|
+
parentField: {
|
|
43
|
+
type: Object as PropType<any>,
|
|
44
|
+
},
|
|
45
|
+
formInfo: {
|
|
46
|
+
type: Object as PropType<any>,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
const emits = defineEmits(["selfFunc", "selectItem"]);
|
|
50
|
+
// const formData = defineModel("formData");
|
|
51
|
+
let audio = ref();
|
|
52
|
+
const init = async () => {
|
|
53
|
+
let file = await blobData(props.field["audioUrl"]);
|
|
54
|
+
if (!file) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
// 开始识别
|
|
58
|
+
let reader = new FileReader();
|
|
59
|
+
reader.readAsArrayBuffer(file);
|
|
60
|
+
reader.onload = function (event) {
|
|
61
|
+
let arrBuffer = event.target.result as ArrayBuffer;
|
|
62
|
+
let audioCtx = new AudioContext();
|
|
63
|
+
audioCtx.decodeAudioData(arrBuffer, function (audioBuffer) {
|
|
64
|
+
// let duration = audioBuffer.duration;
|
|
65
|
+
let channels = audioBuffer.numberOfChannels;
|
|
66
|
+
let rate = audioBuffer.sampleRate;
|
|
67
|
+
// 3秒
|
|
68
|
+
let startOffset = 0;
|
|
69
|
+
let endOffset = rate * 3;
|
|
70
|
+
let frameCount = endOffset - startOffset;
|
|
71
|
+
let newAudioBuffer;
|
|
72
|
+
newAudioBuffer = new AudioContext().createBuffer(
|
|
73
|
+
channels,
|
|
74
|
+
endOffset - startOffset,
|
|
75
|
+
rate,
|
|
76
|
+
);
|
|
77
|
+
let anotherArray = new Float32Array(frameCount);
|
|
78
|
+
let offset = 0;
|
|
79
|
+
for (let channel = 0; channel < channels; channel++) {
|
|
80
|
+
audioBuffer.copyFromChannel(anotherArray, channel, startOffset);
|
|
81
|
+
newAudioBuffer.copyToChannel(anotherArray, channel, offset);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* 直接播放使用下面的代码
|
|
85
|
+
// 创建AudioBufferSourceNode对象
|
|
86
|
+
let source = audioCtx.createBufferSource();
|
|
87
|
+
// 设置AudioBufferSourceNode对象的buffer为复制的3秒AudioBuffer对象
|
|
88
|
+
source.buffer = newAudioBuffer;
|
|
89
|
+
// 这一句是必须的,表示结束,没有这一句没法播放,没有声音
|
|
90
|
+
// 这里直接结束,实际上可以对结束做一些特效处理
|
|
91
|
+
source.connect(audioCtx.destination);
|
|
92
|
+
// 资源开始播放
|
|
93
|
+
source.start();
|
|
94
|
+
*/
|
|
95
|
+
let blob = bufferToWave(newAudioBuffer, frameCount);
|
|
96
|
+
/**
|
|
97
|
+
* 转换成Base64使用下面的代码
|
|
98
|
+
let reader2 = new FileReader();
|
|
99
|
+
reader2.onload = function(evt){
|
|
100
|
+
audio.src = evt.target.result;
|
|
101
|
+
};
|
|
102
|
+
reader2.readAsDataURL(blob);
|
|
103
|
+
*/
|
|
104
|
+
// 使用Blob地址
|
|
105
|
+
audio.value.src = URL.createObjectURL(blob);
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
// Convert AudioBuffer to a Blob using WAVE representation
|
|
110
|
+
const bufferToWave = (abuffer: any, len: number) => {
|
|
111
|
+
let numOfChan = abuffer.numberOfChannels,
|
|
112
|
+
length = len * numOfChan * 2 + 44,
|
|
113
|
+
buffer = new ArrayBuffer(length),
|
|
114
|
+
view = new DataView(buffer),
|
|
115
|
+
channels = [],
|
|
116
|
+
i,
|
|
117
|
+
sample,
|
|
118
|
+
offset = 0,
|
|
119
|
+
pos = 0;
|
|
120
|
+
const setUint16 = (data: any) => {
|
|
121
|
+
view.setUint16(pos, data, true);
|
|
122
|
+
pos += 2;
|
|
123
|
+
};
|
|
124
|
+
const setUint32 = (data: any) => {
|
|
125
|
+
view.setUint32(pos, data, true);
|
|
126
|
+
pos += 4;
|
|
127
|
+
};
|
|
128
|
+
// write WAVE header
|
|
129
|
+
setUint32(0x46464952); // "RIFF"
|
|
130
|
+
setUint32(length - 8); // file length - 8
|
|
131
|
+
setUint32(0x45564157); // "WAVE"
|
|
132
|
+
setUint32(0x20746d66); // "fmt " chunk
|
|
133
|
+
setUint32(16); // length = 16
|
|
134
|
+
setUint16(1); // PCM (uncompressed)
|
|
135
|
+
setUint16(numOfChan);
|
|
136
|
+
setUint32(abuffer.sampleRate);
|
|
137
|
+
setUint32(abuffer.sampleRate * 2 * numOfChan); // avg. bytes/sec
|
|
138
|
+
setUint16(numOfChan * 2); // block-align
|
|
139
|
+
setUint16(16); // 16-bit (hardcoded in this demo)
|
|
140
|
+
setUint32(0x61746164); // "data" - chunk
|
|
141
|
+
setUint32(length - pos - 4); // chunk length
|
|
142
|
+
// write interleaved data
|
|
143
|
+
for (i = 0; i < abuffer.numberOfChannels; i++) {
|
|
144
|
+
channels.push(abuffer.getChannelData(i));
|
|
145
|
+
}
|
|
146
|
+
while (pos < length) {
|
|
147
|
+
for (i = 0; i < numOfChan; i++) {
|
|
148
|
+
// interleave channels
|
|
149
|
+
sample = Math.max(-1, Math.min(1, channels[i][offset])); // clamp
|
|
150
|
+
sample = (0.5 + sample < 0 ? sample * 32768 : sample * 32767) | 0; // scale to 16-bit signed int
|
|
151
|
+
view.setInt16(pos, sample, true); // write 16-bit sample
|
|
152
|
+
pos += 2;
|
|
153
|
+
}
|
|
154
|
+
offset++; // next source sample
|
|
155
|
+
}
|
|
156
|
+
// create Blob
|
|
157
|
+
return new Blob([buffer], { type: "audio/wav" });
|
|
158
|
+
};
|
|
159
|
+
onMounted(() => {
|
|
160
|
+
init();
|
|
161
|
+
});
|
|
162
|
+
</script>
|
|
163
|
+
<style scoped></style>
|