Browse Source

新品流程OK

master
常熟吴彦祖 2 weeks ago
parent
commit
2708a0dd70
  1. 176
      src/views/modules/qc/IQCResultEntry.vue

176
src/views/modules/qc/IQCResultEntry.vue

@ -371,8 +371,8 @@
min-width="60"
label="实测值">
<template slot-scope="scope">
<el-input :ref="`textValue${scope.$index}`" v-if="scope.row.valueTypeDb === 'N'" v-model="scope.row.numberValue" @keyup.enter.native="focusNextInput(scope.$index, 'textValue')" type="number" @change="updateItemResult(scope.row)" style="height: 11px; width: 98%"></el-input>
<el-input :ref="`textValue${scope.$index}`" v-else v-model="scope.row.textValue" @keyup.enter.native="focusNextInput(scope.$index, 'textValue')" style="height: 11px; width: 98%"></el-input>
<el-input :ref="`textValue${scope.$index}`" v-if="scope.row.valueTypeDb === 'N'" v-model="scope.row.numberValue" @keyup.enter.native="focusNextInput(scope.$index, 'textValue')" type="number" @change="updateItemResult(scope.row)" style="height: 10px; width: 98%"></el-input>
<el-input :ref="`textValue${scope.$index}`" v-else v-model="scope.row.textValue" @keyup.enter.native="focusNextInput(scope.$index, 'textValue')" style="height: 10px; width: 98%"></el-input>
</template>
</el-table-column>
<el-table-column
@ -382,11 +382,11 @@
min-width="90"
label="项目检验结论">
<template slot-scope="scope">
<el-select :class="{redElSelect:scope.row.itemResult === 'N', greenElSelect:scope.row.itemResult === 'Y'}" v-if="detailData.submitFlag === 'Y'" v-model="scope.row.itemResult" disabled style="height: 11px;padding: 0px" >
<el-select :class="{redElSelect:scope.row.itemResult === 'N', greenElSelect:scope.row.itemResult === 'Y'}" v-if="detailData.submitFlag === 'Y'" v-model="scope.row.itemResult" disabled style="height: 10px;padding: 0px" >
<el-option label="合格" value="Y" style="color: green"></el-option>
<el-option label="不合格" value="N" style="color: red"></el-option>
</el-select>
<el-select :class="{redElSelect:scope.row.itemResult === 'N', greenElSelect:scope.row.itemResult === 'Y'}" v-else v-model="scope.row.itemResult" style="height: 11px;padding: 0px" placeholder="合格" @change="handleItemResultChange($event, scope.row)">
<el-select :class="{redElSelect:scope.row.itemResult === 'N', greenElSelect:scope.row.itemResult === 'Y'}" v-else v-model="scope.row.itemResult" style="height: 10px;padding: 0px" placeholder="合格" @change="handleItemResultChange($event, scope.row)">
<el-option label="合格" value="Y" style="color: green"></el-option>
<el-option label="不合格" value="N" style="color: red"></el-option>
</el-select>
@ -410,8 +410,8 @@
<!-- min-width="80"-->
<!-- label="抽样数量">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input-number :controls="false" :step="0" v-if="detailData.submitFlag === 'Y'" v-model="scope.row.samplingQty" disabled style="height: 11px; width: 98%"></el-input-number>-->
<!-- <el-input-number :controls="false" :step="0" v-else :ref="`samplingQty${scope.$index}`" v-model="scope.row.samplingQty" @keyup.enter.native="focusNextInput(scope.$index, 'samplingQty')" style="height: 11px; width: 98%"></el-input-number>-->
<!-- <el-input-number :controls="false" :step="0" v-if="detailData.submitFlag === 'Y'" v-model="scope.row.samplingQty" disabled style="height: 10px; width: 98%"></el-input-number>-->
<!-- <el-input-number :controls="false" :step="0" v-else :ref="`samplingQty${scope.$index}`" v-model="scope.row.samplingQty" @keyup.enter.native="focusNextInput(scope.$index, 'samplingQty')" style="height: 10px; width: 98%"></el-input-number>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column
@ -421,8 +421,8 @@
min-width="80"
label="不合格数量">
<template slot-scope="scope">
<el-input-number :controls="false" :step="0" v-if="detailData.submitFlag === 'Y'" v-model="scope.row.unqualifiedQuantity" disabled style="height: 11px; width: 98%"></el-input-number>
<el-input-number :controls="false" :step="0" v-else :ref="`unqualifiedQuantity${scope.$index}`" v-model="scope.row.unqualifiedQuantity" @keyup.enter.native="focusNextInput(scope.$index, 'unqualifiedQuantity')" style="height: 11px; width: 98%"></el-input-number>
<el-input-number :controls="false" :step="0" v-if="detailData.submitFlag === 'Y'" v-model="scope.row.unqualifiedQuantity" disabled style="height: 10px; width: 98%"></el-input-number>
<el-input-number :controls="false" :step="0" v-else :ref="`unqualifiedQuantity${scope.$index}`" v-model="scope.row.unqualifiedQuantity" @keyup.enter.native="focusNextInput(scope.$index, 'unqualifiedQuantity')" style="height: 10px; width: 98%"></el-input-number>
</template>
</el-table-column>
@ -461,7 +461,7 @@
:label = "i.sitename"
:value = "i.buDesc">
<span style="float: left;width: 100px">{{ i.sitename }}</span>
<span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px">
<span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 10px;width: 60px">
{{ i.buDesc }}
</span>
</el-option>
@ -729,7 +729,7 @@
min-width="100"
label="设备">
<template slot-scope="scope">
<el-select v-model="scope.row.equipmentNo" style="height: 11px" placeholder="请选择设备">
<el-select v-model="scope.row.equipmentNo" style="height: 10px" placeholder="请选择设备">
<el-option
v-for = "i in scope.row.objectList"
:key = "i.objectID"
@ -829,6 +829,25 @@
},
},
watch: {
'$route.query.inspectionNo': {
handler (newVal) {
if (newVal) {
if (!this.searchData.site) {
this.searchData.site = this.$store.state.user.site
}
if (!this.searchData.userName) {
this.searchData.userName = this.$store.state.user.name
}
this.searchData.inspectionNo = newVal
//
this.$nextTick(() => {
this.getDataList()
})
}
},
immediate: false // created
},
detailData: {
deep: true,
handler: function (newV, oldV) {
@ -1790,6 +1809,8 @@
disposalRemark: '',
inspectionResult: '',
inspectorNo: '',
inspectorDate: '',
submitDate: '',
inspectionRemark: '',
submitFlag: '',
supplierNo: '',
@ -2000,28 +2021,7 @@
this.height = window.innerHeight - 250
})
},
// 🔑
watch: {
'$route.query.inspectionNo': {
handler (newVal) {
if (newVal) {
if (!this.searchData.site) {
this.searchData.site = this.$store.state.user.site
}
if (!this.searchData.userName) {
this.searchData.userName = this.$store.state.user.name
}
this.searchData.inspectionNo = newVal
//
this.$nextTick(() => {
this.getDataList()
})
}
},
immediate: false // created
}
},
created () {
//
@ -2844,6 +2844,8 @@
this.detailData.disposalRemark = row.disposalRemark
this.detailData.inspectionResult = row.inspectionResult
this.detailData.inspectorNo = row.inspectorNo
this.detailData.inspectorDate = row.inspectorDate
this.detailData.submitDate = row.submitDate
this.detailData.inspectionRemark = row.inspectionRemark
this.detailData.umId = row.umId
this.detailData.rollCount = row.rollCount
@ -2885,10 +2887,12 @@
iqcDetailSearch(this.detailData).then(({data}) => {
if (data && data.code === 0) {
const rows = Array.isArray(data.rows) ? data.rows : []
this.detailList = rows.map(item => ({
...item,
itemResult: item.itemResult == null ? '' : item.itemResult
}))
//
// 1) =
// 2)
// 3) numberValue textValue
const shouldAutoFillMeasuredValue = this.shouldAutoFillMeasuredValueByInspectionRows(rows)
this.detailList = rows.map(item => this.buildDetailRowWithDefaultMeasuredValue(item, shouldAutoFillMeasuredValue))
this.refreshUnqualifiedQty()
} else {
this.detailList = []
@ -2897,6 +2901,108 @@
})
},
/**
* @description 判断当前检验单是否满足整单默认标准值回填条件
* 生效条件必须同时满足
* 1) 单据状态为待检验
* 2) 明细存在至少1行
* 3) 所有明细行的实测值都为空数值型看 numberValue文本型看 textValue
* @param rows 明细行列表
* @returns true=允许整单回填false=不回填
*/
shouldAutoFillMeasuredValueByInspectionRows (rows) {
const inspectionState = String(this.detailData.state || '').trim()
if (inspectionState !== '待检验') {
return false
}
//
// /
// 使
if (this.hasInspectionPersistedByApplyOrSave()) {
return false
}
if (!Array.isArray(rows) || rows.length === 0) {
return false
}
return rows.every(item => {
if (item && item.valueTypeDb === 'N') {
return this.isInspectionMeasuredValueEmpty(item.numberValue)
}
return this.isInspectionMeasuredValueEmpty(item ? item.textValue : null)
})
},
/**
* @description 判断当前检验单是否已经发生过应用/保存落库行为
* 判定规则
* 1) 主记录 inspectorDate 非空说明检验录入动作已落库
* 2) 主记录 submitDate 非空说明保存/提交流程已写入时间戳
* 3) 以上任一成立即视为用户已处理过该单据后续禁止默认回填标准值
* @returns true=已处理过不允许回填false=未处理过可继续按待检验全空规则判断
*/
hasInspectionPersistedByApplyOrSave () {
return !this.isInspectionMeasuredValueEmpty(this.detailData.inspectorDate) ||
!this.isInspectionMeasuredValueEmpty(this.detailData.submitDate)
},
/**
* @description 构建检验明细行并按待检验默认标准值规则初始化实测值
* 处理逻辑
* 1) 统一补齐 itemResult 空值避免后续判定出现 null
* 2) 仅在整单允许回填场景触发默认回填
* 3) 实测值已有内容时不覆盖确保用户历史录入不被改写
* 4) defaultValue 为空时不回填避免写入无意义空串
* @param item 后端返回的单条检验项目
* @param shouldAutoFillMeasuredValue 是否允许整单回填
* @returns 处理后的前端展示行对象
*/
buildDetailRowWithDefaultMeasuredValue (item, shouldAutoFillMeasuredValue) {
const row = {
...item,
itemResult: item.itemResult == null ? '' : item.itemResult
}
//
if (!shouldAutoFillMeasuredValue) {
return row
}
//
if (this.isInspectionMeasuredValueEmpty(row.defaultValue)) {
return row
}
// (numberValue)(defaultValue)
if (row.valueTypeDb === 'N') {
if (this.isInspectionMeasuredValueEmpty(row.numberValue)) {
row.numberValue = row.defaultValue
}
return row
}
// (textValue)(defaultValue)
if (this.isInspectionMeasuredValueEmpty(row.textValue)) {
row.textValue = String(row.defaultValue)
}
return row
},
/**
* @description 判断检验值是否为空统一空值判定避免0被误判为空
* 判定规则
* 1) null / undefined 视为空
* 2) 字符串去空格后为空视为空
* 3) 数值 0 视为有效值不为空
* @param value 待判定值
* @returns true=false=非空
*/
isInspectionMeasuredValueEmpty (value) {
if (value === null || value === undefined) {
return true
}
return String(value).trim() === ''
},
//
subDetailModal (row) {
this.subDetailLoading = true

Loading…
Cancel
Save