This commit is contained in:
六如
2024-11-29 23:47:58 +08:00
parent 85b33e7c3d
commit 09330a7431
198 changed files with 1504 additions and 982 deletions

View File

@@ -4,6 +4,7 @@ import type { Result } from "@/model";
// 后端请求接口
const apiUrl: any = createUrl({
addApp: "/doc/app/add",
syncAppDoc: "/doc/app/syncAppDoc",
syncDoc: "/doc/app/syncDoc",
listApp: "/doc/app/list",
listDocTree: "/doc/info/tree",
@@ -36,10 +37,16 @@ export const api: any = {
* 同步文档
* @param data 表单内容
*/
syncDoc(docAppId) {
syncAppDoc(docAppId) {
const data = {
id: docAppId
};
return http.post<Result<any>, any>(apiUrl.syncAppDoc, { data });
},
syncDoc(docInfoId) {
const data = {
id: docInfoId
};
return http.post<Result<any>, any>(apiUrl.syncDoc, { data });
},
/**

View File

@@ -181,6 +181,35 @@ actionButtons.value = [
});
},
show: (row: any) => row.isFolder === 0
},
{
text: "同步",
confirm: {
options: { draggable: false },
popconfirmProps: { width: 300 },
message: params => {
const row = params.row;
return row.isFolder
? `确定要同步[${row.docTitle}]下所有接口吗?`
: `确定要同步[${row.docTitle}]吗?`;
}
},
props: (_: any) => ({
type: "primary"
}),
onConfirm(params: ButtonsCallBackParams) {
loading.value = true;
api
.syncDoc(params.row.id)
.then(() => {
loading.value = false;
ElMessage.success("同步成功");
search();
})
.catch(() => {
loading.value = false;
});
}
}
];
@@ -203,7 +232,7 @@ export function handleSyncApi() {
.then(() => {
loading.value = true;
api
.syncDoc(docAppId.value)
.syncAppDoc(docAppId.value)
.then(() => {
loading.value = false;
ElMessage.success("同步成功");

View File

@@ -43,7 +43,7 @@ import { Search } from "@element-plus/icons-vue";
:action-bar="{
buttons: actionButtons,
confirmType: 'popconfirm',
width: 120
width: 150
}"
adaptive
>
@@ -60,7 +60,9 @@ import { Search } from "@element-plus/icons-vue";
</el-input>
</template>
<template #toolbar>
<el-button type="primary" @click="handleSyncApi">同步接口</el-button>
<el-button type="primary" @click="handleSyncApi">
同步全部接口
</el-button>
</template>
</PlusTable>
</el-card>