feat: 低代码平台的页面使用低代码平台自身来制作

This commit is contained in:
wangxuefeng 2025-03-05 14:06:43 +08:00
parent 2d202cd6d7
commit 1d7b28160a
12 changed files with 606 additions and 598 deletions

View File

@ -13,17 +13,17 @@
"clean": "rimraf node_modules"
},
"dependencies": {
"@vtj/core": "^0.10.7",
"@vtj/designer": "0.10.7",
"@vtj/icons": "0.10.7",
"@vtj/local": "^0.10.7",
"@vtj/materials": "^0.10.7",
"@vtj/core": "^0.10.9",
"@vtj/designer": "0.10.9",
"@vtj/icons": "0.10.9",
"@vtj/local": "^0.10.9",
"@vtj/materials": "^0.10.9",
"@vtj/node": "0.10.2",
"@vtj/pro": "^0.10.7",
"@vtj/renderer": "^0.10.7",
"@vtj/ui": "^0.10.7",
"@vtj/utils": "0.10.7",
"@vtj/web": "^0.10.7",
"@vtj/pro": "^0.10.9",
"@vtj/renderer": "^0.10.9",
"@vtj/ui": "^0.10.9",
"@vtj/utils": "0.10.9",
"@vtj/web": "^0.10.9",
"axios": "^1.8.1",
"element-plus": "^2.9.4",
"licia-es": "^1.46.0",

View File

@ -32,16 +32,6 @@ const routes: Array<RouteRecordRaw> = [
},
component: () => import('@/components/renderer-adapter/index.vue'),
},
{
path: 'add',
name: `${moduleName}-add`,
meta: {
title: '添加应用',
keepAlive: true,
icon: 'ant-design:list',
},
component: () => import('@/views/application/add.vue'),
},
],
},
];

View File

@ -32,16 +32,6 @@ const routes: Array<RouteRecordRaw> = [
},
component: () => import('@/components/renderer-adapter/index.vue'),
},
{
path: 'add',
name: `${moduleName}-add`,
meta: {
title: '添加项目',
keepAlive: true,
icon: 'ant-design:list',
},
component: () => import('@/views/project/add.vue'),
},
],
},
];

View File

@ -1,52 +0,0 @@
<script setup lang="ts">
import { useQuery, useMutation } from '@tanstack/vue-query';
import { getApplicationList, createApplication, deleteApplication } from '@/io';
const addData = {
name: '低代码平台',
alias: 'low-code-platform',
active: true,
};
const {
data: appList,
isError,
isLoading,
refetch,
} = useQuery({
queryKey: ['applicationList'],
queryFn: getApplicationList,
enabled: true,
});
const { mutate: createApp, isLoading: isCreating } = useMutation({
mutationFn: createApplication,
onSuccess: () => {
refetch();
},
});
const {
mutate: deleteApp,
isLoading: isDeleting,
error: deleteError,
} = useMutation({
mutationFn: deleteApplication,
onSuccess: () => {
refetch();
},
});
</script>
<template>
<div style="display: flex; flex-direction: column; gap: 10px">
<div v-if="isLoading">加载中...</div>
<div v-else-if="isError">加载失败</div>
<div v-else>
{{ appList }}
</div>
<Button type="primary" :loading="isCreating" @click="createApp(addData)"> 添加应用 </Button>
<Button type="primary" @click="refetch">重新获取</Button>
<Button type="primary" :loading="isDeleting" @click="deleteApp('3')"> 删除应用 </Button>
</div>
</template>

View File

@ -1,54 +0,0 @@
<script setup lang="ts">
import { useQuery, useMutation } from '@tanstack/vue-query';
import { getProjectList, createProject, deleteProject } from '@/io';
const addData = {
application_id: 1,
description: '低代码项目管理平台',
name: '低代码项目管理平台',
alias: 'low-code-project-management-platform',
platform: 'web',
};
const {
data: projectList,
isError,
isLoading,
refetch,
} = useQuery({
queryKey: ['getProjectList'],
queryFn: getProjectList,
enabled: true,
});
const { mutate: createProjectMutation, isLoading: isCreating } = useMutation({
mutationFn: createProject,
onSuccess: () => {
refetch();
},
});
const { mutate: deleteProjectMutation, isLoading: isDeleting } = useMutation({
mutationFn: deleteProject,
onSuccess: () => {
refetch();
},
});
</script>
<template>
<div style="display: flex; flex-direction: column; gap: 10px">
<div v-if="isLoading">加载中...</div>
<div v-else-if="isError">加载失败</div>
<div v-else>
{{ projectList }}
</div>
<Button type="primary" :loading="isCreating" @click="createProjectMutation(addData)">
添加项目
</Button>
<Button type="primary" @click="refetch">重新获取</Button>
<Button type="primary" :loading="isDeleting" @click="deleteProjectMutation('3')">
删除项目
</Button>
</div>
</template>

8
apps/renderer/env.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
/// <reference types="vite/client" />
interface ImportMeta {
readonly env: {
NODE_ENV: "development" | "production";
VITE_API_BASE?: string;
};
}

View File

@ -17,13 +17,13 @@
"@sy/low-code-shared": "workspace:*",
"@sy/web-vitals": "workspace:*",
"@tanstack/vue-query": "^5.66.9",
"@vtj/core": "^0.10.7",
"@vtj/pro": "^0.10.7",
"@vtj/ui": "^0.10.7",
"@vtj/web": "^0.10.7",
"@vtj/renderer": "^0.10.7",
"@vtj/icons": "0.10.7",
"@vtj/materials": "^0.10.7",
"@vtj/core": "^0.10.9",
"@vtj/icons": "0.10.9",
"@vtj/materials": "^0.10.9",
"@vtj/pro": "^0.10.9",
"@vtj/renderer": "^0.10.9",
"@vtj/ui": "^0.10.9",
"@vtj/web": "^0.10.9",
"axios": "^1.8.1",
"core-js": "^3.40.0",
"element-plus": "^2.9.4",
@ -34,6 +34,7 @@
},
"devDependencies": {
"@farmfe/cli": "^1.0.4",
"@vtj/cli": "^0.10.2",
"@farmfe/core": "^1.6.6",
"@sy/vite-plugin-http2-proxy": "workspace:*",
"@vitejs/plugin-vue": "^5.2.1",

View File

@ -1,5 +1,4 @@
<script setup lang="ts">
// @ts-nocheck
import { computed, watch, ref, getCurrentInstance } from 'vue'
import { ElLoading } from 'element-plus'
import Postmate from 'postmate'
@ -7,8 +6,7 @@ import { createProvider } from '@vtj/web'
import { useQuery } from '@tanstack/vue-query'
import { LowCodeService } from './service'
import { getFile } from './io'
import * as VtjUI from '@vtj/ui'
console.log('VtjUI',VtjUI)
// import * as VtjUI from '@vtj/ui'
//
const renderer = ref()
@ -42,9 +40,9 @@ const { data: file, isFetching } = useQuery({
nodeEnv: import.meta.env.NODE_ENV,
service: lowCodeService,
project: { id: model.projectId },
components: {
...VtjUI,
}
// components: {
// ...VtjUI,
// }
})
onReady(async () => {
const instance = getCurrentInstance()

View File

@ -1,4 +1,3 @@
// @ts-nocheck
import { type ProjectSchema, type BlockSchema, ProjectModel } from "@vtj/core";
import { BaseService } from "@vtj/renderer";
import { getProject, getFile as getLowCodeFile } from "@/io";

View File

@ -1,16 +1,15 @@
{
"extends": "./node_modules/@vtj/cli/config/tsconfig.web.json",
"compilerOptions": {
"module": "nodenext",
"lib": ["ESNext", "DOM"],
"moduleResolution": "nodenext",
"noUnusedLocals": false,
"noUnusedParameters": false,
"baseUrl": "./",
"paths": {
"@/*": ["src/*"],
"$vtj/*": [".vtj/*"]
},
"lib": ["ES2022", "DOM"],
"module": "NodeNext",
"target": "ES2022",
"moduleResolution": "NodeNext"
"@/*": ["src/*"]
}
},
"include": ["src"],
"exclude": [".vtj"],

1011
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff