Merge branch 'master' of https://gitlink.org.cn/xuos/xiuos_IoT
This commit is contained in:
commit
a7eed2d33b
|
@ -18,11 +18,11 @@ export function getGifCode(data) {
|
|||
})
|
||||
}
|
||||
|
||||
export function getInfo(token) {
|
||||
export function getInfo() {
|
||||
return request({
|
||||
url: '/vue-admin-template/user/info',
|
||||
url: '/user/getSession',
|
||||
method: 'get',
|
||||
params: { token }
|
||||
params: {}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Before Width: | Height: | Size: 3.7 MiB After Width: | Height: | Size: 3.7 MiB |
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.6 MiB |
Binary file not shown.
After Width: | Height: | Size: 773 KiB |
Binary file not shown.
After Width: | Height: | Size: 678 KiB |
|
@ -35,7 +35,7 @@ export default {
|
|||
},
|
||||
async logout() {
|
||||
await this.$store.dispatch('user/logout')
|
||||
this.$router.push(`/login?redirect=${this.$route.fullPath}`)
|
||||
this.$router.push('/login')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ export default {
|
|||
'sidebar'
|
||||
]),
|
||||
routes() {
|
||||
return this.$router.options.routes
|
||||
return this.$store.state.user.routes
|
||||
},
|
||||
activeMenu() {
|
||||
const route = this.$route
|
||||
|
|
|
@ -2,11 +2,13 @@
|
|||
* @Author: 龚祖望 573413756@qq.com
|
||||
* @Date: 2022-05-16 09:16:41
|
||||
* @LastEditors: 龚祖望 573413756@qq.com
|
||||
* @LastEditTime: 2022-09-16 10:39:39
|
||||
* @LastEditTime: 2022-10-09 15:28:49
|
||||
* @FilePath: \dashengda\src\permission.js
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
import router from './router'
|
||||
import store from './store'
|
||||
import { Message } from 'element-ui'
|
||||
import NProgress from 'nprogress' // progress bar
|
||||
import 'nprogress/nprogress.css' // progress bar style
|
||||
import { getToken } from '@/utils/auth' // get token from cookie
|
||||
|
@ -31,8 +33,31 @@ router.beforeEach(async(to, from, next) => {
|
|||
next({ path: '/overview' })
|
||||
NProgress.done()
|
||||
} else {
|
||||
next()
|
||||
NProgress.done()
|
||||
const corpName = store.getters.corpName
|
||||
if (corpName) {
|
||||
next()
|
||||
NProgress.done()
|
||||
} else {
|
||||
try {
|
||||
const res = await store.dispatch('user/getInfo')
|
||||
store.dispatch('user/generateRoutes', res).then(() => {
|
||||
router.addRoutes(store.getters.asyncRouters)
|
||||
next()
|
||||
}).catch(async err => {
|
||||
// remove token and go to login page to re-login
|
||||
await store.dispatch('user/resetToken')
|
||||
Message.error(err || 'Has Error')
|
||||
next(`/login?redirect=${to.path}`)
|
||||
NProgress.done()
|
||||
})
|
||||
} catch (error) {
|
||||
// remove token and go to login page to re-login
|
||||
await store.dispatch('user/resetToken')
|
||||
Message.error(error || 'Has Error')
|
||||
next(`/login?redirect=${to.path}`)
|
||||
NProgress.done()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* has no token*/
|
||||
|
|
|
@ -75,6 +75,26 @@ export const constantRoutes = [
|
|||
component: () => import('@/views/solution/qianjiang'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/configuration/development',
|
||||
component: () => import('@/views/configuration/development'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/configuration/transferStation',
|
||||
component: () => import('@/views/configuration/transferStation'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/configuration/AiCity',
|
||||
component: () => import('@/views/configuration/AiCity'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/configuration/bridgeMachine',
|
||||
component: () => import('@/views/configuration/bridgeMachine'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
path: '/login',
|
||||
component: () => import('@/views/login/index'),
|
||||
|
@ -176,37 +196,43 @@ export const constantRoutes = [
|
|||
}
|
||||
]
|
||||
},
|
||||
// {
|
||||
// path: '/configuration',
|
||||
// component: Layout,
|
||||
// name: 'Configuration',
|
||||
// meta: { title: '组态管理', icon: 'configuration' },
|
||||
// children: [
|
||||
// {
|
||||
// path: 'development',
|
||||
// name: 'Development',
|
||||
// component: () => import('@/views/configuration/development'),
|
||||
// meta: { title: '组态开发' }
|
||||
// },
|
||||
// {
|
||||
// path: 'transferStation',
|
||||
// name: 'TransferStation',
|
||||
// component: () => import('@/views/configuration/transferStation'),
|
||||
// meta: { title: '变电站' }
|
||||
// },
|
||||
// {
|
||||
// path: 'aicity',
|
||||
// name: 'AiCity',
|
||||
// component: () => import('@/views/configuration/AiCity'),
|
||||
// meta: { title: '智慧城市' }
|
||||
// },
|
||||
// {
|
||||
// path: 'bridgeMachine',
|
||||
// name: 'BridgeMachine',
|
||||
// component: () => import('@/views/configuration/bridgeMachine'),
|
||||
// meta: { title: '大方架桥机' }
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
{
|
||||
path: '/configuration',
|
||||
path: '/configureApp',
|
||||
component: Layout,
|
||||
name: 'Configuration',
|
||||
meta: { title: '组态管理', icon: 'configuration' },
|
||||
children: [
|
||||
{
|
||||
path: 'development',
|
||||
name: 'Development',
|
||||
component: () => import('@/views/configuration/development'),
|
||||
meta: { title: '组态开发' }
|
||||
},
|
||||
{
|
||||
path: 'transferStation',
|
||||
name: 'TransferStation',
|
||||
component: () => import('@/views/configuration/transferStation'),
|
||||
meta: { title: '变电站' }
|
||||
},
|
||||
{
|
||||
path: 'aicity',
|
||||
name: 'AiCity',
|
||||
component: () => import('@/views/configuration/AiCity'),
|
||||
meta: { title: '智慧城市' }
|
||||
},
|
||||
{
|
||||
path: 'bridgeMachine',
|
||||
name: 'BridgeMachine',
|
||||
component: () => import('@/views/configuration/bridgeMachine'),
|
||||
meta: { title: '大方架桥机' }
|
||||
}
|
||||
]
|
||||
name: 'configureApp',
|
||||
meta: { title: '组态应用', icon: 'configuration', disabled: true }
|
||||
},
|
||||
{
|
||||
path: '/log',
|
||||
|
@ -228,48 +254,36 @@ export const constantRoutes = [
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/data',
|
||||
component: Layout,
|
||||
name: 'Data',
|
||||
meta: { title: '数据管理', icon: 'data' },
|
||||
children: [
|
||||
{
|
||||
path: 'realTime',
|
||||
name: 'RealTime',
|
||||
component: () => import('@/views/data/realTime/index'),
|
||||
meta: { title: '实时数据' }
|
||||
},
|
||||
{
|
||||
path: 'history',
|
||||
name: 'History',
|
||||
component: () => import('@/views/data/history/index'),
|
||||
meta: { title: '历史数据' }
|
||||
},
|
||||
{
|
||||
path: 'value',
|
||||
name: 'Value',
|
||||
component: () => import('@/views/data/value/index'),
|
||||
meta: { title: '数据价值' }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// {
|
||||
// path: 'external-link',
|
||||
// component: Layout,
|
||||
// children: [
|
||||
// {
|
||||
// path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
|
||||
// meta: { title: 'External Link', icon: 'link' }
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
|
||||
// 404 page must be placed at the end !!!
|
||||
{ path: '*', redirect: '/404', hidden: true }
|
||||
]
|
||||
|
||||
export const asyncRouter = [{
|
||||
path: '/data',
|
||||
component: Layout,
|
||||
name: 'Data',
|
||||
meta: { title: '数据管理', icon: 'data', permission: ['dashengda'] },
|
||||
children: [
|
||||
{
|
||||
path: 'realTime',
|
||||
name: 'RealTime',
|
||||
component: () => import('@/views/data/realTime/index'),
|
||||
meta: { title: '实时数据', permission: ['dashengda'] }
|
||||
},
|
||||
{
|
||||
path: 'history',
|
||||
name: 'History',
|
||||
component: () => import('@/views/data/history/index'),
|
||||
meta: { title: '历史数据', permission: ['dashengda'] }
|
||||
},
|
||||
{
|
||||
path: 'value',
|
||||
name: 'Value',
|
||||
component: () => import('@/views/data/value/index'),
|
||||
meta: { title: '数据价值', permission: ['dashengda'] }
|
||||
}
|
||||
]
|
||||
}]
|
||||
|
||||
const createRouter = () => new Router({
|
||||
mode: 'history', // require service support
|
||||
scrollBehavior: () => ({ y: 0 }),
|
||||
|
@ -277,6 +291,7 @@ const createRouter = () => new Router({
|
|||
})
|
||||
|
||||
const router = createRouter()
|
||||
router.addRoutes(asyncRouter)
|
||||
|
||||
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
|
||||
export function resetRouter() {
|
||||
|
|
|
@ -4,6 +4,9 @@ const getters = {
|
|||
token: state => state.user.token,
|
||||
avatar: state => state.user.avatar,
|
||||
name: state => state.user.name,
|
||||
corpName: state => state.user.corpName
|
||||
corpName: state => state.user.corpName,
|
||||
abbrCorpName: state => state.user.abbrCorpName,
|
||||
asyncRouters: state => state.user.asyncRouters,
|
||||
routes: state => state.user.routes
|
||||
}
|
||||
export default getters
|
||||
|
|
|
@ -2,20 +2,50 @@
|
|||
* @Author: 龚祖望 573413756@qq.com
|
||||
* @Date: 2022-05-16 09:16:41
|
||||
* @LastEditors: 龚祖望 573413756@qq.com
|
||||
* @LastEditTime: 2022-08-31 20:21:28
|
||||
* @LastEditTime: 2022-10-09 15:39:05
|
||||
* @FilePath: \dashengda\src\store\modules\user.js
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
import { login, logout } from '@/api/user'
|
||||
import { login, logout, getInfo } from '@/api/user'
|
||||
import { getToken, setToken, removeToken } from '@/utils/auth'
|
||||
import { resetRouter } from '@/router'
|
||||
import { resetRouter, constantRoutes, asyncRouter } from '@/router'
|
||||
|
||||
function filterAsyncRouter(routerMap, roles) {
|
||||
const accessedRouters = routerMap.filter(route => {
|
||||
if (hasPermission([roles.permissions], route)) {
|
||||
if (route.children && route.children.length) {
|
||||
route.children = filterAsyncRouter(route.children, roles)
|
||||
}
|
||||
return true
|
||||
}
|
||||
return false
|
||||
})
|
||||
return accessedRouters
|
||||
}
|
||||
|
||||
function hasPermission(permission, route) {
|
||||
if (route.meta && route.meta.permission) {
|
||||
let flag = true
|
||||
for (let i = 0; i < permission.length; i++) {
|
||||
flag = route.meta.permission.includes(permission[i])
|
||||
if (flag) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
const getDefaultState = () => {
|
||||
return {
|
||||
token: getToken(),
|
||||
name: '',
|
||||
avatar: '',
|
||||
corpName: '浙江大胜达包装股份有限公司'
|
||||
corpName: '',
|
||||
abbrCorpName: '',
|
||||
permissions: [],
|
||||
asyncRouters: []
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,6 +63,19 @@ const mutations = {
|
|||
},
|
||||
SET_AVATAR: (state, avatar) => {
|
||||
state.avatar = avatar
|
||||
},
|
||||
SET_CORPNAME: (state, corpName) => {
|
||||
state.corpName = corpName
|
||||
},
|
||||
SET_ABBRCORPNAME: (state, abbrCorpName) => {
|
||||
state.abbrCorpName = abbrCorpName
|
||||
},
|
||||
SET_PERMISSIONS: (state, permissions) => {
|
||||
state.permissions = permissions
|
||||
},
|
||||
SET_ROUTERS: (state, asyncRouters) => {
|
||||
state.asyncRouters = asyncRouters
|
||||
state.routes = [...constantRoutes, ...asyncRouters]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,7 +85,6 @@ const actions = {
|
|||
const { username, password } = userInfo
|
||||
const data = { username, password }
|
||||
return new Promise((resolve, reject) => {
|
||||
// console.log('res', res)
|
||||
login(data).then(res => {
|
||||
if (res.code === '200000') {
|
||||
setToken('success')
|
||||
|
@ -57,26 +99,26 @@ const actions = {
|
|||
})
|
||||
},
|
||||
|
||||
// // get user info
|
||||
// getInfo({ commit, state }) {
|
||||
// return new Promise((resolve, reject) => {
|
||||
// getInfo(state.token).then(response => {
|
||||
// const { data } = response
|
||||
// get user info
|
||||
getInfo({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getInfo(state.token).then(response => {
|
||||
const { data } = response
|
||||
|
||||
// if (!data) {
|
||||
// return reject('Verification failed, please Login again.')
|
||||
// }
|
||||
if (!data) {
|
||||
return reject('Verification failed, please Login again.')
|
||||
}
|
||||
// const { name, avatar } = data
|
||||
|
||||
// const { name, avatar } = data
|
||||
|
||||
// commit('SET_NAME', name)
|
||||
// commit('SET_AVATAR', avatar)
|
||||
// resolve(data)
|
||||
// }).catch(error => {
|
||||
// reject(error)
|
||||
// })
|
||||
// })
|
||||
// },
|
||||
commit('SET_CORPNAME', data.corpname)
|
||||
commit('SET_ABBRCORPNAME', data.abbrcorpname)
|
||||
commit('SET_PERMISSIONS', [data.permissions])
|
||||
resolve(data)
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// user logout
|
||||
logout({ commit, state }) {
|
||||
|
@ -99,6 +141,14 @@ const actions = {
|
|||
commit('RESET_STATE')
|
||||
resolve()
|
||||
})
|
||||
},
|
||||
generateRoutes({ commit }, roles) {
|
||||
return new Promise(resolve => {
|
||||
const accessedRouters = filterAsyncRouter(asyncRouter, roles)
|
||||
console.log('accessedRouters', accessedRouters)
|
||||
commit('SET_ROUTERS', accessedRouters)
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,28 @@
|
|||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
<div
|
||||
class="menu"
|
||||
:class="{ active: current === 4 }"
|
||||
style="padding: 0 20px"
|
||||
>
|
||||
<el-dropdown @command="tpPage">
|
||||
<span class="menu"> 组态开发 </span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item
|
||||
command="/configuration/development"
|
||||
>流程规划</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
command="/configuration/transferStation"
|
||||
>变电站</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
command="/configuration/AiCity"
|
||||
>智慧城市</el-dropdown-item>
|
||||
<el-dropdown-item
|
||||
command="/configuration/bridgeMachine"
|
||||
>大方架桥机</el-dropdown-item>
|
||||
</el-dropdown-menu></el-dropdown>
|
||||
</div>
|
||||
<div
|
||||
class="menu"
|
||||
:class="{ active: current === 3 }"
|
||||
|
@ -169,7 +191,6 @@ export default {
|
|||
}
|
||||
},
|
||||
tpPage(router) {
|
||||
console.log('toPage', router)
|
||||
this.$router.push({ path: router })
|
||||
}
|
||||
}
|
||||
|
@ -201,8 +222,7 @@ export default {
|
|||
right: 120px;
|
||||
top: 3px;
|
||||
background-color: rgba(95, 155, 241, 0.39);
|
||||
|
||||
width: 600px;
|
||||
width: 700px;
|
||||
.menu {
|
||||
height: 70px;
|
||||
line-height: 70px;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<iframe id="ifm" style="margin-top:-130px;height: 90vh;border: medium none" src="https://t.le5le.com/?id=6128887203582f00012b8a14" width="100%" :height="iframeHeight" />
|
||||
<iframe id="ifm" style="margin-top:-75px;border: medium none" src="https://t.le5le.com/?id=6128887203582f00012b8a14" width="100%" :height="iframeHeight" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
|||
export default {
|
||||
computed: {
|
||||
iframeHeight() {
|
||||
return window.innerHeight - 185
|
||||
return window.innerHeight + 30
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<iframe id="ifm" style="margin-top:-130px;height: 90vh;border: medium none" src="https://t.le5le.com/?id=61c98f99311360740ed7a18e" width="100%" :height="iframeHeight" />
|
||||
<iframe id="ifm" style="margin-top:-75px;border: medium none" src="https://t.le5le.com/?id=61c98f99311360740ed7a18e" width="100%" :height="iframeHeight" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -8,7 +8,8 @@
|
|||
export default {
|
||||
computed: {
|
||||
iframeHeight() {
|
||||
return window.innerHeight - 185
|
||||
console.log('height', window.innerHeight)
|
||||
return window.innerHeight + 30
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ export default {
|
|||
</script>
|
||||
<style lang="scss">
|
||||
.home {
|
||||
height: calc(100vh - 50px);
|
||||
height: 100vh;
|
||||
}
|
||||
.avater{
|
||||
display: none;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<iframe id="ifm" style="margin-top:-130px;height: 90vh;border: medium none" src="https://t.le5le.com/?id=6318527c288d77e4cee1a1bd" width="100%" :height="iframeHeight" />
|
||||
<iframe id="ifm" style="margin-top:-75px;border: medium none" src="https://t.le5le.com/?id=6318527c288d77e4cee1a1bd" width="100%" :height="iframeHeight" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
|||
export default {
|
||||
computed: {
|
||||
iframeHeight() {
|
||||
return window.innerHeight - 185
|
||||
return window.innerHeight + 30
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
|
|
@ -250,55 +250,56 @@ export default {
|
|||
setInterval(this.animation, 3000)
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
getCount().then(res => {
|
||||
this.unprocessedAlarmNum = res.data
|
||||
})
|
||||
getAlarmLevelCount().then(res => {
|
||||
const level0Num = res.data.filter(item => item.alarm_level === 0)[0]?.count || 0
|
||||
const level1Num = res.data.filter(item => item.alarm_level === 1)[0]?.count || 0
|
||||
const level2Num = res.data.filter(item => item.alarm_level === 2)[0]?.count || 0
|
||||
const level3Num = res.data.filter(item => item.alarm_level === 3)[0]?.count || 0
|
||||
const alarmData = [{
|
||||
value: level0Num,
|
||||
name: '紧急'
|
||||
}, {
|
||||
value: level1Num,
|
||||
name: '重要'
|
||||
}, {
|
||||
value: level2Num,
|
||||
name: '次要'
|
||||
}, {
|
||||
value: level3Num,
|
||||
name: '提示'
|
||||
}]
|
||||
this.alarmTotalNum = res.data.reduce((pre, cur) => pre + cur.count, 0)
|
||||
this.options[1].series[0].data = alarmData
|
||||
})
|
||||
getRunStatusCount().then(res => {
|
||||
const status0Num = res.data.filter(item => item.runstatus === 0)[0]?.count || 0
|
||||
const status1Num = res.data.filter(item => item.runstatus === 1)[0]?.count || 0
|
||||
const status2Num = res.data.filter(item => item.runstatus === 2)[0]?.count || 0
|
||||
const runstatusData = [{
|
||||
value: status0Num,
|
||||
name: '运行'
|
||||
}, {
|
||||
value: status1Num,
|
||||
name: '待机'
|
||||
}, {
|
||||
value: status2Num,
|
||||
name: '警告'
|
||||
}]
|
||||
this.runningNum = status0Num
|
||||
this.options[2].series[0].data = runstatusData
|
||||
})
|
||||
getTypeCount().then(res => {
|
||||
const typeData = res.data.map(item => {
|
||||
return { name: item.type, value: item.count }
|
||||
})
|
||||
this.options[0].series[0].data = typeData
|
||||
this.terminalTotalNum = res.data.reduce((pre, cur) => pre + cur.count, 0)
|
||||
async getData() {
|
||||
const unprocessedAlarmData = await getCount()
|
||||
const alarmLevelData = await getAlarmLevelCount()
|
||||
const runStatusData = await getRunStatusCount()
|
||||
const typeCountData = await getTypeCount()
|
||||
|
||||
this.unprocessedAlarmNum = unprocessedAlarmData.data
|
||||
|
||||
const level0Num = alarmLevelData.data.filter(item => item.alarm_level === 0)[0]?.count || 0
|
||||
const level1Num = alarmLevelData.data.filter(item => item.alarm_level === 1)[0]?.count || 0
|
||||
const level2Num = alarmLevelData.data.filter(item => item.alarm_level === 2)[0]?.count || 0
|
||||
const level3Num = alarmLevelData.data.filter(item => item.alarm_level === 3)[0]?.count || 0
|
||||
const alarmData = [{
|
||||
value: level0Num,
|
||||
name: '紧急'
|
||||
}, {
|
||||
value: level1Num,
|
||||
name: '重要'
|
||||
}, {
|
||||
value: level2Num,
|
||||
name: '次要'
|
||||
}, {
|
||||
value: level3Num,
|
||||
name: '提示'
|
||||
}]
|
||||
this.alarmTotalNum = alarmLevelData.data.reduce((pre, cur) => pre + cur.count, 0)
|
||||
this.options[1].series[0].data = alarmData
|
||||
|
||||
const status0Num = runStatusData.data.filter(item => item.runstatus === 0)[0]?.count || 0
|
||||
const status1Num = runStatusData.data.filter(item => item.runstatus === 1)[0]?.count || 0
|
||||
const status2Num = runStatusData.data.filter(item => item.runstatus === 2)[0]?.count || 0
|
||||
const runstatusData = [{
|
||||
value: status0Num,
|
||||
name: '运行'
|
||||
}, {
|
||||
value: status1Num,
|
||||
name: '待机'
|
||||
}, {
|
||||
value: status2Num,
|
||||
name: '警告'
|
||||
}]
|
||||
this.runningNum = status1Num
|
||||
this.options[2].series[0].data = runstatusData
|
||||
|
||||
const typeData = typeCountData.data.map(item => {
|
||||
return { name: item.type, value: item.count }
|
||||
})
|
||||
this.options[0].series[0].data = typeData
|
||||
this.terminalTotalNum = typeCountData.data.reduce((pre, cur) => pre + cur.count, 0)
|
||||
|
||||
this.myCharts.forEach((chart, index) => {
|
||||
chart.setOption(this.options[index])
|
||||
})
|
||||
|
|
|
@ -142,7 +142,6 @@ export default {
|
|||
watch: {
|
||||
$route: {
|
||||
handler: function(route) {
|
||||
console.log('route', route)
|
||||
this.redirect = route.query && route.query.redirect
|
||||
},
|
||||
immediate: true
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @Author: 龚祖望 573413756@qq.com
|
||||
* @Date: 2022-05-16 09:16:41
|
||||
* @LastEditors: 龚祖望 573413756@qq.com
|
||||
* @LastEditTime: 2022-07-21 11:08:30
|
||||
* @LastEditTime: 2022-10-09 15:42:31
|
||||
* @FilePath: \dashengda\src\views\dashboard\index.vue
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
-->
|
||||
|
@ -10,10 +10,10 @@
|
|||
<div class="dashboard-container">
|
||||
<swiper ref="mySwiper" :options="swiperOption" style="width:100%">
|
||||
<swiper-slide>
|
||||
<img class="slide-img" src="@/assets/images/slide1.png">
|
||||
<img class="slide-img" :src="slide1">
|
||||
</swiper-slide>
|
||||
<swiper-slide>
|
||||
<img class="slide-img" src="@/assets/images/slide2.png">
|
||||
<img class="slide-img" :src="slide2">
|
||||
</swiper-slide>
|
||||
<swiper-slide>
|
||||
<img class="slide-img" src="@/assets/images/slide3.png">
|
||||
|
@ -38,11 +38,25 @@ export default {
|
|||
delay: 3000,
|
||||
disableOnInteraction: false
|
||||
}
|
||||
}
|
||||
},
|
||||
slide1: null,
|
||||
slide2: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['name'])
|
||||
...mapGetters(['abbrCorpName'])
|
||||
},
|
||||
created() {
|
||||
switch (this.abbrCorpName) {
|
||||
case '大胜达':
|
||||
this.slide1 = require('@/assets/images/dashengda-slide1.png')
|
||||
this.slide2 = require('@/assets/images/dashengda-slide2.png')
|
||||
break
|
||||
case '杭萧钢构':
|
||||
this.slide1 = require('@/assets/images/hangxiao-slide1.png')
|
||||
this.slide2 = require('@/assets/images/hangxiao-slide2.png')
|
||||
break
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const imgs = document.getElementsByClassName('slide-img')
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
style="align-items: baseline; margin-bottom: 30px"
|
||||
>
|
||||
<div class="header">
|
||||
<h1 class="title">大胜达PLC管理</h1>
|
||||
<h1 class="title">{{ abbrCorpName+'PLC管理' }}</h1>
|
||||
<span class="date">{{ date }}</span>
|
||||
</div>
|
||||
</el-row>
|
||||
|
@ -172,7 +172,7 @@
|
|||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
<span v-else>{{ form.baud_rate }}</span>
|
||||
<span v-else>{{ form.socketConfig.baud_rate }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="校验位:">
|
||||
<el-select v-if="add" v-model="form.socketConfig.check_mode">
|
||||
|
@ -182,7 +182,7 @@
|
|||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
<span v-else>{{ form.check_mode }}</span>
|
||||
<span v-else>{{ form.socketConfig.check_mode }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="停止位:">
|
||||
<el-select v-if="add" v-model="form.socketConfig.stop_bits">
|
||||
|
@ -192,7 +192,7 @@
|
|||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
<span v-else>{{ form.stop_bits }}</span>
|
||||
<span v-else>{{ form.socketConfig.stop_bits }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="数位号:">
|
||||
<el-select v-if="add" v-model="form.socketConfig.data_bits">
|
||||
|
@ -202,7 +202,7 @@
|
|||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
<span v-else>{{ form.data_bits }}</span>
|
||||
<span v-else>{{ form.socketConfig.data_bits }}</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
@ -311,15 +311,15 @@
|
|||
<el-table-column v-if="form.brand === 'mufg'" align="center" label="监控时间" prop="monitoring_timer" />
|
||||
</el-table>
|
||||
<el-row v-if="add" type="flex" justify="space-between" style="width:60%;margin: 20px auto 0;">
|
||||
<div>
|
||||
<div class="table_btn">
|
||||
<img src="@/assets/images/plus_orange.png" width="35px" @click="addParam">
|
||||
<p>添加</p>
|
||||
</div>
|
||||
<div>
|
||||
<div class="table_btn">
|
||||
<img src="@/assets/images/minus_orange.png" width="35px" @click="removeParam">
|
||||
<p>删除</p>
|
||||
</div>
|
||||
<div>
|
||||
<div class="table_btn">
|
||||
<img src="@/assets/images/remove_orange.png" width="35px" @click="removeAllParam">
|
||||
<p>清空</p>
|
||||
</div>
|
||||
|
@ -348,7 +348,9 @@
|
|||
label-width="130px"
|
||||
>
|
||||
<el-form-item label="配方名称:">
|
||||
<el-input v-if="add" v-model="form.productName" />
|
||||
<el-input v-if="add" v-model="form.productName">
|
||||
<template slot="prepend">{{ productPreName }}</template>
|
||||
</el-input>
|
||||
<span v-else>{{ form.productName }}</span>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@ -360,7 +362,7 @@
|
|||
class="dialog_btn"
|
||||
@click="lastStep"
|
||||
>上一步</el-button>
|
||||
<el-button class="dialog_btn primary" @click="nextStep">{{
|
||||
<el-button v-if="!(active ===2 && !add)" class="dialog_btn primary" @click="nextStep">{{
|
||||
active === 2 ? '保存' : '下一步'
|
||||
}}</el-button>
|
||||
</el-row>
|
||||
|
@ -371,6 +373,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { getList, add, remove } from '@/api/terminal/plc'
|
||||
|
||||
export default {
|
||||
|
@ -444,6 +447,21 @@ export default {
|
|||
currentIndex: -1
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['abbrCorpName']),
|
||||
productPreName() {
|
||||
let pre = ''
|
||||
switch (this.abbrCorpName) {
|
||||
case '大胜达':
|
||||
pre = 'dsd-'
|
||||
break
|
||||
case '杭萧钢构':
|
||||
pre = 'hxgg-'
|
||||
break
|
||||
}
|
||||
return pre
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.date = new Date().toLocaleDateString()
|
||||
this.getList()
|
||||
|
@ -510,6 +528,7 @@ export default {
|
|||
},
|
||||
nextStep() {
|
||||
if (this.active === 2) {
|
||||
this.form.productName = this.productPreName + this.form.productName
|
||||
add(this.form).then(res => {
|
||||
if (res.code === '200000') {
|
||||
this.getList()
|
||||
|
@ -576,12 +595,6 @@ export default {
|
|||
font-family: PingFangSC-Regular;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
.el-input {
|
||||
line-height: 4;
|
||||
}
|
||||
.el-button:hover,.el-button:focus {
|
||||
background-color: #fff;
|
||||
}
|
||||
.step2_params{
|
||||
.el-form-item__label{
|
||||
color: #ff4e00;
|
||||
|
@ -595,6 +608,9 @@ export default {
|
|||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.el-button:hover,.el-button:focus {
|
||||
background-color: #fff;
|
||||
}
|
||||
.header {
|
||||
font-family: Lato;
|
||||
.title {
|
||||
|
@ -627,7 +643,7 @@ export default {
|
|||
font-size: 20px;
|
||||
font-family: Microsoft YaHei;
|
||||
font-weight: bold;
|
||||
margin: 10px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
.remove_icon {
|
||||
font-size: 18px;
|
||||
|
@ -975,6 +991,9 @@ export default {
|
|||
font-family: PingFangSC-Regular;
|
||||
margin: 0;
|
||||
}
|
||||
.table_btn{
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.step3_tab {
|
||||
position: relative;
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
<div class="app-container" style="min-height: calc(100vh - 50px);">
|
||||
<el-row type="flex" justify="space-between" style="align-items: baseline;margin-bottom: 30px;">
|
||||
<div class="header">
|
||||
<h1 class="title">大胜达现有设备接入</h1>
|
||||
<h1 class="title">{{ abbrCorpName+'现有设备接入' }}</h1>
|
||||
<span class="date">{{ date }}</span>
|
||||
<span class="device_num">{{ '共'+activeList.length + '个设备' }}</span>
|
||||
<span class="device_num">{{ '共'+(activeList.length+disactiveList.length) + '个设备' }}</span>
|
||||
</div>
|
||||
<el-button type="primary" style="height: fit-content" @click="selectCompany">切换企业</el-button>
|
||||
</el-row>
|
||||
|
@ -82,7 +82,7 @@
|
|||
<el-form-item label="设备序列号:" prop="no">
|
||||
<el-input v-model="form.no" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备描述:" prop="desc">
|
||||
<el-form-item label="设备描述:" prop="devicedesc">
|
||||
<el-input v-model="form.devicedesc" />
|
||||
</el-form-item>
|
||||
<el-form-item label="设备状态:" prop="activestatus">
|
||||
|
@ -101,6 +101,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import { remove, getList, add, active } from '@/api/terminal/add'
|
||||
|
||||
export default {
|
||||
|
@ -117,32 +118,32 @@ export default {
|
|||
devicedesc: '',
|
||||
activestatus: 0
|
||||
},
|
||||
productList: [
|
||||
{
|
||||
name: '彩印车间',
|
||||
src: require('@/assets/images/device.png'),
|
||||
color: '#00CCF2',
|
||||
val: 0
|
||||
},
|
||||
{
|
||||
name: '生产车间',
|
||||
src: require('@/assets/images/device2.png'),
|
||||
color: '#FAB05A',
|
||||
val: 1
|
||||
},
|
||||
{
|
||||
name: '成型车间',
|
||||
src: require('@/assets/images/device3.png'),
|
||||
color: '#46D5A0',
|
||||
val: 2
|
||||
},
|
||||
{
|
||||
name: '打包车间',
|
||||
src: require('@/assets/images/device4.png'),
|
||||
color: '#9090F2',
|
||||
val: 3
|
||||
}
|
||||
],
|
||||
// productList: [
|
||||
// {
|
||||
// name: '彩印车间',
|
||||
// src: require('@/assets/images/device.png'),
|
||||
// color: '#00CCF2',
|
||||
// val: 0
|
||||
// },
|
||||
// {
|
||||
// name: '生产车间',
|
||||
// src: require('@/assets/images/device2.png'),
|
||||
// color: '#FAB05A',
|
||||
// val: 1
|
||||
// },
|
||||
// {
|
||||
// name: '成型车间',
|
||||
// src: require('@/assets/images/device3.png'),
|
||||
// color: '#46D5A0',
|
||||
// val: 2
|
||||
// },
|
||||
// {
|
||||
// name: '打包车间',
|
||||
// src: require('@/assets/images/device4.png'),
|
||||
// color: '#9090F2',
|
||||
// val: 3
|
||||
// }
|
||||
// ],
|
||||
deviceList: [
|
||||
{
|
||||
name: 'RV400-NPU16T-5G-AR100',
|
||||
|
@ -172,12 +173,102 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['abbrCorpName']),
|
||||
productList() {
|
||||
let res
|
||||
if (this.abbrCorpName === '杭萧钢构') {
|
||||
res = [{
|
||||
name: '数字工厂',
|
||||
src: require('@/assets/images/device.png'),
|
||||
color: '#00CCF2',
|
||||
val: 0
|
||||
}]
|
||||
}
|
||||
if (this.abbrCorpName === '大胜达') {
|
||||
res = [
|
||||
{
|
||||
name: '彩印车间',
|
||||
src: require('@/assets/images/device.png'),
|
||||
color: '#00CCF2',
|
||||
val: 0
|
||||
},
|
||||
{
|
||||
name: '生产车间',
|
||||
src: require('@/assets/images/device2.png'),
|
||||
color: '#FAB05A',
|
||||
val: 1
|
||||
},
|
||||
{
|
||||
name: '成型车间',
|
||||
src: require('@/assets/images/device3.png'),
|
||||
color: '#46D5A0',
|
||||
val: 2
|
||||
},
|
||||
{
|
||||
name: '打包车间',
|
||||
src: require('@/assets/images/device4.png'),
|
||||
color: '#9090F2',
|
||||
val: 3
|
||||
}
|
||||
]
|
||||
}
|
||||
return res
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.date = new Date().toLocaleDateString()
|
||||
this.getList(0)
|
||||
this.getList(1)
|
||||
// this.randomData()
|
||||
},
|
||||
methods: {
|
||||
// randomData() {
|
||||
// for (let i = 16; i < 17; i++) {
|
||||
// const productname = this.productList[0].name
|
||||
// const src = this.productList[0].src
|
||||
// const color = this.productList[0].color
|
||||
|
||||
// const randomDeviceNum = Math.round(Math.random() * 10) % 5
|
||||
// const type = this.deviceList[randomDeviceNum].name
|
||||
// const no = 'S' + String(i).padStart(2, '0')
|
||||
// const desc = ['激光切割机', '火焰切割机', '上料', 'H型钢组立', '进料缓存', '龙门式气保焊', '龙门式埋弧焊', '卧矫', '数控型钢钻孔', '型钢切割', '抛丸线', '门式切割']
|
||||
// const len = desc.length
|
||||
// const devicedesc = desc[i % len]
|
||||
|
||||
// const temp = {
|
||||
// src, productname, type, no, devicedesc, color
|
||||
// }
|
||||
|
||||
// const runstatus = Math.round(Math.random() * 10) % 2 + 1
|
||||
// const statusdesc = runstatus === 0 ? '待机' : runstatus === 1 ? '运行' : '警告'
|
||||
// const dataTemplate = {
|
||||
// runstatus,
|
||||
// statusdesc,
|
||||
// kernel: 'rt-thread kenel',
|
||||
// webversion: '1.0',
|
||||
// ipaddr: '192.168.131.29',
|
||||
// netmask: '255.255.254.0',
|
||||
// gateway: '192.168.130.1',
|
||||
// dnsserver0: '10.0.110.21',
|
||||
// dnsserver1: '10.0.110.20',
|
||||
// topic: '/broadcast/hf6mzwdVnJg/989898',
|
||||
// serveraddr: 'zwdVnJg.iot-as-mqtt.cn-shanghai.aliyuncs.com',
|
||||
// serverport: '1883',
|
||||
// username: 'test1&hf6mzwdVnJg',
|
||||
// clientid: '123|securemode=3,signmethod=hmacsha1|',
|
||||
// privateserveraddr: '192.168.131.30',
|
||||
// privateserverport: '9898',
|
||||
// privateserverusername: 'admin'
|
||||
// }
|
||||
// add({
|
||||
// productname, type, no, devicedesc, activestatus: 0, ...dataTemplate
|
||||
// }).then(res => {
|
||||
// }).catch(err => {
|
||||
// })
|
||||
// this.disactiveList.push(temp)
|
||||
// }
|
||||
// },
|
||||
selectCompany() {
|
||||
this.$message.warning('暂无权限')
|
||||
},
|
||||
|
@ -194,6 +285,7 @@ export default {
|
|||
},
|
||||
chooseCard(list) {
|
||||
list.forEach(item => {
|
||||
console.log('productList', this.productList)
|
||||
const temp = this.productList.filter(product => product.name === item.productname)
|
||||
item.color = temp[0].color
|
||||
item.src = temp[0].src
|
||||
|
@ -321,10 +413,14 @@ export default {
|
|||
.delete-icon,
|
||||
.add-icon {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
bottom: 10px;
|
||||
right: 5px;
|
||||
bottom: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.add-icon{
|
||||
right: -4px;
|
||||
bottom: -4px;
|
||||
}
|
||||
.device-icon {
|
||||
vertical-align: middle;
|
||||
margin-right: 10px;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
<el-card v-if="abbrCorpName === '大胜达'">
|
||||
<img src="@/assets/images/compass.png" class="compass"></img>
|
||||
<div class="workshop">
|
||||
<div class="elec-terminal fm100" @click="showDialog('A000001')">
|
||||
|
@ -79,6 +79,7 @@
|
|||
</div>
|
||||
</div></el-card>
|
||||
|
||||
<iframe v-else src="http://115.236.53.226:9898/home" width="100%" class="ifm" />
|
||||
<!-- 设备详情弹窗 -->
|
||||
<el-dialog title="设备监控详情" :visible.sync="visible" :top="dialogTop">
|
||||
<div class="card_detail">
|
||||
|
@ -102,7 +103,7 @@
|
|||
<div class="temper">{{ current.temper }}<span class="unit">°C</span></div>
|
||||
<p>{{ '内存使用率:'+current.cpuRate+'%' }}</p>
|
||||
<p>{{ '线程数:'+current.threadNum }}</p>
|
||||
<p>{{ '耗电量:'+current.elec+'kW·h' }}</p>
|
||||
<p>{{ '功率:2W' }}</p>
|
||||
<p class="location">{{ current.location }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -123,6 +124,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { mapGetters } from 'vuex'
|
||||
import Antenna from './components/Antenna'
|
||||
export default {
|
||||
components: { Antenna },
|
||||
|
@ -580,6 +582,7 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['abbrCorpName']),
|
||||
dialogTop() {
|
||||
return window.innerHeight > 880 ? '15vh' : '20px'
|
||||
}
|
||||
|
@ -646,6 +649,10 @@ export default {
|
|||
float: right;
|
||||
}
|
||||
}
|
||||
.ifm{
|
||||
height: 900px;
|
||||
border: medium none
|
||||
}
|
||||
.workshop {
|
||||
position: relative;
|
||||
background: url(~@/assets/images/workshop.png) no-repeat;
|
||||
|
|
Loading…
Reference in New Issue