This commit is contained in:
hzz 2023-12-22 16:53:21 +08:00
parent e65a288533
commit b7fb95ccf3
2 changed files with 107 additions and 65 deletions

View File

@ -259,7 +259,7 @@ const routes: Array<RouteRecordRaw> = [
{ {
path: "/MicroExhibition", path: "/MicroExhibition",
name: "MicroExhibition", name: "MicroExhibition",
component: () => import("../views/MicroExhibition/index.vue"), component: () => import("../views/MicroExhibition/indexOld.vue"),
}, },
{ {
path: "/MicroExhibition/:id", path: "/MicroExhibition/:id",
@ -269,6 +269,11 @@ const routes: Array<RouteRecordRaw> = [
] ]
}, },
{
path: "/CismaExhibition",
name: "CismaExhibition",
component: () => import("../views/MicroExhibition/indexOld.vue"),
},
{ {
path: "/MicroExhibitionTable", path: "/MicroExhibitionTable",
name: "MicroExhibitionTable", name: "MicroExhibitionTable",

View File

@ -47,83 +47,93 @@
</template> </template>
<script setup lang='ts'> <script setup lang='ts'>
import { onMounted, onUnmounted, ref, reactive, watch } from 'vue' import { onMounted, onUnmounted, ref, reactive, watch, computed } from 'vue'
import Border from './components/Border.vue' import Border from './components/Border.vue'
import LeftStatus from './components/LeftStatus.vue' import LeftStatus from './components/LeftStatus.vue'
import Buttons from './components/Buttons.vue' import Buttons from './components/Buttons.vue'
import useNowTime from "@/hook/nowTime"; import useNowTime from "@/hook/nowTime";
import { connectWebsocket, closeWebsocket } from "@/utils/websocket"
let { timeHtml } = useNowTime(); let { timeHtml } = useNowTime();
let timer = null; let timer = null;
let leftStatusObj = { let thatstatus = computed(() => {
'up': { if (second_data.value.IN3||first_data.value.IN3||second_data.value.IN4||first_data.value.IN4) {
name: '上升中', clearInterval(timer)
status: false return ''
},
'down': {
name: '下降中',
status: false
},
'top': {
name: '升到位',
status: true
},
'bottom': {
name: '降到位',
status: false
} }
} if (second_data.value.IN7||first_data.value.IN7) {
let thatstatus = ref('top') return 'up'
} else if (second_data.value.IN8||first_data.value.IN8) {
return 'down'
} else if (second_data.value.IN6) {
return 'top'
} else if (first_data.value.IN6) {
return 'bottom'
}
})
// //
let sec_door = ref(false) let sec_door = computed(() => {
return second_data.value.IN5
})
// //
let fir_door = ref(false) let fir_door = computed(() => {
let sec_floor = reactive([ return first_data.value.IN5
})
/**
* 一二层电梯状态数据
*/
let first_data = ref<any>({})
let second_data = ref<any>({})
let sec_floor = computed(() => {
return [
{ {
name: '上升', name: '上升',
icon: 'icon-shangsheng', icon: 'icon-shangsheng',
status: true status: second_data.value.IN1
}, },
{ {
name: '下降', name: '下降',
icon: 'icon-xiajiang', icon: 'icon-xiajiang',
status: false status: second_data.value.IN2
}, },
{ {
name: '急停', name: '急停',
icon: 'icon-jiting', icon: 'icon-jiting',
status: false status: second_data.value.IN4
}, },
{ {
name: '停止', name: '停止',
icon: 'icon-tingzhi', icon: 'icon-tingzhi',
status: false status: second_data.value.IN3
} }
]) ]
let y_px = ref(0) })
let y_px = ref(680)
let max_px = 680; let max_px = 680;
let min_px = 0; let min_px = 0;
let fir_floor = computed(() => {
let fir_floor = reactive([ return [
{ {
name: '上升', name: '上升',
icon: 'icon-shangsheng', icon: 'icon-shangsheng',
status: true status: first_data.value.IN1
}, },
{ {
name: '下降', name: '下降',
icon: 'icon-xiajiang', icon: 'icon-xiajiang',
status: false status: first_data.value.IN2
}, },
{ {
name: '停止', name: '停止',
icon: 'icon-tingzhi', icon: 'icon-tingzhi',
status: false status: first_data.value.IN3
} }
]) ]
})
watch(() => thatstatus.value, (val) => { watch(() => thatstatus.value, (val) => {
console.log(val)
if (val == 'up') { if (val == 'up') {
elevatorUp('up') elevatorUp('up')
} else if (val == 'down') { } else if (val == 'down') {
@ -162,11 +172,37 @@ function elevatorUp(type) {
} }
function getWebsocket(val) {
try {
let data = JSON.parse(val)
if (data.type == 'liftInfo') {
let msg = data.msg
if (msg.name == 'first') {
first_data.value = msg
} else if (msg.name == 'second') {
second_data.value = msg
}
}
} catch (err) {
console.log(err);
}
}
function errWebsocket(val) {
// console.log(val);
}
onMounted(() => { onMounted(() => {
connectWebsocket(null, null, getWebsocket, errWebsocket)
document.getElementById('app').style.backgroundColor = '#000928' document.getElementById('app').style.backgroundColor = '#000928'
}) })
onUnmounted(() => { onUnmounted(() => {
closeWebsocket()
document.getElementById('app').style.backgroundColor = '#100c2a' document.getElementById('app').style.backgroundColor = '#100c2a'
}) })
</script> </script>
@ -373,4 +409,5 @@ onUnmounted(() => {
.right .r-box { .right .r-box {
width: 482px; width: 482px;
height: 328px; height: 328px;
}</style> }
</style>