删除增加二次确认

This commit is contained in:
guoyue 2022-11-03 17:58:28 +08:00
parent 14f82809f6
commit 3e1ff71686
6 changed files with 138 additions and 76 deletions

View File

@ -356,6 +356,11 @@ export default {
deleteHandle2(id) { deleteHandle2(id) {
console.log('删除========================》', id, this.dataListSelections) console.log('删除========================》', id, this.dataListSelections)
this.$confirm('确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const ids = [] const ids = []
if (id) { if (id) {
ids.push(id) ids.push(id)
@ -368,8 +373,18 @@ export default {
} }
this.$http.post('/resource/delete', { ids: ids }).then(res => { this.$http.post('/resource/delete', { ids: ids }).then(res => {
console.log('删除成功', res) console.log('删除成功', res)
this.$message({
type: 'success',
message: '删除成功!'
});
this.getDataList() this.getDataList()
}) })
}).catch(() => {
// this.$message({
// type: 'info',
// message: '已取消删除'
// });
});
}, },
// 导出 // 导出
exportHandle() { exportHandle() {

View File

@ -70,7 +70,7 @@ export default {
mixinViewModuleOptions: { mixinViewModuleOptions: {
getDataListURL: "/fuse/page", getDataListURL: "/fuse/page",
exportURL: "/ability/bsabilityai/export", exportURL: "/ability/bsabilityai/export",
deleteURL: "/fuse", deleteURL: "/fuse/delete",
getDataListIsPage: true, getDataListIsPage: true,
deleteIsBatch: false, deleteIsBatch: false,
}, },
@ -93,6 +93,11 @@ export default {
}, },
methods: { methods: {
deleteRow(id) { deleteRow(id) {
this.$confirm('确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.delete('/fuse/delete', { this.$http.delete('/fuse/delete', {
data: [id] data: [id]
}).then(res => { }).then(res => {
@ -111,6 +116,8 @@ export default {
}).catch(err => { }).catch(err => {
this.$message.error(err); this.$message.error(err);
}) })
}).catch(() => {
});
}, },
// //
searchData() { searchData() {

View File

@ -12,8 +12,8 @@
v-if="dataInfo.length > 1">删除 v-if="dataInfo.length > 1">删除
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-button class="add-btn" size="small" v-if="index == dataInfo.length - 1" @click="addItem" <el-button class="add-btn" size="small" v-if="index == dataInfo.length - 1" @click="addItem" type="primary">
type="primary">添加 添加
</el-button> </el-button>
</div> </div>
</div> </div>
@ -97,8 +97,19 @@ export default {
}) })
}, },
// //
deleteItem(list, index) { deleteItem(index) {
this.$confirm('确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.dataInfo.splice(index, 1) this.dataInfo.splice(index, 1)
}).catch(() => {
});
} }
} }
} }

View File

@ -16,8 +16,8 @@
v-if="!disabledType && dataInfo.length > 1">删除 v-if="!disabledType && dataInfo.length > 1">删除
</el-button> </el-button>
</el-form-item> </el-form-item>
<el-button class="add-btn" size="small" <el-button class="add-btn" size="small" v-if="!disabledType && index == dataInfo.length - 1"
v-if="!disabledType && index == dataInfo.length - 1" @click="addItem" type="primary">添加 @click="addItem" type="primary">添加
</el-button> </el-button>
</div> </div>
@ -100,8 +100,19 @@ export default {
}) })
}, },
// //
deleteItem(list, index) { deleteItem(index) {
this.$confirm('确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.dataInfo.splice(index, 1) this.dataInfo.splice(index, 1)
}).catch(() => {
});
} }
} }
} }

View File

@ -84,6 +84,11 @@ export default {
}, },
methods: { methods: {
deleteRow(id) { deleteRow(id) {
this.$confirm('确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http.delete('/fuse/delete', { this.$http.delete('/fuse/delete', {
data: [id] data: [id]
}).then(res => { }).then(res => {
@ -102,6 +107,8 @@ export default {
}).catch(err => { }).catch(err => {
this.$message.error(err); this.$message.error(err);
}) })
}).catch(() => {
});
}, },
// //
searchData() { searchData() {

View File

@ -110,8 +110,19 @@ export default {
}) })
}, },
// //
deleteItem(list, index) { deleteItem(index) {
this.$confirm('确认是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.dataInfo.splice(index, 1) this.dataInfo.splice(index, 1)
}).catch(() => {
});
} }
} }
} }