修改设备详情
This commit is contained in:
parent
73536a9cc1
commit
164138577c
@ -4,3 +4,5 @@ export const BASE_API_URL = "https://online.totustec.com/api";
|
||||
|
||||
// 静态数据
|
||||
export const BASE_IMG_URL = "https://online.totustec.com/upload";
|
||||
|
||||
export const BASE_STOKECT_URL = "ws://online.totustec.com/webSocket/vue"
|
@ -5,7 +5,8 @@
|
||||
<view class="top_nav_warp">
|
||||
<view>设备管理</view>
|
||||
<view class="back_button_warp" @click="goBack()">
|
||||
<image class="back_button_icon" src="https://online.totustec.com/upload/minePage/mine_area_right.png"></image>
|
||||
<image class="back_button_icon"
|
||||
src="https://online.totustec.com/upload/minePage/mine_area_right.png"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -19,7 +20,8 @@
|
||||
@click="getVideoImg('video')">
|
||||
获取视频
|
||||
</view>
|
||||
<view class="select_device_item" :class="{ device_active: getType == 'img' }" @click="getVideoImg('img')">
|
||||
<view class="select_device_item" :class="{ device_active: getType == 'img' }"
|
||||
@click="getVideoImg('img')">
|
||||
获取图片</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -43,30 +45,13 @@
|
||||
|
||||
<!-- 设备状态 -->
|
||||
<view class="device_status_warp" v-if="deviceType == 1">
|
||||
<!-- 设备名称 -->
|
||||
<view class="device_status_item">
|
||||
<view class="device_status_item" v-for="(field, idx) in statusFields" :key="idx">
|
||||
<view class="statusItem_modal_warp">
|
||||
<view class="item_content_warp">
|
||||
<view class="item_content_left">设备名称</view>
|
||||
<view class="item_content_middel">{{
|
||||
deviceDetail.brand
|
||||
}}</view>
|
||||
</view>
|
||||
|
||||
<view class="itemContent_line_warp">
|
||||
<view class="item_content_model">
|
||||
<view class="item_content_line"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 打印状态 -->
|
||||
<view class="device_status_item">
|
||||
<view class="statusItem_modal_warp">
|
||||
<view class="item_content_warp">
|
||||
<view class="item_content_left">状态</view>
|
||||
<view class="item_content_left">{{ field.label }}</view>
|
||||
<view class="item_content_middel">
|
||||
<!-- 状态特殊处理 -->
|
||||
<template v-if="field.isStatus">
|
||||
<view class="label_warp" v-if="deviceDetail.status == 0">
|
||||
<view class="label_icon"></view>
|
||||
<view class="label_text">空闲</view>
|
||||
@ -87,73 +72,33 @@
|
||||
<view class="label_icon" style="background: #999999"></view>
|
||||
<view class="label_text" style="color: #999999">断开</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="itemContent_line_warp">
|
||||
<view class="item_content_model">
|
||||
<view class="item_content_line"> </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 子状态 -->
|
||||
<view class="device_status_item">
|
||||
<view class="statusItem_modal_warp">
|
||||
<view class="item_content_warp">
|
||||
<view class="item_content_left">子状态</view>
|
||||
<view class="item_content_middel">
|
||||
</template>
|
||||
<!-- 子状态特殊处理 -->
|
||||
<template v-else-if="field.isErrorStatus">
|
||||
<view class="label_warp2">
|
||||
<!-- 状态图标颜色映射 -->
|
||||
<view class="label_icon" :style="{
|
||||
background: getStatusColor(deviceDetail.errorStatus),
|
||||
}"></view>
|
||||
<!-- 状态文字条件渲染 -->
|
||||
<view class="label_text label_text2" :style="{
|
||||
color: getStatusColor(deviceDetail.errorStatus),
|
||||
}">
|
||||
<view class="label_icon"
|
||||
:style="{ background: getStatusColor(deviceDetail.errorStatus) }">
|
||||
</view>
|
||||
<view class="label_text label_text2"
|
||||
:style="{ color: getStatusColor(deviceDetail.errorStatus) }">
|
||||
{{ getStatusText(deviceDetail.errorStatus) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="itemContent_line_warp">
|
||||
<view class="item_content_model">
|
||||
<view class="item_content_line"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 当前时间 -->
|
||||
<view class="device_status_item">
|
||||
<view class="statusItem_modal_warp">
|
||||
<view class="item_content_warp">
|
||||
<view class="item_content_left">当前时间</view>
|
||||
<view class="item_content_middel">{{ getCurrentTime() }}</view>
|
||||
</view>
|
||||
|
||||
<view class="itemContent_line_warp">
|
||||
<view class="item_content_model">
|
||||
<view class="item_content_line"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 错误码 -->
|
||||
<view class="device_status_item">
|
||||
<view class="statusItem_modal_warp">
|
||||
<view class="item_content_warp">
|
||||
<view class="item_content_left">错误码</view>
|
||||
<view class="item_content_middel">
|
||||
<!-- {{deviceDetail.errorStatus}} -->
|
||||
</template>
|
||||
<!-- 错误码特殊处理 -->
|
||||
<template v-else-if="field.isErrorCode">
|
||||
{{ deviceDetail.errorStatus === -1 ? '断开' : deviceDetail.errorStatus }}
|
||||
</template>
|
||||
<!-- 当前时间特殊处理 -->
|
||||
<template v-else-if="field.isCurrentTime">
|
||||
{{ getCurrentTime() }}
|
||||
</template>
|
||||
<!-- 其他字段 -->
|
||||
<template v-else>
|
||||
{{ deviceDetail[field.key] }}
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="itemContent_line_warp">
|
||||
<view class="item_content_model">
|
||||
<view class="item_content_line"></view>
|
||||
@ -170,7 +115,8 @@
|
||||
<input class="deviceN_input" type="text" v-model="deviceName" />
|
||||
<view class="clear_deviceN_warp">
|
||||
<image class="clear_deviceN_icon" @click="deviceName = ''" v-if="deviceName"
|
||||
src="https://online.totustec.com/upload/deviceManage/clear_deviceN_icon.png"></image>
|
||||
src="https://online.totustec.com/upload/deviceManage/clear_deviceN_icon.png">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -182,7 +128,8 @@
|
||||
? '#ffffff'
|
||||
: '#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>
|
||||
<view class="operation_btn_txt">开始打印</view>
|
||||
</view>
|
||||
@ -195,7 +142,8 @@
|
||||
? '#ffffff'
|
||||
: '#cccccc',
|
||||
}">
|
||||
<image class="operation_btn_icon" src="https://online.totustec.com/upload/print_status1.png"></image>
|
||||
<image class="operation_btn_icon"
|
||||
src="https://online.totustec.com/upload/print_status1.png"></image>
|
||||
<view class="operation_btn_txt">继续打印</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -203,11 +151,12 @@
|
||||
<view class="device_operation_warp">
|
||||
<view class="device_operation_btn" @click="operationData('PAUSE')" :style="{
|
||||
backgroundColor:
|
||||
deviceDetail.status == 2 && deviceDetail.status != -1
|
||||
(deviceDetail.status == 1 || deviceDetail.status == 2) && deviceDetail.status != -1
|
||||
? '#ffffff'
|
||||
: '#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>
|
||||
<view class="operation_btn_txt">暂停打印</view>
|
||||
</view>
|
||||
@ -218,19 +167,22 @@
|
||||
? '#ffffff'
|
||||
: '#cccccc',
|
||||
}">
|
||||
<image class="operation_btn_icon" src="https://online.totustec.com/upload/print_status1.png"></image>
|
||||
<image class="operation_btn_icon"
|
||||
src="https://online.totustec.com/upload/print_status1.png"></image>
|
||||
<view class="operation_btn_txt">退出打印</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="device_operation_warp">
|
||||
<view class="device_operation_btn" @click="sendWsCommand('ALARM_CONTINUE')">
|
||||
<image class="operation_btn_icon" src="https://online.totustec.com/upload/deviceManage/print_status2.png">
|
||||
<image class="operation_btn_icon"
|
||||
src="https://online.totustec.com/upload/deviceManage/print_status2.png">
|
||||
</image>
|
||||
<view class="operation_btn_txt">报警继续</view>
|
||||
</view>
|
||||
<view class="device_operation_btn" @click="sendWsCommand('ALARM_EXIT')">
|
||||
<image class="operation_btn_icon" src="https://online.totustec.com/upload/deviceManage/print_status2.png">
|
||||
<image class="operation_btn_icon"
|
||||
src="https://online.totustec.com/upload/deviceManage/print_status2.png">
|
||||
</image>
|
||||
<view class="operation_btn_txt">报警退出</view>
|
||||
</view>
|
||||
@ -241,6 +193,9 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
BASE_STOKECT_URL
|
||||
} from "@/config.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -252,15 +207,93 @@ export default {
|
||||
deviceCode: "", // 存储接收到的设备编码
|
||||
deviceDetail: {}, // 存储设备详情数据
|
||||
statusMap: {
|
||||
0: { text: "正常", color: "#00d195" }, // 绿色
|
||||
1: { text: "文件校验失败", color: "#ff0000" }, // 红色
|
||||
2: { text: "设备或加密错误", color: "#ff0000" },
|
||||
3: { text: "打印准备过程出错", color: "#ff0000" }, // 橙色
|
||||
4: { text: "打印出错", color: "#ff0000" },
|
||||
5: { text: "加液失败", color: "#ff9800" },
|
||||
6: { text: "铲件失败", color: "#ff9800" },
|
||||
7: { text: "图片异物", color: "#ff0000" },
|
||||
0: {
|
||||
text: "正常",
|
||||
color: "#00d195"
|
||||
}, // 绿色
|
||||
1: {
|
||||
text: "文件校验失败",
|
||||
color: "#ff0000"
|
||||
}, // 红色
|
||||
2: {
|
||||
text: "设备或加密错误",
|
||||
color: "#ff0000"
|
||||
},
|
||||
3: {
|
||||
text: "打印准备过程出错",
|
||||
color: "#ff0000"
|
||||
}, // 橙色
|
||||
4: {
|
||||
text: "打印出错",
|
||||
color: "#ff0000"
|
||||
},
|
||||
5: {
|
||||
text: "加液失败",
|
||||
color: "#ff9800"
|
||||
},
|
||||
6: {
|
||||
text: "铲件失败",
|
||||
color: "#ff9800"
|
||||
},
|
||||
7: {
|
||||
text: "图片异物",
|
||||
color: "#ff0000"
|
||||
},
|
||||
},
|
||||
// 新增:设备状态字段配置
|
||||
statusFields: [{
|
||||
label: '设备名称',
|
||||
key: 'brand'
|
||||
},
|
||||
{
|
||||
label: '状态',
|
||||
key: 'status',
|
||||
isStatus: true
|
||||
},
|
||||
{
|
||||
label: '子状态',
|
||||
key: 'errorStatus',
|
||||
isErrorStatus: true
|
||||
},
|
||||
{
|
||||
label: '当前打印层数',
|
||||
key: 'currentLayer'
|
||||
},
|
||||
{
|
||||
label: '打印任务总层数',
|
||||
key: 'totalLayer'
|
||||
},
|
||||
{
|
||||
label: '已打印时间(s)',
|
||||
key: 'printedTime'
|
||||
},
|
||||
{
|
||||
label: '总打印时间(s)',
|
||||
key: 'totalTime'
|
||||
},
|
||||
{
|
||||
label: '打印文件名称',
|
||||
key: 'fileName'
|
||||
},
|
||||
{
|
||||
label: '错误码',
|
||||
key: 'errorStatus',
|
||||
isErrorCode: true
|
||||
},
|
||||
{
|
||||
label: '当前任务数量',
|
||||
key: 'Task'
|
||||
},
|
||||
{
|
||||
label: '总共任务数量',
|
||||
key: 'totalTask'
|
||||
},
|
||||
{
|
||||
label: '当前时间',
|
||||
key: 'currentTime',
|
||||
isCurrentTime: true
|
||||
}
|
||||
],
|
||||
|
||||
// WebSocket 相关状态
|
||||
socketTask: null, // uni-app 的 WebSocket 任务实例
|
||||
@ -294,7 +327,7 @@ export default {
|
||||
methods: {
|
||||
// ---------------------- WebSocket 核心方法 ----------------------
|
||||
connectWebSocket() {
|
||||
const wsUrl = "ws://online.totustec.com/webSocket/vue";
|
||||
const wsUrl = BASE_STOKECT_URL;
|
||||
|
||||
// 初始化 WebSocket 连接(使用 uni-app 接口)
|
||||
this.socketTask = uni.connectSocket({
|
||||
@ -349,7 +382,10 @@ export default {
|
||||
}
|
||||
// ERROR 抛出异常信息
|
||||
if (message.msgType == "ERROR") {
|
||||
uni.showToast({ title: message.msg, icon: "none" });
|
||||
uni.showToast({
|
||||
title: message.msg,
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
// INFO 返回视频/图片地址
|
||||
if (message.msgType == "INFO") {
|
||||
@ -422,15 +458,36 @@ export default {
|
||||
}
|
||||
}
|
||||
if (type == 'PAUSE') {
|
||||
if (this.deviceDetail.status == 2 && this.deviceDetail.status != -1) {
|
||||
if ((this.deviceDetail.status == 1 || this.deviceDetail.status == 2) && this.deviceDetail.status != -
|
||||
1) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要暂停打印吗?',
|
||||
confirmText: '确定',
|
||||
cancelText: '取消',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.sendWsCommand(type);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
if (type == 'EXIT') {
|
||||
if (this.deviceDetail.status != 0 && this.deviceDetail.status != -1) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定要退出打印吗?',
|
||||
confirmText: '确定',
|
||||
cancelText: '取消',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.sendWsCommand(type);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
getVideoImg(type) {
|
||||
if (type == "img") {
|
||||
@ -463,7 +520,7 @@ export default {
|
||||
const hours = String(date.getHours()).padStart(2, "0");
|
||||
const minutes = String(date.getMinutes()).padStart(2, "0");
|
||||
|
||||
return `${year}.${month}.${day} ${hours}:${minutes}`;
|
||||
return `${year}年${month}月${day}日${hours}时${minutes}分`;
|
||||
},
|
||||
goBack() {
|
||||
uni.navigateBack();
|
||||
@ -488,7 +545,10 @@ export default {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取设备详情失败:", error);
|
||||
uni.showToast({ title: "获取设备信息失败", icon: "none" });
|
||||
uni.showToast({
|
||||
title: "获取设备信息失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -17,9 +17,7 @@
|
||||
<view class="profile_item">
|
||||
<text class="item_label">头像</text>
|
||||
<view class="avatar_wrapper" @click="changeAvatar">
|
||||
<image class="avatar"
|
||||
:src="userInfo.avatar || user"
|
||||
mode="aspectFill"></image>
|
||||
<image class="avatar" :src="userInfo.avatar || user" mode="aspectFill"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -36,7 +34,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { BASE_API_URL,BASE_IMG_URL } from "@/config.js";
|
||||
import {
|
||||
BASE_API_URL,
|
||||
BASE_IMG_URL
|
||||
} from "@/config.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -87,7 +88,8 @@
|
||||
success: (uploadRes) => {
|
||||
console.log(uploadRes)
|
||||
this.userInfo.avatar =
|
||||
"https://online.totustec.com/upload/file/image/" + uploadRes.data;
|
||||
"https://online.totustec.com/upload/file/image/" + uploadRes
|
||||
.data;
|
||||
uni.showToast({
|
||||
title: "头像上传成功"
|
||||
});
|
||||
@ -182,6 +184,7 @@
|
||||
position: relative;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.back_icon {
|
||||
position: absolute;
|
||||
left: 20rpx;
|
||||
|
Loading…
Reference in New Issue
Block a user