huang
2025-10-20 23f026fbfd81066b1f2e9662bbeff31965dda4d6
UI-Project/src/views/GlassStorage/rawhistory.vue
@@ -15,10 +15,15 @@
          <el-option :label="$t('sorter.advancerequests')" value="4"></el-option>
          <el-option :label="$t('sorter.releaserequest')" value="5"></el-option>
        </el-select>
            <el-date-picker v-model="timeRange" type="datetimerange" range-separator="至" :start-placeholder="$t('reportmanage.starttime')"
             style="margin-left: 15px;" value-format = "YYYY-MM-DD hh:mm:ss"
              :end-placeholder="$t('reportmanage.endtime')">
            </el-date-picker>
        <el-date-picker
            style="margin-left: 15px;"
             v-model="timeRange"
             type="datetimerange"
             :shortcuts="shortcuts"
             range-separator="至"
             :start-placeholder="$t('reportmanage.starttime')"
             :end-placeholder="$t('reportmanage.endtime')"
           />
          <el-button type="primary" style="margin-left: 10px;margin-bottom: 10px;" @click="sethistorical()">{{$t('reportmanage.inquire')}}</el-button>
     </div>
        <el-table ref="table" style="margin-top: 20px;height: 580px;width: 1770px;" :data="tableDatax" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
@@ -208,8 +213,8 @@
        pageSize: 20,
        taskState: celllist,
        taskType: stateList,
        beginDate:  (timeRange.value && timeRange.value[0]) || '',
        endDate:  (timeRange.value && timeRange.value[1]) || '',
        beginDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[0])) || '',
        endDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[1])) || '',
    })
      if (response.code == 200) {
        ElMessage.success(response.message);
@@ -262,8 +267,8 @@
        pageSize: 20,
        taskState: celllist,
        taskType: stateList,
        beginDate:  (timeRange.value && timeRange.value[0]) || '',
        endDate:  (timeRange.value && timeRange.value[1]) || '',
        beginDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[0])) || '',
        endDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[1])) || '',
    })
      if (response.code == 200) {
        ElMessage.success(response.message);
@@ -294,6 +299,41 @@
  const seconds = String(date.getSeconds()).padStart(2, '0'); // 补零(如果需要显示时间)
  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
const shortcuts = [
  {
    text: '最近一周',
    value: () => {
      const backendTime = new Date(getglobalDate)
      const oneWeekAgo = new Date(getglobalDate)
      oneWeekAgo.setHours(0, 0, 0, 0);
      oneWeekAgo.setDate(oneWeekAgo.getDate() - 7)
      timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)]
      window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
    },
  },
  {
    text: '最近一个月',
    value: () => {
      const backendTime = new Date(getglobalDate)
      const oneWeekAgo = new Date(getglobalDate)
      oneWeekAgo.setHours(0, 0, 0, 0);
      oneWeekAgo.setMonth(oneWeekAgo.getMonth() - 1)
      timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)]
      window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
    },
  },
  {
    text: '最近三个月',
    value: () => {
      const backendTime = new Date(getglobalDate)
      const oneWeekAgo = new Date(getglobalDate)
      oneWeekAgo.setHours(0, 0, 0, 0);
      oneWeekAgo.setMonth(oneWeekAgo.getMonth() - 3)
      timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)]
      window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
},
  },
]
// 格式化后端时间并计算一周前的时间
const defaultTime = ref<[Date, Date]>([new Date(), new Date()]);
function parseAndSetTime() {
@@ -328,27 +368,31 @@
  case 4:  
  return t('sorter.advancerequests');//进片请求
  case 5:  
  return t('sorter.releaserequest');//出片请求
  return t('sorter.warehouseReturntasks');//回库请求
}  
}
function getStatusType2(taskState) {  
switch (taskState) {  
  case 0:
    return 'info';
  case 2:
    return 'warning';
  case 1:
    return 'success';
  case 0:
      return 'info';
    case 1:
      return 'warning';
    case 2:
      return 'success';
    case 3:
      return 'danger';
}  
}
function getStatusText2(taskState) {  
switch (taskState) {
  case 0:
    return t('film.built');//新建
  case 2:
    return t('film.fail');//失败
  case 1:
    return t('film.finish');//完成
   case 0:
      return t('film.built');//新建
    case 1:
      return t('film.execution');//执行中
    case 2:
      return t('film.finish');//完成
    case 3:
      return t('film.fail');//失败
}  
}
onMounted(() => {