src/api/exceptionApi.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/utils/chartFunction/lineChart.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/utils/time.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/data_management/HistoryData.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/exception/components/CompFlightInspection.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/risk_assessment/components/CompDataRiskModel.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/risk_assessment/riskModel/components/CompDailyStatistic.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/api/exceptionApi.js
@@ -16,7 +16,11 @@ endTime: endTime, type:type } }) }).then(res=>{ return res.data.data.sort((a,b)=>{ const dateA = new Date(a.lst) const dateB = new Date(b.lst) return dateA - dateB })}) }, // 根据月份和类型查找分析数据 @@ -39,12 +43,6 @@ } }) }, /** * src/utils/chartFunction/lineChart.js
@@ -79,42 +79,6 @@ }, /** * 返回无数据的时间段 * @param: * @returns: */ backNoDataInteval(dataBeginTime, dataEndTime) { const result = [] // 数据开始时间 const start = dayjs(dataBeginTime) // 数据结束时间 const end = dayjs(dataEndTime) // 该月的1号 const monthStart = start.startOf('month') // 该月最后一天 const monthEnd = start.endOf('month') // 数据起始不等于月初 且 数据结束不等于月末 if (!start.isSame(monthStart, 'day') && !end.isSame(monthEnd, 'day')) { result.push([monthStart.format('YYYY-MM-DD'), start.format('YYYY-MM-DD')]) result.push([end.format('YYYY-MM-DD'), monthEnd.format('YYYY-MM-DD')]) } // 数据起始等于月初 且 数据结束不等于月末 if (start.isSame(monthStart, 'day') && !end.isSame(monthEnd, 'day')) { result.push([end.format('YYYY-MM-DD'), monthEnd.format('YYYY-MM-DD')]) } // 数据起始不等于月初 且 数据结束等于月末 if (!start.isSame(monthStart, 'day') && end.isSame(monthEnd, 'day')) { result.push([monthStart.format('YYYY-MM-DD'), start.format('YYYY-MM-DD')]) } // 数据起始等于月初 且 数据结束等于月末 (这种情况没有空数据的时间间隔) return result }, /** * 组成无数据区域 * @param: 2维数组 * @returns: src/utils/time.js
@@ -145,13 +145,35 @@ }, /** * 根据对象数组中lst字段按升序排列 * @param: * 找到在给定的开始时间bt和结束时间et之间缺失的时间区间 * @param:开始时间,结束时间,在这个时间范围内已有的时间(时间字符串数组) * @returns: */ compareByScore(a, b) { const dateA = new Date(a.lst) const dateB = new Date(b.lst) return dateA - dateB getMissingDays(bt, et, timeArr) { // 存储缺失的时间区间 const r = [] const begin = dayjs(bt) const end = dayjs(et) // 开始时间 let current = begin for (const time of timeArr) { const currentTime = dayjs(time) if (currentTime.isBefore(current)) { continue } if (currentTime.isAfter(current)) { r.push([current.format('YYYY-MM-DD'), currentTime.format('YYYY-MM-DD')]) } current = currentTime.add(1, 'day') } if (end.isAfter(current)) { r.push([current.format('YYYY-MM-DD'), end.format('YYYY-MM-DD')]) } return r } } src/views/data_management/HistoryData.vue
@@ -194,14 +194,14 @@ // 保存返回的 this.tableData = response.data.data.rows; this.displayData = this.tableData; this.loading = false; if (response.data.data.total == 0) { ElMessage('该时段无数据'); this.isNoData = true; return; } this.total = response.data.data.total; this.loading = false; }); } } src/views/exception/components/CompFlightInspection.vue
@@ -923,7 +923,6 @@ params['beginTime'] = this.beginTime params['endTime'] = this.endTime console.log('name',this.siteName) this.$http.get('/dust/exceptiondata', { params: params }).then((response) => { // 保存返回的 // this.tableData = response.data.data.rows; src/views/risk_assessment/components/CompDataRiskModel.vue
@@ -3,17 +3,13 @@ import InputSearch from '@/sfc/InputSearch.vue' import AreaAndmonitorType from '@/sfc/AreaAndmonitorType.vue' import exceptionApi from '@/api/exceptionApi.js' import DustRadarChart from '@/views/risk_assessment/components/DustRadarChart.vue' import FYLineChart from '@/components/chart/FYLineChart.vue' import time from '@/utils/time.js' import index from '@/utils/risk_estimate_common_function/index.js' import ButtonClick from '@/sfc/ButtonClick.vue' import dayjs from 'dayjs' import MonthSelect from '@/sfc/MonthSelect.vue' import riskApi from '@/api/risk/riskApi.js' import riskValue from '@/utils/risk_estimate_common_function/riskValue.js' import lineChart from '@/utils/chartFunction/lineChart.js' import siteInfo from '@/api/site/siteInfo.js' import CompDailyStatistic from '@/views/risk_assessment/riskModel/components/CompDailyStatistic.vue' export default { @@ -35,7 +31,6 @@ } }, components: { FYLineChart, InputSearch, AreaAndmonitorType, DustRadarChart, @@ -59,9 +54,9 @@ form: { // 站点名称 name: '', siteName: '', // 设备编号 number: '3234', mnCode: '3234', // 开始时间 beginTime: '', // 结束时间 @@ -119,29 +114,20 @@ } }, watch: { // showAll() { // console.log('1111') // // 页面加载时showAll才会变化一次 // // 为true表示的风险模型页面 // if (this.showAll) { // // 加载风险值最高的站点数据 // this.ShowDefaultData() // } // }, siteName() { if (this.siteName != '') { // 更新站点名字和时间 this.form.name = this.siteName this.form.siteName = this.siteName this.screenLoading = true siteInfo.queryMnCode(this.siteName).then((response) => { this.form.number = response.data.data[0].mnCode this.form.mnCode = response.data.data[0].mnCode this.month = this.time // 同时更新月起始时间 this.form.beginTime = dayjs(this.month).startOf().format('YYYY-MM-DD HH:mm:ss') this.form.endTime = dayjs(this.month).endOf('month').format('YYYY-MM-DD HH:mm:ss') // 更新该站点的所属场景和运维商 this.getSiteInfo(this.form.number) this.getSiteInfo(this.form.mnCode) // 更新统计数据 this.getAnalysisData() // 计算风险值 @@ -167,7 +153,7 @@ methods: { // 查询站点统计信息 async querySiteStaticsInfo(row) { this.form.name = row.siteName this.form.siteName = row.siteName // 更新统计数据 await this.getAnalysisData() // 计算风险值 @@ -192,7 +178,7 @@ // 更新排名清单 this.getRiskRank() // 更新该站点的所属场景和运维商 this.getSiteInfo(this.form.number) this.getSiteInfo(this.form.mnCode) // 更新分析数据 this.getAnalysisData() // 计算风险值 @@ -222,12 +208,12 @@ this.screenLoading = true // 更新排名清单,并得到风险值最高站点 let arr = await this.getRiskRank() this.form.name = arr[0] this.form.number = arr[1] this.form.siteName = arr[0] this.form.mnCode = arr[1] this.screenLoading = false // 更新该站点的所属场景和运维商 this.getSiteInfo(this.form.number) this.getSiteInfo(this.form.mnCode) // 更新日统计数据 this.getAnalysisData() // 计算风险值 @@ -240,7 +226,7 @@ * @returns: */ calRiskValue() { riskApi.queryRiskValue(this.form.number, this.month, 'month').then((response) => { riskApi.queryRiskValue(this.form.mnCode, this.month, 'month').then((response) => { const rValue = response.data.data[0] this.exceptionRisk.onlineRisk = rValue.onlineRisk this.exceptionRisk.validRisk = rValue.validRisk @@ -254,29 +240,18 @@ // 根据目前站点,月份,查折线图日统计数据 fetchDayAnalysisData() { let params = {} if (this.form.name) { params['siteName'] = this.form.name } if (this.form.beginTime) { params['beginTime'] = this.form.beginTime } if (this.form.endTime) { params['endTime'] = this.form.endTime } this.loading = true this.queryButton = true exceptionApi .analysisdata(this.form.name, this.form.beginTime, this.form.endTime, 'day') .analysisdata(this.form.siteName, this.form.beginTime, this.form.endTime, 'day') .then((response) => { this.chartData = response.data.data this.chartData = response this.loading = false this.queryButton = false if (response.data.data.length == 0) { if (response.length == 0) { this.isNoData = true return } this.chartData.sort(time.compareByScore) // 分析数据中的最早时间 let begin = this.chartData[0].lst // 分析数据中的最晚时间 @@ -300,7 +275,7 @@ fetchExceptionAnalysisData() { exceptionApi .exceptiondata1({ siteName: this.form.name, siteName: this.form.siteName, beginTime: this.form.beginTime, endTime: this.form.endTime }) @@ -357,7 +332,7 @@ }, openDetail() { const encodedSiteName = encodeURIComponent(this.form.name) const encodedSiteName = encodeURIComponent(this.form.siteName) const timeType = '1' const jumpPage = '2' this.$router.push(`/exceptionDetail/${encodedSiteName}/${this.month}/${timeType}/${jumpPage}`) @@ -374,10 +349,10 @@ <el-form-item class="form-item"> <InputSearch :site-name="form.name" :site-name="form.siteName" isNeedDefaultSite="0" @submit-value="(n) => (form.name = n)" @submit-mncode="(n) => (form.number = n)" @submit-value="(n) => (form.siteName = n)" @submit-mncode="(n) => (form.mnCode = n)" ></InputSearch> </el-form-item> @@ -398,7 +373,7 @@ <div v-loading="screenLoading" class="wait-name"> <div class="chart-container" v-show="!isNoData && !screenLoading"> <el-card class="time-text"> <h4>{{ form.name }}</h4> <h4>{{ form.siteName }}</h4> <br /> <br /> src/views/risk_assessment/riskModel/components/CompDailyStatistic.vue
@@ -1,16 +1,16 @@ <script> import exceptionApi from '@/api/exceptionApi.js' import lineChart from '@/utils/chartFunction/lineChart.js' import index from '@/utils/risk_estimate_common_function/index.js' import time from '@/utils/time.js' // import time from '@/utils/time.js' import FYLineChart from '@/components/chart/FYLineChart.vue' export default { props: { fetchParams: { type: Object, default: { name: null, number: null, siteName: null, mnCode: null, beginTime: null, endTime: null } @@ -34,7 +34,7 @@ watch: { fetchParams: { handler() { if(this.fetchParams.name != '' && this.fetchParams.name != null){ if(this.fetchParams.siteName != '' && this.fetchParams.siteName != null){ this.fetchDayAnalysisData() } }, @@ -46,40 +46,40 @@ methods: { // 根据目前站点,月份,查折线图日统计数据 fetchDayAnalysisData() { exceptionApi .analysisdata( this.fetchParams.name, exceptionApi.analysisdata( this.fetchParams.siteName, this.fetchParams.beginTime, this.fetchParams.endTime, 'day' ) .then((response) => { const chartData = response.data.data console.log('数据为',chartData); if (response.data.data.length == 0) { .then(response => { const chartData = response if (chartData.length == 0) { return } chartData.sort(time.compareByScore) // 分析数据中的最早时间 let begin = chartData[0].lst // 分析数据中的最晚时间 let end = chartData[chartData.length - 1].lst const timeArr = chartData.map(item => { return item.lst }) // 无数据的时间段 let noDataTimeInteval = lineChart.backNoDataInteval(begin, end) let noDataTimeInterval = time.getMissingDays(this.fetchParams.beginTime, this.fetchParams.endTime,timeArr) // 无数据配置时间段 this.chart.areaColor = lineChart.getMarkArea(noDataTimeInteval) this.chart.areaColor = lineChart.getMarkArea(noDataTimeInterval) this.setChart(chartData, this.fetchParams.beginTime, this.fetchParams.endTime) }) }, // 选择其他值类型时 /** * 组件折线图的配置项 * @param: * @returns: */ setChart(cData, bt, et) { if (cData.length!=0) { // 构建折线图x,y数据 let obj = lineChart.getLineChartXYData(cData, bt, et) console.log('设置:',obj); this.chart.chartDataAvg = { x: obj.xData, y: obj.yAvg