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

View File

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