UI-Project/src/views/Slicecage/slicecage.vue
@@ -14,13 +14,16 @@
const dialogFormVisible = ref(false)
const dialogFormVisiblea = ref(false)
const dialogFormVisibleb = ref(false)
const dialogFormVisiblec = ref(false)
const tableData = ref([])
const tableDatagh = ref([])
const tableDatab = ref([])
const tableDatac = ref([])
const tableDatad = ref([])
const tableDataf = ref([])
const tableDatae = ref([])
const carPosition = ref([])
const ganghua = ref('')
const adjustedRects = ref([]);
const project = ref([]);
const adjust = ref([]);
@@ -69,8 +72,19 @@
const cell8=ref(true);
const cell9=ref(true);
const selectedRow = ref(null); // 存储选中的行数据  
onMounted(async () => {
  try {
    const response = await request.post('/cacheVerticalGlass/bigStorageCageDetails/selectTemperingGlass');
    if (response.code === 200) {
      tableDatagh.value = response.data
    } else {
      ElMessage.warning(response.msg)
    }
  } catch (error) {
    // console.error('Error fetching rects :', error);
  }
});
    // 当前页码和每页显示的条数
    const currentPage = ref(1);
    const itemsPerPage = computed(() => {
@@ -94,14 +108,14 @@
        return 25; // 默认值,可以根据实际需求修改
      }
    });
    // 计算分页后的数据
    const paginatedUsers = computed(() => {
      const startIndex = calculateStartIndex();
      const endIndex = startIndex + itemsPerPage.value;
      return tableData.value.slice(startIndex, endIndex);
    });
    // 计算当前页的起始索引
    function calculateStartIndex() {
      let index = 0;
@@ -145,7 +159,7 @@
        currentPage.value++;
      }
    };
    // 总页数计算
    const totalPages = computed(() => {
      // let total = 0;
@@ -162,9 +176,16 @@
      // }
      return 9;
    });
    setInterval(() => {
    localStorage.clear(); // 清除所有localStorage数据
    console.log(11111);
}, 60000);
//  function cleanUp() {
//     console.log('执行清理操作');
// }
// // 假设我们每2分钟执行一次清理
// setInterval(cleanUp, 1 * 60 * 1000);
const getTableRow = (row,type) =>{
  switch (type) {
    case 'edit' :{
@@ -349,6 +370,33 @@
    console.error('发生错误:', error);  
  }  
}; 
 // 指定钢化
 const brokee = async(row) => {
  try {
    const confirmResult = await ElMessageBox.confirm(
      t('searchOrder.specifytemperinga'),
      t('searchOrder.prompt'),
      {
        confirmButtonText: t('searchOrder.yes'),
        cancelButtonText: t('searchOrder.cancel'),
        type: 'warning',
      }
    );
    if (confirmResult === 'confirm') {
      const response = await request.post("/cacheVerticalGlass/bigStorageCageDetails/TemperingGlass",{
        engineerId: row.engineer_id,
        temperingLayoutId: row.tempering_layout_id,
    });
    if (response.code === 200) {
      ElMessage.success(response.message);
      } else {
      ElMessage.error(response.message);
      }
    }
  } catch (error) {
    console.error('发生错误:', error);
  }
};
// 出片队列拿走
const brokeb = async(row) => {  
  try {
@@ -452,7 +500,7 @@
      ElMessage.success(response.message);
      glassId.value = '';
      tableDataf.value = '';
      } else {  
      ElMessage.error(response.message);
      }  
@@ -462,21 +510,66 @@
    console.error('发生错误:', error);  
  }  
}; 
// const handleBindRack = (row) => {
//   fetchFlowCardId();
//   dialogFormVisiblea.value = true; // 打开绑定架子对话框
// };
const fetchFlowCardId = async () => {
  try {
    const response = await request.get('unLoadGlass/downWorkStation/getflowCardId');
    console.log(response)
    if (response.code === 200) {
}
 else {
      ElMessage.error(response.msg);
    }
  } catch (error) {
    console.error(error);
  }
};
function handleRowClick(row) {  
  selectedRow.value = row; // 更新选中的行数据  
}  
  const handleChange = async () => {
  try  {
    const body = {
      flag: ganghua.value, // 使用 ganghua.value 获取当前开关的状态
    };
    var url="/cacheVerticalGlass/bigStorageCageDetails/temperingSwitch?flag="+ganghua.value;
  const response = await request.post(url)
    if (response.code == 200) {
      // 绑定成功,处理逻辑
      ElMessage.success(response.message);
      ganghua.value = response.data
    }else {
      ElMessage.error(response.message);
      }
}
catch (error) {
    // 处理错误
    console.error(error);
  }
}
const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheVerticalGlass/api/talk/slicecage`;
// 定义消息处理函数,更新 receivedData 变量
const handleMessage = (data) => {
  // 更新 tableData 的数据
  console.log(data.temperingSwitch[0]);
  if(data.bigStorageCageDetailsOutTask!=null){
    tableDatac.value = data.bigStorageCageDetailsOutTask[0]
    adjusta.value = data.bigStorageCageDetailsOutTask[0].filter(rect => rect.slot !== null && rect.slot !== undefined);
  } else {
    tableDatac.value = '',
    adjusta.value = ''
  }
  if(data.bigStorageCageDetailsFeedTask!=null){
    tableDatad.value = data.bigStorageCageDetailsFeedTask[0]
    adjust.value = data.bigStorageCageDetailsFeedTask[0].filter(rect => rect.slot !== null && rect.slot !== undefined); 
  }
  }else{
    tableDatad.value = ''
      }
  
  // adjust.value = data.bigStorageCageDetailsFeedTask[0].map(rect => ({  
  //           ...rect, 
@@ -487,18 +580,30 @@
// }); 
if(data.bigStorageCageInfo!=null){
  tableData.value = data.bigStorageCageInfo[0]
}
}else{
    tableData.value = ''
   }
if(data.temperingGlassInfoList!=null){
  tableDatab.value = data.temperingGlassInfoList[0]
}
}else{
    tableDatab.value = ''
      }
if(data.bigStorageCageUsage!=null){
  tableDatae.value = data.bigStorageCageUsage[0]
}
}else{
    tableDatae.value = ''
      }
if(data.carPostion!=null){
  carPosition.value = data.carPostion[0]
}
}else{
  carPosition.value = ''
  }
if(data.temperingSwitch!=null){
  ganghua.value = data.temperingSwitch[0]
}else{
  ganghua.value = ''
  }
console.log(data.temperingSwitch[0]);
  if(data.bigStorageCageInfos!=null){
    window.localStorage.setItem('length', data.bigStorageCageInfos[0][1].length)
  let length = window.localStorage.getItem('length')
@@ -547,15 +652,17 @@
            height: 20/length,
            top: 29/length
          })); 
  }else{
    adjustedRects.value = ''
  }
  
};
// 初始化 WebSocket,并传递消息处理函数
onMounted(() => {
  // fetchFlowCardId();
  initializeWebSocket(socketUrl, handleMessage);
});
function getStatusType(enableState: number) {  
  switch (enableState) {  
@@ -615,8 +722,11 @@
 
<template>
  <div style="height: 600px;">
    <el-button style="margin-top: 5px;margin-left: 10px;"   id="searchButton" type="primary" @click="dialogFormVisiblea = true">{{ $t('searchOrder.cageinformation') }}</el-button>
    <el-button style="margin-top: 5px;margin-left: 10px;"   id="searchButton" type="success" @click="dialogFormVisibleb = true">{{ $t('searchOrder.productionqueue') }}</el-button>
    <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="primary" @click="dialogFormVisiblea = true">{{ $t('searchOrder.cageinformation') }}</el-button>
    <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="success" @click="dialogFormVisibleb = true">{{ $t('searchOrder.productionqueue') }}</el-button>
    <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="warning" @click="dialogFormVisiblec = true">{{ $t('searchOrder.temperingqueries') }}</el-button>
    <el-button style="margin-top: 5px;margin-left: 10px;" id="searchButton" type="info" @click="dialogFormVisiblec = true">{{ $t('searchOrder.dutyinformation') }}</el-button>
    <el-switch style="margin-top: 5px;margin-left: 10px;" v-model="ganghua" class="mb-2" :inactive-text="$t('searchOrder.temperedswitch')" @change="handleChange" />
    <el-card style="flex: 1;margin-left: 10px;margin-top: 5px;" v-loading="loading">
      <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 100px;">
        <el-table height="100px" ref="table" 
@@ -1039,7 +1149,7 @@
          </el-input>
          <el-button type="primary" plain style="margin-left: 10px;" @click="searchout">{{ $t('searchOrder.search') }}</el-button>
    </div>
    <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;max-height: 200px;">
        <el-table height="100%" ref="table"
        :data="tableDataf" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
@@ -1239,6 +1349,19 @@
        </el-table-column>
        </el-table>
</el-dialog>
<el-dialog v-model="dialogFormVisiblec" top="5vh" width="85%" :title="$t('searchOrder.temperingqueries')">
    <el-table  ref="table" style="margin-top: 20px;height: 500px;"
        :data="tableDatagh" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
          <el-table-column prop="engineer_id" fixed align="center" :label="$t('searchOrder.projectnumber')" min-width="150"/>
          <el-table-column prop="tempering_layout_id" fixed align="center" :label="$t('searchOrder.layoutnumber')" min-width="120" />
          <el-table-column prop="count" align="center" :label="$t('searchOrder.numberglasses')" min-width="150" />
          <el-table-column fixed="right" :label="$t('searchOrder.operate')" align="center" width="150">
            <template #default="scope">
              <el-button size="mini" type="text" plain @click="brokee(scope.row)">{{ $t('searchOrder.specifytempering') }}</el-button>
            </template>
        </el-table-column>
        </el-table>
</el-dialog>
 
</template>
<style scoped>