| | |
| | | import { useI18n } from 'vue-i18n' |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | |
| | | let language = ref(localStorage.getItem('lang') || 'zh') |
| | | const { t } = useI18n() |
| | | const requestData = reactive({ |
| | |
| | | onMounted(async () => { |
| | | //使用WebSocket方式展示数据 |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | |
| | | //使用接口方式展示数据 |
| | | //load(); |
| | | }); |
| | | |
| | | // //获取数据 |
| | | // const load = async() => { |
| | | // //获取设备任务数据 |
| | | // try { |
| | | // const response = await request.post('/deviceInteraction/tasking/findMachineTask', |
| | | // { |
| | | // "id": 11 |
| | | // }); // 替换为你的API端点 |
| | | // if (response.code === 200) { |
| | | // loadData.value.findTaskingData= response.data; |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rects :', error); |
| | | // } |
| | | // //获取设备状态 |
| | | // try { |
| | | // const response = await request.post('/deviceInteraction/machine/findMachine', |
| | | // { |
| | | // "id": 11 |
| | | // }); // 替换为你的API端点 |
| | | // if (response.code === 200) { |
| | | // findMachine.value= response.data; |
| | | // } else { |
| | | // ElMessage.warning(res.msg) |
| | | // } |
| | | // } catch (error) { |
| | | // // console.error('Error fetching rects :', error); |
| | | // } |
| | | // } |
| | | //修改工作状态 【失败/正在工作/完工】 |
| | | const workStatus = async(row,state) => { |
| | | let url; |
| | |
| | | return; |
| | | } |
| | | ElMessageBox.confirm( |
| | | t('marking.tips'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('marking.sure'), |
| | | cancelButtonText: t('marking.cancel'), |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('marking.cancel'), |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | |
| | |
| | | //开工/暂停 |
| | | const machineStatus = async(state) => { |
| | | ElMessageBox.confirm( |
| | | t('marking.tips'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('marking.sure'), |
| | | cancelButtonText: t('marking.cancel'), |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('marking.cancel'), |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //破损 |
| | | const damagedTask = async(row) => { |
| | | ElMessageBox.confirm( |
| | | t('marking.tips'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('marking.sure'), |
| | | cancelButtonText: t('marking.cancel'), |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('marking.cancel'), |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //下线(拿走) |
| | | const glassDownLine = async(row) => { |
| | | ElMessageBox.confirm( |
| | | t('marking.tips'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('marking.sure'), |
| | | cancelButtonText: t('marking.cancel'), |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('marking.cancel'), |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | |
| | | <br> |
| | | <div id="search" > |
| | | <!-- 功能 --> |
| | | <el-button type="primary" id="ButtonMachineStatus" @click="machineStatus((findMachine['state']=='暂停'?'开工':'暂停'))">{{findMachine['state']=='开工'?$t('functionState.start'):$t('functionState.stop')}}</el-button> |
| | | <el-button :type="(findMachine['state']=='暂停'?'danger':'success')" id="ButtonMachineStatus" |
| | | @click="machineStatus((findMachine['state']=='暂停'?'开工':'暂停'))"> |
| | | {{findMachine['state']=='开工'?$t('functionState.start'):$t('functionState.stop')}}</el-button> |
| | | <el-button type="primary" id="ButtonTopLine" @click="topLine">{{$t('functionState.topLine')}}</el-button> |
| | | <!-- <el-button type="primary" id="searchButton" @click="downLine('下线')">下线</el-button> |
| | | <el-button type="primary" id="searchButton" @click="workStatus('破损')">破损</el-button> |