|
|
@ -19,7 +19,7 @@ import { reactive, ref, SetupContext } from 'vue' |
|
|
|
import { useI18n } from 'vue-i18n' |
|
|
|
import { useI18n } from 'vue-i18n' |
|
|
|
import { useAsyncState } from '@vueuse/core' |
|
|
|
import { useAsyncState } from '@vueuse/core' |
|
|
|
import { queryList } from '@/service/modules/queues' |
|
|
|
import { queryList } from '@/service/modules/queues' |
|
|
|
import { verifyTenantCode, createTenant } from '@/service/modules/tenants' |
|
|
|
import { verifyTenantCode, createTenant, updateTenant } from '@/service/modules/tenants' |
|
|
|
|
|
|
|
|
|
|
|
export function useModalData(props: any, ctx: SetupContext<("cancelModal" | "confirmModal")[]>) { |
|
|
|
export function useModalData(props: any, ctx: SetupContext<("cancelModal" | "confirmModal")[]>) { |
|
|
|
const { t } = useI18n() |
|
|
|
const { t } = useI18n() |
|
|
@ -27,9 +27,10 @@ export function useModalData(props: any, ctx: SetupContext<("cancelModal" | "con |
|
|
|
const variables = reactive({ |
|
|
|
const variables = reactive({ |
|
|
|
tenantFormRef: ref(), |
|
|
|
tenantFormRef: ref(), |
|
|
|
model: { |
|
|
|
model: { |
|
|
|
|
|
|
|
id: ref<number>(0), |
|
|
|
tenantCode: ref(''), |
|
|
|
tenantCode: ref(''), |
|
|
|
description: ref(''), |
|
|
|
description: ref(''), |
|
|
|
queueId: ref<number>(-1), |
|
|
|
queueId: ref<number>(0), |
|
|
|
generalOptions: [] |
|
|
|
generalOptions: [] |
|
|
|
}, |
|
|
|
}, |
|
|
|
rules: { |
|
|
|
rules: { |
|
|
@ -59,11 +60,13 @@ export function useModalData(props: any, ctx: SetupContext<("cancelModal" | "con |
|
|
|
return state |
|
|
|
return state |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const handleValidate = () => { |
|
|
|
const handleValidate = (statusRef: number) => { |
|
|
|
variables.tenantFormRef.validate((errors: any) => { |
|
|
|
variables.tenantFormRef.validate((errors: any) => { |
|
|
|
if (!errors) { |
|
|
|
if (!errors) { |
|
|
|
console.log('验证成功') |
|
|
|
console.log('验证成功') |
|
|
|
submitTenantModal() |
|
|
|
|
|
|
|
|
|
|
|
console.log('statusRef', statusRef) |
|
|
|
|
|
|
|
statusRef === 0 ? submitTenantModal() : updateTenantModal() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
console.log(errors, '验证失败') |
|
|
|
console.log(errors, '验证失败') |
|
|
|
return |
|
|
|
return |
|
|
@ -86,6 +89,18 @@ export function useModalData(props: any, ctx: SetupContext<("cancelModal" | "con |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const updateTenantModal = () => { |
|
|
|
|
|
|
|
const data = { |
|
|
|
|
|
|
|
tenantCode: variables.model.tenantCode, |
|
|
|
|
|
|
|
queueId: variables.model.queueId, |
|
|
|
|
|
|
|
description: variables.model.description, |
|
|
|
|
|
|
|
id: variables.model.id |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
updateTenant(data, {id: variables.model.id}).then((res: any) => { |
|
|
|
|
|
|
|
ctx.emit('confirmModal', props.showModalRef) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
return { |
|
|
|
variables, |
|
|
|
variables, |
|
|
|
getListData, |
|
|
|
getListData, |
|
|
|