| | |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="数量" prop="number"> |
| | | <el-input v-model="dataForm.number" /> |
| | | <el-input v-model="dataForm.number" :disabled="resultVal!=null" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item prop="projectName" label="项目名称"> |
| | | <el-tooltip :disabled="dataForm.projectName==null" :content="dataForm.projectName"> |
| | | <el-input v-model="dataForm.projectName" disabled ></el-input> |
| | | </el-tooltip> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="6"> |
| | | <el-form-item label="报检日期" prop="createTime" v-if="dataForm.id!=null"> |
| | | <el-input v-model="dataForm.createTime" disabled /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | </el-col> |
| | | <el-col :span="6"> |
| | | <el-form-item label="报检人" prop="createUser" v-if="dataForm.id!=null"> |
| | | <el-input v-model="dataForm.createUser" disabled /> |
| | |
| | | :data="list" border style="width: 100%;" height="400"> |
| | | <el-table-column type="index" label="序号" width="60"> |
| | | </el-table-column> |
| | | <el-table-column prop="father" label="检验项目" width="260"> |
| | | <template slot-scope="scope"> |
| | | <el-input :disabled="dataForm.id != null" v-model="scope.row.father" placeholder="请输入检验项目"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="note" label="检验描述" width="260"> |
| | | <template slot-scope="scope"> |
| | | <el-input :disabled="dataForm.id != null" v-model="scope.row.note" placeholder="检验描述"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="项目" width="260"> |
| | | <template slot-scope="scope"> |
| | | <el-select v-if="projectList.length > 0" :disabled="dataForm.id != null" class="inline-input" v-model="scope.row.name" |
| | |
| | | placeholder="请输入项目名称"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column prop="unit" label="单位" width="260"> |
| | | <template slot-scope="scope"> |
| | | <el-input :disabled="dataForm.id != null" v-model="scope.row.unit" placeholder="请输入单位"></el-input> |
| | |
| | | placeholder="请输入标准值"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column prop="testValue" label="检测值" min-width="260" v-for="(item, index) in empiricalValueAdd" |
| | | :key="index"> |
| | | <template slot-scope="scope"> |
| | | <el-tooltip :disabled="scope.row.equipmentId != null" class="item" effect="dark" content="请先选择设备!" |
| | | <el-tooltip :disabled="scope.row.deviceId != null" class="item" effect="dark" content="请先选择设备!" |
| | | placement="top-start"> |
| | | <el-input :disabled="scope.row.equipmentId == null || dataForm.id!=null" v-model="scope.row.testValueList[index]" |
| | | @blur="updateTestValue(scope.row)" placeholder="请输入检测值"></el-input> |
| | | </el-tooltip> |
| | | |
| | | <!-- <el-input :disabled="scope.row.equipmentId == null || (dataForm.id!=null&&resultVal!=null)" v-model="scope.row.testValueList[index]" |
| | | @blur="updateTestValue(scope.row,index)" placeholder="请输入检测值"></el-input> --> |
| | | |
| | | <el-autocomplete |
| | | style="width:100%" |
| | | :disabled="scope.row.deviceId == null || (dataForm.id!=null&&resultVal!=null)" |
| | | class="inline-input" |
| | | v-model="scope.row.testValueList[index]" |
| | | :fetch-suggestions="querySearch" |
| | | placeholder="请输入检测值" |
| | | @select="handleSelect" |
| | | ></el-autocomplete> |
| | | |
| | | </el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column prop="deviceName" label="试验设备" min-width="260"> |
| | | <template slot-scope="scope"> |
| | | <el-select :disabled="resultVal!=null && dataForm.id!=null" style="width:100%" v-model="scope.row.equipmentId" filterable @change="updateDevice(scope.row)"> |
| | | <el-select :disabled="resultVal!=null && dataForm.id!=null" style="width:100%" |
| | | v-model="scope.row.deviceId" filterable @change="updateDevice(scope.row,scope.$index)"> |
| | | <el-option v-for="(item,index) in deviceList" |
| | | :key="index" :value="item.id" :label="item.number +'-'+ item.name"></el-option> |
| | | :key="index" :value="item.id" :label="item.code +'-'+ item.name"></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | <el-table-column fixed="right" v-if="dataForm.id != null" prop="testState" label="结论" min-width="150"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.testState == 0" style="color:#F56C6C">不合格</span> |
| | |
| | | <el-table-column prop="userName" label="检验员"></el-table-column> |
| | | <el-table-column prop="judgeState" label="检验结论"> |
| | | <template slot-scope="scope"> |
| | | <el-tag type="success" v-if="scope.row.judgeState == 1">合格</el-tag> |
| | | <el-tag type="danger" v-else-if="scope.row.judgeState == 0">不合格</el-tag> |
| | | <el-tag type="success" v-if="scope.row.testState == '1'">合格</el-tag> |
| | | <el-tag type="danger" v-else-if="scope.row.testState == '0'">不合格</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作"> |
| | |
| | | <el-dialog |
| | | title="上报" |
| | | :visible.sync="dialogVisible" |
| | | width="30%"> |
| | | width="30%" class="l-mes"> |
| | | <el-row> |
| | | <el-col> |
| | | <span>不合格数量:</span> |
| | | <el-input type="number" v-model="unqualifiedNum" placeholder="请输入不合格数量"/> |
| | | </el-col> |
| | | <el-col> |
| | | <span>实检数量:</span> |
| | | <el-input type="number" placeholder="请输入实检数量" v-model="fiedNum"/> |
| | | </el-col> |
| | | </el-row> |
| | | <span slot="footer" class="dialog-footer"> |
| | |
| | | updateDeviceById, } from '@/api/quality/rawMaterial' |
| | | import rawMaterialPartDialog from '@/views/common/rawMaterial-part' |
| | | export default { |
| | | // props:['currentRow'], |
| | | computed:{}, |
| | | components:{ |
| | | rawMaterialPartDialog |
| | | }, |
| | | data(){ |
| | | return{ |
| | | fiedNum: null, |
| | | currentRow:[], |
| | | userlist:[], |
| | | unqualifiedNum: null, |
| | | dialogVisible:false, |
| | | resultVal: null, |
| | |
| | | formTime: '', |
| | | message: '', |
| | | name: '', |
| | | code: '88.118.1/A0487643', |
| | | code: '88.118.1/A0498220', |
| | | specs: '', |
| | | unit: '', |
| | | number: '', |
| | | supplier: '', |
| | | rawInsProducts: [{ |
| | | equipmentId: 0, |
| | | deviceId: 0, |
| | | name: '', |
| | | required: '', |
| | | testValue: '', |
| | |
| | | }], |
| | | dataRule: {}, |
| | | deviceList: [], |
| | | restaurants:[], |
| | | whetherNot:'', |
| | | } |
| | | }, |
| | | beforeUpdate(){ |
| | |
| | | this.dataForm.id = this.$route.query.id |
| | | this.resultVal = this.$route.query.resultVal |
| | | if(this.resultVal == null){ |
| | | let val = sessionStorage.getItem("raw-resultVal") |
| | | let val = sessionStorage.getItem("raw-resultVal-"+this.dataForm.id) |
| | | val == undefined ? null : this.resultVal=val |
| | | } |
| | | this.init() |
| | | this.getDeviceList() |
| | | this.restaurants = this.loadAll(); |
| | | |
| | | console.log(this.dataForm); |
| | | }, |
| | | watch:{ |
| | | |
| | | dialogVisible(newVal){ |
| | | if(newVal){ |
| | | this.unqualifiedNum = null |
| | | } |
| | | }, |
| | | |
| | | }, |
| | | methods:{ |
| | | querySearch(queryString, cb) { |
| | | var restaurants = this.restaurants; |
| | | var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants; |
| | | |
| | | cb(results); |
| | | }, |
| | | createFilter(queryString) { |
| | | return (restaurant) => { |
| | | return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0); |
| | | }; |
| | | }, |
| | | loadAll(){ |
| | | return [ |
| | | {"value":"是"}, |
| | | {"value":"否"} |
| | | ];}, |
| | | handleSelect(item) { |
| | | console.log(item); |
| | | }, |
| | | changeName(index,row){ |
| | | this.projectList.forEach(item=>{ |
| | | if(row.name == item.name){ |
| | |
| | | this.dataForm.supplier = param.supplier |
| | | this.dataForm.number = param.number |
| | | this.dataForm.message = param.message |
| | | this.dataForm.projectName = param.projectName |
| | | this.projectList = param.rawInsProducts == null ? [] : param.rawInsProducts |
| | | param.rawInsProducts.forEach(o=>{ |
| | | this.clickAddLine(o) |
| | | }) |
| | | } |
| | | }, |
| | | queryCode(){ |
| | |
| | | } |
| | | this.showPart = true |
| | | }, |
| | | updateDevice(row){ |
| | | updateDevice(row,index){ |
| | | if(this.dataForm.id != null){ |
| | | updateDeviceById({equiomentId:row.equipmentId,rpId:row.rpId}).then(res=>{ |
| | | updateDeviceById({deviceId:row.deviceId,rpId:row.rpId}).then(res=>{ |
| | | this.list[index].testValue = '' |
| | | this.list[index].testState = null |
| | | this.list[index].testValueList = [] |
| | | }).catch(error=>{ |
| | | console.log(error) |
| | | }) |
| | | } |
| | | }, |
| | | showDialog(){ |
| | | this.dialogVisible = true |
| | | checkTestState(){ |
| | | let resultVal = '1' |
| | | this.list.forEach(item=>{ |
| | | if(item.children){ |
| | | if(obj.testState == 0){ |
| | | resultVal = '0' |
| | | } |
| | | } |
| | | }) |
| | | this.resultVal = resultVal |
| | | this.conclusionTable[0].testState = resultVal |
| | | sessionStorage.setItem("raw-resultVal-"+this.dataForm.id,resultVal) |
| | | }, |
| | | submitSave(){ |
| | | showDialog(){ |
| | | let pro = this.list.filter(item => { |
| | | return item.testState == 0; |
| | | }) |
| | | if (pro.length > 0) { |
| | | let data = { |
| | | id: this.dataForm.id, |
| | | number: this.unqualifiedNum, |
| | | toLocationNo: this.fiedNum |
| | | } |
| | | updateRawInspectsById(data).then(res => { |
| | | if(res.data.code == 0){ |
| | | sessionStorage.setItem("raw-resultVal",data.judgeState) |
| | | this.$message.success("上报成功"); |
| | | } |
| | | }); |
| | | this.dialogVisible = true |
| | | }else{ |
| | | updateRawInspectsById({id:this.dataForm.id,number:0}).then(res => { |
| | | if(res.data.code == 0){ |
| | | sessionStorage.setItem("raw-resultVal",res) |
| | | this.$message.success("上报成功"); |
| | | } |
| | | }); |
| | | this.submitSave() |
| | | } |
| | | this.init() |
| | | }, |
| | | //上报 |
| | | submitSave(){ |
| | | let data = { |
| | | id: this.dataForm.id, |
| | | number: this.unqualifiedNum, |
| | | // toLocationNo: this.fiedNum |
| | | } |
| | | updateRawInspectsById(data).then(res => { |
| | | if(res.data.code == 0){ |
| | | sessionStorage.setItem("raw-resultVal-"+this.dataForm.id,res.data.data) |
| | | this.$message.success("上报成功"); |
| | | this.dialogVisible = false |
| | | this.checkTestState() |
| | | } |
| | | }); |
| | | }, |
| | | addTeatValueColumn(){ |
| | | this.empiricalValueAdd = this.empiricalValueAdd + 1; |
| | | }, |
| | | // 添加行 |
| | | clickAddLine() { |
| | | clickAddLine(row) { |
| | | let obj = { |
| | | equipmentId: null, |
| | | deviceId: null, |
| | | name: "", |
| | | required: "", |
| | | testValue: "", |
| | |
| | | testState: null, |
| | | testValueList: [], |
| | | }; |
| | | if(row!=undefined){ |
| | | obj.name = row.name |
| | | obj.unit = row.unit |
| | | obj.required = row.required |
| | | } |
| | | this.list.push(obj); |
| | | }, |
| | | // 删除行 |
| | |
| | | } |
| | | } |
| | | }, |
| | | updateTestValue(row){ |
| | | if(row.rpId == null){ |
| | | updateTestValue(row,index){ |
| | | if(row.rpId == null || row.testValueList[index]==null){ |
| | | return |
| | | } |
| | | let obj = { |
| | | equiomentId: row.equipmentId, |
| | | deviceId: row.deviceId, |
| | | rpId: row.rpId, |
| | | testValue: row.testValueList.join(",") |
| | | } |
| | |
| | | this.dataForm.unit = data.runit |
| | | this.dataForm.supplier = data.supplier |
| | | this.dataForm.number = data.number |
| | | this.dataForm.projectName = data.projectName |
| | | this.dataForm.createTime = data.creatTime |
| | | this.dataForm.createUser = data.createUser |
| | | // this.dataForm.judgeState = data.judgeState |
| | | let userNameList = [] |
| | | this.list = [] |
| | | data.children.forEach(item=>{ |
| | |
| | | let arr = [] |
| | | if(item.testValue != undefined ){ |
| | | arr = item.testValue.split(",") |
| | | this.empiricalValueAdd = arr.length |
| | | }else{ |
| | | this.empiricalValueAdd = 1 |
| | | if(arr.length > this.empiricalValueAdd){ |
| | | this.empiricalValueAdd = arr.length |
| | | } |
| | | } |
| | | this.list.push({ |
| | | equipmentId: item.equiomentId, |
| | | deviceId: item.deviceId, |
| | | deviceName: item.deviceName, |
| | | name: item.rpName, |
| | | required: item.required, |
| | |
| | | code: data.code, |
| | | name: data.name, |
| | | userName: Array.from(new Set(userNameList)).join(','), |
| | | judgeState: data.judgeState |
| | | testState: this.resultVal==null?null:this.resultVal |
| | | }] |
| | | }).catch(error=>{ |
| | | this.$message.error("获取失败",error) |
| | |
| | | }) |
| | | addRawInspects(data).then(res=>{ |
| | | this.$message.success("保存成功") |
| | | this.$router.go(-1) |
| | | }).catch(error=>{ |
| | | this.$message.error(error) |
| | | }) |
| | | }, |
| | | getDeviceList(){ |
| | | selectDevice(null).then(res=>{ |
| | | selectDevice().then(res=>{ |
| | | this.deviceList = res.data.data |
| | | }) |
| | | }, |