This commit is contained in:
hzz 2024-04-30 17:10:37 +08:00
parent 7356ed773e
commit 665334d756
3 changed files with 69 additions and 20 deletions

View File

@ -26,12 +26,14 @@
</div>
<div class="footer">
<div class="footer-left">
<button class="btn" :class="[isOn ? 'green' : 'gray']" :disabled="!isOn||(isOn&&loading)" :loading="isOn&&loading" @click="openDevice">
<button class="btn" :class="[isOn ? 'green' : 'gray']" :disabled="!isOn || (isOn && loading)"
:loading="isOn && loading" @click="openDevice">
<img class="image" src="./images/on.svg" alt="">&nbsp;&nbsp;开机
</button>
</div>
<div class="footer-right">
<button class="btn" :class="[isOff ? 'red' : 'gray']" :disabled="!isOff||(isOff&&loading)" :loading="isOff&&loading" @click="closeDevice">
<button class="btn" :class="[isOff ? 'red' : 'gray']" :disabled="!isOff || (isOff && loading)"
:loading="isOff && loading" @click="closeDevice">
<img class="image" src="./images/off.svg" alt="">&nbsp;&nbsp;关机
</button>
</div>
@ -67,7 +69,7 @@ async function getDeviceStatus(query) {
let data = result.data
deviceList.value = [
{ val: data.name },
{ val: data.model||data.name },
{ val: data.model || data.name },
{ val: data.label },
]
image.value = process.env.VUE_APP_BASE_API + data.img
@ -77,6 +79,9 @@ async function getDeviceStatus(query) {
isShow ? ElMessage({ message: '此机器未连接到物联系统!', type: 'warning' }) : ''
isShow = false
}
} else if (result.code == 400) {
clearInterval(timer)
ElMessage({ message: result.msg, type: 'error' })
}
} catch (e) {
@ -144,7 +149,7 @@ onMounted(() => {
getDeviceStatus({ id: device_id })
timer = setInterval(() => {
if (!is_response) {
if (!is_response) {
return
}
getDeviceStatus({ id: device_id })

View File

@ -1,6 +1,6 @@
<template>
<div class="ScrollBoard-container">
<ZdScrollBoard ref="devList" class="dev-list" :config="config" />
<ZdScrollBoard ref="devList" @click="ZdClick" class="dev-list" :config="config" />
</div>
</template>
@ -19,6 +19,11 @@ const prop = defineProps({
}
})
const devList = ref(null);
const emit = defineEmits(['zdclick'])
function ZdClick(value) {
emit('zdclick', value)
}
let config = reactive({
header: [
'<span style="color:#AEEEFAFE;font-size:18px;">'+t('default.序号')+'</span>',
@ -55,9 +60,7 @@ const handleData = () => {
}
return item
})
})
console.log(updateList);
})
devList.value.updateRows(updateList,config)
}
watch(()=>prop.data, (newVal, oldVal) => {

View File

@ -24,7 +24,8 @@
<ScrollBoard :data="cjdata"></ScrollBoard>
</div>
<div class="ltbottom">
<BarChart :xData="xData" style="width: 100%;height: 100%;" :seriesData="seriesData"></BarChart>
<BarChart :xData="xData" style="width: 100%;height: 100%;" :seriesData="seriesData">
</BarChart>
</div>
</BoardVue>
</div>
@ -48,7 +49,7 @@
</div>
<div class="rtright">
<BoardVue :title="t('MicroExhibition.缝中设备')">
<ScrollBoard :data="fzdata"></ScrollBoard>
<ScrollBoard :data="fzdata" @zdclick="zdclick"></ScrollBoard>
</BoardVue>
</div>
</div>
@ -68,22 +69,25 @@ import StepItem from './component/StepItem.vue'
import BottomBorder from './component/BottomBorder.vue'
import ScrollBoard from './component/ScrollBoard.vue'
import BarChart from './component/BarChart.vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getmDeviceList, getmDeviceProduction } from '@/http/MicroExhibition'
import { ref, onMounted, onUnmounted, getCurrentInstance, watch, onUpdated, computed, reactive } from 'vue'
import { useMicroExhibitionStore } from '@/store/module/MicroExhibition'
import { connectWebsocket, closeWebsocket } from "@/utils/websocket"
import { getStoredLanguage, saveStoredLanguage,languageHash } from "@/utils/languageStorage";
import { useRoute } from 'vue-router'
import { getStoredLanguage, saveStoredLanguage, languageHash } from "@/utils/languageStorage";
import { useRoute, useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { id } from 'element-plus/es/locale'
let { t } = useI18n();
let route = useRoute()
let router = useRouter()
const store = useMicroExhibitionStore()
let lang = route.query.lang as string
let videoUrl = ref('https://d.tufting222.cn/video/yzy/a.mp4')
const videoElement = ref(null)
let timer = null
let thisLang = getStoredLanguage();
let thisLang = getStoredLanguage();
let fqdata = ref({
list: [],
rowNum: 3,
@ -136,7 +140,7 @@ function getDeviceProduction() {
data: item.data
}
})
let xDataArr = thisLang&&thisLang != "简体中文"?data.exData:data.xData
let xDataArr = thisLang && thisLang != "简体中文" ? data.exData : data.xData
xData.value = xDataArr
}
})
@ -170,8 +174,8 @@ function getmDevList() {
} else if (item.status == "false") {
temp = '0'
}
let devname = thisLang&&thisLang != "简体中文"?item.ename:item.name
return [i + 1, {devname,label:item.label}, item.num, temp, item.ratio, item.workTime]
let devname = thisLang && thisLang != "简体中文" ? item.ename : item.name
return [i + 1, { devname, label: item.label, id: item.id }, item.num, temp, item.ratio, item.workTime]
})
stepList[statusObj[key]].online = online;
stepList[statusObj[key]].total = devObj[key].list.length;
@ -188,9 +192,9 @@ function getmDevList() {
} else if (item.status == "false") {
temp = '0'
}
let devname = thisLang&&thisLang != "简体中文"?item.ename:item.name
let devname = thisLang && thisLang != "简体中文" ? item.ename : item.name
return {
name: {devname,label:item.label},
name: { devname, label: item.label },
num: item.num,
status: temp,
ratio: item.ratio,
@ -206,6 +210,43 @@ function getmDevList() {
})
}
//
function zdclick(value) {
if (value.row) {
console.log(value, fzdata.value.list);
let row = value.row
let num = row[2]
let index = fzdata.value.list.findIndex((item, index) => {
return item[2] == num
})
if (index !== -1) {
ElMessageBox.confirm(
'是否进入缝纫机控制界面?',
'通知',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'info',
}
)
.then(() => {
router.push({
path: '/ExhibitionStation_' + fzdata.value.list[index][1].id
})
})
.catch(() => {
// ElMessage({
// type: 'info',
// message: 'Delete canceled',
// })
})
}
}
}
/*
改变设备状态
{
@ -229,7 +270,7 @@ function changestatus(val) {
let hzdataIndex = hzdata.value.findIndex((item, index) => {
return item.num == val.num
})
if (hzdataIndex !== -1 && hzdata.value[hzdataIndex].status != val.status) {
if (hzdata.value[hzdataIndex].status != 0 && val.status == '0') {
stepList[3].online -= 1
@ -282,7 +323,7 @@ function errWebsocket(val) {
onMounted(() => {
if (thisLang&&thisLang != "简体中文") {
if (thisLang && thisLang != "简体中文") {
videoUrl.value = "https://d.tufting222.cn/video/yzy/micor_edos_english.mp4"
}