| | |
| | | import request from "@/utils/request" |
| | | import { closeWebSocket, initializeWebSocket } from '@/utils/WebSocketService'; |
| | | const router = useRouter() |
| | | const { t } = useI18n() |
| | | const { t } = useI18n(); |
| | | const selectValuesa = reactive([]); |
| | | const selectedProjectNo = ref(''); |
| | | const stationCell = ref('1'); |
| | |
| | | const blindbd = ref(false) |
| | | const canSelectProjecta = ref(true); |
| | | const canSelectProjectb = ref(true); |
| | | const canSelectProjectc = ref(false); |
| | | const canSelectProjectc = ref(true); |
| | | const tableDatad = ref([]) |
| | | const upstatus = ref(t('basicData.machineaa')); |
| | | const cuttingMachineStatusColor = ref('#911005'); |
| | |
| | | const tableDatab = ref<any[]>([]); |
| | | const tableData = ref([]) |
| | | |
| | | // 暂停按钮 |
| | | const isPaused = ref(false); // 暂停状态标识:false=未暂停(显示“暂停”),true=已暂停(显示“启动”) |
| | | // 取消(恢复)时的弹窗显隐 |
| | | const resumeDialogVisible = ref(false); |
| | | // 存储后端返回的state=5的工程列表 |
| | | const pauseEngineeringList = ref([]); |
| | | // 检查是否有正在执行中的任务 |
| | | const hasRunningTask = ref(false); |
| | | |
| | | const dialogFormVisiblea = ref(false) |
| | | |
| | | function getTagType(state) { |
| | | switch(state) { |
| | | case 100: return 'success'; // 100=通过(绿色) |
| | | case 101: return 'danger'; // 101=执行中(红色) |
| | | default: return 'warning'; // 其他=待处理(橙色) |
| | | } |
| | | } |
| | | |
| | | // 动态获取标签文本(支持国际化) |
| | | function getTagText(state) { |
| | | switch(state) { |
| | | case 100: return t('Mounting.pass'); // 通过 |
| | | case 101: return t('film.execution'); // 执行中 |
| | | default: return t('Mounting.waiting'); // 待处理 |
| | | } |
| | | } |
| | | |
| | | const titleSelectJson = ref({ |
| | | engineerId: [], |
| | |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/loadGlass/api/talk/loadGlassOne`; |
| | | const handleMessage = (data: any) => { |
| | | if (data.engineering != null) { |
| | | isPaused.value = false; |
| | | } |
| | | if (data.inkageState != null) { |
| | | cuttingMachineStatusColor.value = data.inkageState[0] === 1 ? 'green' : '#911005'; |
| | | } |
| | |
| | | } else { |
| | | tableDataa.value = [] |
| | | } |
| | | canSelectProjectc.value = true; |
| | | canSelectProjecta.value = false; |
| | | canSelectProjectb.value = false; |
| | | tableData.value = []; |
| | | window.localStorage.setItem('engineeringIda', ''); |
| | | if (data.upPattenUsages.length != 0) { |
| | | tableData.value = data.upPattenUsages[0] |
| | | window.localStorage.setItem('engineeringIda', tableData.value[0].engineeringId) |
| | | canSelectProjecta.value = false; |
| | | canSelectProjectb.value = false; |
| | | canSelectProjectc.value = true; |
| | | if (tableData.value.length > 0) { |
| | | window.localStorage.setItem('engineeringIda', tableData.value[0].engineeringId); |
| | | } |
| | | hasRunningTask.value = tableData.value.some(task => task.state === 101); |
| | | console.log(hasRunningTask); |
| | | |
| | | // canSelectProjectc.value = !hasRunningTask; |
| | | } |
| | | else { |
| | | hasRunningTask.value = false; |
| | | canSelectProjecta.value = true; |
| | | canSelectProjectb.value = true; |
| | | canSelectProjectc.value = false; |
| | | tableData.value = []; |
| | | window.localStorage.setItem('engineeringIda', '') |
| | | } |
| | |
| | | // 暂停 |
| | | const handleup = async () => { |
| | | try { |
| | | let filmRemove = window.localStorage.getItem('filmRemove') |
| | | let engineeringId = window.localStorage.getItem('engineeringIda') |
| | | const filmRemove = window.localStorage.getItem('filmRemove') |
| | | let engineeringId; |
| | | const currentEngineering = pauseEngineeringList.value[0]; |
| | | if (currentEngineering) { |
| | | // 从选中的工程中获取ID(取消弹窗中选择的工程) |
| | | engineeringId = currentEngineering.engineerId; |
| | | } else { |
| | | // 使用本地缓存的工程ID(暂停弹窗的场景) |
| | | engineeringId = window.localStorage.getItem('engineeringIda'); |
| | | } |
| | | if (engineeringId !== '') { |
| | | const response = await request.post('/loadGlass/engineering/engineering/pause', { |
| | | stationCell: 5, |
| | | filmRemove: filmRemove, |
| | | engineerId: engineeringId, |
| | | state: 0, |
| | | state: isPaused.value ? 1 : 5 |
| | | }) |
| | | if (response.code == 200) { |
| | | if (response.code == 200) { |
| | | // 切换暂停/启动状态 |
| | | isPaused.value = !isPaused.value; |
| | | ElMessage.success(response.message); |
| | | blinda.value = false; |
| | | resumeDialogVisible.value = false; |
| | | } else { |
| | | ElMessage.error(response.message); |
| | | } |
| | |
| | | |
| | | |
| | | // 暂停 |
| | | const handleBinda = (row) => { |
| | | blinda.value = true; |
| | | const handleBinda = async () => { |
| | | if (!isPaused.value) { |
| | | // 情况1:当前是“暂停”状态→打开暂停确认弹窗 |
| | | blinda.value = true; |
| | | } else { |
| | | // 情况2:当前是“取消”状态→打开新增弹窗,并查询state=5的工程 |
| | | try { |
| | | // 调用后端查询state=5的工程接口 |
| | | const response = await request.get('/loadGlass/engineering/engineering/selectTask'); |
| | | if (response.code === 200) { |
| | | pauseEngineeringList.value = response.data; // 存储工程列表 |
| | | resumeDialogVisible.value = true; // 打开新增弹窗 |
| | | } else { |
| | | ElMessage.error(t('film.fail') + response.message); |
| | | } |
| | | } catch (error) { |
| | | console.error('查询暂停工程异常:', error); |
| | | ElMessage.error(t('film.fail') + '查询失败,请重试'); |
| | | } |
| | | } |
| | | }; |
| | | |
| | | // 是否禁用 |
| | | const toggleEnableState = async (row: any) => { |
| | | if (!row.id) { |
| | | if (!row.deviceId) { |
| | | ElMessage.error(t('basicData.updatanull')); |
| | | return; |
| | | } |
| | | const newState = row.state === 100 ? 0 : 100; |
| | | const newState = row.state === 1 ? 0 : 1; |
| | | try { |
| | | const response = await request.post('/loadGlass/up-patten-usage/updateGlassState', { id: row.id, state: newState }); |
| | | var url = "/glassStorage/rawGlassStorageStation/updateSlotState?slot=" + row.slot + "&state=" + newState; |
| | | const response = await request.post(url) |
| | | if (response.code === 200) { |
| | | ElMessage.success(response.message); |
| | | row.state = newState; |
| | | } else { |
| | | ElMessage.error(response.message); |
| | | } |
| | | row.state = newState; |
| | | } catch (error) { |
| | | ElMessage.error(t('basicData.glassnull')); |
| | | } |
| | |
| | | }; |
| | | |
| | | |
| | | // 架子数据对比 (任意一行比匹配都显示红色) |
| | | // 架子数据对比 (每一行都进行比对,不同都显示红色) |
| | | // const tableRowClassName = ({ |
| | | // row, |
| | | // rowIndex: number |
| | |
| | | <el-dialog v-model="dialogFormVisiblea" top="5vh" width="85%"> |
| | | <el-table ref="table" style="margin-top: 20px;height: 700px;" :data="tableDatab" |
| | | :header-cell-style="{ background: '#F2F3F5 ', color: '#1D2129' }"> |
| | | <el-table-column prop="deviceId" fixed align="center" :label="$t('film.station')" min-width="80" /> |
| | | <!-- <el-table-column prop="deviceId" fixed align="center" :label="$t('film.station')" min-width="80" /> --> |
| | | <el-table-column prop="slot" fixed align="center" :label="$t('film.slot')" min-width="80" /> |
| | | <el-table-column prop="patternWidth" align="center" :label="$t('film.width')" min-width="80" /> |
| | | <el-table-column prop="patternHeight" align="center" :label="$t('film.height')" min-width="80" /> |
| | |
| | | <el-table-column fixed="right" :label="$t('film.operate')" align="center" width="270"> |
| | | <template #default="scope"> |
| | | <el-input v-model="inputQuantities[scope.row.slot]" type="number" min="0" @input="handleInput(scope.row)" |
| | | :placeholder="$t('basicData.selectquantity')" :disabled="scope.row.slot > 100" style="width: 120px; margin-right: 10px;"> |
| | | :placeholder="$t('basicData.selectquantity')" v-if ="scope.row.slot < 99" |
| | | style="width: 120px; margin-right: 10px;"> |
| | | </el-input> |
| | | <el-button type="text" :disabled="scope.row.slot > 100" @click="handleBind(scope.row)"> |
| | | <el-button type="text" v-if = "scope.row.slot < 99" :disabled="isPaused || hasRunningTask" @click="handleBind(scope.row)"> |
| | | {{ $t('basicData.startloading') }} </el-button> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | |
| | | <!--暂停--> |
| | | <el-button :disabled="!canSelectProjectc" style="margin-top: 5px;margin-left: 20px;" id="searchButton" |
| | | type="warning" @click="handleBinda">{{ $t('basicData.stop') }}</el-button> |
| | | :type="isPaused ? 'danger' : 'warning'" @click="handleBinda">{{ isPaused ? $t('sorter.cancel') : |
| | | $t('basicData.stop') }}</el-button> |
| | | |
| | | <el-button style="margin-top: 5px;margin-left: 20px;" id="searchButton" type="info" @click="handlehistorical">{{ |
| | | $t('searchOrder.historicaltasks') }}</el-button> |
| | | |
| | | <el-dialog v-model="resumeDialogVisible" top="24vh" width="40%"> |
| | | <!-- 工程列表展示 --> |
| | | <div v-if="pauseEngineeringList.length > 0"> |
| | | <div style="text-align: center; margin-bottom: 10px;"> |
| | | {{ $t('basicData.isEnable')}}{{ pauseEngineeringList[0].engineerId }}{{ $t('basicData.project') }} |
| | | </div> |
| | | </div> |
| | | <!-- 无暂停工程时的提示 --> |
| | | <div v-else class="no-data" style="text-align: center; padding: 20px;"> |
| | | <el-empty description="No pause engineering" /> |
| | | </div> |
| | | |
| | | <!-- 弹窗底部按钮 --> |
| | | <template #footer> |
| | | <div id="dialog-footer"> |
| | | <el-button type="primary" @click="handleup"> |
| | | {{ $t('basicData.confirm') }} |
| | | </el-button> |
| | | <el-button @click="resumeDialogVisible = false">{{ $t('basicData.cancel') }}</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <!-- <el-select disabled v-model="selectValuesa[1]" clearable :placeholder="$t('Mounting.twoloadingline')" |
| | | style="margin-top: 5px;margin-left: 20px;"> |
| | | <el-option :label="$t('Mounting.all')" value="0"></el-option> |
| | |
| | | <el-table-column prop="layoutSequence" :label="$t('Mounting.projectnumber')" align="center" /> |
| | | <el-table-column align="center" :label="$t('Mounting.state')" min-width="80" prop="state"> |
| | | <template #default="scope"> |
| | | <el-tag :type="scope.row.state === 100 ? 'success' : 'warning'" @click="toggleEnableState(scope.row)"> |
| | | {{ scope.row.state === 100 ? $t('Mounting.pass') : $t('Mounting.waiting') }} |
| | | <el-tag :type="getTagType(scope.row.state)"> |
| | | {{ getTagText(scope.row.state) }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | |
| | | <el-table-column prop="remainQuantity" align="center" :label="$t('basicData.quantity')" min-width="80" /> |
| | | <el-table-column prop="patternThickness" align="center" :label="$t('basicData.thickness')" |
| | | min-width="60" /> |
| | | <el-table-column fixed="right" :label="$t('film.operate')" align="center" width="100"> |
| | | <!-- <el-table-column fixed="right" :label="$t('film.operate')" align="center" width="100"> |
| | | <template #default="scope"> |
| | | <el-button :disabled="(!scope.row.patternThickness)" type="text" plain |
| | | @click="handleptask(scope.row.workstationId)">{{ $t('basicData.rackreset') }}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> --> |
| | | </el-table> |
| | | </div> |
| | | </div> |