plugin page render

This commit is contained in:
jxxghp
2023-07-25 11:41:24 +08:00
parent dbd1315a9e
commit e636b1e225
3 changed files with 55 additions and 5 deletions

View File

@@ -3,6 +3,7 @@ import { useToast } from 'vue-toast-notification'
import api from '@/api'
import type { Plugin } from '@/api/types'
import FormRender from '@/components/render/FormRender.vue'
import PageRender from '@/components/render/PageRender.vue'
import { isNullOrEmptyObject } from '@core/utils'
// 输入参数
@@ -112,7 +113,7 @@ async function savePluginConf() {
}
// 显示插件详情
function showPluginInfo() {
async function showPluginInfo() {
pluginConfigDialog.value = false
pluginInfoDialog.value = true
}
@@ -140,7 +141,7 @@ const dropdownItems = ref([
onBeforeMount(async () => {
await loadPluginForm()
await loadPluginConf()
await loadPluginPage()
loadPluginPage()
})
</script>
@@ -205,7 +206,7 @@ onBeforeMount(async () => {
scrollable
persistent
>
<VCard :title="`插件 - ${props.plugin?.plugin_name}`">
<VCard :title="props.plugin?.plugin_name">
<DialogCloseBtn @click="pluginConfigDialog = false" />
<VCardText>
<FormRender
@@ -234,9 +235,16 @@ onBeforeMount(async () => {
scrollable
persistent
>
<VCard :title="`插件 - ${props.plugin?.plugin_name}`">
<VCard :title="`${props.plugin?.plugin_name} - 详情`">
<DialogCloseBtn @click="pluginInfoDialog = false" />
<VCardText />
<VCardText>
<PageRender
v-for="(item, index) in pluginPageItems"
:key="index"
:config="item"
:handler="pluginInfoDialog"
/>
</VCardText>
<VCardActions>
<VSpacer />
<VBtn @click="pluginInfoDialog = false">

View File

@@ -4,6 +4,7 @@ import { type PropType, ref } from 'vue'
// 组件接口
interface RenderProps {
component: string
text: string
content?: any
props?: any
}
@@ -17,6 +18,7 @@ const elementProps = defineProps({
// 配置元素
const formItem = ref<RenderProps>(elementProps.config || {
component: 'div',
text: '',
props: {},
content: [],
})
@@ -31,6 +33,7 @@ const formData = ref<any>(elementProps.form || {})
v-bind="formItem.props"
v-model="formData[formItem.props?.model || '']"
>
{{ formItem.text }}
<FormRender
v-for="(innerItem, innerIndex) in (formItem.content || [])"
:key="innerIndex"

View File

@@ -0,0 +1,39 @@
<script lang="ts" setup>
import { type PropType, ref } from 'vue'
// 组件接口
interface RenderProps {
component: string
text: string
content?: any
props?: any
}
// 输入参数
const elementProps = defineProps({
config: Object as PropType<RenderProps>,
handler: Boolean,
})
// 配置元素
const formItem = ref<RenderProps>(elementProps.config || {
component: 'div',
text: '',
props: {},
content: [],
})
</script>
<template>
<Component
:is="formItem.component"
v-bind="formItem.props"
>
{{ formItem.text }}
<PageRender
v-for="(innerItem, innerIndex) in (formItem.content || [])"
:key="innerIndex"
:config="innerItem"
/>
</Component>
</template>