diff --git a/src/api/DraftApi.ts b/src/api/DraftApi.ts index 9e61d8e..3a1615f 100644 --- a/src/api/DraftApi.ts +++ b/src/api/DraftApi.ts @@ -1,18 +1,32 @@ import { api } from 'src/boot/axios'; +import { PageDto, PageQueryDto } from './ApiCommon'; const DraftUriBase = '/api/drafting'; +interface Item { + id: number; + name: string; + proto: Array; + createdAt: string; + updateAt: string; +} + +export class PagingQueryParams extends PageQueryDto { + name?: string; +} + /** * 分页查询 - * @param query + * @param params * @returns */ -export function pageQuery(query: { - current: number; - size: number; - name: string; -}) { - return api.get(`${DraftUriBase}/paging`, { params: query }); +export async function pageQuery( + params: PagingQueryParams +): Promise> { + const response = await api.get(`${DraftUriBase}/paging`, { + params: params, + }); + return response.data; } /** @@ -20,8 +34,8 @@ export function pageQuery(query: { * @param params * @returns */ -export function createDraft(draftData: { name: string }): Promise { - return api.post(`${DraftUriBase}/create`, draftData); +export function createDraft(draftData: { name: string }) { + return api.post(`${DraftUriBase}`, draftData); } /** @@ -43,3 +57,12 @@ export function publishDraft(data: { }) { return api.post(`${DraftUriBase}/publish`, data); } + +/** + * 获取草稿数据 + * @param params + * @returns + */ +export function getDraft(id: string) { + return api.get(`${DraftUriBase}/${id}`); +} diff --git a/src/pages/DraftManage.vue b/src/pages/DraftManage.vue index d128014..491b61f 100644 --- a/src/pages/DraftManage.vue +++ b/src/pages/DraftManage.vue @@ -128,15 +128,15 @@ const columnDefs: QTableColumn[] = [ }, { name: 'creator', label: '创建人', field: 'creator', align: 'center' }, { - name: 'createTime', + name: 'createdAt', label: '创建时间', - field: 'createTime', + field: 'createdAt', align: 'center', }, { - name: 'updateTime', + name: 'updateAt', label: '更新时间', - field: 'updateTime', + field: 'updateAt', align: 'center', }, { name: 'operations', label: '操作', field: 'operations', align: 'center' }, @@ -168,7 +168,7 @@ async function onRequest(props: any) { size: rowsPerPage, name: filter.name, }); - const pageData = response.data; + const pageData = response; pagination.value.rowsNumber = pageData.total; pagination.value.page = page; pagination.value.rowsPerPage = rowsPerPage;