Authored by 王涛

Merge branch 'master-v32-lushangqing' into 'master'

故障诊断接口联调1214



See merge request !221
@@ -423,6 +423,9 @@ @@ -423,6 +423,9 @@
423 width:30px; 423 width:30px;
424 height:30px; 424 height:30px;
425 } 425 }
  426 +.cursorClass{
  427 + cursor: pointer;
  428 +}
426 .position-absolute{ 429 .position-absolute{
427 430
428 } 431 }
@@ -87,9 +87,13 @@ export default { @@ -87,9 +87,13 @@ export default {
87 } 87 }
88 //添加应用 88 //添加应用
89 let addRes=(row,index)=>{ 89 let addRes=(row,index)=>{
90 - row.targetId=proxy.targetId; 90 + // row.targetId=proxy.targetId;
  91 + let params={
  92 + targetId:proxy.targetId,
  93 + npmList:[row]
  94 + }
91 95
92 - proxy.$http.post('/api-web/fault/conf/npm/batchAddNpm',[row],function (res){ 96 + proxy.$http.post('/api-web/fault/conf/npm/batchAddNpm',params,function (res){
93 if(res){ 97 if(res){
94 proxy.$global.showMsg('添加成功','success'); 98 proxy.$global.showMsg('添加成功','success');
95 proxy.targetId=res.str 99 proxy.targetId=res.str
@@ -401,7 +401,7 @@ @@ -401,7 +401,7 @@
401 401
402 <!--取消和保存--> 402 <!--取消和保存-->
403 <div class="btn-faultDiagnosis flex-center"> 403 <div class="btn-faultDiagnosis flex-center">
404 - <el-button>取消</el-button> 404 + <el-button @click="goBackIndex">取消</el-button>
405 <el-button @click="saveConfigDetail" type="primary">保存</el-button> 405 <el-button @click="saveConfigDetail" type="primary">保存</el-button>
406 406
407 </div> 407 </div>
@@ -186,7 +186,18 @@ export default { @@ -186,7 +186,18 @@ export default {
186 alarmLevel:[] 186 alarmLevel:[]
187 }) 187 })
188 } 188 }
  189 + //模块数据
  190 + let modelData=[
  191 + {type:'gz',targetId:''},
  192 + {type:'netlink',targetId:''},
  193 + {type:'npm',targetId:''},
  194 + {type:'base',targetId:''},
  195 + {type:'apm',targetId:''},
  196 + {type:'log',targetId:''},
  197 + {type:'report',targetId:''},
  198 + ]
189 return{ 199 return{
  200 + modelData,
190 faultDefinitionRadio, 201 faultDefinitionRadio,
191 faultStateRadio, 202 faultStateRadio,
192 faultApplicationRadio, 203 faultApplicationRadio,
@@ -238,6 +249,9 @@ export default { @@ -238,6 +249,9 @@ export default {
238 }, 249 },
239 //打开网络监测卡片 250 //打开网络监测卡片
240 clickNetworkMonitorFunc(index){ 251 clickNetworkMonitorFunc(index){
  252 + if(!this.isSaveModel()){
  253 + return;
  254 + }
241 this.hiddenAll(); 255 this.hiddenAll();
242 this.networkMonitorHide = true; 256 this.networkMonitorHide = true;
243 this.isActiveIndex=index; 257 this.isActiveIndex=index;
@@ -250,6 +264,9 @@ export default { @@ -250,6 +264,9 @@ export default {
250 }, 264 },
251 //打开应用监测卡片 265 //打开应用监测卡片
252 applicationMonitorFunc(index){ 266 applicationMonitorFunc(index){
  267 + if(!this.isSaveModel()){
  268 + return;
  269 + }
253 this.hiddenAll(); 270 this.hiddenAll();
254 this.applicationMonitorHide = true; 271 this.applicationMonitorHide = true;
255 this.isActiveIndex=index; 272 this.isActiveIndex=index;
@@ -261,6 +278,9 @@ export default { @@ -261,6 +278,9 @@ export default {
261 }, 278 },
262 //打开基础环境卡片 279 //打开基础环境卡片
263 basicEnvironmentFunc(index){ 280 basicEnvironmentFunc(index){
  281 + if(!this.isSaveModel()){
  282 + return;
  283 + }
264 this.postPropsData('base',index); 284 this.postPropsData('base',index);
265 /*if(this.busTypeArr){ 285 /*if(this.busTypeArr){
266 this.hiddenAll(); 286 this.hiddenAll();
@@ -275,6 +295,9 @@ export default { @@ -275,6 +295,9 @@ export default {
275 }, 295 },
276 //APM 296 //APM
277 apmMonitorFunc(index){ 297 apmMonitorFunc(index){
  298 + if(!this.isSaveModel()){
  299 + return;
  300 + }
278 this.hiddenAll(); 301 this.hiddenAll();
279 this.apmMonitorHide = true; 302 this.apmMonitorHide = true;
280 this.isActiveIndex=index; 303 this.isActiveIndex=index;
@@ -285,6 +308,9 @@ export default { @@ -285,6 +308,9 @@ export default {
285 }, 308 },
286 //日志检测 309 //日志检测
287 logDetectionFunc(index){ 310 logDetectionFunc(index){
  311 + if(!this.isSaveModel()){
  312 + return;
  313 + }
288 this.$global.showMsg('敬请期待...','warning'); 314 this.$global.showMsg('敬请期待...','warning');
289 return; 315 return;
290 this.hiddenAll(); 316 this.hiddenAll();
@@ -297,6 +323,9 @@ export default { @@ -297,6 +323,9 @@ export default {
297 }, 323 },
298 //报告订阅 324 //报告订阅
299 subscriptionReportFunc(index){ 325 subscriptionReportFunc(index){
  326 + if(!this.isSaveModel()){
  327 + return;
  328 + }
300 this.$global.showMsg('敬请期待...','warning'); 329 this.$global.showMsg('敬请期待...','warning');
301 return; 330 return;
302 this.hiddenAll(); 331 this.hiddenAll();
@@ -390,9 +419,13 @@ export default { @@ -390,9 +419,13 @@ export default {
390 setDetailConfig(typeVal){ 419 setDetailConfig(typeVal){
391 let that=this; 420 let that=this;
392 if(this.configData){ 421 if(this.configData){
  422 + console.log("configData",this.configData,typeVal)
393 this.configData.map((item,index)=>{ 423 this.configData.map((item,index)=>{
394 if(item.type==typeVal){ 424 if(item.type==typeVal){
395 - that.targetId=item.targetId; 425 + // that.targetId=item.targetId;
  426 + that.setTargetId(item.targetId);
  427 + that.faultConfId=item.faultConfId;
  428 +
396 } 429 }
397 }) 430 })
398 } 431 }
@@ -400,7 +433,8 @@ export default { @@ -400,7 +433,8 @@ export default {
400 this.propsData={ 433 this.propsData={
401 bizId:this.busTypeArr, 434 bizId:this.busTypeArr,
402 docId:this.docId, 435 docId:this.docId,
403 - targetId:this.targetId 436 + targetId:this.targetId,
  437 + faultConfId:this.faultConfId
404 } 438 }
405 }, 439 },
406 440
@@ -425,7 +459,26 @@ export default { @@ -425,7 +459,26 @@ export default {
425 getNetworkMonitorList(itemData){ 459 getNetworkMonitorList(itemData){
426 console.log("itemdata",itemData) 460 console.log("itemdata",itemData)
427 this.networkMonitorVisible=false; 461 this.networkMonitorVisible=false;
428 - this.networkMonitorList=itemData; 462 + this.networkMonitorList=itemData.networkMonitorList;
  463 + this.setTargetId(itemData.targetId);
  464 + // this.targetId=itemData.targetId;
  465 + },
  466 + //给每个模块设置targetId
  467 + setTargetId(val){
  468 + this.modelData.map((item,index)=>{
  469 + if(this.type==item.type){
  470 + item.targetId=val;
  471 + }
  472 + })
  473 + },
  474 + //获取模块对应的targetId
  475 + getTargetId(type){
  476 + let that=this;
  477 + this.modelData.map(item=>{
  478 + if(item.type==type){
  479 + that.targetId=item.targetId;
  480 + }
  481 + })
429 }, 482 },
430 //点击添加应用检测 483 //点击添加应用检测
431 addApplicationMonitor(){ 484 addApplicationMonitor(){
@@ -434,13 +487,15 @@ export default { @@ -434,13 +487,15 @@ export default {
434 //关闭应用监测添加弹框 487 //关闭应用监测添加弹框
435 getApplicationMoniList(itemData){ 488 getApplicationMoniList(itemData){
436 this.applicationMonitorVisible=false; 489 this.applicationMonitorVisible=false;
437 - this.targetId=itemData; 490 + this.setTargetId(itemData);
  491 + // this.targetId=itemData;
438 // this.applicationMonitorList=itemData; 492 // this.applicationMonitorList=itemData;
439 this.getAppList(); 493 this.getAppList();
440 }, 494 },
441 //获取应用列表数据 495 //获取应用列表数据
442 getAppList(){ 496 getAppList(){
443 let that=this; 497 let that=this;
  498 + this.getTargetId('npm')
444 let params={ 499 let params={
445 targetId:this.targetId, 500 targetId:this.targetId,
446 bizId:this.busTypeArr 501 bizId:this.busTypeArr
@@ -464,12 +519,14 @@ export default { @@ -464,12 +519,14 @@ export default {
464 getAPMList(itemData){ 519 getAPMList(itemData){
465 this.APMVisible=false; 520 this.APMVisible=false;
466 // this.apmMonitorList=itemData; 521 // this.apmMonitorList=itemData;
467 - this.targetId=itemData; 522 + this.setTargetId(itemData);
  523 + // this.targetId=itemData;
468 this.getApmListInfo(); 524 this.getApmListInfo();
469 }, 525 },
470 //获取apm列表数据 526 //获取apm列表数据
471 getApmListInfo(){ 527 getApmListInfo(){
472 let that=this; 528 let that=this;
  529 + this.getTargetId('apm')
473 let params={ 530 let params={
474 targetId:this.targetId, 531 targetId:this.targetId,
475 bizId:this.busTypeArr 532 bizId:this.busTypeArr
@@ -506,14 +563,16 @@ export default { @@ -506,14 +563,16 @@ export default {
506 deleteEnvironment(obj){ 563 deleteEnvironment(obj){
507 this.deleteItem(obj.id,obj.list) 564 this.deleteItem(obj.id,obj.list)
508 }, 565 },
509 - //根据诊断文档id获取配置详情 566 + //根据诊断文档列表的id获取配置详情
510 getDetailByid(){ 567 getDetailByid(){
511 let that=this; 568 let that=this;
512 if(this.docId){ 569 if(this.docId){
513 let params={} 570 let params={}
514 - this.$http.get('/api-web/fault/conf/detail/'+this.docId,params,function (res){  
515 - if(res){  
516 - that.configData=res.data; 571 + this.$http.get('/api-web/fault/conf/'+this.docId,params,function (res){
  572 + if(res && res.object){
  573 + that.configData=res.object.confDetailList;
  574 + that.faultConfId=that.configData[0].faultConfId;
  575 + that.name=res.object.name;
517 576
518 } 577 }
519 578
@@ -578,6 +637,7 @@ export default { @@ -578,6 +637,7 @@ export default {
578 let that=this; 637 let that=this;
579 let params={ 638 let params={
580 type:this.type, 639 type:this.type,
  640 + targetId:this.targetId,
581 state:this.state, 641 state:this.state,
582 faultConfig:{ 642 faultConfig:{
583 id:this.faultConfId, 643 id:this.faultConfId,
@@ -588,7 +648,8 @@ export default { @@ -588,7 +648,8 @@ export default {
588 } 648 }
589 this.$http.post('/api-web/fault/conf/detail/saveConfigDetail',params,function (res){ 649 this.$http.post('/api-web/fault/conf/detail/saveConfigDetail',params,function (res){
590 if(res && res.success){ 650 if(res && res.success){
591 - that.targetId=res.str; 651 + that.targetId=res.map.configDetail.targetId;
  652 + that.faultConfId=res.map.configDetail.faultConfId;
592 653
593 that.$global.showMsg('保存成功','success') 654 that.$global.showMsg('保存成功','success')
594 that.switchModel(); 655 that.switchModel();
@@ -609,6 +670,7 @@ export default { @@ -609,6 +670,7 @@ export default {
609 break; 670 break;
610 case "npm": 671 case "npm":
611 //应用检测 672 //应用检测
  673 + this.getAppList();
612 break; 674 break;
613 case "base": 675 case "base":
614 //基础环境 676 //基础环境
@@ -616,6 +678,7 @@ export default { @@ -616,6 +678,7 @@ export default {
616 break; 678 break;
617 case "apm": 679 case "apm":
618 //APM 680 //APM
  681 + this.getApmListInfo();
619 break; 682 break;
620 case "log": 683 case "log":
621 //日志检测 684 //日志检测
@@ -630,6 +693,7 @@ export default { @@ -630,6 +693,7 @@ export default {
630 //获取网络监测链路信息列表 693 //获取网络监测链路信息列表
631 getNetLinkList(){ 694 getNetLinkList(){
632 let that=this; 695 let that=this;
  696 + this.getTargetId('netlink')
633 let params={ 697 let params={
634 targetId:this.targetId 698 targetId:this.targetId
635 699
@@ -649,6 +713,7 @@ export default { @@ -649,6 +713,7 @@ export default {
649 this.$http.get('/api-web/fault/base/config/queryKpiInfo',{},function (res){ 713 this.$http.get('/api-web/fault/base/config/queryKpiInfo',{},function (res){
650 if(res && res.data){ 714 if(res && res.data){
651 that.alarmList=res.data; 715 that.alarmList=res.data;
  716 + that.kpiId=that.alarmList[0].kpiId;
652 } 717 }
653 718
654 }) 719 })
@@ -673,6 +738,8 @@ export default { @@ -673,6 +738,8 @@ export default {
673 } 738 }
674 this.$http.post('/api-web/fault/conf/rule/saveOrUpdate',params,function (res){ 739 this.$http.post('/api-web/fault/conf/rule/saveOrUpdate',params,function (res){
675 if(res && res.success){ 740 if(res && res.success){
  741 + that.targetId=res.map.bFaultRule.targetId;
  742 + that.faultConfId=res.map.bFaultRule.faultConfId;
676 that.$global.showMsg('保存成功') 743 that.$global.showMsg('保存成功')
677 // that.alarmList=res.data; 744 // that.alarmList=res.data;
678 }else{ 745 }else{
@@ -708,6 +775,19 @@ export default { @@ -708,6 +775,19 @@ export default {
708 if(this.type=='npm'){ 775 if(this.type=='npm'){
709 this.getAppList(); 776 this.getAppList();
710 } 777 }
  778 + },
  779 + //返回首页
  780 + goBackIndex(){
  781 + this.$emit('backIndex','back')
  782 + },
  783 + //判断是否保存了模块
  784 + isSaveModel(){
  785 + if(!this.faultConfId){
  786 + this.$global.showMsg('请先保存模块','warning');
  787 + return false;
  788 + }else{
  789 + return true;
  790 + }
711 } 791 }
712 792
713 793
@@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
38 <div class="context-body"> 38 <div class="context-body">
39 39
40 <el-row v-if="!addSetLIstVisible"> 40 <el-row v-if="!addSetLIstVisible">
41 - <el-col :span="4" v-for="(itemNode,index) in nodeData"> 41 + <el-col :span="3" v-for="(itemNode,index) in nodeData">
42 <div class="list-step flex-div-start"> 42 <div class="list-step flex-div-start">
43 <div class="list-step-top flex-div"> 43 <div class="list-step-top flex-div">
44 <el-tooltip 44 <el-tooltip
@@ -57,9 +57,9 @@ @@ -57,9 +57,9 @@
57 <li>添加节点</li> 57 <li>添加节点</li>
58 </ul> 58 </ul>
59 </template> 59 </template>
60 - <div @click="addTableList(true)" :class="['step-img',{'isActive':itemNode[0].nodeName}]"> 60 + <div @click="addTableList(true)" :class="['step-img','flex-div-center',{'isActive':itemNode[0].nodeName}]">
61 <i v-if="itemNode[0].nodeName" class="icon-delete-right" @click.stop="deleteNode(item,index)"></i> 61 <i v-if="itemNode[0].nodeName" class="icon-delete-right" @click.stop="deleteNode(item,index)"></i>
62 - <i class="icon-step"><img :src="'/src/style/img/restypeimg/'+itemNode[0].path" alt=""></i> 62 + <i class="icon-step flex-div-center"><img :src="'/src/style/img/restypeimg/'+itemNode[0].resType+'.png'" alt=""></i>
63 </div> 63 </div>
64 </el-tooltip> 64 </el-tooltip>
65 <!-- <span :class="['list-line',{'isActive':item.nodeName && index<nodeData.length}]"></span>--> 65 <!-- <span :class="['list-line',{'isActive':item.nodeName && index<nodeData.length}]"></span>-->
@@ -201,11 +201,13 @@ export default { @@ -201,11 +201,13 @@ export default {
201 let addRes=(row,index)=>{ 201 let addRes=(row,index)=>{
202 console.log("row",row,proxy.nodeData) 202 console.log("row",row,proxy.nodeData)
203 let bNetNodeList=row; 203 let bNetNodeList=row;
204 - proxy.iconArr.map((v,i)=>{  
205 - if(row.resType==v.resType){  
206 - row.path=v.path;  
207 - }  
208 - }) 204 + bNetNodeList.isAdd=false;
  205 + // proxy.iconArr.map((v,i)=>{
  206 + // if(row.resType==v.resType){
  207 + // row.path=v.path;
  208 + // }
  209 + // })
  210 + //flag表示线或点 true点 false线
209 211
210 if(proxy.flag){ 212 if(proxy.flag){
211 if(!proxy.nodeName){ 213 if(!proxy.nodeName){
@@ -215,16 +217,16 @@ export default { @@ -215,16 +217,16 @@ export default {
215 bNetNodeList.nodeName=proxy.nodeName; 217 bNetNodeList.nodeName=proxy.nodeName;
216 bNetNodeList.type='dot'; 218 bNetNodeList.type='dot';
217 219
218 - proxy.backLink(bNetNodeList); 220 + proxy.backLink(bNetNodeList,index);
219 } 221 }
220 }else{ 222 }else{
221 bNetNodeList.type='line'; 223 bNetNodeList.type='line';
222 - proxy.backLink(bNetNodeList); 224 + proxy.backLink(bNetNodeList,index);
223 } 225 }
224 226
225 227
226 } 228 }
227 - let backLink=(row)=>{ 229 + let backLink=(row,index)=>{
228 proxy.tableVisible=false; 230 proxy.tableVisible=false;
229 231
230 let arr=proxy.nodeData; 232 let arr=proxy.nodeData;
@@ -235,7 +237,14 @@ export default { @@ -235,7 +237,14 @@ export default {
235 237
236 if(proxy.flag){ 238 if(proxy.flag){
237 //插入的是点 239 //插入的是点
  240 + console.log("isadd",row.isAdd)
  241 + // if(row.isAdd){
  242 + //isAdd为true代表是添加
238 proxy.nodeData.splice(length-1,0,[row]); 243 proxy.nodeData.splice(length-1,0,[row]);
  244 + // }else{
  245 + //isAdd为false代表是修改
  246 + // proxy.nodeData.splice(index,1,[row]);
  247 + // }
239 }else{ 248 }else{
240 //插入的是线 249 //插入的是线
241 proxy.nodeData[length-2].push(row); 250 proxy.nodeData[length-2].push(row);
@@ -244,7 +253,7 @@ export default { @@ -244,7 +253,7 @@ export default {
244 253
245 }else{ 254 }else{
246 proxy.nodeData.push([row]); 255 proxy.nodeData.push([row]);
247 - proxy.nodeData.push([{nodeName:'',id:''}]) 256 + proxy.nodeData.push([{nodeName:'',id:'',isAdd:true}])
248 257
249 } 258 }
250 console.log(" proxy.nodeData", proxy.nodeData,proxy.nodeData.length) 259 console.log(" proxy.nodeData", proxy.nodeData,proxy.nodeData.length)
@@ -360,13 +369,13 @@ export default { @@ -360,13 +369,13 @@ export default {
360 if(res && res.data){ 369 if(res && res.data){
361 // let resData=res.data.reverse(); 370 // let resData=res.data.reverse();
362 let resData=res.data; 371 let resData=res.data;
363 - resData.map((item,index)=>{  
364 - that.iconArr.map((v,i)=>{  
365 - if(item.resType==v.resType){  
366 - item.path=v.path;  
367 - }  
368 - })  
369 - }) 372 + // resData.map((item,index)=>{
  373 + // that.iconArr.map((v,i)=>{
  374 + // if(item.resType==v.resType){
  375 + // item.path=v.path;
  376 + // }
  377 + // })
  378 + // })
370 let arr=[]; 379 let arr=[];
371 for(let i=0;i<resData.length;i+=2){ 380 for(let i=0;i<resData.length;i+=2){
372 arr.push(resData.slice(i,i+2)) 381 arr.push(resData.slice(i,i+2))
@@ -376,7 +385,7 @@ export default { @@ -376,7 +385,7 @@ export default {
376 console.log('nodedata',that.nodeData,that.nodeData.length) 385 console.log('nodedata',that.nodeData,that.nodeData.length)
377 if(that.nodeData.length>0){ 386 if(that.nodeData.length>0){
378 that.addSetLIstVisible=false; 387 that.addSetLIstVisible=false;
379 - that.nodeData.push([{nodeName:'',id:''}]) 388 + that.nodeData.push([{nodeName:'',id:'',isAdd:true}])
380 389
381 }else{ 390 }else{
382 that.addSetLIstVisible=true; 391 that.addSetLIstVisible=true;
@@ -443,7 +452,11 @@ export default { @@ -443,7 +452,11 @@ export default {
443 }, 452 },
444 //关闭弹框 453 //关闭弹框
445 closeDialog(){ 454 closeDialog(){
446 - this.$emit('callback', this.networkMonitorList); 455 + let obj={
  456 + networkMonitorList:this.networkMonitorList,
  457 + targetId:this.targetId
  458 + }
  459 + this.$emit('callback', obj);
447 }, 460 },
448 461
449 462
@@ -464,7 +477,7 @@ export default { @@ -464,7 +477,7 @@ export default {
464 477
465 }, 478 },
466 mounted () { 479 mounted () {
467 - this.getAllIcon(); 480 + // this.getAllIcon();
468 this.setBizId(); 481 this.setBizId();
469 this.getNetLinkList(); 482 this.getNetLinkList();
470 // this.getNodeData(); 483 // this.getNodeData();
1 -<component :is="componentItem" :diagnosisData="diagnosisData" @getItem="getItem" @getItemDetail="getItemDetail" :detailData="detailData" /> 1 +<component :is="componentItem" :diagnosisData="diagnosisData" @backIndex="backIndexFun" @getItem="getItem" @getItemDetail="getItemDetail" :detailData="detailData" />
2 <!--<FaultAddIndex></FaultAddIndex>--> 2 <!--<FaultAddIndex></FaultAddIndex>-->
@@ -73,6 +73,12 @@ export default { @@ -73,6 +73,12 @@ export default {
73 proxy.componentItem=obj.componentName; 73 proxy.componentItem=obj.componentName;
74 proxy.detailData=obj.item; 74 proxy.detailData=obj.item;
75 } 75 }
  76 + //返回首页回调函数
  77 + let backIndexFun=(val)=>{
  78 + console.log('gogogo',val)
  79 + // proxy.componentItem=val;
  80 + proxy.getListData();
  81 + }
76 82
77 83
78 return { 84 return {
@@ -83,7 +89,8 @@ export default { @@ -83,7 +89,8 @@ export default {
83 diagnosisData, 89 diagnosisData,
84 getItem, 90 getItem,
85 getItemDetail, 91 getItemDetail,
86 - detailData 92 + detailData,
  93 + backIndexFun
87 94
88 } 95 }
89 } 96 }