mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-14 06:42:51 +00:00
新增模块
This commit is contained in:
parent
b4886a77e4
commit
2f502b5a6c
@ -10,7 +10,7 @@
|
|||||||
content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0"
|
content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0"
|
||||||
/>
|
/>
|
||||||
<title></title>
|
<title></title>
|
||||||
<link rel="icon" href="favicon.ico" />
|
<link rel="icon" href="./favicon.ico" />
|
||||||
<style>
|
<style>
|
||||||
html,
|
html,
|
||||||
body,
|
body,
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" name="a-menu" setup>
|
<script lang="ts" name="a-menu" setup>
|
||||||
import { onMounted, ref } from "vue";
|
import { ref, watch } from "vue";
|
||||||
import { useBase } from "/$/base";
|
import { useBase } from "/$/base";
|
||||||
import { useCool } from "/@/cool";
|
import { useCool } from "/@/cool";
|
||||||
import { Menu } from "../../types";
|
import { Menu } from "../../types";
|
||||||
@ -27,7 +27,7 @@ const { menu } = useBase();
|
|||||||
const active = ref("");
|
const active = ref("");
|
||||||
|
|
||||||
// 选择导航
|
// 选择导航
|
||||||
function select(index: number) {
|
function select(index: any) {
|
||||||
menu.setMenu(index);
|
menu.setMenu(index);
|
||||||
|
|
||||||
// 获取第一个菜单地址
|
// 获取第一个菜单地址
|
||||||
@ -35,8 +35,8 @@ function select(index: number) {
|
|||||||
router.push(url);
|
router.push(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(function () {
|
// 刷新
|
||||||
// 设置默认
|
function refresh() {
|
||||||
function deep(e: Menu.Item, i: number) {
|
function deep(e: Menu.Item, i: number) {
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -56,10 +56,27 @@ onMounted(function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.group.forEach((e, i) => {
|
menu.group.forEach(deep);
|
||||||
deep(e, i);
|
}
|
||||||
});
|
|
||||||
});
|
// 监听分组
|
||||||
|
watch(
|
||||||
|
() => menu.group.length,
|
||||||
|
() => {
|
||||||
|
refresh();
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 监听路由
|
||||||
|
watch(
|
||||||
|
() => route.path,
|
||||||
|
() => {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@ -95,8 +95,10 @@ import { setFocus, useCrud, useTable, useUpsert } from "@cool-vue/crud";
|
|||||||
import { useCool } from "/@/cool";
|
import { useCool } from "/@/cool";
|
||||||
import { deepTree } from "/@/cool/utils";
|
import { deepTree } from "/@/cool/utils";
|
||||||
import AutoMenu from "/$/magic/components/auto-menu/index.vue";
|
import AutoMenu from "/$/magic/components/auto-menu/index.vue";
|
||||||
|
import { useStore } from "../store";
|
||||||
|
|
||||||
const { service, mitt } = useCool();
|
const { service, mitt } = useCool();
|
||||||
|
const { menu } = useStore();
|
||||||
|
|
||||||
// cl-table
|
// cl-table
|
||||||
const Table = useTable({
|
const Table = useTable({
|
||||||
@ -341,6 +343,7 @@ const Crud = useCrud(
|
|||||||
});
|
});
|
||||||
|
|
||||||
render(deepTree(list));
|
render(deepTree(list));
|
||||||
|
menu.get();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ModuleConfig } from "/@/cool";
|
import { ModuleConfig } from "/@/cool";
|
||||||
import { addDeclare } from "/$/editor";
|
import { addDeclare } from "/$/extend";
|
||||||
import { CodeDeclare } from "./dict";
|
import { CodeDeclare } from "./dict";
|
||||||
|
|
||||||
export default (): ModuleConfig => {
|
export default (): ModuleConfig => {
|
||||||
|
|||||||
@ -199,19 +199,14 @@ const Upsert = useUpsert({
|
|||||||
// });
|
// });
|
||||||
|
|
||||||
// 直接取列表的数据返回
|
// 直接取列表的数据返回
|
||||||
done({
|
done(data);
|
||||||
...data,
|
|
||||||
age: 18
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 提交钩子
|
// 提交钩子
|
||||||
onSubmit(data, { next, close, done }) {
|
onSubmit(data, { next, close, done }) {
|
||||||
|
console.log("onSubmit", data);
|
||||||
// 继续请求 update/add 接口
|
// 继续请求 update/add 接口
|
||||||
next({
|
next(data);
|
||||||
...data,
|
|
||||||
code: "615206459"
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 打开后
|
// 打开后
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
export * from "./components/monaco/declare";
|
|
||||||
@ -5,12 +5,15 @@ export default (): ModuleConfig => {
|
|||||||
// 根据使用情况选择组件注释,避免资源过大问题
|
// 根据使用情况选择组件注释,避免资源过大问题
|
||||||
components: [
|
components: [
|
||||||
// 富文本编辑器 https://www.npmjs.com/package/@wangeditor/editor
|
// 富文本编辑器 https://www.npmjs.com/package/@wangeditor/editor
|
||||||
() => import("./components/wang.vue"),
|
() => import("./editor/wang.vue"),
|
||||||
// 富文本编辑器 https://www.npmjs.com/package/quill
|
// 富文本编辑器 https://www.npmjs.com/package/quill
|
||||||
() => import("./components/quill.vue"),
|
() => import("./editor/quill.vue"),
|
||||||
// 代码编辑器 https://www.npmjs.com/package/monaco-editor
|
// 代码编辑器 https://www.npmjs.com/package/monaco-editor
|
||||||
() => import("./components/monaco/index.vue"),
|
() => import("./editor/monaco/index.vue"),
|
||||||
() => import("./components/preview.vue")
|
// 文本预览
|
||||||
|
() => import("./editor/preview.vue"),
|
||||||
|
// 省市区选择 https://github.com/modood/Administrative-divisions-of-China
|
||||||
|
() => import("./distpicker/index")
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
31
src/modules/extend/distpicker/index.tsx
Normal file
31
src/modules/extend/distpicker/index.tsx
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import { defineComponent } from "vue";
|
||||||
|
import { registerFormHook } from "@cool-vue/crud";
|
||||||
|
import data from "./pca.json";
|
||||||
|
|
||||||
|
registerFormHook("pca", (value, { method, form, prop }) => {
|
||||||
|
if (method == "bind") {
|
||||||
|
return [form.province, form.city, form.district];
|
||||||
|
} else {
|
||||||
|
const [province, city, district] = value || [];
|
||||||
|
form.province = province;
|
||||||
|
form.city = city;
|
||||||
|
form.district = district;
|
||||||
|
form[prop] = undefined;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
name: "cl-distpicker",
|
||||||
|
|
||||||
|
props: {
|
||||||
|
props: Object
|
||||||
|
},
|
||||||
|
|
||||||
|
setup(props) {
|
||||||
|
return () => {
|
||||||
|
return (
|
||||||
|
<el-cascader options={data} props={{ label: "name", value: "name", ...props }} />
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
5300
src/modules/extend/distpicker/pca.json
Normal file
5300
src/modules/extend/distpicker/pca.json
Normal file
File diff suppressed because it is too large
Load Diff
1
src/modules/extend/index.ts
Normal file
1
src/modules/extend/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from "./editor/monaco/declare";
|
||||||
@ -1,5 +0,0 @@
|
|||||||
import { ModuleConfig } from "/@/cool";
|
|
||||||
|
|
||||||
export default (): ModuleConfig => {
|
|
||||||
return {};
|
|
||||||
};
|
|
||||||
@ -280,10 +280,10 @@
|
|||||||
"@babel/helper-validator-identifier" "^7.19.1"
|
"@babel/helper-validator-identifier" "^7.19.1"
|
||||||
to-fast-properties "^2.0.0"
|
to-fast-properties "^2.0.0"
|
||||||
|
|
||||||
"@cool-vue/crud@^6.1.10":
|
"@cool-vue/crud@^6.1.11":
|
||||||
version "6.1.10"
|
version "6.1.11"
|
||||||
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-6.1.10.tgz#04e7247d157a8646b1b8df08439a0c2f0abb0e78"
|
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-6.1.11.tgz#c61151c067dcf4f3a5fac9dd3fad7d00e0cb6c6f"
|
||||||
integrity sha512-J3ARqqHKhoeweInNzfDlCQEq04PF7CbmFDYSGhoPlNdAIgm+RS6QYVAqmI0Jxeu49bnslaIKhNUNL9pCJiX8qQ==
|
integrity sha512-whgTbDi0SBBge1u9qXlSrstt9tkDCDdhH3xt7vomUwdkf8Yn0ElQwOvM1CqMHcU4k30AdWpaNYOunUsKbETTVA==
|
||||||
dependencies:
|
dependencies:
|
||||||
array.prototype.flat "^1.2.4"
|
array.prototype.flat "^1.2.4"
|
||||||
core-js "^3.21.1"
|
core-js "^3.21.1"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user