ZengTao
2024-08-18 f1916b183ebcff81c64bccae502a63b097c304f5
UI-Project/src/views/Identify/identify.vue
@@ -84,16 +84,16 @@
    //   console.log(url);
    //   const response = await request.post(url)
  const response = await request.post('/cacheGlass/taskCache/identControls', {
    identId: currentGlassId.value,
    controlsId: 201,
    glassId: currentGlassId.value,
    state: 8,
    line: 1001,
    machine: '识别',
    workingProcedure: '识别',
    })
    if (response.code == 200) {
      ElMessage.success(response.message);
      // window.location.reload() 
      blind.value = false;
      updateRectStatus(currentGlassId.value, 201);
      updateRectStatus(currentGlassId.value, 8);
    } else {
      // 请求失败,显示错误消息
      ElMessage.error(response.msg);
@@ -111,17 +111,17 @@
    //   console.log(url);
    //   const response = await request.post(url)
  const response = await request.post('/cacheGlass/taskCache/identControls', {
    identId: currentGlassId.value,
    controlsId: 200,
    glassId: currentGlassId.value,
    state: 9,
    line: 1001,
    machine: '识别',
    workingProcedure: '识别',
    })
    if (response.code == 200) {
      // 绑定成功,处理逻辑
      ElMessage.success(response.message);
      // window.location.reload() 
      blind.value = false;
      updateRectStatus(currentGlassId.value, 200);
      updateRectStatus(currentGlassId.value, 9);
    } else {
      // 请求失败,显示错误消息
      ElMessage.error(response.msg);
@@ -142,11 +142,12 @@
      const rawRects = response.data[0];
      rawData.value = response.data;
      totalPages.value = rawData.value.length;
      const scaleFactor =  1621.78/6000;
      adjustedRects.value = rawRects.map(rect => ({  
        ...rect,
        x_axis: (6000 -(rect.x_axis + rect.width)) * 0.2085,
        x_axis: (6000 -(rect.x_axis + rect.width)) * scaleFactor,
        y_axis: rect.y_axis * 0.17,
        width: rect.width * 0.2 ,
        width: rect.width * scaleFactor ,
        widtha: rect.width ,
        heighta: rect.height ,
        height: rect.height * 0.165 ,
@@ -166,12 +167,13 @@
const handleCurrentChange = (val: number) => {  
  currentPage.value = val;
  const page = currentPage.value - 1
      const scaleFactor =  1621.78/6000;
      adjustedRects.value = rawData.value[page]?.map(rect => ({  
      // adjustedRects.value = rawRects.map(rect => ({  
        ...rect,
        x_axis: (6000 -(rect.x_axis + rect.width)) * 0.2085,
        x_axis: (6000 -(rect.x_axis + rect.width)) * scaleFactor,
        y_axis: rect.y_axis * 0.17,
        width: rect.width * 0.2 ,
        width: rect.width * scaleFactor ,
        widtha: rect.width ,
        heighta: rect.height ,
        height: rect.height * 0.165 ,
@@ -188,12 +190,12 @@
      return '#b3e19d';  
    case 120:  
      return '#f89898';  
    case 200:
      return 'lightblue';
    case 201:
    case 8:
      return '#911005';
    case 9:
      return '#f3d19e';  
    default:
      return '#911005'; // 默认颜色
    // default:
    //   return '#911005'; // 默认颜色
  }  
// 更新矩形状态  
@@ -210,11 +212,12 @@
    webSocket = new WebSocket(socketUrl);  
    webSocket.onmessage = (event) => {  
      const data = JSON.parse(event.data);   
      const scaleFactor =  1621.78/6000;
        adjustedRects.value = data.currentCutTerritory[0].map(rect => ({  
        ...rect,
        x_axis: (6000 -(rect.x_axis + rect.width)) * 0.2085,
        x_axis: (6000 -(rect.x_axis + rect.width)) * scaleFactor,
        y_axis: rect.y_axis * 0.17,
        width: rect.width * 0.2 ,
        width: rect.width * scaleFactor ,
        widtha: rect.width ,
        heighta: rect.height ,
        height: rect.height * 0.165 ,