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