fix: 一些基本功能

This commit is contained in:
2025-03-07 08:18:45 +08:00
parent 638462295d
commit 4cdb8351d4
453 changed files with 13336 additions and 24197 deletions

View File

@@ -0,0 +1,75 @@
<script setup lang="ts">
import type { VbenFormProps } from '@vben/common-ui';
import { onMounted, type PropType, ref, watch } from 'vue';
import { schemaToDetailForm } from '#/util/tool';
import { type DescItem, Description } from '../description';
const props = defineProps({
formOptions: {
type: Object as PropType<VbenFormProps>,
default: () => ({}),
},
data: {
type: Object,
default: () => ({}),
},
descriptionProps: {
type: Object,
default: () => ({}),
},
});
const schemaDescItems = ref<DescItem[]>([]);
const initialSchemaDescItems = () => {
if (
Object.keys(props.formOptions).length > 0 &&
Object.keys(props.data).length > 0
) {
schemaDescItems.value = schemaToDetailForm(props.formOptions, props.data);
}
};
onMounted(() => {
initialSchemaDescItems();
});
watch(
() => props.data,
() => {
initialSchemaDescItems();
},
{
deep: true,
},
);
watch(
() => props.formOptions,
() => {
initialSchemaDescItems();
},
{
deep: true,
},
);
</script>
<template>
<div class="desc-wrap">
<div
v-for="schema in schemaDescItems"
:key="schema.field"
class="desc-card"
>
<Description
:data="data"
:label-style="{
width: '150px',
}"
:schema="schema.children"
:title="schemaDescItems.length === 1 ? undefined : schema.label"
v-bind="descriptionProps"
/>
</div>
</div>
</template>
<style lang="less" scoped></style>

View File

@@ -0,0 +1 @@
export { default as FormDescription } from './form-description.vue';