批量撤销

This commit is contained in:
吴舒先 2024-07-12 16:47:21 +08:00
parent 4e52f5ec4a
commit 8ab1de5930
2 changed files with 47 additions and 55 deletions

View File

@ -11,7 +11,7 @@
<el-main class ='container_Tools_Main'>
<el-header class ='containerTools'>
<!-- 模式切换按钮 -->
<el-button class = 'btnDelete'>
<el-button class = 'btnDelete' @click="deleteSelected">
<el-tooltip content = '批量删除'>
<el-icon><Delete /></el-icon>
</el-tooltip>
@ -352,6 +352,49 @@ export default{
this.$handleNetError(error);
});
},
async deleteSelected(){
//
if(this.selectedColumnData.length == 0){
this.$message({
type: 'warning',
message: '请选择要删除的线索'
});
return;
}
//
const deleteItems = this.selectedColumnData.map(item=>({
table_id: this.clueId,
clue_id: item.clue_id
}));
let flag = true;
try{
for(let i = 0; i < deleteItems.length; i++){
let response = await this.$axios.post('http://localhost:8000/delClue/', deleteItems[i]);
if(response.data.message == "删除失败"){
flag = false;
this.$message({
type:'error',
message:'删除失败,请重试!'
});
}
}
}catch(error){
flag = false;
this.$handleNetError(error);
}
if(flag){
this.$message({
type: 'success',
message: '删除成功,即将刷新界面'
});
//
location.reload();
}
},
// 线
editClue(row){
let editDataID = {

View File

@ -182,43 +182,7 @@ export default {
.catch(error=>{
this.$handleNetError(error); //
})
}
if (row.type == 0){ //
this.$axios.post('http:localhosat:8000/deleteTable/',{table_id:row.table_id}).then(response=>{
if(response.data.message == '删除成功'){
//
this.$message({
type: 'success',
message: '删除成功,即将刷新界面'
});
location.reload(); //
}
})
.catch(error=>{
this.$handleNetError(error);
})
}else if(row.type == 1){ // 线
this.$axios.post('http:localhosat:8000/deleteSelected/',{table_id:row.table_id, clue_id:row.clue_id}).then(response=>{
if(response.data.message == '删除成功'){
//
this.$message({
type: 'success',
message: '删除成功,即将刷新界面'
});
location.reload(); //
}else{
this.$message({
type: 'error',
message: '删除失败'
});
}
})
.catch(error=>{
this.$handleNetError(error); //
})
}
}
},
// 线
async deleteSelected(){
@ -236,9 +200,6 @@ export default {
type: row.type,
table_id: row?.table_id, //
clue_id: row?.clue_id ?? null, // clue_idnull
type: row.type,
table_id: row?.table_id, //
clue_id: row?.clue_id ?? null, // clue_idnull
}));
let flag = true;
@ -248,13 +209,7 @@ export default {
for(let i = 0; i < deleteItems.length; i++){
if(deleteItems[i].type == 0){ //
let response = await this.$axios.post('http://localhost:8000/deleteTable',{table_id: deleteItems[i].table_id})
if(response.data.message == '删除成功'){
//
this.$message({
type: 'success',
message: '删除成功'
});
}else{
if(response.data.message == '删除失败'){
this.$message({
type: 'error',
message: '删除失败'
@ -263,13 +218,7 @@ export default {
}
}else if(deleteItems[i].type == 1){ // 线
let response = await this.$axios.post('http://localhost:8000/deleteSelected/',{table_id:deleteItems[i].table_id, clue_id:deleteItems[i].clue_id})
if(response.data.message == '删除成功'){
//
this.$message({
type: 'success',
message: '删除成功'
});
}else{
if(response.data.message == '删除失败'){
this.$message({
type: 'error',
message: '删除失败'