fix(wms/coil/materialWarning): 优化物料告警页面的操作权限和选择逻辑

1. 新增表格行选择校验,仅未处理告警可被选中
2. 给处理、忽略按钮新增未处理状态校验,仅未处理告警显示操作按钮
3. 优化批量处理/忽略逻辑,过滤已处理的选中项并更新提示文案
4. 移除单条处理的确认弹窗逻辑
This commit is contained in:
2026-06-22 14:48:14 +08:00
parent 15703216c3
commit eda206a4d5

View File

@@ -92,7 +92,7 @@
</el-row>
<el-table v-loading="loading" :data="materialWarningList" :row-class-name="getRowClassName" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="selection" width="55" align="center" :selectable="checkSelectable" />
<!-- <el-table-column label="钢卷ID" align="center" prop="coilId" /> -->
<el-table-column label="告警类型" align="center" prop="warningType" width="100">
<template slot-scope="scope">
@@ -143,8 +143,8 @@
<!-- <el-table-column label="备注" align="center" prop="remark" /> -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleHandle(scope.row)">处理</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleIgnore(scope.row)">忽略</el-button>
<el-button v-if="scope.row.warningStatus == 0" size="mini" type="text" icon="el-icon-edit" @click="handleHandle(scope.row)">处理</el-button>
<el-button v-if="scope.row.warningStatus == 0" size="mini" type="text" icon="el-icon-edit" @click="handleIgnore(scope.row)">忽略</el-button>
<el-button size="mini" type="text" icon="el-icon-view" @click="showDetail(scope.row)">详情</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
</template>
@@ -402,41 +402,45 @@ export default {
},
/** 处理按钮操作 */
handleHandle(row) {
this.$modal.confirm('确认将该告警标记为已处理?').then(() => {
this.handleRemarkMode = 'single'
this.handleRemarkTarget = row
this.handleRemarkForm.handleRemark = ''
this.handleRemarkDialogVisible = true
this.$nextTick(() => {
this.$refs.handleRemarkForm && this.$refs.handleRemarkForm.clearValidate()
})
}).catch(() => {})
this.handleRemarkMode = 'single'
this.handleRemarkTarget = row
this.handleRemarkForm.handleRemark = ''
this.handleRemarkDialogVisible = true
this.$nextTick(() => {
this.$refs.handleRemarkForm && this.$refs.handleRemarkForm.clearValidate()
})
},
/** 批量处理按钮操作 */
handleBatchProcess() {
if (this.ids.length === 0) {
this.$modal.msgWarning('请至少选择一条记录')
const unprocessedIds = this.ids.filter(id => {
const row = this.materialWarningList.find(r => r.warningId === id)
return row && row.warningStatus == 0
})
if (unprocessedIds.length === 0) {
this.$modal.msgWarning('选中的记录中没有未处理的告警')
return
}
this.$modal.confirm('确认将选中的 ' + this.ids.length + ' 条告警标记为已处理?').then(() => {
this.handleRemarkMode = 'batch'
this.handleRemarkTarget = this.ids
this.handleRemarkForm.handleRemark = ''
this.handleRemarkDialogVisible = true
this.$nextTick(() => {
this.$refs.handleRemarkForm && this.$refs.handleRemarkForm.clearValidate()
})
}).catch(() => {})
this.handleRemarkMode = 'batch'
this.handleRemarkTarget = unprocessedIds
this.handleRemarkForm.handleRemark = ''
this.handleRemarkDialogVisible = true
this.$nextTick(() => {
this.$refs.handleRemarkForm && this.$refs.handleRemarkForm.clearValidate()
})
},
/** 批量忽略按钮操作 */
handleBatchIgnore() {
if (this.ids.length === 0) {
this.$modal.msgWarning('请至少选择一条记录')
const unprocessedIds = this.ids.filter(id => {
const row = this.materialWarningList.find(r => r.warningId === id)
return row && row.warningStatus == 0
})
if (unprocessedIds.length === 0) {
this.$modal.msgWarning('选中的记录中没有未处理的告警')
return
}
this.$modal.confirm('确认将选中的 ' + this.ids.length + ' 条告警标记为已忽略?').then(() => {
this.$modal.confirm('确认将选中的 ' + unprocessedIds.length + ' 条告警标记为已忽略?').then(() => {
this.loading = true
return batchHandleMaterial({ warningIds: this.ids, warningStatus: 2 })
return batchHandleMaterial({ warningIds: unprocessedIds, warningStatus: 2 })
}).then(() => {
this.loading = false
this.$modal.msgSuccess('批量忽略成功')
@@ -446,17 +450,18 @@ export default {
this.loading = false
})
},
checkSelectable(row) {
return row.warningStatus == 0
},
/** 处理历史告警按钮操作(批量标记今天以前的所有记录为已处理) */
handleBatchProcessHistory() {
this.$modal.confirm('确认将今天以前的所有告警标记为已处理?').then(() => {
this.handleRemarkMode = 'history'
this.handleRemarkTarget = null
this.handleRemarkForm.handleRemark = ''
this.handleRemarkDialogVisible = true
this.$nextTick(() => {
this.$refs.handleRemarkForm && this.$refs.handleRemarkForm.clearValidate()
})
}).catch(() => {})
this.handleRemarkMode = 'history'
this.handleRemarkTarget = null
this.handleRemarkForm.handleRemark = ''
this.handleRemarkDialogVisible = true
this.$nextTick(() => {
this.$refs.handleRemarkForm && this.$refs.handleRemarkForm.clearValidate()
})
},
/** 忽略历史告警按钮操作(批量标记今天以前的所有记录为已忽略) */
handleBatchIgnoreHistory() {