From 5f7f43f60fdd2fd4cf5c22576fa087cab2bbee85 Mon Sep 17 00:00:00 2001 From: renpy Date: Tue, 11 Jul 2023 17:04:26 +0800 Subject: [PATCH] =?UTF-8?q?alerts=20=20rmssoh=20=20=20met=20=20=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=A2=9E=E5=8A=A0=E6=97=A5=E6=9C=9F=E9=99=90=E5=88=B6?= =?UTF-8?q?=E6=8F=90=E9=86=92=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/statistics/commom.js | 22 ++++++++++ src/views/statistics/imsData/met/index.vue | 42 +++++++++++-------- .../imsData/stateOfHealth/alerts.vue | 42 +++++++++++-------- .../imsData/stateOfHealth/rmssoh.vue | 42 +++++++++++-------- 4 files changed, 94 insertions(+), 54 deletions(-) create mode 100644 src/views/statistics/commom.js diff --git a/src/views/statistics/commom.js b/src/views/statistics/commom.js new file mode 100644 index 0000000..0874ed9 --- /dev/null +++ b/src/views/statistics/commom.js @@ -0,0 +1,22 @@ +const compareDate = function (start, end) { + if (start == null || start.length==0 || end == null || end.length ==0) { + return 0 + } + var arr=start.split("-"); + var starttime=new Date(arr[0],parseInt(arr[1]-1),arr[2]); + var starttimes=starttime.getTime(); + + var arrs=end.split("-"); + var endtime=new Date(arrs[0],parseInt(arrs[1]-1),arrs[2]); + var endtimes=endtime.getTime(); + + var intervalTime = endtimes-starttimes;//两个日期相差的毫秒数 一天86400000毫秒 + var Inter_Days = ((intervalTime).toFixed(2)/86400000)+1;//加1,是让同一天的两个日期返回一天 + + return Inter_Days; +} + + +export { + compareDate +} \ No newline at end of file diff --git a/src/views/statistics/imsData/met/index.vue b/src/views/statistics/imsData/met/index.vue index a29a526..b9d1294 100644 --- a/src/views/statistics/imsData/met/index.vue +++ b/src/views/statistics/imsData/met/index.vue @@ -90,6 +90,7 @@ const columns = [ dataIndex: 'aveWindSpeed', } ] +import { compareDate } from "../../commom" import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { getAction } from '../../../../api/manage' import dateFormat from '../../../../components/jeecg/JEasyCron/format-date' @@ -122,25 +123,30 @@ export default { }, methods: { searchQueryData() { - this.isImmediate = false - this.queryParam = { - startTime: "2023-01-01", - endTime: "2023-07-10", - stationIds: [209, 210] - } - let params = { - ...this.queryParam, - pageNo: 1, - pageSize: 10 - } - getAction(this.url.list, params).then((res) => { - if (res.success) { - this.ipagination.current = res.result.current - this.ipagination.pageSize = res.result.size - this.ipagination.total = res.result.total - this.dataSource = res.result.records + let days = compareDate(this.queryParam.startTime, this.queryParam.endTime) + if (days <= 10) { + this.isImmediate = false + // this.queryParam = { + // startTime: "2023-01-01", + // endTime: "2023-07-10", + // stationIds: [209, 210] + // } + let params = { + ...this.queryParam, + pageNo: 1, + pageSize: 10 } - }) + getAction(this.url.list, params).then((res) => { + if (res.success) { + this.ipagination.current = res.result.current + this.ipagination.pageSize = res.result.size + this.ipagination.total = res.result.total + this.dataSource = res.result.records + } + }) + } else { + this.$message.info("Maximum timespan duration is 10 days. Please, change start or end date.") + } }, findStationList() { getAction(this.url.findStationList, { menuName: '' }).then((res) => { diff --git a/src/views/statistics/imsData/stateOfHealth/alerts.vue b/src/views/statistics/imsData/stateOfHealth/alerts.vue index 9e261f0..bf38ece 100644 --- a/src/views/statistics/imsData/stateOfHealth/alerts.vue +++ b/src/views/statistics/imsData/stateOfHealth/alerts.vue @@ -74,6 +74,7 @@ const columns = [ dataIndex: 'alertText', } ] +import { compareDate } from "../../commom" import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { getAction } from '../../../../api/manage' import dateFormat from '../../../../components/jeecg/JEasyCron/format-date' @@ -106,25 +107,30 @@ export default { }, methods: { searchQueryData() { - this.isImmediate = false - this.queryParam = { - startTime: "2023-01-01", - endTime: "2023-07-10", - stationIds: [209, 210] - } - let params = { - ...this.queryParam, - pageNo: 1, - pageSize: 10 - } - getAction(this.url.list, params).then((res) => { - if (res.success) { - this.ipagination.current = res.result.current - this.ipagination.pageSize = res.result.size - this.ipagination.total = res.result.total - this.dataSource = res.result.records + let days = compareDate(this.queryParam.startTime, this.queryParam.endTime) + if (days <= 10) { + this.isImmediate = false + // this.queryParam = { + // startTime: "2023-01-01", + // endTime: "2023-07-10", + // stationIds: [209, 210] + // } + let params = { + ...this.queryParam, + pageNo: 1, + pageSize: 10 } - }) + getAction(this.url.list, params).then((res) => { + if (res.success) { + this.ipagination.current = res.result.current + this.ipagination.pageSize = res.result.size + this.ipagination.total = res.result.total + this.dataSource = res.result.records + } + }) + } else { + this.$message.info("Maximum timespan duration is 10 days. Please, change start or end date.") + } }, findStationList() { getAction(this.url.findStationList, { menuName: '' }).then((res) => { diff --git a/src/views/statistics/imsData/stateOfHealth/rmssoh.vue b/src/views/statistics/imsData/stateOfHealth/rmssoh.vue index 78bb7e9..1ce091d 100644 --- a/src/views/statistics/imsData/stateOfHealth/rmssoh.vue +++ b/src/views/statistics/imsData/stateOfHealth/rmssoh.vue @@ -70,6 +70,7 @@ const columns = [ dataIndex: 'sohId', } ] +import { compareDate } from "../../commom" import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { getAction } from '../../../../api/manage' import dateFormat from '../../../../components/jeecg/JEasyCron/format-date' @@ -102,25 +103,30 @@ export default { }, methods: { searchQueryData() { - this.isImmediate = false - this.queryParam = { - startTime: "2023-01-01", - endTime: "2023-07-10", - stationIds: [209, 210] - } - let params = { - ...this.queryParam, - pageNo: 1, - pageSize: 10 - } - getAction(this.url.list, params).then((res) => { - if (res.success) { - this.ipagination.current = res.result.current - this.ipagination.pageSize = res.result.size - this.ipagination.total = res.result.total - this.dataSource = res.result.records + let days = compareDate(this.queryParam.startTime, this.queryParam.endTime) + if (days <= 10) { + this.isImmediate = false + // this.queryParam = { + // startTime: "2023-01-01", + // endTime: "2023-07-10", + // stationIds: [209, 210] + // } + let params = { + ...this.queryParam, + pageNo: 1, + pageSize: 10 } - }) + getAction(this.url.list, params).then((res) => { + if (res.success) { + this.ipagination.current = res.result.current + this.ipagination.pageSize = res.result.size + this.ipagination.total = res.result.total + this.dataSource = res.result.records + } + }) + } else { + this.$message.info("Maximum timespan duration is 10 days. Please, change start or end date.") + } }, findStationList() { getAction(this.url.findStationList, { menuName: '' }).then((res) => {