mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-12 13:42:50 +00:00
优化菜单
This commit is contained in:
parent
833ea0c18c
commit
2327e1527f
@ -2,7 +2,7 @@ import { createDir, error, firstUpperCase, readFile, toCamel } from "../utils";
|
||||
import { join } from "path";
|
||||
import { Entity, DistPath } from "./config";
|
||||
import axios from "axios";
|
||||
import { isArray, isEmpty, last, merge } from "lodash";
|
||||
import { isArray, isEmpty, last, merge, unionBy } from "lodash";
|
||||
import { createWriteStream } from "fs";
|
||||
import prettier from "prettier";
|
||||
import { proxy } from "../../../src/config/proxy";
|
||||
@ -61,6 +61,8 @@ async function getData(temps?: Eps.Entity[]) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
list = unionBy(list, "prefix");
|
||||
}
|
||||
|
||||
// 创建 json 文件
|
||||
@ -107,6 +109,7 @@ async function createDescribe({ list, service }: { list: Eps.Entity[]; service:
|
||||
for (const item of list) {
|
||||
if (!item.name) continue;
|
||||
const t = [`interface ${item.name} {`];
|
||||
|
||||
for (const col of item.columns || []) {
|
||||
// 描述
|
||||
t.push("\n");
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
"lint:eslint": "eslint \"{src}/**/*.{vue,ts,tsx}\" --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cool-vue/crud": "^7.0.3",
|
||||
"@cool-vue/crud": "^7.0.4",
|
||||
"@element-plus/icons-vue": "^2.1.0",
|
||||
"@vueuse/core": "^10.4.0",
|
||||
"@wangeditor/editor": "^5.1.23",
|
||||
|
||||
@ -73,6 +73,11 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
|
||||
// 点击事件, 阻止冒泡
|
||||
function onClick(event: MouseEvent) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
return () => {
|
||||
return (
|
||||
<el-switch
|
||||
@ -80,6 +85,7 @@ export default defineComponent({
|
||||
active-value={props.activeValue}
|
||||
inactive-value={props.inactiveValue}
|
||||
onChange={onChange}
|
||||
onClick={onClick}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@ -264,7 +264,11 @@ const Upsert = useUpsert({
|
||||
{
|
||||
prop: "parentId",
|
||||
label: "上级节点",
|
||||
hook: "empty",
|
||||
hook: {
|
||||
submit(value) {
|
||||
return value === "" ? null : value;
|
||||
}
|
||||
},
|
||||
component: {
|
||||
name: "slot-parentId"
|
||||
}
|
||||
|
||||
@ -85,6 +85,16 @@ function open() {
|
||||
props: {
|
||||
placeholder: "请输入菜单路由,如:/test"
|
||||
}
|
||||
},
|
||||
rules: {
|
||||
required: true,
|
||||
validator(_, value, callback) {
|
||||
if (!(value || "").startsWith("/")) {
|
||||
callback(new Error("必须以 / 开头"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -198,7 +198,10 @@ export function useMenu() {
|
||||
function create(data: EpsModule): Promise<() => void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 视图文件路径
|
||||
data.viewPath = `modules/${data.module}/views/${last(data.router?.split("/"))}.vue`;
|
||||
data.viewPath = `modules/${data.module}/views${data.router?.replace(
|
||||
`/${data.module}`,
|
||||
""
|
||||
)}.vue`;
|
||||
|
||||
// 添加菜单
|
||||
service.base.sys.menu
|
||||
|
||||
@ -295,10 +295,10 @@
|
||||
mitt "^3.0.1"
|
||||
vue "^3.3.4"
|
||||
|
||||
"@cool-vue/crud@^7.0.3":
|
||||
version "7.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-7.0.3.tgz#a6e03ac5bcd22690fae3f61549fe9ff744291a1b"
|
||||
integrity sha512-DyzIZGHL8CxY/Mr8SGfBQgLpl1SLxY6COBKR5khoXqhUQ5XqHKIbjYz5h2UwZh9GfY+nswYaW4vCbKumKiS8KQ==
|
||||
"@cool-vue/crud@^7.0.4":
|
||||
version "7.0.4"
|
||||
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-7.0.4.tgz#4f7a33e8ded0930b967325907fbd507404cf6447"
|
||||
integrity sha512-qS2PvqhXOiJ0Grq8uvYkjDdA6JgpjSO2ODbl+9/XPERCah3ptDLo/dGn5ChlYD2z53T5/Vhch6IQPiXbOjfsOg==
|
||||
dependencies:
|
||||
"@cool-vue/crud" "^7.0.1-beta14"
|
||||
array.prototype.flat "^1.2.4"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user