refactor: model => moal
parent
38a05a7637
commit
66a7969039
|
@ -0,0 +1,43 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="PasswordModal">
|
||||
import { ref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { passwordSchema } from './data'
|
||||
import { updateUserPwdApi } from '@/api/base/profile'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
|
||||
const title = ref('修改密码')
|
||||
|
||||
const [registerForm, { resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: passwordSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(() => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
})
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
await updateUserPwdApi(values.oldPassword, values.newPassword)
|
||||
setModalProps({ confirmLoading: true })
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="DeptModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { formSchema } from './dept.data'
|
||||
import { createDeptApi, getDeptApi, updateDeptApi } from '@/api/system/dept'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getDeptApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增部门' : '编辑部门'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateDeptApi(values)
|
||||
} else {
|
||||
await createDeptApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,62 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="DictDataModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { dataFormSchema } from './dict.data'
|
||||
import { createDictDataApi, getDictDataApi, updateDictDataApi } from '@/api/system/dict/data'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: dataFormSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getDictDataApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
} else {
|
||||
setFieldsValue({
|
||||
dictType: data.record
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增字典分类' : '编辑字典分类'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateDictDataApi(values)
|
||||
} else {
|
||||
await createDictDataApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="DictTypeModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { typeFormSchema } from './dict.type'
|
||||
import { createDictTypeApi, getDictTypeApi, updateDictTypeApi } from '@/api/system/dict/type'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: typeFormSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getDictTypeApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增字典分类' : '编辑字典分类'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateDictTypeApi(values)
|
||||
} else {
|
||||
await createDictTypeApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="ErrorCodeModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { formSchema } from './errorCode.data'
|
||||
import { createErrorCodeApi, getErrorCodeApi, updateErrorCodeApi } from '@/api/system/errorCode'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getErrorCodeApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增错误码' : '编辑错误码'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateErrorCodeApi(values)
|
||||
} else {
|
||||
await createErrorCodeApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="MailAccountModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { formSchema } from './account.data'
|
||||
import { createMailAccountApi, getMailAccountApi, updateMailAccountApi } from '@/api/system/mail/account'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getMailAccountApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增邮箱' : '编辑邮箱'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateMailAccountApi(values)
|
||||
} else {
|
||||
await createMailAccountApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="MailTemplateModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { formSchema } from './template.data'
|
||||
import { createMailTemplateApi, getMailTemplateApi, updateMailTemplateApi } from '@/api/system/mail/template'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getMailTemplateApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增邮箱' : '编辑邮箱'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateMailTemplateApi(values)
|
||||
} else {
|
||||
await createMailTemplateApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="MenuModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { formSchema } from './menu.data'
|
||||
import { createMenuApi, getMenuApi, updateMenuApi } from '@/api/system/menu'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getMenuApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增菜单' : '编辑菜单'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateMenuApi(values)
|
||||
} else {
|
||||
await createMenuApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="NoticeModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { formSchema } from './notice.data'
|
||||
import { createNoticeApi, getNoticeApi, updateNoticeApi } from '@/api/system/notice'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getNoticeApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增公告' : '编辑公告'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateNoticeApi(values)
|
||||
} else {
|
||||
await createNoticeApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="ClientModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { formSchema } from './client.data'
|
||||
import { createOAuth2ClientApi, getOAuth2ClientApi, updateOAuth2ClientApi } from '@/api/system/oauth2/client'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 160,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getOAuth2ClientApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增应用' : '编辑应用'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateOAuth2ClientApi(values)
|
||||
} else {
|
||||
await createOAuth2ClientApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="PostModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { formSchema } from './post.data'
|
||||
import { createPostApi, getPostApi, updatePostApi } from '@/api/system/post'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getPostApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增岗位' : '编辑岗位'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updatePostApi(values)
|
||||
} else {
|
||||
await createPostApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="RoleModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { formSchema } from './role.data'
|
||||
import { createRoleApi, getRoleApi, updateRoleApi } from '@/api/system/role'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getRoleApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateRoleApi(values)
|
||||
} else {
|
||||
await createRoleApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="RoleScopeModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { dataScopeFormSchema } from './role.data'
|
||||
import { createRoleApi, getRoleApi, updateRoleApi } from '@/api/system/role'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: dataScopeFormSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getRoleApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateRoleApi(values)
|
||||
} else {
|
||||
await createRoleApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="SensitiveWordModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { formSchema } from './sensitiveWord.data'
|
||||
import { createSensitiveWordApi, getSensitiveWordApi, updateSensitiveWordApi } from '@/api/system/sensitiveWord'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getSensitiveWordApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增敏感词' : '编辑敏感词'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateSensitiveWordApi(values)
|
||||
} else {
|
||||
await createSensitiveWordApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="SmsTemplateModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { formSchema } from './smsTemplate.data'
|
||||
import { createSmsTemplateApi, getSmsTemplateApi, updateSmsTemplateApi } from '@/api/system/sms/smsTemplate'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getSmsTemplateApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增短信模版' : '编辑短信模版'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateSmsTemplateApi(values)
|
||||
} else {
|
||||
await createSmsTemplateApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="TenantModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { formSchema } from './tenant.data'
|
||||
import { createTenantApi, getTenantApi, updateTenantApi } from '@/api/system/tenant'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getTenantApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增租户' : '编辑租户'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateTenantApi(values)
|
||||
} else {
|
||||
await createTenantApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="TenantPackageModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { formSchema } from './tenantPackage.data'
|
||||
import { createTenantPackageApi, getTenantPackageApi, updateTenantPackageApi } from '@/api/system/tenantPackage'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getTenantPackageApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增租户套餐' : '编辑租户套餐'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateTenantPackageApi(values)
|
||||
} else {
|
||||
await createTenantPackageApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,58 @@
|
|||
<template>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
||||
<BasicForm @register="registerForm" />
|
||||
</BasicModal>
|
||||
</template>
|
||||
<script lang="ts" setup name="UserModal">
|
||||
import { ref, computed, unref } from 'vue'
|
||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||
import { BasicForm, useForm } from '@/components/Form'
|
||||
import { formSchema } from './user.data'
|
||||
import { createUserApi, getUserApi, updateUserApi } from '@/api/system/user'
|
||||
|
||||
const emit = defineEmits(['success', 'register'])
|
||||
const isUpdate = ref(true)
|
||||
const rowId = ref()
|
||||
|
||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||
labelWidth: 100,
|
||||
baseColProps: { span: 24 },
|
||||
schemas: formSchema,
|
||||
showActionButtonGroup: false,
|
||||
actionColOptions: {
|
||||
span: 23
|
||||
}
|
||||
})
|
||||
|
||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||
resetFields()
|
||||
setModalProps({ confirmLoading: false })
|
||||
isUpdate.value = !!data?.isUpdate
|
||||
|
||||
if (unref(isUpdate)) {
|
||||
const res = await getUserApi(data.record.id)
|
||||
rowId.value = res.id
|
||||
setFieldsValue({
|
||||
...res
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增用户' : '编辑用户'))
|
||||
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
const values = await validate()
|
||||
setModalProps({ confirmLoading: true })
|
||||
if (unref(isUpdate)) {
|
||||
await updateUserApi(values)
|
||||
} else {
|
||||
await createUserApi(values)
|
||||
}
|
||||
closeModal()
|
||||
emit('success')
|
||||
} finally {
|
||||
setModalProps({ confirmLoading: false })
|
||||
}
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue