<template>
|
<view>
|
<view class="inspect-value-content">
|
<view class="form-item">
|
<view class="left">项目序号</view>
|
<view class="right disabled">
|
<input type="text" v-model="checkData.num" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">检验项目</view>
|
<view class="right disabled">
|
<input type="text" v-model="checkData.HQCCheckItemName" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">样本量</view>
|
<view class="right disabled">
|
<input type="text" v-model="checkData.HSampleQty" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">检验结果</view>
|
<view class="right disabled">
|
<input type="text" v-model="checkData.HResult2" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">不合格数</view>
|
<view class="right">
|
<input type="number" v-model="checkData.HSampleUnRightQty" />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">保留小数位</view>
|
<view class="right">
|
<input type="number" v-model="checkData.HResDec" />
|
</view>
|
</view>
|
<view style="width: 100%;border-bottom: 1px solid #e3e3e3;"></view>
|
<view class="form-item" style="width: 100%;">
|
<view class="left">状态</view>
|
<view class="right none-border">
|
<view style="width: 4em; ">
|
{{ checkData.HStatus?"合格":"不合格" }}
|
</view>
|
<view>
|
<switch style="width: 2em; transform:scale(0.7);" :checked="checkData.HStatus?'checked':''"
|
@change="HStatusChange" />
|
</view>
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">比较符</view>
|
<view class="right disabled">
|
<input type="text" v-model="checkData.HResult2" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">单位</view>
|
<view class="right disabled">
|
<input type="text" v-model="checkData.HTargetVal" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">检验值</view>
|
<view class="right disabled">
|
<input type="text" v-model="checkData.HInspectVal" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">目标值</view>
|
<view class="right disabled">
|
<input type="text" v-model="checkData.HTargetVal" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">上限值</view>
|
<view class="right disabled">
|
<input type="text" v-model="checkData.HUpLimit" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">下限值</view>
|
<view class="right disabled">
|
<input type="text" v-model="checkData.HDownLimit" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">上偏差</view>
|
<view class="right disabled">
|
<input type="text" v-model="checkData.HUpOffset" disabled />
|
</view>
|
</view>
|
<view class="form-item">
|
<view class="left">下偏差</view>
|
<view class="right disabled">
|
<input type="text" v-model="checkData.HDownOffset" disabled />
|
</view>
|
</view>
|
<view style="width: 100%;border-bottom: 1px solid #e3e3e3;"></view>
|
<view class="inspect-value-list">
|
<view style="width: 100%;text-align: right;">
|
<button type="default" size="mini" class="btn-a" @click="storeInspectValue">缓存检验值</button>
|
</view>
|
<view class="item" style="border-top: 2px solid #e3e3e3 ;">
|
<view class="th1">序号</view>
|
<view class="th2" style="display: flex; flex-direction: row; align-items: center;">
|
检验结果
|
</view>
|
<view class="th3">
|
检验值({{getAnalysisMethodTitle(checkData.HAnalysisMethod)}})
|
</view>
|
</view>
|
<view class="item" v-for="(item, index) in inspectValues">
|
<view class="th1">{{item.HSEQ}}</view>
|
<view class="th2" style="display: flex; flex-direction: row; align-items: center;">
|
<view style="width: 3em; ">
|
{{ item.HInspectResult?"合格":"不合格" }}
|
</view>
|
<view>
|
<switch style="width: 3em; transform:scale(0.7);" :checked="item.HInspectResult?'checked':''"
|
@change="HInspectResultChange(index, $event)" />
|
</view>
|
</view>
|
<view class="th3">
|
<input type="number" v-model="item.HInspectValue" />
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
// 检验值模板
|
export default {
|
name: "InspectValueTemplate",
|
data() {
|
return {
|
checkData: {
|
HResDec: 2,
|
HResult2: '',
|
HStatus: true,
|
},
|
inspectValues: []
|
};
|
},
|
props: {
|
bindKey: {
|
type: [String, Number],
|
required: true
|
},
|
bindData: {
|
type: Object,
|
required: true
|
}
|
},
|
mounted() {
|
console.log('bingData: ', this.bindData);
|
let {data, list} = this.bindData
|
this.checkData = Object.assign(data, JSON.parse(JSON.stringify(this.bindData)))
|
// 判断是否有缓存数据或者缓存数据是否与样本数一致
|
if(!list || list.length != this.checkData.HSampleQty ){
|
for (let index = 0; index < this.checkData.HSampleQty; index++) {
|
this.inspectValues.push({
|
HSEQ: index + 1,
|
HInspectResult: true,
|
HInspectValue: 0,
|
})
|
}
|
}else {
|
this.inspectValues = list
|
}
|
|
this.$forceUpdate()
|
},
|
methods: {
|
storeInspectValue(){
|
this.$emit("update", {
|
data: this.checkData,
|
list: this.inspectValues
|
})
|
},
|
getAnalysisMethodTitle(type){
|
if(type == 1) {
|
return '定性分析'
|
}else if(type == 2){
|
return '定量分析'
|
}
|
return '其他分析'
|
},
|
HStatusChange(e) {
|
this.checkData.HStatus = e.detail.value
|
},
|
HInspectResultChange(index, e) {
|
console.log('e: ',e.detail.value);
|
this.inspectValues[index].HInspectResult = e.detail.value
|
},
|
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
input {
|
height: inherit;
|
width: inherit;
|
font-size: 26rpx;
|
}
|
|
.inspect-value-content {
|
box-sizing: border-box;
|
padding: 20rpx 10rpx;
|
display: flex;
|
flex-direction: row;
|
flex-wrap: wrap;
|
gap: 20rpx 0;
|
|
.form-item {
|
width: 50%;
|
display: flex;
|
align-items: center;
|
font-size: 26rpx;
|
box-sizing: border-box;
|
padding-left: 20rpx;
|
|
.left {
|
width: 5em;
|
|
text {
|
color: red;
|
font-weight: bold;
|
}
|
}
|
|
.right {
|
// width: 450rpx;
|
padding: 8rpx 20rpx;
|
font-size: 26rpx;
|
flex: 1;
|
border-radius: 22rpx;
|
border: 1px solid #acacac;
|
display: flex;
|
flex-direction: row;
|
align-items: center;
|
}
|
|
.disabled {
|
border: 1px solid #e4e4e4;
|
background-color: #e4e4e4;
|
}
|
|
.none-border {
|
border: none;
|
}
|
}
|
}
|
|
.inspect-value-list {
|
box-sizing: border-box;
|
display: flex;
|
flex-direction: column;
|
width: 100%;
|
|
.item {
|
display: flex;
|
flex-direction: row;
|
align-items: center;
|
font-size: 30rpx;
|
}
|
|
.th1 {
|
height: 100%;
|
width: 4em;
|
border: #e4e4e4 2px solid;
|
border-top: 0;
|
display: flex;
|
align-items: center;
|
box-sizing: border-box;
|
padding: 8rpx 16rpx;
|
}
|
|
.th2 {
|
height: 100%;
|
width: 50%;
|
border: #e4e4e4 2px solid;
|
border-left: 0;
|
border-top: 0;
|
box-sizing: border-box;
|
padding: 8rpx 16rpx;
|
}
|
|
.th3 {
|
height: 100%;
|
flex: 1;
|
border: #e4e4e4 2px solid;
|
border-left: 0;
|
border-top: 0;
|
box-sizing: border-box;
|
padding: 8rpx 16rpx;
|
}
|
}
|
|
.btn-a {
|
background-color: #3A78FF;
|
color: #fff;
|
}
|
</style>
|