Commit 1d6056ee by luyt

feat:1.前端文档-后端api添加项目分类,列表,新增,编辑,删除

2.项目数据库project_info添加分类字段,并调整列表,新增,编辑接口,以分类来获取
3.新增项目移动功能-支持移动到类一个分类中
1 parent 5af1d2b9
......@@ -72,6 +72,6 @@ export default {
.wrapper-content {
margin: 30px auto;
padding: 0 10px;
max-width: 1200px;
max-width: 1300px;
}
</style>
/*
* @Author: huyue
* @Date: 2021-09-09 16:18:46
* @Last Modified by: huyue
* @Last Modified time: 2021-09-09 16:24:33
*/
import request from "@/plugins/axios";
const classify = {
getList() {
return request({
url: "/classify/getList",
method: "get",
params: {},
});
},
create(data) {
// console.log(data)
return request({
url: "/classify/create",
method: "post",
data,
});
},
update(data) {
// console.log(data)
return request({
url: "/classify/update",
method: "patch",
data,
});
},
delete(data) {
// console.log(data)
return request({
url: "/classify/delete",
method: "patch",
data,
});
},
};
export default classify;
import project from './project';
import documentation from './documentation';
import commons from './commons'
import gitLog from './gitLog'
import project from "./project";
import documentation from "./documentation";
import commons from "./commons";
import gitLog from "./gitLog";
import classify from "./classify";
export default {
project,
documentation,
commons,
gitLog
}
gitLog,
classify,
};
/*
* @Author: huyue
* @Date: 2021-09-06 15:27:21
* @Author: huyue
* @Date: 2021-09-06 15:27:21
* @Last Modified by: huyue
* @Last Modified time: 2021-09-07 10:57:27
*/
import request from '@/plugins/axios'
import request from "@/plugins/axios";
const project = {
getList() {
//按分类查找
getList(classify) {
return request({
url: '/project/getList',
method: 'get',
params: {}
})
url: "/project/getList",
method: "get",
params: {
classify,
},
});
},
create(data) {
return request({
url: '/project/create',
method: 'post',
data
})
url: "/project/create",
method: "post",
data,
});
},
update(data) {
return request({
url: '/project/update',
method: 'patch',
data
})
url: "/project/update",
method: "patch",
data,
});
},
delete(data) {
return request({
url: '/project/delete',
method: 'patch',
data
})
url: "/project/delete",
method: "patch",
data,
});
},
}
};
export default project
export default project;
......@@ -91,7 +91,8 @@ export default {
if (valid) {
if (this.isNewAdd) {
//新增
this.api.documentation.create(this.form).then((res) => {
console.log('this.form',this.form)
this.api.classify.create(this.form).then((res) => {
// console.log(res);
if (res.id) {
this.$message.success("添加成功");
......@@ -103,7 +104,7 @@ export default {
});
} else {
//编辑
this.api.documentation.update(this.form).then((res) => {
this.api.classify.update(this.form).then((res) => {
console.log(res);
if (res.id) {
this.$message.success("编辑成功");
......
<template>
<div>
<h2>项目分类</h2>
<a-list :grid="{ gutter: 16, column: 4 }" :data-source="docData">
<a-list :grid="{ gutter: 16, column: 4 }" :data-source="classifyData">
<a-list-item slot="renderItem" slot-scope="item">
<a rel="noopener noreferrer" @click="shoClassify(item)">
<a rel="noopener noreferrer" @click="showClassify(item)">
<a-card :title="item.classify_title">
<p>{{ item.classify_description }}</p>
<!-- <p v-for="(i, idx) in item.content" :key="i">{{idx + 1}}. {{i}}</p> -->
......@@ -27,31 +27,43 @@ const data = [
classify: "oss-web",
classify_title: "广联赛讯Vue业务模块1",
classify_description: "vue模板介绍与使用",
created_at: "",
updated_at: "",
del_flag: "n",
},
{
id: "2",
classify: "micro-service",
classify_title: "广联赛讯Vue业务模块2",
classify_description: "vue模板介绍与使用",
created_at: "",
updated_at: "",
del_flag: "n",
},
{
id: "3",
classify: "scrm",
classify_title: "广联赛讯Vue业务模块3",
classify_description: "vue模板介绍与使用",
created_at: "",
updated_at: "",
del_flag: "n",
},
{
id: "4",
classify: "scrm-mobile",
classify_title: "广联赛讯Vue业务模块4",
classify_description: "vue模板介绍与使用",
created_at: "",
updated_at: "",
del_flag: "n",
},
];
export default {
name: "folder",
data() {
return {
docData: data,
classifyData: data,
};
},
mounted() {
......@@ -59,15 +71,15 @@ export default {
},
methods: {
getList() {
this.api.documentation.getList().then((res) => {
this.api.classify.getList().then((res) => {
// console.log(res);
this.docData = res;
this.classifyData = res;
});
},
add() {
this.to("FolderAdd");
},
shoClassify(item) {
showClassify(item) {
this.$router.push({ name: "Home", query: { classify: item.classify } });
// if (url) {
// window.open(url, "target");
......@@ -92,7 +104,7 @@ export default {
let params = {
id: item.id,
};
const res = await this.api.documentation.delete(params);
const res = await this.api.classify.delete(params);
// console.log('res: ', res);
if (res.id) {
this.$message.success("删除成功");
......
......@@ -103,9 +103,15 @@ export default {
onSubmit() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
const classify = sessionStorage.getItem("classify");
const pramas = {
...this.form,
classify,
};
if (this.isNewAdd) {
//新增
this.api.project.create(this.form).then((res) => {
this.api.project.create(pramas).then((res) => {
// console.log('res: ', res);
if (res.id) {
this.$message.success("添加成功");
......@@ -117,7 +123,7 @@ export default {
});
} else {
//编辑
this.api.project.update(this.form).then((res) => {
this.api.project.update(pramas).then((res) => {
// console.log("res: ", res);
if (res.id) {
this.$message.success("编辑成功");
......
<template>
<div class="home-project">
<h2>{{ $route.query.classify }} 分类项目</h2>
<a-list item-layout="horizontal" :data-source="projectData">
<a-list-item slot="renderItem" slot-scope="item">
<a-list-item-meta>
......@@ -51,7 +52,6 @@
<a-button type="link" @click="checkGitLog(item)">
查看git提交信息
</a-button>
</a-descriptions-item>
<a-descriptions-item label="git项目ID">
<a-popover title="什么是git ID">
......@@ -59,7 +59,7 @@
<p>1.进入git仓库项目设置</p>
<p>2.查看 Project ID</p>
</template>
{{ item.git_id }} <a-icon type="question" />
{{ item.git_id }} <a-icon type="question" />
</a-popover>
</a-descriptions-item>
</a-descriptions>
......@@ -67,6 +67,22 @@
<a slot="actions" @click="editFn(item)">编辑</a>
<a slot="actions" @click="commentsFn(item)">评论</a>
<a slot="actions" @click="delFn(item)">删除</a>
<template slot="actions">
<a-select
size="small"
v-model="item.classify"
@select="handleSelect(item)"
>
<!-- @change="handleChange(item)" -->
<a-select-option
v-for="classitem in classifyData"
:key="classitem.id"
:value="classitem.classify"
>
{{ classitem.classify }}
</a-select-option>
</a-select>
</template>
</a-list-item>
</a-list>
<div class="icon-anticons" @click="add">
......@@ -76,30 +92,32 @@
</template>
<script>
const data = [
{
id: 1,
project_title: "广联运营平台",
project_description: "广联运营平台",
developer_name: "胡悦、陈婉清",
config_name: "/admin_common",
test_url: "http://sso.test.glsx.com.cn/#/login",
product_url: "http://sso.glsx.com.cn/#/login",
technology: "vue",
git_url:'http://giturl.com/',
git_id:173
},
{
id: 2,
project_title: "账户管理",
project_description: "商户、角色、员工管理",
developer_name: "胡悦、陈婉清",
config_name: "/glsx-oss-account-config",
test_url: "http://glsx-account-merchants.test.glsx.com.cn",
product_url: "http://glsx-account.glsx.com.cn",
technology: "vue",
git_url:'http://giturl.com/',
git_id:173
},
// {
// id: 1,
// project_title: "广联运营平台",
// project_description: "广联运营平台",
// developer_name: "胡悦、陈婉清",
// config_name: "/admin_common",
// test_url: "http://sso.test.glsx.com.cn/#/login",
// product_url: "http://sso.glsx.com.cn/#/login",
// technology: "vue",
// git_url: "http://giturl.com/",
// git_id: 173,
// classify: "other",
// },
// {
// id: 2,
// project_title: "账户管理",
// project_description: "商户、角色、员工管理",
// developer_name: "胡悦、陈婉清",
// config_name: "/glsx-oss-account-config",
// test_url: "http://glsx-account-merchants.test.glsx.com.cn",
// product_url: "http://glsx-account.glsx.com.cn",
// technology: "vue",
// git_url: "http://giturl.com/",
// git_id: 173,
// classify: "other",
// },
];
import projectImgUrl from "@/assets/project.jpg";
export default {
......@@ -108,23 +126,34 @@ export default {
return {
projectData: data,
projectImgUrl,
classifyData: [],
// selectClassify: "", //选中的分类
};
},
mounted() {
this.getList();
this.getClassifyList();
},
methods: {
getList() {
this.api.project.getList().then((res) => {
const classify = this.$route.query.classify;
this.api.project.getList(classify).then((res) => {
// console.log(res);
this.projectData = res;
});
},
//设置 项目分类
setClassifyFn() {
const classify = this.$route.query.classify;
sessionStorage.setItem("classify", classify);
},
add() {
this.to("HomeAdd");
this.setClassifyFn();
},
editFn(item) {
this.to("HomeAdd", item);
this.setClassifyFn();
},
commentsFn(item) {
// this.to("Record", comments);
......@@ -155,13 +184,45 @@ export default {
}
});
},
checkGitLog(item){
if(!item.git_id){
checkGitLog(item) {
if (!item.git_id) {
return this.$message.error("请填写gitlab项目id");
}
// console.log('item: ', item);
this.$router.push({name:'GitLog',query:{projectId:item.git_id}})
}
this.$router.push({ name: "GitLog", query: { projectId: item.git_id } });
},
//h获取全部的分类
getClassifyList() {
this.api.classify.getList().then((res) => {
console.log(res);
this.classifyData = res;
});
},
//移动项目,选中某个分类
handleSelect(item) {
console.log("item: ", item);
const that = this;
this.$confirm({
title: "您确定要移动项目?",
content: `您确定要移动项目到 ${item.classify} 分类?`,
onOk() {
//编辑
that.api.project.update(item).then((res) => {
// console.log("res: ", res);
if (res.id) {
that.$message.success("移动成功");
//重新获取列表
that.getList();
} else {
that.$message.error("移动失败");
}
});
},
onCancel() {},
okText: "确认",
cancelText: "取消",
});
},
},
};
</script>
......@@ -171,12 +232,15 @@ export default {
.ant-list-item {
padding: 10px;
}
.ant-select {
width: 90px !important;
}
}
.ant-list-split .ant-list-item {
transition: all 0.3s;
}
.ant-list-split .ant-list-item:hover {
border-color: rgba(0, 0, 0, 0.09);
box-shadow: 0 2px 8px rgba(0, 0, 0,0.09);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!