新增模块

This commit is contained in:
icssoa 2023-03-16 16:24:52 +08:00
parent b4886a77e4
commit 2f502b5a6c
22 changed files with 5376 additions and 32 deletions

View File

@ -10,7 +10,7 @@
content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0"
/>
<title></title>
<link rel="icon" href="favicon.ico" />
<link rel="icon" href="./favicon.ico" />
<style>
html,
body,

View File

@ -15,7 +15,7 @@
</template>
<script lang="ts" name="a-menu" setup>
import { onMounted, ref } from "vue";
import { ref, watch } from "vue";
import { useBase } from "/$/base";
import { useCool } from "/@/cool";
import { Menu } from "../../types";
@ -27,7 +27,7 @@ const { menu } = useBase();
const active = ref("");
//
function select(index: number) {
function select(index: any) {
menu.setMenu(index);
//
@ -35,8 +35,8 @@ function select(index: number) {
router.push(url);
}
onMounted(function () {
//
//
function refresh() {
function deep(e: Menu.Item, i: number) {
switch (e.type) {
case 0:
@ -56,10 +56,27 @@ onMounted(function () {
}
}
menu.group.forEach((e, i) => {
deep(e, i);
});
});
menu.group.forEach(deep);
}
//
watch(
() => menu.group.length,
() => {
refresh();
},
{
immediate: true
}
);
//
watch(
() => route.path,
() => {
refresh();
}
);
</script>
<style lang="scss" scoped>

View File

@ -95,8 +95,10 @@ import { setFocus, useCrud, useTable, useUpsert } from "@cool-vue/crud";
import { useCool } from "/@/cool";
import { deepTree } from "/@/cool/utils";
import AutoMenu from "/$/magic/components/auto-menu/index.vue";
import { useStore } from "../store";
const { service, mitt } = useCool();
const { menu } = useStore();
// cl-table
const Table = useTable({
@ -341,6 +343,7 @@ const Crud = useCrud(
});
render(deepTree(list));
menu.get();
});
}
},

View File

@ -1,5 +1,5 @@
import { ModuleConfig } from "/@/cool";
import { addDeclare } from "/$/editor";
import { addDeclare } from "/$/extend";
import { CodeDeclare } from "./dict";
export default (): ModuleConfig => {

View File

@ -199,19 +199,14 @@ const Upsert = useUpsert({
// });
//
done({
...data,
age: 18
});
done(data);
},
//
onSubmit(data, { next, close, done }) {
console.log("onSubmit", data);
// update/add
next({
...data,
code: "615206459"
});
next(data);
},
//

View File

@ -1 +0,0 @@
export * from "./components/monaco/declare";

View File

@ -5,12 +5,15 @@ export default (): ModuleConfig => {
// 根据使用情况选择组件注释,避免资源过大问题
components: [
// 富文本编辑器 https://www.npmjs.com/package/@wangeditor/editor
() => import("./components/wang.vue"),
() => import("./editor/wang.vue"),
// 富文本编辑器 https://www.npmjs.com/package/quill
() => import("./components/quill.vue"),
() => import("./editor/quill.vue"),
// 代码编辑器 https://www.npmjs.com/package/monaco-editor
() => import("./components/monaco/index.vue"),
() => import("./components/preview.vue")
() => import("./editor/monaco/index.vue"),
// 文本预览
() => import("./editor/preview.vue"),
// 省市区选择 https://github.com/modood/Administrative-divisions-of-China
() => import("./distpicker/index")
]
};
};

View 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 }} />
);
};
}
});

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
export * from "./editor/monaco/declare";

View File

@ -1,5 +0,0 @@
import { ModuleConfig } from "/@/cool";
export default (): ModuleConfig => {
return {};
};

View File

@ -280,10 +280,10 @@
"@babel/helper-validator-identifier" "^7.19.1"
to-fast-properties "^2.0.0"
"@cool-vue/crud@^6.1.10":
version "6.1.10"
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-6.1.10.tgz#04e7247d157a8646b1b8df08439a0c2f0abb0e78"
integrity sha512-J3ARqqHKhoeweInNzfDlCQEq04PF7CbmFDYSGhoPlNdAIgm+RS6QYVAqmI0Jxeu49bnslaIKhNUNL9pCJiX8qQ==
"@cool-vue/crud@^6.1.11":
version "6.1.11"
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-6.1.11.tgz#c61151c067dcf4f3a5fac9dd3fad7d00e0cb6c6f"
integrity sha512-whgTbDi0SBBge1u9qXlSrstt9tkDCDdhH3xt7vomUwdkf8Yn0ElQwOvM1CqMHcU4k30AdWpaNYOunUsKbETTVA==
dependencies:
array.prototype.flat "^1.2.4"
core-js "^3.21.1"