-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from matevip/dev
Dev
- Loading branch information
Showing
21 changed files
with
383 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { AttachmentVO, AttachmentDTO, Attachment } from './model/attachmentModel'; | ||
import { defHttp } from '/@/utils/http/axios'; | ||
|
||
enum Api { | ||
Page = '/mate-component/attachment/page', | ||
Set = '/mate-component/attachment/set', | ||
Del = '/mate-component/attachment/del', | ||
} | ||
|
||
// 分页查询 | ||
export const page = (params: AttachmentVO) => defHttp.get<AttachmentDTO>({ url: Api.Page, params }); | ||
|
||
// 保存 | ||
export const set = (params: Attachment) => defHttp.post<Attachment>({ url: Api.Set, params }); | ||
|
||
// 删除 | ||
export const del = (params: { ids: String }) => | ||
defHttp.post<boolean>({ url: Api.Del + `?ids=${params.ids}` }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// 引入基础包 | ||
import { BasicPageParams, BasicFetchResult } from '/@/api/model/baseModel'; | ||
|
||
// 定义查询参数 | ||
export type AttachmentVO = BasicPageParams & { | ||
keyword?: string; | ||
startDate?: string; | ||
endDate?: string; | ||
}; | ||
|
||
// 定义路由对象 | ||
export interface Attachment { | ||
id: string; | ||
storageId: string; | ||
attachmentGroupId: string; | ||
name: string; | ||
size: string; | ||
url: string; | ||
fileName: string; | ||
thumbUrl: string; | ||
type: number; | ||
createTime: string; | ||
} | ||
|
||
// 根据字典对象生成响应模型 | ||
export type AttachmentDTO = BasicFetchResult<AttachmentVO>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<template> | ||
<BasicDrawer | ||
v-bind="$attrs" | ||
@register="registerDrawer" | ||
showFooter | ||
:title="getTitle" | ||
width="500px" | ||
@ok="handleSubmit" | ||
> | ||
<BasicForm @register="registerForm" /> | ||
</BasicDrawer> | ||
</template> | ||
<script lang="ts" setup> | ||
import { ref, computed, unref } from 'vue'; | ||
import { BasicForm, useForm } from '/@/components/Form/index'; | ||
import { formSchema } from './attachment.data'; | ||
import { BasicDrawer, useDrawerInner } from '/@/components/Drawer'; | ||
import { set } from '/@/api/gateway/route'; | ||
const emit = defineEmits(['success', 'register']); | ||
const isUpdate = ref(true); | ||
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({ | ||
labelWidth: 100, | ||
schemas: formSchema, | ||
showActionButtonGroup: false, | ||
}); | ||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => { | ||
resetFields(); | ||
setDrawerProps({ confirmLoading: false }); | ||
isUpdate.value = !!data?.isUpdate; | ||
if (unref(isUpdate)) { | ||
setFieldsValue({ | ||
...data.record, | ||
}); | ||
} | ||
}); | ||
const getTitle = computed(() => (!unref(isUpdate) ? '新增微服务' : '编辑微服务')); | ||
async function handleSubmit() { | ||
try { | ||
const values = await validate(); | ||
setDrawerProps({ confirmLoading: true }); | ||
await set(values); | ||
closeDrawer(); | ||
emit('success'); | ||
} finally { | ||
setDrawerProps({ confirmLoading: false }); | ||
} | ||
} | ||
</script> |
Oops, something went wrong.