代码调整

This commit is contained in:
dong 2023-06-05 17:27:38 +08:00
parent 481a2b12c1
commit 5f6b52228b
3 changed files with 18 additions and 25 deletions

View File

@ -1,22 +1,18 @@
import { api } from 'src/boot/axios';
import { PageQueryDto } from './ApiCommon';
const DraftUriBase = '/api/draft';
export class PagingQueryParams extends PageQueryDto {
name?: string;
}
const DraftUriBase = '/api/draft/layout';
/**
*
* @param params
*
* @param query
* @returns
*/
export async function pageQuery(params: PagingQueryParams) {
const response = await api.get(`${DraftUriBase}/paging`, {
params: params,
});
return response.data;
export function pageQuery(query: {
pageNum: number;
size: number;
name: string;
}) {
return api.get(`${DraftUriBase}/page`, { params: query });
}
/**
@ -24,29 +20,26 @@ export async function pageQuery(params: PagingQueryParams) {
* @param params
* @returns
*/
export async function createDraft(draftData: {
name: string;
}): Promise<string> {
const response = await api.post(`${DraftUriBase}/create`, draftData);
return response.data;
export function createDraft(draftData: { name: string }): Promise<string> {
return api.post(`${DraftUriBase}/create`, draftData);
}
/**
* 稿
* @param id 稿id
*/
export async function deleteDraft(id: string) {
return await api.delete(`${DraftUriBase}/delete/${id}`);
export function deleteDraft(id: string) {
return api.delete(`${DraftUriBase}/${id}`);
}
/**
* 稿
* @param id 稿id
*/
export async function publishDraft(data: {
export function publishDraft(data: {
layoutId: string;
name: string;
overwrite?: boolean;
}) {
return await api.post(`${DraftUriBase}/publish`, data);
return api.post(`${DraftUriBase}/publish`, data);
}

View File

@ -20,7 +20,7 @@
v-model="filter.name"
label="名称"
></q-input>
<q-btn flat round color="primary" icon="sym_o_search" />
<q-btn flat round color="primary" icon="search" />
<q-btn color="primary" label="新建" @click="createFormShow = true" />
</template>
@ -164,7 +164,7 @@ async function onRequest(props: any) {
loading.value = true;
try {
let response = await pageQuery({
current: page,
pageNum: page,
size: rowsPerPage,
name: filter.name,
});

View File

@ -24,7 +24,7 @@
:options="optionsSearch"
></q-select>
</q-card-section>
<q-btn flat round color="primary" icon="sym_o_search" />
<q-btn flat round color="primary" icon="search" />
</template>
<template v-slot:body-cell-operations="props">