Browse Source

2026-11-03

物料档案管理增加缺陷跟踪批量编辑
master
fengyuan_yang 4 weeks ago
parent
commit
39cd9d17b6
  1. 1
      src/api/qc/qc.js
  2. 228
      src/views/modules/qc/qcPartAttribute.vue

1
src/api/qc/qc.js

@ -77,6 +77,7 @@ export const getOperationDescList = data => createAPI(`/pms/qc/getOperationDescL
export const getManufacturerList = data => createAPI(`/pms/qc/getManufacturerList`,'post',data)
export const getPartTemplateLists = data => createAPI(`/pms/qc/getPartTemplateLists`,'post',data)
export const qcPartAttributeEdit = data => createAPI(`/pms/qc/qcPartAttributeEdit`,'post',data)
export const batchQcPartDefectTrackingEdit = data => createAPI(`/pms/qc/batchQcPartDefectTrackingEdit`,'post',data)
export const syncPartCatalog = data => createAPI(`/pms/qc/syncPartCatalog`,'post',data)
// ===================================== 检验标准维护 =====================================

228
src/views/modules/qc/qcPartAttribute.vue

@ -33,6 +33,7 @@
<el-form-item :label="' '">
<el-button @click="exportExcel()" type="primary" style="margin-left: 2px">{{'导出'}}</el-button>
<el-button v-if="!authSync" :loading="syncLoading" @click="syncPartCatalogData()" type="primary" style="margin-left: 2px">{{'数据同步'}}</el-button>
<el-button type="primary" style="margin-left: 2px" @click="openBatchDefectEditModal">缺陷跟踪批量编辑</el-button>
</el-form-item>
</el-form>
@ -43,10 +44,20 @@
border
v-loading="searchLoading"
ref="partTable"
:row-key="getPartRowKey"
:row-style="rowStyle"
@row-click="partClickRow"
@current-change="changeCurrentRow"
@selection-change="partSelectionChange"
style="width: 100%;">
<el-table-column
type="selection"
width="45"
header-align="center"
align="center"
fixed="left"
:reserve-selection="true">
</el-table-column>
<el-table-column
v-for="(item,index) in columnList" :key="index"
:sortable="item.columnSortable"
@ -316,22 +327,22 @@
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="不合格阈值">
<el-input-number :controls="false" :step="0" v-model="modalData.defectThreshold" :disabled="modalDisableFlag" style="width: 100%"></el-input-number>
<el-input-number class="num-right" :controls="false" :step="0" v-model="modalData.defectThreshold" :disabled="modalDisableFlag" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="连续跟踪批次">
<el-input-number :controls="false" :step="0" v-model="modalData.recoveryBatchCount" :disabled="modalDisableFlag" style="width: 100%"></el-input-number>
<el-input-number class="num-right" :controls="false" :step="0" v-model="modalData.recoveryBatchCount" :disabled="modalDisableFlag" style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="当前不合格次数">
<el-input-number :controls="false" :step="0" v-model="modalData.currentDefectCount" disabled style="width: 100%"></el-input-number>
<el-input-number class="num-right" :controls="false" :step="0" v-model="modalData.currentDefectCount" disabled style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="剩余跟踪批次">
<el-input-number :controls="false" :step="0" v-model="modalData.remainingTrackingBatches" disabled style="width: 100%"></el-input-number>
<el-input-number class="num-right" :controls="false" :step="0" v-model="modalData.remainingTrackingBatches" disabled style="width: 100%"></el-input-number>
</el-form-item>
</el-col>
</el-row>
@ -344,6 +355,49 @@
</el-footer>
</el-dialog>
<!-- 批量编辑物料缺陷跟踪 -->
<el-dialog title="批量编辑物料缺陷跟踪" :close-on-click-modal="false" v-drag :visible.sync="batchDefectEditFlag" width="1100px" class="part-edit-dialog">
<div class="dialog-content">
<div class="form-section">
<div class="section-title">缺陷跟踪</div>
<el-table
:data="batchDefectEditList"
border
height="420"
class="batch-defect-edit-table"
style="width: 100%;">
<el-table-column prop="partNo" label="物料编码" header-align="center" align="left" min-width="130" show-overflow-tooltip></el-table-column>
<el-table-column prop="partDesc" label="物料名称" header-align="center" align="left" min-width="180" show-overflow-tooltip></el-table-column>
<el-table-column prop="buDesc" label="BU" header-align="center" align="center" width="80" show-overflow-tooltip></el-table-column>
<el-table-column label="不合格阈值" header-align="center" align="right" min-width="110">
<template slot-scope="scope">
<el-input-number class="num-right" :controls="false" :step="0" :min="0" v-model="scope.row.defectThreshold" style="width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="连续跟踪批次" header-align="center" align="right" min-width="120">
<template slot-scope="scope">
<el-input-number class="num-right" :controls="false" :step="0" :min="0" v-model="scope.row.recoveryBatchCount" style="width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="当前不合格次数" header-align="center" align="right" min-width="120">
<template slot-scope="scope">
<el-input-number class="num-right" :controls="false" :step="0" :min="0" v-model="scope.row.currentDefectCount" style="width: 100%"></el-input-number>
</template>
</el-table-column>
<el-table-column label="剩余跟踪批次" header-align="center" align="right" min-width="120">
<template slot-scope="scope">
<el-input-number class="num-right" :controls="false" :step="0" :min="0" v-model="scope.row.remainingTrackingBatches" style="width: 100%"></el-input-number>
</template>
</el-table-column>
</el-table>
</div>
</div>
<el-footer style="height:35px;margin-top: 15px;text-align:center">
<el-button type="primary" :loading="batchDefectEditLoading" @click="saveBatchDefectEdit">保存</el-button>
<el-button type="primary" @click="batchDefectEditFlag = false">关闭</el-button>
</el-footer>
</el-dialog>
<!-- 巡检特殊配置对话框 -->
<el-dialog title="巡检特殊配置" :close-on-click-modal="false" v-drag :visible.sync="patrolConfigDialogFlag" width="900px" append-to-body>
<div style="margin-bottom: 10px;">
@ -647,53 +701,64 @@
<el-table-column
prop="defectThreshold"
header-align="center"
align="center"
align="right"
min-width="100"
label="不合格阈值">
<template slot-scope="scope">
<span v-if="editBatchVisible">
<el-input :controls="false" v-model="scope.row.defectThreshold"
@input="value=>scope.row.defectThreshold= value.match(/^[1-9]\d*$/) ? value.match(/^[1-9]\d*$/)[0] : ''"
style="height: 11px; width: 98%;">
</el-input>
</span>
<span v-else>
<span>{{scope.row[scope.column.property]}}</span>
</span>
<el-input-number
v-if="editBatchVisible"
class="num-right"
:controls="false"
:step="0"
:min="0"
v-model="scope.row.defectThreshold"
style="width: 98%;">
</el-input-number>
<span v-else>{{scope.row.defectThreshold}}</span>
</template>
</el-table-column>
<el-table-column
prop="recoveryBatchCount"
header-align="center"
align="center"
align="right"
min-width="100"
label="连续跟踪批次">
<template slot-scope="scope">
<span v-if="editBatchVisible">
<el-input :controls="false" v-model="scope.row.recoveryBatchCount"
@input="value=>scope.row.recoveryBatchCount = value.match(/^[1-9]\d*$/) ? value.match(/^[1-9]\d*$/)[0] : ''"
style="height: 11px; width: 98%;">
</el-input>
</span>
<span v-else>
<span>{{scope.row[scope.column.property]}}</span>
</span>
<el-input-number
v-if="editBatchVisible"
class="num-right"
:controls="false"
:step="0"
:min="0"
v-model="scope.row.recoveryBatchCount"
style="width: 98%;">
</el-input-number>
<span v-else>{{scope.row.recoveryBatchCount}}</span>
</template>
</el-table-column>
<el-table-column
prop="currentDefectCount"
header-align="center"
align="center"
align="right"
min-width="100"
label="当前不合格次数">
<template slot-scope="scope">
<span>{{scope.row[scope.column.property]}}</span>
<el-input-number
v-if="editBatchVisible"
class="num-right"
:controls="false"
:step="0"
:min="0"
v-model="scope.row.currentDefectCount"
style="width: 98%;">
</el-input-number>
<span v-else>{{scope.row.currentDefectCount}}</span>
</template>
</el-table-column>
<el-table-column
prop="lastDefectCount"
header-align="center"
align="center"
align="right"
min-width="100"
label="上次不合格次数">
<template slot-scope="scope">
@ -703,11 +768,20 @@
<el-table-column
prop="remainingTrackingBatches"
header-align="center"
align="center"
align="right"
min-width="100"
label="剩余跟踪批次">
<template slot-scope="scope">
<span>{{scope.row.remainingTrackingBatches}}</span>
<el-input-number
v-if="editBatchVisible"
class="num-right"
:controls="false"
:step="0"
:min="0"
v-model="scope.row.remainingTrackingBatches"
style="width: 98%;">
</el-input-number>
<span v-else>{{scope.row.remainingTrackingBatches}}</span>
</template>
</el-table-column>
<el-table-column
@ -1486,6 +1560,7 @@
import {
qcPartAttributeSearch, // 查询物料属性
qcPartAttributeEdit, // 修改物料属性
batchQcPartDefectTrackingEdit, // 批量编辑物料缺陷跟踪
searchPartAttributeDetails, // 查询物料属性模板
savePartAttributeDetails, // 新增物料属性模板
deletePartAttributeDetails, // 删除物料属性模板
@ -2355,6 +2430,10 @@
batchLoading: false,
defectTrackingModal: false,
defectTrackingDisableFlag: false,
partSelections: [],
batchDefectEditFlag: false,
batchDefectEditLoading: false,
batchDefectEditList: [],
labelTemplateModal: false,
labelTemplateDisableFlag: false,
selectionCustomer: [],
@ -2849,6 +2928,68 @@
this.getBaseList(207)
},
getPartRowKey (row) {
return (row.site || '') + '_' + (row.buNo || '') + '_' + (row.partNo || '')
},
partSelectionChange (val) {
this.partSelections = val || []
},
openBatchDefectEditModal () {
if (!this.partSelections || this.partSelections.length === 0) {
this.$message.warning('请先勾选要批量编辑的物料!')
return
}
this.batchDefectEditList = this.partSelections.map(row => ({
site: row.site,
buNo: row.buNo,
buDesc: row.buDesc,
partNo: row.partNo,
partDesc: row.partDesc,
defectThreshold: row.defectThreshold == null ? 0 : Number(row.defectThreshold),
recoveryBatchCount: row.recoveryBatchCount == null ? 0 : Number(row.recoveryBatchCount),
currentDefectCount: row.currentDefectCount == null ? 0 : Number(row.currentDefectCount),
remainingTrackingBatches: row.remainingTrackingBatches == null ? 0 : Number(row.remainingTrackingBatches),
lastUpdateBy: this.$store.state.user.name
}))
this.batchDefectEditFlag = true
},
saveBatchDefectEdit () {
if (!this.batchDefectEditList || this.batchDefectEditList.length === 0) {
this.$message.warning('没有可保存的数据!')
return
}
for (let i = 0; i < this.batchDefectEditList.length; i++) {
const row = this.batchDefectEditList[i]
const remaining = Number(row.remainingTrackingBatches || 0)
const recovery = Number(row.recoveryBatchCount || 0)
if (remaining > recovery) {
this.$message.warning(`物料【${row.partNo}】剩余跟踪批次不能大于连续跟踪批次`)
return
}
}
this.batchDefectEditLoading = true
batchQcPartDefectTrackingEdit(this.batchDefectEditList).then(({data}) => {
if (data && data.code === 0) {
this.$message.success('操作成功')
this.batchDefectEditFlag = false
if (this.$refs.partTable) {
this.$refs.partTable.clearSelection()
}
this.partSelections = []
this.getDataList()
} else {
this.$message.error(data.msg || '批量保存失败')
}
}).catch((error) => {
this.$message.error((error && error.message) || '批量保存失败')
}).finally(() => {
this.batchDefectEditLoading = false
})
},
// 获取数据列表
getDataList () {
this.searchData.limit = this.pageSize
@ -3480,8 +3621,17 @@
// 批量保存
batchDefectTrackingModel () {
let params = []
params = this.defectTrackingList
const params = this.defectTrackingList || []
for (let i = 0; i < params.length; i++) {
const row = params[i]
const remaining = Number(row.remainingTrackingBatches || 0)
const recovery = Number(row.recoveryBatchCount || 0)
if (remaining > recovery) {
const supplier = row.supplierName || row.supplierId || ''
this.$message.warning(`供应商【${supplier}】剩余跟踪批次不能大于连续跟踪批次`)
return
}
}
this.batchLoading = true
updateDefectTracking(params).then(({data}) => {
if (data && data.code === 0) {
@ -4355,6 +4505,22 @@
line-height: 32px;
}
.part-edit-dialog .batch-defect-edit-table /deep/ .el-table__cell .cell {
height: auto !important;
line-height: 28px !important;
overflow: visible !important;
white-space: normal !important;
}
.part-edit-dialog .batch-defect-edit-table /deep/ .el-input-number {
width: 100%;
}
.part-edit-dialog .batch-defect-edit-table /deep/ .el-input-number .el-input__inner,
.num-right /deep/ .el-input__inner {
text-align: right;
}
/* 检验模板弹出框样式 - 超紧凑版 */

Loading…
Cancel
Save