Commit b0a240ed by guibin

天合堂设备实时状态页面自动获取factoryCode

parent 76b869d4
...@@ -225,7 +225,7 @@ ...@@ -225,7 +225,7 @@
start_time: "", // 开始时间 start_time: "", // 开始时间
end_time: "", // 结束时间 end_time: "", // 结束时间
refreshInterval: null, // 定时刷新计时器 refreshInterval: null, // 定时刷新计时器
factoryCode: "f1991dbb-52d6-11ef-b13f-fa163e5bb392", // 公司CODE factoryCode: "", // 公司CODE
allEquipmentData: [], // 所有已绑定设备数据 allEquipmentData: [], // 所有已绑定设备数据
selectedWorkshop: "", // 新增字段:当前选中的车间 selectedWorkshop: "", // 新增字段:当前选中的车间
}; };
...@@ -411,10 +411,13 @@ ...@@ -411,10 +411,13 @@
const start_working_time = response.data.result.start_working_time || []; const start_working_time = response.data.result.start_working_time || [];
const end_working_time = response.data.result.end_working_time || []; const end_working_time = response.data.result.end_working_time || [];
const wait_time = response.data.result.wait_time || []; const wait_time = response.data.result.wait_time || [];
if (this.factoryCode) {
// 调用设备状态接口 // 调用设备状态接口
await this.getDeviceStateList(start_working_time, end_working_time, wait_time); await this.getDeviceStateList(start_working_time, end_working_time, wait_time);
}
else {
await this.getFactoryCode(start_working_time, end_working_time, wait_time);
}
return start_working_time, end_working_time, wait_time; return start_working_time, end_working_time, wait_time;
} else { } else {
const errorMsg = response.data.result const errorMsg = response.data.result
...@@ -489,6 +492,34 @@ ...@@ -489,6 +492,34 @@
throw error; throw error;
} }
}, },
// 获取factoryCode
async getFactoryCode(start_working_time, end_working_time, wait_time) {
try {
// 使用CORS代理
// 发送请求获取设备状态
const response = await axios({
method: "post",
url: this.dwsURL + "/roke/workstation/db_uuid/get",
data: {},
headers: { "Content-Type": "application/json" },
});
// 处理JSON-RPC格式的响应
if (response.data && response.data.result && response.data.result.code === 0) {
// 获取计划运行时间数据
this.factoryCode = response.data.result.data || "";
// 调用设备状态接口
await this.getDeviceStateList(start_working_time, end_working_time, wait_time);
} else {
const errorMsg = response.data.result
? response.data.result.message
: "获取账套db_uuid失败";
throw new Error(errorMsg);
}
} catch (error) {
// console.error("获取账套db_uuid失败:", error);
throw error;
}
},
// 处理设备状态数据 // 处理设备状态数据
processDeviceStateData(deviceStateData) { processDeviceStateData(deviceStateData) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment