提交 6785057a authored 作者: pengxiaohui's avatar pengxiaohui

内容管理批量删除增加提示

上级 d9229d8e
......@@ -243,8 +243,24 @@ export default {
},
// 删除
handleRemove() {
const ids = this.multipleSelection.map(item => item.id)
this.fetchDeleteAd(ids)
let isWarn = false
const ids = []
this.multipleSelection.forEach(item => {
if (item.audit_status === 2 && item.is_publish === 1) {
isWarn = true
}
ids.push(item.id)
})
if (isWarn) {
this.$confirm('选中的项中有已经发布上线的广告, 是否继续执行删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(() => {
this.fetchDeleteAd(ids)
}).catch(() => {});
} else {
this.fetchDeleteAd(ids)
}
},
handleCreate() {
this.drawFormOptions.type = 'create'
......
......@@ -254,15 +254,24 @@ export default {
this.multipleSelection = value
}, // 删除
handleRemove() {
const ids = this.multipleSelection.map(item => item.id)
batchDeleteArticle({ ids }).then(res => {
if (res.code === 0) {
this.$message.success('删除成功')
this.$refs.tableList.refetch(true)
} else {
this.$message.error(res.message)
let isWarn = false
const ids = []
this.multipleSelection.forEach(item => {
if (item.audit_status === 2 && item.is_publish === 1) {
isWarn = true
}
ids.push(item.id)
})
if (isWarn) {
this.$confirm('选中的项中有已经发布上线的文章, 是否继续执行删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(() => {
this.fetchDeleteArticle(ids)
}).catch(() => {});
} else {
this.fetchDeleteArticle(ids)
}
},
handleCreate() {
this.drawFormOptions.type = 'create'
......@@ -307,7 +316,7 @@ export default {
this.$refs.tableList.refetch()
this.$refs.articleDrawer.closeDrawer()
} else {
this.$message.error(res.message || '新建广告失败')
this.$message.error(res.message || '新建文章失败')
}
})
},
......@@ -331,6 +340,16 @@ export default {
this.$message.error(res.message)
}
})
},
fetchDeleteArticle(ids) {
batchDeleteArticle({ ids }).then(res => {
if (res.code === 0) {
this.$message.success('删除成功')
this.$refs.tableList.refetch(true)
} else {
this.$message.error(res.message)
}
})
}
},
beforeMount() {
......
......@@ -217,15 +217,24 @@ export default {
},
// 删除
handleRemove() {
const ids = this.multipleSelection.map(item => item.id)
batchDeleteImgText({ ids }).then(res => {
if (res.code === 0) {
this.$message.success('删除成功')
this.$refs.tableList.refetch(true)
} else {
this.$message.error(res.message)
let isWarn = false
const ids = []
this.multipleSelection.forEach(item => {
if (item.audit_status === 2 && item.is_publish === 1) {
isWarn = true
}
ids.push(item.id)
})
if (isWarn) {
this.$confirm('选中的项中有已经发布上线的文章, 是否继续执行删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(() => {
this.fetchDeleteImgText(ids)
}).catch(() => {});
} else {
this.fetchDeleteImgText(ids)
}
},
handleCreate() {
this.drawFormOptions.type = 'create'
......@@ -242,9 +251,9 @@ export default {
if (val[key] === '') delete val[key]
})
if (this.drawFormOptions.type === 'create') {
this.fetchCreateArticle(val)
this.fetchCreateImgText(val)
} else {
this.fetchUpdateArticle(val)
this.fetchUpdateImgText(val)
}
},
handleAuditSubmit(val) {
......@@ -263,7 +272,7 @@ export default {
// true 强制刷新
this.$refs.tableList.refetch(true)
},
fetchCreateArticle(val) {
fetchCreateImgText(val) {
createImgText(val).then(res => {
if (res.code === 0 && res.data && res.data.id) {
this.$message.success('新建图文成功')
......@@ -274,7 +283,7 @@ export default {
}
})
},
fetchUpdateArticle(val) {
fetchUpdateImgText(val) {
updateImgText(this.drawItem.id, val).then(res => {
if (res.code === 0 && res.data && res.data.status) {
this.$message.success('更改图文成功')
......@@ -284,6 +293,16 @@ export default {
this.$message.error(res.message || '更改图文失败')
}
})
},
fetchDeleteImgText(ids) {
batchDeleteImgText({ ids }).then(res => {
if (res.code === 0) {
this.$message.success('删除成功')
this.$refs.tableList.refetch(true)
} else {
this.$message.error(res.message)
}
})
}
},
beforeMount() {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论