fix:设备数据采集模拟

This commit is contained in:
shijing 2025-02-26 15:06:17 +08:00
parent 40bcad0275
commit db431e7379
2 changed files with 37 additions and 1 deletions

View File

@ -336,6 +336,7 @@
</el-drawer>
</template>
<script>
import mockData from "./mock.json";
export default {
props: {
mlogb: {
@ -387,6 +388,7 @@ export default {
form: {
test_user:"",
equipment:"",
cd_req_addr:"",//
equipment_name:"",
testitemids : [],
defectids : [],
@ -744,6 +746,7 @@ export default {
that.equipmentOptions.forEach(item => {
if(item.id == that.form.equipment){
that.form.equipment_name = item.name;
that.form.cd_req_addr=item.cd_req_addr;
}
});
},
@ -861,8 +864,34 @@ export default {
let obj = Object.assign({},item);
obj.isEdit = true;
that.mlogbwlist.splice(index,1);
that.mlogbwlist.unshift(obj);
that.wprInputText = "";
console.log('that.setForm',that.setForm);
if(that.setForm.cd_req_addr!==null){
//cd_req_addr,
console.log('that.setForm.cd_req_addr',that.setForm.cd_req_addr);
let res = mockData[0];
console.log('mockres',res);
// that.$API.system.eq_info_get.req({}).then((res) => {
//res:{x:2.5,y:3.5,z:5.0}
let x = res.x;
let y = res.y;
let z = res.z;
//cd_expr
that.qct_testitems.forEach(item0 => {
let str = "x>y?x:y"
obj[item0.testitem_name] = eval(str);
// if(item0.cd_expr!=null){
// //cd_expr:"x>y?x:y"
// obj[item0.testitem_name] = eval(item0.cd_expr);
// }
})
that.mlogbwlist.unshift(obj);
// }).catch((err) => {
// return err;
// });
}else{
that.mlogbwlist.unshift(obj);
}
}
})
},

View File

@ -0,0 +1,7 @@
[
{
"x":2.5,
"y":3.5,
"z":5.0
}
]