|
|
@ -371,8 +371,8 @@ |
|
|
min-width="60" |
|
|
min-width="60" |
|
|
label="实测值"> |
|
|
label="实测值"> |
|
|
<template slot-scope="scope"> |
|
|
<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> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
<el-table-column |
|
|
<el-table-column |
|
|
@ -382,11 +382,11 @@ |
|
|
min-width="90" |
|
|
min-width="90" |
|
|
label="项目检验结论"> |
|
|
label="项目检验结论"> |
|
|
<template slot-scope="scope"> |
|
|
<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="Y" style="color: green"></el-option> |
|
|
<el-option label="不合格" value="N" style="color: red"></el-option> |
|
|
<el-option label="不合格" value="N" style="color: red"></el-option> |
|
|
</el-select> |
|
|
</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="Y" style="color: green"></el-option> |
|
|
<el-option label="不合格" value="N" style="color: red"></el-option> |
|
|
<el-option label="不合格" value="N" style="color: red"></el-option> |
|
|
</el-select> |
|
|
</el-select> |
|
|
@ -410,8 +410,8 @@ |
|
|
<!-- min-width="80"--> |
|
|
<!-- min-width="80"--> |
|
|
<!-- label="抽样数量">--> |
|
|
<!-- label="抽样数量">--> |
|
|
<!-- <template slot-scope="scope">--> |
|
|
<!-- <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>--> |
|
|
<!-- </template>--> |
|
|
<!-- </el-table-column>--> |
|
|
<!-- </el-table-column>--> |
|
|
<el-table-column |
|
|
<el-table-column |
|
|
@ -421,8 +421,8 @@ |
|
|
min-width="80" |
|
|
min-width="80" |
|
|
label="不合格数量"> |
|
|
label="不合格数量"> |
|
|
<template slot-scope="scope"> |
|
|
<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> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
|
|
|
|
|
|
@ -461,7 +461,7 @@ |
|
|
:label = "i.sitename" |
|
|
:label = "i.sitename" |
|
|
:value = "i.buDesc"> |
|
|
:value = "i.buDesc"> |
|
|
<span style="float: left;width: 100px">{{ i.sitename }}</span> |
|
|
<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 }} |
|
|
{{ i.buDesc }} |
|
|
</span> |
|
|
</span> |
|
|
</el-option> |
|
|
</el-option> |
|
|
@ -729,7 +729,7 @@ |
|
|
min-width="100" |
|
|
min-width="100" |
|
|
label="设备"> |
|
|
label="设备"> |
|
|
<template slot-scope="scope"> |
|
|
<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 |
|
|
<el-option |
|
|
v-for = "i in scope.row.objectList" |
|
|
v-for = "i in scope.row.objectList" |
|
|
:key = "i.objectID" |
|
|
:key = "i.objectID" |
|
|
@ -829,6 +829,25 @@ |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
watch: { |
|
|
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: { |
|
|
detailData: { |
|
|
deep: true, |
|
|
deep: true, |
|
|
handler: function (newV, oldV) { |
|
|
handler: function (newV, oldV) { |
|
|
@ -1790,6 +1809,8 @@ |
|
|
disposalRemark: '', |
|
|
disposalRemark: '', |
|
|
inspectionResult: '', |
|
|
inspectionResult: '', |
|
|
inspectorNo: '', |
|
|
inspectorNo: '', |
|
|
|
|
|
inspectorDate: '', |
|
|
|
|
|
submitDate: '', |
|
|
inspectionRemark: '', |
|
|
inspectionRemark: '', |
|
|
submitFlag: '', |
|
|
submitFlag: '', |
|
|
supplierNo: '', |
|
|
supplierNo: '', |
|
|
@ -2000,28 +2021,7 @@ |
|
|
this.height = window.innerHeight - 250 |
|
|
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 () { |
|
|
created () { |
|
|
// 按钮控制 |
|
|
// 按钮控制 |
|
|
@ -2844,6 +2844,8 @@ |
|
|
this.detailData.disposalRemark = row.disposalRemark |
|
|
this.detailData.disposalRemark = row.disposalRemark |
|
|
this.detailData.inspectionResult = row.inspectionResult |
|
|
this.detailData.inspectionResult = row.inspectionResult |
|
|
this.detailData.inspectorNo = row.inspectorNo |
|
|
this.detailData.inspectorNo = row.inspectorNo |
|
|
|
|
|
this.detailData.inspectorDate = row.inspectorDate |
|
|
|
|
|
this.detailData.submitDate = row.submitDate |
|
|
this.detailData.inspectionRemark = row.inspectionRemark |
|
|
this.detailData.inspectionRemark = row.inspectionRemark |
|
|
this.detailData.umId = row.umId |
|
|
this.detailData.umId = row.umId |
|
|
this.detailData.rollCount = row.rollCount |
|
|
this.detailData.rollCount = row.rollCount |
|
|
@ -2885,10 +2887,12 @@ |
|
|
iqcDetailSearch(this.detailData).then(({data}) => { |
|
|
iqcDetailSearch(this.detailData).then(({data}) => { |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
const rows = Array.isArray(data.rows) ? data.rows : [] |
|
|
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() |
|
|
this.refreshUnqualifiedQty() |
|
|
} else { |
|
|
} else { |
|
|
this.detailList = [] |
|
|
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) { |
|
|
subDetailModal (row) { |
|
|
this.subDetailLoading = true |
|
|
this.subDetailLoading = true |
|
|
|