教学大纲停用改删除

This commit is contained in:
2026-09-15 16:06:16 +08:00
parent 9312327112
commit 5d928bd303
@@ -34,12 +34,13 @@
<div class="list-actions">
<el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增</el-button>
<el-button
v-if="Number(searchForm.ty) !== 1"
type="danger"
plain
icon="el-icon-delete"
:disabled="!selection.length"
icon="el-icon-circle-close"
:disabled="!activeSelection.length"
@click="handleBatchDelete"
>删除所选</el-button>
>停用所选</el-button>
<el-button icon="el-icon-download" @click="handleDownload">下载</el-button>
</div>
</div>
@@ -87,7 +88,14 @@
<el-table-column label="操作" width="160" align="center" fixed="right">
<template slot-scope="scope">
<el-button type="text" size="mini" icon="el-icon-edit" @click="handleEdit(scope.row)">编辑</el-button>
<el-button type="text" size="mini" icon="el-icon-delete" class="danger-text-btn" @click="handleDelete(scope.row)">删除</el-button>
<el-button
v-if="!isDisabled(scope.row)"
type="text"
size="mini"
icon="el-icon-circle-close"
class="danger-text-btn"
@click="handleDelete(scope.row)"
>停用</el-button>
</template>
</el-table-column>
</el-table>
@@ -341,6 +349,9 @@ export default {
}
const start = (this.pageNum - 1) * this.pageSize
return this.tableData.slice(start, start + this.pageSize)
},
activeSelection() {
return this.selection.filter(row => !this.isDisabled(row))
}
},
created() {
@@ -452,33 +463,39 @@ export default {
})
},
/* ---------- 删除 / 批量删除 ---------- */
/* ---------- 停用 / 批量停用 ---------- */
isDisabled(row) {
return Number(row && row.ty) === 1
},
handleDelete(row) {
this.$confirm('删除后该条记录将置为「停用」,是否继续?', '提示', {
if (this.isDisabled(row)) {
return
}
this.$confirm('确认停用该条教学大纲吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
return deleteSyllabus(row.bh)
}).then(() => {
this.$message.success('删除成功')
this.$message.success('停用成功')
this.fetchList()
}).catch(() => {})
},
handleBatchDelete() {
if (!this.selection.length) {
this.$message.warning('请先勾选要删除的记录')
const bhList = this.activeSelection.map(row => row.bh)
if (!bhList.length) {
this.$message.warning('请先勾选要停用的记录')
return
}
const bhList = this.selection.map(row => row.bh)
this.$confirm('确定删除所选 ' + bhList.length + ' 条记录吗?(将置为「停用」)', '提示', {
this.$confirm('确定停用所选 ' + bhList.length + ' 条记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
return batchDeleteSyllabus(bhList)
}).then(() => {
this.$message.success('批量删除成功')
this.$message.success('批量停用成功')
this.fetchList()
}).catch(() => {})
},