From 0012a697cbf2712228a0c78670180c317f0132cf Mon Sep 17 00:00:00 2001 From: Sense T Date: Fri, 12 Apr 2024 22:26:35 +0800 Subject: [PATCH] fix some bug --- web/src/components/domains/DomainEditModal.tsx | 3 ++- web/src/components/domains/DomainOps.tsx | 6 ++++-- web/src/components/domains/DomainRemoveModal.tsx | 1 + web/src/components/records/RecordEditModal.tsx | 8 +++++--- web/src/components/records/RecordOps.tsx | 2 ++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/web/src/components/domains/DomainEditModal.tsx b/web/src/components/domains/DomainEditModal.tsx index fff210f..070b37c 100644 --- a/web/src/components/domains/DomainEditModal.tsx +++ b/web/src/components/domains/DomainEditModal.tsx @@ -90,6 +90,7 @@ const rules = { type Props = { domain: Domain show: boolean + 'onUpdate:show': (v: boolean) => void } type Events = { @@ -202,7 +203,7 @@ function modalActions({ domain }: Props, { emit }: SetupContext) { ) } -function DomainEditModal({ domain, show }: Props, { emit }: SetupContext) { +function DomainEditModal({ domain, show, }: Props, { emit }: SetupContext) { return ( diff --git a/web/src/components/domains/DomainOps.tsx b/web/src/components/domains/DomainOps.tsx index 5434cca..a389815 100644 --- a/web/src/components/domains/DomainOps.tsx +++ b/web/src/components/domains/DomainOps.tsx @@ -8,6 +8,8 @@ const { t } = i18n.global type Props = { domain: Domain + onRemoveDomain: (d: Domain) => void + onEditDomain: (d: Domain) => void } type Events = { @@ -83,8 +85,8 @@ DomainOps.props = { } DomainOps.emits = { - removeDomain: (d:Domain) => d, - editDomain: (d:Domain) => d + removeDomain: (d: Domain) => d, + editDomain: (d: Domain) => d } as Events export default DomainOps \ No newline at end of file diff --git a/web/src/components/domains/DomainRemoveModal.tsx b/web/src/components/domains/DomainRemoveModal.tsx index f7cc50c..cd2e09b 100644 --- a/web/src/components/domains/DomainRemoveModal.tsx +++ b/web/src/components/domains/DomainRemoveModal.tsx @@ -14,6 +14,7 @@ const { notification } = createDiscreteApi(['notification']) type Props = { domain: Domain show: boolean + 'onUpdate:show': (value: boolean) => void } type Events = { diff --git a/web/src/components/records/RecordEditModal.tsx b/web/src/components/records/RecordEditModal.tsx index a1dbbf6..ead169e 100644 --- a/web/src/components/records/RecordEditModal.tsx +++ b/web/src/components/records/RecordEditModal.tsx @@ -45,6 +45,8 @@ type Props = { record: Record domain: string show: boolean + 'onReloadRecords': () => void + 'onUpdate:show': (v: boolean) => void } type Events = { @@ -273,7 +275,7 @@ function buildRules(record: Record): FormRules { } } -async function confirm({ record, domain }: Props) { +async function confirm(record: Record, domain: string) { loading.value = true; try { if (!record.id || record.id < 1) { @@ -292,7 +294,7 @@ async function confirm({ record, domain }: Props) { function modalHeader({ record }: Props) { return ( <> - {(!record || !record.id || record.id < 1) ? {t('common.new')} : t('common.edit')} + {(!record || !record.id || record.id < 1) ? {t('common.new')} : {t('common.edit')}} {t('records._')} ) @@ -310,7 +312,7 @@ function modalActions({ record, domain }: Props, { emit }: SetupContext) confirm({ record, domain, show: false }).then(() => { emit('reloadRecords'); emit('update:show', false) })}> + onClick={() => confirm(record, domain).then(() => { emit('reloadRecords'); emit('update:show', false) })}> {{ icon: () => , default: () => t('common.confirm') diff --git a/web/src/components/records/RecordOps.tsx b/web/src/components/records/RecordOps.tsx index 6d0f023..e7d8ce8 100644 --- a/web/src/components/records/RecordOps.tsx +++ b/web/src/components/records/RecordOps.tsx @@ -8,6 +8,8 @@ const { t } = i18n.global type Props = { record: Record domain: string + onRecordDelete: (domain: string, record: Record) => void + onEditRecord: (domain: string, record: Record) => void } type Events = {