fix:设备数据采集模拟
This commit is contained in:
parent
40bcad0275
commit
db431e7379
|
@ -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);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
[
|
||||
{
|
||||
"x":2.5,
|
||||
"y":3.5,
|
||||
"z":5.0
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue