| | |
| | | <script setup> |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {reactive} from "vue"; |
| | | import {onBeforeUnmount, onMounted, onUnmounted, reactive, ref} from "vue"; |
| | | import {useRouter} from "vue-router" |
| | | import {host, WebSocketHost} from '@/utils/constants' |
| | | import request from "@/utils/request" |
| | | import {closeWebSocket, initializeWebSocket} from '@/utils/WebSocketService'; |
| | | import {ElMessage, ElMessageBox} from 'element-plus' |
| | | import {useI18n} from 'vue-i18n' |
| | | const router = useRouter() |
| | | const adda = ref(false) |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import request from "@/utils/request" |
| | | import { ref, onMounted , onBeforeUnmount,onUnmounted} from "vue"; |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | // import { ref } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | // import LanguageMixin from './lang/LanguageMixin' |
| | | import { useI18n } from 'vue-i18n' |
| | | const { t } = useI18n() |
| | | let language = ref(localStorage.getItem('lang') || 'zh') |
| | | |
| | | const {t} = useI18n() |
| | | let language = ref(localStorage.getItem('lang') || 'zh') |
| | | const tableData = ref([]) |
| | | const blindb = ref(false) |
| | | const slot = ref('') |
| | | const requestData = { |
| | | line: 2001 |
| | | }; |
| | | const now = new Date(); |
| | | const timeRange = ref([new Date(now.setHours(0, 0, 0, 0)), new Date(now.setHours(23, 59, 59, 999))]) |
| | | const requestData = { |
| | | line: 2001 |
| | | }; |
| | | const timeRange = ref([]) |
| | | const selectValuesa = reactive([]); |
| | | // request.post("/cacheGlass/taskCache/selectEdgTask",{ |
| | | // ...requestData, |
| | | |
| | | // }).then((res) => { |
| | | // if (res.code == 200) { |
| | | |
| | | // console.log(res.data); |
| | | // tableData.value = res.data |
| | | // console.log(res.data[0].slot); |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | |
| | | // } |
| | | // }); |
| | | |
| | | // 磨边任务查询 |
| | | const setEdgGlassInfoRequest = async () => { |
| | | let celllist=[] |
| | |
| | | stateList=[selectValuesa[1]]; |
| | | } |
| | | } |
| | | |
| | | |
| | | const response = await request.post("/cacheGlass/edgGlassTaskInfo/setEdgGlassInfoRequest", { |
| | | cellList: celllist, |
| | | stateList: stateList, |
| | |
| | | } else { |
| | | ElMessage.error(response.message); |
| | | } |
| | | |
| | | } |
| | | |
| | | // 破损 |
| | | const open = async(row) => { |
| | | try { |
| | |
| | | type: 'warning', |
| | | } |
| | | ); |
| | | if (confirmResult === 'confirm') { |
| | | // 用户点击了“是”,现在调用删除接口 |
| | | if (confirmResult === 'confirm') { |
| | | const response = await request.post("/cacheGlass/edgStorageCage/edgReportStatus", { |
| | | glassId: row.glassId, |
| | | state: 8, |
| | | line: row.line, |
| | | workingProcedure: '冷加工', |
| | | workingProcedure: '磨边', |
| | | }) |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | | } else { |
| | | // 删除失败,您可以处理错误或显示错误信息给用户 |
| | | } else { |
| | | ElMessage.error(response.msg); |
| | | // alert('删除失败:' + deleteResponse.message); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | // 处理可能出现的错误,比如 ElMessageBox 抛出的异常等 |
| | | console.error('发生错误:', error); |
| | | } catch (error) { |
| | | } |
| | | }; |
| | | // 拿走 |
| | |
| | | type: 'warning', |
| | | } |
| | | ); |
| | | if (confirmResult === 'confirm') { |
| | | // 用户点击了“是”,现在调用删除接口 |
| | | if (confirmResult === 'confirm') { |
| | | const response = await request.post("/cacheGlass/edgStorageCage/edgReportStatus", { |
| | | glassId: row.glassId, |
| | | state: 9, |
| | | line: row.line, |
| | | workingProcedure: '冷加工', |
| | | workingProcedure: '磨边', |
| | | }) |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | | } else { |
| | | // 删除失败,您可以处理错误或显示错误信息给用户 |
| | | } else { |
| | | ElMessage.error(response.msg); |
| | | // alert('删除失败:' + deleteResponse.message); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | // 处理可能出现的错误,比如 ElMessageBox 抛出的异常等 |
| | | console.error('发生错误:', error); |
| | | } catch (error) { |
| | | } |
| | | }; |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/edgTasks`; |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | tableData.value = data.edgTasks[0] |
| | | const formattedTasks = data.edgTasks[0].map(cageInfo => { |
| | | if (cageInfo && cageInfo.createTime) { |
| | | cageInfo.formattedCreateTime = formatTimestamp(cageInfo.createTime); |
| | | } |
| | | return cageInfo; |
| | | }); |
| | | tableData.value = formattedTasks |
| | | }; |
| | | // 历史任务 |
| | | const iframeUrl = ref(''); |
| | | const handlehistorical = (row) => { |
| | | blindb.value = true; |
| | | iframeUrl.value = `${window.location.origin}/#/StockBasicData/stockhistory`; |
| | | }; |
| | | onMounted(() => { |
| | | socket = initializeWebSocket(socketUrl, handleMessage); |
| | | }); |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | closeWebSocket(socket); |
| | | } |
| | | }); |
| | | }); |
| | | function getStatusTypeb(state) { |
| | | switch (state) { |
| | | case 0: |
| | | return 'info'; |
| | | case 1: |
| | | return 'success'; |
| | | case 1: |
| | | return 'danger'; |
| | | } |
| | | } |
| | | function getStatusTextb(state) { |
| | | switch (state) { |
| | | case 0: |
| | | return t('workOrder.nedging'); |
| | | case 1: |
| | | return t('workOrder.edging'); |
| | | case 2: |
| | | return t('workOrder.finedging'); |
| | | } |
| | | } |
| | | 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}`; |
| | | } |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | }); |
| | | </script> |
| | | <template> |
| | | <div> |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading"> |
| | | <el-select v-model="selectValuesa[0]" filterable :placeholder="$t('请选择线路')" clearable> |
| | | <el-option label="磨边一线" value="2001"></el-option> |
| | | <el-option label="磨边二线" value="2002"></el-option> |
| | | <div style="height: 500px;"> |
| | | <div> |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" > |
| | | <div style="display: flex;"> |
| | | <!-- <el-button style="margin-left: 20px;" id="searchButton" type="success" @click="handlehistorical">{{ |
| | | $t('searchOrder.historicaltasks') |
| | | }} |
| | | </el-button> --> |
| | | <el-select v-model="selectValuesa[0]" filterable :placeholder="$t('workOrder.cway')" clearable |
| | | style="margin-left: 20px;margin-bottom: 10px;"> |
| | | <el-option :label="$t('workOrder.edgingone')" value="930"></el-option> |
| | | <el-option :label="$t('workOrder.edgingtwo')" value="931"></el-option> |
| | | </el-select> |
| | | <el-select v-model="selectValuesa[1]" filterable :placeholder="$t('workOrder.cstate')" clearable |
| | | style="margin-left: 20px;margin-bottom: 10px;"> |
| | | <el-option :label="$t('workOrder.nedging')" value="0"></el-option> |
| | | <el-option :label="$t('workOrder.edging')" value="1"></el-option> |
| | | <el-option :label="$t('workOrder.finedging')" value="2"></el-option> |
| | | </el-select> |
| | | |
| | | <el-select v-model="selectValuesa[1]" filterable :placeholder="$t('请选择状态')" clearable > |
| | | <el-option label="未磨边" value="0"></el-option> |
| | | <el-option label="磨边中" value="1"></el-option> |
| | | <el-option label="已磨边" value="2"></el-option> |
| | | </el-select> |
| | | <span class="demonstration">时间段</span> |
| | | <el-date-picker v-model="timeRange" type="datetimerange" range-separator="至" start-placeholder="开始日期" |
| | | end-placeholder="结束日期"> |
| | | <span class="demonstration" style="margin-left: 20px;margin-top: 3px;">{{ $t('workOrder.time') }}</span> |
| | | <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-button type="primary" style="margin-left: 10px;" @click="setEdgGlassInfoRequest()">{{ |
| | | <el-button type="primary" style="margin-left: 10px;margin-bottom: 10px;" @click="setEdgGlassInfoRequest()">{{ |
| | | $t('reportmanage.inquire') |
| | | }}</el-button> |
| | | |
| | | </div> |
| | | <div style="width: 98%; height: calc(100% - 35px); overflow-y: auto;"> |
| | | <el-table height="750" ref="table" |
| | | @selection-change="handleSelectionChange" |
| | |
| | | <el-table-column prop="width" align="center" :label="$t('workOrder.width')" min-width="120" /> |
| | | <el-table-column prop="height" align="center" :label="$t('workOrder.height')" min-width="80" /> |
| | | <el-table-column prop="thickness" align="center" :label="$t('workOrder.thickness')" min-width="120" /> |
| | | <el-table-column prop="glassType" align="center" :label="$t('workOrder.glasstype')" min-width="120" /> |
| | | <el-table-column prop="filmsid" align="center" :label="$t('workOrder.glasstype')" min-width="120" /> |
| | | <el-table-column prop="line" align="center" :label="$t('workOrder.line')" min-width="120" /> |
| | | <el-table-column prop="status" :label="$t('workOrder.status')" align="center" width="200"> |
| | | <template #default="scope"> |
| | | <el-table-column prop="formattedCreateTime" align="center" :label="$t('workOrder.time')" min-width="120" /> |
| | | <el-table-column prop="state" :label="$t('workOrder.status')" align="center" width="200"> |
| | | <!-- <template #default="scope"> |
| | | {{ scope.row.status==0?"未磨边":scope.row.status==1?"磨边中":"已磨边" }} |
| | | </template> |
| | | </template> --> |
| | | <template #default="scope"> |
| | | <el-tag :type="getStatusTypeb(scope.row.state)"> |
| | | {{ getStatusTextb(scope.row.state) }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | |
| | | |
| | | <el-table-column fixed="right" :label="$t('workOrder.operate')" align="center" width="200"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" type="text" plain @click="open(scope.row)">{{ $t('workOrder.breakage') }}</el-button> |
| | | <el-button size="mini" type="text" plain @click="opena(scope.row)">{{ $t('workOrder.takeout') }}</el-button> |
| | | <el-button type="text" plain @click="open(scope.row)">{{ |
| | | $t('workOrder.breakage') |
| | | }} |
| | | </el-button> |
| | | <el-button type="text" plain @click="opena(scope.row)">{{ |
| | | $t('workOrder.takeout') |
| | | }} |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </el-card> |
| | | </el-card> |
| | | </div> |
| | | <!-- 历史任务 --> |
| | | <el-dialog v-model="blindb" top="10vh" width="95%" @close="iframeUrl=''"> |
| | | <iframe |
| | | :src="iframeUrl" |
| | | marginwidth="2000px" |
| | | marginheight="2000px" |
| | | width="100%" |
| | | height="700px" |
| | | frameborder="0" |
| | | ></iframe> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | #dt { display:block; float:left;line-height: 20px;margin-left: 100px;} |
| | | #dta { display:block; float:left;line-height: 20px;margin-left: 80%;} |