refactor: model => modal
parent
c95b974dca
commit
38a05a7637
6
dev.md
6
dev.md
|
@ -20,13 +20,13 @@ pnpm dev
|
||||||
* 迁移方式
|
* 迁移方式
|
||||||
* 1. 在views下找到自己的开发模块
|
* 1. 在views下找到自己的开发模块
|
||||||
* 2. 复制system/post下三个文件到需要开发的路径下
|
* 2. 复制system/post下三个文件到需要开发的路径下
|
||||||
* 3. 将post.data.ts 以及 PostModel.vue 更名为需要开发的名称(以下用role代替)
|
* 3. 将post.data.ts 以及 PostModal.vue 更名为需要开发的名称(以下用role代替)
|
||||||
* 4. index.vue 中 修改script lang="ts" setup name="Post"中 name为Role PostModel 为RoleModel 详情看图<img alt="index.vue" width="100%" src="./docimg/1.png">
|
* 4. index.vue 中 修改script lang="ts" setup name="Post"中 name为Role PostModal 为RoleModal 详情看图<img alt="index.vue" width="100%" src="./docimg/1.png">
|
||||||
* 5. 修改post.data.ts 更名为role.data.ts 然后打开文档最上面的vue2代码,找到迁移的index.vue文件
|
* 5. 修改post.data.ts 更名为role.data.ts 然后打开文档最上面的vue2代码,找到迁移的index.vue文件
|
||||||
* 6. 修改 columns 为 vue2 中 el-table-column 的参数 title 为 vue2中label ,dataIndex 为 prop
|
* 6. 修改 columns 为 vue2 中 el-table-column 的参数 title 为 vue2中label ,dataIndex 为 prop
|
||||||
* 7. 修改 searchFormSchema 为 vue2 中 搜索工作栏 下 el-form-item 的参数,component 可参考其他已完成页面修改
|
* 7. 修改 searchFormSchema 为 vue2 中 搜索工作栏 下 el-form-item 的参数,component 可参考其他已完成页面修改
|
||||||
* 8. 修改 formSchema 为 vue2 中 添加或修改参数配置对话框 的参数,component 可参考其他已完成页面修改
|
* 8. 修改 formSchema 为 vue2 中 添加或修改参数配置对话框 的参数,component 可参考其他已完成页面修改
|
||||||
* 9. 修改 PostModel.vue ,更名为RoleModel.vue,如果所示的其他字段<img alt="index.vue" width="100%" src="./docimg/1.png">
|
* 9. 修改 PostModal.vue ,更名为RoleModal.vue,如果所示的其他字段<img alt="index.vue" width="100%" src="./docimg/1.png">
|
||||||
* 10. 基本上70%以上的页面这样就可以完成了,修改完成后测试一下增删改查,如果没有问题就可以提交pr了
|
* 10. 基本上70%以上的页面这样就可以完成了,修改完成后测试一下增删改查,如果没有问题就可以提交pr了
|
||||||
|
|
||||||
* 最后提交代码,本项目采用了cgz的形式,先git add 自己修改的文件,然后控制台pnpm commit,选择feat输入修改的页面,提交即可,他会自动检测代码是否有问题
|
* 最后提交代码,本项目采用了cgz的形式,先git add 自己修改的文件,然后控制台pnpm commit,选择feat输入修改的页面,提交即可,他会自动检测代码是否有问题
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
<template>
|
|
||||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit">
|
|
||||||
<BasicForm @register="registerForm" />
|
|
||||||
</BasicModal>
|
|
||||||
</template>
|
|
||||||
<script lang="ts" setup name="PasswordModel">
|
|
||||||
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>
|
|
|
@ -18,7 +18,7 @@
|
||||||
</template>
|
</template>
|
||||||
</List>
|
</List>
|
||||||
</CollapseContainer>
|
</CollapseContainer>
|
||||||
<PasswordModel @register="registerModal" @success="handleSuccess" />
|
<PasswordModal @register="registerModal" @success="handleSuccess" />
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { List } from 'ant-design-vue'
|
import { List } from 'ant-design-vue'
|
||||||
|
@ -26,7 +26,7 @@ import { CollapseContainer } from '@/components/Container/index'
|
||||||
import { secureSettingList } from './data'
|
import { secureSettingList } from './data'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import PasswordModel from './PasswordModel.vue'
|
import PasswordModal from './PasswordModal.vue'
|
||||||
|
|
||||||
const ListItem = List.Item
|
const ListItem = List.Item
|
||||||
const ListItemMeta = List.Item.Meta
|
const ListItemMeta = List.Item.Meta
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<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>
|
|
|
@ -29,7 +29,7 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<DeptModel @register="registerModal" @success="reload()" />
|
<DeptModal @register="registerModal" @success="reload()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="Dept">
|
<script lang="ts" setup name="Dept">
|
||||||
|
@ -38,7 +38,7 @@ import { handleTree } from '@/utils/tree'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import DeptModel from './DeptModel.vue'
|
import DeptModal from './DeptModal.vue'
|
||||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
import { getListSimpleUsersApi } from '@/api/system/user'
|
import { getListSimpleUsersApi } from '@/api/system/user'
|
||||||
import { deleteDeptApi, getDeptPageApi } from '@/api/system/dept'
|
import { deleteDeptApi, getDeptPageApi } from '@/api/system/dept'
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<DictDataModel @register="registerModal" @success="reload()" />
|
<DictDataModal @register="registerModal" @success="reload()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="DictData">
|
<script lang="ts" setup name="DictData">
|
||||||
|
@ -32,7 +32,7 @@ import { watch } from 'vue'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import DictDataModel from './DictDataModel.vue'
|
import DictDataModal from './DictDataModal.vue'
|
||||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
import { dataColumns, dataSearchFormSchema } from './dict.data'
|
import { dataColumns, dataSearchFormSchema } from './dict.data'
|
||||||
import { deleteDictDataApi, getDictDataPageApi } from '@/api/system/dict/data'
|
import { deleteDictDataApi, getDictDataPageApi } from '@/api/system/dict/data'
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
<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>
|
|
|
@ -1,58 +0,0 @@
|
||||||
<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>
|
|
|
@ -25,7 +25,7 @@
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<DictData class="w-1/2 xl:w-1/2" :searchInfo="searchInfo" />
|
<DictData class="w-1/2 xl:w-1/2" :searchInfo="searchInfo" />
|
||||||
<DictTypeModel @register="registerModal" @success="reload()" />
|
<DictTypeModal @register="registerModal" @success="reload()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="Dict">
|
<script lang="ts" setup name="Dict">
|
||||||
|
@ -34,7 +34,7 @@ import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import DictData from './DictData.vue'
|
import DictData from './DictData.vue'
|
||||||
import DictTypeModel from './DictTypeModel.vue'
|
import DictTypeModal from './DictTypeModal.vue'
|
||||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
import { typeColumns, typeSearchFormSchema } from './dict.type'
|
import { typeColumns, typeSearchFormSchema } from './dict.type'
|
||||||
import { deleteDictTypeApi, getDictTypePageApi } from '@/api/system/dict/type'
|
import { deleteDictTypeApi, getDictTypePageApi } from '@/api/system/dict/type'
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<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>
|
|
|
@ -25,14 +25,14 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<ErrorCodeModel @register="registerModal" @success="reload()" />
|
<ErrorCodeModal @register="registerModal" @success="reload()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="ErrorCode">
|
<script lang="ts" setup name="ErrorCode">
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import ErrorCodeModel from './ErrorCodeModel.vue'
|
import ErrorCodeModal from './ErrorCodeModal.vue'
|
||||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
import { ErrorCodePageReqVO, deleteErrorCodeApi, excelErrorCodeApi, getErrorCodePageApi } from '@/api/system/errorCode'
|
import { ErrorCodePageReqVO, deleteErrorCodeApi, excelErrorCodeApi, getErrorCodePageApi } from '@/api/system/errorCode'
|
||||||
import { columns, searchFormSchema } from './errorCode.data'
|
import { columns, searchFormSchema } from './errorCode.data'
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<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>
|
|
|
@ -24,14 +24,14 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<AccountModel @register="registerModal" @success="reload()" />
|
<AccountModal @register="registerModal" @success="reload()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="MailAccount">
|
<script lang="ts" setup name="MailAccount">
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import AccountModel from './AccountModel.vue'
|
import AccountModal from './AccountModal.vue'
|
||||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
import { deleteMailAccountApi, getMailAccountPageApi } from '@/api/system/mail/account'
|
import { deleteMailAccountApi, getMailAccountPageApi } from '@/api/system/mail/account'
|
||||||
import { columns, searchFormSchema } from './account.data'
|
import { columns, searchFormSchema } from './account.data'
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<template>
|
|
||||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
|
||||||
<BasicForm @register="registerForm" />
|
|
||||||
</BasicModal>
|
|
||||||
</template>
|
|
||||||
<script lang="ts" setup name="MailTemplateModel">
|
|
||||||
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>
|
|
|
@ -24,14 +24,14 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<TemplateModel @register="registerModal" @success="reload()" />
|
<TemplateModal @register="registerModal" @success="reload()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="MailTemplate">
|
<script lang="ts" setup name="MailTemplate">
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import TemplateModel from './TemplateModel.vue'
|
import TemplateModal from './TemplateModal.vue'
|
||||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
import { deleteMailTemplateApi, getMailTemplatePageApi } from '@/api/system/mail/template'
|
import { deleteMailTemplateApi, getMailTemplatePageApi } from '@/api/system/mail/template'
|
||||||
import { columns, searchFormSchema } from './template.data'
|
import { columns, searchFormSchema } from './template.data'
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<template>
|
|
||||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
|
||||||
<BasicForm @register="registerForm" />
|
|
||||||
</BasicModal>
|
|
||||||
</template>
|
|
||||||
<script lang="ts" setup name="MenuModel">
|
|
||||||
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>
|
|
|
@ -26,7 +26,7 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<DeptModel @register="registerModal" @success="reload()" />
|
<MenuModal @register="registerModal" @success="reload()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="Menu">
|
<script lang="ts" setup name="Menu">
|
||||||
|
@ -34,7 +34,7 @@ import { handleTree } from '@/utils/tree'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import DeptModel from './MenuModel.vue'
|
import MenuModal from './MenuModal.vue'
|
||||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
import { deleteMenuApi, getMenuListApi } from '@/api/system/menu'
|
import { deleteMenuApi, getMenuListApi } from '@/api/system/menu'
|
||||||
import { columns, searchFormSchema } from './menu.data'
|
import { columns, searchFormSchema } from './menu.data'
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<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>
|
|
|
@ -31,7 +31,7 @@
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import NoticeModal from './NoticeModel.vue'
|
import NoticeModal from './NoticeModal.vue'
|
||||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
import { deleteNoticeApi, getNoticePageApi } from '@/api/system/notice'
|
import { deleteNoticeApi, getNoticePageApi } from '@/api/system/notice'
|
||||||
import { columns, searchFormSchema } from './notice.data'
|
import { columns, searchFormSchema } from './notice.data'
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<template>
|
|
||||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
|
||||||
<BasicForm @register="registerForm" />
|
|
||||||
</BasicModal>
|
|
||||||
</template>
|
|
||||||
<script lang="ts" setup name="ClientModel">
|
|
||||||
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>
|
|
|
@ -24,14 +24,14 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<ClientModel @register="registerModal" @success="reload()" />
|
<ClientModal @register="registerModal" @success="reload()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="Client">
|
<script lang="ts" setup name="Client">
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import ClientModel from './ClientModel.vue'
|
import ClientModal from './ClientModal.vue'
|
||||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
import { deleteOAuth2ClientApi, getOAuth2ClientPageApi } from '@/api/system/oauth2/client'
|
import { deleteOAuth2ClientApi, getOAuth2ClientPageApi } from '@/api/system/oauth2/client'
|
||||||
import { columns, searchFormSchema } from './client.data'
|
import { columns, searchFormSchema } from './client.data'
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<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>
|
|
|
@ -25,14 +25,14 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<PostModel @register="registerModal" @success="reload()" />
|
<PostModal @register="registerModal" @success="reload()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="Post">
|
<script lang="ts" setup name="Post">
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import PostModel from './PostModel.vue'
|
import PostModal from './PostModal.vue'
|
||||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
import { PostExportReqVO, deletePostApi, exportPostApi, getPostPageApi } from '@/api/system/post'
|
import { PostExportReqVO, deletePostApi, exportPostApi, getPostPageApi } from '@/api/system/post'
|
||||||
import { columns, searchFormSchema } from './post.data'
|
import { columns, searchFormSchema } from './post.data'
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<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>
|
|
|
@ -1,58 +0,0 @@
|
||||||
<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 { 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>
|
|
|
@ -27,14 +27,14 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<RoleModel @register="registerModal" @success="reload()" />
|
<RoleModal @register="registerModal" @success="reload()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="Role">
|
<script lang="ts" setup name="Role">
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import RoleModel from './RoleModel.vue'
|
import RoleModal from './RoleModal.vue'
|
||||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
import { RoleExportReqVO, deleteRoleApi, exportRoleApi, getRolePageApi } from '@/api/system/role'
|
import { RoleExportReqVO, deleteRoleApi, exportRoleApi, getRolePageApi } from '@/api/system/role'
|
||||||
import { columns, searchFormSchema } from './role.data'
|
import { columns, searchFormSchema } from './role.data'
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<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>
|
|
|
@ -25,7 +25,7 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<SensitiveWordModel @register="registerModal" @success="reload()" />
|
<SensitiveWordModal @register="registerModal" @success="reload()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="SensitiveWord">
|
<script lang="ts" setup name="SensitiveWord">
|
||||||
|
@ -37,7 +37,7 @@ import {
|
||||||
getSensitiveWordPageApi
|
getSensitiveWordPageApi
|
||||||
} from '@/api/system/sensitiveWord'
|
} from '@/api/system/sensitiveWord'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import SensitiveWordModel from './SensitiveWordModel.vue'
|
import SensitiveWordModal from './SensitiveWordModal.vue'
|
||||||
import { columns, searchFormSchema } from './sensitiveWord.data'
|
import { columns, searchFormSchema } from './sensitiveWord.data'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<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>
|
|
|
@ -26,14 +26,14 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<SmsTemplateModel @register="registerModal" @success="reload()" />
|
<SmsTemplateModal @register="registerModal" @success="reload()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="SmsTemplate">
|
<script lang="ts" setup name="SmsTemplate">
|
||||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
import { SmsTemplateExportReqVO, deleteSmsTemplateApi, exportSmsTemplateApi, getSmsTemplatePageApi } from '@/api/system/sms/smsTemplate'
|
import { SmsTemplateExportReqVO, deleteSmsTemplateApi, exportSmsTemplateApi, getSmsTemplatePageApi } from '@/api/system/sms/smsTemplate'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import SmsTemplateModel from './SmsTemplateModel.vue'
|
import SmsTemplateModal from './SmsTemplateModal.vue'
|
||||||
import { columns, searchFormSchema } from './smsTemplate.data'
|
import { columns, searchFormSchema } from './smsTemplate.data'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<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>
|
|
|
@ -25,14 +25,14 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<TenantModel @register="registerModal" @success="reload()" />
|
<TenantModal @register="registerModal" @success="reload()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="Tenant">
|
<script lang="ts" setup name="Tenant">
|
||||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
import { TenantExportReqVO, deleteTenantApi, exportTenantApi, getTenantPageApi } from '@/api/system/tenant'
|
import { TenantExportReqVO, deleteTenantApi, exportTenantApi, getTenantPageApi } from '@/api/system/tenant'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import TenantModel from './TenantModel.vue'
|
import TenantModal from './TenantModal.vue'
|
||||||
import { columns, searchFormSchema } from './tenant.data'
|
import { columns, searchFormSchema } from './tenant.data'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<template>
|
|
||||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit">
|
|
||||||
<BasicForm @register="registerForm" />
|
|
||||||
</BasicModal>
|
|
||||||
</template>
|
|
||||||
<script lang="ts" setup name="TenantPackageModel">
|
|
||||||
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>
|
|
|
@ -24,14 +24,14 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<TenantPackageModel @register="registerModal" @success="reload()" />
|
<TenantPackageModal @register="registerModal" @success="reload()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="TenantPackage">
|
<script lang="ts" setup name="TenantPackage">
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import TenantPackageModel from './TenantPackageModel.vue'
|
import TenantPackageModal from './TenantPackageModal.vue'
|
||||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
import { deleteTenantPackageApi, getTenantPackagePageApi } from '@/api/system/tenantPackage'
|
import { deleteTenantPackageApi, getTenantPackagePageApi } from '@/api/system/tenantPackage'
|
||||||
import { columns, searchFormSchema } from './tenantPackage.data'
|
import { columns, searchFormSchema } from './tenantPackage.data'
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
<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>
|
|
|
@ -26,7 +26,7 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</BasicTable>
|
</BasicTable>
|
||||||
<UserModel @register="registerModal" @success="reload()" />
|
<UserModal @register="registerModal" @success="reload()" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="User">
|
<script lang="ts" setup name="User">
|
||||||
|
@ -34,7 +34,7 @@ import { reactive } from 'vue'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { useMessage } from '@/hooks/web/useMessage'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import { useModal } from '@/components/Modal'
|
import { useModal } from '@/components/Modal'
|
||||||
import UserModel from './UserModel.vue'
|
import UserModal from './UserModal.vue'
|
||||||
import DeptTree from './DeptTree.vue'
|
import DeptTree from './DeptTree.vue'
|
||||||
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
import { BasicTable, useTable, TableAction } from '@/components/Table'
|
||||||
import { columns, searchFormSchema } from './user.data'
|
import { columns, searchFormSchema } from './user.data'
|
||||||
|
|
Loading…
Reference in New Issue