草稿接口调整

This commit is contained in:
dong 2023-06-06 13:14:42 +08:00
parent 2512c6a8ce
commit 17c2c02e10
2 changed files with 37 additions and 14 deletions

View File

@ -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<string>;
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<PageDto<Item>> {
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<string> {
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}`);
}

View File

@ -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;