| | |
| | | const adda = ref(false) |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import request from "@/utils/request" |
| | | import { ref, onMounted , onBeforeUnmount} from "vue"; |
| | | 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 tableData = ref([]) |
| | | const slot = ref('') |
| | |
| | | }); |
| | | // 破损 |
| | | 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') { |
| | | // 用户点击了“是”,现在调用删除接口 |
| | | const response = await request.post("/cacheGlass/edgStorageCage/edgReportStatus", { |
| | | glassId: row.GlassId, |
| | | controlsId: 300 |
| | | controlsId: 300, |
| | | line: 2002, |
| | | machine: '冷加工', |
| | | }) |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | |
| | | }; |
| | | // 拿走 |
| | | 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') { |
| | | // 用户点击了“是”,现在调用删除接口 |
| | | const response = await request.post("/cacheGlass/edgStorageCage/edgReportStatus", { |
| | | glassId: row.GlassId, |
| | | controlsId: 301 |
| | | controlsId: 301, |
| | | line: 2002, |
| | | machine: '冷加工', |
| | | }) |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | |
| | | console.error('发生错误:', error); |
| | | } |
| | | }; |
| | | |
| | | |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/cacheGlass/api/talk/cacheGlass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | 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(); |
| | |
| | | <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-column prop="GlassId" align="center" :label="$t('workOrder.glassID')" min-width="180" /> |
| | | <el-table-column prop="Height" align="center" :label="$t('workOrder.height')" min-width="80" /> |
| | | <el-table-column prop="Width" align="center" :label="$t('workOrder.width')" min-width="120" /> |
| | | <el-table-column prop="Thickness" align="center" :label="$t('workOrder.thickness')" min-width="120" /> |
| | | <el-table-column prop="FilmsId" align="center" :label="$t('workOrder.coatingtypes')" min-width="120" /> |
| | | <el-table-column prop="SerialNumber" align="center" :label="$t('workOrder.productionsequence')" min-width="120" /> |
| | | <el-table-column prop="FlowCardId" align="center" :label="$t('workOrder.cardnumber')" 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 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> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |