fix:链接管理 删除链接二次弹框

This commit is contained in:
zqx0221
2021-07-27 15:37:40 +08:00
parent 818b620c20
commit 9c27738b08
+65 -41
View File
@@ -163,33 +163,46 @@
}, },
//表格中操作列删除操作弹窗 //表格中操作列删除操作弹窗
deleteLink (row) { deleteLink (row) {
this.$confirm('此操作将删除该链接, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.delete('sarUrl/tsUrl/delete', { this.$http.delete('sarUrl/tsUrl/delete', {
id: row.id id: row.id
}, { }, {
_this: this, _this: this,
loading: 'Loading' loading: 'Loading'
}, res => { }, res => {
if (res.ok) { if (res.ok) {
this.$message.success('删除成功') this.$message.success('删除成功')
let arr = [] let arr = []
for (let a = 0; a < this.linkList.length; a++) { for (let a = 0; a < this.linkList.length; a++) {
if (this.linkList[a].id === row.id) { if (this.linkList[a].id === row.id) {
this.linkList.splice(a, 1) this.linkList.splice(a, 1)
} }
}
this.linkList.forEach((item, index) => {
let json = {}
json.id = item.id
json.orderBy = index + 1
arr.push(json)
})
this.$http.putData('sarUrl/tsUrl/updateOrder', JSON.stringify(arr), {}, res => {
this.getLink()
})
}else {
this.$message.warning(res.message)
} }
this.linkList.forEach((item, index) => {
let json = {}
json.id = item.id
json.orderBy = index + 1
arr.push(json)
})
this.$http.putData('sarUrl/tsUrl/updateOrder', JSON.stringify(arr), {}, res => {
this.getLink()
})
}else {
this.$message.warning(res.message)
}
}) })
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
}, },
//头部删除按钮 //头部删除按钮
deleteAllLink() { deleteAllLink() {
@@ -202,28 +215,39 @@
this.$message.warning('请选择要删除的链接') this.$message.warning('请选择要删除的链接')
} else { } else {
this.modalRole = true this.modalRole = true
this.$confirm('此操作将删除链接, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.delete('sarUrl/tsUrl/deleteBatch', { this.$http.delete('sarUrl/tsUrl/deleteBatch', {
ids: this.ids ids: this.ids
}, {}, res => { }, {}, res => {
if (res.ok) { if (res.ok) {
this.$message.success('删除成功') this.$message.success('删除成功')
let arr = this.linkList.filter(items => { let arr = this.linkList.filter(items => {
if (!this.ids.includes(items.id)) return items; if (!this.ids.includes(items.id)) return items;
}) })
let newArr = [] let newArr = []
arr.forEach((item, index) => { arr.forEach((item, index) => {
let json = {} let json = {}
json.id = item.id json.id = item.id
json.orderBy = index + 1 json.orderBy = index + 1
newArr.push(json) newArr.push(json)
}) })
this.$http.putData('sarUrl/tsUrl/updateOrder', JSON.stringify(newArr), {}, res => { this.$http.putData('sarUrl/tsUrl/updateOrder', JSON.stringify(newArr), {}, res => {
this.getLink() this.getLink()
}) })
}else { }else {
this.$message.warning(res.message) this.$message.warning(res.message)
} }
}) })
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
} }
}, },
//弹窗关闭操作 //弹窗关闭操作