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

View File

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

View File

@ -24,7 +24,8 @@
<ScrollBoard :data="cjdata"></ScrollBoard> <ScrollBoard :data="cjdata"></ScrollBoard>
</div> </div>
<div class="ltbottom"> <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> </div>
</BoardVue> </BoardVue>
</div> </div>
@ -48,7 +49,7 @@
</div> </div>
<div class="rtright"> <div class="rtright">
<BoardVue :title="t('MicroExhibition.缝中设备')"> <BoardVue :title="t('MicroExhibition.缝中设备')">
<ScrollBoard :data="fzdata"></ScrollBoard> <ScrollBoard :data="fzdata" @zdclick="zdclick"></ScrollBoard>
</BoardVue> </BoardVue>
</div> </div>
</div> </div>
@ -68,22 +69,25 @@ import StepItem from './component/StepItem.vue'
import BottomBorder from './component/BottomBorder.vue' import BottomBorder from './component/BottomBorder.vue'
import ScrollBoard from './component/ScrollBoard.vue' import ScrollBoard from './component/ScrollBoard.vue'
import BarChart from './component/BarChart.vue' import BarChart from './component/BarChart.vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { getmDeviceList, getmDeviceProduction } from '@/http/MicroExhibition' import { getmDeviceList, getmDeviceProduction } from '@/http/MicroExhibition'
import { ref, onMounted, onUnmounted, getCurrentInstance, watch, onUpdated, computed, reactive } from 'vue' import { ref, onMounted, onUnmounted, getCurrentInstance, watch, onUpdated, computed, reactive } from 'vue'
import { useMicroExhibitionStore } from '@/store/module/MicroExhibition' import { useMicroExhibitionStore } from '@/store/module/MicroExhibition'
import { connectWebsocket, closeWebsocket } from "@/utils/websocket" import { connectWebsocket, closeWebsocket } from "@/utils/websocket"
import { getStoredLanguage, saveStoredLanguage,languageHash } from "@/utils/languageStorage"; import { getStoredLanguage, saveStoredLanguage, languageHash } from "@/utils/languageStorage";
import { useRoute } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { id } from 'element-plus/es/locale'
let { t } = useI18n(); let { t } = useI18n();
let route = useRoute() let route = useRoute()
let router = useRouter()
const store = useMicroExhibitionStore() const store = useMicroExhibitionStore()
let lang = route.query.lang as string let lang = route.query.lang as string
let videoUrl = ref('https://d.tufting222.cn/video/yzy/a.mp4') let videoUrl = ref('https://d.tufting222.cn/video/yzy/a.mp4')
const videoElement = ref(null) const videoElement = ref(null)
let timer = null let timer = null
let thisLang = getStoredLanguage(); let thisLang = getStoredLanguage();
let fqdata = ref({ let fqdata = ref({
list: [], list: [],
rowNum: 3, rowNum: 3,
@ -136,7 +140,7 @@ function getDeviceProduction() {
data: item.data data: item.data
} }
}) })
let xDataArr = thisLang&&thisLang != "简体中文"?data.exData:data.xData let xDataArr = thisLang && thisLang != "简体中文" ? data.exData : data.xData
xData.value = xDataArr xData.value = xDataArr
} }
}) })
@ -170,8 +174,8 @@ function getmDevList() {
} else if (item.status == "false") { } else if (item.status == "false") {
temp = '0' temp = '0'
} }
let devname = thisLang&&thisLang != "简体中文"?item.ename:item.name let devname = thisLang && thisLang != "简体中文" ? item.ename : item.name
return [i + 1, {devname,label:item.label}, item.num, temp, item.ratio, item.workTime] 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]].online = online;
stepList[statusObj[key]].total = devObj[key].list.length; stepList[statusObj[key]].total = devObj[key].list.length;
@ -188,9 +192,9 @@ function getmDevList() {
} else if (item.status == "false") { } else if (item.status == "false") {
temp = '0' temp = '0'
} }
let devname = thisLang&&thisLang != "简体中文"?item.ename:item.name let devname = thisLang && thisLang != "简体中文" ? item.ename : item.name
return { return {
name: {devname,label:item.label}, name: { devname, label: item.label },
num: item.num, num: item.num,
status: temp, status: temp,
ratio: item.ratio, 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) => { let hzdataIndex = hzdata.value.findIndex((item, index) => {
return item.num == val.num return item.num == val.num
}) })
if (hzdataIndex !== -1 && hzdata.value[hzdataIndex].status != val.status) { if (hzdataIndex !== -1 && hzdata.value[hzdataIndex].status != val.status) {
if (hzdata.value[hzdataIndex].status != 0 && val.status == '0') { if (hzdata.value[hzdataIndex].status != 0 && val.status == '0') {
stepList[3].online -= 1 stepList[3].online -= 1
@ -282,7 +323,7 @@ function errWebsocket(val) {
onMounted(() => { onMounted(() => {
if (thisLang&&thisLang != "简体中文") { if (thisLang && thisLang != "简体中文") {
videoUrl.value = "https://d.tufting222.cn/video/yzy/micor_edos_english.mp4" videoUrl.value = "https://d.tufting222.cn/video/yzy/micor_edos_english.mp4"
} }