feat(异常管理): 增强异常表格功能并优化显示

添加coil-info属性支持以显示异常挂载时机
新增创建人和创建时间列
调整主缺陷列位置
优化质量状态显示逻辑
This commit is contained in:
2026-05-05 17:42:41 +08:00
parent 2f5c799143
commit bc2e42b110
7 changed files with 41 additions and 11 deletions

View File

@@ -51,7 +51,7 @@
</el-form>
<abnormal-table ref="abnormalTable" :list="coilAbnormalList"
:editable="true" :show-coil="false"
:editable="true" :show-coil="false" :coil-info="currentCoil"
@delete="handleDelete" @update="handleUpdate">
</abnormal-table>

View File

@@ -36,7 +36,7 @@
</el-row>
<abnormal-table ref="abnormalTable" :list="coilAbnormalList"
:editable="true" :show-coil="false"
:editable="true" :show-coil="false"
@delete="handleDelete" @update="handleUpdate">
</abnormal-table>

View File

@@ -34,6 +34,13 @@
<dict-tag :options="dict.type.coil_abnormal_degree" :value="scope.row.degree" />
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="挂载时机" align="center" prop="abnormalTime" v-if="coilInfo.coilId">
<template slot-scope="scope">
{{ getAbnormalTime(scope.row) }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" v-if="editable">
<template slot-scope="scope">
@@ -60,6 +67,10 @@ export default {
showCoil: {
type: Boolean,
default: false
},
coilInfo: {
type: Object,
default: () => ({})
}
},
components: {
@@ -76,6 +87,22 @@ export default {
if (this.editable) {
this.$emit('update', row);
}
},
// 计算目标列的异常挂载时机
// 如果coilInfo.coilId存在且与row.coilId相同
// 判断钢卷的createBy和row.createBy是否相同
// 判断钢卷的createTime与row的createTime是否在一分钟内
// 如果是,返回'生产时'
// 如果否,返回'补录'
getAbnormalTime(row) {
if (this.coilInfo.coilId === row.coilId) {
if (this.coilInfo.createBy === row.createBy) {
if (Math.abs(new Date(this.coilInfo.createTime) - new Date(row.createTime)) < 60 * 1000) {
return '生产时'
}
}
}
return '补录'
}
}
}

View File

@@ -82,6 +82,11 @@
</div>
</template>
</el-table-column>
<el-table-column label="主缺陷" prop="mainMark" width="60">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.mainMark" :true-label="1" :false-label="0"></el-checkbox>
</template>
</el-table-column>
<el-table-column label="操作" width="80">
<template slot-scope="scope">
<el-button v-if="scope.row.abnormalId" type="text" size="mini" @click="handleDelete(scope.row)" style="color: #f56c6c;">
@@ -92,11 +97,6 @@
</el-button>
</template>
</el-table-column>
<el-table-column label="主缺陷" prop="mainMark" width="60">
<template slot-scope="scope">
<el-checkbox v-model="scope.row.mainMark" :true-label="1" :false-label="0"></el-checkbox>
</template>
</el-table-column>
</el-table>
</div>
</div>

View File

@@ -725,7 +725,7 @@
<span class="section-title">异常信息</span>
</div>
<div class="section-body">
<abnormal-table ref="abnormalTable" :list="abmornalList" :editable="false" :show-coil="false" />
<abnormal-table ref="abnormalTable" :list="abmornalList" :editable="false" :show-coil="false" :coil-info="coilInfo" />
</div>
</div>

View File

@@ -27,7 +27,7 @@
</el-form>
<abnormal-table v-loading="loading" ref="abnormalTable" :list="coilAbnormalList"
:editable="true" :show-coil="false"
:editable="true" :show-coil="false" :coil-info="coilInfo"
@delete="handleDelete" @update="handleUpdate">
</abnormal-table>

View File

@@ -51,7 +51,8 @@
<!-- 质量状态点击后会出现弹窗显示详细信息 -->
<template v-else-if="column.prop === 'qualityStatus'">
<div @click="handleQualityStatusClick(scope.row)" style="cursor: pointer; background-color: #f5f7fa;">
<dict-tag :options="dict.type.coil_quality_status" :value="scope.row.qualityStatus"></dict-tag>
<dict-tag v-if="scope.row.qualityStatus" :options="dict.type.coil_quality_status" :value="scope.row.qualityStatus"></dict-tag>
<span v-else>暂未判级</span>
</div>
</template>
<!-- 默认渲染 -->
@@ -64,7 +65,7 @@
<el-dialog title="钢卷异常信息" :visible.sync="abmornal.visible" width="60%">
<abnormal-table ref="abnormalTable" :list="abmornal.data"
:editable="false" :show-coil="false" v-loading="abmornal.loading">
:editable="false" :show-coil="false" :coil-info="abmornal.currentCoil" v-loading="abmornal.loading">
</abnormal-table>
</el-dialog>
</div>
@@ -123,6 +124,7 @@ export default {
visible: false,
data: {},
loading: false,
currentCoil: {},
}
}
},
@@ -239,6 +241,7 @@ export default {
handleQualityStatusClick(row) {
this.abmornal.visible = true
this.abmornal.loading = true
this.abmornal.currentCoil = row
listCoilAbnormal({
coilId: row.coilId
}).then(response => {