| | |
| | | <script setup> |
| | | import {Search} from "@element-plus/icons-vue"; |
| | | import {reactive} from "vue"; |
| | | import {onBeforeUnmount, onMounted, onUnmounted, 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 request from "@/utils/request" |
| | | import { ref, onMounted , onBeforeUnmount} from "vue"; |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | // import { ref } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | // import LanguageMixin from './lang/LanguageMixin' |
| | | |
| | | const {t} = useI18n() |
| | | let language = ref(localStorage.getItem('lang') || 'zh') |
| | | const tableData = ref([]) |
| | | const slot = ref('') |
| | | const requestData = { |
| | | const requestData = { |
| | | line: 2002 |
| | | }; |
| | | 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 open = async(row) => { |
| | | try { |
| | | try { |
| | | const confirmResult = await ElMessageBox.confirm( |
| | | '是否破损该条信息?', |
| | | '提示', |
| | | t('workOrder.messagedamaged'), |
| | | t('workOrder.prompt'), |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | confirmButtonText: t('workOrder.yes'), |
| | | cancelButtonText: t('workOrder.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ); |
| | | if (confirmResult === 'confirm') { |
| | | // 用户点击了“是”,现在调用删除接口 |
| | | } |
| | | ); |
| | | if (confirmResult === 'confirm') { |
| | | const response = await request.post("/cacheGlass/edgStorageCage/edgReportStatus", { |
| | | glassId: row.GlassId, |
| | | controlsId: 300 |
| | | glassId: row.glass_id, |
| | | controlsId: 8, |
| | | line: 2002, |
| | | machine: '冷加工', |
| | | }) |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | | } else { |
| | | // 删除失败,您可以处理错误或显示错误信息给用户 |
| | | } else { |
| | | ElMessage.error(response.msg); |
| | | // alert('删除失败:' + deleteResponse.message); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | // 处理可能出现的错误,比如 ElMessageBox 抛出的异常等 |
| | | } catch (error) { |
| | | console.error('发生错误:', error); |
| | | } |
| | | }; |
| | | // 拿走 |
| | | const opena = async(row) => { |
| | | try { |
| | | try { |
| | | const confirmResult = await ElMessageBox.confirm( |
| | | '是否拿走该条信息?', |
| | | '提示', |
| | | t('workOrder.takemessage'), |
| | | t('workOrder.prompt'), |
| | | { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | confirmButtonText: t('workOrder.yes'), |
| | | cancelButtonText: t('workOrder.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ); |
| | | if (confirmResult === 'confirm') { |
| | | // 用户点击了“是”,现在调用删除接口 |
| | | } |
| | | ); |
| | | if (confirmResult === 'confirm') { |
| | | const response = await request.post("/cacheGlass/edgStorageCage/edgReportStatus", { |
| | | glassId: row.GlassId, |
| | | controlsId: 301 |
| | | glassId: row.glass_id, |
| | | controlsId: 9, |
| | | line: 2002, |
| | | machine: '冷加工', |
| | | }) |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | | } else { |
| | | // 删除失败,您可以处理错误或显示错误信息给用户 |
| | | } else { |
| | | ElMessage.error(response.msg); |
| | | // alert('删除失败:' + deleteResponse.message); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | // 处理可能出现的错误,比如 ElMessageBox 抛出的异常等 |
| | | console.error('发生错误:', error); |
| | | } |
| | | }; |
| | | |
| | | |
| | | const socketUrl = `ws://10.153.19.150:88/api/cacheGlass/api/talk/cacheGlass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlass`; |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | tableData.value = data.EdgTasks2[0] |
| | | }; |
| | | // 初始化 WebSocket,并传递消息处理函数 |
| | | onMounted(() => { |
| | | // fetchFlowCardId(); |
| | | // fetchTableData(); // 获取数据 |
| | | initializeWebSocket(socketUrl, handleMessage); |
| | | socket = initializeWebSocket(socketUrl, handleMessage); |
| | | }); |
| | | |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | | } |
| | | }); |
| | | onBeforeUnmount(() => { |
| | | console.log("关闭了") |
| | | closeWebSocket(); |
| | | }); |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <el-card style="flex: 1;margin-left: 10px;margin-top: 20px;" v-loading="loading"> |
| | | <div style="height: 500px;"> |
| | | <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="240" ref="table" |
| | | @selection-change="handleSelectionChange" |
| | | :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"> |
| | | <el-table-column prop="GlassId" align="center" label="玻璃id" min-width="180" /> |
| | | <el-table-column prop="Height" align="center" label="高" min-width="80" /> |
| | | <el-table-column prop="Width" align="center" label="宽" min-width="120" /> |
| | | <el-table-column prop="Thickness" align="center" label="厚度" min-width="120" /> |
| | | <el-table-column prop="FilmsId" align="center" label="膜系" min-width="120" /> |
| | | <el-table-column prop="SerialNumber" align="center" label="出片顺序" min-width="120" /> |
| | | <el-table-column prop="FlowCardId" align="center" label="流程卡号" min-width="120" /> |
| | | <el-table-column fixed="right" label="操作" align="center" width="200"> |
| | | <el-table height="750" ref="table" |
| | | @selection-change="handleSelectionChange" |
| | | :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"> |
| | | <el-table-column prop="glass_id" align="center" :label="$t('workOrder.glassID')" min-width="180"/> |
| | | <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="glass_type" align="center" :label="$t('workOrder.glasstype')" min-width="120"/> |
| | | <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)">破损</el-button> |
| | | <el-button size="mini" type="text" plain @click="opena(scope.row)">拿走</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> |
| | |
| | | </el-card> |
| | | </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%;} |
| | | #dialog-footer{ |