diff --git a/src/api/dashboard.js b/src/api/dashboard.js index 0a4ddfc..6ad37f1 100644 --- a/src/api/dashboard.js +++ b/src/api/dashboard.js @@ -20,7 +20,7 @@ // 阀门数量 export function valveCount() { return request({ - url: 'waterMeterData/count', + url: '/device/valve/count', method: 'get' }) } @@ -71,3 +71,22 @@ } +// 用水事记查询 +export function getNoteList() { + return request({ + // url: '/note/list', + url: 'waterMeterData/count', + method: 'get', + params + }) +} + +// 用水事记更新 +export function updateNoteList(params) { + return request({ + // url: '/note/update', + url: 'waterMeterData/count', + method: 'post', + params + }) +} diff --git a/src/api/dashboard.js b/src/api/dashboard.js index 0a4ddfc..6ad37f1 100644 --- a/src/api/dashboard.js +++ b/src/api/dashboard.js @@ -20,7 +20,7 @@ // 阀门数量 export function valveCount() { return request({ - url: 'waterMeterData/count', + url: '/device/valve/count', method: 'get' }) } @@ -71,3 +71,22 @@ } +// 用水事记查询 +export function getNoteList() { + return request({ + // url: '/note/list', + url: 'waterMeterData/count', + method: 'get', + params + }) +} + +// 用水事记更新 +export function updateNoteList(params) { + return request({ + // url: '/note/update', + url: 'waterMeterData/count', + method: 'post', + params + }) +} diff --git a/src/views/dashboard/components/AlarmCountByDept.vue b/src/views/dashboard/components/AlarmCountByDept.vue new file mode 100644 index 0000000..91df51d --- /dev/null +++ b/src/views/dashboard/components/AlarmCountByDept.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/src/api/dashboard.js b/src/api/dashboard.js index 0a4ddfc..6ad37f1 100644 --- a/src/api/dashboard.js +++ b/src/api/dashboard.js @@ -20,7 +20,7 @@ // 阀门数量 export function valveCount() { return request({ - url: 'waterMeterData/count', + url: '/device/valve/count', method: 'get' }) } @@ -71,3 +71,22 @@ } +// 用水事记查询 +export function getNoteList() { + return request({ + // url: '/note/list', + url: 'waterMeterData/count', + method: 'get', + params + }) +} + +// 用水事记更新 +export function updateNoteList(params) { + return request({ + // url: '/note/update', + url: 'waterMeterData/count', + method: 'post', + params + }) +} diff --git a/src/views/dashboard/components/AlarmCountByDept.vue b/src/views/dashboard/components/AlarmCountByDept.vue new file mode 100644 index 0000000..91df51d --- /dev/null +++ b/src/views/dashboard/components/AlarmCountByDept.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/src/views/dashboard/components/DeviceCount.vue b/src/views/dashboard/components/DeviceCount.vue index 6c36bcb..453fa09 100644 --- a/src/views/dashboard/components/DeviceCount.vue +++ b/src/views/dashboard/components/DeviceCount.vue @@ -1,5 +1,9 @@ + diff --git a/src/views/dashboard/components/DeviceCount.vue b/src/views/dashboard/components/DeviceCount.vue index 6c36bcb..453fa09 100644 --- a/src/views/dashboard/components/DeviceCount.vue +++ b/src/views/dashboard/components/DeviceCount.vue @@ -1,5 +1,9 @@ + + diff --git a/src/api/dashboard.js b/src/api/dashboard.js index 0a4ddfc..6ad37f1 100644 --- a/src/api/dashboard.js +++ b/src/api/dashboard.js @@ -20,7 +20,7 @@ // 阀门数量 export function valveCount() { return request({ - url: 'waterMeterData/count', + url: '/device/valve/count', method: 'get' }) } @@ -71,3 +71,22 @@ } +// 用水事记查询 +export function getNoteList() { + return request({ + // url: '/note/list', + url: 'waterMeterData/count', + method: 'get', + params + }) +} + +// 用水事记更新 +export function updateNoteList(params) { + return request({ + // url: '/note/update', + url: 'waterMeterData/count', + method: 'post', + params + }) +} diff --git a/src/views/dashboard/components/AlarmCountByDept.vue b/src/views/dashboard/components/AlarmCountByDept.vue new file mode 100644 index 0000000..91df51d --- /dev/null +++ b/src/views/dashboard/components/AlarmCountByDept.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/src/views/dashboard/components/DeviceCount.vue b/src/views/dashboard/components/DeviceCount.vue index 6c36bcb..453fa09 100644 --- a/src/views/dashboard/components/DeviceCount.vue +++ b/src/views/dashboard/components/DeviceCount.vue @@ -1,5 +1,9 @@ + + diff --git a/src/views/dashboard/components/PanelGroup.vue b/src/views/dashboard/components/PanelGroup.vue index 332cbf9..7be90a7 100644 --- a/src/views/dashboard/components/PanelGroup.vue +++ b/src/views/dashboard/components/PanelGroup.vue @@ -62,7 +62,6 @@ context: '--', icon: 'icon-valve', color: '#40c9c6', - path: '/deviceList?deviceType=20', permission: '/device/list' }, { @@ -103,7 +102,7 @@ // 用水量 getWatchStatistic().then(response => { this.dataGroup1[0].context = [response.data.total?parseFloat(response.data.total).toFixed(0):'--', response.data.month?parseFloat(response.data.month).toFixed(0):'--'] - this.dataGroup1[1].context = [response.data.today?parseFloat(response.data.today).toFixed(0):'--', response.data.yesterday?parseFloat(response.data.yesterday).toFixed(0):'--'] + this.dataGroup1[1].context = [response.data.today?parseFloat(response.data.today).toFixed(0):'--', response.data.production?parseFloat(response.data.production).toFixed(0):'--'] this.dataGroup1[2].context = [response.data.sound?Number(response.data.sound).toFixed(2):'--'] }) diff --git a/src/api/dashboard.js b/src/api/dashboard.js index 0a4ddfc..6ad37f1 100644 --- a/src/api/dashboard.js +++ b/src/api/dashboard.js @@ -20,7 +20,7 @@ // 阀门数量 export function valveCount() { return request({ - url: 'waterMeterData/count', + url: '/device/valve/count', method: 'get' }) } @@ -71,3 +71,22 @@ } +// 用水事记查询 +export function getNoteList() { + return request({ + // url: '/note/list', + url: 'waterMeterData/count', + method: 'get', + params + }) +} + +// 用水事记更新 +export function updateNoteList(params) { + return request({ + // url: '/note/update', + url: 'waterMeterData/count', + method: 'post', + params + }) +} diff --git a/src/views/dashboard/components/AlarmCountByDept.vue b/src/views/dashboard/components/AlarmCountByDept.vue new file mode 100644 index 0000000..91df51d --- /dev/null +++ b/src/views/dashboard/components/AlarmCountByDept.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/src/views/dashboard/components/DeviceCount.vue b/src/views/dashboard/components/DeviceCount.vue index 6c36bcb..453fa09 100644 --- a/src/views/dashboard/components/DeviceCount.vue +++ b/src/views/dashboard/components/DeviceCount.vue @@ -1,5 +1,9 @@ + + diff --git a/src/views/dashboard/components/PanelGroup.vue b/src/views/dashboard/components/PanelGroup.vue index 332cbf9..7be90a7 100644 --- a/src/views/dashboard/components/PanelGroup.vue +++ b/src/views/dashboard/components/PanelGroup.vue @@ -62,7 +62,6 @@ context: '--', icon: 'icon-valve', color: '#40c9c6', - path: '/deviceList?deviceType=20', permission: '/device/list' }, { @@ -103,7 +102,7 @@ // 用水量 getWatchStatistic().then(response => { this.dataGroup1[0].context = [response.data.total?parseFloat(response.data.total).toFixed(0):'--', response.data.month?parseFloat(response.data.month).toFixed(0):'--'] - this.dataGroup1[1].context = [response.data.today?parseFloat(response.data.today).toFixed(0):'--', response.data.yesterday?parseFloat(response.data.yesterday).toFixed(0):'--'] + this.dataGroup1[1].context = [response.data.today?parseFloat(response.data.today).toFixed(0):'--', response.data.production?parseFloat(response.data.production).toFixed(0):'--'] this.dataGroup1[2].context = [response.data.sound?Number(response.data.sound).toFixed(2):'--'] }) diff --git a/src/views/dashboard/components/watchAlarmBar.vue b/src/views/dashboard/components/watchAlarmBar.vue index 13824f3..6a18ef6 100644 --- a/src/views/dashboard/components/watchAlarmBar.vue +++ b/src/views/dashboard/components/watchAlarmBar.vue @@ -1,9 +1,11 @@ + @@ -38,51 +40,51 @@ export default { name: 'WatchAlarmBar', data() { - this.extend = { - legend: { - show: false - }, - xAxis: { - axisLabel: { - rotate: 30, - margin: 30, - textStyle: { - align: 'center' - } - } - }, - yAxis: { - name: '报警次数', - position: 'left' - }, - series: { - label: { show: true, position: 'top', formatter: '{c}' }, - barWidth: 25 - }, - tooltip: { trigger: 'item', formatter: '{b}
报警次数:{c}次' } - } - this.grid = { - right: 40, - top: 100, - bottom: 5 - } - this.title = { - text: '水表告警统计' - } - this.chartSettings = { - itemStyle: { - barCategoryGap: 10 - }, - - labelMap: { - 'areaName': '分区', - 'alarm': '报警数', - 'warning': '预警数' - }, - dimension: ['areaName'], - metrics: ['alarm', 'warning'] - } return { + title:{ + text: '水表告警统计' + }, + chartSettings:{ + itemStyle: { + barCategoryGap: 0 + }, + labelMap: { + 'areaName': '分区', + 'alarm': '报警数', + 'warning': '预警数' + }, + dimension: ['areaName'], + metrics: ['alarm', 'warning'] + }, + grid: { + right: 40, + top: 80, + bottom: 5 + }, + extend: { + legend: { + show: false + }, + xAxis: { + axisLabel: { + rotate: 30, + margin: 30, + textStyle: { + align: 'center' + } + } + }, + yAxis: { + name: '报警次数', + position: 'left', + max: 10 + }, + series: { + label: { show: true, position: 'top', formatter: '{c}' }, + barWidth: 20 + }, + // tooltip: { trigger: 'item', formatter: '{b}
报警次数:{c}次' } + }, areaId: '', areaList: [], isShow: true, @@ -100,43 +102,50 @@ } }, chartData: { - columns: ['wellTypeName', 'alarm'], + columns: ['areaName', 'alarm'], rows: [] } } }, mounted() { this.setDefaultTime('today') - this.fetchArea() + // this.fetchArea() }, methods: { - fetchArea() { - getDoorAreaTree().then(response => { - if (response.code === 200) { - this.areaList = response.data.filter(item => { - return item.pid === '1' - }).map(function(item) { - return { - id: item.id, name: item.name - } - }) - if (this.areaList.length !== 0) { this.areaChange(this.areaList[0].id) } - } - }) - }, - areaChange(val) { - this.areaId = val - this.fetchData() - }, + // fetchArea() { + // getDoorAreaTree().then(response => { + // if (response.code === 200) { + // this.areaList = response.data.filter(item => { + // return item.pid === '1' + // }).map(function(item) { + // return { + // id: item.id, name: item.name + // } + // }) + // if (this.areaList.length !== 0) { this.areaChange(this.areaList[0].id) } + // } + // }) + // }, + // areaChange(val) { + // this.areaId = val + // this.fetchData() + // }, fetchData() { const params = { - areaId: this.areaId, + areaId: '110000', startTime: this.timeRange[0], endTime: this.timeRange[1] } + this.$emit('change', params) alarmBySecondArea(params).then(response => { this.isShow = false this.chartData.rows = response.data + const maxValue = Math.max.apply(Math, response.data.map(item=> {return item.alarm>item.warning?item.alarm: item.warning})) + if (maxValue < 10) { + this.extend.yAxis.max = 10 + } else { + this.extend.yAxis = maxValue+1 + } // this.chartData.rows = [ // { 'areaName': '科技楼及食堂', 'alarm': 53 }, // { 'areaName': 'A\\B\\C\\D\\E座', 'alarm': 78 }, @@ -186,10 +195,11 @@ } } .statistic-container { + .el-button{ padding: 5px 10px; } - /*margin-bottom: 10px;*/ + margin-bottom: 10px; text-align: center; .chart-tool-button { padding: 5px; diff --git a/src/api/dashboard.js b/src/api/dashboard.js index 0a4ddfc..6ad37f1 100644 --- a/src/api/dashboard.js +++ b/src/api/dashboard.js @@ -20,7 +20,7 @@ // 阀门数量 export function valveCount() { return request({ - url: 'waterMeterData/count', + url: '/device/valve/count', method: 'get' }) } @@ -71,3 +71,22 @@ } +// 用水事记查询 +export function getNoteList() { + return request({ + // url: '/note/list', + url: 'waterMeterData/count', + method: 'get', + params + }) +} + +// 用水事记更新 +export function updateNoteList(params) { + return request({ + // url: '/note/update', + url: 'waterMeterData/count', + method: 'post', + params + }) +} diff --git a/src/views/dashboard/components/AlarmCountByDept.vue b/src/views/dashboard/components/AlarmCountByDept.vue new file mode 100644 index 0000000..91df51d --- /dev/null +++ b/src/views/dashboard/components/AlarmCountByDept.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/src/views/dashboard/components/DeviceCount.vue b/src/views/dashboard/components/DeviceCount.vue index 6c36bcb..453fa09 100644 --- a/src/views/dashboard/components/DeviceCount.vue +++ b/src/views/dashboard/components/DeviceCount.vue @@ -1,5 +1,9 @@ + + diff --git a/src/views/dashboard/components/PanelGroup.vue b/src/views/dashboard/components/PanelGroup.vue index 332cbf9..7be90a7 100644 --- a/src/views/dashboard/components/PanelGroup.vue +++ b/src/views/dashboard/components/PanelGroup.vue @@ -62,7 +62,6 @@ context: '--', icon: 'icon-valve', color: '#40c9c6', - path: '/deviceList?deviceType=20', permission: '/device/list' }, { @@ -103,7 +102,7 @@ // 用水量 getWatchStatistic().then(response => { this.dataGroup1[0].context = [response.data.total?parseFloat(response.data.total).toFixed(0):'--', response.data.month?parseFloat(response.data.month).toFixed(0):'--'] - this.dataGroup1[1].context = [response.data.today?parseFloat(response.data.today).toFixed(0):'--', response.data.yesterday?parseFloat(response.data.yesterday).toFixed(0):'--'] + this.dataGroup1[1].context = [response.data.today?parseFloat(response.data.today).toFixed(0):'--', response.data.production?parseFloat(response.data.production).toFixed(0):'--'] this.dataGroup1[2].context = [response.data.sound?Number(response.data.sound).toFixed(2):'--'] }) diff --git a/src/views/dashboard/components/watchAlarmBar.vue b/src/views/dashboard/components/watchAlarmBar.vue index 13824f3..6a18ef6 100644 --- a/src/views/dashboard/components/watchAlarmBar.vue +++ b/src/views/dashboard/components/watchAlarmBar.vue @@ -1,9 +1,11 @@ + @@ -38,51 +40,51 @@ export default { name: 'WatchAlarmBar', data() { - this.extend = { - legend: { - show: false - }, - xAxis: { - axisLabel: { - rotate: 30, - margin: 30, - textStyle: { - align: 'center' - } - } - }, - yAxis: { - name: '报警次数', - position: 'left' - }, - series: { - label: { show: true, position: 'top', formatter: '{c}' }, - barWidth: 25 - }, - tooltip: { trigger: 'item', formatter: '{b}
报警次数:{c}次' } - } - this.grid = { - right: 40, - top: 100, - bottom: 5 - } - this.title = { - text: '水表告警统计' - } - this.chartSettings = { - itemStyle: { - barCategoryGap: 10 - }, - - labelMap: { - 'areaName': '分区', - 'alarm': '报警数', - 'warning': '预警数' - }, - dimension: ['areaName'], - metrics: ['alarm', 'warning'] - } return { + title:{ + text: '水表告警统计' + }, + chartSettings:{ + itemStyle: { + barCategoryGap: 0 + }, + labelMap: { + 'areaName': '分区', + 'alarm': '报警数', + 'warning': '预警数' + }, + dimension: ['areaName'], + metrics: ['alarm', 'warning'] + }, + grid: { + right: 40, + top: 80, + bottom: 5 + }, + extend: { + legend: { + show: false + }, + xAxis: { + axisLabel: { + rotate: 30, + margin: 30, + textStyle: { + align: 'center' + } + } + }, + yAxis: { + name: '报警次数', + position: 'left', + max: 10 + }, + series: { + label: { show: true, position: 'top', formatter: '{c}' }, + barWidth: 20 + }, + // tooltip: { trigger: 'item', formatter: '{b}
报警次数:{c}次' } + }, areaId: '', areaList: [], isShow: true, @@ -100,43 +102,50 @@ } }, chartData: { - columns: ['wellTypeName', 'alarm'], + columns: ['areaName', 'alarm'], rows: [] } } }, mounted() { this.setDefaultTime('today') - this.fetchArea() + // this.fetchArea() }, methods: { - fetchArea() { - getDoorAreaTree().then(response => { - if (response.code === 200) { - this.areaList = response.data.filter(item => { - return item.pid === '1' - }).map(function(item) { - return { - id: item.id, name: item.name - } - }) - if (this.areaList.length !== 0) { this.areaChange(this.areaList[0].id) } - } - }) - }, - areaChange(val) { - this.areaId = val - this.fetchData() - }, + // fetchArea() { + // getDoorAreaTree().then(response => { + // if (response.code === 200) { + // this.areaList = response.data.filter(item => { + // return item.pid === '1' + // }).map(function(item) { + // return { + // id: item.id, name: item.name + // } + // }) + // if (this.areaList.length !== 0) { this.areaChange(this.areaList[0].id) } + // } + // }) + // }, + // areaChange(val) { + // this.areaId = val + // this.fetchData() + // }, fetchData() { const params = { - areaId: this.areaId, + areaId: '110000', startTime: this.timeRange[0], endTime: this.timeRange[1] } + this.$emit('change', params) alarmBySecondArea(params).then(response => { this.isShow = false this.chartData.rows = response.data + const maxValue = Math.max.apply(Math, response.data.map(item=> {return item.alarm>item.warning?item.alarm: item.warning})) + if (maxValue < 10) { + this.extend.yAxis.max = 10 + } else { + this.extend.yAxis = maxValue+1 + } // this.chartData.rows = [ // { 'areaName': '科技楼及食堂', 'alarm': 53 }, // { 'areaName': 'A\\B\\C\\D\\E座', 'alarm': 78 }, @@ -186,10 +195,11 @@ } } .statistic-container { + .el-button{ padding: 5px 10px; } - /*margin-bottom: 10px;*/ + margin-bottom: 10px; text-align: center; .chart-tool-button { padding: 5px; diff --git a/src/views/dashboard/components/waterCompare.vue b/src/views/dashboard/components/waterCompare.vue new file mode 100644 index 0000000..8e34936 --- /dev/null +++ b/src/views/dashboard/components/waterCompare.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/src/api/dashboard.js b/src/api/dashboard.js index 0a4ddfc..6ad37f1 100644 --- a/src/api/dashboard.js +++ b/src/api/dashboard.js @@ -20,7 +20,7 @@ // 阀门数量 export function valveCount() { return request({ - url: 'waterMeterData/count', + url: '/device/valve/count', method: 'get' }) } @@ -71,3 +71,22 @@ } +// 用水事记查询 +export function getNoteList() { + return request({ + // url: '/note/list', + url: 'waterMeterData/count', + method: 'get', + params + }) +} + +// 用水事记更新 +export function updateNoteList(params) { + return request({ + // url: '/note/update', + url: 'waterMeterData/count', + method: 'post', + params + }) +} diff --git a/src/views/dashboard/components/AlarmCountByDept.vue b/src/views/dashboard/components/AlarmCountByDept.vue new file mode 100644 index 0000000..91df51d --- /dev/null +++ b/src/views/dashboard/components/AlarmCountByDept.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/src/views/dashboard/components/DeviceCount.vue b/src/views/dashboard/components/DeviceCount.vue index 6c36bcb..453fa09 100644 --- a/src/views/dashboard/components/DeviceCount.vue +++ b/src/views/dashboard/components/DeviceCount.vue @@ -1,5 +1,9 @@ + + diff --git a/src/views/dashboard/components/PanelGroup.vue b/src/views/dashboard/components/PanelGroup.vue index 332cbf9..7be90a7 100644 --- a/src/views/dashboard/components/PanelGroup.vue +++ b/src/views/dashboard/components/PanelGroup.vue @@ -62,7 +62,6 @@ context: '--', icon: 'icon-valve', color: '#40c9c6', - path: '/deviceList?deviceType=20', permission: '/device/list' }, { @@ -103,7 +102,7 @@ // 用水量 getWatchStatistic().then(response => { this.dataGroup1[0].context = [response.data.total?parseFloat(response.data.total).toFixed(0):'--', response.data.month?parseFloat(response.data.month).toFixed(0):'--'] - this.dataGroup1[1].context = [response.data.today?parseFloat(response.data.today).toFixed(0):'--', response.data.yesterday?parseFloat(response.data.yesterday).toFixed(0):'--'] + this.dataGroup1[1].context = [response.data.today?parseFloat(response.data.today).toFixed(0):'--', response.data.production?parseFloat(response.data.production).toFixed(0):'--'] this.dataGroup1[2].context = [response.data.sound?Number(response.data.sound).toFixed(2):'--'] }) diff --git a/src/views/dashboard/components/watchAlarmBar.vue b/src/views/dashboard/components/watchAlarmBar.vue index 13824f3..6a18ef6 100644 --- a/src/views/dashboard/components/watchAlarmBar.vue +++ b/src/views/dashboard/components/watchAlarmBar.vue @@ -1,9 +1,11 @@ + @@ -38,51 +40,51 @@ export default { name: 'WatchAlarmBar', data() { - this.extend = { - legend: { - show: false - }, - xAxis: { - axisLabel: { - rotate: 30, - margin: 30, - textStyle: { - align: 'center' - } - } - }, - yAxis: { - name: '报警次数', - position: 'left' - }, - series: { - label: { show: true, position: 'top', formatter: '{c}' }, - barWidth: 25 - }, - tooltip: { trigger: 'item', formatter: '{b}
报警次数:{c}次' } - } - this.grid = { - right: 40, - top: 100, - bottom: 5 - } - this.title = { - text: '水表告警统计' - } - this.chartSettings = { - itemStyle: { - barCategoryGap: 10 - }, - - labelMap: { - 'areaName': '分区', - 'alarm': '报警数', - 'warning': '预警数' - }, - dimension: ['areaName'], - metrics: ['alarm', 'warning'] - } return { + title:{ + text: '水表告警统计' + }, + chartSettings:{ + itemStyle: { + barCategoryGap: 0 + }, + labelMap: { + 'areaName': '分区', + 'alarm': '报警数', + 'warning': '预警数' + }, + dimension: ['areaName'], + metrics: ['alarm', 'warning'] + }, + grid: { + right: 40, + top: 80, + bottom: 5 + }, + extend: { + legend: { + show: false + }, + xAxis: { + axisLabel: { + rotate: 30, + margin: 30, + textStyle: { + align: 'center' + } + } + }, + yAxis: { + name: '报警次数', + position: 'left', + max: 10 + }, + series: { + label: { show: true, position: 'top', formatter: '{c}' }, + barWidth: 20 + }, + // tooltip: { trigger: 'item', formatter: '{b}
报警次数:{c}次' } + }, areaId: '', areaList: [], isShow: true, @@ -100,43 +102,50 @@ } }, chartData: { - columns: ['wellTypeName', 'alarm'], + columns: ['areaName', 'alarm'], rows: [] } } }, mounted() { this.setDefaultTime('today') - this.fetchArea() + // this.fetchArea() }, methods: { - fetchArea() { - getDoorAreaTree().then(response => { - if (response.code === 200) { - this.areaList = response.data.filter(item => { - return item.pid === '1' - }).map(function(item) { - return { - id: item.id, name: item.name - } - }) - if (this.areaList.length !== 0) { this.areaChange(this.areaList[0].id) } - } - }) - }, - areaChange(val) { - this.areaId = val - this.fetchData() - }, + // fetchArea() { + // getDoorAreaTree().then(response => { + // if (response.code === 200) { + // this.areaList = response.data.filter(item => { + // return item.pid === '1' + // }).map(function(item) { + // return { + // id: item.id, name: item.name + // } + // }) + // if (this.areaList.length !== 0) { this.areaChange(this.areaList[0].id) } + // } + // }) + // }, + // areaChange(val) { + // this.areaId = val + // this.fetchData() + // }, fetchData() { const params = { - areaId: this.areaId, + areaId: '110000', startTime: this.timeRange[0], endTime: this.timeRange[1] } + this.$emit('change', params) alarmBySecondArea(params).then(response => { this.isShow = false this.chartData.rows = response.data + const maxValue = Math.max.apply(Math, response.data.map(item=> {return item.alarm>item.warning?item.alarm: item.warning})) + if (maxValue < 10) { + this.extend.yAxis.max = 10 + } else { + this.extend.yAxis = maxValue+1 + } // this.chartData.rows = [ // { 'areaName': '科技楼及食堂', 'alarm': 53 }, // { 'areaName': 'A\\B\\C\\D\\E座', 'alarm': 78 }, @@ -186,10 +195,11 @@ } } .statistic-container { + .el-button{ padding: 5px 10px; } - /*margin-bottom: 10px;*/ + margin-bottom: 10px; text-align: center; .chart-tool-button { padding: 5px; diff --git a/src/views/dashboard/components/waterCompare.vue b/src/views/dashboard/components/waterCompare.vue new file mode 100644 index 0000000..8e34936 --- /dev/null +++ b/src/views/dashboard/components/waterCompare.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/src/views/dashboard/components/waterCountByAreaBar.vue b/src/views/dashboard/components/waterCountByAreaBar.vue index c488923..f4196f1 100644 --- a/src/views/dashboard/components/waterCountByAreaBar.vue +++ b/src/views/dashboard/components/waterCountByAreaBar.vue @@ -19,14 +19,14 @@ @change="fetchData"/> -
- {{ item.name }} -
+ + + + + + + + @@ -107,7 +107,7 @@ } }, mounted() { - this.setDefaultTime('today') + this.setDefaultTime('week') // this.fetchArea() }, methods: { @@ -180,7 +180,8 @@ const endTime = getDayTime(new Date().getTime()) this.timeRange = [beginTime, endTime.Format('yyyy-MM-dd')] } else if (val === 'week') { - const nowDayOfWeek = new Date().getDay()-1 + // const nowDayOfWeek = new Date().getDay()-1 + const nowDayOfWeek = 6 this.timeRange = [getDayTime(new Date().getTime() - 24 * nowDayOfWeek * 60 * 60 * 1000).Format('yyyy-MM-dd'), getDayTime(new Date().getTime()).Format('yyyy-MM-dd')] } else if (val === 'yesterday') { this.timeRange = [getDayTime(new Date().getTime() - 24 * 60 * 60 * 1000).Format('yyyy-MM-dd'), getDayTime(new Date().getTime() - 24 * 60 * 60 * 1000).Format('yyyy-MM-dd')] diff --git a/src/api/dashboard.js b/src/api/dashboard.js index 0a4ddfc..6ad37f1 100644 --- a/src/api/dashboard.js +++ b/src/api/dashboard.js @@ -20,7 +20,7 @@ // 阀门数量 export function valveCount() { return request({ - url: 'waterMeterData/count', + url: '/device/valve/count', method: 'get' }) } @@ -71,3 +71,22 @@ } +// 用水事记查询 +export function getNoteList() { + return request({ + // url: '/note/list', + url: 'waterMeterData/count', + method: 'get', + params + }) +} + +// 用水事记更新 +export function updateNoteList(params) { + return request({ + // url: '/note/update', + url: 'waterMeterData/count', + method: 'post', + params + }) +} diff --git a/src/views/dashboard/components/AlarmCountByDept.vue b/src/views/dashboard/components/AlarmCountByDept.vue new file mode 100644 index 0000000..91df51d --- /dev/null +++ b/src/views/dashboard/components/AlarmCountByDept.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/src/views/dashboard/components/DeviceCount.vue b/src/views/dashboard/components/DeviceCount.vue index 6c36bcb..453fa09 100644 --- a/src/views/dashboard/components/DeviceCount.vue +++ b/src/views/dashboard/components/DeviceCount.vue @@ -1,5 +1,9 @@ + + diff --git a/src/views/dashboard/components/PanelGroup.vue b/src/views/dashboard/components/PanelGroup.vue index 332cbf9..7be90a7 100644 --- a/src/views/dashboard/components/PanelGroup.vue +++ b/src/views/dashboard/components/PanelGroup.vue @@ -62,7 +62,6 @@ context: '--', icon: 'icon-valve', color: '#40c9c6', - path: '/deviceList?deviceType=20', permission: '/device/list' }, { @@ -103,7 +102,7 @@ // 用水量 getWatchStatistic().then(response => { this.dataGroup1[0].context = [response.data.total?parseFloat(response.data.total).toFixed(0):'--', response.data.month?parseFloat(response.data.month).toFixed(0):'--'] - this.dataGroup1[1].context = [response.data.today?parseFloat(response.data.today).toFixed(0):'--', response.data.yesterday?parseFloat(response.data.yesterday).toFixed(0):'--'] + this.dataGroup1[1].context = [response.data.today?parseFloat(response.data.today).toFixed(0):'--', response.data.production?parseFloat(response.data.production).toFixed(0):'--'] this.dataGroup1[2].context = [response.data.sound?Number(response.data.sound).toFixed(2):'--'] }) diff --git a/src/views/dashboard/components/watchAlarmBar.vue b/src/views/dashboard/components/watchAlarmBar.vue index 13824f3..6a18ef6 100644 --- a/src/views/dashboard/components/watchAlarmBar.vue +++ b/src/views/dashboard/components/watchAlarmBar.vue @@ -1,9 +1,11 @@ + @@ -38,51 +40,51 @@ export default { name: 'WatchAlarmBar', data() { - this.extend = { - legend: { - show: false - }, - xAxis: { - axisLabel: { - rotate: 30, - margin: 30, - textStyle: { - align: 'center' - } - } - }, - yAxis: { - name: '报警次数', - position: 'left' - }, - series: { - label: { show: true, position: 'top', formatter: '{c}' }, - barWidth: 25 - }, - tooltip: { trigger: 'item', formatter: '{b}
报警次数:{c}次' } - } - this.grid = { - right: 40, - top: 100, - bottom: 5 - } - this.title = { - text: '水表告警统计' - } - this.chartSettings = { - itemStyle: { - barCategoryGap: 10 - }, - - labelMap: { - 'areaName': '分区', - 'alarm': '报警数', - 'warning': '预警数' - }, - dimension: ['areaName'], - metrics: ['alarm', 'warning'] - } return { + title:{ + text: '水表告警统计' + }, + chartSettings:{ + itemStyle: { + barCategoryGap: 0 + }, + labelMap: { + 'areaName': '分区', + 'alarm': '报警数', + 'warning': '预警数' + }, + dimension: ['areaName'], + metrics: ['alarm', 'warning'] + }, + grid: { + right: 40, + top: 80, + bottom: 5 + }, + extend: { + legend: { + show: false + }, + xAxis: { + axisLabel: { + rotate: 30, + margin: 30, + textStyle: { + align: 'center' + } + } + }, + yAxis: { + name: '报警次数', + position: 'left', + max: 10 + }, + series: { + label: { show: true, position: 'top', formatter: '{c}' }, + barWidth: 20 + }, + // tooltip: { trigger: 'item', formatter: '{b}
报警次数:{c}次' } + }, areaId: '', areaList: [], isShow: true, @@ -100,43 +102,50 @@ } }, chartData: { - columns: ['wellTypeName', 'alarm'], + columns: ['areaName', 'alarm'], rows: [] } } }, mounted() { this.setDefaultTime('today') - this.fetchArea() + // this.fetchArea() }, methods: { - fetchArea() { - getDoorAreaTree().then(response => { - if (response.code === 200) { - this.areaList = response.data.filter(item => { - return item.pid === '1' - }).map(function(item) { - return { - id: item.id, name: item.name - } - }) - if (this.areaList.length !== 0) { this.areaChange(this.areaList[0].id) } - } - }) - }, - areaChange(val) { - this.areaId = val - this.fetchData() - }, + // fetchArea() { + // getDoorAreaTree().then(response => { + // if (response.code === 200) { + // this.areaList = response.data.filter(item => { + // return item.pid === '1' + // }).map(function(item) { + // return { + // id: item.id, name: item.name + // } + // }) + // if (this.areaList.length !== 0) { this.areaChange(this.areaList[0].id) } + // } + // }) + // }, + // areaChange(val) { + // this.areaId = val + // this.fetchData() + // }, fetchData() { const params = { - areaId: this.areaId, + areaId: '110000', startTime: this.timeRange[0], endTime: this.timeRange[1] } + this.$emit('change', params) alarmBySecondArea(params).then(response => { this.isShow = false this.chartData.rows = response.data + const maxValue = Math.max.apply(Math, response.data.map(item=> {return item.alarm>item.warning?item.alarm: item.warning})) + if (maxValue < 10) { + this.extend.yAxis.max = 10 + } else { + this.extend.yAxis = maxValue+1 + } // this.chartData.rows = [ // { 'areaName': '科技楼及食堂', 'alarm': 53 }, // { 'areaName': 'A\\B\\C\\D\\E座', 'alarm': 78 }, @@ -186,10 +195,11 @@ } } .statistic-container { + .el-button{ padding: 5px 10px; } - /*margin-bottom: 10px;*/ + margin-bottom: 10px; text-align: center; .chart-tool-button { padding: 5px; diff --git a/src/views/dashboard/components/waterCompare.vue b/src/views/dashboard/components/waterCompare.vue new file mode 100644 index 0000000..8e34936 --- /dev/null +++ b/src/views/dashboard/components/waterCompare.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/src/views/dashboard/components/waterCountByAreaBar.vue b/src/views/dashboard/components/waterCountByAreaBar.vue index c488923..f4196f1 100644 --- a/src/views/dashboard/components/waterCountByAreaBar.vue +++ b/src/views/dashboard/components/waterCountByAreaBar.vue @@ -19,14 +19,14 @@ @change="fetchData"/> -
- {{ item.name }} -
+ + + + + + + + @@ -107,7 +107,7 @@ } }, mounted() { - this.setDefaultTime('today') + this.setDefaultTime('week') // this.fetchArea() }, methods: { @@ -180,7 +180,8 @@ const endTime = getDayTime(new Date().getTime()) this.timeRange = [beginTime, endTime.Format('yyyy-MM-dd')] } else if (val === 'week') { - const nowDayOfWeek = new Date().getDay()-1 + // const nowDayOfWeek = new Date().getDay()-1 + const nowDayOfWeek = 6 this.timeRange = [getDayTime(new Date().getTime() - 24 * nowDayOfWeek * 60 * 60 * 1000).Format('yyyy-MM-dd'), getDayTime(new Date().getTime()).Format('yyyy-MM-dd')] } else if (val === 'yesterday') { this.timeRange = [getDayTime(new Date().getTime() - 24 * 60 * 60 * 1000).Format('yyyy-MM-dd'), getDayTime(new Date().getTime() - 24 * 60 * 60 * 1000).Format('yyyy-MM-dd')] diff --git a/src/views/dashboard/components/waterCountByDay.vue b/src/views/dashboard/components/waterCountByDay.vue index 78d1f7c..07524f9 100644 --- a/src/views/dashboard/components/waterCountByDay.vue +++ b/src/views/dashboard/components/waterCountByDay.vue @@ -39,8 +39,7 @@ text: '用水走势图' }, chartSettings: { - labelMap: { - }, + labelMap: {date:'日期'}, metrics: [], dimension: ['date'] }, @@ -76,6 +75,7 @@ fetchArea() { getDoorAreaTree().then(response => { if (response.code === 200) { + debugger const area = response.data.filter(item => { return item.pid === '1' }).map(item => item.name) @@ -91,14 +91,20 @@ }, fetchData() { countByDayFirst(this.query).then(response => { - const arr = response.data.map(function(item) { - for (let i = 0; i < item.data.length; i++) { - item[item.data[i].areaName] = item.data[i].count - } - delete item.data - return item - }) - this.chartData.rows = arr + if(response.data.length>0){ + const arr = response.data.map((item)=> { + const result = {date: item.date} + for (let i = 0; i < item.data.length; i++) { + result[item.data[i].areaName] = item.data[i].count + } + return result + }) + const area = response.data[0].data.map(item=>item.areaName) + this.chartData.columns = ['date', ...area] + this.chartSettings.metrics = area + this.chartSettings.labelMap = {'date':'日期'} + this.chartData.rows = arr + } }) // 模拟数据 // this.chartData.rows = [ @@ -143,17 +149,7 @@ diff --git a/src/api/dashboard.js b/src/api/dashboard.js index 0a4ddfc..6ad37f1 100644 --- a/src/api/dashboard.js +++ b/src/api/dashboard.js @@ -20,7 +20,7 @@ // 阀门数量 export function valveCount() { return request({ - url: 'waterMeterData/count', + url: '/device/valve/count', method: 'get' }) } @@ -71,3 +71,22 @@ } +// 用水事记查询 +export function getNoteList() { + return request({ + // url: '/note/list', + url: 'waterMeterData/count', + method: 'get', + params + }) +} + +// 用水事记更新 +export function updateNoteList(params) { + return request({ + // url: '/note/update', + url: 'waterMeterData/count', + method: 'post', + params + }) +} diff --git a/src/views/dashboard/components/AlarmCountByDept.vue b/src/views/dashboard/components/AlarmCountByDept.vue new file mode 100644 index 0000000..91df51d --- /dev/null +++ b/src/views/dashboard/components/AlarmCountByDept.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/src/views/dashboard/components/DeviceCount.vue b/src/views/dashboard/components/DeviceCount.vue index 6c36bcb..453fa09 100644 --- a/src/views/dashboard/components/DeviceCount.vue +++ b/src/views/dashboard/components/DeviceCount.vue @@ -1,5 +1,9 @@ + + diff --git a/src/views/dashboard/components/PanelGroup.vue b/src/views/dashboard/components/PanelGroup.vue index 332cbf9..7be90a7 100644 --- a/src/views/dashboard/components/PanelGroup.vue +++ b/src/views/dashboard/components/PanelGroup.vue @@ -62,7 +62,6 @@ context: '--', icon: 'icon-valve', color: '#40c9c6', - path: '/deviceList?deviceType=20', permission: '/device/list' }, { @@ -103,7 +102,7 @@ // 用水量 getWatchStatistic().then(response => { this.dataGroup1[0].context = [response.data.total?parseFloat(response.data.total).toFixed(0):'--', response.data.month?parseFloat(response.data.month).toFixed(0):'--'] - this.dataGroup1[1].context = [response.data.today?parseFloat(response.data.today).toFixed(0):'--', response.data.yesterday?parseFloat(response.data.yesterday).toFixed(0):'--'] + this.dataGroup1[1].context = [response.data.today?parseFloat(response.data.today).toFixed(0):'--', response.data.production?parseFloat(response.data.production).toFixed(0):'--'] this.dataGroup1[2].context = [response.data.sound?Number(response.data.sound).toFixed(2):'--'] }) diff --git a/src/views/dashboard/components/watchAlarmBar.vue b/src/views/dashboard/components/watchAlarmBar.vue index 13824f3..6a18ef6 100644 --- a/src/views/dashboard/components/watchAlarmBar.vue +++ b/src/views/dashboard/components/watchAlarmBar.vue @@ -1,9 +1,11 @@ + @@ -38,51 +40,51 @@ export default { name: 'WatchAlarmBar', data() { - this.extend = { - legend: { - show: false - }, - xAxis: { - axisLabel: { - rotate: 30, - margin: 30, - textStyle: { - align: 'center' - } - } - }, - yAxis: { - name: '报警次数', - position: 'left' - }, - series: { - label: { show: true, position: 'top', formatter: '{c}' }, - barWidth: 25 - }, - tooltip: { trigger: 'item', formatter: '{b}
报警次数:{c}次' } - } - this.grid = { - right: 40, - top: 100, - bottom: 5 - } - this.title = { - text: '水表告警统计' - } - this.chartSettings = { - itemStyle: { - barCategoryGap: 10 - }, - - labelMap: { - 'areaName': '分区', - 'alarm': '报警数', - 'warning': '预警数' - }, - dimension: ['areaName'], - metrics: ['alarm', 'warning'] - } return { + title:{ + text: '水表告警统计' + }, + chartSettings:{ + itemStyle: { + barCategoryGap: 0 + }, + labelMap: { + 'areaName': '分区', + 'alarm': '报警数', + 'warning': '预警数' + }, + dimension: ['areaName'], + metrics: ['alarm', 'warning'] + }, + grid: { + right: 40, + top: 80, + bottom: 5 + }, + extend: { + legend: { + show: false + }, + xAxis: { + axisLabel: { + rotate: 30, + margin: 30, + textStyle: { + align: 'center' + } + } + }, + yAxis: { + name: '报警次数', + position: 'left', + max: 10 + }, + series: { + label: { show: true, position: 'top', formatter: '{c}' }, + barWidth: 20 + }, + // tooltip: { trigger: 'item', formatter: '{b}
报警次数:{c}次' } + }, areaId: '', areaList: [], isShow: true, @@ -100,43 +102,50 @@ } }, chartData: { - columns: ['wellTypeName', 'alarm'], + columns: ['areaName', 'alarm'], rows: [] } } }, mounted() { this.setDefaultTime('today') - this.fetchArea() + // this.fetchArea() }, methods: { - fetchArea() { - getDoorAreaTree().then(response => { - if (response.code === 200) { - this.areaList = response.data.filter(item => { - return item.pid === '1' - }).map(function(item) { - return { - id: item.id, name: item.name - } - }) - if (this.areaList.length !== 0) { this.areaChange(this.areaList[0].id) } - } - }) - }, - areaChange(val) { - this.areaId = val - this.fetchData() - }, + // fetchArea() { + // getDoorAreaTree().then(response => { + // if (response.code === 200) { + // this.areaList = response.data.filter(item => { + // return item.pid === '1' + // }).map(function(item) { + // return { + // id: item.id, name: item.name + // } + // }) + // if (this.areaList.length !== 0) { this.areaChange(this.areaList[0].id) } + // } + // }) + // }, + // areaChange(val) { + // this.areaId = val + // this.fetchData() + // }, fetchData() { const params = { - areaId: this.areaId, + areaId: '110000', startTime: this.timeRange[0], endTime: this.timeRange[1] } + this.$emit('change', params) alarmBySecondArea(params).then(response => { this.isShow = false this.chartData.rows = response.data + const maxValue = Math.max.apply(Math, response.data.map(item=> {return item.alarm>item.warning?item.alarm: item.warning})) + if (maxValue < 10) { + this.extend.yAxis.max = 10 + } else { + this.extend.yAxis = maxValue+1 + } // this.chartData.rows = [ // { 'areaName': '科技楼及食堂', 'alarm': 53 }, // { 'areaName': 'A\\B\\C\\D\\E座', 'alarm': 78 }, @@ -186,10 +195,11 @@ } } .statistic-container { + .el-button{ padding: 5px 10px; } - /*margin-bottom: 10px;*/ + margin-bottom: 10px; text-align: center; .chart-tool-button { padding: 5px; diff --git a/src/views/dashboard/components/waterCompare.vue b/src/views/dashboard/components/waterCompare.vue new file mode 100644 index 0000000..8e34936 --- /dev/null +++ b/src/views/dashboard/components/waterCompare.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/src/views/dashboard/components/waterCountByAreaBar.vue b/src/views/dashboard/components/waterCountByAreaBar.vue index c488923..f4196f1 100644 --- a/src/views/dashboard/components/waterCountByAreaBar.vue +++ b/src/views/dashboard/components/waterCountByAreaBar.vue @@ -19,14 +19,14 @@ @change="fetchData"/> -
- {{ item.name }} -
+ + + + + + + + @@ -107,7 +107,7 @@ } }, mounted() { - this.setDefaultTime('today') + this.setDefaultTime('week') // this.fetchArea() }, methods: { @@ -180,7 +180,8 @@ const endTime = getDayTime(new Date().getTime()) this.timeRange = [beginTime, endTime.Format('yyyy-MM-dd')] } else if (val === 'week') { - const nowDayOfWeek = new Date().getDay()-1 + // const nowDayOfWeek = new Date().getDay()-1 + const nowDayOfWeek = 6 this.timeRange = [getDayTime(new Date().getTime() - 24 * nowDayOfWeek * 60 * 60 * 1000).Format('yyyy-MM-dd'), getDayTime(new Date().getTime()).Format('yyyy-MM-dd')] } else if (val === 'yesterday') { this.timeRange = [getDayTime(new Date().getTime() - 24 * 60 * 60 * 1000).Format('yyyy-MM-dd'), getDayTime(new Date().getTime() - 24 * 60 * 60 * 1000).Format('yyyy-MM-dd')] diff --git a/src/views/dashboard/components/waterCountByDay.vue b/src/views/dashboard/components/waterCountByDay.vue index 78d1f7c..07524f9 100644 --- a/src/views/dashboard/components/waterCountByDay.vue +++ b/src/views/dashboard/components/waterCountByDay.vue @@ -39,8 +39,7 @@ text: '用水走势图' }, chartSettings: { - labelMap: { - }, + labelMap: {date:'日期'}, metrics: [], dimension: ['date'] }, @@ -76,6 +75,7 @@ fetchArea() { getDoorAreaTree().then(response => { if (response.code === 200) { + debugger const area = response.data.filter(item => { return item.pid === '1' }).map(item => item.name) @@ -91,14 +91,20 @@ }, fetchData() { countByDayFirst(this.query).then(response => { - const arr = response.data.map(function(item) { - for (let i = 0; i < item.data.length; i++) { - item[item.data[i].areaName] = item.data[i].count - } - delete item.data - return item - }) - this.chartData.rows = arr + if(response.data.length>0){ + const arr = response.data.map((item)=> { + const result = {date: item.date} + for (let i = 0; i < item.data.length; i++) { + result[item.data[i].areaName] = item.data[i].count + } + return result + }) + const area = response.data[0].data.map(item=>item.areaName) + this.chartData.columns = ['date', ...area] + this.chartSettings.metrics = area + this.chartSettings.labelMap = {'date':'日期'} + this.chartData.rows = arr + } }) // 模拟数据 // this.chartData.rows = [ @@ -143,17 +149,7 @@ diff --git a/src/views/dashboard/components/waterNote.vue b/src/views/dashboard/components/waterNote.vue index aa0f448..a4ff85d 100644 --- a/src/views/dashboard/components/waterNote.vue +++ b/src/views/dashboard/components/waterNote.vue @@ -1,15 +1,35 @@ - + + diff --git a/src/api/dashboard.js b/src/api/dashboard.js index 0a4ddfc..6ad37f1 100644 --- a/src/api/dashboard.js +++ b/src/api/dashboard.js @@ -20,7 +20,7 @@ // 阀门数量 export function valveCount() { return request({ - url: 'waterMeterData/count', + url: '/device/valve/count', method: 'get' }) } @@ -71,3 +71,22 @@ } +// 用水事记查询 +export function getNoteList() { + return request({ + // url: '/note/list', + url: 'waterMeterData/count', + method: 'get', + params + }) +} + +// 用水事记更新 +export function updateNoteList(params) { + return request({ + // url: '/note/update', + url: 'waterMeterData/count', + method: 'post', + params + }) +} diff --git a/src/views/dashboard/components/AlarmCountByDept.vue b/src/views/dashboard/components/AlarmCountByDept.vue new file mode 100644 index 0000000..91df51d --- /dev/null +++ b/src/views/dashboard/components/AlarmCountByDept.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/src/views/dashboard/components/DeviceCount.vue b/src/views/dashboard/components/DeviceCount.vue index 6c36bcb..453fa09 100644 --- a/src/views/dashboard/components/DeviceCount.vue +++ b/src/views/dashboard/components/DeviceCount.vue @@ -1,5 +1,9 @@ + + diff --git a/src/views/dashboard/components/PanelGroup.vue b/src/views/dashboard/components/PanelGroup.vue index 332cbf9..7be90a7 100644 --- a/src/views/dashboard/components/PanelGroup.vue +++ b/src/views/dashboard/components/PanelGroup.vue @@ -62,7 +62,6 @@ context: '--', icon: 'icon-valve', color: '#40c9c6', - path: '/deviceList?deviceType=20', permission: '/device/list' }, { @@ -103,7 +102,7 @@ // 用水量 getWatchStatistic().then(response => { this.dataGroup1[0].context = [response.data.total?parseFloat(response.data.total).toFixed(0):'--', response.data.month?parseFloat(response.data.month).toFixed(0):'--'] - this.dataGroup1[1].context = [response.data.today?parseFloat(response.data.today).toFixed(0):'--', response.data.yesterday?parseFloat(response.data.yesterday).toFixed(0):'--'] + this.dataGroup1[1].context = [response.data.today?parseFloat(response.data.today).toFixed(0):'--', response.data.production?parseFloat(response.data.production).toFixed(0):'--'] this.dataGroup1[2].context = [response.data.sound?Number(response.data.sound).toFixed(2):'--'] }) diff --git a/src/views/dashboard/components/watchAlarmBar.vue b/src/views/dashboard/components/watchAlarmBar.vue index 13824f3..6a18ef6 100644 --- a/src/views/dashboard/components/watchAlarmBar.vue +++ b/src/views/dashboard/components/watchAlarmBar.vue @@ -1,9 +1,11 @@ + @@ -38,51 +40,51 @@ export default { name: 'WatchAlarmBar', data() { - this.extend = { - legend: { - show: false - }, - xAxis: { - axisLabel: { - rotate: 30, - margin: 30, - textStyle: { - align: 'center' - } - } - }, - yAxis: { - name: '报警次数', - position: 'left' - }, - series: { - label: { show: true, position: 'top', formatter: '{c}' }, - barWidth: 25 - }, - tooltip: { trigger: 'item', formatter: '{b}
报警次数:{c}次' } - } - this.grid = { - right: 40, - top: 100, - bottom: 5 - } - this.title = { - text: '水表告警统计' - } - this.chartSettings = { - itemStyle: { - barCategoryGap: 10 - }, - - labelMap: { - 'areaName': '分区', - 'alarm': '报警数', - 'warning': '预警数' - }, - dimension: ['areaName'], - metrics: ['alarm', 'warning'] - } return { + title:{ + text: '水表告警统计' + }, + chartSettings:{ + itemStyle: { + barCategoryGap: 0 + }, + labelMap: { + 'areaName': '分区', + 'alarm': '报警数', + 'warning': '预警数' + }, + dimension: ['areaName'], + metrics: ['alarm', 'warning'] + }, + grid: { + right: 40, + top: 80, + bottom: 5 + }, + extend: { + legend: { + show: false + }, + xAxis: { + axisLabel: { + rotate: 30, + margin: 30, + textStyle: { + align: 'center' + } + } + }, + yAxis: { + name: '报警次数', + position: 'left', + max: 10 + }, + series: { + label: { show: true, position: 'top', formatter: '{c}' }, + barWidth: 20 + }, + // tooltip: { trigger: 'item', formatter: '{b}
报警次数:{c}次' } + }, areaId: '', areaList: [], isShow: true, @@ -100,43 +102,50 @@ } }, chartData: { - columns: ['wellTypeName', 'alarm'], + columns: ['areaName', 'alarm'], rows: [] } } }, mounted() { this.setDefaultTime('today') - this.fetchArea() + // this.fetchArea() }, methods: { - fetchArea() { - getDoorAreaTree().then(response => { - if (response.code === 200) { - this.areaList = response.data.filter(item => { - return item.pid === '1' - }).map(function(item) { - return { - id: item.id, name: item.name - } - }) - if (this.areaList.length !== 0) { this.areaChange(this.areaList[0].id) } - } - }) - }, - areaChange(val) { - this.areaId = val - this.fetchData() - }, + // fetchArea() { + // getDoorAreaTree().then(response => { + // if (response.code === 200) { + // this.areaList = response.data.filter(item => { + // return item.pid === '1' + // }).map(function(item) { + // return { + // id: item.id, name: item.name + // } + // }) + // if (this.areaList.length !== 0) { this.areaChange(this.areaList[0].id) } + // } + // }) + // }, + // areaChange(val) { + // this.areaId = val + // this.fetchData() + // }, fetchData() { const params = { - areaId: this.areaId, + areaId: '110000', startTime: this.timeRange[0], endTime: this.timeRange[1] } + this.$emit('change', params) alarmBySecondArea(params).then(response => { this.isShow = false this.chartData.rows = response.data + const maxValue = Math.max.apply(Math, response.data.map(item=> {return item.alarm>item.warning?item.alarm: item.warning})) + if (maxValue < 10) { + this.extend.yAxis.max = 10 + } else { + this.extend.yAxis = maxValue+1 + } // this.chartData.rows = [ // { 'areaName': '科技楼及食堂', 'alarm': 53 }, // { 'areaName': 'A\\B\\C\\D\\E座', 'alarm': 78 }, @@ -186,10 +195,11 @@ } } .statistic-container { + .el-button{ padding: 5px 10px; } - /*margin-bottom: 10px;*/ + margin-bottom: 10px; text-align: center; .chart-tool-button { padding: 5px; diff --git a/src/views/dashboard/components/waterCompare.vue b/src/views/dashboard/components/waterCompare.vue new file mode 100644 index 0000000..8e34936 --- /dev/null +++ b/src/views/dashboard/components/waterCompare.vue @@ -0,0 +1,117 @@ + + + + + diff --git a/src/views/dashboard/components/waterCountByAreaBar.vue b/src/views/dashboard/components/waterCountByAreaBar.vue index c488923..f4196f1 100644 --- a/src/views/dashboard/components/waterCountByAreaBar.vue +++ b/src/views/dashboard/components/waterCountByAreaBar.vue @@ -19,14 +19,14 @@ @change="fetchData"/> -
- {{ item.name }} -
+ + + + + + + + @@ -107,7 +107,7 @@ } }, mounted() { - this.setDefaultTime('today') + this.setDefaultTime('week') // this.fetchArea() }, methods: { @@ -180,7 +180,8 @@ const endTime = getDayTime(new Date().getTime()) this.timeRange = [beginTime, endTime.Format('yyyy-MM-dd')] } else if (val === 'week') { - const nowDayOfWeek = new Date().getDay()-1 + // const nowDayOfWeek = new Date().getDay()-1 + const nowDayOfWeek = 6 this.timeRange = [getDayTime(new Date().getTime() - 24 * nowDayOfWeek * 60 * 60 * 1000).Format('yyyy-MM-dd'), getDayTime(new Date().getTime()).Format('yyyy-MM-dd')] } else if (val === 'yesterday') { this.timeRange = [getDayTime(new Date().getTime() - 24 * 60 * 60 * 1000).Format('yyyy-MM-dd'), getDayTime(new Date().getTime() - 24 * 60 * 60 * 1000).Format('yyyy-MM-dd')] diff --git a/src/views/dashboard/components/waterCountByDay.vue b/src/views/dashboard/components/waterCountByDay.vue index 78d1f7c..07524f9 100644 --- a/src/views/dashboard/components/waterCountByDay.vue +++ b/src/views/dashboard/components/waterCountByDay.vue @@ -39,8 +39,7 @@ text: '用水走势图' }, chartSettings: { - labelMap: { - }, + labelMap: {date:'日期'}, metrics: [], dimension: ['date'] }, @@ -76,6 +75,7 @@ fetchArea() { getDoorAreaTree().then(response => { if (response.code === 200) { + debugger const area = response.data.filter(item => { return item.pid === '1' }).map(item => item.name) @@ -91,14 +91,20 @@ }, fetchData() { countByDayFirst(this.query).then(response => { - const arr = response.data.map(function(item) { - for (let i = 0; i < item.data.length; i++) { - item[item.data[i].areaName] = item.data[i].count - } - delete item.data - return item - }) - this.chartData.rows = arr + if(response.data.length>0){ + const arr = response.data.map((item)=> { + const result = {date: item.date} + for (let i = 0; i < item.data.length; i++) { + result[item.data[i].areaName] = item.data[i].count + } + return result + }) + const area = response.data[0].data.map(item=>item.areaName) + this.chartData.columns = ['date', ...area] + this.chartSettings.metrics = area + this.chartSettings.labelMap = {'date':'日期'} + this.chartData.rows = arr + } }) // 模拟数据 // this.chartData.rows = [ @@ -143,17 +149,7 @@ diff --git a/src/views/dashboard/components/waterNote.vue b/src/views/dashboard/components/waterNote.vue index aa0f448..a4ff85d 100644 --- a/src/views/dashboard/components/waterNote.vue +++ b/src/views/dashboard/components/waterNote.vue @@ -1,15 +1,35 @@ - + + diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 831dbc3..69d09ea 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -2,6 +2,18 @@
+ + + + + + + + + + + + @@ -28,29 +40,16 @@ - + - + - + - - - - - - - - - - - - - - + @@ -72,10 +71,14 @@ import WaterCountByAreaBar from "./components/waterCountByAreaBar"; import WatchAlarmBar from "./components/watchAlarmBar"; import WaterNote from "./components/waterNote"; +import AlarmCountByDept from "./components/AlarmCountByDept"; +import WaterCompare from "./components/waterCompare"; export default { name: 'Dashboard', components: { + WaterCompare, + AlarmCountByDept, WaterNote, WatchAlarmBar, WaterCountByAreaBar, @@ -120,9 +123,9 @@ endTime:new Date().Format('yyyy-MM-dd') },// 分区用水量查询条件 listQuery2:{ - areaId:'', - startTime:'', - endTime:'' + areaId:'110000', + startTime:new Date().Format('yyyy-MM-dd'), + endTime:new Date().Format('yyyy-MM-dd') } // 分区报警查询条件 } }, @@ -145,6 +148,10 @@ // 切换分区查询条件 changeWaterQuery(listQuery1){ this.listQuery1 = listQuery1 + }, + // 切换报警查询条件 + changeAlarmQuery(listQuery2){ + this.listQuery2 = listQuery2 } } }