微工厂大屏修改

This commit is contained in:
hzz 2024-03-28 17:04:43 +08:00
parent eebd14903e
commit 09969fa1a1
3 changed files with 34 additions and 19 deletions

View File

@ -116,7 +116,7 @@ let getImgSrc = computed(() => {
}) })
// //
let speed = ref(200) let speed = ref(2000)
function scatteredLayoutExhibitionDeviceFun() { function scatteredLayoutExhibitionDeviceFun() {
scatteredLayoutExhibitionDevice({ s: 'WME' }).then((res: any) => { scatteredLayoutExhibitionDevice({ s: 'WME' }).then((res: any) => {
if (res.code == 200) { if (res.code == 200) {
@ -133,8 +133,16 @@ function scatteredLayoutExhibitionDeviceFun() {
if (name == '电脑绗绣机') { if (name == '电脑绗绣机') {
device_data.value.push({ key: '花型编号', value: device_info['fileName'] }) device_data.value.push({ key: '花型编号', value: device_info['fileName'] })
} }
if (device_info['status'] == 2) { if (name == '电脑绣花机') {
speed.value = 200 device_data.value.push({ key: '版型', value: "展会560"})
}
if (name == '零等待皮革缝纫机') {
device_data.value.push({ key: '版型', value: "零等待(骨头).DSR" })
}
if (name == '床笠裙边机') {
speed.value = 3000
} else if (device_info['status'] == 2) {
speed.value = 2000
} else { } else {
speed.value = 0 speed.value = 0
} }
@ -257,7 +265,10 @@ function getWebsocket(val) {
if (device_data.value[2].value == RackNumber) { if (device_data.value[2].value == RackNumber) {
device_data.value[1].value = WorkingState device_data.value[1].value = WorkingState
speed.value = data.msg?.speed if (device_data.value[0].value !="床笠裙边机") {
speed.value = data.msg?.speed
}
} }
} }

View File

@ -26,12 +26,12 @@
</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" @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" @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>
@ -55,16 +55,16 @@ const isOn = ref(false)
const isOff = ref(false) const isOff = ref(false)
let timer = null let timer = null
let isShow = true let isShow = true
let loading = ref(false)
// //
async function getDeviceStatus(query) { async function getDeviceStatus(query) {
try { try {
const result:any = await getStatus(query) const result: any = await getStatus(query)
if (result.code == 200) { if (result.code == 200) {
let data = result.data let data = result.data
deviceList.value = [ deviceList.value = [
{ val: data.name }, { val: data.name },
{ val: data.model }, { 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
@ -89,13 +89,15 @@ async function openDevice() {
if (!isOn.value) return if (!isOn.value) return
clearInterval(timer) clearInterval(timer)
let queryData = { id: device_id } let queryData = { id: device_id }
let result:any = await setOpen(queryData) loading.value = true
let result: any = await setOpen(queryData)
if (result.code == 200) { if (result.code == 200) {
let data = result.data let data = result.data
isOn.value = data.open isOn.value = data.open
isOff.value = data.close isOff.value = data.close
isShow = true isShow = true
} }
loading.value = false
timer = setInterval(() => { timer = setInterval(() => {
getDeviceStatus({ id: device_id }) getDeviceStatus({ id: device_id })
}, 10000) }, 10000)
@ -106,7 +108,8 @@ async function closeDevice() {
if (!isOff.value) return if (!isOff.value) return
clearInterval(timer) clearInterval(timer)
let queryData = { id: device_id } let queryData = { id: device_id }
let result:any = await setClose(queryData) loading.value = true
let result: any = await setClose(queryData)
if (result.code == 200) { if (result.code == 200) {
let data = result.data let data = result.data
isOn.value = data.open isOn.value = data.open
@ -119,6 +122,7 @@ async function closeDevice() {
}, 10000) }, 10000)
isShow = true isShow = true
} }
loading.value = false
} }
@ -144,7 +148,6 @@ onUnmounted(() => {
</script> </script>
<style scoped> <style scoped>
@import url("@/assets/css/styles/iconfont.css"); @import url("@/assets/css/styles/iconfont.css");
@font-face { @font-face {
@ -343,4 +346,5 @@ onUnmounted(() => {
.container .footer .footer-right .btn .image { .container .footer .footer-right .btn .image {
width: 50px; width: 50px;
height: 119px; height: 119px;
}</style> }
</style>

View File

@ -80,7 +80,7 @@ let { t } = useI18n();
let route = useRoute() let route = useRoute()
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('http://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();
@ -136,7 +136,7 @@ function getDeviceProduction() {
data: item.data data: item.data
} }
}) })
let xDataArr = thisLang != "简体中文"?data.exData:data.xData let xDataArr = thisLang&&thisLang != "简体中文"?data.exData:data.xData
xData.value = xDataArr xData.value = xDataArr
} }
}) })
@ -170,7 +170,7 @@ function getmDevList() {
} else if (item.status == "false") { } else if (item.status == "false") {
temp = '0' temp = '0'
} }
let devname = thisLang == "简体中文"?item.name:item.ename let devname = thisLang&&thisLang != "简体中文"?item.ename:item.name
return [i + 1, devname, item.num, temp, item.ratio, item.workTime] return [i + 1, devname, item.num, temp, item.ratio, item.workTime]
}) })
stepList[statusObj[key]].online = online; stepList[statusObj[key]].online = online;
@ -188,7 +188,7 @@ function getmDevList() {
} else if (item.status == "false") { } else if (item.status == "false") {
temp = '0' temp = '0'
} }
let devname = thisLang == "简体中文"?item.name:item.ename let devname = thisLang&&thisLang != "简体中文"?item.ename:item.name
return { return {
name: devname, name: devname,
num: item.num, num: item.num,
@ -282,8 +282,8 @@ function errWebsocket(val) {
onMounted(() => { onMounted(() => {
if (thisLang != "简体中文") { if (thisLang&&thisLang != "简体中文") {
videoUrl.value = "https://d.tufting222.cn/video/yzy/micor_edos_english.mp4" videoUrl.value = "http://d.tufting222.cn/video/yzy/micor_edos_english.mp4"
} }
getDeviceProduction() getDeviceProduction()