wangfei
2025-10-21 1496904805dff921b79504ed29a71d297a84e674
UI-Project/src/views/ReportWork/reportWork.vue
@@ -33,7 +33,7 @@
    </div>
    <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" >
      <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
        <el-table height="740" ref="table" :data="reportData"
        <el-table height="700" ref="table" :data="reportData"
          :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129' }">
          <el-table-column prop="teamsGroupsName" align="center" :label="$t('reportmanage.reporteam')"
            min-width="135" />
@@ -137,6 +137,18 @@
            </template>
          </el-table-column>
        </el-table>
      <div style="margin-top: 20px;margin-left: 40%;">
      <el-pagination
        v-model:current-page="currentPage"
        :page-size="pageSize"
        :size="large"
        :disabled="disabled"
        layout="prev, pager, next, jumper"
        :total="totalRecords"
        @current-change="handlePageChange"
        style="margin-top: 10px;"
    />
    </div>
      </div>
    </el-card>
  </div>
@@ -151,33 +163,11 @@
import { useI18n } from 'vue-i18n'
import { inject } from 'vue';
const globalDate = inject('globalDate');
const timeRange = ref([])
const currentPage = ref(1)
const totalRecords = ref(0)
const { t } = useI18n()
const report = ref({
  type: '8',
  status: '1',
  workingProcedure: '0',
});
const timeRange = ref([])
const reportData = ref([])
function formatTimestamp(timestamp) {
  const date = new Date(timestamp);
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1,并补零
  const day = String(date.getDate()).padStart(2, '0'); // 补零
  const hours = String(date.getHours()).padStart(2, '0'); // 补零(如果需要显示时间)
  const minutes = String(date.getMinutes()).padStart(2, '0'); // 补零(如果需要显示时间)
  const seconds = String(date.getSeconds()).padStart(2, '0'); // 补零(如果需要显示时间)
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
// 格式化后端时间并计算一周前的时间
const defaultTime = ref<[Date, Date]>([new Date(), new Date()]);
function parseAndSetTime() {
  const backendTime = new Date(globalDate);
  const oneWeekAgo = new Date(backendTime.getTime() - 7 * 24 * 60 * 60 * 1000); // 减去7天
  oneWeekAgo.setHours(0, 0, 0, 0);
  timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)];
  window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
}
// const timeRange = ref([formatTimestamp(startDate), formatTimestamp(globalDate)]);
const selectOptionsa = ref([]);
const selectOptionsb = ref([]);
@@ -192,6 +182,11 @@
const inputValuesb = reactive({});
const selectedType = ref(true);
const selectedStatus = ref(false);
const report = ref({
  type: '8',
  status: '1',
  workingProcedure: '0',
});
// 查询数据
const selectReportData = async () => {
  const response = await request.post("/cacheVerticalGlass/damage/selectDamage", {
@@ -271,6 +266,12 @@
    console.error('Error fetching options:', error);
  }
};
const handlePageChange = (newPage) => {
currentPage.value = newPage;
window.localStorage.setItem('pagenumber', currentPage.value)
historicala(currentPage.value);
Dailya(currentPage.value);
};
const handleInputChangea = (value, rowId) => {
  // 更新对应行的 select 值  
  selectValuesa[rowId] = value;
@@ -333,6 +334,25 @@
//     })); 
// };
// let socket;
function formatTimestamp(timestamp) {
  const date = new Date(timestamp);
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1,并补零
  const day = String(date.getDate()).padStart(2, '0'); // 补零
  const hours = String(date.getHours()).padStart(2, '0'); // 补零(如果需要显示时间)
  const minutes = String(date.getMinutes()).padStart(2, '0'); // 补零(如果需要显示时间)
  const seconds = String(date.getSeconds()).padStart(2, '0'); // 补零(如果需要显示时间)
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
// 格式化后端时间并计算一周前的时间
const defaultTime = ref<[Date, Date]>([new Date(), new Date()]);
function parseAndSetTime() {
  const backendTime = new Date(globalDate);
  const oneWeekAgo = new Date(backendTime.getTime() - 7 * 24 * 60 * 60 * 1000); // 减去7天
  oneWeekAgo.setHours(0, 0, 0, 0);
  timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)];
  window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
}
onUnmounted(() => {
  socket.close();
});