wangfei
2025-03-19 c2437613fdb41f8b187130ffc78f6afafb2d64c3
UI-Project/src/views/Caching/cachingunhistory.vue
@@ -30,8 +30,28 @@
             style="margin-left: 15px;" value-format = "YYYY-MM-DD hh:mm:ss"
              :end-placeholder="$t('reportmanage.endtime')">
            </el-date-picker>
          <el-button type="primary" style="margin-left: 10px;margin-bottom: 10px;" @click="sethistorical()">{{$t('reportmanage.inquire')}}</el-button>
          <el-button type="primary" style="margin-left: 10px;margin-bottom: 10px;" @click="handleClick()">{{$t('reportmanage.inquire')}}</el-button>
     </div>
     <div style="margin-bottom: 10px;margin-top: 20px;margin-left: 20px;">
      <el-form>
        <el-row style="margin-top: -15px;margin-bottom: -2px;">
          <el-col :span="4">
              <div id="dt" style="font-size: 15px;">
              <el-form-item :label="$t('hellow.countOutTwo')"  style="width: 14vw">
                {{ countOutTwo }}
              </el-form-item>
              </div>
          </el-col>
          <el-col :span="5">
            <div id="dta" style="font-size: 15px;">
          <el-form-item :label="$t('hellow.totalAreaOutTwo')" style="width: 14vw">
                {{ totalAreaOutTwo }}
              </el-form-item>
              </div>
          </el-col>
        </el-row>
      </el-form>
    </div>
        <el-table ref="table" style="margin-top: 20px;height: 580px;width: 1770px;" :data="tableDatax" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
      <el-table-column prop="glassIdIn" align="center" :label="$t('searchOrder.glassID')" min-width="80" />
          <el-table-column
@@ -93,6 +113,8 @@
const tableDatax = ref([])
const currentPage2 = ref(1)
const totalRecords = ref(0)
const countOutTwo = ref(0)
const totalAreaOutTwo = ref(0)
const glassId = ref('');
const startSlot = ref('');
const targetSlot = ref('');
@@ -125,11 +147,36 @@
    console.error(error);
  }
}
const Daily = async () => {
  try {
  let startTime = window.localStorage.getItem('startTime')
      const response = await request.post("/cacheGlass/edgStorageDeviceTaskHistory/queryEdgDailyProduction", {
        deviceId: 2,
        pageNo: 1,
        pageSize: 20,
        glassId: glassId.value,
        taskState: '',
        taskType: '',
        startTime: startTime,
        endTime: getglobalDate
    })
      if (response.code == 200) {
        countOutTwo.value = response.data.countOutTwo
        totalAreaOutTwo.value = response.data.totalAreaOutTwo
      } else {
        ElMessage.error(response.message);
    }
}
catch (error) {
    console.error(error);
  }
}
const handlePageChange2 = (newPage) => {
  currentPage2.value = newPage;
  console.log(currentPage2.value);
  window.localStorage.setItem('pagenumber', currentPage2.value)
  historicala(currentPage2.value);
  Dailya(currentPage2.value);
};
const historicala = async (page) => {
  try { 
@@ -157,6 +204,35 @@
    console.error(error);
  }
}
const Dailya = async (page) => {
  try {
  let page = window.localStorage.getItem('pagenumber')
  let startTime = window.localStorage.getItem('startTime')
      const response = await request.post("/cacheGlass/edgStorageDeviceTaskHistory/queryEdgDailyProduction", {
        deviceId: 2,
        pageNo: page,
        pageSize: 20,
        glassId: glassId.value,
        taskState: taskState.value,
        taskType: taskType.value,
        startTime: (timeRange.value && timeRange.value[0]) || '',
        endTime: (timeRange.value && timeRange.value[1]) || '',
    })
      if (response.code == 200) {
        countOutTwo.value = response.data.countOutTwo
        totalAreaOutTwo.value = response.data.totalAreaOutTwo
      } else {
        ElMessage.error(response.message);
    }
}
catch (error) {
    console.error(error);
  }
}
const handleClick = async () => {
  await sethistorical();
  await Dailyhistorical();
};
// 历史查询点击
const sethistorical = async () => {
  try { 
@@ -174,9 +250,35 @@
        endTime: (timeRange.value && timeRange.value[1]) || '',
    })
      if (response.code == 200) {
        currentPage2.value = 1;
        ElMessage.success(response.message);
        tableDatax.value = response.data.records;
        totalRecords.value = response.data.total/2 || 0
      } else {
        ElMessage.error(response.message);
    }
}
catch (error) {
    console.error(error);
  }
}
const Dailyhistorical = async () => {
  try {
  let startTime = window.localStorage.getItem('startTime')
  let page = window.localStorage.getItem('pagenumber')
    const response = await request.post("/cacheGlass/edgStorageDeviceTaskHistory/queryEdgDailyProduction", {
        deviceId: 2,
        pageNo: 1,
        pageSize: 20,
        glassId: glassId.value,
        taskState: taskState.value,
        taskType: taskType.value,
        startTime: (timeRange.value && timeRange.value[0]) || '',
        endTime: (timeRange.value && timeRange.value[1]) || '',
    })
      if (response.code == 200) {
        countOutTwo.value = response.data.countOutTwo
        totalAreaOutTwo.value = response.data.totalAreaOutTwo
      } else {
        ElMessage.error(response.message);
    }
@@ -201,6 +303,7 @@
function parseAndSetTime() {
  const backendTime = new Date(getglobalDate);
  const oneWeekAgo = new Date(backendTime.getTime() - 7 * 24 * 60 * 60 * 1000); // 减去7天
  oneWeekAgo.setHours(0, 0, 0, 0);
  console.log(formatTimestamp(oneWeekAgo));
  console.log(oneWeekAgo);
  timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)];
@@ -269,6 +372,7 @@
onMounted(() => {
  parseAndSetTime();
  historical();
  Daily()
});
  </script>
  <style scoped>