diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index ae7ae6d..36161f2 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -88,6 +88,11 @@ return fmt } +export function getSearchTodayTime() { + const startTime = getDayTime(new Date().getTime()).Format('yyyy-MM-dd hh:mm:ss') + const endTime = getDayTime(new Date().getTime()+ 3599 * 1000 * 24).Format('yyyy-MM-dd hh:mm:ss') + return [startTime, endTime] +} /** * 获取近1周日期范围 * @returns {*[]} diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index ae7ae6d..36161f2 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -88,6 +88,11 @@ return fmt } +export function getSearchTodayTime() { + const startTime = getDayTime(new Date().getTime()).Format('yyyy-MM-dd hh:mm:ss') + const endTime = getDayTime(new Date().getTime()+ 3599 * 1000 * 24).Format('yyyy-MM-dd hh:mm:ss') + return [startTime, endTime] +} /** * 获取近1周日期范围 * @returns {*[]} diff --git a/src/views/alarmRule/components/editRule.vue b/src/views/alarmRule/components/editRule.vue index 135a723..0e6a56e 100644 --- a/src/views/alarmRule/components/editRule.vue +++ b/src/views/alarmRule/components/editRule.vue @@ -3,12 +3,12 @@ - + - + diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index ae7ae6d..36161f2 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -88,6 +88,11 @@ return fmt } +export function getSearchTodayTime() { + const startTime = getDayTime(new Date().getTime()).Format('yyyy-MM-dd hh:mm:ss') + const endTime = getDayTime(new Date().getTime()+ 3599 * 1000 * 24).Format('yyyy-MM-dd hh:mm:ss') + return [startTime, endTime] +} /** * 获取近1周日期范围 * @returns {*[]} diff --git a/src/views/alarmRule/components/editRule.vue b/src/views/alarmRule/components/editRule.vue index 135a723..0e6a56e 100644 --- a/src/views/alarmRule/components/editRule.vue +++ b/src/views/alarmRule/components/editRule.vue @@ -3,12 +3,12 @@ - + - + diff --git a/src/views/alarmStatics/alarmStatics.vue b/src/views/alarmStatics/alarmStatics.vue index baf8cba..1195d22 100644 --- a/src/views/alarmStatics/alarmStatics.vue +++ b/src/views/alarmStatics/alarmStatics.vue @@ -33,6 +33,9 @@ import SimpleCard from '@/components/BigData/Card/simpleCard' import AlarmWellRank from './components/alarmWellRank' import AlarmStaticsByContent from '@/views/alarmStatics/components/alarmStaticsByContent' +import { alarmNowStatic } from '@/api/data/dataStatics' +import { getSearchTodayTime } from '@/utils/dateutils' +import { getAlarmList } from '@/api/alarm/alarm' export default { name: 'AlarmStatics', components: { @@ -47,10 +50,38 @@ return { alarmNow: 0, todayAlarm: 0 - + } + }, + created() { + this.getAlarmCount() + this.getTodayAlarmCount() + }, + methods: { + getAlarmCount() { + alarmNowStatic().then(response => { + this.alarmNow = response.data.total + }) + }, + getTodayAlarmCount() { + const date = getSearchTodayTime() + debugger + const listQuery = { + keywords: '', + alarmType: '', + alarmContentType: '', + beginTime: date[0], + endTime: date[1], + status: '1', + offset: 1, + limit: 20, + sort: '', + order: '' + } // 筛选条件 + getAlarmList(listQuery).then(response => { + this.todayAlarm = parseInt(response.data.total) + }) } } - } diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index ae7ae6d..36161f2 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -88,6 +88,11 @@ return fmt } +export function getSearchTodayTime() { + const startTime = getDayTime(new Date().getTime()).Format('yyyy-MM-dd hh:mm:ss') + const endTime = getDayTime(new Date().getTime()+ 3599 * 1000 * 24).Format('yyyy-MM-dd hh:mm:ss') + return [startTime, endTime] +} /** * 获取近1周日期范围 * @returns {*[]} diff --git a/src/views/alarmRule/components/editRule.vue b/src/views/alarmRule/components/editRule.vue index 135a723..0e6a56e 100644 --- a/src/views/alarmRule/components/editRule.vue +++ b/src/views/alarmRule/components/editRule.vue @@ -3,12 +3,12 @@ - + - + diff --git a/src/views/alarmStatics/alarmStatics.vue b/src/views/alarmStatics/alarmStatics.vue index baf8cba..1195d22 100644 --- a/src/views/alarmStatics/alarmStatics.vue +++ b/src/views/alarmStatics/alarmStatics.vue @@ -33,6 +33,9 @@ import SimpleCard from '@/components/BigData/Card/simpleCard' import AlarmWellRank from './components/alarmWellRank' import AlarmStaticsByContent from '@/views/alarmStatics/components/alarmStaticsByContent' +import { alarmNowStatic } from '@/api/data/dataStatics' +import { getSearchTodayTime } from '@/utils/dateutils' +import { getAlarmList } from '@/api/alarm/alarm' export default { name: 'AlarmStatics', components: { @@ -47,10 +50,38 @@ return { alarmNow: 0, todayAlarm: 0 - + } + }, + created() { + this.getAlarmCount() + this.getTodayAlarmCount() + }, + methods: { + getAlarmCount() { + alarmNowStatic().then(response => { + this.alarmNow = response.data.total + }) + }, + getTodayAlarmCount() { + const date = getSearchTodayTime() + debugger + const listQuery = { + keywords: '', + alarmType: '', + alarmContentType: '', + beginTime: date[0], + endTime: date[1], + status: '1', + offset: 1, + limit: 20, + sort: '', + order: '' + } // 筛选条件 + getAlarmList(listQuery).then(response => { + this.todayAlarm = parseInt(response.data.total) + }) } } - } diff --git a/src/views/alarmStatics/components/alarmWellRank.vue b/src/views/alarmStatics/components/alarmWellRank.vue index f666639..f752abe 100644 --- a/src/views/alarmStatics/components/alarmWellRank.vue +++ b/src/views/alarmStatics/components/alarmWellRank.vue @@ -40,18 +40,7 @@ endTime: '' // 结束时间 }, // 查询结果 alarmContentTypeList: [], - list: [ - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 } - ], + list: [], total: 0 } }, diff --git a/src/utils/dateutils.js b/src/utils/dateutils.js index ae7ae6d..36161f2 100644 --- a/src/utils/dateutils.js +++ b/src/utils/dateutils.js @@ -88,6 +88,11 @@ return fmt } +export function getSearchTodayTime() { + const startTime = getDayTime(new Date().getTime()).Format('yyyy-MM-dd hh:mm:ss') + const endTime = getDayTime(new Date().getTime()+ 3599 * 1000 * 24).Format('yyyy-MM-dd hh:mm:ss') + return [startTime, endTime] +} /** * 获取近1周日期范围 * @returns {*[]} diff --git a/src/views/alarmRule/components/editRule.vue b/src/views/alarmRule/components/editRule.vue index 135a723..0e6a56e 100644 --- a/src/views/alarmRule/components/editRule.vue +++ b/src/views/alarmRule/components/editRule.vue @@ -3,12 +3,12 @@ - + - + diff --git a/src/views/alarmStatics/alarmStatics.vue b/src/views/alarmStatics/alarmStatics.vue index baf8cba..1195d22 100644 --- a/src/views/alarmStatics/alarmStatics.vue +++ b/src/views/alarmStatics/alarmStatics.vue @@ -33,6 +33,9 @@ import SimpleCard from '@/components/BigData/Card/simpleCard' import AlarmWellRank from './components/alarmWellRank' import AlarmStaticsByContent from '@/views/alarmStatics/components/alarmStaticsByContent' +import { alarmNowStatic } from '@/api/data/dataStatics' +import { getSearchTodayTime } from '@/utils/dateutils' +import { getAlarmList } from '@/api/alarm/alarm' export default { name: 'AlarmStatics', components: { @@ -47,10 +50,38 @@ return { alarmNow: 0, todayAlarm: 0 - + } + }, + created() { + this.getAlarmCount() + this.getTodayAlarmCount() + }, + methods: { + getAlarmCount() { + alarmNowStatic().then(response => { + this.alarmNow = response.data.total + }) + }, + getTodayAlarmCount() { + const date = getSearchTodayTime() + debugger + const listQuery = { + keywords: '', + alarmType: '', + alarmContentType: '', + beginTime: date[0], + endTime: date[1], + status: '1', + offset: 1, + limit: 20, + sort: '', + order: '' + } // 筛选条件 + getAlarmList(listQuery).then(response => { + this.todayAlarm = parseInt(response.data.total) + }) } } - } diff --git a/src/views/alarmStatics/components/alarmWellRank.vue b/src/views/alarmStatics/components/alarmWellRank.vue index f666639..f752abe 100644 --- a/src/views/alarmStatics/components/alarmWellRank.vue +++ b/src/views/alarmStatics/components/alarmWellRank.vue @@ -40,18 +40,7 @@ endTime: '' // 结束时间 }, // 查询结果 alarmContentTypeList: [], - list: [ - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 }, - { wellCode: 'aaaa', position: '中关村南大街5号院', alarmCount: 5, count: 0 } - ], + list: [], total: 0 } }, diff --git a/src/views/dashboard/components/AlarmNowList.vue b/src/views/dashboard/components/AlarmNowList.vue index 890325f..3bb5c4d 100644 --- a/src/views/dashboard/components/AlarmNowList.vue +++ b/src/views/dashboard/components/AlarmNowList.vue @@ -1,6 +1,4 @@ - +