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

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

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