告警设置、过滤单多指标、压制次数及纳入容量预测接口调用
Showing
5 changed files
with
395 additions
and
162 deletions
@@ -4,6 +4,7 @@ const prodEnv = require('./prod.env') | @@ -4,6 +4,7 @@ const prodEnv = require('./prod.env') | ||
4 | 4 | ||
5 | module.exports = merge(prodEnv, { | 5 | module.exports = merge(prodEnv, { |
6 | NODE_ENV: '"development"', | 6 | NODE_ENV: '"development"', |
7 | - BASE_API: '"http://127.0.0.1:9095"' | 7 | + BASE_API: '"http://127.0.0.1:9095"', |
8 | + BASE_API_other: '"https://192.168.0.69:8080"' | ||
8 | // BASE_API: '"http://10.108.26.197:9095"' | 9 | // BASE_API: '"http://10.108.26.197:9095"' |
9 | }) | 10 | }) |
1 | -import request from '@/utils/request' | 1 | +import request from '@/utils/request1' |
2 | import { getShareToken, getToken } from "@/utils/auth"; | 2 | import { getShareToken, getToken } from "@/utils/auth"; |
3 | import axios from 'axios'; | 3 | import axios from 'axios'; |
4 | //自监控平台接口数据联调 // Start LSQ 2022/1/13 10:52 TODO | 4 | //自监控平台接口数据联调 // Start LSQ 2022/1/13 10:52 TODO |
5 | -export function getData(data) { | 5 | +// export function getData(data) { |
6 | +// return request({ | ||
7 | +// url: 'reportDashboard/getData', | ||
8 | +// method: 'post', | ||
9 | +// headers: { 'Share-Token': getShareToken(), 'Authorization': getToken() }, | ||
10 | +// data, | ||
11 | +// }) | ||
12 | +// } | ||
13 | +//性能趋势图路径 | ||
14 | + | ||
15 | +export function getTrendBaseUrl() { | ||
16 | + return process.env.BASE_API_other | ||
17 | +} | ||
18 | +//获取告警策略列表数据 | ||
19 | +export function getAlarmPolicy(params) { | ||
20 | + return request({ | ||
21 | + url: '/api-web/alarmPolicy/list?policyType=0&kpiId=' +params.kpiId+'&access_token='+params.token, | ||
22 | + headers: { 'Authorization': "Bearer "+params.token }, | ||
23 | + method: 'get', | ||
24 | + }) | ||
25 | +} | ||
26 | +//获取告警订阅列表数据 | ||
27 | +export function getAlarmSubscribe(params) { | ||
28 | + return request({ | ||
29 | + url: '/api-web/alarmsubscribe/list?access_token='+params.token, | ||
30 | + headers: { 'Authorization': "Bearer "+params.token }, | ||
31 | + method: 'get', | ||
32 | + }) | ||
33 | +} | ||
34 | +//保存告警设置 | ||
35 | +export function saveKpiPolicy(params,urlObj) { | ||
36 | + return request({ | ||
37 | + url: '/api-web/alarmPolicy/save/kpipolicy?access_token='+urlObj.token, | ||
38 | + headers: { 'Authorization': "Bearer "+urlObj.token }, | ||
39 | + method: 'post', | ||
40 | + data:params | ||
41 | + }) | ||
42 | +} | ||
43 | +//保存过滤单指标 | ||
44 | +export function saveSetKpiFilter(params,urlObj) { | ||
45 | + let paramsStr='&resId='+params.resId+'&kpiId='+params.kpiId+'&flag='+params.flag+'&subFlag='+params.subFlag+'&isOne='+params.isOne; | ||
46 | + return request({ | ||
47 | + url: '/api-web/filterkpi/kpi/filter?access_token='+urlObj.token+paramsStr, | ||
48 | + headers: { 'Authorization': "Bearer "+urlObj.token }, | ||
49 | + method: 'GET', | ||
50 | + // data:params | ||
51 | + }) | ||
52 | +} | ||
53 | +//获取压制次数 | ||
54 | +export function getKpiPressTimes(params,urlObj) { | ||
55 | + let paramsStr='&resId='+params.resId+'&kpiId='+params.kpiId+'&flag='+params.flag+'&subFlag='+params.subFlag; | ||
56 | + return request({ | ||
57 | + url: '/api-web/manage/resource/res/kpi/findIgnore?access_token='+urlObj.token+paramsStr, | ||
58 | + headers: { 'Authorization': "Bearer "+urlObj.token }, | ||
59 | + method: 'GET', | ||
60 | + }) | ||
61 | +} | ||
62 | +//保存压制次数 | ||
63 | +export function saveSetKpiPressTimes(params,urlObj) { | ||
6 | return request({ | 64 | return request({ |
7 | - url: 'reportDashboard/getData', | 65 | + url: '/api-web/manage/resource/res/kpi/ignore?access_token='+urlObj.token, |
66 | + headers: { 'Authorization': "Bearer "+urlObj.token }, | ||
8 | method: 'post', | 67 | method: 'post', |
9 | - headers: { 'Share-Token': getShareToken(), 'Authorization': getToken() }, | ||
10 | - data, | 68 | + data:params |
69 | + }) | ||
70 | +} | ||
71 | +//纳入容量预测 | ||
72 | +export function saveCaAdd(params,urlObj) { | ||
73 | + let paramsStr='&resId='+params.resId+'&kpiId='+params.kpiId+'&flag='+params.flag+'&resType='+params.resType; | ||
74 | + return request({ | ||
75 | + url: '/api-web/caUnit/add?access_token='+urlObj.token+paramsStr, | ||
76 | + headers: { 'Authorization': "Bearer "+urlObj.token }, | ||
77 | + method: 'GET', | ||
78 | + }) | ||
79 | +} | ||
80 | +//获取资源类型 | ||
81 | +export function getResType(params,urlObj) { | ||
82 | + return request({ | ||
83 | + url: 'api-web/manage/resource/findById?resId='+params.resId+'&access_token='+urlObj.token, | ||
84 | + headers: { 'Authorization': "Bearer "+urlObj.token }, | ||
85 | + method: 'GET', | ||
11 | }) | 86 | }) |
12 | } | 87 | } |
13 | export function getHealth(data) { | 88 | export function getHealth(data) { |
report-ui/src/utils/request1.js
0 → 100644
1 | +import axios from 'axios' | ||
2 | +import { Message, MessageBox } from 'element-ui' | ||
3 | +import store from '../store' | ||
4 | +import { getToken } from '@/utils/auth' | ||
5 | +// 创建axios实例 | ||
6 | +const service = axios.create({ | ||
7 | + baseURL: process.env.BASE_API_other, // api 的 base_url | ||
8 | + timeout: 20000 // 请求超时时间 | ||
9 | +}) | ||
10 | + | ||
11 | +// request拦截器 | ||
12 | +service.interceptors.request.use( | ||
13 | + config => { | ||
14 | + config.headers['Authorization'] = (getToken() == null || getToken() == undefined) ? '' : getToken() | ||
15 | + return config | ||
16 | + }, | ||
17 | + error => { | ||
18 | + // Do something with request error | ||
19 | + Promise.reject(error) | ||
20 | + } | ||
21 | +) | ||
22 | + | ||
23 | +// response 拦截器 | ||
24 | +service.interceptors.response.use( | ||
25 | + response => { | ||
26 | + /** | ||
27 | + * code为非20000是抛错 可结合自己业务进行修改 | ||
28 | + */ | ||
29 | + const res = response.data | ||
30 | + // 50008:非法的token; 50012:其他客户端登录了; 50014:Token 过期了; | ||
31 | + if (res.code == '50008' || res.code == '50012' || res.code == '50014') { | ||
32 | + MessageBox.confirm( | ||
33 | + '你已被登出,可以取消继续留在该页面,或者重新登录', | ||
34 | + '重新登录', | ||
35 | + { | ||
36 | + confirmButtonText: '重新登录', | ||
37 | + cancelButtonText: '取消', | ||
38 | + type: 'warning' | ||
39 | + } | ||
40 | + ).then(() => { | ||
41 | + sessionStorage.clear() | ||
42 | + localStorage.clear() | ||
43 | + window.location.href = "/"; | ||
44 | + }) | ||
45 | + } | ||
46 | + else if (res.code !== '200' && res.code !== 0) { | ||
47 | + Message({ | ||
48 | + message: res.message, | ||
49 | + type: 'error', | ||
50 | + duration: 5 * 1000 | ||
51 | + }) | ||
52 | + return response.data | ||
53 | + } else { | ||
54 | + return response.data | ||
55 | + } | ||
56 | + }, | ||
57 | + error => { | ||
58 | + Message({ | ||
59 | + message: error.message, | ||
60 | + type: 'error', | ||
61 | + duration: 5 * 1000 | ||
62 | + }) | ||
63 | + return Promise.reject(error) | ||
64 | + } | ||
65 | +) | ||
66 | + | ||
67 | +export default service |
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | <img class="info-img" src="@/assets/images/healthStatus/icon_row_menu.png" alt="" @click.stop="pressingTimes()"> | 6 | <img class="info-img" src="@/assets/images/healthStatus/icon_row_menu.png" alt="" @click.stop="pressingTimes()"> |
7 | </template> | 7 | </template> |
8 | <div class="info-ul" style="width:140px;" > | 8 | <div class="info-ul" style="width:140px;" > |
9 | - <div class="basic-pressing-times" @click.stop="pressingDialog(itemMenu,tableDataValue,flg)" v-for="itemMenu in detailMenubox"> | 9 | + <div class="basic-pressing-times" @click.stop="pressingDialog(itemMenu,tableDataValue,tableDataValueHead,flg)" v-for="itemMenu in detailMenubox"> |
10 | <i class="el-icon-link icon-div"></i>{{itemMenu.name}} | 10 | <i class="el-icon-link icon-div"></i>{{itemMenu.name}} |
11 | </div> | 11 | </div> |
12 | </div> | 12 | </div> |
@@ -20,24 +20,24 @@ | @@ -20,24 +20,24 @@ | ||
20 | <!-- 告警设置{{pressingValue}}--> | 20 | <!-- 告警设置{{pressingValue}}--> |
21 | <div class="alarm-li flex-center"> | 21 | <div class="alarm-li flex-center"> |
22 | <div class="alarm-li-label">告警策略</div> | 22 | <div class="alarm-li-label">告警策略</div> |
23 | - <el-select v-model="strategyValue" filterable class="m-2 alarm-li-select" placeholder="选择告警策略"> | 23 | + <el-select v-model="strategyValue" filterable clearable class="m-2 alarm-li-select" placeholder="选择告警策略"> |
24 | <el-option | 24 | <el-option |
25 | v-for="item in strategyData" | 25 | v-for="item in strategyData" |
26 | - :key="item.value" | ||
27 | - :label="item.label" | ||
28 | - :value="item.value" | 26 | + :key="item.alarmPolicyId" |
27 | + :label="item.alarmPolicyName" | ||
28 | + :value="item.alarmPolicyId" | ||
29 | > | 29 | > |
30 | </el-option> | 30 | </el-option> |
31 | </el-select> | 31 | </el-select> |
32 | </div> | 32 | </div> |
33 | <div class="alarm-li flex-center"> | 33 | <div class="alarm-li flex-center"> |
34 | <div class="alarm-li-label">告警列表</div> | 34 | <div class="alarm-li-label">告警列表</div> |
35 | - <el-select v-model="alarmListValue" multiple filterable class="m-2 alarm-li-select" placeholder="选择告警列表" > | 35 | + <el-select v-model="alarmListValue" multiple clearable filterable class="m-2 alarm-li-select" placeholder="选择告警列表" > |
36 | <el-option | 36 | <el-option |
37 | v-for="item in alarmListData" | 37 | v-for="item in alarmListData" |
38 | - :key="item.value" | ||
39 | - :label="item.label" | ||
40 | - :value="item.value" | 38 | + :key="item.subId" |
39 | + :label="item.subName" | ||
40 | + :value="item.subId" | ||
41 | > | 41 | > |
42 | </el-option> | 42 | </el-option> |
43 | </el-select> | 43 | </el-select> |
@@ -53,13 +53,13 @@ | @@ -53,13 +53,13 @@ | ||
53 | 您确定要对当前指标进行过滤处理? | 53 | 您确定要对当前指标进行过滤处理? |
54 | </div> | 54 | </div> |
55 | <div v-if="dialogName=='performance_trends'" class="txtScroll-top"> | 55 | <div v-if="dialogName=='performance_trends'" class="txtScroll-top"> |
56 | - <div>性能趋势{{pressingValue}}</div> | 56 | + <div>性能趋势{{pressingValue.kpiValue}}</div> |
57 | <iframe :src="trendSrc" class="layadmin-iframe" style="height: 99.5%!important;width: 100%;"/> | 57 | <iframe :src="trendSrc" class="layadmin-iframe" style="height: 99.5%!important;width: 100%;"/> |
58 | </div> | 58 | </div> |
59 | <div v-if="dialogName=='pressing_times'" class="txtScroll-top"> | 59 | <div v-if="dialogName=='pressing_times'" class="txtScroll-top"> |
60 | <!-- 压制次数{{pressingValue}}--> | 60 | <!-- 压制次数{{pressingValue}}--> |
61 | <el-input | 61 | <el-input |
62 | - v-model="pressingNum" | 62 | + v-model="ignoreCnt" |
63 | :rows="2" | 63 | :rows="2" |
64 | type="textarea" | 64 | type="textarea" |
65 | placeholder="压制次数(必填,建议100以内)" | 65 | placeholder="压制次数(必填,建议100以内)" |
@@ -77,6 +77,7 @@ | @@ -77,6 +77,7 @@ | ||
77 | <script> | 77 | <script> |
78 | import customDialog from "./customDialog"; | 78 | import customDialog from "./customDialog"; |
79 | import {Message} from "_element-ui@2.15.6@element-ui"; | 79 | import {Message} from "_element-ui@2.15.6@element-ui"; |
80 | +import {getAlarmPolicy,getAlarmSubscribe,saveKpiPolicy,saveSetKpiFilter,getKpiPressTimes,saveSetKpiPressTimes,saveCaAdd,getTrendBaseUrl} from "@/api/platform"; | ||
80 | 81 | ||
81 | export default { | 82 | export default { |
82 | name: "customMenuBox", | 83 | name: "customMenuBox", |
@@ -86,9 +87,9 @@ export default { | @@ -86,9 +87,9 @@ export default { | ||
86 | props: { | 87 | props: { |
87 | heightStyle: String, | 88 | heightStyle: String, |
88 | marginStyle: String, | 89 | marginStyle: String, |
89 | - trendSrc:{ | ||
90 | - type:String, | ||
91 | - default:'', | 90 | + tableDataValueHead:{ |
91 | + type:Object, | ||
92 | + default: {}, | ||
92 | }, | 93 | }, |
93 | tableName:{ | 94 | tableName:{ |
94 | type:String, | 95 | type:String, |
@@ -130,13 +131,18 @@ export default { | @@ -130,13 +131,18 @@ export default { | ||
130 | ] | 131 | ] |
131 | },//表格下探数据 | 132 | },//表格下探数据 |
132 | tableDataValue: { | 133 | tableDataValue: { |
133 | - type: String, | ||
134 | - default: '' | 134 | + type: Object, |
135 | + default: {} | ||
135 | },//单元格内容 | 136 | },//单元格内容 |
136 | flg: { | 137 | flg: { |
137 | type: String, | 138 | type: String, |
138 | default: '' | 139 | default: '' |
139 | },//标志 | 140 | },//标志 |
141 | + urlObj:{},//url地址参数对象 | ||
142 | + resType:{ | ||
143 | + type: String, | ||
144 | + default: '' | ||
145 | + },//资源类型 | ||
140 | }, | 146 | }, |
141 | data() { | 147 | data() { |
142 | return { | 148 | return { |
@@ -146,31 +152,15 @@ export default { | @@ -146,31 +152,15 @@ export default { | ||
146 | // trendSrc:'',//性能走势图地址 | 152 | // trendSrc:'',//性能走势图地址 |
147 | // pressingVisible:'', | 153 | // pressingVisible:'', |
148 | pressingValue:'',//压制次数 | 154 | pressingValue:'',//压制次数 |
149 | - pressingNum:'', | ||
150 | - strategyData: [{ | ||
151 | - label:'策略一', | ||
152 | - value:'001' | ||
153 | - }],//告警策略数据 | 155 | + ignoreCnt:'', |
156 | + strategyData: [],//告警策略数据 | ||
154 | strategyValue:'',//告警策略值 | 157 | strategyValue:'',//告警策略值 |
155 | - alarmListData:[{ | ||
156 | - label:'告警列表一', | ||
157 | - value:'001' | ||
158 | - },{ | ||
159 | - label:'告警列表二', | ||
160 | - value:'002' | ||
161 | - },],//告警列表数据 | 158 | + alarmListData:[],//告警列表数据 |
162 | alarmListValue:[],//告警列表值 | 159 | alarmListValue:[],//告警列表值 |
163 | - | 160 | + trendSrc:'',//性能趋势图地址 |
164 | } | 161 | } |
165 | }, | 162 | }, |
166 | watch: { | 163 | watch: { |
167 | - trendSrc: { | ||
168 | - handler(val) { | ||
169 | - console.log("trendSrc",val) | ||
170 | - | ||
171 | - }, | ||
172 | - deep: true | ||
173 | - }, | ||
174 | tableName:{ | 164 | tableName:{ |
175 | handler(val){ | 165 | handler(val){ |
176 | console.log("titlename",val) | 166 | console.log("titlename",val) |
@@ -178,8 +168,20 @@ export default { | @@ -178,8 +168,20 @@ export default { | ||
178 | deep:true | 168 | deep:true |
179 | } | 169 | } |
180 | }, | 170 | }, |
171 | + computed: { | ||
172 | + //获取url地址中的token | ||
173 | + getUrlToken(){ | ||
174 | + let locationUrl=this.$route.query; | ||
175 | + let resId=locationUrl.resId; | ||
176 | + let token=locationUrl.access_token; | ||
177 | + let urlObj={ | ||
178 | + resId:resId, | ||
179 | + token:token | ||
180 | + } | ||
181 | + return urlObj; | ||
182 | + } | ||
183 | + }, | ||
181 | mounted() { | 184 | mounted() { |
182 | - | ||
183 | }, | 185 | }, |
184 | methods: { | 186 | methods: { |
185 | //表格下探关闭 | 187 | //表格下探关闭 |
@@ -191,19 +193,33 @@ export default { | @@ -191,19 +193,33 @@ export default { | ||
191 | this.dialogVisible=false; | 193 | this.dialogVisible=false; |
192 | }, | 194 | }, |
193 | okFunc(){ | 195 | okFunc(){ |
194 | - this.dialogVisible=false; | ||
195 | if(this.dialogName=='filter_sheet_indicator'){ | 196 | if(this.dialogName=='filter_sheet_indicator'){ |
197 | + //保存设置单指标过滤 | ||
196 | this.setKpiFilter(true); | 198 | this.setKpiFilter(true); |
199 | + this.dialogVisible=false; | ||
197 | }else if(this.dialogName=='filter_multiple_indicators'){ | 200 | }else if(this.dialogName=='filter_multiple_indicators'){ |
201 | + //保存设置多指标过滤 | ||
198 | this.setKpiFilter(false); | 202 | this.setKpiFilter(false); |
203 | + this.dialogVisible=false; | ||
204 | + }else if(this.dialogName=='alarm_setting'){ | ||
205 | + //保存告警设置 | ||
206 | + this.alarmSetSave(); | ||
207 | + }else if(this.dialogName=='pressing_times'){ | ||
208 | + //保存压制次数 | ||
209 | + this.setKpiPressTimes(); | ||
199 | } | 210 | } |
211 | + // this.dialogVisible=false; | ||
212 | + | ||
200 | }, | 213 | }, |
201 | //表格下探 | 214 | //表格下探 |
202 | - pressingDialog(itemMenu,value,flg){ | ||
203 | - this.pressingValue=value; | 215 | + pressingDialog(itemMenu,tableDataValue,tableDataValueHead,flg){ |
216 | + this.pressingValue=tableDataValue; | ||
217 | + let kpiId=tableDataValue.kpiId; | ||
204 | let styleStr='width: 300px;height: 200px;min-height: 200px;overflow: hidden;' | 218 | let styleStr='width: 300px;height: 200px;min-height: 200px;overflow: hidden;' |
219 | + let isDialog=true; | ||
205 | if(itemMenu.type=='alarm_setting'){ | 220 | if(itemMenu.type=='alarm_setting'){ |
206 | this.widthStyle='width:70%;'; | 221 | this.widthStyle='width:70%;'; |
222 | + this.getAlarmPolicyData(kpiId) | ||
207 | 223 | ||
208 | }else if(itemMenu.type=='filter_sheet_indicator'){ | 224 | }else if(itemMenu.type=='filter_sheet_indicator'){ |
209 | this.widthStyle=styleStr; | 225 | this.widthStyle=styleStr; |
@@ -213,16 +229,23 @@ export default { | @@ -213,16 +229,23 @@ export default { | ||
213 | 229 | ||
214 | }else if(itemMenu.type=='performance_trends'){ | 230 | }else if(itemMenu.type=='performance_trends'){ |
215 | this.widthStyle=''; | 231 | this.widthStyle=''; |
232 | + this.setTrend(tableDataValueHead); | ||
216 | 233 | ||
217 | }else if(itemMenu.type=='pressing_times'){ | 234 | }else if(itemMenu.type=='pressing_times'){ |
218 | this.widthStyle='width:400px;height: 200px;min-height: 200px;overflow: hidden;'; | 235 | this.widthStyle='width:400px;height: 200px;min-height: 200px;overflow: hidden;'; |
236 | + //获取压制次数 | ||
237 | + this.getKpiPressTimesData(tableDataValue); | ||
219 | 238 | ||
220 | }else if(itemMenu.type=='include_capacity_forecast'){ | 239 | }else if(itemMenu.type=='include_capacity_forecast'){ |
221 | this.widthStyle=styleStr; | 240 | this.widthStyle=styleStr; |
241 | + isDialog=false; | ||
242 | + this.caAdd(); | ||
222 | 243 | ||
223 | } | 244 | } |
224 | 245 | ||
246 | + if(isDialog){ | ||
225 | this.setDialog(itemMenu.type,flg); | 247 | this.setDialog(itemMenu.type,flg); |
248 | + } | ||
226 | 249 | ||
227 | this.closePopoverMenu(); | 250 | this.closePopoverMenu(); |
228 | 251 | ||
@@ -248,18 +271,161 @@ export default { | @@ -248,18 +271,161 @@ export default { | ||
248 | this.dialogName=name; | 271 | this.dialogName=name; |
249 | }, | 272 | }, |
250 | //设置指标过滤,isOne true单指标过滤,false多指标过滤 | 273 | //设置指标过滤,isOne true单指标过滤,false多指标过滤 |
251 | - setKpiFilter(isOne){ | 274 | + async setKpiFilter(isOne){ |
275 | + | ||
252 | let params={ | 276 | let params={ |
253 | - resId: '',kpiId: '',flag:'',subFlag: '', | 277 | + resId:this.getUrlToken.resId, |
278 | + kpiId:this.pressingValue.kpiId, | ||
279 | + flag:this.pressingValue.flag, | ||
280 | + subFlag:this.pressingValue.kpiName, | ||
281 | + isOne:isOne===true?'s':'m' | ||
254 | } | 282 | } |
255 | - let datas={resId:params.resId,kpiId:params.kpiId,flag:params.flag,isOne:isOne===true?'s':'m',subFlag:params.subFlag} | ||
256 | - console.log("过滤指标",isOne,'/api-web/filterkpi/kpi/filter') | 283 | + |
284 | + const { success } = await saveSetKpiFilter(params,this.getUrlToken); | ||
285 | + if (success) { | ||
257 | Message({ | 286 | Message({ |
258 | - message: '过滤指标失败', | 287 | + message: '过滤设置成功', |
288 | + type: 'success', | ||
289 | + duration: 3 * 1000 | ||
290 | + }) | ||
291 | + }else{ | ||
292 | + Message({ | ||
293 | + message: '过滤设置失败', | ||
259 | type: 'error', | 294 | type: 'error', |
260 | duration: 3 * 1000 | 295 | duration: 3 * 1000 |
261 | }) | 296 | }) |
262 | } | 297 | } |
298 | + }, | ||
299 | + //设置性能趋势图 | ||
300 | + setTrend(tableDataValueHead){ | ||
301 | + let urlParams='resId='+this.getUrlToken.resId+'&kpiId='+this.pressingValue.kpiId+'&flag='+this.pressingValue.flag+'&warning='+this.pressingValue.iswarning | ||
302 | + +'&ident='+this.pressingValue.kpiIdent | ||
303 | + +'&trend='+this.pressingValue.isTrend | ||
304 | + +'&unit='+tableDataValueHead.unit | ||
305 | + +'&name='+this.pressingValue.kpiName + " " + tableDataValueHead.name; | ||
306 | + let baseUrl=getTrendBaseUrl(); | ||
307 | + this.trendSrc=baseUrl+'/vue3/index.html#/vue3/pieDetailLine?'+urlParams; | ||
308 | + }, | ||
309 | + //获取告警策略列表数据 | ||
310 | + async getAlarmPolicyData(kpiId){ | ||
311 | + let obj=this.getUrlToken; | ||
312 | + let params={ | ||
313 | + kpiId:kpiId, | ||
314 | + token:obj.token | ||
315 | + } | ||
316 | + const { code, data } = await getAlarmPolicy(params); | ||
317 | + if (code != 200 && code!=0) return; | ||
318 | + this.strategyData=data; | ||
319 | + this.getAlarmSubscribeData(params); | ||
320 | + | ||
321 | + }, | ||
322 | + //获取告警订阅列表数据 | ||
323 | + async getAlarmSubscribeData(params){ | ||
324 | + const { code, data } = await getAlarmSubscribe(params); | ||
325 | + if (code != 200 && code!=0) return; | ||
326 | + this.alarmListData=data; | ||
327 | + }, | ||
328 | + //保存告警设置 | ||
329 | + async alarmSetSave(){ | ||
330 | + let kpiSubscribe=this.alarmListValue.join(','); | ||
331 | + if(!this.strategyValue || !kpiSubscribe){ | ||
332 | + Message({ | ||
333 | + message: '告警策略或者告警订阅不能为空', | ||
334 | + type: 'warning', | ||
335 | + duration: 3 * 1000 | ||
336 | + }); | ||
337 | + return; | ||
338 | + } | ||
339 | + let params={ | ||
340 | + resId:this.getUrlToken.resId, | ||
341 | + kpiId:this.pressingValue.kpiId, | ||
342 | + flag:this.pressingValue.flag, | ||
343 | + policyId:this.strategyValue, | ||
344 | + subId:kpiSubscribe | ||
345 | + } | ||
346 | + const { success } = await saveKpiPolicy(params,this.getUrlToken); | ||
347 | + if (success){ | ||
348 | + Message({ | ||
349 | + message: '设置成功', | ||
350 | + type: 'success', | ||
351 | + duration: 3 * 1000 | ||
352 | + }); | ||
353 | + | ||
354 | + }else{ | ||
355 | + Message({ | ||
356 | + message: '设置失败', | ||
357 | + type: 'error', | ||
358 | + duration: 3 * 1000 | ||
359 | + }); | ||
360 | + } | ||
361 | + this.dialogVisible=false; | ||
362 | + | ||
363 | + }, | ||
364 | + //获取压制次数 | ||
365 | + async getKpiPressTimesData(obj){ | ||
366 | + let params= { | ||
367 | + resId: this.getUrlToken.resId, | ||
368 | + kpiId: obj.kpiId, | ||
369 | + flag: obj.flag, | ||
370 | + subFlag: obj.kpiName | ||
371 | + } | ||
372 | + const { code, object } = await getKpiPressTimes(params,this.getUrlToken); | ||
373 | + if (code != 200 && code!=0) return; | ||
374 | + this.ignoreCnt = object?object.ignoreCnt:""; | ||
375 | + }, | ||
376 | + //保存设置压制次数 | ||
377 | + async setKpiPressTimes(){ | ||
378 | + let params= { | ||
379 | + access_token:this.getUrlToken.token, | ||
380 | + resId: this.getUrlToken.resId, | ||
381 | + kpiId: this.pressingValue.kpiId, | ||
382 | + flag: this.pressingValue.flag, | ||
383 | + subFlag: this.pressingValue.kpiName, | ||
384 | + ignoreCnt:this.ignoreCnt | ||
385 | + } | ||
386 | + const { success } = await saveSetKpiPressTimes(params,this.getUrlToken); | ||
387 | + if(success){ | ||
388 | + Message({ | ||
389 | + message: '设置成功', | ||
390 | + type: 'success', | ||
391 | + duration: 3 * 1000 | ||
392 | + }); | ||
393 | + }else{ | ||
394 | + Message({ | ||
395 | + message: '设置失败,请与管理员联系!', | ||
396 | + type: 'error', | ||
397 | + duration: 3 * 1000 | ||
398 | + }); | ||
399 | + } | ||
400 | + this.dialogVisible=false; | ||
401 | + | ||
402 | + }, | ||
403 | + //纳入容量预测 | ||
404 | + async caAdd(){ | ||
405 | + let params= { | ||
406 | + resId: this.getUrlToken.resId, | ||
407 | + kpiId: this.pressingValue.kpiId, | ||
408 | + flag: this.pressingValue.flag, | ||
409 | + resType: this.resType, | ||
410 | + } | ||
411 | + const { success } = await saveCaAdd(params,this.getUrlToken); | ||
412 | + if(success){ | ||
413 | + Message({ | ||
414 | + message: '纳入容量预测成功', | ||
415 | + type: 'success', | ||
416 | + duration: 3 * 1000 | ||
417 | + }); | ||
418 | + }else{ | ||
419 | + Message({ | ||
420 | + message: '纳入容量预测失败!', | ||
421 | + type: 'error', | ||
422 | + duration: 3 * 1000 | ||
423 | + }); | ||
424 | + } | ||
425 | + this.dialogVisible=false; | ||
426 | + | ||
427 | + }, | ||
428 | + | ||
263 | } | 429 | } |
264 | } | 430 | } |
265 | </script> | 431 | </script> |
@@ -50,9 +50,10 @@ | @@ -50,9 +50,10 @@ | ||
50 | 50 | ||
51 | <customMenuBox ref="customMenu" v-if="pressingVisible==index+'-'+idx && item[itemChild.key] && (item[itemChild.key].kpiIdent==1 || item[itemChild.key].isWarning==1)" | 51 | <customMenuBox ref="customMenu" v-if="pressingVisible==index+'-'+idx && item[itemChild.key] && (item[itemChild.key].kpiIdent==1 || item[itemChild.key].isWarning==1)" |
52 | :detailMenubox="calcDetailMenubox" | 52 | :detailMenubox="calcDetailMenubox" |
53 | - :tableDataValue="item[itemChild.key].kpiValue" :flg="''" :trendSrc="trendSrc" | 53 | + :tableDataValue="item[itemChild.key]" :flg="''" |
54 | + :tableDataValueHead="itemChild" | ||
54 | :heightStyle="heightStyle" :marginStyle="marginStyle" :tableName="dialogNameStyle(item[itemChild.key])" | 55 | :heightStyle="heightStyle" :marginStyle="marginStyle" :tableName="dialogNameStyle(item[itemChild.key])" |
55 | - | 56 | + :resType="resType" |
56 | ></customMenuBox> | 57 | ></customMenuBox> |
57 | </div> | 58 | </div> |
58 | </li> | 59 | </li> |
@@ -114,9 +115,10 @@ | @@ -114,9 +115,10 @@ | ||
114 | {{ item[itemChild.key]?item[itemChild.key].kpiValue:'' }}</span>--> | 115 | {{ item[itemChild.key]?item[itemChild.key].kpiValue:'' }}</span>--> |
115 | <customMenuBox v-if="pressingVisible==index+'-'+idx && item[itemChild.key] && (item[itemChild.key].kpiIdent==1 || item[itemChild.key].isWarning==1)" | 116 | <customMenuBox v-if="pressingVisible==index+'-'+idx && item[itemChild.key] && (item[itemChild.key].kpiIdent==1 || item[itemChild.key].isWarning==1)" |
116 | :detailMenubox="calcDetailMenubox" | 117 | :detailMenubox="calcDetailMenubox" |
117 | - :tableDataValue="item[itemChild.key].kpiValue" :flg="''" :trendSrc="trendSrc" | 118 | + :tableDataValue="item[itemChild.key]" :flg="''" |
119 | + :tableDataValueHead="itemChild" | ||
118 | :heightStyle="heightStyle" :marginStyle="marginStyle" :tableName="dialogNameStyle(item[itemChild.key])" | 120 | :heightStyle="heightStyle" :marginStyle="marginStyle" :tableName="dialogNameStyle(item[itemChild.key])" |
119 | - | 121 | + :resType="resType" |
120 | ></customMenuBox> | 122 | ></customMenuBox> |
121 | </div> | 123 | </div> |
122 | </li> | 124 | </li> |
@@ -150,44 +152,13 @@ | @@ -150,44 +152,13 @@ | ||
150 | </div> | 152 | </div> |
151 | </template> | 153 | </template> |
152 | </customDialog> | 154 | </customDialog> |
153 | -<!-- <div class="dialog-div" v-if="tableVisible" :style="heightStyle"> | ||
154 | - <div class="dialog-div-content" :style="marginStyle" > | ||
155 | - <div class="dialog-div-title title-flex-between"><span>{{tableStyle.tableName}}</span> <span class="dialog-close" @click="tableVisible = false">X</span></div> | ||
156 | - | ||
157 | - </div> | ||
158 | - </div>--> | ||
159 | -<!-- <customDialog :dialogVisible="dialogVisible" :heightStyle="heightStyle" :marginStyle="marginStyle" :widthStyle="widthStyle" :title-name="tableStyle.tableName" | ||
160 | - :showFooter="true" :showCancelBtn="true" :showOkBtn="true" @hideDialog="hideDialog" @okFunc="okFunc" | ||
161 | - > | ||
162 | - <template v-slot> | ||
163 | - <div v-if="dialogName=='alarm_setting'" class="txtScroll-top"> | ||
164 | - 告警设置{{pressingValue}} | ||
165 | - </div> | ||
166 | - <div v-if="dialogName=='filter_sheet_indicator'" class="txtScroll-top"> | ||
167 | - 过滤单指标{{pressingValue}} | ||
168 | - </div> | ||
169 | - <div v-if="dialogName=='filter_multiple_indicators'" class="txtScroll-top"> | ||
170 | - 过滤多指标{{pressingValue}} | ||
171 | - </div> | ||
172 | - <div v-if="dialogName=='performance_trends'" class="txtScroll-top"> | ||
173 | - 性能趋势{{pressingValue}} | ||
174 | - <iframe :src="trendSrc" class="layadmin-iframe" style="height: 99.5%!important;width: 100%;"/> | ||
175 | - </div> | ||
176 | - <div v-if="dialogName=='pressing_times'" class="txtScroll-top"> | ||
177 | - 压制次数{{pressingValue}} | ||
178 | - </div> | ||
179 | - <div v-if="dialogName=='include_capacity_forecast'" class="txtScroll-top"> | ||
180 | - 纳入容量预测{{pressingValue}} | ||
181 | - </div> | ||
182 | - </template> | ||
183 | - </customDialog>--> | ||
184 | 155 | ||
185 | </div> | 156 | </div> |
186 | </template> | 157 | </template> |
187 | <script> | 158 | <script> |
188 | import vue from "vue"; | 159 | import vue from "vue"; |
189 | import VueSuperSlide from "vue-superslide"; | 160 | import VueSuperSlide from "vue-superslide"; |
190 | -import {getDetailTableData,getDetailTableDataNoPage} from "@/api/platform"; | 161 | +import {getDetailTableData,getDetailTableDataNoPage,getResType} from "@/api/platform"; |
191 | import customDialog from "../../designerComponents/customDialog"; | 162 | import customDialog from "../../designerComponents/customDialog"; |
192 | import customMenuBox from "../../designerComponents/customMenuBox";//下探组件 | 163 | import customMenuBox from "../../designerComponents/customMenuBox";//下探组件 |
193 | import textToImage from "../../designerComponents/textToImage";//文字转图片 | 164 | import textToImage from "../../designerComponents/textToImage";//文字转图片 |
@@ -232,38 +203,6 @@ export default { | @@ -232,38 +203,6 @@ export default { | ||
232 | optionsData: {}, | 203 | optionsData: {}, |
233 | pressingVisible:'', | 204 | pressingVisible:'', |
234 | isHover:false, | 205 | isHover:false, |
235 | - /*detailMenubox:[ | ||
236 | - { | ||
237 | - name:'告警设置', | ||
238 | - type:'alarm_setting', | ||
239 | - isDisplay:true | ||
240 | - }, | ||
241 | - { | ||
242 | - name:'过滤单指标', | ||
243 | - type:'filter_sheet_indicator', | ||
244 | - isDisplay:true | ||
245 | - }, | ||
246 | - { | ||
247 | - name:'过滤多指标', | ||
248 | - type:'filter_multiple_indicators', | ||
249 | - isDisplay:true | ||
250 | - }, | ||
251 | - { | ||
252 | - name:'性能趋势', | ||
253 | - type:'performance_trends', | ||
254 | - isDisplay:true | ||
255 | - }, | ||
256 | - { | ||
257 | - name:'压制次数', | ||
258 | - type:'pressing_times', | ||
259 | - isDisplay:true | ||
260 | - }, | ||
261 | - { | ||
262 | - name:'纳入容量预测', | ||
263 | - type:'include_capacity_forecast', | ||
264 | - isDisplay:true | ||
265 | - } | ||
266 | - ],*/ | ||
267 | dialogName:'',//表格名称 | 206 | dialogName:'',//表格名称 |
268 | pressingValue:'',//表格下探值 | 207 | pressingValue:'',//表格下探值 |
269 | trendSrc:'',//性能走势图地址 | 208 | trendSrc:'',//性能走势图地址 |
@@ -276,6 +215,7 @@ export default { | @@ -276,6 +215,7 @@ export default { | ||
276 | isEllipsis:[],//是否文字超出 | 215 | isEllipsis:[],//是否文字超出 |
277 | isEllipsisMore:[],//是否文字超出 | 216 | isEllipsisMore:[],//是否文字超出 |
278 | componentName:'',//组件名称 | 217 | componentName:'',//组件名称 |
218 | + resType:'',//资源类型 | ||
279 | }; | 219 | }; |
280 | }, | 220 | }, |
281 | computed: { | 221 | computed: { |
@@ -381,6 +321,17 @@ export default { | @@ -381,6 +321,17 @@ export default { | ||
381 | }) | 321 | }) |
382 | } | 322 | } |
383 | return detailMenuBox; | 323 | return detailMenuBox; |
324 | + }, | ||
325 | + //获取url地址中的token | ||
326 | + getUrlToken(){ | ||
327 | + let locationUrl=this.$route.query; | ||
328 | + let resId=locationUrl.resId; | ||
329 | + let token=locationUrl.access_token; | ||
330 | + let urlObj={ | ||
331 | + resId:resId, | ||
332 | + token:token | ||
333 | + } | ||
334 | + return urlObj; | ||
384 | } | 335 | } |
385 | }, | 336 | }, |
386 | watch: { | 337 | watch: { |
@@ -390,15 +341,18 @@ export default { | @@ -390,15 +341,18 @@ export default { | ||
390 | this.optionsPosition = val.position; | 341 | this.optionsPosition = val.position; |
391 | this.optionsData = val.data; | 342 | this.optionsData = val.data; |
392 | this.initData(); | 343 | this.initData(); |
344 | + this.getResTypeData(); | ||
393 | }, | 345 | }, |
394 | deep: true | 346 | deep: true |
395 | } | 347 | } |
396 | }, | 348 | }, |
349 | + | ||
397 | mounted() { | 350 | mounted() { |
398 | this.optionsSetUp = this.value.setup; | 351 | this.optionsSetUp = this.value.setup; |
399 | this.optionsPosition = this.value.position; | 352 | this.optionsPosition = this.value.position; |
400 | this.optionsData = this.value.data; | 353 | this.optionsData = this.value.data; |
401 | this.initData(); | 354 | this.initData(); |
355 | + this.getResTypeData(); | ||
402 | }, | 356 | }, |
403 | methods: { | 357 | methods: { |
404 | initData() { | 358 | initData() { |
@@ -571,13 +525,6 @@ export default { | @@ -571,13 +525,6 @@ export default { | ||
571 | // this.setDialog('table'); | 525 | // this.setDialog('table'); |
572 | this.tableVisible=true; | 526 | this.tableVisible=true; |
573 | }, | 527 | }, |
574 | - /*//打开弹框 | ||
575 | - setDialog(name,flg){ | ||
576 | - | ||
577 | - this.dialogVisible=true; | ||
578 | - | ||
579 | - this.dialogName=name; | ||
580 | - },*/ | ||
581 | //点击表格内容名称事件 | 528 | //点击表格内容名称事件 |
582 | clickListName(obj){ | 529 | clickListName(obj){ |
583 | if(obj.kpiIdent==1 || obj.isWarning==1){ | 530 | if(obj.kpiIdent==1 || obj.isWarning==1){ |
@@ -724,41 +671,7 @@ export default { | @@ -724,41 +671,7 @@ export default { | ||
724 | return value1 - value2; | 671 | return value1 - value2; |
725 | } | 672 | } |
726 | }, | 673 | }, |
727 | - /* //表格下探 | ||
728 | - pressingDialog(itemMenu,value,flg){ | ||
729 | - this.pressingValue=value; | ||
730 | - let styleStr='width: 300px;height: 200px;min-height: 200px;overflow: hidden;' | ||
731 | - if(itemMenu.type=='alarm_setting'){ | ||
732 | - this.widthStyle='width:70%;'; | ||
733 | - | ||
734 | - }else if(itemMenu.type=='filter_sheet_indicator'){ | ||
735 | - this.widthStyle=styleStr; | ||
736 | - | ||
737 | - }else if(itemMenu.type=='filter_multiple_indicators'){ | ||
738 | - this.widthStyle=styleStr; | ||
739 | - | ||
740 | - }else if(itemMenu.type=='performance_trends'){ | ||
741 | - this.widthStyle=''; | ||
742 | - | ||
743 | - }else if(itemMenu.type=='pressing_times'){ | ||
744 | - this.widthStyle=styleStr; | ||
745 | 674 | ||
746 | - }else if(itemMenu.type=='include_capacity_forecast'){ | ||
747 | - this.widthStyle=styleStr; | ||
748 | - | ||
749 | - } | ||
750 | - | ||
751 | - this.setDialog(itemMenu.type,flg); | ||
752 | - | ||
753 | - let key=this.$refs.popoverMenu; | ||
754 | - if(key && key.length>0){ | ||
755 | - key.map(item=>{ | ||
756 | - item.showPopper=false | ||
757 | - }) | ||
758 | - } | ||
759 | - // this.$refs.popoverMenu.showPopper = false; | ||
760 | - | ||
761 | - },*/ | ||
762 | pressingTimes(index,idx){ | 675 | pressingTimes(index,idx){ |
763 | this.pressingVisible=index+'-'+idx; | 676 | this.pressingVisible=index+'-'+idx; |
764 | }, | 677 | }, |
@@ -836,7 +749,7 @@ export default { | @@ -836,7 +749,7 @@ export default { | ||
836 | dialogName = tableStyleSetup.tableName + kpiName; | 749 | dialogName = tableStyleSetup.tableName + kpiName; |
837 | 750 | ||
838 | } else { | 751 | } else { |
839 | - let nameResType = tableStyleSetup.nameResType ? obj.resType ? obj.resType + '|' : '' : ''; | 752 | + let nameResType = tableStyleSetup.nameResType ? this.resType ? this.resType + '|' : '' : ''; |
840 | let nameIPAddress = tableStyleSetup.nameIPAddress ? obj.ipAddr ? obj.ipAddr + '|' : '' : ''; | 753 | let nameIPAddress = tableStyleSetup.nameIPAddress ? obj.ipAddr ? obj.ipAddr + '|' : '' : ''; |
841 | let nameResName = tableStyleSetup.nameResName ? obj.resName ? obj.resName + '|' : '' : ''; | 754 | let nameResName = tableStyleSetup.nameResName ? obj.resName ? obj.resName + '|' : '' : ''; |
842 | let nameKpiName = tableStyleSetup.nameKpiName ? obj.kpiName ? obj.kpiName + '|' : '' : ''; | 755 | let nameKpiName = tableStyleSetup.nameKpiName ? obj.kpiName ? obj.kpiName + '|' : '' : ''; |
@@ -858,8 +771,19 @@ export default { | @@ -858,8 +771,19 @@ export default { | ||
858 | kpiIdArr.push(item.key) | 771 | kpiIdArr.push(item.key) |
859 | } | 772 | } |
860 | }) | 773 | }) |
861 | - console.log("kpiIdArr",kpiIdArr) | 774 | + }, |
775 | + //获取资源类型 | ||
776 | + async getResTypeData(){ | ||
777 | + let params= { | ||
778 | + resId: this.getUrlToken.resId, | ||
779 | + } | ||
780 | + const { success,obj } = await getResType(params,this.getUrlToken); | ||
781 | + if (success && obj && obj.bean && obj.bean.resType){ | ||
782 | + this.resType=obj.bean.resType; | ||
862 | } | 783 | } |
784 | + | ||
785 | + }, | ||
786 | + | ||
863 | } | 787 | } |
864 | }; | 788 | }; |
865 | </script> | 789 | </script> |
-
Please register or login to post a comment