Commit db3f247e authored by caojm's avatar caojm

页面大致结构完成

parents 4d1ec48f f73abedb
......@@ -843,8 +843,8 @@ export default {
.el-table td,
.el-table th {
padding: 0 !important;
line-height: 49px;
height: 49px;
line-height: 40px;
height: 40px;
}
</style>
......
......@@ -107,6 +107,7 @@ $el-bg-color-4: #F2F6FC;
// 表格大概样式
.hall,.office-area-control {
.el-table__row > td {
......@@ -124,4 +125,24 @@ $el-bg-color-4: #F2F6FC;
.el-table--group::after {
width: 0;
}
}
.margin-lr-20 {
margin: 0 20px;
}
// color
.color-blue {
color: #21ACFC;
}
.color-cyan {
color: #36CBCB;
}
.color-green {
color: #4ECB74;
}
\ No newline at end of file
......@@ -99,8 +99,6 @@
}
.d2-theme-container-main-body {
position: relative;
margin: 24px 24px 85px;
}
}
}
......
......@@ -176,6 +176,7 @@
.d2-theme-container {
// 侧边栏
.d2-theme-container-aside {
border-right:1px solid #ECECEC ;
// 菜单为空的时候显示的信息
.d2-layout-header-aside-menu-empty {
background: $theme-aside-menu-empty-background-color;
......
......@@ -44,8 +44,9 @@ import { preventReClick } from '@/util/plugins'
// import './promission'
//自定义提示框
import toastRegistry from './components/toast/index'
import cardWarp from '@/pages/components/cardWarp.vue'
import ElementUI from 'element-ui' //element-ui的全部组件
Vue.component('cardWarp', cardWarp)
// import 'element-ui/lib/theme-chalk/index.css'
Vue.use(toastRegistry)//element-ui的css
Vue.use(ElementUI) //使用elementUI
......
......@@ -101,6 +101,7 @@ export default {
<style lang="scss">
.energy-page{
padding:10px 10px 40px 10px;
.el-input__inner {
// height: 30px;
}
......
<template>
<div>
设备故障报警
</div>
<template lang='pug'>
card-warp(title="故障报警分析")
div(slot="right")
span 时间范围:
el-date-picker.margin-lr-20(
size='mini'
v-model="dateValue",
type="daterange",
align="right",
unlink-panels,
range-separator="至",
start-placeholder="开始日期",
end-placeholder="结束日期",
:picker-options="pickerOptions"
)
el-button(size='mini' type='primary') 查询
div(slot="content")
.echartsWarp(width="100%", flex)
//- div
//- .title 设备故障统计
//- pie
//- div
//- .title 设备报警统计
//- pie2
div
.title 设备类型故障数量统计
pie3
div
.title 设备故障数量统计
pie4
</template>
<script>
export default {
// import pie from './pie'
// import pie2 from './pie2'
import pie3 from './pie3'
import pie4 from './pie4'
export default {
components: {
// pie,
// pie2,
pie3,
pie4
},
data() {
return {
dateValue: '',
pickerOptions: {
shortcuts: [
{
text: '最近一周',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(
start.getTime() - 3600 * 1000 * 24 * 7
)
picker.$emit('pick', [start, end])
}
},
{
text: '最近一个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(
start.getTime() - 3600 * 1000 * 24 * 30
)
picker.$emit('pick', [start, end])
}
},
{
text: '最近三个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(
start.getTime() - 3600 * 1000 * 24 * 90
)
picker.$emit('pick', [start, end])
}
}
]
}
}
},
methods: {
tabClick(tab, event) {
console.log(tab, event)
}
}
}
</script>
<style lang="scss" scoped>
.echartsWarp {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
height: calc(100vh - 260px);
> div {
width: 47%;
// height: calc(90% / 2);
height: 95%;
margin: 3px;
padding: 13px;
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
.title {
font-size: 16px;
font-family: Microsoft YaHei;
font-weight: 600;
color: #000000;
line-height: 40px;
&::before {
content: "";
display: inline-block;
width: 10px;
height: 10px;
border-radius: 50%;
background: #0097ff;
margin: 0 10px;
}
}
}
}
</style>
<template lang='pug'>
#pie(:style="{ width: '100%', height: '90%'}")
</template>
<script>
export default {
mounted() {
this.pie()
},
methods: {
pie() {
let dom = document.getElementById('pie')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
tooltip: {
trigger: 'item'
},
legend: {
orient: 'horizontal',
top: '1%'
},
series: [
{
type: 'pie',
radius: '50%',
data: [
{ value: 1048, name: '搜索引擎' },
{ value: 735, name: '直接访问' },
{ value: 580, name: '邮件营销' },
{ value: 484, name: '联盟广告' },
{ value: 300, name: '视频广告' }
]
}
]
}
myCharts.setOption(option)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang='pug'>
#pie2(:style="{ width: '100%', height: '90%' }")
</template>
<script>
export default {
data() {
return {
legendData: [],
nameList: [
'赵', '钱', '孙', '李', '周', '吴', '郑', '王', '冯', '陈', '褚', '卫', '蒋', '沈', '韩'
],
list: {}
}
},
created() {
this.list = this.genData(20)
},
mounted() {
this.ring()
console.log(this.list)
},
methods: {
ring() {
let dom = document.getElementById('pie2')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
legend: {
type: 'scroll',
orient: 'vertical',
right: 10,
top: 20,
bottom: 20,
data: this.list.legendData,
selected: this.list.selected
},
series: [
{
name: '姓名',
type: 'pie',
radius: '55%',
center: ['40%', '50%'],
data: this.list.seriesData,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
}
myCharts.setOption(option)
},
genData(count) {
var legendData = []
var seriesData = []
for (var i = 0; i < count; i++) {
var name =
Math.random() > 0.65
? this.makeWord(4, 1) + '·' + this.makeWord(3, 0)
: this.makeWord(2, 1)
legendData.push(name)
seriesData.push({
name: name,
value: Math.round(Math.random() * 100000)
})
}
return {
legendData: legendData,
seriesData: seriesData
}
},
makeWord(max, min) {
var nameLen = Math.ceil(Math.random() * max + min)
var name = []
for (var i = 0; i < nameLen; i++) {
name.push(
this.nameList[ Math.round(Math.random() * this.nameList.length - 1) ]
)
}
return name.join('')
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang='pug'>
#pie3(:style="{ width: '100%', height: '90%'}")
</template>
<script>
export default {
mounted() {
this.pie()
},
methods: {
pie() {
let dom = document.getElementById('pie3')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
tooltip: {
trigger: 'item'
},
legend: {
orient: 'horizontal',
top: '1%'
},
series: [
{
type: 'pie',
radius: '50%',
data: [
{ value: 1048, name: '搜索引擎' },
{ value: 735, name: '直接访问' },
{ value: 580, name: '邮件营销' },
{ value: 484, name: '联盟广告' },
{ value: 300, name: '视频广告' }
]
}
]
}
myCharts.setOption(option)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang='pug'>
#pie4(:style="{ width: '100%', height: '90%' }")
</template>
<script>
export default {
data() {
return {
legendData: [],
nameList: [
'赵',
'钱',
'孙',
'范',
'屈',
'项',
'祝',
'董',
'梁',
'杜',
'阮',
'蓝',
'闵',
'席',
'季',
'麻',
'强',
'贾',
'路',
'娄',
'危'
],
list: {}
}
},
created() {
this.list = this.genData(30)
},
mounted() {
this.ring()
console.log(this.list)
},
methods: {
ring() {
let dom = document.getElementById('pie4')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
legend: {
type: 'scroll',
orient: 'vertical',
right: 10,
top: 20,
bottom: 20,
data: this.list.legendData,
selected: this.list.selected
},
series: [
{
name: '姓名',
type: 'pie',
radius: '55%',
center: ['40%', '50%'],
data: this.list.seriesData,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
}
myCharts.setOption(option)
},
genData(count) {
var legendData = []
var seriesData = []
for (var i = 0; i < count; i++) {
var name =
Math.random() > 0.65
? this.makeWord(4, 1) + '·' + this.makeWord(3, 0)
: this.makeWord(2, 1)
legendData.push(name)
seriesData.push({
name: name,
value: Math.round(Math.random() * 100000)
})
}
return {
legendData: legendData,
seriesData: seriesData
}
},
makeWord(max, min) {
var nameLen = Math.ceil(Math.random() * max + min)
var name = []
for (var i = 0; i < nameLen; i++) {
name.push(
this.nameList[ Math.round(Math.random() * this.nameList.length - 1) ]
)
}
return name.join('')
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang='pug'>
#chart(:style="{ width: '100%', height: '90%'}")
</template>
<script>
export default {
mounted() {
this.chart()
},
methods: {
chart() {
let dom = document.getElementById('chart')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
// color:['#D0F0FF'],
title: {
text: '温度(℃)'
},
tooltip: {
trigger: 'axis'
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '订单数量',
type: 'line',
stack: '总量',
smooth: true,
label: {
show: true,
position: 'top'
},
areaStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#81befd' // 0% 处的颜色
},
{
offset: 1,
color: '#fff' // 100% 处的颜色
}
])
}
},
lineStyle: {
color: '#13B0FF'
},
itemStyle: {
normal: {
color: '#13B0FF'
}
},
emphasis: {
focus: 'series'
},
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
myCharts.setOption(option)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang='pug'>
#chart2(:style="{ width: '100%', height: '90%'}")
</template>
<script>
export default {
mounted() {
this.chart2()
},
methods: {
chart2() {
let dom = document.getElementById('chart2')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
// color:['#D0F0FF'],
title: {
text: '湿度(%)'
},
tooltip: {
trigger: 'axis'
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '订单数量',
type: 'line',
stack: '总量',
smooth: true,
label: {
show: true,
position: 'top'
},
areaStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#36CBCB' // 0% 处的颜色
},
{
offset: 1,
color: '#fff' // 100% 处的颜色
}
])
}
},
lineStyle: {
color: '#13B0FF'
},
itemStyle: {
normal: {
color: '#13B0FF'
}
},
emphasis: {
focus: 'series'
},
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
myCharts.setOption(option)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang='pug'>
#chart3(:style="{ width: '100%', height: '90%'}")
</template>
<script>
export default {
mounted() {
this.chart3()
},
methods: {
chart3() {
let dom = document.getElementById('chart3')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
// color:['#D0F0FF'],
title: {
text: 'CO2(PPM)'
},
tooltip: {
trigger: 'axis'
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '订单数量',
type: 'line',
stack: '总量',
smooth: true,
label: {
show: true,
position: 'top'
},
areaStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#4ECB74' // 0% 处的颜色
},
{
offset: 1,
color: '#fff' // 100% 处的颜色
}
])
}
},
lineStyle: {
color: '#13B0FF'
},
itemStyle: {
normal: {
color: '#13B0FF'
}
},
emphasis: {
focus: 'series'
},
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
myCharts.setOption(option)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang="pug">
card-warp(title="室内气象分析" height='45px' )
div(slot="right")
//- span 时间范围:
//- el-date-picker.margin-lr-20(
//- size='mini'
//- v-model="dateValue",
//- type="daterange",
//- align="right",
//- unlink-panels,
//- range-separator="至",
//- start-placeholder="开始日期",
//- end-placeholder="结束日期",
//- :picker-options="pickerOptions"
//- )
//- el-button(size='mini' type='primary') 查询
router-link.margin-lr-20(:to="{name:'kb-indoor'}")
el-button(size='mini' type='primary') 图形 / 列表
//- el-button(size='mini' type='primary' icon='el-icon-download') 下载
div(slot="content", style="height: 90%")
el-tabs.myTabs(v-model="activeName", @tab-click="tabClick")
el-tab-pane(label="候车室区域", name="1")
el-tab-pane(label="办公区域", name="2")
el-form(:inline='true')
el-form-item(label='时间范围:')
el-date-picker.margin-lr-20(
size='mini'
v-model="dateValue",
type="daterange",
align="right",
unlink-panels,
range-separator="至",
start-placeholder="开始日期",
end-placeholder="结束日期",
:picker-options="pickerOptions"
)
el-form-item(label='')
el-button(size='mini' type='primary') 查询
.echartsWarp(width="100%", flex)
div
chart
div
chart2
div
chart3
div
pie4
</template>
<script>
import chart from './chart'
import chart2 from './chart2'
import chart3 from './chart3'
import pie4 from './pie4'
export default {
components: {
chart,
chart2,
chart3,
pie4
},
data() {
return {
activeName: '1',
dateValue: '',
pickerOptions: {
shortcuts: [
{
text: '最近一周',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(
start.getTime() - 3600 * 1000 * 24 * 7
)
picker.$emit('pick', [start, end])
}
},
{
text: '最近一个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(
start.getTime() - 3600 * 1000 * 24 * 30
)
picker.$emit('pick', [start, end])
}
},
{
text: '最近三个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(
start.getTime() - 3600 * 1000 * 24 * 90
)
picker.$emit('pick', [start, end])
}
}
]
}
}
},
methods: {
tabClick(tab, event) {
console.log(tab, event)
},
getDataList() {
}
}
}
</script>
<style lang="scss" scoped>
.myTabs {
/deep/ .el-tabs__nav-wrap::after {
height: 0;
}
/deep/.el-tabs__nav-wrap {
background: #f2f4f5;
.el-tabs__nav {
// background: #E5E9EC;
border-bottom: 1px solid #e5e9ec;
}
}
/deep/ .el-tabs__header {
border: 1px solid #e5e9ec;
}
/deep/ .el-tabs__item:nth-child(2) {
padding: 0 20px;
}
/deep/ .el-tabs__item:last-child {
padding: 0 20px;
}
/deep/ .el-tabs__item.is-active {
background: #fff;
}
}
.echartsWarp {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
height: calc(100vh - 350px);
> div {
width: 48%;
height: calc(90% / 2);
margin: 3px;
padding: 13px;
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
.title {
font-size: 16px;
font-family: Microsoft YaHei;
font-weight: 600;
color: #000000;
line-height: 40px;
&::before {
content: "";
display: inline-block;
width: 10px;
height: 10px;
border-radius: 50%;
background: #0097ff;
margin: 0 10px;
}
}
}
}
</style>
<template lang='pug'>
#pie4(:style="{ width: '100%', height: '90%' }")
</template>
<script>
export default {
mounted() {
this.pie()
},
methods: {
pie() {
let dom = document.getElementById('pie4')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
title: {
text: '故障报警'
},
tooltip: {
trigger: 'item'
},
legend: {
top: '5%',
left: 'center'
},
series: [
{
name: '访问来源',
type: 'pie',
radius: ['40%', '70%'],
avoidLabelOverlap: false,
itemStyle: {
borderRadius: 10,
borderColor: '#fff',
borderWidth: 2
},
label: {
show: false,
position: 'center'
},
emphasis: {
label: {
show: true,
fontSize: '20',
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: [
{ value: 1048, name: '搜索引擎' },
{ value: 735, name: '直接访问' },
{ value: 580, name: '邮件营销' },
{ value: 484, name: '联盟广告' },
{ value: 300, name: '视频广告' }
]
}
]
}
myCharts.setOption(option)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang='pug'>
#chart(:style="{ width: '100%', height: '90%'}")
</template>
<script>
export default {
mounted() {
this.chart()
},
methods: {
chart() {
let dom = document.getElementById('chart')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
// color:['#D0F0FF'],
title: {
text: '温度'
},
tooltip: {
trigger: 'axis'
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '订单数量',
type: 'line',
stack: '总量',
smooth: true,
// label: {
// show: true,
// position: 'top'
// },
areaStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#21ACFC' // 0% 处的颜色
},
{
offset: 1,
color: '#fff' // 100% 处的颜色
}
])
}
},
lineStyle: {
color: '#21ACFC'
},
itemStyle: {
normal: {
color: '#13B0FF'
}
},
emphasis: {
focus: 'series'
},
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
myCharts.setOption(option)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang='pug'>
#chart2(:style="{ width: '100%', height: '90%'}")
</template>
<script>
export default {
mounted() {
this.chart2()
},
methods: {
chart2() {
let dom = document.getElementById('chart2')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
// color:['#D0F0FF'],
title: {
text: '湿度'
},
tooltip: {
trigger: 'axis'
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '订单数量',
type: 'line',
stack: '总量',
smooth: true,
// label: {
// show: true,
// position: 'top'
// },
areaStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#36CBCB' // 0% 处的颜色
},
{
offset: 1,
color: '#fff' // 100% 处的颜色
}
])
}
},
lineStyle: {
color: '#36CBCB'
},
itemStyle: {
normal: {
color: '#13B0FF'
}
},
emphasis: {
focus: 'series'
},
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
myCharts.setOption(option)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang='pug'>
#chart3(:style="{ width: '100%', height: '90%'}")
</template>
<script>
export default {
mounted() {
this.chart3()
},
methods: {
chart3() {
let dom = document.getElementById('chart3')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
// color:['#D0F0FF'],
title: {
text: '风速'
},
tooltip: {
trigger: 'axis'
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '订单数量',
type: 'line',
stack: '总量',
smooth: true,
// label: {
// show: true,
// position: 'top'
// },
areaStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#3AA0FF' // 0% 处的颜色
},
{
offset: 1,
color: '#fff' // 100% 处的颜色
}
])
}
},
lineStyle: {
color: '#3AA0FF'
},
itemStyle: {
normal: {
color: '#13B0FF'
}
},
emphasis: {
focus: 'series'
},
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
myCharts.setOption(option)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang='pug'>
#chart4(:style="{ width: '100%', height: '90%'}")
</template>
<script>
export default {
mounted() {
this.chart4()
},
methods: {
chart4() {
let dom = document.getElementById('chart4')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
// color:['#D0F0FF'],
title: {
text: '光照'
},
tooltip: {
trigger: 'axis'
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '订单数量',
type: 'line',
stack: '总量',
smooth: true,
// label: {
// show: true,
// position: 'top'
// },
areaStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#FAD337' // 0% 处的颜色
},
{
offset: 1,
color: '#fff' // 100% 处的颜色
}
])
}
},
lineStyle: {
color: '#FAD337'
},
itemStyle: {
normal: {
color: '#13B0FF'
}
},
emphasis: {
focus: 'series'
},
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
myCharts.setOption(option)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang='pug'>
#chart5(:style="{ width: '100%', height: '90%' }")
</template>
<script>
export default {
mounted() {
this.chart5()
},
methods: {
chart5() {
let dom = document.getElementById('chart5')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
// color:['#D0F0FF'],
title: {
text: 'CO2'
},
tooltip: {
trigger: 'axis'
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '订单数量',
type: 'line',
stack: '总量',
smooth: true,
// label: {
// show: true,
// position: 'top'
// },
areaStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#4ECB74' // 0% 处的颜色
},
{
offset: 1,
color: '#fff' // 100% 处的颜色
}
])
}
},
lineStyle: {
color: '#4ECB74'
},
itemStyle: {
normal: {
color: '#13B0FF'
}
},
emphasis: {
focus: 'series'
},
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
myCharts.setOption(option)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang='pug'>
#chart6(:style="{ width: '100%', height: '90%' }")
</template>
<script>
export default {
mounted() {
this.chart6()
},
methods: {
chart6() {
let dom = document.getElementById('chart6')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
// color:['#D0F0FF'],
title: {
text: 'PM2.5'
},
tooltip: {
trigger: 'axis'
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '订单数量',
type: 'line',
stack: '总量',
smooth: true,
// label: {
// show: true,
// position: 'top'
// },
areaStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#999999' // 0% 处的颜色
},
{
offset: 1,
color: '#fff' // 100% 处的颜色
}
])
}
},
lineStyle: {
color: '#999999'
},
itemStyle: {
normal: {
color: '#13B0FF'
}
},
emphasis: {
focus: 'series'
},
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
myCharts.setOption(option)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang='pug'>
#chart7(:style="{ width: '100%', height: '90%' }")
</template>
<script>
export default {
mounted() {
this.chart7()
},
methods: {
chart7() {
let dom = document.getElementById('chart7')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
// color:['#D0F0FF'],
title: {
text: '辐射'
},
tooltip: {
trigger: 'axis'
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '订单数量',
type: 'line',
stack: '总量',
smooth: true,
// label: {
// show: true,
// position: 'top'
// },
areaStyle: {
normal: {
color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#975FE4' // 0% 处的颜色
},
{
offset: 1,
color: '#fff' // 100% 处的颜色
}
])
}
},
lineStyle: {
color: '#975FE4'
},
itemStyle: {
normal: {
color: '#13B0FF'
}
},
emphasis: {
focus: 'series'
},
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
]
}
myCharts.setOption(option)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang="pug">
card-warp(title="室外气象分析" height='45px' )
div(slot="right")
router-link.margin-lr-20(:to="{name:'kb-indoor'}")
el-button(size='mini' type='primary') 图形 / 列表
div(slot="content", style="height: 90%")
el-tabs.myTabs(v-model="activeName", @tab-click="tabClick")
el-tab-pane(label="候车室区域", name="1")
el-tab-pane(label="办公区域", name="2")
el-form(:inline='true' size="mini" )
el-form-item(label='设备名称:')
el-input(type='primary' size='mini')
el-form-item(label='时间范围:')
el-date-picker(
size='mini'
v-model="dateValue",
type="daterange",
align="right",
unlink-panels,
range-separator="至",
start-placeholder="开始日期",
end-placeholder="结束日期",
:picker-options="pickerOptions"
)
el-button(size='mini' type='primary') 查询
.echartsWarp(width="100%", flex)
div
chart
div
chart2
div
chart3
div
chart4
div
chart5
div
chart6
div
chart7
div
pie8
</template>
<script>
import chart from './chart'
import chart2 from './chart2'
import chart3 from './chart3'
import chart4 from './chart4'
import chart5 from './chart5'
import chart6 from './chart6'
import chart7 from './chart7'
import pie8 from './pie8'
export default {
components: {
chart,
chart2,
chart3,
chart4,
chart5,
chart6,
chart7,
pie8
},
data() {
return {
activeName: '1',
dateValue: '',
pickerOptions: {
shortcuts: [
{
text: '最近一周',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(
start.getTime() - 3600 * 1000 * 24 * 7
)
picker.$emit('pick', [start, end])
}
},
{
text: '最近一个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(
start.getTime() - 3600 * 1000 * 24 * 30
)
picker.$emit('pick', [start, end])
}
},
{
text: '最近三个月',
onClick(picker) {
const end = new Date()
const start = new Date()
start.setTime(
start.getTime() - 3600 * 1000 * 24 * 90
)
picker.$emit('pick', [start, end])
}
}
]
}
}
},
methods: {
tabClick(tab, event) {
console.log(tab, event)
},
getDataList() {
}
}
}
</script>
<style lang="scss" scoped>
.myTabs {
/deep/ .el-tabs__nav-wrap::after {
height: 0;
}
/deep/.el-tabs__nav-wrap {
background: #f2f4f5;
.el-tabs__nav {
// background: #E5E9EC;
border-bottom: 1px solid #e5e9ec;
}
}
/deep/ .el-tabs__header {
border: 1px solid #e5e9ec;
}
/deep/ .el-tabs__item:nth-child(2) {
padding: 0 20px;
}
/deep/ .el-tabs__item:last-child {
padding: 0 20px;
}
/deep/ .el-tabs__item.is-active {
background: #fff;
}
}
.echartsWarp {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
height: calc(100vh - 350px);
> div {
width: 23%;
height: calc(90% / 2);
margin: 3px;
padding: 13px;
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
.title {
font-size: 16px;
font-family: Microsoft YaHei;
font-weight: 600;
color: #000000;
line-height: 40px;
&::before {
content: "";
display: inline-block;
width: 10px;
height: 10px;
border-radius: 50%;
background: #0097ff;
margin: 0 10px;
}
}
}
}
</style>
<template lang='pug'>
#pie4(:style="{ width: '100%', height: '95%' }")
</template>
<script>
export default {
mounted() {
this.pie()
},
methods: {
pie() {
let dom = document.getElementById('pie4')
if (!dom) return
let myCharts = this.$echarts.init(dom)
let option = {
color: ['#F2637B', '#eeeeee'],
title: {
text: '故障报警'
},
series: [
{
name: '',
type: 'pie',
radius: ['50%', '70%'],
avoidLabelOverlap: false,
hoverAnimation: false, //关闭放大动画
selectedOffset: 0, //选中块的偏移量
label: {
show: false,
position: 'center',
formatter: '{d}%'
},
emphasis: {
label: {
show: true,
fontSize: '20',
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: [
{
value: 60,
name: '直接访问',
selected: true, //默认选中第一块
label: {
show: true, //默认显示第一块
fontSize: '20',
fontWeight: 'bold'
}
},
{
value: 100,
name: '总故障',
label: {
show: false, //默认显示第一块
fontSize: '20',
fontWeight: 'bold'
}
}
]
}
]
}
myCharts.setOption(option)
}
}
}
</script>
<style lang="scss" scoped>
</style>
<template lang='pug'>
.card-warp
.card-header(:style="{height,'line-height':height}" :class=" showBackground ? 'bg' : '' ")
span.card-title {{ title }}
slot(name="right")
.card-content
slot(name="content")
</template>
<script>
export default {
name: 'card-warp',
props: {
title: {
type: String,
default: '数据统计'
},
height: {
type: String,
default: '74px'
},
showBackground: {
type: Boolean,
default: false
}
}
}
</script>
<style lang="scss" scoped>
.card-warp {
width: 100%;
height: 100%;
.card-header {
display: flex;
justify-content: space-between;
// height: 74px;
// line-height: 74px;
padding: 0 20px;
border-bottom: 1px solid #ececec;
.card-title {
display: flex;
justify-content: center;
align-items: center;
font-size: 16px;
font-weight: 600;
&::before {
content: "";
display: inline-block;
padding-right: 5px;
margin-right: 10px;
height: 16px;
background: #21acfc;
}
}
}
.card-content {
margin: 20px;
height: calc(100% - 100px);
}
}
.bg{
background: #F2FAFF;
}
</style>
<template>
<el-pagination
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="newtotalSize"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
>
</el-pagination>
</template>
<script>
export default {
data() {
return {
newtotalSize: this.totalSize,
newpageSize: this.pageSize,
currentPage: 1 // 当前页
}
},
watch: {
totalSize(n, o) {
this.newtotalSize = n
}
},
props: {
// 每页展示多少条数据
pageSize: {
type: Number,
default: 10
},
// 数据总条数
totalSize: {
type: Number,
default: 0
}
},
methods: {
// pageSize 改变时会触发
handleSizeChange(val) {
this.newpageSize = val
this.$emit('parentMethod', this.currentPage, val)
},
// currentPage 改变时会触发
handleCurrentChange(val) {
this.currentPage = val
this.$emit('parentMethod', val, this.newpageSize)
}
}
}
</script>
<style>
</style>
......@@ -260,6 +260,7 @@ export default {
<style lang="scss" >
.hall {
height: 100%;
padding:10px 10px 40px 10px;
.el-input__inner {
height: 30px;
}
......
......@@ -200,6 +200,7 @@ export default {
.home-page {
height: 100%;
width: 100%;
padding:10px 10px 40px 10px;
// overflow: auto;
&-top {
margin-bottom: 24px;
......
<template>
<div>
</div>
</template>
<script>
export default {
}
</script>
<style lang="scss" scoped>
</style>
<template lang="pug">
card-warp(title="室内气象数据" height='45px' showBackground )
div(slot='right')
router-link.margin-lr-20(:to="{name:'analysis-indoor'}")
el-button(size='mini' type='primary') 综合图形
div(slot="content", style="height: 90%")
el-tabs.myTabs(v-model="activeName", @tab-click="tabClick")
el-tab-pane(label="候车室区域", name="1")
el-tab-pane(label="办公区域", name="2")
el-form(:inline='true')
el-form-item(label='设备编号:')
el-input(size='mini')
el-form-item(label='')
el-button(type='primary' size='mini') 查询
.data-warp
div.data-item
p.type 温度
p.color-blue
span.num 37
span.unit ℃
div.data-item
p.type 湿度
p.color-cyan
span.num 25
span.unit %RH
div.data-item()
p.type CO2
p.color-green
span.num 17
span.unit PPM
el-table(size="mini" :data='dataList' stripe v-loading='dataListLoading' style='width: 100%;' :header-cell-style="{ background: '#EEF8FF', color: '#333333' }")
el-table-column(:resizable="false" type="index" header-align='center' align='center' width="50" label='序号')
el-table-column(:resizable="false" prop='visitorId' header-align='center' align='center' width='240' label='设备编号')
el-table-column(:resizable="false" prop='visitorId' header-align='center' align='center' width='240' label='设备名称')
el-table-column(:resizable="false" prop='visitorId' header-align='center' align='center' width='240' label='温度(℃)')
el-table-column(:resizable="false" prop='visitorId' header-align='center' align='center' label='混度(%RH)')
el-table-column(:resizable="false" prop='visitorId' header-align='center' align='center' )
span(slot='header')
span CO
sub 2
span ( PPM )
el-table-column(:resizable="false" prop='visitorId' header-align='center' align='center' label='设备状态')
el-table-column( :resizable="false" header-align='center' align='center' width='180' label='操作内容')
template(slot-scope='scope')
el-button(type='text' size='small' @click='showParams(scope.row)') 历史数据
el-button(type='text' size='small' @click='showParams(scope.row)') 统计图表
tablePagination(:pageSize="pageSize" :totalSize="totalPage" @parentMethod='getDataList')
</template>
<script>
import tablePagination from '@/pages/components/tablePagination'
export default {
components: {
tablePagination
},
data() {
return {
activeName: '1',
dataList: [{ id: 1 }],
dataListLoading: false,
pageSize: 50,
totalPage: 0
}
},
methods: {
tabClick(tab, event) {
console.log(tab, event)
},
getDataList() {
}
}
}
</script>
<style lang="scss" scoped>
.myTabs {
/deep/ .el-tabs__nav-wrap::after {
height: 0;
}
/deep/.el-tabs__nav-wrap {
background: #f2f4f5;
.el-tabs__nav {
// background: #E5E9EC;
border-bottom: 1px solid #e5e9ec;
}
}
/deep/ .el-tabs__header {
border: 1px solid #e5e9ec;
}
/deep/ .el-tabs__item:nth-child(2) {
padding: 0 20px;
}
/deep/ .el-tabs__item:last-child {
padding: 0 20px;
}
/deep/ .el-tabs__item.is-active {
background: #fff;
}
}
.data-warp{
display: flex;
justify-content: space-between;
text-align: center;
margin-bottom: 20px;
.data-item{
width: 32%;
height: 153px;
background: #FFFFFF;
border: 1px solid #ECECEC;
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.08);
.type{
height: 19px;
font-size: 18px;
font-family: Microsoft YaHei;
font-weight: 400;
color: #333333;
line-height: 60px;
}
.num{
height: 28px;
font-size: 36px;
font-family: PingFang SC;
font-weight: 600;
color: #21ACFC;
line-height: 60px;
}
.unit{
height: 15px;
font-size: 18px;
font-family: Microsoft YaHei;
font-weight: 400;
}
}
}
</style>
......@@ -222,6 +222,7 @@ export default {
</script>
<style lang="scss">
.use-electro-data{
padding:10px 10px 40px 10px;
.el-form-item{
margin-bottom: 15px;
margin-top: 15px;
......
......@@ -27,7 +27,7 @@
img.login-code(:src="captchaPath" @click="getCaptcha()" alt="")
el-row.checkbox
el-col(:span='24' )
el-checkbox(v-model="formLogin.remember" checked) 自动登陆
el-checkbox(v-model="formLogin.remember" checked) 记住密码
el-button(size="default" @click="submit" class='login-btn' :loading="loginLoad") 立即登录
div.lFooter() Copyright (C) 2009-2010. 四川旷谷信息工程有限公司 蜀ICP备12026813号-1 电话:86-028-68937037 传真:86-028-68937039
</template>
......@@ -36,71 +36,70 @@
/* eslint-disable */
// 动态背景js
// require("particles.js");
import config from "./config/default";
import { mapActions } from "vuex";
import util from "@/libs/util.js";
import { getPermissions } from "@/util";
import config from './config/default'
import { mapActions } from 'vuex'
import util from '@/libs/util.js'
import { getPermissions } from '@/util'
const Base64 = require('js-base64').Base64
import httpRequest from '@/plugin/axios'
import bcrypt from '@/util/bcrypt.js'
export default {
data () {
data() {
return {
loginLoad:false,
loginLoad: false,
// 快速选择用户
dialogVisible: false,
users: [
{
name: "管理员",
username: "admin",
password: "admin"
name: '管理员',
username: 'admin',
password: 'admin'
},
{
name: "编辑",
username: "editor",
password: "editor"
name: '编辑',
username: 'editor',
password: 'editor'
},
{
name: "用户1",
username: "user1",
password: "user1"
name: '用户1',
username: 'user1',
password: 'user1'
}
],
// 表单
formLogin: {
username: "",
password: "",
username: '',
password: '',
remember: '',
uuid: "",
code: "qweqwe"
uuid: '',
code: 'qweqwe'
},
// 校验
rules: {
username: [
{ required: true, message: "请输入用户名", trigger: "blur" }
{ required: true, message: '请输入用户名', trigger: 'blur' }
],
password: [{ required: true, message: "请输入密码", trigger: "blur" }],
code: [{ required: true, message: "请输入验证码", trigger: "blur" }]
password: [{ required: true, message: '请输入密码', trigger: 'blur' }],
code: [{ required: true, message: '请输入验证码', trigger: 'blur' }]
},
captchaPath: ""
};
captchaPath: ''
}
},
created () {
created() {
//this.getCookie();
let u = util.cookies.get("username")
let p = util.cookies.get("password")
if(u && p){
this.formLogin.username =bcrypt.decrypt(u);
this.formLogin.password = bcrypt.decrypt(p);
let u = util.cookies.get('username')
let p = util.cookies.get('password')
if (u && p) {
this.formLogin.username = bcrypt.decrypt(u)
this.formLogin.password = bcrypt.decrypt(p)
}
this.getCaptcha();
this.$parent.getDateList();
this.getCaptcha()
},
mounted () {
mounted() {
// 初始化例子插件
//particlesJS("login", config);
},
beforeDestroy () {
beforeDestroy() {
// 销毁 particlesJS
// thanks https://github.com/d2-projects/d2-admin/issues/65
// ref https://github.com/VincentGarreau/particles.js/issues/63
......@@ -110,44 +109,43 @@ export default {
//}
},
methods: {
...mapActions("d2admin/account", ["login"]),
...mapActions('d2admin/account', ['login']),
...mapActions('d2admin/page', ['closeAll']),
// getType(){
// let type
// httpRequest({ url: httpRequest.adornUrl('/sysSystem/getSystem'), method: 'get' }).then((e) => {
// console.log(e, '类型')
// })
// return type
// return type
// },
/**
* 获取uuid
*/
getUUID () {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
return (c === "x"
getUUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
return (c === 'x'
? (Math.random() * 16) | 0
: "r&0x3" | "0x8"
).toString(16);
});
: 'r&0x3' | '0x8'
).toString(16)
})
},
// 获取验证码
getCaptcha () {
this.formLogin.uuid = this.getUUID();
getCaptcha() {
this.formLogin.uuid = this.getUUID()
this.captchaPath = this.$http.adornUrl(
`/captcha.jpg?uuid=${this.formLogin.uuid}`
);
)
},
/**
* @description 接收选择一个用户快速登录的事件
* @param {Object} user 用户信息
*/
handleUserBtnClick (user) {
this.formLogin.username = user.username;
this.formLogin.password = user.password;
this.submit();
handleUserBtnClick(user) {
this.formLogin.username = user.username
this.formLogin.password = user.password
this.submit()
},
/* setCookie(c_name, c_pwd, exdays) {
var exdate = new Date();
......@@ -181,18 +179,17 @@ export default {
*/
// 提交登录信息
clearCookie: function () {
util.cookies.set("username", "");
util.cookies.set("password", "");
util.cookies.set('username', '')
util.cookies.set('password', '')
},
submit () {
submit() {
// 防止重复提交
if(this.loginLoad) return
if (this.loginLoad) return
// 登录关闭所有tab
this.closeAll()
let u = bcrypt.encrypt(this.formLogin.username.trim())
let p = bcrypt.encrypt(this.formLogin.password.trim())
this.$refs.loginForm.validate(valid => {
this.$refs.loginForm.validate((valid) => {
if (valid) {
// this.login({
// vm: this,
......@@ -205,28 +202,28 @@ export default {
// 获取数据列表
this.loginLoad = true
this.$http({
url: this.$http.authUrl("/oauth/token"),
method: "post",
url: this.$http.authUrl('/oauth/token'),
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data: {
grant_type: "password",
grant_type: 'password',
username: u,
password: p,
scope: "all"
scope: 'all'
}
})
.then(data => {
.then((data) => {
if (data.access_token) {
// 登录
// 注意 这里的演示没有传验证码
// 具体需要传递的数据请自行修改代码
util.cookies.set("authorization", data.access_token);
util.cookies.set('authorization', data.access_token)
this.$http({
url: this.$http.adornUrl("/sys/login"),
method: "post",
url: this.$http.adornUrl('/sys/login'),
method: 'post',
data: {
uuid: this.formLogin.uuid,
username: u,
......@@ -234,7 +231,7 @@ export default {
captcha: this.formLogin.code
}
})
.then(res => {
.then((res) => {
if (res.msg == 'success') {
this.$message.success({
message: '登录成功',
......@@ -249,88 +246,96 @@ export default {
// util.cookies.set("token", res.token);
sessionStorage.setItem('uuid', res.uuid)
sessionStorage.setItem('token', res.token)
localStorage.setItem("userId",res.userId)
localStorage.setItem('userId', res.userId)
// 存储登陆用户权限信息
sessionStorage.setItem("permissions", res.permissions);
localStorage.setItem("sysSystem",res.sysSystem)
localStorage.setItem("sysSign",JSON.parse(res.sysSystem || '{}').code)
localStorage.setItem("stationId",JSON.parse(res.sysSystem || '{}').code)
localStorage.setItem("lineId",JSON.parse(res.sysSystem || '{}').lineId)
sessionStorage.setItem('permissions', res.permissions)
localStorage.setItem('sysSystem', res.sysSystem)
localStorage.setItem(
'sysSign',
JSON.parse(res.sysSystem || '{}').code
)
localStorage.setItem(
'stationId',
JSON.parse(res.sysSystem || '{}').code
)
localStorage.setItem(
'lineId',
JSON.parse(res.sysSystem || '{}').lineId
)
//设置被接管
let takeover = res.takeover
if(takeover && takeover.status === 1){
if (takeover && takeover.status === 1) {
// 弹出提示框
this.$store.dispatch('d2admin/takeover/setTakeover', takeover)
} else if(takeover && takeover.status === 2 ){
sessionStorage.setItem('takeover',true)
this.$store.dispatch(
'd2admin/takeover/setTakeover',
takeover
)
} else if (takeover && takeover.status === 2) {
sessionStorage.setItem('takeover', true)
}
// 设置 vuex 用户信息
this.$store.dispatch(
"d2admin/user/set",
'd2admin/user/set',
{
name: this.formLogin.username,
userName:res.userName
userName: res.userName
},
{ root: true }
);
)
// 用户登录后从持久化数据加载一系列的设置
this.$store.dispatch("d2admin/account/load");
this.$store.dispatch('d2admin/account/load')
// 获取最新权限信息
getPermissions();
getPermissions()
// 更新路由 尝试去获取 cookie 里保存的需要重定向的页面完整地址
const path = util.cookies.get("redirect");
const path = util.cookies.get('redirect')
// 根据是否存有重定向页面判断如何重定向
this.$http({
url: this.$http.adornUrl('/sys/menu/nav'),
method: "get"
}).then((e)=>{
this.$router.replace({path:'/'})
})
url: this.$http.adornUrl('/sys/menu/nav'),
method: 'get'
}).then((e) => {
this.$router.replace({ path: '/' })
})
// this.$router.replace(path ? { path } : { name: "index" });
// 删除 cookie 中保存的重定向页面
util.cookies.remove("redirect");
util.cookies.remove('redirect')
if (this.formLogin.remember) {
//传入账号名,密码,和保存天数3个参数
//this.setCookie(this.formLogin.username, this.formLogin.password, 7);
util.cookies.set("username", u);
util.cookies.set("password", p);
util.cookies.set('username', u)
util.cookies.set('password', p)
} else {
console.log("清空Cookie");
console.log('清空Cookie')
//清空Cookie
this.clearCookie();
this.clearCookie()
}
this.$parent.getDateList();
} else {
sessionStorage.removeItem("uuid")
sessionStorage.removeItem("token")
sessionStorage.removeItem('uuid')
sessionStorage.removeItem('token')
this.$message.danger('账号或密码错误')
}
})
.catch(err => {
.catch((err) => {
this.loginLoad = false
this.getCaptcha();
});
this.getCaptcha()
})
}
})
.catch(err => {
.catch((err) => {
this.loginLoad = false
this.getCaptcha();
});
this.getCaptcha()
})
} else {
// 登录表单校验失败
// this.$message.error("表单校验失败");
}
});
})
}
}
};
}
</script>
<style lang="scss" >
@import "./style.scss";
<style lang="scss">
@import './style.scss';
</style>
<template lang="pug">
el-container(style="height:77.6vh")
el-aside( width="18vw" v-loading="leftLoading" style="z-index:1000;box-shadow: 2px 0 8px 0 rgba(0, 0, 0, 0.2);")
div.tree_warp
div.title_warp
span.title-bold(style='padding-right:150px;margin-left:20px;z-index:1001;') 角色列表
el-button(type='primary' v-if="isAuth('sys:role:save')" size='mini' icon='el-icon-plus' @click="addOrUpdateHandle('')") 新增
div.tree_content(v-for='item in tableData' :key='item.roleId' @click='chooseRole(item)' :class="{'isActive': ids == item.roleId}" )
el-tooltip(v-if="item.roleName.replace(/[\u0391-\uFFE5]/g,'aa').length>14" :content="item.roleName" effect="light" placement="top")
div.role_name {{item.roleName | ellipsis}}
div.role_name(v-else) {{item.roleName | ellipsis}}
div(style="width:50%;text-align:right;padding-right:20px")
el-button(v-if="isAuth('sys:role:update')" plain type='primary' size='mini' @click="addOrUpdateHandle(item)") 编辑
el-button(v-if="isAuth('sys:role:delete')" plain type='primary' size='mini' style="margin-left:10px;" @click="delRole(item.roleId)") 删除
el-container(style="height:77vh")
el-header(style='height:42px;line-height:42px;background: #f4f4f4;z-index:1001;border:1px solid rgba(196, 196, 196, 1);')
template()
span.title-bold.title-left-color {{roleName ? roleName : '权限详情'}}&emsp;
el-checkbox(v-model="checked" @change="checkAll") 全选
el-main().box_main
el-card.tableCard( style='overflow:auto;box-sizing:border-box;' v-loading.fullscreen.lock="rightLoading")
div(v-loading="rightLoading1" class='div_tree')
el-tree(ref="tree" @check-change="handleNodeClick" :render-content="renderContent" @node-expand="handleNodeExpand" :default-expanded-keys="expandedKeys" :props="defaultProps" :data="videoData" show-checkbox node-key="menu_id")
div(style="margin-top:20px;")
el-button(type='primary' size='medium' v-if="isAuth('sys:role:update')" @click="saveRoleMenu" v-prevent-re-click) 保存
add-or-update( v-if="addOrUpdateVisible" ref="addOrUpdate" @reFreshDataList="reFreshDataList")
</template>
<script>
import AddOrUpdate from './role-add-or-update'
// import Vue from 'vue'
export default {
data() {
return {
rightLoading: false,
clickFlag: false,
ids: '',
leftLoading: false,
rightLoading1: false,
selection: '',
expandedKeys: [],
addOrUpdateVisible: false,
tableData: [],
checked: false,
isIndeterminate: true,
roleName: '',
activeNames: ['1'], //手风琴
videoData: [],
totalCount: 0,
checkTotalCount: 0,
defaultProps: {
children: 'children',
label: 'name'
}
}
},
filters: {
ellipsis(value) {
// console.log(value)
if (!value) return ''
let len = value.length
let realLength = 0
for (var i = 0; i < len; i++) {
let charCode = value.charCodeAt(i)
if (charCode >= 0 && charCode <= 128) {
realLength += 1
} else {
realLength += 2
}
if (realLength > 14) {
return value.slice(0, i) + '...'
}
}
return value
}
},
components: {
AddOrUpdate
},
watch: {
checkTotalCount() {
// console.log('全部:', this.totalCount, '选中:', this.checkTotalCount)
if (this.checkTotalCount === this.totalCount) {
this.checked = true
} else {
this.checked = false
}
}
},
created() {
//查询角色信息
this.getAllRole()
this.getMenu()
},
mounted() {
var legLast = document.querySelectorAll('.is-leaf')
console.log('====log:', document)
for (let i = 0; i < legLast.length; i++) {
console.log('====log:===', legLast[i].html)
}
},
methods: {
reFreshDataList() {
this.getAllRole()
this.getMenu()
},
// 新增或修改
addOrUpdateHandle(item) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.init(item)
})
},
saveRoleMenu() {
let checkedKeys = this.$refs.tree
.getCheckedKeys()
.concat(this.$refs.tree.getHalfCheckedKeys())
// console.log(checkedKeys)
let checkedRow = this.selection
if (!checkedRow) {
this.$message({
type: 'warning',
message: '请先选择角色!',
duration: 1000
})
return
}
this.clickFlag = true
this.rightLoading = true
// console.log("checkedKeys", checkedKeys);
// console.log("checkedRow", checkedRow);
this.$http({
url: this.$http.adornUrl(`/sys/menu/updateRoleMenu`),
method: 'post',
data: {
roleId: checkedRow,
menuIds: checkedKeys
}
}).then((data) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500
})
} else {
this.$message.error(data.msg)
}
this.reFreshDataList()
this.clickFlag = false
this.rightLoading = false
})
},
checkAll() {
if (!this.checked) {
this.$nextTick(() => {
this.$refs.tree.setCheckedKeys([])
})
this.checkTotalCount = 0
} else {
this.$nextTick(() => {
if (this.videoData) {
this.expandedKeys = this.videoData.map((item) => {
return item.menu_id
})
this.$refs.tree.setCheckedKeys(this.expandedKeys)
}
})
this.checkTotalCount = this.expandedKeys.length
}
},
handleNodeClick() {
this.checkTotalCount = this.$refs.tree.getCheckedKeys().length
},
handleNodeExpand(data) {
for (let m = 0; m < data.children.length; m++) {
this.$refs.tree.store.nodesMap[data.children[m].menu_id].expanded = true
}
},
renderContent(h, { node, data }) {
let nodeName = data.name
if (node.level == 3) {
return (<span class='lastLevel' style='font-size:11px;font-weight:100'>{nodeName}</span>)
} else {
return (<span style='font-size:14px;font-weight:600'>{nodeName}</span>)
}
    },
chooseRole(res) {
this.clickFlag = false
this.ids = res.roleId
this.selection = res.roleId
this.roleName = res.roleName
this.$http({
url: this.$http.adornUrl(`/sys/menu/getRoleMenu`),
method: 'get',
params: this.$http.adornParams({
roleId: res.roleId
})
}).then((data) => {
if (data && data.code === 0) {
let list = data.list.map((item) => {
return item.menu_id
})
this.$nextTick(() => {
this.$refs.tree.setCheckedKeys(list)
if (this.videoData) {
this.expandedKeys = this.videoData.map((item) => {
return item.menu_id
})
}
})
//this.checkTotalCount = data.count
}
})
},
getAllRole() {
this.leftLoading = true
this.$http({
url: this.$http.adornUrl(`/sys/role/getRoleList`),
method: 'get',
params: this.$http.adornParams()
}).then((data) => {
if (data && data.code === 0) {
this.tableData = data.list
// let row = this.$refs.roleTable.data[0]
// this.$refs.roleTable.setCurrentRow(row)
// this.chooseRole(row)
}
this.leftLoading = false
}).then(() => {
this.$nextTick(() => {
this.chooseRole(this.tableData[0])
})
})
},
getMenu() {
this.rightLoading1 = true
this.$http({
url: this.$http.adornUrl(`/sys/menu/getMenu`),
method: 'get',
params: this.$http.adornParams()
}).then((data) => {
if (data && data.code === 0) {
this.videoData = data.result
// console.log(data.size, 'size')
this.totalCount = data.size
// this.totalCount = this.videoData.length
// this.videoData.forEach(e => {
// if (e.children != null && e.children.length > 0) {
// this.totalCount += e.children.length
// e.children.forEach(j => {
// if (j.children != null && j.children.length > 0) {
// this.totalCount += j.children.length
// }
// })
// }
// })
}
this.rightLoading1 = false
})
},
delRole(roleId) {
this.$confirm('确认删除此角色?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.leftLoading = true
let roleIds = [roleId]
this.$http({
url: this.$http.adornUrl(`/sys/role/delete`),
method: 'POST',
data: roleIds
}).then((data) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500
})
} else {
this.$message.error(data.msg)
}
this.getMenu()
this.getAllRole()
this.leftLoading = false
})
})
}
}
}
</script>
<style lang="scss" scoped>
.item {
margin-bottom: 18px;
}
.is-leaf > span:nth-child(0){
font-size:11px;
font-weight: 100;
}
.tree_warp {
overflow: auto;
height: 100%;
box-sizing: border-box;
background: #f4f4f4;
/*border-right: 1px solid rgba(195, 195, 195, 1);*/
/*box-shadow: 2px 0 8px 0 rgba(0, 0, 0, 0.2);*/
/*box-shadow: 2px 0 8px 0 red;*/
.title_warp {
height: 42px;
line-height: 42px;
background: #eef8ff;
color: #333333;
}
.tree_content {
display: flex;
height: 40px;
line-height: 40px;
background: #fff;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
margin: 10px 10px 0 20px;
// float: right;
.role_name {
margin-left: 20px;
width: 50%;
margin-left: 20px;
font-size: 14px;
font-family: Microsoft YaHei;
font-weight: 400;
color: rgba(51, 51, 51, 1);
display: inline-block;
}
}
}
.isActive {
background: #eef8ff !important;
}
.el-tree-node__content {
height: 40px;
.el-tree-node__expand-icon {
position: relative;
left: 126px;
}
}
</style>
<style lang="scss">
.div_tree {
background: #F6F7FB;
border: 1px solid #EDEEF1;
.el-tree-node__expand-icon.el-icon-caret-right:before{
//position:absolute;
//top:1x;
//margin-left:120px;
//display: none;
}
.el-tree-node__expand-icon.el-icon-caret-right:after{
//display: inline-block;
}
.el-tree-node .el-tree-node__content {
// .el-tree-node__label {
// font-size: 14px;
// }
height: 40px;
border-bottom:1px solid #EDEEF1;
span.el-tree-node__label {
font-size: 14px;
font-family: Microsoft YaHei;
height: 17px;
font-weight: bold;
}
}
.el-tree-node__children .el-tree-node__children .el-tree-node__content {
float: left;
}
.el-tree-node__children{
//margin-top: -40px;
//margin-left: 10%;
}
}
</style>
......@@ -3,7 +3,7 @@
div.title-bold(slot='title') {{!id ? '新增角色' : '编辑角色'}}
div()
el-form(:model='dataForm' :rules='dataRule', ref='dataForm', label-width='80px')
el-row(:sapn='24')
el-row()
el-col(:span='24' )
el-form-item(label='角色名称', prop='roleName')
el-input.mywidth(v-model='dataForm.roleName', placeholder='角色名称')
......
......@@ -230,7 +230,6 @@ service.interceptors.response.use(
sessionStorage.removeItem('token')
sessionStorage.removeItem('uuid')
if (this) {
this.$parent.getDateList()
//清空接管提示框
this.$store.dispatch('d2admin/takeover/setTakeover', null)
}
......
......@@ -39,10 +39,12 @@ const frameIn = [
component:layoutHeaderAside,
children:(pre => [
{ path: 'power', name: `${pre}power`, component: () => import('@/pages/kb/power'), meta: { ...meta, title: '用电数据' } },
{ path: 'indoor', name: `${pre}indoor`, component: () => import('@/pages/kb/indoor'), meta: { ...meta, title: '室内气象数据' } }
])('kb-')
},
// 数据分析
{
path: '/analysis',
......@@ -52,8 +54,10 @@ const frameIn = [
children: (pre => [
{ path: 'fault', name: `${pre}fault`, component: () => import('@/pages/analysis/fault'), meta: { ...meta, title: '设备故障报警' } },
{ path: 'energy', name: `${pre}energy`, component: () => import('@/pages/analysis/energy'), meta: { ...meta, title: '能耗数据分析' } }
{ path: 'energy', name: `${pre}energy`, component: () => import('@/pages/analysis/energy'), meta: { ...meta, title: '能耗数据分析' } },
{ path: 'indoor', name: `${pre}indoor`, component: () => import('@/pages/analysis/indoor'), meta: { ...meta, title: '室内气象分析' } },
{ path: 'outdoor', name: `${pre}outdoor`, component: () => import('@/pages/analysis/outdoor'), meta: { ...meta, title: '室外气象分析' } }
])('analysis-')
},
// 系统管理
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment