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) {
this.$confirm('此操作将删除该链接, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.delete('sarUrl/tsUrl/delete', {
id: row.id
id: row.id
}, {
_this: this,
loading: 'Loading'
_this: this,
loading: 'Loading'
}, res => {
if (res.ok) {
this.$message.success('删除成功')
let arr = []
for (let a = 0; a < this.linkList.length; a++) {
if (this.linkList[a].id === row.id) {
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)
if (res.ok) {
this.$message.success('删除成功')
let arr = []
for (let a = 0; a < this.linkList.length; a++) {
if (this.linkList[a].id === row.id) {
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)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
//头部删除按钮
deleteAllLink() {
@@ -202,28 +215,39 @@
this.$message.warning('请选择要删除的链接')
} else {
this.modalRole = true
this.$confirm('此操作将删除链接, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.delete('sarUrl/tsUrl/deleteBatch', {
ids: this.ids
ids: this.ids
}, {}, res => {
if (res.ok) {
this.$message.success('删除成功')
let arr = this.linkList.filter(items => {
if (!this.ids.includes(items.id)) return items;
})
let newArr = []
arr.forEach((item, index) => {
let json = {}
json.id = item.id
json.orderBy = index + 1
newArr.push(json)
})
this.$http.putData('sarUrl/tsUrl/updateOrder', JSON.stringify(newArr), {}, res => {
this.getLink()
})
}else {
this.$message.warning(res.message)
}
if (res.ok) {
this.$message.success('删除成功')
let arr = this.linkList.filter(items => {
if (!this.ids.includes(items.id)) return items;
})
let newArr = []
arr.forEach((item, index) => {
let json = {}
json.id = item.id
json.orderBy = index + 1
newArr.push(json)
})
this.$http.putData('sarUrl/tsUrl/updateOrder', JSON.stringify(newArr), {}, res => {
this.getLink()
})
}else {
this.$message.warning(res.message)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
}
},
//弹窗关闭操作