修改按钮逻辑
This commit is contained in:
parent
30fe13dac2
commit
bb3e6c69fe
@ -188,22 +188,16 @@
|
||||
<!--暂停打印 退出打印-->
|
||||
<view class="device_operation_warp">
|
||||
<view class="device_operation_btn" @click="operationData('PAUSE')" :style="{
|
||||
backgroundColor:
|
||||
deviceDetail.status === 1 ||
|
||||
deviceDetail.status === 2 ||
|
||||
printInfo.status === 6
|
||||
backgroundColor:printInfo.status !== 6 && deviceDetail.status !==0
|
||||
? '#ffffff'
|
||||
: '#cccccc',
|
||||
}">
|
||||
<image class="operation_btn_icon" src="https://online.totustec.com/upload/deviceManage/print_status1.png">
|
||||
</image>
|
||||
<view class="operation_btn_txt"
|
||||
:style="{
|
||||
<view class="operation_btn_txt" :style="{
|
||||
color:
|
||||
deviceDetail.status === 1 ||
|
||||
deviceDetail.status === 2 ||
|
||||
printInfo.status === 6
|
||||
?'#333333':'#ece8e8' ,
|
||||
printInfo.status !== 6 && deviceDetail.status !==0
|
||||
? '#333333':'#ece8e8',
|
||||
}"
|
||||
>暂停打印</view>
|
||||
</view>
|
||||
@ -216,9 +210,7 @@
|
||||
</image>
|
||||
<view class="operation_btn_txt"
|
||||
:style="{
|
||||
color:
|
||||
deviceDetail.status != -1
|
||||
?'#ece8e8': '#333333',
|
||||
color: deviceDetail.status != 0 && deviceDetail.status != -1 ?'#333333': '#ece8e8',
|
||||
}"
|
||||
>退出打印</view>
|
||||
</view>
|
||||
@ -558,6 +550,8 @@ export default {
|
||||
|
||||
operationData(type) {
|
||||
if (type == "PRINT") {
|
||||
// 检查设备状态
|
||||
if (this.deviceDetail.status == 0 && this.deviceDetail.status != -1) {
|
||||
// 检查设备名称是否为空
|
||||
if (!this.deviceName || this.deviceName.trim() === '') {
|
||||
uni.showToast({
|
||||
@ -567,8 +561,7 @@ export default {
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 检查设备状态
|
||||
if (this.deviceDetail.status == 0 && this.deviceDetail.status != -1) {
|
||||
|
||||
// 显示确认提示框
|
||||
uni.showModal({
|
||||
title: '确认打印',
|
||||
@ -586,28 +579,34 @@ export default {
|
||||
}
|
||||
if (type === "CONTINUE") {
|
||||
// 检查设备状态
|
||||
if (this.deviceDetail.status === 0) {
|
||||
uni.showToast({
|
||||
title: "当前设备空闲,禁止继续打印",
|
||||
icon: "none",
|
||||
duration: 1500
|
||||
});
|
||||
console.log("设备未就绪,禁止继续打印");
|
||||
if (this.deviceDetail.status === 0 || this.printInfo.status !== 6) {
|
||||
return;
|
||||
}
|
||||
if (this.printInfo.status !== 6) {
|
||||
uni.showToast({
|
||||
title: "当前设备未暂定,禁止继续打印",
|
||||
icon: "none",
|
||||
duration: 1500
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 显示确认提示框
|
||||
uni.showModal({
|
||||
title: '确认打印',
|
||||
content: '确定要继续执行打印吗?',
|
||||
confirmText: '确认执行',
|
||||
cancelText: '取消',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// 用户确认后执行打印
|
||||
this.sendWsCommand(type);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (type == 'PAUSE') {
|
||||
if ((this.deviceDetail.status == 1 || this.deviceDetail.status == 2 || this.printInfo.status == 3) && this.deviceDetail.status != -1) {
|
||||
|
||||
console.log(this.deviceDetail.status ===0)
|
||||
if (this.printInfo.status === 6 || this.deviceDetail.status ===0){
|
||||
// uni.showToast({
|
||||
// title: "当前设备已暂定,禁止操作",
|
||||
// icon: "none",
|
||||
// duration: 1500
|
||||
// });
|
||||
return;
|
||||
}
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要暂停打印吗?',
|
||||
@ -620,7 +619,6 @@ export default {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (type == 'EXIT') {
|
||||
if (this.deviceDetail.status != 0 && this.deviceDetail.status != -1) {
|
||||
uni.showModal({
|
||||
|
Loading…
Reference in New Issue
Block a user