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