| | |
| | | <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-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-select v-model="report.type" :placeholder="$t('reportmanage.ctype')" style="margin-left: 10px;"> |
| | | <!-- <el-option :label="$t('reportmanage.all')" value="0"></el-option> --> |
| | | <!-- <el-option :label="$t('reportmanage.completed')" value="1"></el-option> --> |
| | | <el-option :label="$t('reportmanage.completed')" value="1"></el-option> |
| | | <el-option :label="$t('reportmanage.broke')" value="8"></el-option> |
| | | <el-option :label="$t('reportmanage.takeout')" value="9"></el-option> |
| | | </el-select> |
| | | <el-select v-model="report.status" :placeholder="$t('reportmanage.cstate')" style="margin-left: 10px;"> |
| | | <!-- <el-option :label="$t('reportmanage.all')" value="0"></el-option> --> |
| | | <el-option :label="$t('reportmanage.dreportwork')" value="1"></el-option> |
| | | <!-- <el-option :label="$t('reportmanage.pendingwork')" value="2"></el-option> --> |
| | | <el-option :label="$t('reportmanage.pendingwork')" value="7"></el-option> |
| | | <el-option :label="$t('reportmanage.reportwork')" value="3"></el-option> |
| | | <el-option :label="$t('reportmanage.reportworked')" value="8"></el-option> |
| | | </el-select> |
| | | <el-select v-model="report.workingProcedure" :placeholder="$t('reportmanage.cprocess')" |
| | | style="margin-left: 10px;"> |
| | |
| | | $t('reportmanage.signingwork') |
| | | }}</el-button> |
| | | </div> |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading"> |
| | | <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" |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129' }"> |
| | | <el-table-column prop="teamsGroupsName" align="center" :label="$t('reportmanage.reporteam')" |
| | | min-width="120" /> |
| | | min-width="135" /> |
| | | <el-table-column prop="deviceName" align="center" :label="$t('reportmanage.reportingequipment')" |
| | | min-width="120" /> |
| | | min-width="156" /> |
| | | <el-table-column prop="line" align="center" :label="$t('reportmanage.line')" min-width="120" /> |
| | | <el-table-column prop="workingProcedure" align="center" :label="$t('reportmanage.process')" min-width="120" /> |
| | | <el-table-column prop="glassId" align="center" :label="$t('reportmanage.glassID')" min-width="130" /> |
| | | <el-table-column prop="engineerId" align="center" :label="$t('reportmanage.projectnumber')" min-width="120" /> |
| | | <el-table-column prop="temperingLayoutId" align="center" :label="$t('reportmanage.layoutID')" |
| | | min-width="120" /> |
| | | <el-table-column prop="damageTime" align="center" :label="$t('reportmanage.productiontime')" |
| | | <el-table-column prop="formattedCreateTime" align="center" :label="$t('reportmanage.productiontime')" |
| | | min-width="230" /> |
| | | <el-table-column prop="type" align="center" :label="$t('reportmanage.type')" min-width="120" /> |
| | | <el-table-column prop="status" align="center" :label="$t('reportmanage.state')" min-width="120" /> |
| | | <el-table-column |
| | | align="center" |
| | | :label="$t('reportmanage.type')" |
| | | min-width="120" |
| | | prop="type" |
| | | > |
| | | <template #default="scope"> |
| | | <el-tag :type="gettypeType(scope.row.type)"> |
| | | {{ gettypeText(scope.row.type) }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | align="center" |
| | | :label="$t('reportmanage.state')" |
| | | min-width="120" |
| | | prop="status" |
| | | > |
| | | <template #default="scope"> |
| | | <el-tag :type="getStatusType(scope.row.status)"> |
| | | {{ getStatusText(scope.row.status) }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="processId" align="center" :label="$t('reportmanage.processcards')" min-width="140" /> |
| | | <el-table-column prop="orderNumber" align="center" :label="$t('reportmanage.number')" min-width="120" /> |
| | | <el-table-column prop="technologyNumber" align="center" :label="$t('reportmanage.layer')" min-width="120" /> |
| | |
| | | <template #default="{ row }"> |
| | | <el-select v-model="row.responsibleProcess" filterable :placeholder="$t('reportmanage.ptypebreakage')" :disabled="selectedType" |
| | | clearable @input="handleInputChangea($event, row.id)"> |
| | | <el-option value="切割" label="切割"></el-option> |
| | | <el-option value="磨边" label="磨边"></el-option> |
| | | <el-option value="钢化" label="钢化"></el-option> |
| | | <el-option :label="$t('reportmanage.incise')" value="切割"></el-option> |
| | | <el-option :label="$t('reportmanage.edging')" value="磨边"></el-option> |
| | | <el-option :label="$t('reportmanage.steel')" value="钢化"></el-option> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | </el-card> |
| | | </div> |
| | | </template> |
| | | <script setup> |
| | | <script lang="ts" 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 { WebSocketHost, host } from '@/utils/constants' |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | import { useI18n } from 'vue-i18n' |
| | | import { inject } from 'vue'; |
| | | const globalDate = inject('globalDate'); |
| | | const timeRange = ref([]) |
| | | const { t } = useI18n() |
| | | const report = ref({ |
| | | type: '8', |
| | |
| | | workingProcedure: '0', |
| | | }); |
| | | const reportData = ref([]) |
| | | const endDate = new Date(); |
| | | const startDate = new Date(); |
| | | startDate.setDate(endDate.getDate() - 7); // 获取一个星期前的时间 |
| | | // 格式化为 "YYYY-MM-DD" 格式 |
| | | const formatDate = (date) => { |
| | | function formatTimestamp(timestamp) { |
| | | const date = new Date(timestamp); |
| | | 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 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([]); |
| | | const selectOptionsc = ref([]); |
| | |
| | | const selectValuese = reactive({}); |
| | | const inputValuesa = reactive({}); |
| | | const inputValuesb = reactive({}); |
| | | |
| | | const selectedType = ref(true); |
| | | const selectedStatus = ref(false); |
| | | |
| | | |
| | | // 查询数据 |
| | | const selectReportData = async () => { |
| | | const response = await request.post("/cacheVerticalGlass/damage/selectDamage", { |
| | | startTime: timeRange.value[0], |
| | | endTime: timeRange.value[1]+" 23:59:59", |
| | | startTime: (timeRange.value && timeRange.value[0]) || '', |
| | | endTime: (timeRange.value && timeRange.value[1]) || '', |
| | | type: report.value.type, |
| | | status: report.value.status, |
| | | workingProcedure: report.value.workingProcedure |
| | |
| | | }else{ |
| | | selectedType.value = true; |
| | | } |
| | | if (report.value.status == 1&&(report.value.type == 8||report.value.type == 1)) { |
| | | if ((report.value.status == 1||report.value.status == 7)&&(report.value.type == 8||report.value.type == 1)) { |
| | | selectedStatus.value = true; |
| | | }else{ |
| | | selectedStatus.value = false; |
| | | } |
| | | if (response.code === 200) { |
| | | reportData.value = response.data; |
| | | const formattedData = response.data.map(record => ({ |
| | | ...record, |
| | | formattedCreateTime: formatTimestamp(record.damageTime), |
| | | })); |
| | | reportData.value = formattedData; |
| | | ElMessage.success(response.message); |
| | | |
| | | } else { |
| | | ElMessage.error(response.message); |
| | | } |
| | | |
| | | // const responses = await request.post("/cacheVerticalGlass/damage/insertDamage", { |
| | | // glassId:"P24081502|1|1", |
| | | // line:"1001", |
| | |
| | | ElMessage.error(response.message); |
| | | } |
| | | } |
| | | |
| | | selectReportData(); |
| | | }; |
| | | const fetchTableData = async () => { |
| | | try { |
| | |
| | | inputValuesb[rowId] = value; |
| | | }; |
| | | fetchTableData(); |
| | | function gettypeType(type: number) { |
| | | switch (type) { |
| | | case 9: |
| | | return 'success'; |
| | | case 8: |
| | | return 'danger'; |
| | | } |
| | | } |
| | | function gettypeText(type: number) { |
| | | switch (type) { |
| | | case 9: |
| | | return t('reportmanage.takeout'); |
| | | case 8: |
| | | return t('reportmanage.broke'); |
| | | } |
| | | } |
| | | function getStatusType(status: number) { |
| | | switch (status) { |
| | | case 1: |
| | | return 'warning'; |
| | | case 3: |
| | | return 'info'; |
| | | case 7: |
| | | return 'success'; |
| | | case 8: |
| | | return 'primary'; |
| | | } |
| | | } |
| | | function getStatusText(status: number) { |
| | | switch (status) { |
| | | case 1: |
| | | return t('reportmanage.dreportwork'); |
| | | case 3: |
| | | return t('reportmanage.reportwork'); |
| | | case 7: |
| | | return t('reportmanage.pendingwork'); |
| | | case 8: |
| | | return t('reportmanage.reportworked'); |
| | | } |
| | | } |
| | | let socket = null; |
| | | // const socketUrl = `ws://${WebSocketHost}:${host}/api/temperingGlass/api/talk/screen`; |
| | | // const handleMessage = (data) => { |
| | |
| | | // })); |
| | | // }; |
| | | // let socket; |
| | | onMounted(() => { |
| | | // socket = new WebSocket(socketUrl); |
| | | // socket.onmessage = (event) => { |
| | | // const data = JSON.parse(event.data); |
| | | |
| | | // // updateCharts(); |
| | | // }; |
| | | // }; |
| | | }); |
| | | onUnmounted(() => { |
| | | socket.close(); |
| | | }); |
| | | onMounted(() => { |
| | | fetchTableData(); |
| | | parseAndSetTime(); |
| | | // socket = initializeWebSocket(socketUrl, handleMessage); |
| | | }); |
| | | onUnmounted(() => { |
| | |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | }); |
| | | </script> |