初始提交
This commit is contained in:
335
pages/cottonCandy/ParameterSet.vue
Normal file
335
pages/cottonCandy/ParameterSet.vue
Normal file
@@ -0,0 +1,335 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="propertyBox1" scroll-y="true">
|
||||
<text>糖头实时温度:</text>
|
||||
<text class="f">{{ readSugarHeadTemperature }}</text>
|
||||
<text class="f">糖头手动设定-温度:</text>
|
||||
<text class="f">{{ readSetManualTemperature }}</text>
|
||||
<input class="f" v-model="sendSetManualTemperature" value= "sendSetManualTemperature" placeholder="糖头手动设定温度" />
|
||||
</view>
|
||||
<view class="propertyBox1" scroll-y="true">
|
||||
<text>机柜内湿度:</text>
|
||||
<text class="f1">{{ readCabinetHumidity }}</text>
|
||||
<text class="f1">糖头工作-温度:</text>
|
||||
<text class="f1">{{ readSugarHeadWorkingTemperature }}</text>
|
||||
<input class="f" v-model="sendSugarHeadWorkingTemperature" value="sendSugarHeadWorkingTemperature" placeholder="糖头工作温度" />
|
||||
</view>
|
||||
<view class="propertyBox1" scroll-y="true">
|
||||
<text>机柜内温度:</text>
|
||||
<text class="f1">{{ readCabinetTemperature }}</text>
|
||||
<text class="f1">糖头等待-温度:</text>
|
||||
<text class="f1">{{ readSugarHeadWaitingTemperature }}</text>
|
||||
<input class="f" v-model="sendSugarHeadWaitingTemperature" value="sendSugarHeadWaitingTemperature" placeholder="糖头等待温度" />
|
||||
</view>
|
||||
<view class="propertyBox1" scroll-y="true">
|
||||
<text>喷水时长:</text>
|
||||
<text class="f">{{ readWaterSprayingDuration }}</text>
|
||||
<input class="f" v-model="sendWaterSprayingDuration" value="sendWaterSprayingDuration" placeholder="喷水时长" />
|
||||
<text class="f">吹风时长:</text>
|
||||
<text class="f">{{ readBlowingDuration }}</text>
|
||||
<input class="f1" v-model="sendBlowingDuration" value="sendBlowingDuration" placeholder="吹风时长" />
|
||||
</view>
|
||||
<view class="propertyBox1" scroll-y="true">
|
||||
<text>设定-湿度:</text>
|
||||
<text class="f2">{{ readSetHumidity }}</text>
|
||||
<!-- <input class="f" @input="SetHumidity" placeholder="设置湿度" /> -->
|
||||
<input class="f" v-model="sendSetHumidity" value="sendSetHumidity" placeholder="设置湿度" />
|
||||
</view>
|
||||
|
||||
<view class="for-text" v-for="(item,name,index) in 6" :key="index">
|
||||
<view>
|
||||
<text class="font-Interval">{{index+1}}次出糖量:</text><text
|
||||
class="text-color">{{ readtrSugarYield[index] }}</text>
|
||||
<text class="font-Interval">{{index+1}}-{{index+2}}间隔:</text><text
|
||||
class="text-color">{{ readtrInterval[index] }}</text>
|
||||
<text class="font-Interval">{{index+1}}次吹风:</text><text
|
||||
class="text-color">{{ readtrBlow[index] }}</text>
|
||||
</view>
|
||||
<view class="propertyBox">
|
||||
<input type="type" v-model="sendStrSugarYield[index]" value="Send[index]" />
|
||||
<input type="type" v-model="sendInterval[index]" value="Send[index]" />
|
||||
<input type="type" v-model="sendBlow[index]" value="Send[index]" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<button type="primary" class="button" @click="Index()" size="mini">首页</button>
|
||||
<button type="primary" class="button1" @touchstart="RobotArmImport()" @touchend="RobotArmImportRelease()"
|
||||
size="mini">机械臂参数一键写入</button>
|
||||
<button type="primary" class="button" @touchstart="HumidificationPress()" @touchend="HumidificationRelease()"
|
||||
size="mini">加湿</button>
|
||||
<button type="primary" class="button2" @touchstart="ReadParameters ()" @touchend="ReadParametersRelease()"
|
||||
size="mini">读取数据</button>
|
||||
<view>
|
||||
<button type="primary" class="button" @click="Download()" size="mini">下载</button>
|
||||
<button type="primary" class="button" @click="Upload()" size="mini">上传</button>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
var _self;
|
||||
import process from '@/utils/process.js';
|
||||
const db = uniCloud.database();
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
readCabinetTemperature: '', //机柜温度
|
||||
readCabinetHumidity: '', //机柜湿度
|
||||
readSugarHeadTemperature: '', //糖头温度
|
||||
|
||||
readSetHumidity: '', //设定湿度
|
||||
readSetManualTemperature: '', //糖头手动设定温度
|
||||
readSugarHeadWorkingTemperature: '', //糖头工作温度
|
||||
readSugarHeadWaitingTemperature: '', //糖头等待温度
|
||||
readWaterSprayingDuration: '', //喷水时长
|
||||
readBlowingDuration: '', //吹风时长
|
||||
readtrSugarYield: [], //出糖量
|
||||
readtrInterval: [], //间隔
|
||||
readtrBlow: [], //吹风
|
||||
readWriteParameter: '', //写参数使能
|
||||
|
||||
sendxyzr : [],
|
||||
sendSetHumidity: '', //设定湿度
|
||||
sendSetManualTemperature:'', // 糖头手动设定-温度
|
||||
sendSugarHeadWorkingTemperature:'', //糖头工作温度
|
||||
sendSugarHeadWaitingTemperature: '', //糖头等待温度
|
||||
sendWaterSprayingDuration: '', //喷水时长
|
||||
sendBlowingDuration: '', //吹风时长
|
||||
sendStrSugarYield: [], //发送出糖量
|
||||
sendInterval: [], //发送间隔
|
||||
sendBlow: [] , //发送吹风
|
||||
timer:null, //定时器刷新数据
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
// getApp().globalData.pageState = getApp().globalData.pageState + 1;
|
||||
//手动刷新数据
|
||||
process.bushu = 0;
|
||||
for (let cnti = 0; cnti < 6; cnti++) { //把输入的数组里的xyzr轴坐标 发送到全局变量
|
||||
this.sendStrSugarYield[cnti] = process.glbStrSendData_FFCC.sendStrSugarYield[cnti]
|
||||
this.sendInterval[cnti] = process.glbStrSendData_FFCC.sendInterval[cnti]
|
||||
this.sendBlow[cnti] = process.glbStrSendData_FFCC.sendBlow[cnti]
|
||||
}
|
||||
this.sendSetHumidity = process.glbStrSendData_FFCC.sendSetHumidity //设置湿度输入
|
||||
this.sendSetManualTemperature = process.glbStrSendData_FFCC.sendSetManualTemperature //糖头手动设置温度输入
|
||||
this.sendSugarHeadWorkingTemperature = process.glbStrSendData_FFCC.sendSugarHeadWorkingTemperature //糖头工作温度输入
|
||||
this.sendSugarHeadWaitingTemperature = process.glbStrSendData_FFCC.sendSugarHeadWaitingTemperature //糖头等待温度输入
|
||||
this.sendWaterSprayingDuration = process.glbStrSendData_FFCC.sendWaterSprayingDuration //喷水时长输入
|
||||
this.sendBlowingDuration = process.glbStrSendData_FFCC.sendBlowingDuration //吹风时长输入
|
||||
this.timer = setInterval(() => {
|
||||
this.ReadData();
|
||||
this.InputCoordinate();
|
||||
}, 100);
|
||||
},
|
||||
onLoad() {
|
||||
_self = this;
|
||||
},
|
||||
onHide() {
|
||||
console.log('onHide');
|
||||
//关闭定时器
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
},
|
||||
methods: {
|
||||
//跳转到首页
|
||||
Index() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/cottonCandy/index'
|
||||
})
|
||||
},
|
||||
Download() {
|
||||
db.collection('DataSave').where('machine_id == "001"').get().then((res) => {
|
||||
const DownloadData = res.result.data[0]
|
||||
//从数据库下载的数据传个 输入框的数组xyzr轴坐标里
|
||||
for (let cnti = 0; cnti < 51 ; cnti++) { //xyzr轴坐标
|
||||
process.glbStrSendData_FFCC.sendAxis_x [cnti ] = DownloadData.SavteData.sendAxis_x[cnti]
|
||||
process.glbStrSendData_FFCC.sendAxis_y [cnti ] = DownloadData.SavteData.sendAxis_y[cnti]
|
||||
process.glbStrSendData_FFCC.sendAxis_z [cnti ] = DownloadData.SavteData.sendAxis_z[cnti]
|
||||
process.glbStrSendData_FFCC.sendAxis_r [cnti ] = DownloadData.SavteData.sendAxis_r[cnti]
|
||||
}
|
||||
_self.sendSetHumidity = DownloadData.SavteData.sendSetHumidity //设置湿度输入
|
||||
_self.sendSetManualTemperature = DownloadData.SavteData.sendSetManualTemperature //糖头手动设置温度输入
|
||||
_self.sendSugarHeadWorkingTemperature = DownloadData.SavteData.sendSugarHeadWorkingTemperature //糖头工作温度输入
|
||||
_self.sendSugarHeadWaitingTemperature = DownloadData.SavteData.sendSugarHeadWaitingTemperature //糖头等待温度输入
|
||||
_self.sendWaterSprayingDuration = DownloadData.SavteData.sendWaterSprayingDuration //喷水时长
|
||||
_self.sendBlowingDuration = DownloadData.SavteData.sendBlowingDuration //吹风时长
|
||||
for (let cntj = 0; cntj < 6; cntj++) {
|
||||
_self.sendStrSugarYield[cntj] = DownloadData.SavteData.sendStrSugarYield[cntj] //出糖量
|
||||
_self.sendInterval[cntj] = DownloadData.SavteData.sendInterval[cntj] //间隔
|
||||
_self.sendBlow[cntj] = DownloadData.SavteData.sendBlow[cntj] //吹风
|
||||
}
|
||||
uni.showToast({
|
||||
title: '下载成功'
|
||||
})
|
||||
}).catch((err) =>{
|
||||
uni.showToast({
|
||||
title: '下载失败'
|
||||
})
|
||||
console.error(err);
|
||||
})
|
||||
|
||||
},
|
||||
Upload() {
|
||||
const db = uniCloud.database()
|
||||
let a = process.recData1.recMachine_id.join('')
|
||||
//上传之前应该检查数据里有没有id 有就删除id
|
||||
// db.collection("DataSave").where('machine_id == "001"').remove()
|
||||
// .then((res) => {
|
||||
// // uni.showToast({
|
||||
// // title: '删除成功'
|
||||
// // })
|
||||
// // console.log("删除条数: ",res.deleted);
|
||||
// })
|
||||
db.collection('DataSave').where("machine_id == '001'").update({
|
||||
SavteData: process.glbStrSendData_FFCC
|
||||
})
|
||||
//云数据库库添加数据
|
||||
db.collection("DataSave").add({
|
||||
chine_id : a,
|
||||
machine_id: "001", //id
|
||||
SavteData: process.glbStrSendData_FFCC //坐标数据
|
||||
}).then((res) => { // res 为数据库查询结果
|
||||
uni.showToast({
|
||||
title: '上传成功'
|
||||
})
|
||||
console.log(res)
|
||||
}).catch((err) =>{
|
||||
uni.showToast({
|
||||
title: '上传失败'
|
||||
})
|
||||
console.error(err);
|
||||
})
|
||||
},
|
||||
RobotArmImport() {
|
||||
process.glbStrSendData_FFCC.sendWriteParameter = 0x01; //机械臂参数写入按下
|
||||
},
|
||||
RobotArmImportRelease() {
|
||||
process.glbStrSendData_FFCC.sendWriteParameter = 0x00; //机械臂参数写入松开
|
||||
},
|
||||
ReadParameters() {
|
||||
process.ReadConfiguration[0] = 0x01; //读取配置参数使能按下
|
||||
},
|
||||
ReadParametersRelease() {
|
||||
process.ReadConfiguration[0] = 0x00; //读取配置参数使能松开
|
||||
},
|
||||
HumidificationPress() {
|
||||
process.glbFFBB_Byte07.Humidification = 0x01 //加湿按下
|
||||
},
|
||||
HumidificationRelease() {
|
||||
process.glbFFBB_Byte07.Humidification = 0x00 //加湿松开
|
||||
},
|
||||
//把接收到的数据传到页面中显示
|
||||
ReadData() {
|
||||
_self.readtrSugarYield = [0]; //显示数据数组赋值
|
||||
_self.readCabinetTemperature = process.recData1.recTemperature //机柜温度
|
||||
_self.readCabinetHumidity = process.recData1.recHumidity //机柜湿度
|
||||
_self.readSugarHeadTemperature = process.recData1.recSugarHead //糖头温度
|
||||
_self.readSetHumidity = process.recData.recSetHumidity //设定湿度
|
||||
_self.readSetManualTemperature = process.recData.recSetManualTemperature //糖头手动设定
|
||||
_self.readSugarHeadWorkingTemperature = process.recData.recSugarHeadWorkingTemperature //糖头工作温度
|
||||
_self.readSugarHeadWaitingTemperature = process.recData.recSugarHeadWaitingTemperature //糖头等待温度
|
||||
_self.readWaterSprayingDuration = process.recData.recWaterSprayingDuration //喷水时长
|
||||
_self.readBlowingDuration = process.recData.recBlowingDuration //吹风时长
|
||||
for (let cnti = 0; cnti < 6; cnti++) {
|
||||
_self.readtrSugarYield[cnti] = process.recData.recStrSugarYield[cnti] //出糖量
|
||||
_self.readtrInterval[cnti] = process.recData.recInterval[cnti] //间隔
|
||||
_self.readtrBlow[cnti] = process.recData.recBlow[cnti] //吹风
|
||||
}
|
||||
},
|
||||
InputCoordinate() {
|
||||
//用for循环 把输入框中的数存在数组中发送
|
||||
for (let cnti = 0; cnti < 6; cnti++) { //把输入的数组里的xyzr轴坐标 发送到全局变量
|
||||
process.glbStrSendData_FFCC.sendStrSugarYield[cnti] = (_self.sendStrSugarYield[cnti]);
|
||||
process.glbStrSendData_FFCC.sendInterval[cnti] = (_self.sendInterval[cnti])
|
||||
process.glbStrSendData_FFCC.sendBlow[cnti] = (_self.sendBlow[cnti])
|
||||
}
|
||||
process.glbStrSendData_FFCC.sendSetHumidity = (_self.sendSetHumidity) //设置湿度输入
|
||||
process.glbStrSendData_FFCC.sendSetManualTemperature = (_self.sendSetManualTemperature) //糖头手动设置温度输入
|
||||
process.glbStrSendData_FFCC.sendSugarHeadWorkingTemperature = (_self.sendSugarHeadWorkingTemperature) //糖头工作温度输入
|
||||
process.glbStrSendData_FFCC.sendSugarHeadWaitingTemperature = (_self.sendSugarHeadWaitingTemperature) //糖头等待温度输入
|
||||
process.glbStrSendData_FFCC.sendWaterSprayingDuration =( _self.sendWaterSprayingDuration) //喷水时长输入
|
||||
process.glbStrSendData_FFCC.sendBlowingDuration = (_self.sendBlowingDuration) //吹风时长输入
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.button {
|
||||
height: 60rpx;
|
||||
width: 200rpx;
|
||||
margin-top: 30rpx;
|
||||
margin-left: 20rpx;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.button1 {
|
||||
height: 60rpx;
|
||||
width: 240rpx;
|
||||
margin-top: 30rpx;
|
||||
margin-left: 20rpx;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.button2 {
|
||||
height: 60rpx;
|
||||
width: 240rpx;
|
||||
margin-top: 30rpx;
|
||||
margin-left: 240rpx;
|
||||
border-radius: 10px
|
||||
}
|
||||
|
||||
.propertyBox1 {
|
||||
margin-top: 5rpx;
|
||||
flex-flow: row;
|
||||
justify-content: left;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.propertyBox1 input {
|
||||
border: 1rpx solid black;
|
||||
width: 100rpx;
|
||||
}
|
||||
|
||||
.f {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.f1 {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.f2 {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.for-text {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.propertyBox {
|
||||
margin-top: 5rpx;
|
||||
flex-flow: row;
|
||||
justify-content: space-evenly;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.propertyBox input {
|
||||
border: 1rpx solid black;
|
||||
width: 180rpx;
|
||||
}
|
||||
|
||||
.text-color {
|
||||
margin-left: 5rpx;
|
||||
border: 3rpx solid dodgerblue;
|
||||
}
|
||||
|
||||
.font-Interval {
|
||||
margin-left: 80rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user