commit
12d6c14b1c
@ -1,20 +1,20 @@
|
|||||||
package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group;
|
package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 用户组 Response VO")
|
@Schema(description = "管理后台 - 用户组 Response VO")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class BpmUserGroupRespVO extends BpmUserGroupBaseVO {
|
public class BpmUserGroupRespVO extends BpmUserGroupBaseVO {
|
||||||
|
|
||||||
@Schema(description = "编号", required = true, example = "1024")
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "创建时间", required = true)
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,49 +1,56 @@
|
|||||||
<template>
|
<template>
|
||||||
<BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? '编辑' : '新增'" @ok="handleSubmit">
|
<BasicModal v-bind="$attrs" @register="registerModal" :title="isUpdate ? t('action.edit') : t('action.create')" @ok="handleSubmit">
|
||||||
<BasicForm @register="registerForm" />
|
<BasicForm @register="registerForm" />
|
||||||
</BasicModal>
|
</BasicModal>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup name="${table.className}Modal">
|
<script lang="ts" setup>
|
||||||
import { ref, unref } from 'vue'
|
import { ref, unref } from 'vue'
|
||||||
import { BasicModal, useModalInner } from '@/components/Modal'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import { BasicForm, useForm } from '@/components/Form'
|
import { useMessage } from '@/hooks/web/useMessage'
|
||||||
import { formSchema } from './${classNameVar}.data'
|
import { BasicForm, useForm } from '@/components/Form'
|
||||||
import { create${simpleClassName}, get${simpleClassName}, update${simpleClassName} } from '@/api/${table.moduleName}/${classNameVar}'
|
import { BasicModal, useModalInner } from '@/components/Modal'
|
||||||
|
import { createFormSchema, updateFormSchema } from './${classNameVar}.data'
|
||||||
|
import { create${simpleClassName}, get${simpleClassName}, update${simpleClassName} } from '@/api/${table.moduleName}/${classNameVar}'
|
||||||
|
|
||||||
const emit = defineEmits(['success', 'register'])
|
defineOptions({ name: '${table.className}Modal' })
|
||||||
const isUpdate = ref(true)
|
|
||||||
|
|
||||||
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
const { t } = useI18n()
|
||||||
labelWidth: 120,
|
const { createMessage } = useMessage()
|
||||||
baseColProps: { span: 24 },
|
const emit = defineEmits(['success', 'register'])
|
||||||
schemas: formSchema,
|
const isUpdate = ref(true)
|
||||||
showActionButtonGroup: false,
|
|
||||||
actionColOptions: { span: 23 }
|
|
||||||
})
|
|
||||||
|
|
||||||
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
const [registerForm, { setFieldsValue, resetFields, validate }] = useForm({
|
||||||
resetFields()
|
labelWidth: 120,
|
||||||
setModalProps({ confirmLoading: false })
|
baseColProps: { span: 24 },
|
||||||
isUpdate.value = !!data?.isUpdate
|
schemas: isUpdate? updateFormSchema : createFormSchema,
|
||||||
if (unref(isUpdate)) {
|
showActionButtonGroup: false,
|
||||||
const res = await get${simpleClassName}(data.record.id)
|
actionColOptions: { span: 23 }
|
||||||
setFieldsValue({ ...res })
|
})
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
async function handleSubmit() {
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
||||||
try {
|
resetFields()
|
||||||
const values = await validate()
|
setModalProps({ confirmLoading: false })
|
||||||
setModalProps({ confirmLoading: true })
|
isUpdate.value = !!data?.isUpdate
|
||||||
if (unref(isUpdate)) {
|
if (unref(isUpdate)) {
|
||||||
await update${simpleClassName}(values)
|
const res = await get${simpleClassName}(data.record.id)
|
||||||
} else {
|
setFieldsValue({ ...res })
|
||||||
await create${simpleClassName}(values)
|
}
|
||||||
}
|
})
|
||||||
closeModal()
|
|
||||||
emit('success')
|
async function handleSubmit() {
|
||||||
} finally {
|
try {
|
||||||
setModalProps({ confirmLoading: false })
|
const values = await validate()
|
||||||
|
setModalProps({ confirmLoading: true })
|
||||||
|
if (unref(isUpdate)) {
|
||||||
|
await update${simpleClassName}(values)
|
||||||
|
} else {
|
||||||
|
await create${simpleClassName}(values)
|
||||||
}
|
}
|
||||||
|
closeModal()
|
||||||
|
emit('success')
|
||||||
|
createMessage.success(t('common.saveSuccessText'))
|
||||||
|
} finally {
|
||||||
|
setModalProps({ confirmLoading: false })
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue