-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
518 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
<template> | ||
<v-list> | ||
<div v-for="item in lists" :key="item.id"> | ||
<v-list-item :append-icon="item.include == true ? 'mdi-minus-circle' : 'mdi-plus-circle'" | ||
:active="item.include == true" color="primary" | ||
@click="item.include == true ? ProjectlistDelete(item.id) : ProjectlistAdd(item.id)"> | ||
|
||
<v-list-item-title> {{ item.title }}</v-list-item-title> | ||
<v-list-item-subtitle>{{ item.description }}</v-list-item-subtitle> | ||
</v-list-item></div> | ||
<v-list-item @click="NewProjectListDialog = true">新建列表</v-list-item> | ||
</v-list> | ||
|
||
|
||
|
||
<v-dialog v-model="NewProjectListDialog"> | ||
<NewProjectList :listid="editlistid" :close="() => NewProjectListDialog = false" :callback="getProjectList"> | ||
</NewProjectList> | ||
</v-dialog> | ||
|
||
|
||
</template> | ||
<script> | ||
import NewProjectList from '@/components/NewProjectList.vue' | ||
import { localuser } from "@/stores/user"; | ||
import request from '../axios/axios' | ||
export default { | ||
components: { NewProjectList }, | ||
name: "projectlist", | ||
data() { | ||
return { | ||
localuser: localuser, | ||
userinfo: localuser.user, | ||
NewProjectListDialog: false, | ||
lists: [ | ||
], | ||
}; | ||
}, | ||
methods: { | ||
async getProjectList() { | ||
this.lists = (await request({ | ||
url: '/projectlist/check?projectid=' + this.$route.params.id, | ||
data: { | ||
userid: this.userinfo.id, | ||
projectid: this.$route.params.id, | ||
}, | ||
method: 'get', | ||
})).data | ||
}, | ||
async ProjectlistAdd(id) { | ||
await request({ | ||
url: '/projectlist/add', | ||
data: { | ||
userid: this.userinfo.id, | ||
projectid: this.$route.params.id, | ||
listid: id, | ||
}, | ||
method: 'post', | ||
}).then((res) => { | ||
this.$toast.add({ | ||
severity: "info", | ||
summary: "info", | ||
detail: res.message, | ||
life: 3000, | ||
}); | ||
this.getProjectList() | ||
}) | ||
}, | ||
async ProjectlistDelete(id) { | ||
await request({ | ||
url: '/projectlist/delete', | ||
data: { | ||
userid: this.userinfo.id, | ||
projectid: this.$route.params.id, | ||
listid: id, | ||
}, | ||
method: 'post', | ||
}).then((res) => { | ||
this.$toast.add({ | ||
severity: "info", | ||
summary: "info", | ||
detail: res.message, | ||
life: 3000, | ||
}); | ||
this.getProjectList() | ||
}) | ||
} | ||
}, | ||
mounted() { | ||
this.getProjectList(); | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<template> | ||
<v-card :title="`${listinfo.title}(#${listinfo.id})`"> | ||
<v-card-text> | ||
<v-text-field v-model="newlistinfo.title" label="名称" required></v-text-field> | ||
<v-text-field v-model="newlistinfo.description" label="简介" required></v-text-field> | ||
|
||
<v-select v-model="newlistinfo.state" :items="liststates" item-title="state" item-value="abbr" | ||
label="项目状态"></v-select> | ||
</v-card-text> | ||
<v-card-actions> | ||
<v-btn text="删除" variant="plain" @click="deleteProjectList(listid);close()" color="red"></v-btn> | ||
|
||
<v-spacer></v-spacer> | ||
<v-btn text="回退" variant="plain" @click="newlistinfo = Object.assign({}, listinfo)"></v-btn> | ||
|
||
<v-btn text="关闭" variant="plain" @click="close()"></v-btn> | ||
|
||
<v-btn color="primary" text="保存" variant="tonal" @click="updateProjectList(listid)"></v-btn> | ||
</v-card-actions> | ||
</v-card> | ||
</template> | ||
|
||
<script> | ||
import request from "../axios/axios"; | ||
export default { | ||
data() { | ||
return { | ||
liststates: [ | ||
{ state: "私密", abbr: "private" }, | ||
{ state: "公开", abbr: "public" }, | ||
], | ||
created: false, | ||
newid: 0, | ||
isVisible: false, | ||
listinfo: {}, | ||
newlistinfo: {}, | ||
}; | ||
}, | ||
props: { | ||
listid: { | ||
type: String, | ||
required: true, // 可以根据需要设置为 true | ||
}, | ||
callback: { | ||
type: Function, | ||
required: false, // 可以根据需要设置为 true | ||
}, close: { | ||
type: Function, | ||
required: false, // 可以根据需要设置为 true | ||
}, | ||
}, | ||
methods: { | ||
show() { | ||
this.created = false; | ||
this.newid = 0; | ||
this.isVisible = true; | ||
}, | ||
async getProjectList(listid) { | ||
await request.get("/projectlist/" + listid).then((res) => { | ||
console.log(res); | ||
this.$toast.add({ | ||
severity: "info", | ||
summary: "info", | ||
detail: res, | ||
life: 3000, | ||
}); | ||
if (res.status == "1") { | ||
//this.created = true | ||
this.listinfo = Object.assign({}, res.data); | ||
this.newlistinfo = Object.assign({}, res.data); | ||
} | ||
}); | ||
this.callback(); | ||
}, | ||
async updateProjectList(listid) { | ||
await request | ||
.put("/projectlist/" + listid, this.newlistinfo) | ||
.then((res) => { | ||
console.log(res); | ||
this.$toast.add({ | ||
severity: "info", | ||
summary: "info", | ||
detail: res, | ||
life: 3000, | ||
}); | ||
if (res.status == "1") { | ||
//this.created = true | ||
this.listinfo = Object.assign({}, res.data); | ||
this.newlistinfo = Object.assign({}, res.data); | ||
} | ||
}); | ||
this.callback(); | ||
}, | ||
async deleteProjectList(listid) { | ||
await request.delete("/projectlist/" + listid).then((res) => { | ||
console.log(res); | ||
this.$toast.add({ | ||
severity: "info", | ||
summary: "info", | ||
detail: res, | ||
life: 3000, | ||
}); | ||
}); | ||
this.callback(); | ||
}, | ||
}, | ||
mounted() { | ||
this.getProjectList(this.listid); | ||
}, | ||
}; | ||
</script> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<template> | ||
|
||
|
||
<v-card prepend-icon="mdi-xml" title="新建列表"> | ||
<v-card-text> | ||
<v-row dense> | ||
<v-col cols="12" md="12" sm="12"> | ||
<v-text-field label="标题" required hint="将便于查找" v-model="projectinfo.title" disabled></v-text-field> | ||
</v-col> | ||
</v-row> | ||
|
||
</v-card-text> | ||
<v-divider></v-divider> | ||
<v-card-actions> | ||
|
||
<v-spacer></v-spacer> | ||
|
||
<v-btn text="关闭" variant="plain" @click="close()"></v-btn> | ||
|
||
<v-btn color="primary" text="创建" variant="tonal" @click="newProjectList();close()" :disabled="created"></v-btn> | ||
</v-card-actions> | ||
</v-card> | ||
</template> | ||
|
||
|
||
<script> | ||
import openEdit from "../stores/openEdit"; | ||
import request from "../axios/axios"; | ||
export default { | ||
data() { | ||
return { | ||
projectinfo: { | ||
title: '新建项目列表', | ||
}, | ||
created: false, | ||
newid: 0, | ||
isVisible: false, | ||
openEdit | ||
}; | ||
}, | ||
props: { | ||
callback: { | ||
type: Function, | ||
required: false, // 可以根据需要设置为 true | ||
}, close: { | ||
type: Function, | ||
required: false, // 可以根据需要设置为 true | ||
}, | ||
}, | ||
methods: { | ||
show() { | ||
this.projectinfo = { | ||
title: '新建项目列表', | ||
}, | ||
this.created = false | ||
this.newid = 0 | ||
this.isVisible = true | ||
}, | ||
async newProjectList() { | ||
await request.post('/projectlist/', this.projectinfo).then((res) => { | ||
console.log(res) | ||
this.$toast.add({ severity: 'info', summary: 'info', detail: res, life: 3000 }); | ||
if (res.status == '1') { | ||
//this.created = true | ||
this.newid = res.id | ||
} | ||
}) | ||
this.callback() | ||
} | ||
}, | ||
}; | ||
</script> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.