From 703356a664f61f0bf8e1e46a297a9020d017c896 Mon Sep 17 00:00:00 2001 From: guoapeng Date: Tue, 15 Jul 2025 10:08:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B7=A5=E8=89=BA=E5=A4=8D=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/martixCraft/Edit/index.vue | 8 ++++++++ src/views/matrixCraft/index.vue | 11 ++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/martixCraft/Edit/index.vue b/src/components/martixCraft/Edit/index.vue index b9fd20d..4e35e61 100644 --- a/src/components/martixCraft/Edit/index.vue +++ b/src/components/martixCraft/Edit/index.vue @@ -19,6 +19,10 @@ const props = defineProps({ type: Number, default: 0, }, + type: { + type: String, + default: 'edit', + }, }) const emits = defineEmits(['ok', 'cancel']) const matrixList = ref<{ id: number, name: string }[]>([]) @@ -34,6 +38,10 @@ onMounted(async () => { await getMatrixList() if (props.id) { form.value = await getCraftById(props.id) + if (props.type === 'copy') { + form.value.id = undefined + form.value.name = `${form.value.name} - 副本` + } await nextTick(() => { form.value.times.forEach((item: any, index: number) => { sprayRefs.value[index].updateSelection(item.x1 * 5, item.y1 * 5, (item.x2 - item.x1) * 5, (item.y2 - item.y1) * 5) diff --git a/src/views/matrixCraft/index.vue b/src/views/matrixCraft/index.vue index 51edad3..074ac9a 100644 --- a/src/views/matrixCraft/index.vue +++ b/src/views/matrixCraft/index.vue @@ -50,8 +50,10 @@ const addHandle = () => { } const formId = ref(0) -const editHandle = () => { +const editType = ref<'edit' | 'copy'>('edit') +const editHandle = (type: 'edit' | 'copy') => { formId.value = selectedData.value[0]?.id + editType.value = type addVisible.value = true } @@ -105,9 +107,12 @@ const ok = () => { 新增 - + 编辑 + + 复制 + 删除 @@ -132,7 +137,7 @@ const ok = () => { - +