From c2f95b0b9090a2394b5b068582b932a5e57b86aa Mon Sep 17 00:00:00 2001 From: zmc <zmc_li@foxmail.com> Date: 星期二, 05 九月 2023 18:19:37 +0800 Subject: [PATCH] 雷达图 新增综合风险排名 数据接入配置 --- src/api/exceptionApi.js | 7 package-lock.json | 14 src/views/line_graph/SiteComprehensiveRskRanking.vue | 271 ++++++++++++ components.d.ts | 2 src/utils/risk_estimate_common_function/index.js | 149 +++++++ src/views/exception/FlightInspection.vue | 93 +++- src/views/line_graph/DataRiskModel.vue | 279 +++++++------ src/views/setting/SetConfiguration.vue | 125 +++--- src/views/exception/SiteAuditAssistance.vue | 131 +++++- src/main.ts | 33 + src/api/data_access_setting/settingApi.js | 15 src/views/login/LoginSystem.vue | 3 package.json | 1 src/views/line_graph/DataRiskRank.vue | 5 src/views/line_graph/components/DustRadarChart.vue | 16 src/components/layout/AppAside.vue | 39 - src/router/index.ts | 2 17 files changed, 887 insertions(+), 298 deletions(-) diff --git a/components.d.ts b/components.d.ts index 733691a..84d2d19 100644 --- a/components.d.ts +++ b/components.d.ts @@ -39,6 +39,8 @@ ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] ElOption: typeof import('element-plus/es')['ElOption'] ElPagination: typeof import('element-plus/es')['ElPagination'] + ElRadio: typeof import('element-plus/es')['ElRadio'] + ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] ElRow: typeof import('element-plus/es')['ElRow'] ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElSelect: typeof import('element-plus/es')['ElSelect'] diff --git a/package-lock.json b/package-lock.json index 4044c4b..70bcd34 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "dayjs": "^1.11.9", "echarts": "^5.4.3", "element-plus": "^2.3.6", + "js-cookie": "^3.0.1", "pinia": "^2.1.3", "sass": "^1.63.4", "vue": "^3.3.4", @@ -4148,6 +4149,14 @@ "resolved": "https://registry.npmmirror.com/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true + }, + "node_modules/js-cookie": { + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/js-cookie/-/js-cookie-3.0.1.tgz", + "integrity": "sha512-+0rgsUXZu4ncpPxRL+lNEptWMOWl9etvPHc/koSRp6MPwpRYAhmk0dUG00J4bxVV3r9uUzfo24wW0knS07SKSw==", + "engines": { + "node": ">=12" + } }, "node_modules/js-stringify": { "version": "1.0.2", @@ -9961,6 +9970,11 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "js-cookie": { + "version": "3.0.1", + "resolved": "https://registry.npmmirror.com/js-cookie/-/js-cookie-3.0.1.tgz", + "integrity": "sha512-+0rgsUXZu4ncpPxRL+lNEptWMOWl9etvPHc/koSRp6MPwpRYAhmk0dUG00J4bxVV3r9uUzfo24wW0knS07SKSw==" + }, "js-stringify": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/js-stringify/-/js-stringify-1.0.2.tgz", diff --git a/package.json b/package.json index 8b81bfd..568d68e 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "dayjs": "^1.11.9", "echarts": "^5.4.3", "element-plus": "^2.3.6", + "js-cookie": "^3.0.1", "pinia": "^2.1.3", "sass": "^1.63.4", "vue": "^3.3.4", diff --git a/src/api/data_access_setting/settingApi.js b/src/api/data_access_setting/settingApi.js new file mode 100644 index 0000000..857b188 --- /dev/null +++ b/src/api/data_access_setting/settingApi.js @@ -0,0 +1,15 @@ +import {$http} from '@/api/index.js'; + +export default { + + /** + * 鏍规嵁绔欑偣锛屾椂闂存鏌ヨ鍘嗗彶琛ㄤ腑鎵�鏈夋暟鎹� + * @param锛� + * @returns锛� + */ + submitSetting(argsObj){ + + return $http.post('dust/setting',argsObj); + } + +} \ No newline at end of file diff --git a/src/api/exceptionApi.js b/src/api/exceptionApi.js index e061235..e6b3d02 100644 --- a/src/api/exceptionApi.js +++ b/src/api/exceptionApi.js @@ -36,5 +36,12 @@ _params.exceptionType = exceptionType; } return $http.get('/dust/exceptiondata1', { params: _params }); + }, + + getSitesNum(){ + return $http.get('/dust/sitename'); } + + + }; diff --git a/src/components/layout/AppAside.vue b/src/components/layout/AppAside.vue index 184e19d..6ae8ff1 100644 --- a/src/components/layout/AppAside.vue +++ b/src/components/layout/AppAside.vue @@ -1,24 +1,11 @@ <script> import { isCollapse } from './isCollapse'; -import { selectedName } from './selectName'; export default { data() { return { menuHeight: '600px', isCollapseAside: isCollapse, - selected: selectedName, - optionClick: [ - ' 鏁版嵁椋庨櫓妯″瀷', - '鏁版嵁椋庨櫓鎺掑悕', - '绔欑偣缁煎悎椋庨櫓鎺掑悕', - '椋炶宸℃', - '绔欑偣瀹℃牳杈呭姪', - '鍘嗗彶鏁版嵁绠$悊', - '鏁版嵁鎺ュ叆绠$悊', - '涓氬姟鎶ヨ〃', - '鏁版嵁鎺ュ叆閰嶇疆', - ] }; }, methods:{ @@ -30,7 +17,6 @@ mounted(){ this.menuHeight = this.calMenuHeight(); console.log('meta:',this.$route.matched); - } }; </script> @@ -63,16 +49,16 @@ <span class="parent-title">椋庨櫓璇勪及</span> </template> - <el-menu-item index="avgDay" @click="selected = optionClick[0]"> + <el-menu-item index="avgDay" > <el-icon><i-ep-Stopwatch /></el-icon> 鏁版嵁椋庨櫓妯″瀷 </el-menu-item> - <el-menu-item index="analysis" @click="selected = optionClick[1]"> + <el-menu-item index="analysis" > <el-icon><i-ep-Stopwatch /></el-icon> - 鏁版嵁椋庨櫓鎺掑悕 - </el-menu-item><el-menu-item index="riskrank" @click="selected = optionClick[2]"> + 鏁版嵁鎺掑悕娓呭崟 + </el-menu-item><el-menu-item index="riskrank" > <el-icon><i-ep-Stopwatch /></el-icon> - 绔欑偣缁煎悎椋庨櫓鎺掑悕 + 缁煎悎椋庨櫓鎺掑悕 </el-menu-item> @@ -84,12 +70,12 @@ <el-icon><i-ep-Histogram /></el-icon> <span class="parent-title">绾夸笂宸℃</span> </template> - <el-menu-item index="edata" @click="selected = optionClick[3]"> + <el-menu-item index="edata" > <el-icon><i-ep-Bell /></el-icon> 椋炶宸℃ </el-menu-item> - <el-menu-item index="testData" @click="selected = optionClick[4]"> + <el-menu-item index="testData"> <el-icon><i-ep-Bell /></el-icon> 绔欑偣瀹℃牳杈呭姪 </el-menu-item> @@ -103,18 +89,19 @@ </template> - <el-menu-item index="hdata" @click="selected = optionClick[4]"> + <el-menu-item index="hdata" > <el-icon><i-ep-Histogram /></el-icon> 鍘嗗彶鏁版嵁绠$悊 </el-menu-item> - <el-menu-item index="management" @click="selected = optionClick[5]"> + + <!-- <el-menu-item index="management" > <el-icon><i-ep-Histogram /></el-icon> 鏁版嵁鎺ュ叆绠$悊 </el-menu-item> - <el-menu-item index="report" @click="selected = optionClick[6]"> + <el-menu-item index="report" > <el-icon><i-ep-Histogram /></el-icon> 涓氬姟鎶ヨ〃 - </el-menu-item> + </el-menu-item> --> </el-sub-menu> @@ -124,7 +111,7 @@ <span class="parent-title">閰嶇疆绠$悊</span> </template> - <el-menu-item index="setting" @click="selected = optionClick[7]"> + <el-menu-item index="setting" > <el-icon><i-ep-Histogram /></el-icon> 鏁版嵁鎺ュ叆閰嶇疆 </el-menu-item> diff --git a/src/main.ts b/src/main.ts index bc891f6..b6f4335 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,8 +1,6 @@ -// import './assets/main.css' - import { createApp } from 'vue' -import { createPinia } from 'pinia' - +// import { createPinia } from 'pinia' +import Cookie from 'js-cookie' import App from './App.vue' import router from './router' @@ -14,21 +12,34 @@ const app = createApp(App) -function SecretPiniaPlugin() { - return { secret: 'the cake is a lie',vue:'333.0' } - } + +// function SecretPiniaPlugin() { +// return { secret: 'the cake is a lie',vue:'333.0' } +// } - const pinia = createPinia() - // 灏嗘彃浠舵彁渚涚粰 pinia - pinia.use(SecretPiniaPlugin) +// const pinia = createPinia() +// // 灏嗘彃浠舵彁渚涚粰 pinia +// pinia.use(SecretPiniaPlugin) // pinia.use(() => ({'澶�':'闆ㄥぉ'})) +router.beforeEach((to,from,next)=>{ + const token = Cookie.get('token') + if(!token && to.name!='login'){ + next({name:'login'}) + } + // token瀛樺湪锛屼絾鐢ㄦ埛鍒囨崲鐨勬槸鐧诲綍椤甸潰鏃讹紝杩斿洖榛樿涓荤晫闈� + else if(token && to.name =='login'){ + next({name:'edata'}) + }else{ + next() + } +}) // axios.defaults.baseURL = 'http://192.168.1.4:8081' axios.defaults.baseURL = 'http://localhost:8081' app.config.globalProperties.$http = axios -app.use(pinia) +// app.use(pinia) app.use(router) diff --git a/src/router/index.ts b/src/router/index.ts index b7232a0..bd9240a 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -86,7 +86,7 @@ // 鐧婚檰椤甸潰 { path: "/login", - name: 'fst', + name: 'login', component: () => import('@/views/login/LoginSystem.vue') }, diff --git a/src/utils/risk_estimate_common_function/index.js b/src/utils/risk_estimate_common_function/index.js new file mode 100644 index 0000000..50cae19 --- /dev/null +++ b/src/utils/risk_estimate_common_function/index.js @@ -0,0 +1,149 @@ +import dayjs from 'dayjs'; +export default { + /** + * 璁$畻鏃ユ湡鐩稿樊鍑犲ぉ + * @param锛� + * @createTime:寮�濮嬫椂闂达紝缁撴潫鏃堕棿 + * @returns锛� + */ + getDaysDifference(startDate, endDate) { + return dayjs(endDate).diff(startDate, 'day') + 1; + }, + /** + * 浠庡垎鏋愭暟鎹暟缁勪腑璁$畻鏈�灏忓拰澶у�� ,骞冲潎鍊硷紝 鍦ㄧ嚎鐜囷紝鏈夋晥鐜囷紝瓒呮爣鐜囷紙鍚庝笁涓�间负0~100鍙栧�硷級 + * @param锛氬垎鏋愯〃涓殑鏁版嵁 + * @returns锛� + */ + calBillData(arr, beginTime, endTime) { + let min = 65536; + let max = -1; + let avg = 0; + let online = 0; + let valid = 0; + let exceeding = 0; + + let sumAvg = 0; + let sumOnline = 0; + let sumValid = 0; + let sumExceeding = 0; + + // 璁$畻閫夋嫨鐨勬椂闂寸殑鐩稿樊鐨勫ぉ鏁� + let begin = dayjs(beginTime).format('YYYY-MM-DD'); + let end = dayjs(endTime).format('YYYY-MM-DD'); + let dayDiff = this.getDaysDifference(begin, end); + console.log('鏃ユ湡闂撮殧', dayDiff); + let obj = {}; + // 璁$畻鏈�灏忓拰澶у�� + arr.forEach((item) => { + if (item.min < min) { + min = item.min; + } + if (item.max > max) { + max = item.max; + } + // 璁$畻骞冲潎鍊硷紝鍦ㄧ嚎鐜囷紝鏈夋晥鐜囷紝瓒呮爣鐜� + sumAvg = sumAvg + item.dayAvg; + sumOnline = sumOnline + Number(item.dayOnline.slice(0, -1)); + sumValid = sumValid + Number(item.dayValid.slice(0, -1)); + sumExceeding = sumExceeding + Number(item.dayExceeding.slice(0, -1)); + }); + // 璁$畻鍧囧�� + avg = sumAvg / dayDiff; + // console.log('sumavg:',sumAvg,dayDiff); + online = sumOnline / dayDiff; + valid = sumValid / dayDiff; + exceeding = sumExceeding / dayDiff; + obj['min'] = min.toFixed(3); + obj['max'] = max.toFixed(3); + + obj['avg'] = avg.toFixed(2); + obj['online'] = online.toFixed(2); + obj['valid'] = valid.toFixed(2); + obj['exceeding'] = exceeding.toFixed(2); + + return obj; + }, + + /** + * 璁$畻寮傚父绫诲瀷鑱氶泦搴� 寮傚父澶嶇幇鐜� + * @param锛� 寮傚父鏁版嵁鏁扮粍 + * @returns锛� + */ + calRecur(exceptionArr) { + // 鍏稿瀷寮傚父澶嶇幇鐜� + let exceptionTyprRecurRate = 0; + // 閲忕骇绐佸彉 + let mutationCount = 0; + // 瓒呮爣涓磋繎 + let exceedingNearCount = 0; + // 瓒呮爣娆℃暟涓寸晫 + let exceedindCriticalDegree = 0; + + // 淇濆瓨鍑虹幇鐨勪笉鍚屽紓甯哥被鍨� + let exception = []; + // 寮傚父绫诲瀷鑱氶泦搴� + let exceptionTypeAggregation = 0; + + exceptionArr.forEach((item) => { + // 寮傚父澶嶇幇鐜� + if (item.exceptionType == 4) { + mutationCount++; + } else if (item.exceptionType == 5) { + exceedingNearCount++; + } else if (item.exceptionType == 6) { + exceedindCriticalDegree++; + } + + // 寮傚父绫诲瀷鑱氶泦搴� + if (exception.length == 0) { + exception.push(item.exceptionType); + } + // 淇濆瓨鏂扮殑寮傚父绫诲瀷 + else if (exception.indexOf(item.exceptionType) == -1) { + exception.push(item.exceptionType); + } + }); + + let sum = 0; + // 娆℃暟鍑�1锛岃寮傚父鍑虹幇2娆★紝绠楀鐜�1娆°�傚嚭鐜�3娆★紝绠楀鐜�2娆�... + if (mutationCount > 1) { + sum = sum + mutationCount - 1; + } + if (exceedingNearCount > 1) { + sum = sum + exceedindCriticalDegree - 1; + } + if (exceedindCriticalDegree > 1) { + sum = sum + exceedindCriticalDegree - 1; + } + // console.log('sum:', sum); + // console.log('exception:', exception); + // console.log( + // '鍏朵粬', + // mutationCount, + // exceedindCriticalDegree, + // exceedindCriticalDegree + // ); + switch (sum) { + case 0: + exceptionTyprRecurRate = sum / 3; + break; + case 1: + exceptionTyprRecurRate = sum / 3; + break; + case 2: + case sum >= 3: + exceptionTyprRecurRate = 1; + break; + default: + return 'error'; + } + + exceptionTypeAggregation = exception.length / 8; + + let obj = {}; + obj['exceptionRecurrence'] = exceptionTyprRecurRate; + obj['exceptionTypeAggregation'] = exceptionTypeAggregation; + + return obj; + } +}; diff --git a/src/views/exception/FlightInspection.vue b/src/views/exception/FlightInspection.vue index dd60dfe..b4d4d3c 100644 --- a/src/views/exception/FlightInspection.vue +++ b/src/views/exception/FlightInspection.vue @@ -12,12 +12,12 @@ const DustLineChart = defineAsyncComponent(() => import('./components/DustLineChart.vue') ); - +import exceptionApi from '@/api/exceptionApi.js'; import dayjs from 'dayjs'; export default { components: { ExceptionType, - InputSearch, + // InputSearch, TimeSelectWithShortCuts, DustExceptionText, DustLineChart, @@ -42,15 +42,17 @@ displayData: [], // 琛ㄦ牸楂樺害 tableHeight: 400, - // 琛ㄦ牸鏁版嵁 + // 琛ㄦ牸鏄剧ず + isTableShow:false, // 褰撳墠椤� currentPage: 1, // 姣忛〉鏉℃暟 pageSize: 20, + // 琛ㄦ牸鐨勬�昏褰曟暟 total: 0, // 琛ㄦ牸鏌ヨ鏃犳暟鎹椂 - isNoData: false, + // isNoData: false, // 瀵硅瘽妗嗘樉绀� dialogTableVisible: false, // 淇濆瓨寮傚父瀵瑰簲鐨勫簵閾哄悕绉板拰璁惧缂栧彿 @@ -86,8 +88,6 @@ // 绔欑偣鎬绘暟閲� siteTotal: 0, - // 寮傚父鐨勭珯鐐规�绘暟閲� - // exceptionSiteNum:0, // 閫変腑琛ㄦ牸褰撳墠琛岀殑鏁版嵁 tableCurrentRowData: null, @@ -129,8 +129,9 @@ banTouch:0, // 0浠h〃鍒嗛〉锛�1浠h〃涓嶅垎椤� originClick:0 - } - + }, + // 鏉′欢鏌ヨ瀵硅瘽妗� + conditionDialogVisible:false }; }, setup() { @@ -185,10 +186,17 @@ this.backExceptionDataAWeekAgo(); // 鏌ヨ鏃堕棿娈电殑鍚勫紓甯哥殑绔欑偣锛屾煡璇㈣鏃堕棿鍖洪棿鐨勫悇寮傚父鏁伴噺 this.getShopNames(); - + this.getSiteNume() }, methods: { + // 鏀惧洖绔欑偣鎬绘暟閲� + getSiteNume(){ + exceptionApi.getSitesNum().then(res => { + this.siteTotal = res.data.data.length + }) + + }, /** * description锛氱偣鍑诲紓甯哥珯鐐瑰悕瀛楁椂 杩斿洖鐨勬暟鎹� @@ -1098,15 +1106,18 @@ this.displayData = response.data.data.rows; this.loading.queryButton = false this.loading.tableLoading = false; + if (response.data.data.total == 0) { ElMessage('璇ユ椂娈垫棤鏁版嵁'); - this.isNoData = true; + this.isTableShow = false return; } + this.isTableShow = true this.total = response.data.data.total; // 绉婚櫎绌烘暟鎹姸鎬� - this.isNoData = false; }); + + this.conditionDialogVisible = false }, /** @@ -1134,9 +1145,10 @@ if (response.data.data.total == 0) { ElMessage('璇ユ椂娈垫棤鏁版嵁'); - this.isNoData = true; + this.isTableShow = false return; } + this.isTableShow = true this.total = response.data.data.total; this.loading.tableLoading = false; }); @@ -1205,7 +1217,16 @@ </script> <template> - + <el-button type="primary" @click="conditionDialogVisible = true"> + 鎼滅储鏉′欢 + </el-button> + + <el-dialog + v-model="conditionDialogVisible" + title="Tips" + width="30%" + class="condition-dialog" + > <el-row ref="h1"> <el-col> <el-form :inline="true"> @@ -1213,24 +1234,27 @@ <el-form-item > <AreaAndmonitorType ></AreaAndmonitorType> </el-form-item> - <el-form-item> + + <!-- <el-form-item> <InputSearch isNeedDefaultSite="0" @submit-value="(n) => (form.name = n)" @submit-site-Nums="(n) => (siteTotal = n)" > </InputSearch> - </el-form-item> + </el-form-item> --> + <el-form-item> + <TimeSelectWithShortCuts timeType="day" @submit-time="giveTime" ></TimeSelectWithShortCuts> + </el-form-item> + <el-form-item> <ExceptionType @submit-value="(n) => form.exceptionName = n" ></ExceptionType> </el-form-item> - <el-form-item> - <TimeSelectWithShortCuts @submit-time="giveTime"></TimeSelectWithShortCuts> - </el-form-item> + </div> <div class="head-container-search"> @@ -1242,6 +1266,24 @@ </el-form> </el-col> </el-row> + + +<!-- + <template #footer> + + <span class="dialog-footer"> + <el-button @click="dialogVisible = false">Cancel</el-button> + <el-button type="primary" @click="dialogVisible = false"> + Confirm + </el-button> + </span> + </template> --> + </el-dialog> + + + + + <el-row class="head-describtion-text" ref="h2"> <el-row> @@ -1859,8 +1901,8 @@ </el-col> </el-row> - <el-row> - <el-col v-show="!isNoData"> + <el-row v-show="isTableShow"> + <el-col > <el-table ref="table" :data="displayData" @@ -1954,7 +1996,6 @@ </el-col> </el-row> - <el-empty v-show="isNoData" :image-size="200" /> <el-dialog v-model="dialogTableVisible" draggable align-center height="300px"> <!-- 澶� --> @@ -2097,9 +2138,19 @@ </template> <style lang="scss" scoped> + .el-row { margin-left: 10px; } +/* 涓嬫媺鑿滃崟寮�濮� */ +.example-showcase .el-dropdown-link { + cursor: pointer; + color: var(--el-color-primary); + display: flex; + align-items: center; +} + +/* 涓嬫媺鑿滃崟缁撴潫 */ /* 鏉′欢鏌ヨ妯″潡鐨勬牱寮� */ .head-container-search { diff --git a/src/views/exception/SiteAuditAssistance.vue b/src/views/exception/SiteAuditAssistance.vue index 49f083e..6bc9746 100644 --- a/src/views/exception/SiteAuditAssistance.vue +++ b/src/views/exception/SiteAuditAssistance.vue @@ -100,10 +100,12 @@ checker: 'admin', checkDate: '', checkerNotes: '', - enterpriseNotes: '' + enterpriseNotes: '', + }, auditTableData: [], - auditNumByTime: 0 + // 瀹℃牳鐘舵�佷笉涓�0 + auditData: [], }; }, setup() { @@ -143,13 +145,39 @@ } }, computed: { - unCheckedNUm() { - return this.total - this.auditNumByTime; + + // 瀹¤鎬绘暟锛堝寘鎷儴鍒嗗鏍革級 + auditTotal(){ + return this.auditData.length }, - // 瀹℃牳姣斾緥 - checkedRate() { - return (this.auditNumByTime / this.total) * 100; - } + // 瑙勮寖瀹¤鎬绘暟 + auditedRegular(){ + let count = 0 + this.auditData.forEach(item => { + if(item.auditStatus == 3){ + count ++ + } + }) + return count + }, + // 閮ㄥ垎瀹℃牳鏁伴噺 + auditPart(){ + let count = 0 + this.auditData.forEach(item => { + if(item.auditStatus == 1 || item.auditStatus == 2){ + count ++ + } + }) + return count + }, + // 寰呭鏍告暟 + unCheckedNUm() { + return this.total - this.auditedRegular; + }, + // 瀹℃牳姣斾緥 + checkedRate() { + return ((this.auditedRegular / this.total) * 100).toFixed(1); + }, }, mounted() { this.backExceptionDataAWeekAgo(); @@ -158,13 +186,13 @@ methods: { /** - * 鏌ョ湅璇ユ鏃堕棿鍐呭凡瀹℃牳鐨勬暟閲� + * 鏌ョ湅璇ユ鏃堕棿鍐呭凡瀹℃牳鐨勬暟鎹� * @param锛� * @returns锛� */ gethasCheckedNumByTime() { submitApi.getAuditNumByTime(this.beginTime, this.endTime).then((res) => { - this.auditNumByTime = res.data.data.length; + this.auditData = res.data.data; }); }, /** @@ -278,6 +306,12 @@ if (enterprise) { this.tableCurrentRowData.enterpriseContent = enterprise; } + + // 鏇存柊鍒嗘瀽鐨勬暟鎹� + setTimeout(() => { + this.gethasCheckedNumByTime(); + }, 1500); + } else { ElMessage.warning('鎻愪氦澶辫触'); } @@ -305,6 +339,11 @@ if (enterpriseContent) { this.tableCurrentRowData.enterpriseContent = enterpriseContent; } + + // 鏇存柊鍒嗘瀽鐨勬暟鎹� + setTimeout(() => { + this.gethasCheckedNumByTime(); + }, 1500); } else { ElMessage.warning('鎻愪氦澶辫触'); } @@ -1270,7 +1309,7 @@ </el-col> </el-row> - <el-row class="anasysis" ref="h2"> + <!-- <el-row class="anasysis" ref="h2"> <el-col :span="6"> <el-card> <el-statistic title="鍏ㄩ儴瀹℃牳鏁�" :value="total" /> @@ -1296,7 +1335,27 @@ </el-statistic> </el-card> </el-col> - </el-row> + </el-row> --> + + + <div class="checknum"> + <el-row class="anasysis" ref="h2"> + <el-col :span="8"> + <span class="checknum-blue">搴斿鏍告暟锛�</span> {{ total }}<span class="checknum-rate">({{ checkedRate }}%) </span> + </el-col> + + <el-col :span="8"> + <div><span class="checknum-green">宸插鏍告暟锛�</span>{{ auditTotal }}</div> + <div>瑙勮寖瀹℃牳鏁帮細{{ auditedRegular }}</div> + <div>閮ㄥ垎瀹℃牳鏁帮細{{ auditPart }}</div> + </el-col > + + <el-col :span="8"> + <span><span class="checknum-red">寰呭鏍告暟锛�</span>{{ unCheckedNUm }}</span> + </el-col> + </el-row> +</div> + <el-row> <el-col v-show="!isNoData"> @@ -1387,7 +1446,7 @@ plain v-else-if="row.auditStatus == 1 || row.auditStatus == 2" @click="openAuditDiag(row)" - >瀹℃牳</el-button + >寰呭鏍�</el-button > <el-button @@ -1395,7 +1454,7 @@ size="default" type="danger" @click="openAuditDiag(row)" - >瀹℃牳</el-button + >寰呭鏍�</el-button > <!-- <span v-if="row.auditStatus == 3">宸插鏍�</span ><span v-else>瀹℃牳</span> --> @@ -1471,7 +1530,8 @@ /> </el-form-item> </el-form> - <el-card> + + <el-card v-show="tableCurrentRowData.auditStatus==3"> <template #header>瀹℃牳璇︽儏</template> <el-form> <el-form-item label="瀹℃牳浜�">{{ @@ -1485,6 +1545,7 @@ }}</el-form-item> </el-form> </el-card> + <template #footer> <span class="dialog-footer"> <el-button @click="close">鍙栨秷</el-button> @@ -1644,34 +1705,58 @@ .el-row { margin-left: 20px; } - /* 鏉′欢鏌ヨ妯″潡鐨勬牱寮� */ .head-container-search { display: flex; justify-content: space-between; // float: right; } - .head-describtion-text { justify-content: flex-end; margin-bottom: 10px; font-size: 14px; color: gray; } - /* 鏉′欢鏌ヨ妯″潡缁撴潫 */ + + + /*鍒嗘瀽 */ -.anasysis { - margin-bottom: 20px; +// .anasysis { +// margin-bottom: 20px; +// } +// :deep(.el-statistic__head) { +// font-weight: bold; +// font-size: 16px; +// } +.checknum { + border: 1px solid orange; + margin-bottom: 10px; + margin-left: 20px; + margin: 0px 5px 10px 20px; } -:deep(.el-statistic__head) { +.checknum-rate{ + margin-left: 5px; + } +.checknum-blue { font-weight: bold; - font-size: 16px; + color: blue; +} + +.checknum-green { + font-weight: bold; + color: green; +} +.checknum-red { + font-weight: bold; + color: red; } /* 鍒嗘瀽缁撴潫 */ -/* 琛ㄦ牸妯″潡鐨勬牱寮� */ + + +/* 琛ㄦ牸妯″潡鐨勬牱寮� */ :global(.el-table .black-row) { color: black; } diff --git a/src/views/line_graph/DataRiskModel.vue b/src/views/line_graph/DataRiskModel.vue index aaf2359..c8d4b60 100644 --- a/src/views/line_graph/DataRiskModel.vue +++ b/src/views/line_graph/DataRiskModel.vue @@ -6,14 +6,8 @@ import DustRadarChart from './components/DustRadarChart.vue'; import exceptionApi from '@/api/exceptionApi.js'; -import { useWindowSize } from '@vueuse/core'; -import LineChart from './components/LineChart.vue' - - -// const DustRadarChart = defineAsyncComponent(() => -// import('./components/DustRadarChart.vue') -// ) +import LineChart from './components/LineChart.vue'; import dayjs from 'dayjs'; export default { @@ -61,14 +55,21 @@ // 鍏稿瀷寮傚父澶嶇幇鐜� exceptionRecurrence: '', // 寮傚父绫诲瀷鎹仛闆嗗害 - exceptionTypeAggregation: '', - + exceptionTypeAggregation: '' } }; }, - setup() { - const { height } = useWindowSize(); - return { height }; + + computed: { + weight() { + return ( + (100 - this.bill.online) * 0.1 + + (100 - this.bill.valid) * 0.2 + + this.bill.exceeding * 0.2 + + this.bill.exceptionTypeAggregation * 0.2 + + this.bill.exceptionRecurrence * 0.3 + ).toFixed(2); + } }, mounted() { this.fetch(); @@ -90,11 +91,11 @@ let exceedindCriticalDegree = 0; // 淇濆瓨鍑虹幇鐨勪笉鍚屽紓甯哥被鍨� - let exception = [] + let exception = []; // 寮傚父绫诲瀷鑱氶泦搴� - let exceptionTypeAggregation = 0 - - exceptionArr.forEach(item => { + let exceptionTypeAggregation = 0; + + exceptionArr.forEach((item) => { // 寮傚父澶嶇幇鐜� if (item.exceptionType == 4) { mutationCount++; @@ -105,12 +106,12 @@ } // 寮傚父绫诲瀷鑱氶泦搴� - if(exception.length == 0){ - exception.push(item.exceptionType) + if (exception.length == 0) { + exception.push(item.exceptionType); } // 淇濆瓨鏂扮殑寮傚父绫诲瀷 - else if(exception.indexOf(item.exceptionType) == -1){ - exception.push(item.exceptionType) + else if (exception.indexOf(item.exceptionType) == -1) { + exception.push(item.exceptionType); } }); @@ -125,9 +126,14 @@ if (exceedindCriticalDegree > 1) { sum = sum + exceedindCriticalDegree - 1; } - console.log('sum:',sum); - console.log('exception:',exception); - console.log('鍏朵粬',mutationCount,exceedindCriticalDegree,exceedindCriticalDegree); + console.log('sum:', sum); + console.log('exception:', exception); + console.log( + '鍏朵粬', + mutationCount, + exceedindCriticalDegree, + exceedindCriticalDegree + ); switch (sum) { case 0: exceptionTyprRecurRate = sum / 3; @@ -143,13 +149,13 @@ return 'error'; } - exceptionTypeAggregation = exception.length / 8 + exceptionTypeAggregation = exception.length / 8; - let obj = {} - obj['exceptionRecurrence'] = exceptionTyprRecurRate - obj['exceptionTypeAggregation'] = exceptionTypeAggregation + let obj = {}; + obj['exceptionRecurrence'] = exceptionTyprRecurRate; + obj['exceptionTypeAggregation'] = exceptionTypeAggregation; - return obj + return obj; }, /** * 璁$畻鏃ユ湡鐩稿樊鍑犲ぉ @@ -158,13 +164,7 @@ * @returns锛� */ getDaysDifference(startDate, endDate) { - // var start = new Date(startDate); - // var end = new Date(endDate); - // var timeDiff = Math.abs(end.getTime() - start.getTime()); - // var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)); - - - return dayjs(endDate).diff(startDate,'day') + 1; + return dayjs(endDate).diff(startDate, 'day') + 1; }, /** * 浠庡垎鏋愭暟鎹暟缁勪腑鎵惧埌鏈�灏忓拰澶у�� @@ -188,7 +188,7 @@ let begin = dayjs(this.form.beginTime).format('YYYY-MM-DD'); let end = dayjs(this.form.endTime).format('YYYY-MM-DD'); let dayDiff = this.getDaysDifference(begin, end); - console.log('鏃ユ湡闂撮殧',dayDiff); + console.log('鏃ユ湡闂撮殧', dayDiff); let obj = {}; // 璁$畻鏈�灏忓拰澶у�� arr.forEach((item) => { @@ -245,14 +245,6 @@ // 鐐瑰嚮灞曠ず鎸夐挳 fetchData() { - if ( - this.form.beginTime >= this.form.endTime && - (this.form.beginTime != null || this.form.endTime != null) && - (this.form.beginTime != '' || tthis.form.endTime != '') - ) { - alert('璇疯緭鍏ユ湁鏁堢殑鏃堕棿娈�'); - return; - } let params = {}; if (this.form.name) { params['siteName'] = this.form.name; @@ -287,8 +279,8 @@ this.bill.valid = temp['valid']; this.bill.exceeding = temp['exceeding']; - this.begin = this.chartData[0].lst - this.end = this.chartData[this.chartData.length-1].lst + this.begin = this.chartData[0].lst; + this.end = this.chartData[this.chartData.length - 1].lst; }); }, @@ -341,9 +333,9 @@ }) .then((res) => { console.log('寮傚父锛�', res.data.data); - let obj = this.calRecur(res.data.data) - this.bill.exceptionRecurrence = obj['exceptionRecurrence'] - this.bill.exceptionTypeAggregation = obj['exceptionTypeAggregation'] + let obj = this.calRecur(res.data.data); + this.bill.exceptionRecurrence = obj['exceptionRecurrence']; + this.bill.exceptionTypeAggregation = obj['exceptionTypeAggregation']; }); } } @@ -353,9 +345,7 @@ <div class="search-container"> <el-container> <el-main> - - <el-form :inline="true" :model="form" > - + <el-form :inline="true" :model="form"> <el-form-item> <AreaAndmonitorType></AreaAndmonitorType> </el-form-item> @@ -371,36 +361,103 @@ @submit-time="giveTime" ></TimeSelectWithShortCuts> </el-form-item> - - + <el-form-item> <el-button type="primary" @click="fetch">灞曠ず鎶樼嚎鍥�</el-button> </el-form-item> - </el-form> - <div class="time-text">鏁版嵁缁熻鏃舵锛歿{ begin}} ~ {{ end }}</div> + <div class="time-text">鏁版嵁缁熻鏃舵锛歿{ begin }} ~ {{ end }}</div> <el-row :gutter="20"> - <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="16" > - - <el-card - shadow="never" - > - <DustRadarChart :name="['鏁版嵁鏈夋晥鐜�','鍏稿瀷寮傚父澶嶇幇鐜�','寮傚父绫诲瀷鑱氶泦搴�','鏁版嵁瓒呮爣鐜�','鏁版嵁鍦ㄧ嚎鐜�']" :yData="[bill.valid,bill.exceptionRecurrence,bill.exceptionTypeAggregation,bill.exceeding,bill.online]" ></DustRadarChart> - 鏉冮噸锛歿{ ((bill.online*0.1+bill.valid*0.2+bill.exceeding*0.2+bill.exceptionTypeAggregation*0.2+bill.exceptionRecurrence*0.3)*0.01).toFixed(2) }} + <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="16"> + <el-card shadow="never"> + <DustRadarChart + :name="[ + '鏁版嵁鏈夋晥鐜囬闄�', + '鍏稿瀷寮傚父澶嶇幇鐜囬闄�', + '寮傚父绫诲瀷鑱氶泦搴﹂闄�', + '鏁版嵁瓒呮爣鐜囬闄�', + '鏁版嵁鍦ㄧ嚎鐜囬闄�' + ]" + :yData="[ + bill.valid, + bill.exceptionRecurrence, + bill.exceptionTypeAggregation, + bill.exceeding, + bill.online + ]" + ></DustRadarChart> + <div> + 鏉冮噸锛� + <span + :class="{ + 'weightColor-low': weight < 0.2, + 'weightColor-medium': weight >= 0.2 && weight < 0.6, + 'weightColor-heigh': weight >= 0.6 + }" + >{{ weight }}</span + > + </div> + <div></div> </el-card> - - </el-col> <el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="4"> - <el-card - shadow="never" - style="width: 200px;min-width: 200px;" - > - <template #header><span class="title-16">椋庨櫓璇︽儏</span></template> - <el-form > + <el-card shadow="never" style="width: 200px; min-width: 200px"> + <template #header> + <h1 + :class="{ + 'weightColor-low': weight < 0.2, + 'weightColor-medium': weight >= 0.2 && weight < 0.6, + 'weightColor-heigh': weight >= 0.6 + }" + > + 椋庨櫓鍊硷細{{ weight }} + </h1> + </template> + <template #default> + <div class="risk-grade"> + <h1>椋庨櫓绛夌骇锛�</h1> + <span v-if="weight >= 0.6"> 楂橀闄�</span> + <span v-else-if="weight >= 0.2 && weight < 0.6"> 涓闄�</span> + <span v-else> 浣庨闄�</span> + </div> + + <div class="risk-advice"> + <h1>绠℃帶寤鸿锛�</h1> + <span v-if="weight >= 0.6"> + 寤鸿瀵硅绔欑偣杩涜绾夸笅鎵ф硶妫�鏌ワ紝涓撻」鏁版嵁瀵规瘮</span + > + <span v-else-if="weight >= 0.2 && weight < 0.6"> + 寤鸿寮�灞曞父鎬佽拷韪垎鏋�</span + > + <span v-else> 寤鸿寮曞浼佷笟闀挎�佷繚鎸�</span> + </div> + <div class="grade-instance"> + <div class="container"> + <div class="block-color heigh"></div> + <div>楂橀闄�(鈮�0.6)</div> + </div> + <div class="container"> + <div class="block-color medium"></div> + <div>涓闄�(0.2~0.6)</div> + </div> + <div class="container"> + <div class="block-color low"></div> + <div>浣庨闄�(锛�0.2)</div> + </div> + </div> + </template> + </el-card> + </el-col> + + <el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="4"> + <el-card shadow="never" style="width: 200px; min-width: 200px"> + <template #header + ><span class="title-16">椋庨櫓璇︽儏</span></template + > + <el-form> <el-form-item label="鏈�澶у�硷細"> {{ bill.max }} mg/m鲁 </el-form-item> @@ -417,54 +474,19 @@ {{ bill.exceeding }}% </el-form-item> <el-form-item label="寮傚父绫诲瀷鑱氶泦搴︼細"> - {{ bill.exceptionTypeAggregation*100 }}% + {{ bill.exceptionTypeAggregation * 100 }}% </el-form-item> - <el-form-item label="鍏稿瀷寮傚父澶嶇幇鐜囷細" label-width="auto"> - {{ bill.exceptionRecurrence*100 }}% + <el-form-item label="鍏稿瀷寮傚父澶嶇幇鐜囷細"> + {{ bill.exceptionRecurrence * 100 }}% </el-form-item> </el-form> - - - </el-card> - </el-col> - - <el-col :xs="24" :sm="24" :md="6" :lg="6" :xl="4"> - <el-card - shadow="never" - - style="width:200px; min-width: 200px;" - > - <template #header> - <span class="title-16">椋庨櫓绛夌骇</span> - </template> - <template #default> - <!-- <el-space direction="vertical" :size="15" > --> - <div class="container"> - <div class="block-color heigh"></div> <div>楂橀闄�(鈮�0.6)</div> - </div> - <div class="container"> - <div class="block-color medium" ></div> <div>涓闄�(0.2~0.6)</div> - </div> - <div class="container"> - <div class="block-color low"></div><div>浣庨闄�(锛�0.2)</div> - </div> - - - - <!-- </el-space> --> - </template> </el-card> </el-col> </el-row> - - <el-row :gutter="24"> <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6"> - <el-card - shadow="never" - - > + <el-card shadow="never"> <template #default> <LineChart title="鏃ュ潎鍊�" @@ -478,10 +500,7 @@ </el-col> <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6"> - <el-card - shadow="never" - - > + <el-card shadow="never"> <template #default> <LineChart title="鏃ュ湪绾跨巼" @@ -495,8 +514,7 @@ </el-col> <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6"> - <el-card shadow="never" - > + <el-card shadow="never"> <template #default> <LineChart title="鏃ユ湁鏁堢巼" @@ -510,7 +528,7 @@ </el-col> <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="6"> - <el-card shadow="never" > + <el-card shadow="never"> <template #default> <LineChart title="鏃ヨ秴鏍囩巼" @@ -523,9 +541,6 @@ </el-card> </el-col> </el-row> - - - </el-main> </el-container> </div> @@ -552,6 +567,9 @@ display: flex; margin-bottom: 10px; } +.grade-instance { + margin-top: 40px; +} .block-color { width: 1em; height: 1em; @@ -562,27 +580,36 @@ background-color: red; } .medium { - background-color: #FADC19; + background-color: #fadc19; } .low { - background-color: #9FDB1D; + background-color: #9fdb1d; } .el-text { align-self: left; } .el-form-item { -margin-bottom: 20px; - + margin-bottom: 20px; } :deep().el-form-item__content { justify-content: flex-end; - } .title-16 { font-size: 16px; font-weight: bold; } -.el-row { +.weightColor-low { + color: #9fdb1d; +} +.weightColor-medium { + color: #dabe09; +} +.weightColor-heigh { + color: red; +} +.risk-grade { + display: flex; + margin-bottom: 20px; } </style> diff --git a/src/views/line_graph/DataRiskRank.vue b/src/views/line_graph/DataRiskRank.vue index 8ee4838..3077011 100644 --- a/src/views/line_graph/DataRiskRank.vue +++ b/src/views/line_graph/DataRiskRank.vue @@ -20,8 +20,6 @@ tableData: [], isNoData: false, loading: false, - // begin: '2023-05-01', //寮�濮嬫椂闂� - // end: '2023-05-15', //缁撴潫鏃堕棿 form: { // 寮�濮嬫椂闂� @@ -178,7 +176,6 @@ <el-card> <el-empty v-show="isNoData" :image-size="200" /> - </el-card> <el-table :data="tableData" @@ -260,6 +257,8 @@ @update:current-page="handleCurrentChange" @update:page-size="handleSizeChange" /> + </el-card> + </el-main> </el-container> </div> diff --git a/src/views/line_graph/SiteComprehensiveRskRanking.vue b/src/views/line_graph/SiteComprehensiveRskRanking.vue index fccc0d1..cf6130c 100644 --- a/src/views/line_graph/SiteComprehensiveRskRanking.vue +++ b/src/views/line_graph/SiteComprehensiveRskRanking.vue @@ -1,25 +1,270 @@ <script> - export default { - data() { - return{ +import TimeSelectWithShortCuts from '@/sfc/TimeSelectWithShortCuts.vue'; +import InputSearch from '@/sfc/InputSearch.vue'; +import AreaAndmonitorType from '@/sfc/AreaAndmonitorType.vue'; +import exceptionApi from '@/api/exceptionApi.js'; +import {useCommonFunction} from '../../utils/common.js'; +import index from '@/utils/risk_estimate_common_function/index.js' +import dayjs from 'dayjs'; +export default { + components: { + TimeSelectWithShortCuts, + AreaAndmonitorType, + InputSearch + }, + data() { + return { + // 褰撳墠椤� + currentPage: 1, + // 姣忛〉鏉℃暟 + pageSize: 20, + total: 0, + // 琛ㄦ牸鏁版嵁 + tableData: [], + isNoData: false, + loading: false, + form: { + // 绔欑偣鍚嶇О + name: '', + // 寮�濮嬫椂闂� + beginTime: '', + // 缁撴潫鏃堕棿 + endTime: '' + }, + bill: { + min: '', + max: '', + avg: '', + online: '', + valid: '', + exceeding: '', + + // 鍏稿瀷寮傚父澶嶇幇鐜� + exceptionRecurrence: '', + // 寮傚父绫诲瀷鎹仛闆嗗害 + exceptionTypeAggregation: '', + }, + // { + // siteName:'', + // region:'', + // monitorType:'', + // riskValue:'', + // riskGrage:'', + // riskAdvice:'', + // beginTime:'', + // endTime:'', + // } + table:[] + }; + }, + setup(){ + // 寮曞叆 鐧惧垎鍙锋瘮杈冨ぇ灏� 瀵煎嚭鍔熻兘 + const {exportToExcel} = useCommonFunction() + return {exportToExcel} + }, + + computed: { + weight() { + return ( + (100 - this.bill.online) * 0.1 + + (100 - this.bill.valid) * 0.2 + + this.bill.exceeding * 0.2 + + this.bill.exceptionTypeAggregation * 0.2 + + this.bill.exceptionRecurrence * 0.3 + ).toFixed(2); + } + }, + watch:{ + weight(){ + this.table[0].riskValue = this.weight + } + }, + methods: { + /** + * 灏嗕腑鍥芥爣鍑嗘椂闂磋浆涓烘寚瀹氭牸寮� + * @param锛� + * @returns锛� + */ + giveTime(val) { + //灏嗕腑鍥芥爣鍑嗘椂闂磋浆涓烘寚瀹氭牸寮�(璇ョ粍浠惰繑鍥炵殑鏍囧噯鏃堕棿鐨勬牸寮忥紝鎵�浠ュ繀椤荤殑鍔犺繖涓嚱鏁�) + this.form.beginTime = dayjs(val[0]).format('YYYY-MM-DD HH:mm:ss'); + this.form.endTime = dayjs(val[1]).format('YYYY-MM-DD HH:mm:ss'); + }, + // 鐐瑰嚮灞曠ず鎸夐挳 + fetchData() { + + 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; + exceptionApi + .analysisdata(this.form.name, this.form.beginTime, this.form.endTime) + .then((response) => { + this.chartData = response.data.data; + this.loading = false; + if (response.data.data.length == 0) { + this.isNoData = true; + return; + } + // 绉婚櫎绌烘暟鎹姸鎬� + this.isNoData = false; + let temp = index.calBillData(this.chartData,this.form.beginTime,this.form.endTime); + this.bill.min = temp['min']; + this.bill.max = temp['max']; + + this.bill.avg = temp['avg']; + this.bill.online = temp['online']; + this.bill.valid = temp['valid']; + this.bill.exceeding = temp['exceeding']; + + this.begin = this.chartData[0].lst; + this.end = this.chartData[this.chartData.length - 1].lst; + const tempObj = {} + tempObj.region = '閲戝北鍖�' + tempObj.monitorType = '鎵皹' + tempObj.siteName = this.form.name + tempObj.beginTime = this.form.beginTime + tempObj.endTime = this.form.endTime + + // this.table[0].region = '閲戝北鍖�' + // this.table[0].monitorType = '鎵皹' + // this.table[0].siteName = this.form.name + // this.table[0].beginTime = this.form.beginTime + // this.table[0].endTime = this.form.endTime + + if(this.weight>=0.6){ + tempObj.riskGrage = '楂橀闄�' + tempObj.riskAdvice = '寤鸿瀵硅绔欑偣杩涜绾夸笅鎵ф硶妫�鏌ワ紝涓撻」鏁版嵁瀵规瘮' + // this.table[0].riskGrage = '楂橀闄�' + // this.table[0].riskAdvice = '寤鸿瀵硅绔欑偣杩涜绾夸笅鎵ф硶妫�鏌ワ紝涓撻」鏁版嵁瀵规瘮' + }else if(this.weight<0.6 && this.weight>=0.2){ + tempObj.riskGrage = '涓闄�' + tempObj.riskAdvice = '寤鸿寮�灞曞父鎬佽拷韪垎鏋�' + // this.table[0].riskGrage = '涓闄�' + // this.table[0].riskAdvice = '寤鸿寮�灞曞父鎬佽拷韪垎鏋�' + }else { + tempObj.riskGrage = '浣庨闄�' + tempObj.riskAdvice = '寤鸿寮曞浼佷笟闀挎�佷繚鎸�' + // this.table[0].riskGrage = '浣庨闄�' + // this.table[0].riskAdvice = '寤鸿寮曞浼佷笟闀挎�佷繚鎸�' + } + this.table.push(tempObj) + }); }, - mounted() { + + // 浼佷笟寮傚父璇︽儏 + exceptiondataCount() { + exceptionApi + .exceptiondata1({ + siteName: this.form.name, + beginTime: this.form.beginTime, + endTime: this.form.endTime + }) + .then((res) => { + let obj = index.calRecur(res.data.data); + this.bill.exceptionRecurrence = obj['exceptionRecurrence']; + this.bill.exceptionTypeAggregation = obj['exceptionTypeAggregation']; + }); + }, + + /** + * 鍒濆鍔犺浇鍑芥暟 + */ + fetch() { + // 鍒嗘瀽鏁版嵁 + this.fetchData(); + // 寮傚父鏁版嵁 + this.exceptiondataCount(); + }, + + /** + * 瀵煎嚭涓篍xcel + + */ + exportData(){ + if(this.table.length!=0){ + const tableColumns = ['siteName','region','monitorType','riskValue','riskGrage','riskAdvice','beginTime','endTime'] + const excelColumns = [['A1','绔欑偣鍚嶇О'], + ['B1','鍖哄煙'],['C1','鐩戞祴绫诲瀷'],['D1','椋庨櫓鍊�'], + ['E1','椋庨櫓绛夌骇'],['F1','绠℃帶鎺柦'],['G1','寮�濮嬫棩鏈�'], + ['H1','缁撴潫鏃ユ湡']] + + this.exportToExcel(this.table,tableColumns,excelColumns,'缁煎悎椋庨櫓鎺掑悕.xlsx') + } }, - methods: { - } -} + } +}; </script> <template> - <div> -绔欑偣缁煎悎椋庨櫓鎺掑悕 - </div> + <el-row> + <el-row> + <el-form :inline="true" :model="form"> + <el-form-item> + <AreaAndmonitorType></AreaAndmonitorType> + </el-form-item> + <el-form-item> + <InputSearch + isNeedDefaultSite="1" + @submit-value="(n) => (form.name = n)" + ></InputSearch> + </el-form-item> + <el-form-item> + <TimeSelectWithShortCuts + @submit-time="giveTime" + ></TimeSelectWithShortCuts> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="fetch">椋庨櫓鎺掑悕</el-button> + <el-button type="warning" @click="exportData">瀵煎嚭</el-button> + </el-form-item> + </el-form> + </el-row> + </el-row> + + <el-table + :data="table" + height="600px" + style="width: 100%" + v-loading="loading" + :cell-class-name="tableCellClassName" + > + <el-table-column + type="index" + prop="name" + label="搴忓彿" + :index="indexMethod" + fixed + show-overflow-tooltip + /> + <el-table-column prop="siteName" label="绔欑偣鍚嶇О" show-overflow-tooltip /> + <el-table-column prop="region" label="鍖哄煙" show-overflow-tooltip /> + <el-table-column prop="monitorType" label="妫�娴嬬被鍨�" show-overflow-tooltip /> + <el-table-column prop="riskValue" label="椋庨櫓鍊�" show-overflow-tooltip /> + <el-table-column prop="riskGrage" label="椋庨櫓绛夌骇" show-overflow-tooltip /> + <el-table-column prop="riskAdvice" label="绠℃帶鎺柦" show-overflow-tooltip /> + <el-table-column prop="beginTime" label="寮�濮嬫棩鏈�" show-overflow-tooltip /> + <el-table-column prop="endTime" label="缁撴潫鏃ユ湡" show-overflow-tooltip /> + </el-table> + <el-empty v-show="isNoData" :image-size="200" /> + </template> -<style scoped> - -</style> \ No newline at end of file +<style scoped> +.el-row,.el-table { + margin: 10px 0px 0px 10px +} +.el-table{ + +} +</style> diff --git a/src/views/line_graph/components/DustRadarChart.vue b/src/views/line_graph/components/DustRadarChart.vue index b0e5748..9db0b1f 100644 --- a/src/views/line_graph/components/DustRadarChart.vue +++ b/src/views/line_graph/components/DustRadarChart.vue @@ -54,7 +54,7 @@ color: ['#ddd', '#aaa'] } }, - // shape: 'circle', + indicator: [ { name: this.name[0], max: 1 }, { name: this.name[1], max: 1 }, @@ -62,13 +62,7 @@ { name: this.name[3], max: 1 }, { name: this.name[4], max: 1 } ], - // splitArea: { - // areaStyle: { - // // color: ['#77EADF', '#26C3BE', '#64AFE9', '#428BD4'], - // shadowColor: 'rgba(0, 0, 0, 0.2)', - // shadowBlur: 10 - // } - // }, + axisName: { color: '#428BD4' }, @@ -82,11 +76,11 @@ data: [ { value: [ - (this.yData[0] / 100).toFixed(4), + (1 - (this.yData[0] / 100).toFixed(4)), this.yData[1], this.yData[2], - (this.yData[3] / 100).toFixed(4), - (this.yData[4] / 100).toFixed(4) + (this.yData[3] / 100).toFixed(4), + 1-((this.yData[4] / 100).toFixed(4)) ], // value: [ // this.yData[0], diff --git a/src/views/login/LoginSystem.vue b/src/views/login/LoginSystem.vue index 49a19c4..2739f79 100644 --- a/src/views/login/LoginSystem.vue +++ b/src/views/login/LoginSystem.vue @@ -31,6 +31,7 @@ </template> <script lang="ts"> +import Cookie from 'js-cookie' export default { data() { return { @@ -43,6 +44,8 @@ // 鐧诲綍閫昏緫 if (this.username === 'admin' && this.password === 'admin123') { ElMessage.success('鐧诲綍鎴愬姛'); + const token = 'abc' + Cookie.set('token',token) // 鐧诲綍鎴愬姛锛岃烦杞埌瀵瑰簲椤甸潰 this.$router.push('/edata') // 鍋囪鐧诲綍鎴愬姛鍚庤烦杞埌 '/dashboard' 椤甸潰 } else { diff --git a/src/views/setting/SetConfiguration.vue b/src/views/setting/SetConfiguration.vue index d8d07c5..e19ee72 100644 --- a/src/views/setting/SetConfiguration.vue +++ b/src/views/setting/SetConfiguration.vue @@ -1,76 +1,75 @@ <script> -import {useCounterStore} from '@/stores/counter'; -export default { - data(){ +import TimeSelectWithShortCuts from '@/sfc/TimeSelectWithShortCuts.vue'; +import settingApi from '@/api/data_access_setting/settingApi.js' +import dayjs from 'dayjs'; + export default { + components: { + TimeSelectWithShortCuts, + + }, + data() { return{ - + // 鍖哄煙 + radio:0, + // 瀹氭椂 + radio1:'', + beginTime:'', + endTime:'', } - }, - setup(){ - const store = useCounterStore() - const unsubscribe = store.$onAction( - ({ - name, // action 鐨勫悕瀛� - store, // store 瀹炰緥 - args, // 璋冪敤杩欎釜 action 鐨勫弬鏁� - after, // 鍦ㄨ繖涓� action 鎵ц瀹屾瘯涔嬪悗锛屾墽琛岃繖涓嚱鏁� - onError, // 鍦ㄨ繖涓� action 鎶涘嚭寮傚父鐨勬椂鍊欙紝鎵ц杩欎釜鍑芥暟 - }) => { - // 璁板綍寮�濮嬬殑鏃堕棿鍙橀噺 - const startTime = Date.now() - // 杩欏皢鍦� `store` 涓婄殑鎿嶄綔鎵ц涔嬪墠瑙﹀彂 - console.log(`Start "${name}" with params [${args.join(', ')}].`) - - // 濡傛灉 action 鎴愬姛骞朵笖瀹屽叏杩愯鍚庯紝after 灏嗚Е鍙戙�� - // 瀹冨皢绛夊緟浠讳綍杩斿洖鐨� promise - after((result) => { - console.log( - `Finished "${name}" after ${ - Date.now() - startTime - }ms.\nResult: ${result}.` - ) - }) - - // 濡傛灉 action 鎶涘嚭鎴栬繑鍥� Promise.reject 锛宱nError 灏嗚Е鍙� - onError((error) => { - console.warn( - `Failed "${name}" after ${Date.now() - startTime}ms.\nError: ${error}.` - ) - }) - } -) - return{ - store,unsubscribe - } - }, - computed:{ - a(){ - return this.store.doubleCount*2 }, - - }, - mounted(){ + mounted() { - }, - methods:{ - doThing(){ - this.store.increment(5) - this.store.doubleCount - } - } + }, + methods: { + giveTime(val) { + //灏嗕腑鍥芥爣鍑嗘椂闂磋浆涓烘寚瀹氭牸寮�(璇ョ粍浠惰繑鍥炵殑鏍囧噯鏃堕棿鐨勬牸寮忥紝鎵�浠ュ繀椤荤殑鍔犺繖涓嚱鏁�) + this.beginTime = dayjs(val[0]).format('YYYY-MM-DD HH:mm:ss'); + this.endTime = dayjs(val[1]).format('YYYY-MM-DD HH:mm:ss'); + }, + set(){ + const params = {} + params.user = 'admin' + params.beginTime = this.beginTime + params.endTime = this.endTime + params.region = '閲戝北' + params.isRegularTime = this.radio1 + settingApi.submitSetting(params).then(res => { + if(res.data.code == 1){ + ElMessage.success('璁剧疆鎴愬姛') + }else{ + ElMessage('璁剧疆澶辫触') + } + }) + } + } } </script> <template> - <div> - <el-button type="primary" @click="doThing">鐐瑰嚮{{ store.doubleCount }}</el-button> - </div> - <div>{{ a }}</div> - <div>{{ store.secret }}</div> - <div>{{ store.vue }}</div> - <div>{{ store.澶� }}</div> + <div>鐢熸垚閰嶇疆鏂囦欢</div> + <el-form> + <el-form-item label="鍖哄煙"> + <el-radio-group v-model="radio"> + <el-radio :label="0">閲戝北</el-radio> + <!-- <el-radio :label="6">Option B</el-radio> + <el-radio :label="9">Option C</el-radio> --> + </el-radio-group> + </el-form-item> + <el-form-item label="閫夋嫨璧峰鏃堕棿"> + <TimeSelectWithShortCuts @submit-time="giveTime"></TimeSelectWithShortCuts> + </el-form-item> + <el-form-item label="鏄惁瀹氭椂"> + <el-radio-group v-model="radio1" > + <el-radio label="1" size="large">鏄�</el-radio> + <el-radio label="2" size="large">鍚�</el-radio> + </el-radio-group> + </el-form-item> + + <el-form-item> <el-button @click="set">璁剧疆</el-button></el-form-item> + </el-form> </template> -<style scoped> + +<style scoped> </style> \ No newline at end of file -- Gitblit v1.9.3