http
This commit is contained in:
0
src/assets/js/getData1.js
Normal file
0
src/assets/js/getData1.js
Normal file
38
src/assets/js/getData2.js
Normal file
38
src/assets/js/getData2.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
// import {post} from './http.js'
|
||||||
|
|
||||||
|
// 设备监控
|
||||||
|
// export const deviceMonitor = () => post('api/cockpit/deviceMonitor', {
|
||||||
|
// })
|
||||||
|
export const deviceMonitor = () => {
|
||||||
|
let res = [
|
||||||
|
{
|
||||||
|
'point_id': '1',
|
||||||
|
'point_code': 'HLJDJW01',
|
||||||
|
'point_name': '混料机1对接位',
|
||||||
|
'point_status': '3',
|
||||||
|
'material_id': 1556534702800769024,
|
||||||
|
'material_name': '木质花纹2cm',
|
||||||
|
'ivt_weight': 29.500000,
|
||||||
|
'work_time': '50',
|
||||||
|
'ivt_qty': 600.000000,
|
||||||
|
'vehicle_qty': 15,
|
||||||
|
'vehicle_max_qty': 20,
|
||||||
|
'device_url': 'hlj'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'point_id': '1518105008862793728',
|
||||||
|
'point_code': 'YZJ02XL01',
|
||||||
|
'point_name': '压制机2下料位1',
|
||||||
|
'point_status': '3',
|
||||||
|
'material_id': 1556534702800769024,
|
||||||
|
'material_name': '木质花纹2cm',
|
||||||
|
'ivt_weight': 29.500000,
|
||||||
|
'work_time': '50',
|
||||||
|
'ivt_qty': 600.000000,
|
||||||
|
'vehicle_qty': 15,
|
||||||
|
'vehicle_max_qty': 20,
|
||||||
|
'device_url': 'yzj'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
return res
|
||||||
|
}
|
||||||
65
src/assets/js/http.js
Normal file
65
src/assets/js/http.js
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
import { Dialog } from './mUtils.js'
|
||||||
|
import store from '../../vuex/store'
|
||||||
|
import router from '@/router'
|
||||||
|
|
||||||
|
axios.defaults.timeout = 50000
|
||||||
|
axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'
|
||||||
|
|
||||||
|
axios.interceptors.request.use(
|
||||||
|
config => {
|
||||||
|
// let token = ''
|
||||||
|
// if (store.getters.userInfo !== '') {
|
||||||
|
// token = JSON.parse(store.getters.userInfo).token
|
||||||
|
// }
|
||||||
|
// token && (config.headers.Authorization = token)
|
||||||
|
if (config.method === 'post') {
|
||||||
|
if (!config.data.flag) {
|
||||||
|
config.data = config.data
|
||||||
|
} else {
|
||||||
|
config.data = config.data.formData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
Dialog('错误的传参')
|
||||||
|
return Promise.reject(error)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
axios.interceptors.response.use(
|
||||||
|
response => {
|
||||||
|
return Promise.resolve(response)
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
if (error && error.response) {
|
||||||
|
switch (error.response.status) {
|
||||||
|
case 400:
|
||||||
|
break
|
||||||
|
case 401:
|
||||||
|
// store.dispatch('setSignOut')
|
||||||
|
router.push('/setup')
|
||||||
|
break
|
||||||
|
}
|
||||||
|
return Promise.reject(error.response.data)
|
||||||
|
} else {
|
||||||
|
return Promise.reject(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export const post = (sevmethod, params) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
axios.post(`${store.getters.baseUrl}/` + sevmethod, params)
|
||||||
|
.then(response => {
|
||||||
|
resolve(response.data)
|
||||||
|
}, error => {
|
||||||
|
Dialog(error.message)
|
||||||
|
reject(error.message)
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -6,9 +6,9 @@ import store from '../../vuex/store'
|
|||||||
export const Dialog = (str) => {
|
export const Dialog = (str) => {
|
||||||
store.dispatch('showAlert', true)
|
store.dispatch('showAlert', true)
|
||||||
store.dispatch('alertMsg', str)
|
store.dispatch('alertMsg', str)
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
store.dispatch('showAlert', false)
|
// store.dispatch('showAlert', false)
|
||||||
}, 30000)
|
// }, 30000)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,16 +4,14 @@
|
|||||||
<div class="fl">
|
<div class="fl">
|
||||||
<div v-if="index == '0'" class="tag cur_tag">首页</div>
|
<div v-if="index == '0'" class="tag cur_tag">首页</div>
|
||||||
<router-link v-else to="/homepage" class="tag">首页</router-link>
|
<router-link v-else to="/homepage" class="tag">首页</router-link>
|
||||||
<div v-if="index == '1'" class="tag cur_tag">仓储监控</div>
|
<div v-if="index == '1'" class="tag cur_tag">生产统计</div>
|
||||||
<router-link v-else to="/storagemonitor" class="tag">仓储监控</router-link>
|
<router-link v-else to="/prodcount" class="tag">生产统计</router-link>
|
||||||
<div v-if="index == '2'" class="tag cur_tag">设备监控</div>
|
|
||||||
<router-link v-else to="/devicemonitor" class="tag">设备监控</router-link>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="fr">
|
<div class="fr">
|
||||||
<div v-if="index == '3'" class="tag cur_tag">物流工艺</div>
|
<div v-if="index == '2'" class="tag cur_tag">仓储监控</div>
|
||||||
<router-link v-else to="/logisticstech" class="tag">物流工艺</router-link>
|
<router-link v-else to="/storagemonitor" class="tag">仓储监控</router-link>
|
||||||
<div v-if="index == '4'" class="tag cur_tag">生产统计</div>
|
<div v-if="index == '3'" class="tag cur_tag">设备监控</div>
|
||||||
<router-link v-else to="/prodcount" class="tag">生产统计</router-link>
|
<router-link v-else to="/devicemonitor" class="tag">设备监控</router-link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="container" @click="uid = ''">
|
<section class="container" @click="uid = ''">
|
||||||
<t-header index='2'></t-header>
|
<t-header index='3'></t-header>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="item_tr clearfix">
|
<div class="item_tr clearfix">
|
||||||
<div class="item_block fl" v-for="e in deviceDatas.slice(0, 9)" :key="e.device_uuid">
|
<div class="item_block fl" v-for="e in deviceDatas.slice(0, 9)" :key="e.point_id">
|
||||||
<div class="item_inner" @click.stop="getInfo(e)">
|
<div class="item_inner" @click.stop="getInfo(e)">
|
||||||
<div class="item_img">
|
<div class="item_img">
|
||||||
<img v-if="e.device_url !== ''" :src="require('../assets/images/devmoni/' + e.device_url + '.jpg')" :alt="e.device_name">
|
<img v-if="e.device_url !== ''" :src="require('../assets/images/devmoni/' + e.device_url + '.jpg')" :alt="e.point_name">
|
||||||
</div>
|
</div>
|
||||||
<div class="device_name clearfix">
|
<div class="device_name clearfix">
|
||||||
<div class="fl device_name_tag" :class="['yellow', 'green', 'orange', 'gray'][Number(e.status) - 1]"></div>
|
<div class="fl device_name_tag" :class="['yellow', 'green', 'orange', 'gray'][Number(e.point_status) - 1]"></div>
|
||||||
<div class="fl device_name_text">{{e.device_name}}</div>
|
<div class="fl device_name_text">{{e.point_name}}</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 混碾机LB0001、压力机LB0004、机械手LB0006 -->
|
<!-- 混碾机LB0001、压力机LB0004、机械手LB0006 -->
|
||||||
<div v-if="e.deviceclass_code === 'LB0001' || e.deviceclass_code === 'LB0004' || (e.deviceclass_code === 'LB0006' && e.device_code !== 'CDJQR01' && e.device_code !== 'MDJXS01')" class="info_block clearfix">
|
<div v-if="e.deviceclass_code === 'LB0001' || e.deviceclass_code === 'LB0004' || (e.deviceclass_code === 'LB0006' && e.device_code !== 'CDJQR01' && e.device_code !== 'MDJXS01')" class="info_block clearfix">
|
||||||
@@ -690,6 +690,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import THeader from '@components/header.vue'
|
import THeader from '@components/header.vue'
|
||||||
|
import { deviceMonitor } from '@js/getData2'
|
||||||
export default {
|
export default {
|
||||||
name: 'DeviceMonitor',
|
name: 'DeviceMonitor',
|
||||||
components: {
|
components: {
|
||||||
@@ -716,14 +717,13 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
refresh () {
|
refresh () {
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
// this.deviceDatas = []
|
|
||||||
// this.form = {}
|
|
||||||
// this.allrows1 = []
|
|
||||||
// this.allrows2 = []
|
|
||||||
// this.uid = ''
|
|
||||||
this.initData()
|
this.initData()
|
||||||
}, this.interTime)
|
}, this.interTime)
|
||||||
},
|
},
|
||||||
|
async initData () {
|
||||||
|
let res = await deviceMonitor()
|
||||||
|
this.deviceDatas = [...res]
|
||||||
|
},
|
||||||
addPosition () {
|
addPosition () {
|
||||||
for (let i = 0; i < this.deviceDatas.length; i++) {
|
for (let i = 0; i < this.deviceDatas.length; i++) {
|
||||||
if (i <= 5) {
|
if (i <= 5) {
|
||||||
@@ -753,26 +753,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
initData () {
|
|
||||||
let data = {
|
|
||||||
// '_SRVNAME': 'server.jxht.screen',
|
|
||||||
'_SRVNAME': 'service.st.al.realivt',
|
|
||||||
'_SRVMETHOD': 'queryDevices',
|
|
||||||
'_DATA': JSON.stringify({
|
|
||||||
accountId: '-1'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this
|
|
||||||
.$post(data)
|
|
||||||
.then(res => {
|
|
||||||
if (res.code === '1') {
|
|
||||||
this.deviceDatas = [...res.result]
|
|
||||||
this.addPosition()
|
|
||||||
} else {
|
|
||||||
this.toast(res.desc)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getInfo (e) {
|
getInfo (e) {
|
||||||
if (this.uid === e.device_uuid) {
|
if (this.uid === e.device_uuid) {
|
||||||
this.uid = ''
|
this.uid = ''
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loginname: '',
|
loginname: '',
|
||||||
password: '',
|
password: '',
|
||||||
equipment: [{id: 0, name: '首页'}, {id: 1, name: '仓储监控'}, {id: 2, name: '设备监控'}, {id: 3, name: '物流工艺'}, {id: 4, name: '生产统计'}],
|
equipment: [{id: 0, name: '首页'}, {id: 1, name: '生产统计'}, {id: 2, name: '仓储监控'}, {id: 3, name: '设备监控'}],
|
||||||
equipId: Number(this.$store.getters.equipId),
|
equipId: Number(this.$store.getters.equipId),
|
||||||
drift: 0,
|
drift: 0,
|
||||||
baseUrl: this.$store.getters.baseUrl,
|
baseUrl: this.$store.getters.baseUrl,
|
||||||
@@ -78,13 +78,11 @@ export default {
|
|||||||
if (this.equipId === 0) {
|
if (this.equipId === 0) {
|
||||||
this.$router.push('/homepage')
|
this.$router.push('/homepage')
|
||||||
} else if (this.equipId === 1) {
|
} else if (this.equipId === 1) {
|
||||||
this.$router.push('/storagemonitor')
|
|
||||||
} else if (this.equipId === 2) {
|
|
||||||
this.$router.push('/devicemonitor')
|
|
||||||
} else if (this.equipId === 3) {
|
|
||||||
this.$router.push('/logisticstech')
|
|
||||||
} else {
|
|
||||||
this.$router.push('/prodcount')
|
this.$router.push('/prodcount')
|
||||||
|
} else if (this.equipId === 2) {
|
||||||
|
this.$router.push('/storagemonitor')
|
||||||
|
} else if (this.equipId === 3) {
|
||||||
|
this.$router.push('/devicemonitor')
|
||||||
}
|
}
|
||||||
let element = document.documentElement
|
let element = document.documentElement
|
||||||
if (this.fullscreen) {
|
if (this.fullscreen) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const state = {
|
|||||||
alertMsg: '操作成功',
|
alertMsg: '操作成功',
|
||||||
baseUrl: getStore('baseUrl') || baseUrl,
|
baseUrl: getStore('baseUrl') || baseUrl,
|
||||||
setTime: getStore('setTime') || 5000,
|
setTime: getStore('setTime') || 5000,
|
||||||
equipId: getStore('equipId') || 1
|
equipId: getStore('equipId') || 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
|
|||||||
Reference in New Issue
Block a user