Merge branch 'master' of https://gitee.com/youlaiorg/vue3-element-admin into feature/noticews

This commit is contained in:
胡少翔
2024-09-05 09:48:33 +08:00
9 changed files with 131 additions and 51 deletions

View File

@@ -134,8 +134,8 @@ export default defineMock([
// 重置密码 // 重置密码
{ {
url: "users/:userId/password", url: "users/:userId/password/reset",
method: ["PATCH"], method: ["PUT"],
body({ query }) { body({ query }) {
return { return {
code: "00000", code: "00000",
@@ -156,6 +156,51 @@ export default defineMock([
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
}, },
}, },
{
url: "users/profile",
method: ["GET"],
body: {
code: "00000",
data: {
id: 2,
username: "admin",
nickname: "系统管理员",
avatar:
"https://foruda.gitee.com/images/1723603502796844527/03cdca2a_716974.gif",
gender: 1,
mobile: "17621210366",
email: null,
deptName: "有来技术",
roleNames: "系统管理员",
createTime: "2019-10-10",
},
},
},
{
url: "users/profile",
method: ["PUT"],
body({ query }) {
return {
code: "00000",
data: null,
msg: "修改个人信息成功",
};
},
},
{
url: "users/password",
method: ["PUT"],
body({ query }) {
return {
code: "00000",
data: null,
msg: "修改密码成功",
};
},
},
]); ]);
// 用户映射表数据 // 用户映射表数据

View File

@@ -45,16 +45,17 @@
}, },
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
"@stomp/stompjs": "^7.0.0",
"@vueuse/core": "^10.11.1", "@vueuse/core": "^10.11.1",
"@wangeditor/editor": "^5.1.23", "@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "5.1.10", "@wangeditor/editor-for-vue": "5.1.10",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"axios": "^1.7.4", "axios": "^1.7.7",
"codemirror": "^5.65.17", "codemirror": "^5.65.17",
"codemirror-editor-vue3": "^2.7.0", "codemirror-editor-vue3": "^2.7.0",
"color": "^4.2.3", "color": "^4.2.3",
"echarts": "^5.5.1", "echarts": "^5.5.1",
"element-plus": "^2.8.0", "element-plus": "^2.8.1",
"exceljs": "^4.4.0", "exceljs": "^4.4.0",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
@@ -62,45 +63,44 @@
"path-to-regexp": "^6.2.2", "path-to-regexp": "^6.2.2",
"pinia": "^2.2.2", "pinia": "^2.2.2",
"qs": "^6.13.0", "qs": "^6.13.0",
"sortablejs": "^1.15.2", "sortablejs": "^1.15.3",
"@stomp/stompjs": "^7.0.0", "vue": "^3.5.1",
"vue": "^3.4.38",
"vue-i18n": "9.9.1", "vue-i18n": "9.9.1",
"vue-router": "^4.4.3" "vue-router": "^4.4.3"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^18.6.1", "@commitlint/cli": "^18.6.1",
"@commitlint/config-conventional": "^18.6.3", "@commitlint/config-conventional": "^18.6.3",
"@iconify-json/ep": "^1.1.16", "@iconify-json/ep": "^1.2.0",
"@types/codemirror": "^5.60.15", "@types/codemirror": "^5.60.15",
"@types/color": "^3.0.6", "@types/color": "^3.0.6",
"@types/lodash": "^4.17.7", "@types/lodash": "^4.17.7",
"@types/node": "^20.14.15", "@types/node": "^20.16.5",
"@types/nprogress": "^0.2.3", "@types/nprogress": "^0.2.3",
"@types/path-browserify": "^1.0.2", "@types/path-browserify": "^1.0.3",
"@types/qs": "^6.9.15", "@types/qs": "^6.9.15",
"@types/sortablejs": "^1.15.8", "@types/sortablejs": "^1.15.8",
"@typescript-eslint/eslint-plugin": "^7.18.0", "@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0", "@typescript-eslint/parser": "^7.18.0",
"@vitejs/plugin-vue": "^5.1.2", "@vitejs/plugin-vue": "^5.1.3",
"@vitejs/plugin-vue-jsx": "^3.1.0", "@vitejs/plugin-vue-jsx": "^3.1.0",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"commitizen": "^4.3.0", "commitizen": "^4.3.0",
"cz-git": "^1.9.4", "cz-git": "^1.9.4",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0", "eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1", "eslint-plugin-import": "^2.30.0",
"eslint-plugin-prettier": "^5.2.1", "eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-vue": "^9.27.0", "eslint-plugin-vue": "^9.28.0",
"fast-glob": "^3.3.2", "fast-glob": "^3.3.2",
"husky": "^9.1.4", "husky": "^9.1.5",
"lint-staged": "^15.2.9", "lint-staged": "^15.2.10",
"postcss": "^8.4.41", "postcss": "^8.4.45",
"postcss-html": "^1.7.0", "postcss-html": "^1.7.0",
"postcss-scss": "^4.0.9", "postcss-scss": "^4.0.9",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"sass": "^1.77.8", "sass": "^1.78.0",
"stylelint": "^16.8.2", "stylelint": "^16.9.0",
"stylelint-config-html": "^1.1.0", "stylelint-config-html": "^1.1.0",
"stylelint-config-recess-order": "^4.6.0", "stylelint-config-recess-order": "^4.6.0",
"stylelint-config-recommended-scss": "^14.1.0", "stylelint-config-recommended-scss": "^14.1.0",
@@ -112,16 +112,17 @@
"unplugin-auto-import": "^0.17.8", "unplugin-auto-import": "^0.17.8",
"unplugin-icons": "^0.18.5", "unplugin-icons": "^0.18.5",
"unplugin-vue-components": "^0.26.0", "unplugin-vue-components": "^0.26.0",
"vite": "^5.4.1", "vite": "^5.4.3",
"vite-plugin-mock-dev-server": "^1.7.1", "vite-plugin-mock-dev-server": "^1.7.1",
"vite-plugin-svg-icons": "^2.0.1", "vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-vue-devtools": "^7.3.8", "vite-plugin-vue-devtools": "^7.4.4",
"vue-tsc": "^2.0.29" "vue-tsc": "^2.1.6"
},
"engines": {
"node": "^18.0.0 || ^20.7.0",
"pnpm": ">=9"
}, },
"repository": "https://gitee.com/youlaiorg/vue3-element-admin.git", "repository": "https://gitee.com/youlaiorg/vue3-element-admin.git",
"author": "有来开源组织", "author": "有来开源组织",
"license": "MIT", "license": "MIT"
"engines": {
"node": ">=18.0.0"
}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -77,7 +77,7 @@ class UserAPI {
*/ */
static resetPassword(id: number, password: string) { static resetPassword(id: number, password: string) {
return request({ return request({
url: `${USER_BASE_URL}/${id}/password`, url: `${USER_BASE_URL}/${id}/password/reset`,
method: "put", method: "put",
params: { password: password }, params: { password: password },
}); });

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -147,6 +147,11 @@ interface SearchItem {
} }
} }
.search-content {
max-height: 400px;
overflow-y: auto;
}
.search-space { .search-space {
padding: 20px; padding: 20px;
color: #999; color: #999;

View File

@@ -96,7 +96,7 @@ function changeLayout(layout: string) {
/** 重新激活顶部菜单 */ /** 重新激活顶部菜单 */
function againActiveTop(newVal: string) { function againActiveTop(newVal: string) {
const parent = findOutermostParent(permissionStore.routes, newVal); const parent = findOutermostParent(permissionStore.routes, newVal);
if (appStore.activeTopMenu !== parent.path) { if (appStore.activeTopMenuPath !== parent.path) {
appStore.activeTopMenu(parent.path); appStore.activeTopMenu(parent.path);
} }
} }

View File

@@ -97,15 +97,16 @@
v-show="active == 0" v-show="active == 0"
:model="genConfigFormData" :model="genConfigFormData"
:label-width="100" :label-width="100"
:rules="genConfigFormRules"
> >
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="表名"> <el-form-item label="表名" prop="tableName">
<el-input v-model="genConfigFormData.tableName" readonly /> <el-input v-model="genConfigFormData.tableName" readonly />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="业务名"> <el-form-item label="业务名" prop="businessName">
<el-input <el-input
v-model="genConfigFormData.businessName" v-model="genConfigFormData.businessName"
placeholder="用户" placeholder="用户"
@@ -116,18 +117,18 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="模块名"> <el-form-item label="包名" prop="packageName">
<el-input <el-input
v-model="genConfigFormData.moduleName" v-model="genConfigFormData.packageName"
placeholder="system" placeholder="com.youlai.boot"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="包名"> <el-form-item label="模块名" prop="moduleName">
<el-input <el-input
v-model="genConfigFormData.packageName" v-model="genConfigFormData.moduleName"
placeholder="com.youlai.boot" placeholder="system"
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
@@ -135,7 +136,7 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="实体名"> <el-form-item label="实体名" prop="entityName">
<el-input <el-input
v-model="genConfigFormData.entityName" v-model="genConfigFormData.entityName"
placeholder="User" placeholder="User"
@@ -154,7 +155,23 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="上级菜单"> <el-form-item>
<template #label>
<div class="flex-y-between">
<span>上级菜单</span>
<el-tooltip effect="dark">
<template #content>
选择上级菜单生成代码后会自动创建对应菜单
<br />
注意1生成菜单后需分配权限给角色否则菜单将无法显示
<br />
注意2演示环境默认不生成菜单如需生成请在本地部署数据库
</template>
<i-ep-QuestionFilled class="cursor-pointer" />
</el-tooltip>
</div>
</template>
<el-tree-select <el-tree-select
v-model="genConfigFormData.parentMenuId" v-model="genConfigFormData.parentMenuId"
placeholder="选择上级菜单" placeholder="选择上级菜单"
@@ -435,6 +452,13 @@ import GeneratorAPI, {
import DictAPI from "@/api/dict"; import DictAPI from "@/api/dict";
import MenuAPI from "@/api/menu"; import MenuAPI from "@/api/menu";
interface TreeNode {
label: string;
content?: string;
children?: TreeNode[];
}
const treeData = ref<TreeNode[]>([]);
const queryFormRef = ref(ElForm); const queryFormRef = ref(ElForm);
const queryParams = reactive<TablePageQuery>({ const queryParams = reactive<TablePageQuery>({
pageNum: 1, pageNum: 1,
@@ -455,6 +479,14 @@ const genConfigFormData = ref<GenConfigForm>({
fieldConfigs: [], fieldConfigs: [],
}); });
const genConfigFormRules = {
tableName: [{ required: true, message: "请输入表名", trigger: "blur" }],
businessName: [{ required: true, message: "请输入业务名", trigger: "blur" }],
packageName: [{ required: true, message: "请输入包名", trigger: "blur" }],
moduleName: [{ required: true, message: "请输入模块名", trigger: "blur" }],
entityName: [{ required: true, message: "请输入实体名", trigger: "blur" }],
};
const dialog = reactive({ const dialog = reactive({
visible: false, visible: false,
title: "", title: "",
@@ -473,12 +505,12 @@ const active = ref(0);
const currentTableName = ref(""); const currentTableName = ref("");
const sortFlag = ref<Object>(); const sortFlag = ref<Object>();
interface TreeNode { // 查询是否全选
label: string; const isCheckAllQuery = ref(false);
content?: string; // 列表是否全选
children?: TreeNode[]; const isCheckAllList = ref(false);
} // 表单是否全选
const treeData = ref<TreeNode[]>([]); const isCheckAllForm = ref(false);
watch(active, (val) => { watch(active, (val) => {
if (val === 0) { if (val === 0) {
@@ -550,6 +582,7 @@ const setNodeSort = (oldIndex: number, newIndex: number) => {
}); });
}; };
/** 上一步 */
function handlePrevClick() { function handlePrevClick() {
if (active.value === 2) { if (active.value === 2) {
//这里需要重新获取一次数据,如果第一次生成代码后,再次点击上一步,数据不重新获取,再次点击下一步,会再次插入数据,导致索引重复报错 //这里需要重新获取一次数据,如果第一次生成代码后,再次点击上一步,数据不重新获取,再次点击下一步,会再次插入数据,导致索引重复报错
@@ -571,6 +604,7 @@ function handlePrevClick() {
if (active.value-- <= 0) active.value = 0; if (active.value-- <= 0) active.value = 0;
} }
/** 下一步 */
function handleNextClick() { function handleNextClick() {
if (active.value === 0) { if (active.value === 0) {
initSort(); initSort();
@@ -680,6 +714,7 @@ function handleResetConfig(tableName: string) {
type FieldConfigKey = "isShowInQuery" | "isShowInList" | "isShowInForm"; type FieldConfigKey = "isShowInQuery" | "isShowInList" | "isShowInForm";
/** 全选 */
const toggleCheckAll = (key: FieldConfigKey, value: boolean) => { const toggleCheckAll = (key: FieldConfigKey, value: boolean) => {
const fieldConfigs = genConfigFormData.value?.fieldConfigs; const fieldConfigs = genConfigFormData.value?.fieldConfigs;
@@ -690,10 +725,6 @@ const toggleCheckAll = (key: FieldConfigKey, value: boolean) => {
} }
}; };
const isCheckAllQuery = ref(false);
const isCheckAllList = ref(false);
const isCheckAllForm = ref(false);
const checkAllSelected = (key: keyof FieldConfig, isCheckAllRef: any) => { const checkAllSelected = (key: keyof FieldConfig, isCheckAllRef: any) => {
const fieldConfigs = genConfigFormData.value?.fieldConfigs || []; const fieldConfigs = genConfigFormData.value?.fieldConfigs || [];
isCheckAllRef.value = fieldConfigs.every( isCheckAllRef.value = fieldConfigs.every(
@@ -740,7 +771,6 @@ function buildTree(
const parts = item.path.split(separator); const parts = item.path.split(separator);
// 定义特殊路径 // 定义特殊路径
// TODO: 如果菜单有多个节点,需要将此菜单作为独立一级的节点,而不是合并到上一级。 按照此规则, com.youlai.system 则是三个节点,而不是合并到一起,但是这里需要将 com.youlai.system 合并到一起,所以需要特殊处理
const specialPaths = [ const specialPaths = [
"src" + separator + "main", "src" + separator + "main",
"java", "java",
@@ -753,8 +783,6 @@ function buildTree(
).replace(/\./g, separator), ).replace(/\./g, separator),
]; ];
console.log("specialPaths", specialPaths);
// 检查路径中的特殊部分并合并它们 // 检查路径中的特殊部分并合并它们
const mergedParts: string[] = []; const mergedParts: string[] = [];
let buffer: string[] = []; let buffer: string[] = [];

View File

@@ -208,7 +208,8 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
"element-plus/es/components/steps/style/css", "element-plus/es/components/steps/style/css",
"element-plus/es/components/step/style/css", "element-plus/es/components/step/style/css",
"element-plus/es/components/avatar/style/css", "element-plus/es/components/avatar/style/css",
"sockjs-client/dist/sockjs.min.js", "element-plus/es/components/descriptions/style/css",
"element-plus/es/components/descriptions-item/style/css",
], ],
}, },
// 构建配置 // 构建配置