fix some bug

This commit is contained in:
Sense T 2024-04-12 22:26:35 +08:00
parent a098d3056c
commit 0012a697cb
5 changed files with 14 additions and 6 deletions

View File

@ -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<Events>) {
)
}
function DomainEditModal({ domain, show }: Props, { emit }: SetupContext<Events>) {
function DomainEditModal({ domain, show, }: Props, { emit }: SetupContext<Events>) {
return (
<NModal maskClosable={false} show={show}>
<NCard style={{ width: '640px' }} role='dialog'>

View File

@ -8,6 +8,8 @@ const { t } = i18n.global
type Props = {
domain: Domain
onRemoveDomain: (d: Domain) => void
onEditDomain: (d: Domain) => void
}
type Events = {

View File

@ -14,6 +14,7 @@ const { notification } = createDiscreteApi(['notification'])
type Props = {
domain: Domain
show: boolean
'onUpdate:show': (value: boolean) => void
}
type Events = {

View File

@ -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) ? <span>{t('common.new')}</span> : <span> t('common.edit')</span>}
{(!record || !record.id || record.id < 1) ? <span>{t('common.new')}</span> : <span> {t('common.edit')}</span>}
<span>{t('records._')}</span>
</>
)
@ -310,7 +312,7 @@ function modalActions({ record, domain }: Props, { emit }: SetupContext<Events>)
<NButton size='small' type='primary' loading={loading.value} attrType='submit'
disabled={invalidData.value !== (validationFlags.content | validationFlags.name)}
onClick={() => confirm({ record, domain, show: false }).then(() => { emit('reloadRecords'); emit('update:show', false) })}>
onClick={() => confirm(record, domain).then(() => { emit('reloadRecords'); emit('update:show', false) })}>
{{
icon: () => <NIcon component={Check} />,
default: () => t('common.confirm')

View File

@ -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 = {