api接口文档开发
This commit is contained in:
@@ -37,31 +37,30 @@ public class ApiCustomNodeServiceImpl extends ServiceImpl<ApiCustomNodeMapper, A
|
|||||||
ApiCustomParamsService apiCustomParamsService;
|
ApiCustomParamsService apiCustomParamsService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addNode(ApiCustomNode apiCustomFolder, ApiCustomParams apiCustomParams) {
|
public void addNode(ApiCustomNode apiCustomNode, ApiCustomParams apiCustomParams) {
|
||||||
apiDocAuthJudgeService.judgeDevelopAndThrow(apiCustomFolder.getDocId());
|
apiDocAuthJudgeService.judgeDevelopAndThrow(apiCustomNode.getDocId());
|
||||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||||
Long parentId = Optional.ofNullable(apiCustomFolder.getParentId()).orElse(0L);
|
Long parentId = Optional.ofNullable(apiCustomNode.getParentId()).orElse(0L);
|
||||||
apiCustomFolder.setParentId(parentId);
|
if (apiCustomNode.getId() == null) {
|
||||||
if (apiCustomFolder.getId() == null) {
|
apiCustomNode.setYn(1);
|
||||||
apiCustomFolder.setYn(1);
|
apiCustomNode.setCreateTime(new Date());
|
||||||
apiCustomFolder.setCreateTime(new Date());
|
apiCustomNode.setCreateUserId(currentUser.getUserId());
|
||||||
apiCustomFolder.setCreateUserId(currentUser.getUserId());
|
apiCustomNode.setCreateUserName(currentUser.getUsername());
|
||||||
apiCustomFolder.setCreateUserName(currentUser.getUsername());
|
|
||||||
// 修改顺序值,新增放最后
|
// 修改顺序值,新增放最后
|
||||||
Integer lastSeq = apiCustomNodeMapper.getLastSeq(parentId);
|
Integer lastSeq = apiCustomNodeMapper.getLastSeq(parentId);
|
||||||
lastSeq = Optional.ofNullable(lastSeq).orElse(0);
|
lastSeq = Optional.ofNullable(lastSeq).orElse(0);
|
||||||
apiCustomFolder.setSeqNo(lastSeq + 1);
|
apiCustomNode.setSeqNo(lastSeq + 1);
|
||||||
} else {
|
} else {
|
||||||
apiCustomFolder.setCreateTime(null);
|
apiCustomNode.setCreateTime(null);
|
||||||
apiCustomFolder.setCreateUserId(null);
|
apiCustomNode.setCreateUserId(null);
|
||||||
apiCustomFolder.setCreateUserName(null);
|
apiCustomNode.setCreateUserName(null);
|
||||||
}
|
}
|
||||||
this.saveOrUpdate(apiCustomFolder);
|
this.saveOrUpdate(apiCustomNode);
|
||||||
// 保存参数
|
// 保存参数
|
||||||
if (Objects.equals(apiCustomFolder.getNodeType(), 1)) {
|
if (Objects.equals(apiCustomNode.getNodeType(), 1)) {
|
||||||
apiCustomParams.setNodeId(apiCustomFolder.getId());
|
apiCustomParams.setNodeId(apiCustomNode.getId());
|
||||||
QueryWrapper<ApiCustomParams> nodeParamsWrapper = new QueryWrapper<>();
|
QueryWrapper<ApiCustomParams> nodeParamsWrapper = new QueryWrapper<>();
|
||||||
nodeParamsWrapper.eq("node_id", apiCustomFolder.getId());
|
nodeParamsWrapper.eq("node_id", apiCustomNode.getId());
|
||||||
ApiCustomParams customParams = apiCustomParamsService.getOne(nodeParamsWrapper);
|
ApiCustomParams customParams = apiCustomParamsService.getOne(nodeParamsWrapper);
|
||||||
if (customParams != null) {
|
if (customParams != null) {
|
||||||
apiCustomParams.setId(customParams.getId());
|
apiCustomParams.setId(customParams.getId());
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
VITE_APP_TITLE=API文档管理
|
VITE_APP_TITLE=API文档管理
|
||||||
|
|
||||||
本地切换环境改这个参数,可选值:dev、online
|
本地切换环境改这个参数,可选值:dev、online
|
||||||
VITE_APP_ENV=dev
|
VITE_APP_ENV=online
|
||||||
|
|
||||||
# 线上环境
|
# 线上环境
|
||||||
VITE_APP_BASE_URL_ONLINE=http://doc.zyplayer.com/zyplayer-doc-manage
|
VITE_APP_BASE_URL_ONLINE=http://doc.zyplayer.com/zyplayer-doc-manage
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
<a-menu @click="handleFolderDropdownClick($event, record)">
|
<a-menu @click="handleFolderDropdownClick($event, record)">
|
||||||
<a-menu-item key="newRequest"><plus-outlined /> 新建接口</a-menu-item>
|
<a-menu-item key="newRequest"><plus-outlined /> 新建接口</a-menu-item>
|
||||||
<a-menu-item key="newFolder"><folder-add-outlined /> 新建文件夹</a-menu-item>
|
<a-menu-item key="newFolder"><folder-add-outlined /> 新建文件夹</a-menu-item>
|
||||||
|
<a-menu-item key="refresh"><reload-outlined /> 刷新</a-menu-item>
|
||||||
</a-menu>
|
</a-menu>
|
||||||
</template>
|
</template>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
@@ -50,6 +51,9 @@
|
|||||||
<a-popover v-model:visible="record.data.editing" placement="rightTop" title="编辑名称" trigger="click" @visibleChange="editFolderVisibleChange($event, record)">
|
<a-popover v-model:visible="record.data.editing" placement="rightTop" title="编辑名称" trigger="click" @visibleChange="editFolderVisibleChange($event, record)">
|
||||||
<template #content>
|
<template #content>
|
||||||
<a-input v-model:value="record.data.titleEditing" v-autofocus></a-input>
|
<a-input v-model:value="record.data.titleEditing" v-autofocus></a-input>
|
||||||
|
<div style="margin-top: 10px;text-align: right;">
|
||||||
|
<a-button @click="editFolderSave(record)" type="primary">保存</a-button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<span class="tree-title-text">{{record.title}}</span>
|
<span class="tree-title-text">{{record.title}}</span>
|
||||||
</a-popover>
|
</a-popover>
|
||||||
@@ -86,14 +90,25 @@
|
|||||||
FolderAddOutlined,
|
FolderAddOutlined,
|
||||||
ApiOutlined,
|
ApiOutlined,
|
||||||
PlusOutlined,
|
PlusOutlined,
|
||||||
ExclamationCircleOutlined
|
ExclamationCircleOutlined,
|
||||||
|
ReloadOutlined
|
||||||
} from '@ant-design/icons-vue';
|
} from '@ant-design/icons-vue';
|
||||||
import {zyplayerApi} from '../../../api'
|
import {zyplayerApi} from '../../../api'
|
||||||
import {getTreeDataForTag} from '../../../assets/core/CustomRequestTreeAnalysis.js'
|
import {getTreeDataForTag} from '../../../assets/core/CustomRequestTreeAnalysis.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {InfoCircleOutlined, FileTextOutlined, EllipsisOutlined, EditOutlined, DeleteOutlined, FolderAddOutlined, ApiOutlined, PlusOutlined},
|
components: {
|
||||||
setup() {
|
InfoCircleOutlined,
|
||||||
|
FileTextOutlined,
|
||||||
|
EllipsisOutlined,
|
||||||
|
EditOutlined,
|
||||||
|
DeleteOutlined,
|
||||||
|
FolderAddOutlined,
|
||||||
|
ApiOutlined,
|
||||||
|
PlusOutlined,
|
||||||
|
ReloadOutlined,
|
||||||
|
},
|
||||||
|
setup() {
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -176,10 +191,11 @@
|
|||||||
// 点击触发弹出事件不处理
|
// 点击触发弹出事件不处理
|
||||||
if (visible) {
|
if (visible) {
|
||||||
record.data.editing = false;
|
record.data.editing = false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
const editFolderSave = (record) => {
|
||||||
|
// 没做修改不处理
|
||||||
let title = record.data.titleEditing;
|
let title = record.data.titleEditing;
|
||||||
// 没做修改不处理
|
|
||||||
if (title === record.data.title) {
|
if (title === record.data.title) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -190,6 +206,8 @@
|
|||||||
if (folderItem) {
|
if (folderItem) {
|
||||||
folderItem.name = title;
|
folderItem.name = title;
|
||||||
}
|
}
|
||||||
|
record.data.editing = false;
|
||||||
|
message.success('修改成功');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
const handleApiTitleDropdownClick = (event, record) => {
|
const handleApiTitleDropdownClick = (event, record) => {
|
||||||
@@ -242,6 +260,12 @@
|
|||||||
changeSelectedRequestKeys(requestSaved.id);
|
changeSelectedRequestKeys(requestSaved.id);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} else if (event.key === 'refresh') {
|
||||||
|
loadDoc(choiceDocId, searchKeyword, res => {
|
||||||
|
if(res) {
|
||||||
|
message.success('重新加载成功');
|
||||||
|
}
|
||||||
|
});
|
||||||
} else if (event.key === 'edit') {
|
} else if (event.key === 'edit') {
|
||||||
record.data.editing = true;
|
record.data.editing = true;
|
||||||
} else if (event.key === 'delete') {
|
} else if (event.key === 'delete') {
|
||||||
@@ -291,6 +315,7 @@
|
|||||||
expandedKeys,
|
expandedKeys,
|
||||||
selectedKeys,
|
selectedKeys,
|
||||||
editFolderVisibleChange,
|
editFolderVisibleChange,
|
||||||
|
editFolderSave,
|
||||||
docChecked,
|
docChecked,
|
||||||
treeDataDragEnd,
|
treeDataDragEnd,
|
||||||
loadDoc,
|
loadDoc,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<mavon-editor ref="mavonEditor" v-model="shareInstruction" :toolbars="toolbars"
|
<mavon-editor ref="mavonEditor" v-model="shareInstruction" :toolbars="toolbars"
|
||||||
:externalLink="false" @imgAdd="addMarkdownImage" :imageFilter="imageFilter"
|
:externalLink="false" @imgAdd="addMarkdownImage" :imageFilter="imageFilter"
|
||||||
style="height: 100%;"
|
style="height: calc(100vh - 80px);"
|
||||||
placeholder="请录入开放文档说明"/>
|
placeholder="请录入开放文档说明"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user