From 8e1a4a4705261288f1cf5052659b36d993b61077 Mon Sep 17 00:00:00 2001 From: icssoa <2570063477@qq.com> Date: Mon, 5 Apr 2021 17:00:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20crud=20=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cool/modules/chat/components/chat.vue | 9 ++---- .../components/context-menu/context-menu.tsx | 12 ++++---- .../modules/crud/components/dialog/index.tsx | 6 +++- .../modules/crud/components/form/index.tsx | 10 +++++-- src/cool/modules/crud/components/query.tsx | 12 ++++---- src/cool/modules/crud/types/form.d.ts | 4 +-- src/cool/modules/crud/types/render.d.ts | 2 +- src/cool/modules/crud/utils/vnode.tsx | 29 ++++++++++--------- .../modules/demo/components/crud/table.vue | 21 ++++++-------- src/core/set/router.ts | 3 +- 10 files changed, 56 insertions(+), 52 deletions(-) diff --git a/src/cool/modules/chat/components/chat.vue b/src/cool/modules/chat/components/chat.vue index cd5502d..2665258 100644 --- a/src/cool/modules/chat/components/chat.vue +++ b/src/cool/modules/chat/components/chat.vue @@ -39,12 +39,7 @@
- +
@@ -61,6 +56,7 @@ import Message from "./message.vue"; import Input from "./input.vue"; import { parseContent } from "../utils"; import { useRefs } from "/@/core"; +import NotifyMp3 from "../static/notify.mp3"; export default defineComponent({ name: "cl-chat", @@ -255,6 +251,7 @@ export default defineComponent({ }); return { + NotifyMp3, refs, session, sessionVisible, diff --git a/src/cool/modules/crud/components/context-menu/context-menu.tsx b/src/cool/modules/crud/components/context-menu/context-menu.tsx index 8b7b9d8..d4fde4b 100644 --- a/src/cool/modules/crud/components/context-menu/context-menu.tsx +++ b/src/cool/modules/crud/components/context-menu/context-menu.tsx @@ -14,7 +14,7 @@ export default defineComponent({ const { refs, setRefs }: any = useRefs(); // 菜单是否可见 - const visible = ref(props.visible); + const visible2 = ref(props.visible); // 按钮列表 const list = ref>([]); @@ -58,7 +58,7 @@ export default defineComponent({ // 关闭菜单 function close() { - visible.value = false; + visible2.value = false; ids.value = ""; } @@ -95,7 +95,7 @@ export default defineComponent({ stopDefault(event); // 显示菜单 - visible.value = true; + visible2.value = true; return { close @@ -124,7 +124,7 @@ export default defineComponent({ } onMounted(function () { - if (visible.value) { + if (visible2.value) { // 添加到 body 下 document.body.appendChild(refs.value["context-menu"]); // 关闭事件 @@ -139,7 +139,7 @@ export default defineComponent({ return { refs, - visible, + visible2, ids, style, list, @@ -193,7 +193,7 @@ export default defineComponent({ } return ( - ctx.visible && ( + ctx.visible2 && (
(false); + const fullscreen = ref(props.props.fullscreen); // 是否可见 const visible = ref(props.modelValue); @@ -114,6 +114,10 @@ export default defineComponent({ } function onOpen() { + // 初始值 + fullscreen.value = props.props.fullscreen; + + // 是否缓存 if (!props.keepAlive) { cacheKey.value += 1; } diff --git a/src/cool/modules/crud/components/form/index.tsx b/src/cool/modules/crud/components/form/index.tsx index e24f883..1138bf1 100644 --- a/src/cool/modules/crud/components/form/index.tsx +++ b/src/cool/modules/crud/components/form/index.tsx @@ -105,6 +105,10 @@ export default defineComponent({ done(); } + function onClosed() { + tabActive.value = null; + } + // 表单关闭前事件 function beforeClose() { if (conf.on?.close) { @@ -167,7 +171,7 @@ export default defineComponent({ for (const i in conf) { switch (i) { case "items": - conf.items = options.items || []; + conf.items = cloneDeep(options.items || []); break; case "title": case "width": @@ -240,6 +244,7 @@ export default defineComponent({ open, beforeClose, close, + onClosed, done, clear, submit, @@ -470,7 +475,8 @@ export default defineComponent({ props: { ...dialog.props, "before-close": ctx.beforeClose - } + }, + onClosed: ctx.onClosed }, { default() { diff --git a/src/cool/modules/crud/components/query.tsx b/src/cool/modules/crud/components/query.tsx index 6920fdd..8c89828 100644 --- a/src/cool/modules/crud/components/query.tsx +++ b/src/cool/modules/crud/components/query.tsx @@ -24,7 +24,7 @@ export default defineComponent({ setup(props, { emit }) { const crud = inject("crud") as Crud; - const list = ref>([]); + const list2 = ref>([]); // 更新数据列表 const update = () => { @@ -41,7 +41,7 @@ export default defineComponent({ } // 默认选择 - list.value = (props.list || []).map((e: any) => { + list2.value = (props.list || []).map((e: any) => { e.active = arr.some((v) => v === e.value); return e; }); @@ -57,14 +57,14 @@ export default defineComponent({ if (props.multiple) { item.active = true; } else { - list.value.map((e: any) => { + list2.value.map((e: any) => { e.active = e.value == item.value; }); } } // 过滤未选中的 - const selection = list.value.filter((e: any) => e.active).map((e: any) => e.value); + const selection = list2.value.filter((e: any) => e.active).map((e: any) => e.value); // 处理多选情况 const value = props.multiple ? selection : selection[0]; @@ -92,7 +92,7 @@ export default defineComponent({ ); return { - list, + list2, selectItem }; }, @@ -100,7 +100,7 @@ export default defineComponent({ render(ctx: any) { return (
- {ctx.list.map((item: any, index: number) => { + {ctx.list2.map((item: any, index: number) => { return (