feat(wms/coil): 为钢卷相关页面添加异常继承功能
本次修改在typing.vue、merge.vue、split.vue和stepSplit.vue四个钢卷相关页面中,新增了异常继承的完整功能: 1. 重构异常信息展示区域,添加继承标记样式 2. 新增继承异常按钮,打开异常选择弹窗 3. 实现从源钢卷拉取异常列表、批量选择继承异常的功能 4. 继承的异常会标记来源并使用特殊样式展示
This commit is contained in:
@@ -280,21 +280,29 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="异常信息">
|
||||
<div class="abnormal-container">
|
||||
<div v-for="(abnormal, index) in abnormals" :key="index" class="abnormal-item"
|
||||
@click="editAbnormal(index)">
|
||||
<div class="abnormal-content">
|
||||
<div class="abnormal-info">
|
||||
<div class="abnormal-position">{{ getAbnormalPositionText(abnormal.position) }}</div>
|
||||
<div class="abnormal-code">{{ getAbnormalCodeText(abnormal.defectCode) }}</div>
|
||||
<div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px;">
|
||||
<div class="abnormal-container" style="margin-top: 0;">
|
||||
<div v-for="(abnormal, index) in abnormals" :key="index"
|
||||
:class="['abnormal-item', { inherited: abnormal._inherited }]"
|
||||
@click="editAbnormal(index)">
|
||||
<div class="abnormal-content">
|
||||
<div class="abnormal-info">
|
||||
<div class="abnormal-position">{{ getAbnormalPositionText(abnormal.position) }}</div>
|
||||
<div class="abnormal-code">{{ getAbnormalCodeText(abnormal.defectCode) }}</div>
|
||||
<div v-if="abnormal._inherited" class="abnormal-inherit-tip">继承 · {{ abnormal.processSource }}</div>
|
||||
</div>
|
||||
<el-button type="danger" size="mini" icon="el-icon-close" class="abnormal-delete"
|
||||
@click.stop="deleteAbnormal(index)"></el-button>
|
||||
</div>
|
||||
<el-button type="danger" size="mini" icon="el-icon-close" class="abnormal-delete"
|
||||
@click.stop="deleteAbnormal(index)"></el-button>
|
||||
</div>
|
||||
<div class="abnormal-add" @click="addAbnormal">
|
||||
<i class="el-icon-plus"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="abnormal-add" @click="addAbnormal">
|
||||
<i class="el-icon-plus"></i>
|
||||
</div>
|
||||
<el-button type="text" size="mini" icon="el-icon-download"
|
||||
style="color: #409eff; white-space: nowrap;" @click="handleInheritAbnormal">
|
||||
继承异常
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -351,11 +359,61 @@
|
||||
<el-button type="primary" @click="useCacheData">使用暂存数据</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 异常继承弹窗 -->
|
||||
<el-dialog title="异常继承" :visible.sync="inheritDialogVisible" width="1200px" append-to-body top="5vh"
|
||||
:close-on-click-modal="false">
|
||||
<div v-loading="inheritLoading">
|
||||
<template v-if="parentCoils.length > 0">
|
||||
<el-alert title="以下为当前钢卷的异常记录,请选择要继承的异常" type="info" :closable="false" show-icon style="margin-bottom: 16px;" />
|
||||
<div v-for="(parent, pIdx) in parentCoils" :key="parent.coilId" class="parent-coil-section">
|
||||
<div class="parent-header">
|
||||
<span class="parent-title">当前钢卷 #{{ pIdx + 1 }}:{{ parent.currentCoilNo || parent.coilId }}</span>
|
||||
</div>
|
||||
<el-table :data="parent.abnormalList" border stripe size="small" style="width: 100%">
|
||||
<el-table-column width="50">
|
||||
<template slot="header">
|
||||
<el-checkbox :indeterminate="parent.isIndeterminate"
|
||||
:value="parent.checkedAll"
|
||||
@change="val => handleParentSelectAll(parent, val)" />
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
<el-checkbox v-model="scope.row._selected"
|
||||
@change="() => recalcParentCheckState(parent)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="缺陷描述" prop="remark" show-overflow-tooltip />
|
||||
<el-table-column label="开始位置" prop="startPosition" width="80" />
|
||||
<el-table-column label="结束位置" prop="endPosition" width="80" />
|
||||
<el-table-column label="长度" width="70">
|
||||
<template slot-scope="scope">{{ scope.row.endPosition - scope.row.startPosition }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="上下版面" prop="plateSurface" width="100" />
|
||||
<el-table-column label="断面位置" prop="position" width="160" />
|
||||
<el-table-column label="缺陷代码" prop="defectCode" width="80" />
|
||||
<el-table-column label="程度" prop="degree" width="60" />
|
||||
<el-table-column label="主缺陷" width="60">
|
||||
<template slot-scope="scope">{{ scope.row.mainMark === 1 ? '是' : '否' }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
<el-empty v-else description="未找到当前钢卷或异常记录" />
|
||||
</div>
|
||||
<span slot="footer">
|
||||
<el-button @click="inheritDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="inheritButtonLoading" @click="confirmInherit"
|
||||
:disabled="selectedInheritCount === 0">
|
||||
确认继承 ({{ selectedInheritCount }})
|
||||
</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getMaterialCoil, updateMaterialCoil, getFirstHeatCoilMaterial } from '@/api/wms/coil';
|
||||
import { listCoilAbnormal } from '@/api/wms/coilAbnormal';
|
||||
import { matchBestSpecVersion } from '@/api/wms/processSpecVersion';
|
||||
import { completeAction, getPendingAction } from '@/api/wms/pendingAction';
|
||||
import { listPlanSheet } from '@/api/aps/planSheet';
|
||||
@@ -523,6 +581,11 @@ export default {
|
||||
planSheetDetailMap: {},
|
||||
activePlanSheetId: null,
|
||||
currentLineName: '',
|
||||
// 异常继承
|
||||
inheritDialogVisible: false,
|
||||
inheritLoading: false,
|
||||
inheritButtonLoading: false,
|
||||
parentCoils: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -558,6 +621,15 @@ export default {
|
||||
}
|
||||
return '请先选择材料类型';
|
||||
},
|
||||
selectedInheritCount() {
|
||||
let count = 0
|
||||
for (const parent of this.parentCoils) {
|
||||
for (const row of parent.abnormalList) {
|
||||
if (row._selected) count++
|
||||
}
|
||||
}
|
||||
return count
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
// 从路由参数获取coilId和actionId
|
||||
@@ -1083,6 +1155,78 @@ export default {
|
||||
this.$message.error('删除暂存失败:' + error.message);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 异常继承
|
||||
handleInheritAbnormal() {
|
||||
const parentId = this.currentInfo.coilId
|
||||
if (!parentId) {
|
||||
this.$message.info('钢卷信息未加载,无法继承异常')
|
||||
return
|
||||
}
|
||||
this.inheritDialogVisible = true
|
||||
this.parentCoils = []
|
||||
this.inheritLoading = true
|
||||
getMaterialCoil(parentId).then(res => {
|
||||
const coil = res.data || {}
|
||||
return listCoilAbnormal({ coilId: parentId, pageSize: 999 }).then(res2 => {
|
||||
const list = (res2.rows || []).map(item => ({ ...item, _selected: false }))
|
||||
return { coil, abnormalList: list, checkedAll: false, isIndeterminate: false }
|
||||
})
|
||||
}).catch(() => null).then(result => {
|
||||
this.parentCoils = result ? [result] : []
|
||||
if (this.parentCoils.length === 0 || this.parentCoils[0].abnormalList.length === 0) {
|
||||
this.$message.info('未找到当前钢卷的异常记录')
|
||||
}
|
||||
}).finally(() => {
|
||||
this.inheritLoading = false
|
||||
})
|
||||
},
|
||||
recalcParentCheckState(parent) {
|
||||
const selected = parent.abnormalList.filter(r => r._selected)
|
||||
const total = parent.abnormalList.length
|
||||
parent.checkedAll = selected.length === total && total > 0
|
||||
parent.isIndeterminate = selected.length > 0 && selected.length < total
|
||||
},
|
||||
handleParentSelectAll(parent, val) {
|
||||
parent.abnormalList.forEach(row => { row._selected = val })
|
||||
parent.checkedAll = val
|
||||
parent.isIndeterminate = false
|
||||
},
|
||||
confirmInherit() {
|
||||
const selected = []
|
||||
for (const parent of this.parentCoils) {
|
||||
for (const row of parent.abnormalList) {
|
||||
if (row._selected) {
|
||||
const end = Number(row.endPosition) || 0
|
||||
const start = Number(row.startPosition) || 0
|
||||
selected.push({
|
||||
coilId: this.currentInfo.coilId,
|
||||
position: row.position,
|
||||
plateSurface: row.plateSurface,
|
||||
startPosition: start,
|
||||
endPosition: end,
|
||||
length: end - start,
|
||||
defectCode: row.defectCode,
|
||||
degree: row.degree,
|
||||
mainMark: row.mainMark,
|
||||
remark: row.remark,
|
||||
attachmentFiles: row.attachmentFiles,
|
||||
productionLine: row.productionLine,
|
||||
processSource: actionTypeToLineName[this.actionType] || '',
|
||||
_inherited: true,
|
||||
parentAbnormalId: row.abnormalId
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
if (selected.length === 0) {
|
||||
this.$message.info('请选择要继承的异常')
|
||||
return
|
||||
}
|
||||
this.abnormals.push(...selected)
|
||||
this.$message.success(`成功继承 ${selected.length} 条异常记录`)
|
||||
this.inheritDialogVisible = false
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1385,4 +1529,43 @@ export default {
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
}
|
||||
|
||||
.abnormal-item.inherited {
|
||||
background-color: #f0f9ff;
|
||||
border-color: #1890ff;
|
||||
|
||||
.abnormal-position {
|
||||
color: #1890ff;
|
||||
}
|
||||
}
|
||||
|
||||
.abnormal-inherit-tip {
|
||||
font-size: 10px;
|
||||
color: #909399;
|
||||
line-height: 1.2;
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
.parent-coil-section {
|
||||
margin-bottom: 20px;
|
||||
padding: 12px;
|
||||
background-color: #fafafa;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.parent-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 1px solid #e4e7ed;
|
||||
}
|
||||
|
||||
.parent-title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user