修改bug

This commit is contained in:
‘937886381’
2024-04-11 15:26:51 +08:00
parent 024060182e
commit e7f440a142
4 changed files with 87 additions and 47 deletions

View File

@@ -1,7 +1,7 @@
<!--
* @Author: zhp
* @Date: 2023-12-08 13:46:17
* @LastEditTime: 2024-04-10 16:46:44
* @LastEditTime: 2024-04-11 15:25:51
* @LastEditors: zhp
* @Description:
-->
@@ -75,7 +75,7 @@
<el-row :gutter="24" v-for="(item,index) in ingredientList" :key="item.id">
<el-col :span="4">
<el-form-item label="成分">
{{ item.name }}
{{ item.checkName }}
</el-form-item>
</el-col>
<el-col :span="6">
@@ -83,11 +83,11 @@
:rules="[{ required: true, message: '成分含量不能为空', trigger: 'blur' }]">
<el-input oninput="value=value.replace(/[^\d]/g,'')" :disabled="isdetail"
style="width: 90%;margin-right: 10px;" :max="item.maxValue" :min='item.minValue'
v-model.number="dataForm.checkValueList[index].checkValue"
@change="judgeValue(arguments[0],item.minValue,item.maxValue,index)"></el-input>
v-model.number="dataForm.checkValueList[index].minCheckValue"
@change="judgeMinValue(arguments[0],item.minValue,item.maxValue,index)"></el-input>
<span v-if="dataForm.checkValueList[index].showIcon">
<!-- <i class="el-icon-success"></i> -->
<svg-icon v-if="dataForm.checkValueList[index].isStandard" icon-class="standards" />
<svg-icon v-if="dataForm.checkValueList[index].isMinStandard" icon-class="standards" />
<svg-icon v-else icon-class="noStandards" />
</span>
</el-form-item>
@@ -97,11 +97,11 @@
:rules="[{ required: true, message: '成分含量不能为空', trigger: 'blur' }]">
<el-input oninput="value=value.replace(/[^\d]/g,'')" :disabled="isdetail"
style="width: 90%;margin-right: 10px;" :max="item.maxValue" :min='item.minValue'
v-model.number="dataForm.checkValueList[index].checkValue"
@change="judgeValue(arguments[0],item.minValue,item.maxValue,index)"></el-input>
v-model.number="dataForm.checkValueList[index].maxCheckValue"
@change="judgeMaxValue(arguments[0],item.minValue,item.maxValue,index)"></el-input>
<span v-if="dataForm.checkValueList[index].showIcon">
<!-- <i class="el-icon-success"></i> -->
<svg-icon v-if="dataForm.checkValueList[index].isStandard" icon-class="standards" />
<svg-icon v-if="dataForm.checkValueList[index].isMaxStandard" icon-class="standards" />
<svg-icon v-else icon-class="noStandards" />
</span>
</el-form-item>
@@ -274,14 +274,25 @@ export default {
onInput() {
this.$forceUpdate();
},
judgeValue(val, minValue, maxValue, index) {
judgeMinValue(val, minValue, maxValue, index) {
// console.log(cal);
if (val >= minValue && val <= maxValue) {
console.log(val)
this.dataForm.checkValueList[index].showIcon = true
this.dataForm.checkValueList[index].isStandard = true
this.dataForm.checkValueList[index].isMinStandard = true
} else {
this.dataForm.checkValueList[index].showIcon = true
this.dataForm.checkValueList[index].isStandard = false
this.dataForm.checkValueList[index].isMinStandard = false
}
},
judgeMaxValue(val, minValue, maxValue, index) {
if (val >= minValue && val <= maxValue) {
console.log(val)
this.dataForm.checkValueList[index].showIcon = true
this.dataForm.checkValueList[index].isMaxStandard = true
} else {
this.dataForm.checkValueList[index].showIcon = true
this.dataForm.checkValueList[index].isMaxStandard = false
}
},
handleClose() {
@@ -304,7 +315,7 @@ export default {
checkerId: this.dataForm.checkerId,
checkTime: this.dataForm.checkTime,
appearance: this.dataForm.appearance,
checkResult: this.dataForm.checkResult,
// checkResult: this.dataForm.checkResult,
materialGrade: this.dataForm.materialGrade,
// checkValueList: [],
checkResult: this.dataForm.checkResult,
@@ -349,7 +360,7 @@ export default {
checkResult: this.dataForm.checkResult,
materialGrade: this.dataForm.materialGrade,
// checkValueList: [],
checkResult: this.dataForm.checkResult,
// checkResult: this.dataForm.checkResult,
materialGrade: this.dataForm.materialGrade,
remark:this.dataForm.remark
}
@@ -357,13 +368,15 @@ export default {
// this.idAttrShow = true;
let array = []
this.dataForm.checkValueList.forEach(ele => {
array.push(this.createDet({
mainId: response.data,
checkDetId: ele.checkDetId,
minCheckValue: ele.minCheckValue,
maxCheckValue: ele.maxCheckValue
array.push(this.createDet([
{
mainId: response.data,
checkDetId: ele.checkDetId,
minCheckValue: ele.minCheckValue,
maxCheckValue: ele.maxCheckValue
}))
}
]))
})
Promise.all(array).then(res => {
this.$modal.msgSuccess("新增成功");
@@ -394,15 +407,17 @@ export default {
getMaterialCheckList({
materialId:val
}).then((res) => {
console.log('aaaaaaaa', res.data);
this.ingredientList = res.data
this.ingredientFlag = true
this.dataForm.checkValueList = res.data.map((ele) => {
return {
mainId: null,
checkDetId: ele.id,
minCheckValue:null,
maxCheckValue: null,
isStandard: true,
checkDetId: ele.checkDetId,
minCheckValue:undefined,
maxCheckValue: undefined,
isMinStandard: true,
isMaxStandard: true,
showIcon:false,
}
})
@@ -496,28 +511,31 @@ export default {
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data
getMaterialCheckList({
materialId: response.data.materialId
materialId: response.data.materialId,
mainId:id,
}).then((res) => {
console.log(res.data);
let arr = res.data
valueList = arr.map((ele) => {
// console.log(ele)
return {
checkDetId:ele.id,
checkDetId: ele.checkDetId,
maxValue: ele.maxValue,
minValue: ele.minValue
}
})
console.log(valueList);
getQualityHotMaterialDetList({
mainId: response.data.id
mainId: response.data.id,
materialId: response.data.materialId,
}).then((result) => {
this.ingredientList = result.data.map((ele) => {
return {
name: ele.checkName,
checkName: ele.checkName,
id: ele.id,
checkDetId: ele.checkDetId,
checkValue: ele.checkValue,
minCheckValue: ele.minCheckValue,
maxCheckValue: ele.maxCheckValue,
maxValue:null,
minValue: null
}
@@ -528,8 +546,10 @@ export default {
mainId: ele.mainId,
id: ele.id,
checkDetId: ele.checkDetId,
checkValue: ele.checkValue,
isStandard: true,
minCheckValue: ele.minCheckValue,
maxCheckValue: ele.maxCheckValue,
isMinStandard: true,
isMaxStandard: true,
showIcon: false,
}
})
@@ -543,13 +563,21 @@ export default {
})
valueList.forEach((ele, index) => {
this.dataForm.checkValueList.forEach((item, i) => {
if (ele.checkDetId == item.checkDetId && item.checkValue >= ele.minValue && item.checkValue <= ele.maxValue) {
if (ele.checkDetId == item.checkDetId && item.minCheckValue >= ele.minValue && item.minCheckValue <= ele.maxValue) {
console.log(1111)
item.showIcon = true
item.isStandard = true
item.isMinStandard = true
} else {
item.showIcon = true
item.isStandard = false
item.isMinStandard = false
}
if (ele.checkDetId == item.checkDetId && item.maxCheckValue >= ele.minValue && item.maxCheckValue <= ele.maxValue) {
console.log(1111)
item.showIcon = true
item.isMaxStandard = true
} else {
item.showIcon = true
item.isMaxStandard = false
}
})
})