<template>
|
<view>
|
<view>
|
<uni-card>
|
<view style="font-size: 25px;">
|
<u-row customStyle="margin-top:5px;margin-bottom: 15px">
|
<u-col span="12">
|
<label>检验项目 : {{detail.FCHECK_ITEM}}</label>
|
</u-col>
|
</u-row>
|
<u-row customStyle="margin-bottom: 15px">
|
<u-col span="12">
|
<label>检验工具 : {{detail.FCHECK_TOOL}}</label>
|
</u-col>
|
</u-row>
|
<u-row customStyle="margin-bottom: 15px">
|
<u-col span="12">
|
<label style="line-height:30px">检验项目描述 : {{detail.FCHECK_ITEM_DESC}}</label>
|
</u-col>
|
</u-row>
|
<u-row customStyle="margin-bottom: 15px">
|
<u-col span="12">
|
<label>抽检数 : {{detail.CHECK_QYT}}</label>
|
</u-col>
|
</u-row>
|
<u-row customStyle="margin-bottom: 15px">
|
<u-col>
|
<label>上限 : {{detail.FUP_ALLOW}}</label>
|
</u-col>
|
</u-row>
|
<u-row customStyle="margin-bottom: 15px">
|
<u-col>
|
<label>标准值 : {{detail.FSTAND}}</label>
|
</u-col>
|
</u-row>
|
<u-row customStyle="margin-bottom: 15px">
|
<u-col>
|
<label>下限 : {{detail.FDOWN_ALLOW}}</label>
|
</u-col>
|
</u-row>
|
</view>
|
</uni-card>
|
</view>
|
|
<view>
|
<uni-table border stripe emptyText="暂无更多数据" style="margin-left: 5px;margin-right: 5px;">
|
<!-- 表头行 -->
|
<uni-tr>
|
<uni-th align="center" width="60">项次</uni-th>
|
<uni-th align="center" width="220">典型值记录</uni-th>
|
<uni-th align="center" width="150">值是否在范围内</uni-th>
|
</uni-tr>
|
<!-- 表格数据行 -->
|
<uni-tr v-for="(item,index) in table" style="height: 40px;">
|
<uni-td align="center" style="font-size: 25px;">{{item.IDX}} #</uni-td>
|
<uni-td align="center" style="font-size:25px;">
|
<input v-model="item.FCHECK_RESU" fontSize="28" input-align="center" :focus="item.FS" :ref="`table${index}`"
|
@confirm="confirm(index)" style="height: 40px;"></input>
|
</uni-td>
|
<uni-td align="center" style="font-size:25px;">
|
<div v-if="item.FCHECK_RESU ==null || item.FCHECK_RESU =='' "></div>
|
<div v-else-if="(parseFloat(item.FCHECK_RESU)<=parseFloat(detail.FUP_ALLOW) && parseFloat(item.FCHECK_RESU) >= parseFloat(detail.FDOWN_ALLOW))" style="color: #90BA87">√</div>
|
<div v-else style="color: #E47470">×</div>
|
</uni-td>
|
</uni-tr>
|
</uni-table>
|
</view>
|
|
<u-button text="保存" type="primary" style="margin-top: 20px;height: 55px;" @click="submit()"></u-button>
|
<div style="height: 100px;"></div>
|
<u-toast ref="uToast" />
|
</view>
|
</template>
|
|
<script>
|
import {getIqcSampleResult,saveIqcType} from '../../api/iqc'
|
export default{
|
data() {
|
return {
|
detail: {},
|
table: [],
|
name: '',
|
value:''
|
}
|
},
|
onLoad(option) {
|
this.detail = JSON.parse(decodeURIComponent(option.detail))
|
this.name = uni.getStorageSync('userInfo').username
|
this.getSampleResult(this.detail.ID)
|
},
|
methods: {
|
getSampleResult(mainId) {
|
getIqcSampleResult(mainId).then(res => {
|
var lg=res.data.length
|
for (let item of res.data) {
|
if (item.IDX==1) {
|
item.FS = true
|
} else {
|
item.FS = false
|
}
|
|
this.table.push(item)
|
}
|
if (this.detail.CHECK_QYT-lg>0){
|
for (let i =1;i<=this.detail.CHECK_QYT-lg;i++){
|
if (lg+i==1){
|
this.table.push({"ID":"1","FCHECK_RESU":"","RELEASE_NO":this.detail.RELEASE_NO,"MAIN_ID":this.detail.ID,"IDX":lg+i,"FS":true})
|
}else{
|
this.table.push({"ID":"1","FCHECK_RESU":"","RELEASE_NO":this.detail.RELEASE_NO,"MAIN_ID":this.detail.ID,"IDX":lg+i,"FS":false})
|
}
|
}
|
}
|
})
|
},
|
submit() {
|
if(this.check()){
|
saveIqcType(this.detail.RELEASE_NO,this.detail.ID, this.table).then(res => {
|
console.log(res)
|
if (!res.result) {
|
this.$refs.uToast.show({
|
message: res.msg,
|
type: 'error'
|
})
|
return
|
} else {
|
let pages = getCurrentPages();
|
let beforePage = pages[pages.length - 2];
|
uni.navigateBack({
|
delta: 1, //返回的页面数,如果为1表示返回上一页
|
success: (event) => {
|
beforePage.$vm.reload()
|
}
|
});
|
}
|
})
|
}else{
|
this.$refs.uToast.show({
|
message: '典型值未录入完全!',
|
type: 'error'
|
})
|
}
|
},
|
check() {
|
try{
|
this.table.forEach(item=>{
|
if (item.FCHECK_RESU === null || item.FCHECK_RESU === '') {
|
throw new Error()
|
}
|
})
|
return true
|
}catch(e){
|
return false
|
}
|
},
|
confirm(index){
|
// let nextInput = this.$refs[`table${index + 1}`];
|
// if (nextInput) {
|
// console.log(nextInput[0].focus);
|
// this.table[index].FS='true'
|
// }
|
uni.hideKeyboard();
|
if(this.table.length>index+1){
|
this.table[index].FS=false
|
this.table[index+1].FS=true
|
}
|
}
|
}
|
}
|
</script>
|
|
<style>
|
|
</style>
|