Authored by 鲁尚清

故障诊断接口联调1214

... ... @@ -423,6 +423,9 @@
width:30px;
height:30px;
}
.cursorClass{
cursor: pointer;
}
.position-absolute{
}
... ...
... ... @@ -87,9 +87,13 @@ export default {
}
//添加应用
let addRes=(row,index)=>{
row.targetId=proxy.targetId;
// row.targetId=proxy.targetId;
let params={
targetId:proxy.targetId,
npmList:[row]
}
proxy.$http.post('/api-web/fault/conf/npm/batchAddNpm',[row],function (res){
proxy.$http.post('/api-web/fault/conf/npm/batchAddNpm',params,function (res){
if(res){
proxy.$global.showMsg('添加成功','success');
proxy.targetId=res.str
... ...
... ... @@ -401,7 +401,7 @@
<!--取消和保存-->
<div class="btn-faultDiagnosis flex-center">
<el-button>取消</el-button>
<el-button @click="goBackIndex">取消</el-button>
<el-button @click="saveConfigDetail" type="primary">保存</el-button>
</div>
... ...
... ... @@ -186,7 +186,18 @@ export default {
alarmLevel:[]
})
}
//模块数据
let modelData=[
{type:'gz',targetId:''},
{type:'netlink',targetId:''},
{type:'npm',targetId:''},
{type:'base',targetId:''},
{type:'apm',targetId:''},
{type:'log',targetId:''},
{type:'report',targetId:''},
]
return{
modelData,
faultDefinitionRadio,
faultStateRadio,
faultApplicationRadio,
... ... @@ -238,6 +249,9 @@ export default {
},
//打开网络监测卡片
clickNetworkMonitorFunc(index){
if(!this.isSaveModel()){
return;
}
this.hiddenAll();
this.networkMonitorHide = true;
this.isActiveIndex=index;
... ... @@ -250,6 +264,9 @@ export default {
},
//打开应用监测卡片
applicationMonitorFunc(index){
if(!this.isSaveModel()){
return;
}
this.hiddenAll();
this.applicationMonitorHide = true;
this.isActiveIndex=index;
... ... @@ -261,6 +278,9 @@ export default {
},
//打开基础环境卡片
basicEnvironmentFunc(index){
if(!this.isSaveModel()){
return;
}
this.postPropsData('base',index);
/*if(this.busTypeArr){
this.hiddenAll();
... ... @@ -275,6 +295,9 @@ export default {
},
//APM
apmMonitorFunc(index){
if(!this.isSaveModel()){
return;
}
this.hiddenAll();
this.apmMonitorHide = true;
this.isActiveIndex=index;
... ... @@ -285,6 +308,9 @@ export default {
},
//日志检测
logDetectionFunc(index){
if(!this.isSaveModel()){
return;
}
this.$global.showMsg('敬请期待...','warning');
return;
this.hiddenAll();
... ... @@ -297,6 +323,9 @@ export default {
},
//报告订阅
subscriptionReportFunc(index){
if(!this.isSaveModel()){
return;
}
this.$global.showMsg('敬请期待...','warning');
return;
this.hiddenAll();
... ... @@ -390,9 +419,13 @@ export default {
setDetailConfig(typeVal){
let that=this;
if(this.configData){
console.log("configData",this.configData,typeVal)
this.configData.map((item,index)=>{
if(item.type==typeVal){
that.targetId=item.targetId;
// that.targetId=item.targetId;
that.setTargetId(item.targetId);
that.faultConfId=item.faultConfId;
}
})
}
... ... @@ -400,7 +433,8 @@ export default {
this.propsData={
bizId:this.busTypeArr,
docId:this.docId,
targetId:this.targetId
targetId:this.targetId,
faultConfId:this.faultConfId
}
},
... ... @@ -425,7 +459,26 @@ export default {
getNetworkMonitorList(itemData){
console.log("itemdata",itemData)
this.networkMonitorVisible=false;
this.networkMonitorList=itemData;
this.networkMonitorList=itemData.networkMonitorList;
this.setTargetId(itemData.targetId);
// this.targetId=itemData.targetId;
},
//给每个模块设置targetId
setTargetId(val){
this.modelData.map((item,index)=>{
if(this.type==item.type){
item.targetId=val;
}
})
},
//获取模块对应的targetId
getTargetId(type){
let that=this;
this.modelData.map(item=>{
if(item.type==type){
that.targetId=item.targetId;
}
})
},
//点击添加应用检测
addApplicationMonitor(){
... ... @@ -434,13 +487,15 @@ export default {
//关闭应用监测添加弹框
getApplicationMoniList(itemData){
this.applicationMonitorVisible=false;
this.targetId=itemData;
this.setTargetId(itemData);
// this.targetId=itemData;
// this.applicationMonitorList=itemData;
this.getAppList();
},
//获取应用列表数据
getAppList(){
let that=this;
this.getTargetId('npm')
let params={
targetId:this.targetId,
bizId:this.busTypeArr
... ... @@ -464,12 +519,14 @@ export default {
getAPMList(itemData){
this.APMVisible=false;
// this.apmMonitorList=itemData;
this.targetId=itemData;
this.setTargetId(itemData);
// this.targetId=itemData;
this.getApmListInfo();
},
//获取apm列表数据
getApmListInfo(){
let that=this;
this.getTargetId('apm')
let params={
targetId:this.targetId,
bizId:this.busTypeArr
... ... @@ -506,14 +563,16 @@ export default {
deleteEnvironment(obj){
this.deleteItem(obj.id,obj.list)
},
//根据诊断文档id获取配置详情
//根据诊断文档列表的id获取配置详情
getDetailByid(){
let that=this;
if(this.docId){
let params={}
this.$http.get('/api-web/fault/conf/detail/'+this.docId,params,function (res){
if(res){
that.configData=res.data;
this.$http.get('/api-web/fault/conf/'+this.docId,params,function (res){
if(res && res.object){
that.configData=res.object.confDetailList;
that.faultConfId=that.configData[0].faultConfId;
that.name=res.object.name;
}
... ... @@ -578,6 +637,7 @@ export default {
let that=this;
let params={
type:this.type,
targetId:this.targetId,
state:this.state,
faultConfig:{
id:this.faultConfId,
... ... @@ -588,7 +648,8 @@ export default {
}
this.$http.post('/api-web/fault/conf/detail/saveConfigDetail',params,function (res){
if(res && res.success){
that.targetId=res.str;
that.targetId=res.map.configDetail.targetId;
that.faultConfId=res.map.configDetail.faultConfId;
that.$global.showMsg('保存成功','success')
that.switchModel();
... ... @@ -609,6 +670,7 @@ export default {
break;
case "npm":
//应用检测
this.getAppList();
break;
case "base":
//基础环境
... ... @@ -616,6 +678,7 @@ export default {
break;
case "apm":
//APM
this.getApmListInfo();
break;
case "log":
//日志检测
... ... @@ -630,6 +693,7 @@ export default {
//获取网络监测链路信息列表
getNetLinkList(){
let that=this;
this.getTargetId('netlink')
let params={
targetId:this.targetId
... ... @@ -649,6 +713,7 @@ export default {
this.$http.get('/api-web/fault/base/config/queryKpiInfo',{},function (res){
if(res && res.data){
that.alarmList=res.data;
that.kpiId=that.alarmList[0].kpiId;
}
})
... ... @@ -673,6 +738,8 @@ export default {
}
this.$http.post('/api-web/fault/conf/rule/saveOrUpdate',params,function (res){
if(res && res.success){
that.targetId=res.map.bFaultRule.targetId;
that.faultConfId=res.map.bFaultRule.faultConfId;
that.$global.showMsg('保存成功')
// that.alarmList=res.data;
}else{
... ... @@ -708,6 +775,19 @@ export default {
if(this.type=='npm'){
this.getAppList();
}
},
//返回首页
goBackIndex(){
this.$emit('backIndex','back')
},
//判断是否保存了模块
isSaveModel(){
if(!this.faultConfId){
this.$global.showMsg('请先保存模块','warning');
return false;
}else{
return true;
}
}
... ...
... ... @@ -38,7 +38,7 @@
<div class="context-body">
<el-row v-if="!addSetLIstVisible">
<el-col :span="4" v-for="(itemNode,index) in nodeData">
<el-col :span="3" v-for="(itemNode,index) in nodeData">
<div class="list-step flex-div-start">
<div class="list-step-top flex-div">
<el-tooltip
... ... @@ -57,9 +57,9 @@
<li>添加节点</li>
</ul>
</template>
<div @click="addTableList(true)" :class="['step-img',{'isActive':itemNode[0].nodeName}]">
<div @click="addTableList(true)" :class="['step-img','flex-div-center',{'isActive':itemNode[0].nodeName}]">
<i v-if="itemNode[0].nodeName" class="icon-delete-right" @click.stop="deleteNode(item,index)"></i>
<i class="icon-step"><img :src="'/src/style/img/restypeimg/'+itemNode[0].path" alt=""></i>
<i class="icon-step flex-div-center"><img :src="'/src/style/img/restypeimg/'+itemNode[0].resType+'.png'" alt=""></i>
</div>
</el-tooltip>
<!-- <span :class="['list-line',{'isActive':item.nodeName && index<nodeData.length}]"></span>-->
... ...
... ... @@ -201,11 +201,13 @@ export default {
let addRes=(row,index)=>{
console.log("row",row,proxy.nodeData)
let bNetNodeList=row;
proxy.iconArr.map((v,i)=>{
if(row.resType==v.resType){
row.path=v.path;
}
})
bNetNodeList.isAdd=false;
// proxy.iconArr.map((v,i)=>{
// if(row.resType==v.resType){
// row.path=v.path;
// }
// })
//flag表示线或点 true点 false线
if(proxy.flag){
if(!proxy.nodeName){
... ... @@ -215,16 +217,16 @@ export default {
bNetNodeList.nodeName=proxy.nodeName;
bNetNodeList.type='dot';
proxy.backLink(bNetNodeList);
proxy.backLink(bNetNodeList,index);
}
}else{
bNetNodeList.type='line';
proxy.backLink(bNetNodeList);
proxy.backLink(bNetNodeList,index);
}
}
let backLink=(row)=>{
let backLink=(row,index)=>{
proxy.tableVisible=false;
let arr=proxy.nodeData;
... ... @@ -235,7 +237,14 @@ export default {
if(proxy.flag){
//插入的是点
console.log("isadd",row.isAdd)
// if(row.isAdd){
//isAdd为true代表是添加
proxy.nodeData.splice(length-1,0,[row]);
// }else{
//isAdd为false代表是修改
// proxy.nodeData.splice(index,1,[row]);
// }
}else{
//插入的是线
proxy.nodeData[length-2].push(row);
... ... @@ -244,7 +253,7 @@ export default {
}else{
proxy.nodeData.push([row]);
proxy.nodeData.push([{nodeName:'',id:''}])
proxy.nodeData.push([{nodeName:'',id:'',isAdd:true}])
}
console.log(" proxy.nodeData", proxy.nodeData,proxy.nodeData.length)
... ... @@ -360,13 +369,13 @@ export default {
if(res && res.data){
// let resData=res.data.reverse();
let resData=res.data;
resData.map((item,index)=>{
that.iconArr.map((v,i)=>{
if(item.resType==v.resType){
item.path=v.path;
}
})
})
// resData.map((item,index)=>{
// that.iconArr.map((v,i)=>{
// if(item.resType==v.resType){
// item.path=v.path;
// }
// })
// })
let arr=[];
for(let i=0;i<resData.length;i+=2){
arr.push(resData.slice(i,i+2))
... ... @@ -376,7 +385,7 @@ export default {
console.log('nodedata',that.nodeData,that.nodeData.length)
if(that.nodeData.length>0){
that.addSetLIstVisible=false;
that.nodeData.push([{nodeName:'',id:''}])
that.nodeData.push([{nodeName:'',id:'',isAdd:true}])
}else{
that.addSetLIstVisible=true;
... ... @@ -443,7 +452,11 @@ export default {
},
//关闭弹框
closeDialog(){
this.$emit('callback', this.networkMonitorList);
let obj={
networkMonitorList:this.networkMonitorList,
targetId:this.targetId
}
this.$emit('callback', obj);
},
... ... @@ -464,7 +477,7 @@ export default {
},
mounted () {
this.getAllIcon();
// this.getAllIcon();
this.setBizId();
this.getNetLinkList();
// this.getNodeData();
... ...
<component :is="componentItem" :diagnosisData="diagnosisData" @getItem="getItem" @getItemDetail="getItemDetail" :detailData="detailData" />
<component :is="componentItem" :diagnosisData="diagnosisData" @backIndex="backIndexFun" @getItem="getItem" @getItemDetail="getItemDetail" :detailData="detailData" />
<!--<FaultAddIndex></FaultAddIndex>-->
\ No newline at end of file
... ...
... ... @@ -73,6 +73,12 @@ export default {
proxy.componentItem=obj.componentName;
proxy.detailData=obj.item;
}
//返回首页回调函数
let backIndexFun=(val)=>{
console.log('gogogo',val)
// proxy.componentItem=val;
proxy.getListData();
}
return {
... ... @@ -83,7 +89,8 @@ export default {
diagnosisData,
getItem,
getItemDetail,
detailData
detailData,
backIndexFun
}
}
... ...