From 1ad241932bf44eb214b6eb1104e4cae0ffd3e3fc Mon Sep 17 00:00:00 2001 From: wxw <Administrator@DESKTOP-5BIMHQ3> Date: 星期五, 27 九月 2024 15:32:23 +0800 Subject: [PATCH] 修改页面样式 --- Web/src/views/device/deviceInfo/index.vue | 56 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 48 insertions(+), 8 deletions(-) diff --git a/Web/src/views/device/deviceInfo/index.vue b/Web/src/views/device/deviceInfo/index.vue index e6526f7..c43003f 100644 --- a/Web/src/views/device/deviceInfo/index.vue +++ b/Web/src/views/device/deviceInfo/index.vue @@ -1,5 +1,5 @@ <template> - <div class="sys-user-container"> + <div class="sys-user-container" style="overflow: hidden;"> <el-row> <el-col :span="3"> <el-collapse v-model="activeName"> @@ -19,6 +19,10 @@ <el-card class="box-card" shadow="hover" style="margin-top: 3px;"> <el-switch v-model="state.boDemo" active-text="" inactive-text="婕旂ず妯″紡" @change="handleSwitchChange('boDemo', $event)"></el-switch> + </el-card> + <el-card class="box-card" shadow="hover" style="margin-top: 3px;"> + <el-switch v-model="state.boDrumReversal" active-text="" inactive-text="婊氬姩鍙嶈浆" + @change="handleSwitchChange('boDrumReversal', $event)"></el-switch> </el-card> </el-collapse-item> @@ -81,6 +85,7 @@ import { listStatus, listPosition } from '/@/api/wcs/wcsPlc'; import { signalR } from './signalR'; import { cellsDataLine, cellsDataOne, cellsDataTwo, cellsDataThree } from './data'; +import { ElMessage } from "element-plus"; const state = ref<any>({}); const stackers = ref<any>({}); @@ -90,7 +95,7 @@ var res = await listStatus(); state.value = res.data.result.modService; stackers.value = res.data.result.listPlc.filter(s => s.type == 0); - conveyors.value = res.data.result.listPlc.filter(s => s.type == 1 || s.type == 4); + conveyors.value = res.data.result.listPlc.filter(s => s.type == 1); var res2 = await listPosition(); res2.data.result.forEach(s => { @@ -100,6 +105,7 @@ if (foundCell) { //淇敼楂樺害 foundCell.BoxHeight = s.boxHeight; + foundCell.EndLocat = s.endLocat; } } else if (s.type == 1) { @@ -135,6 +141,12 @@ signalR.off('UpdateService'); signalR.on('UpdateService', (data: any) => { state.value = data; + if (data.error) { + ElMessage({ + message: data.error, + type: "error", + }); + } }); signalR.off('PublicPosition'); signalR.on('PublicPosition', (data: any) => { @@ -147,19 +159,47 @@ } else if (data.type == 0) { // 鏇存柊鍫嗗灈鏈烘暟鎹� - const foundCell = cellsDataLine.value.find(cell => cell.Code === data.stationNum); - if (foundCell) { - //淇敼楂樺害 - foundCell.BoxHeight = data.boxHeight; - } + updateStacker(data) + // const foundCell = cellsDataLine.value.find(cell => cell.Code === data.stationNum); + // if (foundCell) { + // //淇敼楂樺害 + // foundCell.BoxHeight = data.boxHeight; + // } } }); }); const handleSwitchChange = (field: string, value: boolean) => { const param = { [field]: value }; - debugger; signalR.invoke('UpdateService', param); }; +//鏇存柊鍫嗗灈鏈� +// updateStacker({ stationNum: '10', boxHeight: 200 }) +function updateStacker(data: any) { + debugger; + const foundCell = cellsDataLine.value.find(cell => cell.Code === data.stationNum); + if (foundCell) { + foundCell.EndLocat = data.endLocat; + const startHeight = foundCell.BoxHeight; + const targetHeight = data.boxHeight; + const duration = 1000; // 鍔ㄧ敾鎸佺画鏃堕棿锛堟绉掞級 + const interval = 50; // 鏇存柊闂撮殧锛堟绉掞級 + const step = (targetHeight - startHeight) / (duration / interval); + + const update = () => { + if ((step > 0 && foundCell.BoxHeight < targetHeight) || (step < 0 && foundCell.BoxHeight > targetHeight)) { + foundCell.BoxHeight += step; + if ((step > 0 && foundCell.BoxHeight >= targetHeight) || (step < 0 && foundCell.BoxHeight <= targetHeight)) { + foundCell.BoxHeight = targetHeight; // 纭繚鏈�缁堝�煎噯纭� + clearInterval(timer); + } + } else { + clearInterval(timer); + } + }; + + const timer = setInterval(update, interval); + } +} // 鏇存柊杈撻�佺嚎鏁版嵁鐨勯�氱敤鍑芥暟 function updateCellData(cellsData: any[], data: any) { -- Gitblit v1.8.0