feat: 增加删除项目功能

This commit is contained in:
maxmon 2021-07-14 23:39:53 +08:00
parent e73e573dd5
commit ec99bc5b11
1 changed files with 29 additions and 9 deletions

View File

@ -52,6 +52,7 @@
<p style="font-size:10px">请选择包含文本文件的ziptar文件</p>
<input type="file" id="file-input" accept=".zip,.tar"/>
<p class="edit-box-btn-area">
<button class="button danger" @click="del" v-if="page==='edit'">删除</button>
<button class="button" @click="submit">提交</button>
<button class="button" @click="toList">取消</button>
</p>
@ -122,6 +123,30 @@ export default {
setType (ev) {
this.projectType = ev.target.value
},
del () {
//
const that = this
if (prompt(`请输入${this.projectName}来确认删除。`) === this.projectName) {
get(`/v1/project/delete_program?projectName=${this.projectName}`, function () {
that.init()
})
} else {
alert('输入错误,删除失败')
}
},
init () {
//
const that = this
that.type = ''
that.projectName = ''
//
get('/v1/index', function (info) {
that.$set(that, 'projects', info)
that.projectName = ''
that.projectType = ''
that.page = 'list'
})
},
submit () {
const that = this
const newEntityTypes = that.typeList.map((type) => {
@ -136,15 +161,7 @@ export default {
projectType: that.projectType,
entityTypes: JSON.stringify(newEntityTypes)
}, function () {
that.type = ''
that.projectName = ''
//
get('/v1/index', function (info) {
that.$set(that, 'projects', info)
that.projectName = ''
that.projectType = ''
that.page = 'list'
})
that.init()
//
const fileInputElement = document.getElementById('file-input')
if (fileInputElement.files[0]) {
@ -281,6 +298,9 @@ export default {
border: 1px solid #ccc;
padding: 5px 10px;
}
.button.danger {
background-color: #ff0000;
}
.project-box-titile {
margin: auto;
width: 500px;