<template>
|
<div style="height: 600px;">
|
<div style="display: flex; flex-direction: row; align-items: center; margin-top: 20px;">
|
<span style="margin-left: 10px;" class="demonstration">{{ $t('reportmanage.productiontime') }}</span>
|
<el-date-picker style="margin-left: 10px;" v-model="timeRange" type="daterange" format="YYYY/MM/DD"
|
value-format="YYYY-MM-DD" :start-placeholder="$t('reportmanage.starttime')"
|
:end-placeholder="$t('reportmanage.endtime')" :default-time="defaultTime" />
|
<el-input v-model="report.targetSlot" style="margin-left: 15px;width: 150px" placeholder="请输入格子号" />
|
<!-- <el-input v-model="report.width" style="margin-left: 15px;width: 150px" placeholder="请输入宽" />
|
<el-input v-model="report.height" style="margin-left: 15px;width: 150px" placeholder="请输入高" /> -->
|
<el-select v-model="report.taskType" :placeholder="$t('reportmanage.ctype')" style="margin-left: 10px;">
|
<el-option :label="$t('reportmanage.all')" value="-1"></el-option>
|
<el-option :label="$t('reportmanage.incomplete')" value="0"></el-option>
|
<el-option :label="$t('reportmanage.complete')" value="1"></el-option>
|
</el-select>
|
<el-select v-model="report.taskState" :placeholder="$t('reportmanage.cstate')" style="margin-left: 10px;">
|
<el-option :label="$t('reportmanage.all')" value="-1"></el-option>
|
<el-option :label="$t('reportmanage.feed')" value="1"></el-option>
|
<el-option :label="$t('reportmanage.out')" value="2"></el-option>
|
<el-option :label="$t('reportmanage.straightthrough')" value="3"></el-option>
|
</el-select>
|
<!-- <el-select v-model="report.line" :placeholder="$t('reportmanage.cprocess')" style="margin-left: 10px;">
|
<el-option :label="$t('reportmanage.all')" value="0"></el-option>
|
<el-option :label="$t('reportmanage.oneline')" value="2001"></el-option>
|
<el-option :label="$t('reportmanage.twoline')" value="2002"></el-option>
|
</el-select> -->
|
<el-button type="primary" style="margin-left: 10px;" @click="selectReportData()">{{ $t('reportmanage.inquire')
|
}}</el-button>
|
</div>
|
<el-card style="flex: 1;margin-left: 10px;" v-loading="loading">
|
<!-- <div style="margin-bottom: 20px">
|
<el-row style="margin-top: -15px;margin-bottom: -2px;">
|
<el-col :span="3">
|
<div id="dta" style="font-size: 15px;">
|
<el-form-item :label="$t('reportmanage.totalCounts')" style="width: 14vw">
|
{{ totalCounts }}
|
</el-form-item>
|
</div>
|
</el-col>
|
<el-col :span="3">
|
<div id="dt" style="font-size: 15px;">
|
<el-form-item :label="$t('reportmanage.totalAreas')" style="width: 14vw">
|
{{ totalAreas }}
|
</el-form-item>
|
</div>
|
</el-col>
|
<el-col :span="3">
|
<div id="dt" style="font-size: 15px;">
|
<el-form-item :label="$t('reportmanage.totalDamages')" style="width: 14vw">
|
{{ totalDamages }}
|
</el-form-item>
|
</div>
|
</el-col>
|
<el-col :span="3">
|
<div id="dt" style="font-size: 15px;">
|
<el-form-item :label="$t('reportmanage.totalTakes')" style="width: 14vw">
|
{{ totalTakes }}
|
</el-form-item>
|
</div>
|
</el-col>
|
</el-row>
|
</div> -->
|
<div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;">
|
<el-table height="750" ref="table" :data="reportData"
|
:header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129' }">
|
<el-table-column prop="glassId" align="center" :label="$t('reportmanage.glassID')" min-width="130" />
|
<el-table-column prop="startCell" align="center" :label="$t('reportmanage.targetSlot')" min-width="120" />
|
<el-table-column prop="endCell" align="center" :label="$t('reportmanage.endSlot')" min-width="120" />
|
<el-table-column prop="taskStatus" align="center" :label="$t('reportmanage.state')" min-width="120">
|
<template #default="scope">
|
<span v-if="scope.row.taskStatus == 0">{{ $t('reportmanage.incomplete') }}</span>
|
<span v-if="scope.row.taskStatus == 1">{{ $t('reportmanage.complete') }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="taskType" align="center" :label="$t('reportmanage.type')" min-width="120">
|
<template #default="scope">
|
<span v-if="scope.row.taskType == 1">{{ $t('reportmanage.cage') }}</span>
|
<span v-if="scope.row.taskType == 2">{{ $t('reportmanage.out') }}</span>
|
<span v-if="scope.row.taskType == 3">{{ $t('reportmanage.straightthrough') }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="createTime" align="center" :label="$t('reportmanage.createTime')" min-width="230" />
|
</el-table>
|
</div>
|
</el-card>
|
</div>
|
</template>
|
<script setup>
|
import { Delete, Upload } from '@element-plus/icons-vue'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
import { ref, onMounted, onBeforeUnmount, reactive, computed, shallowRef, onUnmounted, watchEffect } from "vue";
|
import request from "@/utils/request"
|
import { WebSocketHost, host } from '@/utils/constants'
|
import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService';
|
import { useI18n } from 'vue-i18n'
|
const { t } = useI18n()
|
const report = ref({
|
targetSlot: '',
|
taskType: '-1',
|
taskState: '-1',
|
line: '0',
|
width: '',
|
height: ''
|
});
|
const reportData = ref([])
|
const endDate = new Date();
|
const startDate = new Date();
|
startDate.setDate(endDate.getDate() - 100); // 获取一个星期前的时间
|
// 格式化为 "YYYY-MM-DD" 格式
|
const formatDate = (date) => {
|
const year = date.getFullYear();
|
const month = String(date.getMonth() + 1).padStart(2, '0');
|
const day = String(date.getDate()).padStart(2, '0');
|
return `${year}-${month}-${day}`;
|
};
|
|
const timeRange = ref([formatDate(startDate), formatDate(endDate)]);
|
const totalCounts = ref(0);
|
const totalAreas = ref(0);
|
const totalDamages = ref(0);
|
const totalTakes = ref(0);
|
|
// 查询数据
|
const selectReportData = async () => {
|
const response = await request.post("/unLoadGlass/downGlassTask/selectDownGlassTask?startTime=" + timeRange.value[0] + "&&endTime=" + timeRange.value[1] + "", {
|
startTime: timeRange.value[0],
|
endTime: timeRange.value[1],
|
startCell: report.value.targetSlot,
|
width: report.value.width,
|
height: report.value.height,
|
taskType: report.value.taskType,
|
taskStatus: report.value.taskState,
|
endCell: report.value.line
|
})
|
if (response.code === 200) {
|
reportData.value = response.data;
|
let totalCount = 0;
|
let totalArea = 0;
|
let totalDamage = 0;
|
let totalTake = 0;
|
// response.data.forEach(item => {
|
// if (item.taskState == 3) {
|
// totalCount += 1;
|
// totalArea += item.width * item.height / 100000000;
|
// }
|
// if (item.taskState == 8) {
|
// totalDamage += 1;
|
// }
|
// if (item.taskState == 9) {
|
// totalTake += 1;
|
// }
|
// });
|
totalCounts.value = totalCount;
|
totalAreas.value = totalArea.toFixed(2);
|
totalDamages.value = totalDamage;
|
totalTakes.value = totalTake;
|
ElMessage.success(response.message);
|
} else {
|
ElMessage.error(response.message);
|
}
|
|
};
|
|
</script>
|