rev:新增质检模块

This commit is contained in:
2023-06-25 09:01:56 +08:00
parent 9f1a982a63
commit c576f04413
3 changed files with 1224 additions and 0 deletions

View File

@@ -0,0 +1,564 @@
<template>
<div>
<el-dialog
title="质检结果录入"
append-to-body
:visible.sync="visiable1"
fullscreen
destroy-on-close
:before-close="close"
@open="open"
>
<el-row :gutter="20">
<el-col :span="18" style="border: 1px solid white">
<span />
</el-col>
<el-col :span="6">
<span>
<el-button
:disabled="form1.bill_status === '99'"
type="success"
icon="el-icon-finished"
@click="computerResult"
>计算结果</el-button>
<el-button
:disabled="form1.bill_status === '99'"
icon="el-icon-check"
size="mini"
type="primary"
@click="onSubmit"
>保存</el-button>
<el-button icon="el-icon-close" type="info" @click="close">关闭</el-button>
</span>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form
:inline="true"
:model="form1"
style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;"
class="demo-form-inline"
label-width="auto"
label-position="right"
label-suffix=":"
>
<el-form-item label="物料编码">
<el-input
v-model="form1.material_code"
disabled
size="mini"
style="width: 210px"
class="filter-item"
/>
</el-form-item>
<el-form-item label="物料名称">
<el-input
v-model="form1.material_name"
disabled
size="mini"
style="width: 210px"
class="filter-item"
/>
</el-form-item>
<el-form-item label="批号">
<label slot="label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
<el-input
v-model="form1.pcsn"
disabled
size="mini"
style="width: 210px"
class="filter-item"
/>
</el-form-item>
<el-form-item label="样品编号">
<el-input
v-model="form1.sample_code"
size="mini"
style="width: 210px"
class="filter-item"
:disabled="form1.bill_status === '99'"
/>
</el-form-item>
<el-form-item label="烧结炉号">
<el-input
v-model="form1.other_device_no"
size="mini"
style="width: 210px"
class="filter-item"
:disabled="form1.bill_status === '99'"
/>
</el-form-item>
<el-form-item label="烧结温度">
<el-input
v-model="form1.other_device_wd"
size="mini"
style="width: 210px"
class="filter-item"
:disabled="form1.bill_status === '99'"
/>
</el-form-item>
<el-form-item>
<label slot="label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
<el-select
v-model="form1.grade"
clearable
size="mini"
style="width: 210px"
placeholder="等级"
class="filter-item"
:disabled="form1.bill_status === '99'"
>
<el-option
v-for="item in dict.ST_IVT_LEVEL"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<label slot="label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
<el-input
v-model="form1.weightlost"
size="mini"
style="width: 210px"
class="filter-item"
:disabled="form1.bill_status === '99'"
/>
</el-form-item>
<el-form-item>
<label slot="label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
<el-select
v-model="form1.result"
clearable
size="mini"
style="width: 210px"
placeholder="结论"
class="filter-item"
:disabled="form1.bill_status === '99'"
>
<el-option
v-for="item in dict.QC_RESULT_LHZJD"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item v-if="form1.result==='07'" label="改料编码">
<el-input
v-model="form1.change_material_code"
prefix-icon="el-icon-search"
placeholder="请选择物料"
size="mini"
style="width: 210px"
class="filter-item"
clearable
@clear="cleanMater"
@focus="materShow=true"
/>
</el-form-item>
<el-form-item v-if="form1.result==='07'" label="改料名称">
<el-input
v-model="form1.change_material_name"
disabled
size="mini"
style="width: 210px"
class="filter-item"
/>
</el-form-item>
<el-form-item v-if="form1.result==='07'" label="改用批号">
<el-input
v-model="form1.change_pcsn"
disabled
size="mini"
style="width: 210px"
class="filter-item"
/>
</el-form-item>
<el-form-item label="金相备注">
<el-input
v-model="form1.metallography_remark"
:disabled="form1.bill_status === '99'"
style="width: 380px;"
rows="2"
type="textarea"
/>
</el-form-item>
<el-form-item label="检验备注">
<el-input
v-model="form1.remark"
:disabled="form1.bill_status === '99'"
style="width: 380px;"
rows="2"
type="textarea"
/>
</el-form-item>
</el-form>
</el-col>
</el-row>
<!--表格渲染-->
<el-table
:data="form1.tableData"
border
stripe
style="width: 100%"
:cell-style="cellStyle"
>
<el-table-column
v-if="false"
prop="inspection_item_id"
label="项点标识"
/>
<el-table-column
prop="order_index"
width="60"
label="序号"
>
<template slot-scope="scope">
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column
prop="inspection_item_code"
label="项点编码"
/>
<el-table-column
prop="inspection_item_name"
label="项点名称"
/>
<el-table-column
width="100"
prop="inspection_item_type"
label="项点类别"
:formatter="format_inspection_item_type"
/>
<el-table-column
prop="down_limit"
label="合格下限(≥)"
width="100"
:formatter="crud.formatQlNum4"
/>
<el-table-column
prop="up_limit"
label="合格上限(≤)"
width="100"
:formatter="crud.formatQlNum4"
/>
<el-table-column
prop="down_limit_value"
label="下限临界值(≤)"
width="100"
:formatter="crud.formatQlNum4"
/>
<el-table-column
prop="up_limit_value"
label="上限临界值(≥)"
width="100"
:formatter="crud.formatQlNum4"
/>
<el-table-column
v-if="false"
prop="is_ok"
label="是否合格"
width="155"
/>
<el-table-column
prop="value"
width="155px"
label="检测值"
>
<template slot-scope="scope">
<el-input-number
v-model="form1.tableData[scope.$index].value"
:controls="false"
size="mini"
type="number"
:disabled="form1.bill_status === '99'"
:precision="4"
/>
</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
width="160"
>
<template slot-scope="scope">
<el-input
v-model="form1.tableData[scope.$index].remark"
:disabled="form1.bill_status === '99'"
size="mini"
class="edit-input"
/>
</template>
</el-table-column>
<el-table-column
prop="item_remark"
label="项点备注"
width="160"
/>
<el-table-column
v-if="false"
prop="form_remark"
label="表单备注"
width="160"
/>
</el-table>
</el-dialog>
<MaterDtl :dialog-show.sync="materShow" :mater-opt-code="'05'" @tableChanged2="tableChanged2" />
</div>
</template>
<script>
import CRUD, { crud } from '@crud/crud'
import MaterDtl from '@/views/wms/pub/MaterDialog'
import crudPhysicalMst from '@/api/wms/ql/physicalMst'
export default {
name: 'Dialog1',
dicts: ['QL_TEST_POINTTYPE', 'QC_RESULT_LHZJD', 'ST_IVT_LEVEL'],
components: { MaterDtl },
mixins: [crud()],
props: {
visiable1: {
type: Boolean
},
inspectionId: {
type: String
}
},
data() {
return {
materShow: false,
materType: '05',
form1: {
material_id: '',
bill_status: '',
material_code: '',
material_name: '',
pcsn: '',
sample_code: '',
other_device_no: '',
other_device_wd: '',
weightlost: '',
grade: '',
result: '',
change_material_id: '',
change_material_code: '',
change_material_name: '',
change_pcsn: '',
remark: '',
tableData: []
}
}
},
watch: {
'form1.tableData': {
handler(newValue, oldValue) {
// this.computerResult()
},
deep: true
}
},
methods: {
open() {
const param = {
inspection_id: this.inspectionId
}
crudPhysicalMst.getResult(param).then(res => {
this.form1 = res
if (res.grade === '') {
this.form1.grade = '01'
}
})
},
hand() {
},
cellStyle({ row, column, rowIndex, columnIndex }) {
// https://blog.csdn.net/qq_41648113/article/details/109337781
// https://blog.csdn.net/Akatsuki233/article/details/100311040
// https://blog.csdn.net/qq_45414633/article/details/107795124
const inspection_type = row.inspection_type
const is_limit_remark = row.is_limit_remark
const value = parseFloat(row.value)
const up_limit = parseFloat(row.up_limit)
const down_limit = parseFloat(row.down_limit)
const down_limit_value = parseFloat(row.down_limit_value)
const up_limit_value = parseFloat(row.up_limit_value)
// 理化项
if (inspection_type === '02') {
if (column.property === 'value') {
if (value < down_limit) {
row.is_ok = '0'
return 'background: red'
} else if ((value >= down_limit) && (value <= down_limit_value)) {
if (is_limit_remark === '1') {
row.form_remark = row.inspection_item_name + '超下限'
return 'background: yellow'
}
row.is_ok = '1'
} else if (value > up_limit) {
row.is_ok = '0'
return 'background: red'
} else if ((value <= up_limit) && (value >= up_limit_value)) {
if (is_limit_remark === '1') {
row.form_remark = row.inspection_item_name + '超上限'
return 'background: yellow'
}
row.is_ok = '1'
} else {
row.form_remark = ''
row.is_ok = '1'
}
}
}
},
computerResult() {
const rows = this.form1.tableData
for (let i = 0; i < rows.length; i++) {
if (rows[i].up_limit !== '') {
if (rows[i].value === undefined) {
this.crud.notify('有标准项点未输入完', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}
}
this.form1.result = '01'
var remark = ''
for (var row of rows) {
if (row.is_ok === '0') {
this.form1.result = '02'
} else {
if (row.is_limit_remark === '1' && row.form_remark) {
remark += row.form_remark.replace('\n', '') + ','
}
}
}
this.form1.remark = remark
this.$set(this.form1, 'remark', remark)
if (this.form1.metallography_remark !== '') {
this.form1.result = ''
return this.crud.notify('金相异常,需人工判定', CRUD.NOTIFICATION_TYPE.INFO)
}
if (this.form1.result === '01') return this.crud.notify('计算结果为合格', CRUD.NOTIFICATION_TYPE.SUCCESS)
if (this.form1.result === '02') return this.crud.notify('计算结果为不合格', CRUD.NOTIFICATION_TYPE.INFO)
},
format_inspection_item_type(row, column) {
return this.dict.label.QL_TEST_POINTTYPE[row.inspection_item_type]
},
onSubmit() {
const msg = '是否继续!'
const data = this.form1.tableData
var flag = 0
for (var row of data) {
if (row.up_limit !== '') {
if (!row.value) {
flag = flag + 1
}
}
}
// 如果检测值有一项没填则提示是否继续 (在上限下限有值的情况下)
if (flag > 0) {
this.$confirm(msg, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
crudPhysicalMst.saveResult(this.form1).then(res => {
this.close()
this.crud.toQuery()
this.notify('操作成功', 'success')
})
})
} else {
crudPhysicalMst.saveResult(this.form1).then(res => {
this.close()
this.crud.toQuery()
this.notify('操作成功', 'success')
})
}
},
onSubmit2() {
const data = this.form1.tableData
var flag = 0
for (var row of data) {
if (!row.value) {
flag = flag + 1
}
}
// if (flag === data.length) {
// this.crud.notify('请至少填写一项检测值', CRUD.NOTIFICATION_TYPE.INFO)
// return false
// }
crudPhysicalMst.saveResult(this.form1).then(res => {
this.close()
this.crud.toQuery()
this.notify('操作成功', 'success')
})
},
notify(title, type) {
this.$notify({
title: title,
type: type,
duration: 2500
})
},
cleanMater() {
this.form1.change_material_id = null
this.form1.change_material_code = null
this.form1.change_material_name = null
this.form1.change_pcsn = null
this.$forceUpdate()
},
tableChanged2(row) {
// 新增一行物料时,给行进行赋值
this.form1.change_material_id = row.material_id
this.form1.change_material_code = row.material_code
this.form1.change_material_name = row.material_name
this.form1.change_pcsn = this.form1.pcsn + '-GY'
},
close() {
// this.$emit('update:visiable1', false)
this.$parent._data.visiable1 = false
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss">
.edit-input {
.el-input__inner {
border: 1px solid #e5e6e7;
}
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 10px;
}
</style>