增加铲车下一步隐藏功能,跳转按钮大小,修改不显示kg

This commit is contained in:
liuwu 2024-03-21 16:03:28 +08:00
parent aa9dd0e56f
commit 6448cf693a
3 changed files with 48 additions and 48 deletions

View File

@ -2,7 +2,7 @@
<scroll-view class="main"> <scroll-view class="main">
<view class="header"> <view class="header">
<button type="button" class="header_btn1" @click="handleBackMain">返回</button> <button type="button" class="header_btn1" @click="handleBackMain">返回</button>
<text class="label_s">{{carName}}</text> <text class="label_s" @click="setOpt">{{carName}}</text>
<text class="label_s">{{batch}}{{train}}{{total}}</text> <text class="label_s">{{batch}}{{train}}{{total}}</text>
<text class="label_s" @click="rescan">{{state}}</text> <text class="label_s" @click="rescan">{{state}}</text>
<button class="header_btnt" @click="bleChange">{bleName}</button> <button class="header_btnt" @click="bleChange">{bleName}</button>
@ -49,24 +49,13 @@
<text class="label">计划:{{plan}}kg,已装:{{feed}}kg</text> <text class="label">计划:{{plan}}kg,已装:{{feed}}kg</text>
</view> </view>
<view class="item"> <view class="item">
<view v-for="(item,index) in carArr"> <button class="car_btnt" v-for="(item,index) in carArr" :style="{backgroundColor:item.sbId === sbId?'#407ae6':'#ffffff'}" @click="carChange(item)">{{item.name}}</button>
<button class="car_btnt" :style="{backgroundColor:item.sbId === sbId?'#407ae6':'#ffffff'}" @click="carChange(item)">{{item.name}}</button>
</view>
</view> </view>
<view class="item"> <view class="item" v-show="showOpt">
<button class="next_btn_text" @click="nextFeed">下一步</button> <button class="next_btn_text" @click="nextFeed">下一步</button>
<!-- <text class="next_btn_text" @click="nextFeed">下一步</text> -->
</view> </view>
</view> </view>
</view> </view>
<!-- <view class="item">
<view class="circle">
<text class="text">车内总重</text>
<text class="text">{{nowWeight}}kg</text>
</view>
</view> -->
</view> </view>
</scroll-view> </scroll-view>
</template> </template>
@ -83,6 +72,7 @@ export default {
return { return {
_feed: '0', _feed: '0',
showItems:false, showItems:false,
showOpt:false,
total: '', total: '',
bleName: '请选择蓝牙', bleName: '请选择蓝牙',
state: '未连接', state: '未连接',
@ -146,6 +136,9 @@ export default {
handleBackMain() { handleBackMain() {
api.closeWin(); api.closeWin();
}, },
setOpt(){
this.data.showOpt = !this.data.showOpt;
},
rescan(){ rescan(){
const that = this; const that = this;
api.confirm({ api.confirm({
@ -210,7 +203,8 @@ export default {
const that = this; const that = this;
var sbIdHex = that.decimalToHex(that.data.sbId).replace(' ', ''); var sbIdHex = that.decimalToHex(that.data.sbId).replace(' ', '');
sbIdHex = sbIdHex.length < 4 ? '00' + sbIdHex : sbIdHex; sbIdHex = sbIdHex.length < 4 ? '00' + sbIdHex : sbIdHex;
var msg = 'FF0A0002' + sbIdHex var feedIndex = that.decimalToHex(that.data.feedIndex).replace(' ', '');
var msg = 'FF0A0003' + sbIdHex + feedIndex
let param = { let param = {
peripheralUUID: this.data.peripheralUUID, peripheralUUID: this.data.peripheralUUID,
serviceUUID: this.data.serviceUUID, serviceUUID: this.data.serviceUUID,
@ -239,6 +233,7 @@ export default {
carChange(item) { carChange(item) {
this.data.sbId = item.sbId; this.data.sbId = item.sbId;
this.data.carName = item.name; this.data.carName = item.name;
this.data.showOpt = false;
this.resetData() this.resetData()
}, },
resetData(){ resetData(){
@ -293,7 +288,7 @@ export default {
}) })
}) })
}, 3000); }, 5000);
}) })
}) })
}, },
@ -342,8 +337,10 @@ export default {
return false return false
} }
that.data.showItems = true; that.data.showItems = true;
that.data.nowWeight = parseInt(res.substr(8, 4), 16) var nowW = parseInt(res.substr(8, 4), 16);
that.data.beforeWeight = parseInt(res.substr(12, 4), 16) var befW = parseInt(res.substr(12, 4), 16)
that.data.nowWeight = nowW>32578?nowW-65536:nowW;
that.data.beforeWeight = befW>32578?befW-65536:befW;
that.data.feed = that.data.nowWeight - that.data.beforeWeight that.data.feed = that.data.nowWeight - that.data.beforeWeight
var _feed = that.data.plan - that.data.feed; var _feed = that.data.plan - that.data.feed;
that.data._feed = _feed > 0 ? '少' + Math.abs(_feed) : '多' + Math.abs(_feed); that.data._feed = _feed > 0 ? '少' + Math.abs(_feed) : '多' + Math.abs(_feed);
@ -461,14 +458,14 @@ export default {
border-radius: 10px; border-radius: 10px;
} }
.car_btnt { .car_btnt {
margin: 5px; margin-bottom: 10px;
/* background-color: #407ae6; */ /* background-color: #407ae6; */
width: 100%; width: 100%;
color: #000000; color: #000000;
font-size: 20px; font-size: 30px;
height: 50px; height: 60px;
font-weight: 900; font-weight: 900;
border-radius: 10px; border-radius: 20px;
} }
.header_btn1 { .header_btn1 {
background-color: #e60d0d; background-color: #e60d0d;
@ -524,7 +521,7 @@ export default {
margin-top: 40px; margin-top: 40px;
color: #ffffff; color: #ffffff;
background-color: #407ae6; background-color: #407ae6;
font-size: 70px; font-size: 60px;
font-weight: 900; font-weight: 900;
border-radius: 20%; border-radius: 20%;
} }
@ -535,12 +532,12 @@ export default {
border-radius: 10px; border-radius: 10px;
} }
.label_x { .label_x {
font-size: 100px; font-size: 90px;
font-weight: 900; font-weight: 900;
border-radius: 10px; border-radius: 10px;
} }
.label { .label {
font-size: 60px; font-size: 50px;
font-weight: 900; font-weight: 900;
border-radius: 10px; border-radius: 10px;
} }

View File

@ -363,7 +363,7 @@ function discoverService(param) {
serviceUUID: ret4, serviceUUID: ret4,
characteristicUUID: ret5 characteristicUUID: ret5
}, function (ret6) { }, function (ret6) {
if (ret6 !== undefined&& ret6 !='') { if (ret6 !== undefined && ret6 !=='') {
if (isNaN(ret6)) { if (isNaN(ret6)) {
return false return false
} }
@ -619,11 +619,11 @@ function setNotify(param, callback) {
res = Math.round(Number(StringToNum(wei))); res = Math.round(Number(StringToNum(wei)));
} }
// 发送实时重量和校准重量到其他平板 // 发送实时重量和校准重量到其他平板
if(weiNum >= shujubao && res && sbId && beforeWeight){ if(weiNum >= shujubao && undefined !== res && sbId && undefined !== beforeWeight){
weiNum = 0; weiNum = 0;
var weiHex = decimalToHex(res).replace(' ',''); var weiHex = decimalToHex(res>0?res:res+65536).replace(' ','');
var sbIdHex = decimalToHex(sbId).replace(' ',''); var sbIdHex = decimalToHex(sbId).replace(' ','');
var beforeHex = decimalToHex(beforeWeight).replace(' ',''); var beforeHex = decimalToHex(beforeWeight>0?beforeWeight:beforeWeight+65536).replace(' ','');
var banciHex = decimalToHex(classCode).replace(' ',''); var banciHex = decimalToHex(classCode).replace(' ','');
var checiHex = decimalToHex(trainNumber).replace(' ',''); var checiHex = decimalToHex(trainNumber).replace(' ','');
var feedInexHex = decimalToHex(feedIndex).replace(' ',''); var feedInexHex = decimalToHex(feedIndex).replace(' ','');
@ -633,6 +633,7 @@ function setNotify(param, callback) {
if(feedStatus){ if(feedStatus){
var bleStr = 'FF0A0009'+weiHex+beforeHex+sbIdHex+banciHex+checiHex+feedInexHex; var bleStr = 'FF0A0009'+weiHex+beforeHex+sbIdHex+banciHex+checiHex+feedInexHex;
// msgList.push(bleStr); // msgList.push(bleStr);
// console.log(bleStr)
execute(db, "INSERT INTO t_ble_msg (id,text) VALUES ("+new Date().getTime()+",'"+bleStr+"');", function (ret, err) {}) execute(db, "INSERT INTO t_ble_msg (id,text) VALUES ("+new Date().getTime()+",'"+bleStr+"');", function (ret, err) {})
} }
@ -641,8 +642,9 @@ function setNotify(param, callback) {
// 接收其他平板发来的校准重量和实时重量 // 接收其他平板发来的校准重量和实时重量
if (feedStatus && ret && value.startsWith("ff0a") && sbId === parseInt(value.substr(8, 4),16)){ if (feedStatus && ret && value.startsWith("ff0a") && sbId === parseInt(value.substr(8, 4),16)){
var sbId_now = parseInt(value.substr(8, 4),16); var sbId_now = parseInt(value.substr(8, 4),16);
var feedIdx = parseInt(value.substr(12, 2),16);
console.log(sbId) console.log(sbId)
if(sbId != sbId_now){ if(sbId !== sbId_now || feedIndex !== feedIdx || !load){
return false return false
} }
weightDataFilter.dataBuffer = [] weightDataFilter.dataBuffer = []
@ -742,7 +744,8 @@ function getMess(param, callback) {
} }
param1.msg = newmsg + '饲喂完成'; param1.msg = newmsg + '饲喂完成';
}else{ }else{
param1.msg = newmsg + Math.abs(Number(_planSum - _feedNum)).toFixed(0) + 'kg'; // param1.msg = newmsg + Math.abs(Number(_planSum - _feedNum)).toFixed(0) + 'kg';
param1.msg = newmsg + Math.abs(Number(_planSum - _feedNum)).toFixed(0);
} }
// param1.msg = newmsg + Math.abs(Number(param.value)).toFixed(0) + 'kg' // param1.msg = newmsg + Math.abs(Number(param.value)).toFixed(0) + 'kg'
// console.log(param1.msg) // console.log(param1.msg)

View File

@ -1,6 +1,6 @@
var Util = { var Util = {
appOpen:function(){ appOpen:function(){
var phoneInfoMore = api.require('phoneInfoMore'); // var phoneInfoMore = api.require('phoneInfoMore');
var data1 = { var data1 = {
appDeviceid: api.deviceId, appDeviceid: api.deviceId,
appId: api.appId, appId: api.appId,
@ -19,21 +19,21 @@ var Util = {
screenheight: api.screenHeight, screenheight: api.screenHeight,
sourceCow: api.getPrefs({ sync: true, key: 'sourceCow' }), sourceCow: api.getPrefs({ sync: true, key: 'sourceCow' }),
} }
if(api.systemVersion<=10){ // if(api.systemVersion<=10){
phoneInfoMore.getBaseInfo(function(ret, err) { // phoneInfoMore.getBaseInfo(function(ret, err) {
if(ret){ // if(ret){
api.setGlobalData({ key: 'imei', value: ret.imei }); // api.setGlobalData({ key: 'imei', value: ret.imei });
data1.imei = ret.imei // data1.imei = ret.imei
POST('appOpen', data1, {}).then(ret => { // POST('appOpen', data1, {}).then(ret => {
// console.log(JSON.stringify(ret)); // // console.log(JSON.stringify(ret));
}).catch(err => { // }).catch(err => {
api.toast({ // api.toast({
msg: JSON.stringify(err) // msg: JSON.stringify(err)
}) // })
}) // })
} // }
}); // });
}else{ // }else{
data1.imei = api.deviceId data1.imei = api.deviceId
POST('appOpen', data1, {}).then(ret => { POST('appOpen', data1, {}).then(ret => {
// console.log(JSON.stringify(ret)); // console.log(JSON.stringify(ret));
@ -42,7 +42,7 @@ var Util = {
msg: JSON.stringify(err) msg: JSON.stringify(err)
}) })
}) })
} // }
}, },
getDateStr:function(date){ getDateStr:function(date){