chore: 🔨 合并gitee仓库代码

This commit is contained in:
ray
2024-07-29 22:58:51 +08:00
5 changed files with 43 additions and 31 deletions

View File

@@ -17,7 +17,7 @@
## 项目简介 ## 项目简介
[vue3-element-admin](https://gitee.com/youlaiorg/vue3-element-admin) 是基于 Vue3 + Vite5+ TypeScript5 + Element-Plus + Pinia 等主流技术栈构建的免费开源的后台管理前端模板(配套[后端源码](https://gitee.com/youlaiorg/youlai-boot))。 [vue3-element-admin](https://gitee.com/youlaiorg/vue3-element-admin) 是基于 Vue3 + Vite5+ TypeScript5 + Element-Plus + Pinia 等主流技术栈构建的免费开源的后台管理前端模板(配套[Java 后端源码](https://gitee.com/youlaiorg/youlai-boot))。
## 项目特色 ## 项目特色
@@ -70,6 +70,9 @@ cd vue3-element-admin
# 安装 pnpm # 安装 pnpm
npm install pnpm -g npm install pnpm -g
# 设置镜像源(可忽略)
pnpm config set registry https://registry.npmmirror.com
# 安装依赖 # 安装依赖
pnpm install pnpm install
@@ -86,7 +89,7 @@ pnpm run dev
pnpm run build pnpm run build
# 上传文件至远程服务器 # 上传文件至远程服务器
将打包生成`dist` 目录下的文件拷贝至 `/usr/share/nginx/html` 目录 本地打包生成dist 目录下的所有文件拷贝至服务器的 /usr/share/nginx/html 目录
# nginx.cofig 配置 # nginx.cofig 配置
server { server {

View File

@@ -125,6 +125,5 @@
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=18.0.0" "node": ">=18.0.0"
}, }
"packageManager": "pnpm@9.1.3+sha512.7c2ea089e1a6af306409c4fc8c4f0897bdac32b772016196c469d9428f1fe2d5a21daf8ad6512762654ac645b5d9136bb210ec9a00afa8dbc4677843ba362ecd"
} }

View File

@@ -82,7 +82,7 @@
</el-steps> </el-steps>
<div class="mt-5"> <div class="mt-5">
<el-form v-show="active == 1" :model="formData" :label-width="100"> <el-form v-show="active == 0" :model="formData" :label-width="100">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="表名"> <el-form-item label="表名">
@@ -124,7 +124,7 @@
</el-form> </el-form>
<el-table <el-table
v-show="active == 2" v-show="active == 1"
v-loading="loading" v-loading="loading"
:element-loading-text="loadingText" :element-loading-text="loadingText"
highlight--currentrow highlight--currentrow
@@ -253,7 +253,8 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-row v-show="active == 3">
<el-row v-show="active == 2">
<el-col :span="6"> <el-col :span="6">
<el-scrollbar max-height="72vh"> <el-scrollbar max-height="72vh">
<el-tree <el-tree
@@ -293,13 +294,13 @@
</div> </div>
<template #footer> <template #footer>
<el-button type="success" @click="handlePrevClick" v-if="active !== 1"> <el-button type="success" @click="handlePrevClick" v-if="active !== 0">
<el-icon><Back /></el-icon> <el-icon><Back /></el-icon>
{{ prevBtnText }} {{ prevBtnText }}
</el-button> </el-button>
<el-button type="primary" @click="handleNextClick"> <el-button type="primary" @click="handleNextClick">
{{ nextBtnText }} {{ nextBtnText }}
<el-icon v-if="active !== 3"><Right /></el-icon> <el-icon v-if="active !== 2"><Right /></el-icon>
<el-icon v-else><Download /></el-icon> <el-icon v-else><Download /></el-icon>
</el-button> </el-button>
</template> </template>
@@ -357,14 +358,22 @@ const cmOptions: EditorConfiguration = {
const prevBtnText = ref(""); const prevBtnText = ref("");
const nextBtnText = ref("下一步,字段配置"); const nextBtnText = ref("下一步,字段配置");
const active = ref(1); const active = ref(0);
interface TreeNode {
label: string;
content?: string;
children?: TreeNode[];
}
const treeData = ref<TreeNode[]>([]);
function handlePrevClick() { function handlePrevClick() {
if (active.value-- <= 1) active.value = 1; if (active.value-- <= 0) active.value = 0;
} }
function handleNextClick() { function handleNextClick() {
if (active.value === 2) { if (active.value === 1) {
// 保存生成配置 // 保存生成配置
const tableName = formData.value.tableName; const tableName = formData.value.tableName;
if (!tableName) { if (!tableName) {
@@ -378,24 +387,24 @@ function handleNextClick() {
handlePreview(tableName); handlePreview(tableName);
}) })
.then(() => { .then(() => {
if (active.value++ >= 3) active.value = 3; if (active.value++ >= 2) active.value = 2;
}) })
.finally(() => { .finally(() => {
loading.value = false; loading.value = false;
loadingText.value = "loading..."; loadingText.value = "loading...";
}); });
} else { } else {
if (active.value++ >= 3) active.value = 3; if (active.value++ >= 2) active.value = 2;
} }
} }
watch(active, (val) => { watch(active, (val) => {
if (val === 1) { if (val === 0) {
nextBtnText.value = "下一步,字段配置"; nextBtnText.value = "下一步,字段配置";
} else if (val === 2) { } else if (val === 1) {
prevBtnText.value = "上一步,基础配置"; prevBtnText.value = "上一步,基础配置";
nextBtnText.value = "下一步,确认生成"; nextBtnText.value = "下一步,确认生成";
} else if (val === 3) { } else if (val === 2) {
prevBtnText.value = "上一步,字段配置"; prevBtnText.value = "上一步,字段配置";
nextBtnText.value = "下载代码"; nextBtnText.value = "下载代码";
} }
@@ -424,14 +433,6 @@ function handleCloseDialog() {
dialog.visible = false; dialog.visible = false;
} }
interface TreeNode {
label: string;
content?: string;
children?: TreeNode[];
}
const treeData = ref<TreeNode[]>([]);
/** 打开弹窗 */ /** 打开弹窗 */
function handleOpenDialog(tableName: string) { function handleOpenDialog(tableName: string) {
dialog.visible = true; dialog.visible = true;
@@ -439,10 +440,10 @@ function handleOpenDialog(tableName: string) {
dialog.title = `${tableName} 代码生成`; dialog.title = `${tableName} 代码生成`;
formData.value = data; formData.value = data;
if (formData.value.id) { if (formData.value.id) {
active.value = 3; active.value = 2;
handlePreview(tableName); handlePreview(tableName);
} else { } else {
active.value = 1; active.value = 0;
} }
}); });
} }
@@ -485,11 +486,11 @@ function buildTree(
// 定义特殊路径 // 定义特殊路径
// TODO: 如果菜单有多个节点,需要将此菜单作为独立一级的节点,而不是合并到上一级。 按照此规则, com.youlai.system 则是三个节点,而不是合并到一起,但是这里需要将 com.youlai.system 合并到一起,所以需要特殊处理 // TODO: 如果菜单有多个节点,需要将此菜单作为独立一级的节点,而不是合并到上一级。 按照此规则, com.youlai.system 则是三个节点,而不是合并到一起,但是这里需要将 com.youlai.system 合并到一起,所以需要特殊处理
const specialPaths = [ const specialPaths = [
"com\\youlai\\system", "src/main",
"src\\main",
"java", "java",
"youlai-boot", "youlai-boot",
"vue3-element-admin", "vue3-element-admin",
"com/youlai/system",
]; ];
// 检查路径中的特殊部分并合并它们 // 检查路径中的特殊部分并合并它们
@@ -499,6 +500,7 @@ function buildTree(
parts.forEach((part) => { parts.forEach((part) => {
buffer.push(part); buffer.push(part);
const currentPath = buffer.join(separator); const currentPath = buffer.join(separator);
console.log("currentPath", currentPath);
if (specialPaths.includes(currentPath)) { if (specialPaths.includes(currentPath)) {
mergedParts.push(currentPath); mergedParts.push(currentPath);
buffer = []; buffer = [];

View File

@@ -27,11 +27,12 @@
> >
<el-icon class="el-icon--upload"><upload-filled /></el-icon> <el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text"> <div class="el-upload__text">
将文件拖到此处<em>点击上传</em> 将文件拖到此处
<em>点击上传</em>
</div> </div>
<template #tip> <template #tip>
<div class="el-upload__tip"> <div class="el-upload__tip">
*.xlsx / *.xls 格式为*.xlsx / *.xls文件不超过一个
<el-link <el-link
type="primary" type="primary"
icon="download" icon="download"
@@ -95,7 +96,12 @@ const importFormRules = {
files: [{ required: true, message: "文件不能为空", trigger: "blur" }], files: [{ required: true, message: "文件不能为空", trigger: "blur" }],
}; };
const emptyFileList = () => {
importFormData.files.length = 0;
};
const handleClose = () => { const handleClose = () => {
emptyFileList();
dialogVisible.value = false; dialogVisible.value = false;
}; };

View File

@@ -205,6 +205,8 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
"element-plus/es/components/skeleton/style/css", "element-plus/es/components/skeleton/style/css",
"element-plus/es/components/skeleton-item/style/css", "element-plus/es/components/skeleton-item/style/css",
"element-plus/es/components/badge/style/css", "element-plus/es/components/badge/style/css",
"element-plus/es/components/steps/style/css",
"element-plus/es/components/step/style/css",
], ],
}, },
// 构建配置 // 构建配置