<template>
|
<!-- 新增页面 -->
|
<div class="addInspection">
|
<div class="page-header">
|
<div class="header-left">
|
<a @click="$router.go(-1)"><i class="icon-btn-back"></i></a>
|
<h2>编辑-产品检验</h2>
|
</div>
|
<div class="btn-group header-right">
|
<el-button @click="addTestProject">生成检验项目</el-button>
|
</div>
|
</div>
|
<div class="page-main">
|
<div class="finishedProduct-basic">
|
<el-form :model="processInspectVo" ref="addInspectionform" class="l-mes"
|
label-position="right" label-width="120px" style="width: 100%" size="small">
|
<div class="formwrapper">
|
<el-row>
|
<el-col :span="6">
|
<el-form-item label="订单号:">
|
<el-input @blur="selectInfoByOrderId" v-model="processInspectVo.orderNumber" placeholder="请输入订单号" autocomplete="off" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="客户名称:">
|
<el-input disabled v-model="processInspectVo.prname"
|
placeholder="请输入客户名称" autocomplete="off" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="工程名称:">
|
<el-input disabled v-model="processInspectVo.sname"
|
placeholder="请输入工程名称" autocomplete="off" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="质量追溯号:">
|
<el-input disabled v-model="processInspectVo.qualityTraceability"
|
placeholder="请输入质量追溯号" autocomplete="off" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="6">
|
<el-form-item label="产品名称:">
|
<el-select style="width: 100%" @change="changeOptionsSamplename"
|
v-model="processInspectVo.material" size="small" placeholder="请选择产品名称">
|
<el-option v-for="(item,index) in optionsSamplename" :key="index" :label="item.material"
|
:value="item.materialCode">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="产品编码:">
|
<el-input disabled v-model="processInspectVo.mcode"
|
placeholder="请输入产品编码" autocomplete="off" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="规格型号:">
|
<el-input disabled v-model="processInspectVo.specificationsModel"
|
placeholder="请输入规格型号" autocomplete="off" />
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="单位:">
|
<el-input disabled v-model="processInspectVo.unit"
|
placeholder="请输入单位" autocomplete="off" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="6">
|
<el-form-item label="数量:">
|
<el-input v-model="processInspectVo.quantity" placeholder="请输入数量"
|
autocomplete="off" />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</div>
|
</el-form>
|
</div>
|
<div class="finishedProduct-detail">
|
<el-row style="width:100%;z-index: 10;height:50px;">
|
<el-col :span="12" class="inspectionProject_span">检验项目</el-col>
|
<el-col :span="12" class="inspectionProject_span" style="text-align: right;">
|
<el-button size="mini" @click="clickAddInspectionColumn()">添加检验值列</el-button>
|
<el-button size="mini" @click="clickDeleteInspectionColumn()">删除检验值列</el-button>
|
</el-col>
|
</el-row>
|
<el-row style="width:100%;">
|
<el-col :span="24">
|
<el-table border :data="inspectionItems" max-height="400" height="calc(100vh - 550px)"
|
:header-cell-style="{textAlign:'center',color:'black',backgroundColor:'#fafafa'}"
|
:cell-style="{textAlign:'center'}" row-key="iid"
|
style="width: 100%" ref="table" :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
|
<el-table-column type="index" label="序号" width="60"></el-table-column>
|
<el-table-column label="项目" prop="father"></el-table-column>
|
<el-table-column prop="iname" label="指标"></el-table-column>
|
<el-table-column prop="iunit" label="单位"></el-table-column>
|
<el-table-column prop="required" label="标准值"></el-table-column>
|
<el-table-column prop="inspectionValue" v-for="(item, index) in empiricalValueAdd" :key="index" label="检测值"
|
min-width="100" style="text-align: center;">
|
<template slot-scope="scope">
|
<el-tooltip :disabled="scope.row.dname != null" class="item" effect="dark" content="请先选择设备!"
|
placement="top-start">
|
<!-- <el-input :disabled="scope.row.dname === null" v-model="scope.row.empiricalValueAddss[index]"
|
@blur="changeState(scope.row, index)" placeholder="请输入检测值"></el-input> -->
|
</el-tooltip>
|
</template>
|
</el-table-column>
|
<el-table-column prop="dname" label="试验设备" min-width="100">
|
<template slot-scope="scope">
|
<el-button v-if="!scope.row.isSelectDevice" type="text" @click="clickTableSelect(scope)">{{
|
scope.row.dname == null ? "请选择" : scope.row.dname
|
}}</el-button>
|
<el-select v-if="scope.row.isSelectDevice" style="width: 100%;" @change="clickNodeSure(scope.row)" v-model="filterText" placeholder="请选择">
|
<el-option v-for="item in materialOptions" :key="item.id" :label="item.device" :value="item.id">
|
</el-option>
|
</el-select>
|
</template>
|
</el-table-column>
|
<el-table-column prop="deviceName" label="试验设备" min-width="260">
|
<template slot-scope="scope">
|
<el-select style="width:100%" v-model="scope.row.equipmentId" filterable @change="updateDevice(scope.row)">
|
<el-option v-for="(item,index) in deviceList"
|
:key="index" :value="item.id" :label="item.number +'-'+ item.name"></el-option>
|
</el-select>
|
</template>
|
</el-table-column>
|
<el-table-column label="结论" fixed="right" min-width="100">
|
<template slot-scope="scope">
|
<span style="color: #34BD66;" v-if="scope.row.result === 1">合格</span>
|
<span style="color: #E84738;" v-else-if="scope.row.result === 0">不合格</span>
|
<span v-show="scope.row.result === null">暂未结论</span>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-col>
|
</el-row>
|
</div>
|
<div class="finishedProduct-detail">
|
<el-row style="width:100%">
|
<el-col :span="24">检测结果</el-col>
|
</el-row>
|
<el-row style="width:100%;margin-top:-180px">
|
<el-col :span="24">
|
<el-table border max-height="400" :data="inspectionResultForm"
|
:header-cell-style="{textAlign:'center',color:'black',backgroundColor:'#fafafa'}"
|
:cell-style="{textAlign:'center'}">
|
<el-table-column prop="id" label="物料编号"></el-table-column>
|
<el-table-column prop="name" label="物料名称"></el-table-column>
|
<el-table-column prop="inspecter" label="检验员"></el-table-column>
|
<el-table-column prop="conclusion" label="检验结论"></el-table-column>
|
<el-table-column prop="operation" label="上报"></el-table-column>
|
</el-table>
|
</el-col>
|
</el-row>
|
</div>
|
</div>
|
<el-dialog title="请选择设备" :visible.sync="centerDialogVisible" width="20%">
|
<div class="div_device_dialog">
|
<el-select style="width: 100%;" @change="clickNodeSure()" v-model="filterText" placeholder="请选择">
|
<el-option v-for="item in materialOptions" :key="item.id" :label="item.device" :value="item.id">
|
</el-option>
|
</el-select>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import {
|
chooseMater,
|
addFinish,
|
queryById, } from '@/api/quality/finishedProduct'
|
import { updateDeviceById,selectDevice } from '@/api/quality/rawMaterial'
|
export default {
|
data() {
|
return {
|
deviceList: [],
|
hasChildren: true,
|
showUp: false,
|
isAddProject: false,
|
showLook: false,
|
detailId: 0,
|
rowInfp: {},
|
search: {
|
countSize: 10,
|
pageSize: 1,
|
result: "", // 检测状态
|
name: "", // 产品名称
|
techfather: "" // 工序
|
},
|
optionsSamplename: [],
|
inspectionTable: [],
|
tableColumn: [],
|
optionSoptionSprocesses: [],
|
optionTechnology: [],
|
inspectionTableTotal: 0,
|
pageSize: 10,
|
currentPage: 1,
|
treeProject: [],
|
// 添加列
|
empiricalValueAdd: 1,
|
// 编辑时存储最长的列数字,做删除判断
|
empiricalValueAddMaxNumber: 0,
|
showAddPage: false,
|
processInspectVo: {
|
id: null,
|
material: null,
|
mcode: null,
|
prname: null,
|
sname: null,
|
orderNumber: "ZTTIC20230001",
|
qualityTraceability: null,
|
quantity: null,
|
specificationsModel: null,
|
unit: null,
|
technologyId: null
|
},
|
InspectioniD: null,
|
addInspectionform: [
|
{
|
number: "",
|
username: "",
|
projectname: "",
|
tracenumber: "",
|
code: "",
|
class: "",
|
specificationmodel: "",
|
unit: "",
|
quantity: "",
|
group: "",
|
worker: "",
|
machine: ""
|
}]
|
,
|
inspectionItems: [], // 新增检验项目表格
|
inspectionResultForm: [
|
{
|
id: "",
|
name: "",
|
inspecter: "",
|
conclusion: "",
|
operation: ""
|
}
|
],
|
options: [],
|
value: "",
|
rowList: [],
|
spanArr: [],
|
position: 0,
|
// 设备选择树显示
|
centerDialogVisible: false,
|
filterText: "",
|
materialOptions: [],
|
defaultProps: {
|
// 设备树数据设置
|
children: "children",
|
label: "name"
|
},
|
nodeData: {
|
id: 0,
|
name: null
|
}, // node点击保存当前点击数据
|
clickSelectDevice: {
|
index: null, // 点击选择存储当前行索引
|
rpId: null // 点击选择存储当前行项目Id
|
}
|
};
|
},
|
watch: {
|
},
|
beforeUpdate(){
|
this.$nextTick(()=>{
|
this.$refs.table.doLayout();
|
})
|
},
|
created() {
|
},
|
mounted() {
|
this.getDeviceList()
|
},
|
methods: {
|
getDeviceList(){
|
selectDevice(null).then(res=>{
|
this.deviceList = res.data.data
|
})
|
},
|
updateDevice(row){
|
if(this.dataForm.id != null){
|
updateDeviceById({equiomentId:row.equipmentId,rpId:row.rpId}).then(res=>{
|
}).catch(error=>{
|
console.log(error)
|
})
|
}
|
},
|
changeOptionsSamplename(val) {
|
let sample = this.optionsSamplename.filter(o => {
|
return o.materialCode == val
|
})[0]
|
// this.processInspectVo.qualityTraceability = sample.qualityTraceability
|
this.processInspectVo.mcode = sample.materialCode
|
this.processInspectVo.material = sample.material
|
this.processInspectVo.specificationsModel = sample.specs
|
this.processInspectVo.unit = sample.unit
|
},
|
handleClick(row) {
|
this.rowInfp = row
|
this.showLook = true
|
},
|
updateInsInfo(row) {
|
this.rowInfp = row
|
this.showUp = true
|
},
|
searchPro() {
|
this.search.countSize = this.pageSize
|
this.search.pageSize = this.currentPage
|
this.defaultInitializationTable()
|
},
|
// 点击表格选择触发
|
clickTableSelect(scope) {
|
if(this.clickSelectDevice.index!=null){
|
this.$set(this.inspectionItems[this.clickSelectDevice.index],'isSelectDevice',false)
|
}
|
this.clickSelectDevice.index = scope.$index;
|
this.clickSelectDevice.rpId = scope.row.id;
|
this.getOptions(scope.row);
|
},
|
changeState(row, index) {
|
if (row.did != null && row.did != '') {
|
// let val = row.empiricalValueAddss.filter(item => {
|
// return item != '' && item != null
|
// })
|
// let eq = val.filter(item => {
|
// return /^[^><=]/.test(item)
|
// })
|
// if (eq.length > 0) {
|
// this.$message({
|
// message: "检测值[" + eq + "]格式首位应包含>,<或者=",
|
// type: 'warning'
|
// });
|
// return
|
// }
|
let str = ""
|
row.empiricalValueAddss.forEach(e => {
|
str += e + ","
|
})
|
if (str.slice(0, -1) === '' || str.slice(0, -1) === null || str.slice(0, -1) === undefined) {
|
return
|
}
|
this.$axios.post(this.$api.url.inspectionItemlose_focus_update, {
|
deviceId: row.did,
|
inspectionItemId: row.id,
|
inspectionValue: str.slice(0, -1)
|
}, {
|
headers: { "Content-Type": "application/json" }
|
}).then(res => {
|
row.result = res.data.result
|
row.username = res.data.username
|
})
|
} else {
|
this.$message({
|
message: '请选择择设备!',
|
type: 'warning'
|
});
|
}
|
},
|
addTestProject() {
|
let val = this.processInspectVo
|
let data = {
|
customerName: val.prname,
|
material: val.material,
|
materialCode: val.mcode,
|
orderNumber: val.orderNumber,
|
projectName: val.sname,
|
quantity: val.quantity,
|
specs: val.specificationsModel,
|
unit: val.unit,
|
}
|
addFinish(data).then(res=>{
|
let id = res.data.data
|
if(id != null){
|
queryById(id).then(response=>{
|
console.log(response.data.data.children)
|
let proList = response.data.data.children
|
proList.forEach(item=>{
|
item.iid = Math.random();
|
})
|
this.inspectionItems = proList
|
}).catch(error=>{
|
console.log(error);
|
})
|
}
|
}).catch(error=>{
|
console.log(error)
|
})
|
},
|
selectInfoByOrderId() {
|
chooseMater({
|
orderNumber: this.processInspectVo.orderNumber
|
}).then(res => {
|
if (res.data.data != null) {
|
this.processInspectVo.sname = res.data.data.projectName
|
this.processInspectVo.prname = res.data.data.customerName
|
this.optionsSamplename = res.data.data.children
|
} else {
|
this.$message({
|
message: '没有该订单号!',
|
type: 'warning'
|
});
|
this.processInspectVo.sname = null
|
this.processInspectVo.prname = null
|
this.optionsSamplename = []
|
this.processInspectVo.mcode = null
|
this.processInspectVo.material = null
|
this.processInspectVo.specificationsModel = null
|
this.processInspectVo.unit = null
|
}
|
})
|
},
|
// 表格初始化接口
|
defaultInitializationTable() {
|
// this.$axios
|
// .post(this.$api.url.selectProcessInspectsList, this.search)
|
// .then(res => {
|
// this.inspectionTableTotal = res.data.total;
|
// this.inspectionTable = res.data.row;
|
// });
|
},
|
// 添加行
|
clickAddLine() {
|
let obj = {
|
material: "",
|
materialCode: "",
|
orderNumber: "",
|
quantity: 0,
|
specificationsModel: "",
|
techfather: "",
|
techname: "",
|
technologyId: 0,
|
unit: ""
|
};
|
this.inspectionItems.push(obj);
|
},
|
// 删除行
|
clickDeleteline(scope) {
|
this.inspectionItems.splice(scope.$index, 1);
|
},
|
// 删除检验值列
|
clickDeleteInspectionColumn() {
|
if (this.empiricalValueAdd - 1 === 0) {
|
} else {
|
if (this.empiricalValueAddMaxNumber != this.empiricalValueAdd - 1) {
|
this.empiricalValueAdd = this.empiricalValueAdd - 1;
|
this.inspectionItems.forEach(i => {
|
i.testValueList.splice(this.empiricalValueAdd, 1);
|
});
|
}
|
}
|
},
|
// 添加检验值列
|
clickAddInspectionColumn() {
|
this.empiricalValueAdd = this.empiricalValueAdd + 1;
|
}
|
},
|
}
|
</script>
|
|
<style scoped>
|
.finishedProduct-detail {
|
width: 100%;
|
height: 460px;
|
padding: 10px 20px;
|
display: flex;
|
border: 1px solid #ddd;
|
background-color: #fff;
|
margin-top: 10px;
|
box-sizing: border-box;
|
flex-wrap: wrap;
|
}
|
|
.finishedProduct-basic {
|
background-color: #fff;
|
height: 155px;
|
display: flex;
|
flex-wrap: wrap;
|
padding: 10px 20px;
|
border: 1px solid #ddd;
|
box-sizing: border-box;
|
}
|
/*自定义disabled状态下checkbox的样式*/
|
.completeproductstructure-checkout
|
.el-checkbox__input.is-disabled.is-checked
|
.el-checkbox__inner {
|
background-color: #006eff;
|
border-color: #006eff;
|
}
|
|
.completeproductstructure-checkout
|
.el-checkbox__input.is-disabled.is-checked
|
+ span.el-checkbox__label {
|
color: #006eff;
|
border-color: #006eff;
|
}
|
|
.completeproductstructure-checkout
|
.el-checkbox__input.is-disabled
|
.el-checkbox__inner {
|
background-color: #ffffff;
|
cursor: pointer;
|
}
|
|
.completeproductstructure-checkout
|
.el-checkbox__input.is-disabled
|
+ span.el-checkbox__label {
|
color: #606266;
|
cursor: pointer;
|
}
|
|
.completeproductstructure-checkout .el-checkbox__inner::after {
|
border: 1px solid #fff !important;
|
border-left: 0 !important;
|
border-top: 0 !important;
|
cursor: pointer !important;
|
}
|
</style>
|