feat: modal style
							parent
							
								
									2cfbb8d094
								
							
						
					
					
						commit
						d0dbb951cf
					
				|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="ConfigModal"> | <script lang="ts" setup name="ConfigModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './config.data' | import { formSchema } from './config.data' | ||||||
|  | @ -12,10 +12,9 @@ import { createConfig, getConfig, updateConfig } from '@/api/infra/config' | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 120, | ||||||
|   baseColProps: { span: 24 }, |   baseColProps: { span: 24 }, | ||||||
|   schemas: formSchema, |   schemas: formSchema, | ||||||
|   showActionButtonGroup: false, |   showActionButtonGroup: false, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getConfig(data.record.id) |     const res = await getConfig(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增配置' : '编辑配置')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="DataSourceConfigModal"> | <script lang="ts" setup name="DataSourceConfigModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './dataSourceConfig.data' | import { formSchema } from './dataSourceConfig.data' | ||||||
|  | @ -12,10 +12,9 @@ import { createPost, getPost, updatePost } from '@/api/system/post' | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 120, | ||||||
|   baseColProps: { span: 24 }, |   baseColProps: { span: 24 }, | ||||||
|   schemas: formSchema, |   schemas: formSchema, | ||||||
|   showActionButtonGroup: false, |   showActionButtonGroup: false, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getPost(data.record.id) |     const res = await getPost(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增数据源' : '编辑数据源')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="FileConfigModal"> | <script lang="ts" setup name="FileConfigModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './ficleConfig.data' | import { formSchema } from './ficleConfig.data' | ||||||
|  | @ -12,7 +12,6 @@ import { createFileConfig, getFileConfig, updateFileConfig } from '@/api/infra/f | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 100, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getFileConfig(data.record.id) |     const res = await getFileConfig(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增文件配置' : '编辑文件配置')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="JobModal"> | <script lang="ts" setup name="JobModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './job.data' | import { formSchema } from './job.data' | ||||||
|  | @ -12,7 +12,6 @@ import { createJob, getJob, updateJob } from '@/api/infra/job' | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 100, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getJob(data.record.id) |     const res = await getJob(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增定时任务' : '编辑定时任务')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -14,7 +14,7 @@ const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 120, | ||||||
|   baseColProps: { span: 24 }, |   baseColProps: { span: 24 }, | ||||||
|   schemas: formSchema, |   schemas: formSchema, | ||||||
|   showActionButtonGroup: false, |   showActionButtonGroup: false, | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="MailAccountModal"> | <script lang="ts" setup name="MailAccountModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './account.data' | import { formSchema } from './account.data' | ||||||
|  | @ -12,10 +12,9 @@ import { createMailAccount, getMailAccount, updateMailAccount } from '@/api/syst | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 120, | ||||||
|   baseColProps: { span: 24 }, |   baseColProps: { span: 24 }, | ||||||
|   schemas: formSchema, |   schemas: formSchema, | ||||||
|   showActionButtonGroup: false, |   showActionButtonGroup: false, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getMailAccount(data.record.id) |     const res = await getMailAccount(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增邮箱' : '编辑邮箱')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -2,17 +2,20 @@ | ||||||
|   <div> |   <div> | ||||||
|     <BasicTable @register="registerTable"> |     <BasicTable @register="registerTable"> | ||||||
|       <template #toolbar> |       <template #toolbar> | ||||||
|         <a-button type="primary" :preIcon="IconEnum.ADD" @click="handleCreate"> {{ t('action.create') }} </a-button> |         <a-button type="primary" v-auth="['system:mail-account:create']" :preIcon="IconEnum.ADD" @click="handleCreate"> | ||||||
|  |           {{ t('action.create') }} | ||||||
|  |         </a-button> | ||||||
|       </template> |       </template> | ||||||
|       <template #bodyCell="{ column, record }"> |       <template #bodyCell="{ column, record }"> | ||||||
|         <template v-if="column.key === 'action'"> |         <template v-if="column.key === 'action'"> | ||||||
|           <TableAction |           <TableAction | ||||||
|             :actions="[ |             :actions="[ | ||||||
|               { icon: IconEnum.EDIT, label: t('action.edit'), onClick: handleEdit.bind(null, record) }, |               { icon: IconEnum.EDIT, label: t('action.edit'), auth: 'system:mail-account:update', onClick: handleEdit.bind(null, record) }, | ||||||
|               { |               { | ||||||
|                 icon: IconEnum.DELETE, |                 icon: IconEnum.DELETE, | ||||||
|                 color: 'error', |                 color: 'error', | ||||||
|                 label: t('action.delete'), |                 label: t('action.delete'), | ||||||
|  |                 auth: 'system:mail-account:delete', | ||||||
|                 popConfirm: { |                 popConfirm: { | ||||||
|                   title: t('common.delMessage'), |                   title: t('common.delMessage'), | ||||||
|                   placement: 'left', |                   placement: 'left', | ||||||
|  | @ -60,16 +63,11 @@ const [registerTable, { reload }] = useTable({ | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| function handleCreate() { | function handleCreate() { | ||||||
|   openModal(true, { |   openModal(true, { isUpdate: false }) | ||||||
|     isUpdate: false |  | ||||||
|   }) |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function handleEdit(record: Recordable) { | function handleEdit(record: Recordable) { | ||||||
|   openModal(true, { |   openModal(true, { record, isUpdate: true }) | ||||||
|     record, |  | ||||||
|     isUpdate: true |  | ||||||
|   }) |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| async function handleDelete(record: Recordable) { | async function handleDelete(record: Recordable) { | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="MailTemplateModal"> | <script lang="ts" setup name="MailTemplateModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './template.data' | import { formSchema } from './template.data' | ||||||
|  | @ -12,10 +12,9 @@ import { createMailTemplate, getMailTemplate, updateMailTemplate } from '@/api/s | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 120, | ||||||
|   baseColProps: { span: 24 }, |   baseColProps: { span: 24 }, | ||||||
|   schemas: formSchema, |   schemas: formSchema, | ||||||
|   showActionButtonGroup: false, |   showActionButtonGroup: false, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getMailTemplate(data.record.id) |     const res = await getMailTemplate(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增邮箱' : '编辑邮箱')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="MenuModal"> | <script lang="ts" setup name="MenuModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './menu.data' | import { formSchema } from './menu.data' | ||||||
|  | @ -12,10 +12,9 @@ import { createMenu, getMenu, updateMenu } from '@/api/system/menu' | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 120, | ||||||
|   baseColProps: { span: 24 }, |   baseColProps: { span: 24 }, | ||||||
|   schemas: formSchema, |   schemas: formSchema, | ||||||
|   showActionButtonGroup: false, |   showActionButtonGroup: false, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getMenu(data.record.id) |     const res = await getMenu(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增菜单' : '编辑菜单')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="NoticeModal"> | <script lang="ts" setup name="NoticeModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './notice.data' | import { formSchema } from './notice.data' | ||||||
|  | @ -12,10 +12,9 @@ import { createNotice, getNotice, updateNotice } from '@/api/system/notice' | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 120, | ||||||
|   baseColProps: { span: 24 }, |   baseColProps: { span: 24 }, | ||||||
|   schemas: formSchema, |   schemas: formSchema, | ||||||
|   showActionButtonGroup: false, |   showActionButtonGroup: false, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getNotice(data.record.id) |     const res = await getNotice(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增公告' : '编辑公告')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="NotifyTemplateModal"> | <script lang="ts" setup name="NotifyTemplateModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './template.data' | import { formSchema } from './template.data' | ||||||
|  | @ -12,10 +12,9 @@ import { createNotifyTemplate, getNotifyTemplate, updateNotifyTemplate } from '@ | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 120, | ||||||
|   baseColProps: { span: 24 }, |   baseColProps: { span: 24 }, | ||||||
|   schemas: formSchema, |   schemas: formSchema, | ||||||
|   showActionButtonGroup: false, |   showActionButtonGroup: false, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getNotifyTemplate(data.record.id) |     const res = await getNotifyTemplate(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增岗位' : '编辑岗位')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="ClientModal"> | <script lang="ts" setup name="ClientModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './client.data' | import { formSchema } from './client.data' | ||||||
|  | @ -12,7 +12,6 @@ import { createOAuth2Client, getOAuth2Client, updateOAuth2Client } from '@/api/s | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 160, |   labelWidth: 160, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getOAuth2Client(data.record.id) |     const res = await getOAuth2Client(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增应用' : '编辑应用')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="RoleModal"> | <script lang="ts" setup name="RoleModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './role.data' | import { formSchema } from './role.data' | ||||||
|  | @ -12,10 +12,9 @@ import { createRole, getRole, updateRole } from '@/api/system/role' | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 120, | ||||||
|   baseColProps: { span: 24 }, |   baseColProps: { span: 24 }, | ||||||
|   schemas: formSchema, |   schemas: formSchema, | ||||||
|   showActionButtonGroup: false, |   showActionButtonGroup: false, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getRole(data.record.id) |     const res = await getRole(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="RoleScopeModal"> | <script lang="ts" setup name="RoleScopeModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { dataScopeFormSchema } from './role.data' | import { dataScopeFormSchema } from './role.data' | ||||||
|  | @ -12,7 +12,6 @@ import { createRole, getRole, updateRole } from '@/api/system/role' | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 100, | ||||||
|  | @ -29,13 +28,10 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
| 
 | 
 | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getRole(data.record.id) |     const res = await getRole(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="SensitiveWordModal"> | <script lang="ts" setup name="SensitiveWordModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './sensitiveWord.data' | import { formSchema } from './sensitiveWord.data' | ||||||
|  | @ -12,7 +12,6 @@ import { createSensitiveWord, getSensitiveWord, updateSensitiveWord } from '@/ap | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 100, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getSensitiveWord(data.record.id) |     const res = await getSensitiveWord(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增敏感词' : '编辑敏感词')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="SmsChannelModal"> | <script lang="ts" setup name="SmsChannelModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './smsChannel.data' | import { formSchema } from './smsChannel.data' | ||||||
|  | @ -12,10 +12,9 @@ import { createSmsChannel, getSmsChannel, updateSmsChannel } from '@/api/system/ | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 120, | ||||||
|   baseColProps: { span: 24 }, |   baseColProps: { span: 24 }, | ||||||
|   schemas: formSchema, |   schemas: formSchema, | ||||||
|   showActionButtonGroup: false, |   showActionButtonGroup: false, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getSmsChannel(data.record.id) |     const res = await getSmsChannel(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增短信渠道' : '编辑短信渠道')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="SmsTemplateModal"> | <script lang="ts" setup name="SmsTemplateModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './smsTemplate.data' | import { formSchema } from './smsTemplate.data' | ||||||
|  | @ -12,7 +12,6 @@ import { createSmsTemplate, getSmsTemplate, updateSmsTemplate } from '@/api/syst | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 100, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getSmsTemplate(data.record.id) |     const res = await getSmsTemplate(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增短信模版' : '编辑短信模版')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="TenantModal"> | <script lang="ts" setup name="TenantModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './tenant.data' | import { formSchema } from './tenant.data' | ||||||
|  | @ -12,10 +12,9 @@ import { createTenant, getTenant, updateTenant } from '@/api/system/tenant' | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 120, | ||||||
|   baseColProps: { span: 24 }, |   baseColProps: { span: 24 }, | ||||||
|   schemas: formSchema, |   schemas: formSchema, | ||||||
|   showActionButtonGroup: false, |   showActionButtonGroup: false, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getTenant(data.record.id) |     const res = await getTenant(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增租户' : '编辑租户')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm"> |     <BasicForm @register="registerForm"> | ||||||
|       <template #menuIds="{ model, field }"> |       <template #menuIds="{ model, field }"> | ||||||
|         <BasicTree |         <BasicTree | ||||||
|  | @ -16,7 +16,7 @@ | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="TenantPackageModal"> | <script lang="ts" setup name="TenantPackageModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { BasicTree, TreeItem } from '@/components/Tree' | import { BasicTree, TreeItem } from '@/components/Tree' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
|  | @ -27,13 +27,12 @@ import { handleTree } from '@/utils/tree' | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| const menuTree = ref<TreeItem[]>([]) | const menuTree = ref<TreeItem[]>([]) | ||||||
| const menuKeys = ref<(string | number)[]>([]) | const menuKeys = ref<(string | number)[]>([]) | ||||||
| const menuHalfKeys = ref<(string | number)[]>([]) | const menuHalfKeys = ref<(string | number)[]>([]) | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 120, | ||||||
|   baseColProps: { span: 24 }, |   baseColProps: { span: 24 }, | ||||||
|   schemas: formSchema, |   schemas: formSchema, | ||||||
|   showActionButtonGroup: false, |   showActionButtonGroup: false, | ||||||
|  | @ -46,18 +45,14 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getTenantPackage(data.record.id) |     const res = await getTenantPackage(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     const menus = await listSimpleMenus() |     const menus = await listSimpleMenus() | ||||||
|     menuTree.value = handleTree(menus, 'id') |     menuTree.value = handleTree(menus, 'id') | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增租户套餐' : '编辑租户套餐')) |  | ||||||
| 
 |  | ||||||
| function menuCheck(checkedKeys, e) { | function menuCheck(checkedKeys, e) { | ||||||
|   menuKeys.value = checkedKeys as (string | number)[] |   menuKeys.value = checkedKeys as (string | number)[] | ||||||
|   menuHalfKeys.value = e.halfCheckedKeys as (string | number)[] |   menuHalfKeys.value = e.halfCheckedKeys as (string | number)[] | ||||||
|  |  | ||||||
|  | @ -1,10 +1,10 @@ | ||||||
| <template> | <template> | ||||||
|   <BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit"> |   <BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit"> | ||||||
|     <BasicForm @register="registerForm" /> |     <BasicForm @register="registerForm" /> | ||||||
|   </BasicModal> |   </BasicModal> | ||||||
| </template> | </template> | ||||||
| <script lang="ts" setup name="UserModal"> | <script lang="ts" setup name="UserModal"> | ||||||
| import { ref, computed, unref } from 'vue' | import { ref, unref } from 'vue' | ||||||
| import { BasicModal, useModalInner } from '@/components/Modal' | import { BasicModal, useModalInner } from '@/components/Modal' | ||||||
| import { BasicForm, useForm } from '@/components/Form' | import { BasicForm, useForm } from '@/components/Form' | ||||||
| import { formSchema } from './user.data' | import { formSchema } from './user.data' | ||||||
|  | @ -12,10 +12,9 @@ import { createUser, getUser, updateUser } from '@/api/system/user' | ||||||
| 
 | 
 | ||||||
| const emit = defineEmits(['success', 'register']) | const emit = defineEmits(['success', 'register']) | ||||||
| const isUpdate = ref(true) | const isUpdate = ref(true) | ||||||
| const rowId = ref() |  | ||||||
| 
 | 
 | ||||||
| const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({ | ||||||
|   labelWidth: 100, |   labelWidth: 120, | ||||||
|   baseColProps: { span: 24 }, |   baseColProps: { span: 24 }, | ||||||
|   schemas: formSchema, |   schemas: formSchema, | ||||||
|   showActionButtonGroup: false, |   showActionButtonGroup: false, | ||||||
|  | @ -26,16 +25,12 @@ const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data | ||||||
|   resetFields() |   resetFields() | ||||||
|   setModalProps({ confirmLoading: false }) |   setModalProps({ confirmLoading: false }) | ||||||
|   isUpdate.value = !!data?.isUpdate |   isUpdate.value = !!data?.isUpdate | ||||||
| 
 |  | ||||||
|   if (unref(isUpdate)) { |   if (unref(isUpdate)) { | ||||||
|     const res = await getUser(data.record.id) |     const res = await getUser(data.record.id) | ||||||
|     rowId.value = res.id |  | ||||||
|     setFieldsValue({ ...res }) |     setFieldsValue({ ...res }) | ||||||
|   } |   } | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| const getTitle = computed(() => (!unref(isUpdate) ? '新增用户' : '编辑用户')) |  | ||||||
| 
 |  | ||||||
| async function handleSubmit() { | async function handleSubmit() { | ||||||
|   try { |   try { | ||||||
|     const values = await validate() |     const values = await validate() | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 xingyuv
						xingyuv