<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 style="line-height:30px">质量要求 : {{detail.FSPEC_REQU}}</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>抽检数 : {{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_SAMPLE" 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_SAMPLE ==null || item.FCHECK_SAMPLE =='' "></div>
|
<div v-else-if="(parseFloat(item.FCHECK_SAMPLE)<=parseFloat(detail.FUP_ALLOW) && parseFloat(item.FCHECK_SAMPLE) >= 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 {getFqcSampleResult,saveFqcType} from '../../api/fqc'
|
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) {
|
getFqcSampleResult(mainId).then(res => {
|
for (let item of res.data) {
|
if (item.IDX==1) {
|
item.FS = true
|
} else {
|
item.FS = false
|
}
|
|
this.table.push(item)
|
}
|
})
|
console.log(this.table)
|
},
|
submit() {
|
if(this.check()){
|
saveFqcType(this.detail.ID, this.table).then(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_SAMPLE === null || item.FCHECK_SAMPLE === '') {
|
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>
|