文件夹管理部分代码
This commit is contained in:
@@ -6,12 +6,7 @@ import com.test.test.domain.qo.IDQO;
|
|||||||
import com.test.test.domain.qo.TestApiListQO;
|
import com.test.test.domain.qo.TestApiListQO;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.test.common.annotation.Log;
|
import com.test.common.annotation.Log;
|
||||||
import com.test.common.core.controller.BaseController;
|
import com.test.common.core.controller.BaseController;
|
||||||
import com.test.common.core.domain.AjaxResult;
|
import com.test.common.core.domain.AjaxResult;
|
||||||
@@ -19,6 +14,7 @@ import com.test.common.enums.BusinessType;
|
|||||||
import com.test.test.domain.TestApi;
|
import com.test.test.domain.TestApi;
|
||||||
import com.test.test.service.ITestApiService;
|
import com.test.test.service.ITestApiService;
|
||||||
import com.test.common.core.page.TableDataInfo;
|
import com.test.common.core.page.TableDataInfo;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口Controller
|
* 接口Controller
|
||||||
@@ -58,6 +54,14 @@ public class TestApiController extends BaseController {
|
|||||||
return toAjax(testApiService.insertTestApi(testApi));
|
return toAjax(testApiService.insertTestApi(testApi));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入Swagger接口
|
||||||
|
*/
|
||||||
|
@Log(title = "接口", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/import/swagger")
|
||||||
|
public AjaxResult importSwagger(@RequestParam(value = "url") String url) throws Exception {
|
||||||
|
return toAjax(testApiService.importSwaggerApi(url));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 修改接口
|
* 修改接口
|
||||||
*/
|
*/
|
||||||
@@ -75,4 +79,6 @@ public class TestApiController extends BaseController {
|
|||||||
public AjaxResult remove(@RequestBody IDQO qo) {
|
public AjaxResult remove(@RequestBody IDQO qo) {
|
||||||
return toAjax(testApiService.deleteTestApiById(qo.getId()));
|
return toAjax(testApiService.deleteTestApiById(qo.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.test.test.domain.qo.IDQO;
|
|||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -43,7 +42,7 @@ public class TestApiGroupController extends BaseController {
|
|||||||
@Log(title = "接口节点", businessType = BusinessType.INSERT)
|
@Log(title = "接口节点", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
public AjaxResult add(@RequestBody TestApiGroup testApiGroup) {
|
public AjaxResult add(@RequestBody TestApiGroup testApiGroup) {
|
||||||
return toAjax(testApiGroupService.insertTestApiGroup(testApiGroup));
|
return success(testApiGroupService.insertTestApiGroup(testApiGroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ public class TestApiGroup extends BaseEntity
|
|||||||
/** 节点id */
|
/** 节点id */
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/** 父节点id */
|
||||||
|
@Excel(name = "父节点id")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
/** 节点名称 */
|
/** 节点名称 */
|
||||||
@Excel(name = "节点名称")
|
@Excel(name = "节点名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package com.test.test.domain.dto;
|
||||||
|
|
||||||
|
public class SwaggerInfo {
|
||||||
|
}
|
||||||
@@ -24,7 +24,7 @@ public interface ITestApiGroupService {
|
|||||||
* @param testApiGroup 接口节点
|
* @param testApiGroup 接口节点
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertTestApiGroup(TestApiGroup testApiGroup);
|
public TestApiGroup insertTestApiGroup(TestApiGroup testApiGroup);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改接口节点
|
* 修改接口节点
|
||||||
|
|||||||
@@ -35,6 +35,14 @@ public interface ITestApiService {
|
|||||||
*/
|
*/
|
||||||
public int insertTestApi(TestApi testApi);
|
public int insertTestApi(TestApi testApi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入Swagger接口
|
||||||
|
*
|
||||||
|
* @param url Swagger文档链接
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int importSwaggerApi(String url);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改接口
|
* 修改接口
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -38,10 +38,11 @@ public class TestApiGroupServiceImpl implements ITestApiGroupService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertTestApiGroup(TestApiGroup testApiGroup)
|
public TestApiGroup insertTestApiGroup(TestApiGroup testApiGroup)
|
||||||
{
|
{
|
||||||
testApiGroup.setCreateTime(DateUtils.getNowDate());
|
testApiGroup.setCreateTime(DateUtils.getNowDate());
|
||||||
return testApiGroupMapper.insertTestApiGroup(testApiGroup);
|
testApiGroupMapper.insertTestApiGroup(testApiGroup);
|
||||||
|
return testApiGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ package com.test.test.service.impl;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.test.common.utils.DateUtils;
|
import com.test.common.utils.DateUtils;
|
||||||
|
import com.test.common.utils.http.HttpUtils;
|
||||||
import com.test.test.domain.qo.TestApiListQO;
|
import com.test.test.domain.qo.TestApiListQO;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -54,6 +57,12 @@ public class TestApiServiceImpl implements ITestApiService {
|
|||||||
return testApiMapper.insertTestApi(testApi);
|
return testApiMapper.insertTestApi(testApi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int importSwaggerApi(String url) {
|
||||||
|
JSONObject json = JSONObject.parse(HttpUtils.sendGet(url));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改接口
|
* 修改接口
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<resultMap type="TestApiGroup" id="TestApiGroupResult">
|
<resultMap type="TestApiGroup" id="TestApiGroupResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
|
<result property="parentId" column="parent_id" />
|
||||||
<result property="name" column="name" />
|
<result property="name" column="name" />
|
||||||
<result property="delFlag" column="del_flag" />
|
<result property="delFlag" column="del_flag" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
@@ -15,7 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectTestApiGroupVo">
|
<sql id="selectTestApiGroupVo">
|
||||||
select id, name, del_flag, create_by, create_time, update_by, update_time from test_api_group
|
select id, parent_id, name, del_flag, create_by, create_time, update_by, update_time from test_api_group
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectTestApiGroupList" resultMap="TestApiGroupResult">
|
<select id="selectTestApiGroupList" resultMap="TestApiGroupResult">
|
||||||
@@ -25,26 +26,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<insert id="insertTestApiGroup" parameterType="TestApiGroup" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertTestApiGroup" parameterType="TestApiGroup" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into test_api_group
|
insert into test_api_group
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="parentId != null">parent_id,</if>
|
||||||
<if test="name != null">name,</if>
|
<if test="name != null">name,</if>
|
||||||
<if test="delFlag != null">del_flag,</if>
|
<if test="delFlag != null">del_flag,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="updateBy != null">update_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="parentId != null">#{parentId},</if>
|
||||||
<if test="name != null">#{name},</if>
|
<if test="name != null">#{name},</if>
|
||||||
<if test="delFlag != null">#{delFlag},</if>
|
<if test="delFlag != null">#{delFlag},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateTestApiGroup" parameterType="TestApiGroup">
|
<update id="updateTestApiGroup" parameterType="TestApiGroup">
|
||||||
update test_api_group
|
update test_api_group
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||||
<if test="name != null">name = #{name},</if>
|
<if test="name != null">name = #{name},</if>
|
||||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ aside {
|
|||||||
//main-container全局样式
|
//main-container全局样式
|
||||||
.app-container {
|
.app-container {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
min-height: calc(100vh - 84px);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.components-container {
|
.components-container {
|
||||||
|
|||||||
@@ -1,12 +1,32 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-aside width="240px">
|
<el-aside>
|
||||||
<el-menu class="el-menu-vertical-demo">
|
<el-input placeholder="输入关键字进行过滤" v-model="filterText" size="small" style="margin-bottom: 10px"/>
|
||||||
<el-menu-item v-for="item in groupList" :index="item.id" :key="item.id" :disabled="item.name">
|
<el-tree class="filter-tree" :data="groupList" node-key="id" highlight-current :expand-on-click-node="false" @node-click="nodeClick" :filter-node-method="filterNode" ref="tree" :default-expanded-keys="[0]">
|
||||||
<span slot="title">{{ item.name }}</span>
|
<span class="custom-tree-node" slot-scope="{ node, data }" v-if="groupState !== 'list' && editId === data.id">
|
||||||
</el-menu-item>
|
<span>
|
||||||
</el-menu>
|
<el-form ref="form" :model="form" :rules="rules">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入节点名称" class="custom-tree-node-input" />
|
||||||
|
</el-form>
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
<el-button type="text" size="mini"><i class="el-icon-check" @click="submitNode(node)"/></el-button>
|
||||||
|
<el-button type="text" size="mini"><i class="el-icon-close" @click="cancelNode(node)"/></el-button>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span class="custom-tree-node" slot-scope="{ node, data }" v-else>
|
||||||
|
<span>{{ node.label }}</span>
|
||||||
|
<span v-if="data.id === 0">
|
||||||
|
<el-button type="text" size="mini" @click="nodeAdd(data)"><i class="el-icon-plus"/></el-button>
|
||||||
|
</span>
|
||||||
|
<span class="custom-tree-node-option" v-else>
|
||||||
|
<el-button type="text" size="mini" @click="nodeAdd(data)"><i class="el-icon-plus"/></el-button>
|
||||||
|
<el-button type="text" size="mini"><i class="el-icon-edit"/></el-button>
|
||||||
|
<el-button type="text" size="mini"><i class="el-icon-delete"/></el-button>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</el-tree>
|
||||||
</el-aside>
|
</el-aside>
|
||||||
<el-main>
|
<el-main>
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
@@ -47,78 +67,135 @@
|
|||||||
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
|
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
|
|
||||||
<!-- 添加或修改接口对话框 -->
|
|
||||||
<el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
|
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
||||||
<el-form-item label="接口名称" prop="name">
|
|
||||||
<el-input v-model="form.name" placeholder="请输入接口名称"/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="接口请求类型" prop="method">
|
|
||||||
<el-select v-model="form.method" placeholder="请选择接口请求类型" clearable>
|
|
||||||
<el-option v-for="dict in dict.type.http_method" :key="dict.value" :label="dict.label" :value="dict.value"/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="接口路径" prop="uri">
|
|
||||||
<el-input v-model="form.uri" placeholder="请输入接口路径"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
||||||
<el-button @click="cancel">取 消</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {listApi, getApi, delApi, addApi, updateApi, listGroup, delGroup, addGroup, updateGroup} from "@/api/test/api";
|
import {listApi, delApi, addApi, updateApi, listGroup, delGroup, addGroup, updateGroup} from "@/api/test/api";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Api",
|
name: "Api",
|
||||||
dicts: ['http_method'],
|
dicts: ['http_method'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
filterText: "",
|
||||||
|
groupList: [{
|
||||||
|
id: 0,
|
||||||
|
label: "接口管理",
|
||||||
|
children: []
|
||||||
|
}],
|
||||||
|
groupState: "list",
|
||||||
|
editId: null,
|
||||||
loading: true,
|
loading: true,
|
||||||
// 显示搜索条件
|
|
||||||
showSearch: true,
|
showSearch: true,
|
||||||
// 总条数
|
|
||||||
total: 0,
|
total: 0,
|
||||||
groupList: [],
|
|
||||||
// 接口表格数据
|
|
||||||
apiList: [],
|
apiList: [],
|
||||||
// 弹出层标题
|
|
||||||
title: "",
|
|
||||||
// 是否显示弹出层
|
|
||||||
open: false,
|
open: false,
|
||||||
// 查询参数
|
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
groupId: 1,
|
groupId: null,
|
||||||
name: null,
|
name: null,
|
||||||
method: null,
|
method: null,
|
||||||
uri: null,
|
uri: null,
|
||||||
},
|
},
|
||||||
// 表单参数
|
form: {
|
||||||
form: {},
|
name: null
|
||||||
// 表单校验
|
},
|
||||||
rules: {}
|
rules: {
|
||||||
|
name: [
|
||||||
|
{required: true, message: "节点名不能为空", trigger: "blur"}
|
||||||
|
],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
filterText(val) {
|
||||||
|
this.$refs.tree.filter(val);
|
||||||
|
}
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getGroup();
|
this.getGroup();
|
||||||
this.getList();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getGroup() {
|
getGroup() {
|
||||||
this.loading = true;
|
listGroup().then(res => {
|
||||||
listGroup().then(response => {
|
let child = []
|
||||||
this.groupList = response.data;
|
res.data.filter(item => item.parentId === 0).map(item => {
|
||||||
this.loading = false;
|
child.push({
|
||||||
|
id: item.id,
|
||||||
|
label: item.name,
|
||||||
|
children: this.getChild(res.data, item.id)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
this.groupList[0].children = child;
|
||||||
|
this.queryParams.groupId = res.data[0].id;
|
||||||
|
this.$refs.tree.setCurrentKey(res.data[0].id);
|
||||||
|
this.getList();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getChild(data, parentId) {
|
||||||
|
return data.filter(item => item.parentId === parentId).map(item => {
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
label: item.name,
|
||||||
|
children: this.getChild(data, item.id)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
filterNode(value, data) {
|
||||||
|
if (!value) return true;
|
||||||
|
return data.label.indexOf(value) !== -1;
|
||||||
|
},
|
||||||
|
nodeClick(data) {
|
||||||
|
if (data.id > 0 && this.queryParams.groupId !== data.id) {
|
||||||
|
this.queryParams.groupId = data.id;
|
||||||
|
this.getList();
|
||||||
|
} else {
|
||||||
|
this.$refs.tree.setCurrentKey(this.queryParams.groupId);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
nodeAdd(data) {
|
||||||
|
this.groupState = "add";
|
||||||
|
const newChild = {id: -1, label: '', children: []};
|
||||||
|
if (!data.children) {
|
||||||
|
this.$set(data, 'children', []);
|
||||||
|
}
|
||||||
|
data.children.push(newChild);
|
||||||
|
this.$refs.tree.store.nodesMap[data.id].expanded = true;
|
||||||
|
this.editId = -1;
|
||||||
|
},
|
||||||
|
submitNode(node) {
|
||||||
|
if (node.data.id === -1) {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (node.data.id === -1) {
|
||||||
|
addGroup({
|
||||||
|
parentId: node.parent.data.id,
|
||||||
|
name: this.form.name,
|
||||||
|
}).then(res => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
node.data = {
|
||||||
|
id: res.data.id,
|
||||||
|
label: res.data.name,
|
||||||
|
children: []
|
||||||
|
}
|
||||||
|
this.groupState = "list";
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.reset()
|
||||||
|
},
|
||||||
|
cancelNode(node) {
|
||||||
|
if (node.data.id === -1) {
|
||||||
|
this.$refs.tree.remove(node);
|
||||||
|
}
|
||||||
|
this.groupState = "list";
|
||||||
|
},
|
||||||
/** 查询接口列表 */
|
/** 查询接口列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
@@ -128,14 +205,11 @@ export default {
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// 取消按钮
|
|
||||||
cancel() {
|
|
||||||
this.open = false;
|
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
// 表单重置
|
// 表单重置
|
||||||
reset() {
|
reset() {
|
||||||
this.form = {};
|
this.form = {
|
||||||
|
name: null,
|
||||||
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
@@ -155,34 +229,6 @@ export default {
|
|||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.$tab.openPage("修改接口", "/api/add", {id: row.id || this.ids});
|
this.$tab.openPage("修改接口", "/api/add", {id: row.id || this.ids});
|
||||||
//
|
|
||||||
// this.reset();
|
|
||||||
// const id = row.id || this.ids
|
|
||||||
// getApi(id).then(response => {
|
|
||||||
// this.form = response.data;
|
|
||||||
// this.open = true;
|
|
||||||
// this.title = "修改接口";
|
|
||||||
// });
|
|
||||||
},
|
|
||||||
/** 提交按钮 */
|
|
||||||
submitForm() {
|
|
||||||
this.$refs["form"].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
if (this.form.id != null) {
|
|
||||||
updateApi(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("修改成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
addApi(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("新增成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
@@ -197,3 +243,42 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.custom-tree-node-input {
|
||||||
|
::v-deep .el-input__inner {
|
||||||
|
height: 24px;
|
||||||
|
line-height: 24px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-container {
|
||||||
|
height: calc(100vh - 124px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-tree-node {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 14px;
|
||||||
|
padding-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-aside {
|
||||||
|
padding: 20px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-tree-node__content {
|
||||||
|
.custom-tree-node-option {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
.custom-tree-node-option {
|
||||||
|
display: unset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user