feat(wms/coil): 为钢卷相关页面添加异常继承功能
本次修改在typing.vue、merge.vue、split.vue和stepSplit.vue四个钢卷相关页面中,新增了异常继承的完整功能: 1. 重构异常信息展示区域,添加继承标记样式 2. 新增继承异常按钮,打开异常选择弹窗 3. 实现从源钢卷拉取异常列表、批量选择继承异常的功能 4. 继承的异常会标记来源并使用特殊样式展示
This commit is contained in:
@@ -303,21 +303,29 @@
|
||||
|
||||
<div class="form-row">
|
||||
<el-form-item label="异常信息" class="form-item-full">
|
||||
<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;">
|
||||
<div class="abnormal-container">
|
||||
<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 v-if="!readonly" type="text" size="mini" icon="el-icon-download"
|
||||
style="color: #409eff; white-space: nowrap;" @click="handleInheritAbnormal">
|
||||
继承异常
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
@@ -336,11 +344,61 @@
|
||||
<el-button type="primary" @click="saveAbnormal">确 定</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, mergeMaterialCoil } from '@/api/wms/coil';
|
||||
import { listCoilAbnormal } from '@/api/wms/coilAbnormal';
|
||||
import { listPendingAction, getPendingAction } from '@/api/wms/pendingAction';
|
||||
import { listPlanSheet } from '@/api/aps/planSheet'
|
||||
import { listPlanDetail } from '@/api/aps/planDetail'
|
||||
@@ -463,6 +521,11 @@ export default {
|
||||
planSheetDetailMap: {},
|
||||
planSheetLoading: false,
|
||||
activePlanSheetId: null,
|
||||
// 异常继承
|
||||
inheritDialogVisible: false,
|
||||
inheritLoading: false,
|
||||
inheritButtonLoading: false,
|
||||
parentCoils: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -509,6 +572,15 @@ export default {
|
||||
activePlanSheetDetails() {
|
||||
return this.planSheetDetailMap[this.activePlanSheetId] || []
|
||||
},
|
||||
selectedInheritCount() {
|
||||
let count = 0
|
||||
for (const parent of this.parentCoils) {
|
||||
for (const row of parent.abnormalList) {
|
||||
if (row._selected) count++
|
||||
}
|
||||
}
|
||||
return count
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
// 不再需要watch,直接用@change事件处理
|
||||
@@ -1032,6 +1104,80 @@ export default {
|
||||
if (!dict) return code;
|
||||
const item = dict.find(item => item.value === code);
|
||||
return item ? item.label : code;
|
||||
},
|
||||
|
||||
// 异常继承
|
||||
handleInheritAbnormal() {
|
||||
const sourceIds = this.sourceCoils.map(c => c.coilId).filter(Boolean)
|
||||
if (sourceIds.length === 0) {
|
||||
this.$message.info('请先选择源卷')
|
||||
return
|
||||
}
|
||||
this.inheritDialogVisible = true
|
||||
this.parentCoils = []
|
||||
this.inheritLoading = true
|
||||
const promises = sourceIds.map(id =>
|
||||
getMaterialCoil(id).then(res => {
|
||||
const coil = res.data || {}
|
||||
return listCoilAbnormal({ coilId: id, pageSize: 999 }).then(res2 => {
|
||||
const list = (res2.rows || []).map(item => ({ ...item, _selected: false }))
|
||||
return { coil, abnormalList: list, checkedAll: false, isIndeterminate: false }
|
||||
})
|
||||
}).catch(() => null)
|
||||
)
|
||||
Promise.all(promises).then(results => {
|
||||
this.parentCoils = results.filter(Boolean)
|
||||
if (this.parentCoils.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({
|
||||
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: this.planSheetLineName,
|
||||
_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
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1535,6 +1681,45 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
/* 排产单区域 */
|
||||
.plan-sheet-container {
|
||||
background: #fff;
|
||||
|
||||
@@ -327,30 +327,37 @@
|
||||
</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;">
|
||||
<div class="abnormal-container">
|
||||
<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)"
|
||||
/>
|
||||
</div>
|
||||
<el-button
|
||||
type="danger"
|
||||
size="mini"
|
||||
icon="el-icon-close"
|
||||
class="abnormal-delete"
|
||||
@click.stop="deleteAbnormal(index)"
|
||||
/>
|
||||
</div>
|
||||
<div class="abnormal-add" @click="addAbnormal">
|
||||
<i class="el-icon-plus" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="abnormal-add" @click="addAbnormal">
|
||||
<i class="el-icon-plus" />
|
||||
</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>
|
||||
|
||||
@@ -440,11 +447,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, listMaterialCoil, createSpecialChild, completeSpecialSplit, updateMaterialCoilSimple, delMaterialCoil, getFirstHeatCoilMaterial } from '@/api/wms/coil'
|
||||
import { listCoilAbnormal } from '@/api/wms/coilAbnormal'
|
||||
import { completeAction, getPendingAction, updatePendingAction } from '@/api/wms/pendingAction'
|
||||
import { saveCoilCache, getCoilCacheByCoilId, delCoilCache } from '@/api/wms/coilCache'
|
||||
import { getGalvanize1TypingPrefill } from '@/api/pocket/acidTyping'
|
||||
@@ -591,7 +648,12 @@ export default {
|
||||
planSheetList: [],
|
||||
planSheetDetailMap: {},
|
||||
planSheetLoading: false,
|
||||
activePlanSheetId: null
|
||||
activePlanSheetId: null,
|
||||
// 异常继承
|
||||
inheritDialogVisible: false,
|
||||
inheritLoading: false,
|
||||
inheritButtonLoading: false,
|
||||
parentCoils: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -645,6 +707,15 @@ export default {
|
||||
// 镀锌/酸轧/镀铬产线免验净重和厚度范围
|
||||
isExemptFromValidation() {
|
||||
return [11, 200, 520, 206, 501, 521, 505, 525, 206].includes(Number(this.actionType))
|
||||
},
|
||||
selectedInheritCount() {
|
||||
let count = 0
|
||||
for (const parent of this.parentCoils) {
|
||||
for (const row of parent.abnormalList) {
|
||||
if (row._selected) count++
|
||||
}
|
||||
}
|
||||
return count
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -1263,6 +1334,77 @@ export default {
|
||||
this.$message.error('删除缓存失败:' + error.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 异常继承
|
||||
handleInheritAbnormal() {
|
||||
const parentId = this.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.$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({
|
||||
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: this.planSheetLineName,
|
||||
_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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1374,6 +1516,45 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.plan-sheet-section {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
@@ -306,21 +306,29 @@
|
||||
</div>
|
||||
|
||||
<el-form-item label="异常信息" class="form-item-full">
|
||||
<div class="abnormal-container">
|
||||
<div v-for="(abnormal, abnormalIndex) in item.abnormals" :key="abnormalIndex" class="abnormal-item"
|
||||
@click="editAbnormal(index, abnormalIndex)">
|
||||
<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;">
|
||||
<div class="abnormal-container">
|
||||
<div v-for="(abnormal, abnormalIndex) in item.abnormals" :key="abnormalIndex"
|
||||
:class="['abnormal-item', { inherited: abnormal._inherited }]"
|
||||
@click="editAbnormal(index, abnormalIndex)">
|
||||
<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, abnormalIndex)"></el-button>
|
||||
</div>
|
||||
<el-button type="danger" size="mini" icon="el-icon-close" class="abnormal-delete"
|
||||
@click.stop="deleteAbnormal(index, abnormalIndex)"></el-button>
|
||||
</div>
|
||||
<div class="abnormal-add" @click="addAbnormal(index)">
|
||||
<i class="el-icon-plus"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="abnormal-add" @click="addAbnormal(index)">
|
||||
<i class="el-icon-plus"></i>
|
||||
</div>
|
||||
<el-button v-if="!readonly" type="text" size="mini" icon="el-icon-download"
|
||||
style="color: #409eff; white-space: nowrap;" @click="handleInheritAbnormal(index)">
|
||||
继承异常
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -339,11 +347,61 @@
|
||||
<el-button type="primary" @click="saveAbnormal">确 定</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, splitMaterialCoil, getFirstHeatCoilMaterial } from '@/api/wms/coil';
|
||||
import { listCoilAbnormal } from '@/api/wms/coilAbnormal';
|
||||
import { listWarehouse } from '@/api/wms/warehouse';
|
||||
import { completeAction, getPendingAction } from '@/api/wms/pendingAction';
|
||||
import { listPlanSheet } from '@/api/aps/planSheet'
|
||||
@@ -456,6 +514,12 @@ export default {
|
||||
planSheetDetailMap: {},
|
||||
planSheetLoading: false,
|
||||
activePlanSheetId: null,
|
||||
// 异常继承
|
||||
inheritDialogVisible: false,
|
||||
inheritLoading: false,
|
||||
inheritButtonLoading: false,
|
||||
parentCoils: [],
|
||||
currentInheritSubCoilIndex: -1,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -469,6 +533,15 @@ export default {
|
||||
activePlanSheetDetails() {
|
||||
return this.planSheetDetailMap[this.activePlanSheetId] || []
|
||||
},
|
||||
selectedInheritCount() {
|
||||
let count = 0
|
||||
for (const parent of this.parentCoils) {
|
||||
for (const row of parent.abnormalList) {
|
||||
if (row._selected) count++
|
||||
}
|
||||
}
|
||||
return count
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
// 先加载库区列表
|
||||
@@ -965,6 +1038,81 @@ export default {
|
||||
this.$set(this.planSheetDetailMap, planSheetId, details)
|
||||
} catch (e) { console.error('查询排产单明细失败', e) }
|
||||
},
|
||||
|
||||
// 异常继承
|
||||
handleInheritAbnormal(subCoilIndex) {
|
||||
const parentId = this.motherCoil.coilId
|
||||
if (!parentId) {
|
||||
this.$message.info('母卷信息未加载,无法继承异常')
|
||||
return
|
||||
}
|
||||
this.currentInheritSubCoilIndex = subCoilIndex
|
||||
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.$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({
|
||||
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: this.planSheetLineName,
|
||||
_inherited: true,
|
||||
parentAbnormalId: row.abnormalId
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
if (selected.length === 0) {
|
||||
this.$message.info('请选择要继承的异常')
|
||||
return
|
||||
}
|
||||
const subCoil = this.splitList[this.currentInheritSubCoilIndex]
|
||||
if (subCoil) {
|
||||
subCoil.abnormals.push(...selected)
|
||||
}
|
||||
this.$message.success(`成功继承 ${selected.length} 条异常记录`)
|
||||
this.inheritDialogVisible = false
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -1343,4 +1491,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>
|
||||
|
||||
@@ -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