| | |
| | | <script lang="ts" 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" |
| | | const router = useRouter() |
| | | import type { TableColumnCtx } from 'element-plus' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import { useI18n } from 'vue-i18n' |
| | | const { t } = useI18n() |
| | | import { WebSocketHost ,host} from '@/utils/constants' |
| | | import {ElMessage} from 'element-plus' |
| | | import {useI18n} from 'vue-i18n' |
| | | import {host, WebSocketHost} from '@/utils/constants' |
| | | import request from "@/utils/request" |
| | | import { initializeWebSocket, closeWebSocket } from '@/utils/WebSocketService'; |
| | | import { ref, onMounted, onUnmounted, onBeforeUnmount } from "vue"; |
| | | import {closeWebSocket, initializeWebSocket} from '@/utils/WebSocketService'; |
| | | |
| | | const router = useRouter() |
| | | const {t} = useI18n() |
| | | const selectValuesa = reactive([]); |
| | | const selectedProjectNo = ref(''); // 当前选中的工程号 |
| | | const loadingline = ref(''); // 当前选中的上片线 |
| | |
| | | }; |
| | | const selectproject = () => { |
| | | dialogFormVisible.value = true; |
| | | selectgong(); |
| | | }; |
| | | |
| | | |
| | | onMounted(() => { |
| | | // socket = initializeWebSocket(socketUrl, handleMessage); |
| | | socket = initializeWebSocket(socketUrl, handleMessage); |
| | | }); |
| | | const handleMessage = (data) => { |
| | | |
| | | } |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | | closeWebSocket(socket); |
| | |
| | | }); |
| | | //定义接收加载表头下拉数据 |
| | | const titleSelectJson = ref({ |
| | | processType: [], |
| | | }) |
| | | const titleSelectJsona = ref({ |
| | | processTypea: [], |
| | | engineerId: [], |
| | | }) |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/loadGlass`; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/uploadGlass`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | |
| | | const requestData = { |
| | | state: 100 |
| | | }; |
| | | |
| | | |
| | | onBeforeUnmount(() => { |
| | | closeWebSocket(); |
| | | }); |
| | | const selectgong = async () => { |
| | | try { |
| | | const response = await request.post('/loadGlass/engineering/engineering/selectTask') |
| | | if (response.code == 200) { |
| | | titleSelectJson.value.engineerId = response.data; |
| | | } else { |
| | | ElMessage.error(response.message); |
| | | } |
| | | } catch (error) { |
| | | // 处理错误 |
| | | console.error(error); |
| | | } |
| | | } |
| | | // 添加 |
| | | const handleBindRack = (row) => { |
| | | workstationId.value = row.workstationId; // 假设rackNumber是架号字段的属性名 |
| | | ida.value = row.id; |
| | | add.value = true; // 打开绑定架子对话框 |
| | | }; |
| | | // 暂停 |
| | | const handlea = async () => { |
| | | try { |
| | | let engineeringId = window.localStorage.getItem('engineeringId') |
| | | console.log(engineeringId); |
| | | if (engineeringId !== '') { |
| | | const response = await request.post('/loadGlass/engineering/engineering/pauseTask', { |
| | | engineeringId: engineeringId, |
| | | state: 0, |
| | | }) |
| | | if (response.code == 200) { |
| | | ElMessage.success(response.message); |
| | | blinda.value = false; |
| | | // tableData.splice([]); |
| | | } else { |
| | | // 请求失败,显示错误消息 |
| | | ElMessage.error(response.message); |
| | | } |
| | | } |
| | | else { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('basicData.infonull'), |
| | | }) |
| | | } |
| | | } |
| | | catch (error) { |
| | | // 处理错误 |
| | | console.error(error); |
| | | } |
| | | } |
| | | |
| | | function getStatusText(state: number) { |
| | | switch (state) { |
| | | case 0: |
| | | case 0: |
| | | return t('basicData.waiting'); |
| | | case 1: |
| | | case 1: |
| | | return t('basicData.up'); |
| | | case 2: |
| | | return t('basicData.up'); |
| | | case 2: |
| | | return t('basicData.up'); |
| | | case 100: |
| | | return t('basicData.finish'); |
| | | } |
| | |
| | | blindb.value = true; |
| | | }; |
| | | |
| | | // 删除 |
| | | const handleBindRacka = (row) => { |
| | | workstationId.value = row.workstationId; |
| | | adda.value = true; |
| | | }; |
| | | |
| | | const toggleEnableState = async (row: any) => { |
| | | // 检查 id 是否为空 |
| | | if (!row.id) { |
| | |
| | | :placeholder="$t('basicData.plselectproject')" |
| | | style="width: 220px" |
| | | @input="handleInputChange" |
| | | > |
| | | <el-option |
| | | v-for="item in titleSelectJson['processType']" |
| | | :key="item.id" |
| | | :label="item.projectNo" |
| | | :value="item.projectNo" |
| | | /> |
| | | > |
| | | <el-option |
| | | v-for="item in titleSelectJson['engineerId']" |
| | | :key="item.id" |
| | | :label="item.engineerId" |
| | | :value="item.engineerId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </div> |