Merge branch 'master-500-dev' of http://113.200.75.45:82/monitor_v3/hg-monitor-w…
…eb into master-500-dev-xwx
Showing
13 changed files
with
951 additions
and
63 deletions
@@ -3204,6 +3204,7 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele | @@ -3204,6 +3204,7 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele | ||
3204 | } | 3204 | } |
3205 | title += `<a class="layui-icon filterList" data-id=${resId} lay-tips="指标过滤清单" style="margin-left: 10px"><i class="iconfont"></i></a>`; | 3205 | title += `<a class="layui-icon filterList" data-id=${resId} lay-tips="指标过滤清单" style="margin-left: 10px"><i class="iconfont"></i></a>`; |
3206 | title += `<a class="layui-icon res-view-relation-topo" data-id=${resId} lay-tips="查看资源关系拓扑" style="margin-left: 10px"><i class="iconfont"></i></a>`; | 3206 | title += `<a class="layui-icon res-view-relation-topo" data-id=${resId} lay-tips="查看资源关系拓扑" style="margin-left: 10px"><i class="iconfont"></i></a>`; |
3207 | + title += `<a class="layui-icon res-view-ping" data-id=${resId} data-resName=${name} data-ip=${ip} data-resTypeName=${res.resTypeName} data-adminName=${res.adminName} lay-tips="查看资源ping详情" style="margin-left: 10px"> <img width="20" src="/src/style/img/ping.png" ></a>`; | ||
3207 | if (resCategory === 'share' && hardwareFlag.endsWith("Y")) { | 3208 | if (resCategory === 'share' && hardwareFlag.endsWith("Y")) { |
3208 | /* | 3209 | /* |
3209 | title += `<a class="layui-icon res-view-assets-details" data-ip=${ip} data-name=${name} data-restype=${resType} data-id=${resId} lay-tips="资产配置信息"><i class="iconfont"></i></a>`; | 3210 | title += `<a class="layui-icon res-view-assets-details" data-ip=${ip} data-name=${name} data-restype=${resType} data-id=${resId} lay-tips="资产配置信息"><i class="iconfont"></i></a>`; |
@@ -3494,6 +3495,28 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele | @@ -3494,6 +3495,28 @@ layui.define(['laytpl', 'admin', 'form', 'table', 'echarts', 'sessions', 'xmSele | ||
3494 | } | 3495 | } |
3495 | common.viewResTopo($(this).data('id')); | 3496 | common.viewResTopo($(this).data('id')); |
3496 | }); | 3497 | }); |
3498 | + //start 查看ping详情列表页 lsq 2022-04-24 | ||
3499 | + $('a.res-view-ping').unbind('click').on('click', function () { | ||
3500 | + // if ($.inArray('back:details:viewtopo', checkList) === -1) { | ||
3501 | + // layer.msg('暂无权限!', {icon: 0}); | ||
3502 | + // return; | ||
3503 | + // } | ||
3504 | + let paramStr='?resId='+$(this).data('id')+'&resName='+$(this).data('resName')+'&resTypeName='+$(this).data('resTypeName')+'&adminName='+$(this).data('adminName')+'&ip='+$(this).data('ip') | ||
3505 | + | ||
3506 | + layer.open({ | ||
3507 | + title: ['ping详情', 'font-size:18px;'], | ||
3508 | + type: 2, | ||
3509 | + area: ['80%', '90%'], | ||
3510 | + shadeClose: true,//开启遮罩层 | ||
3511 | + id: 'res-ping', | ||
3512 | + // content: laytpl(res.body).render(JSON.stringify(params)), | ||
3513 | + content: ['/vue3/index.html#/ping'+paramStr, 'no'], | ||
3514 | + cancel: function () { | ||
3515 | + clearTimeout(); | ||
3516 | + } | ||
3517 | + }); | ||
3518 | + }); | ||
3519 | + //end lsq 2022-04-24 | ||
3497 | 3520 | ||
3498 | // 查看资产配置信息 | 3521 | // 查看资产配置信息 |
3499 | $('a.res-view-assets-details').unbind('click').on('click', function () { | 3522 | $('a.res-view-assets-details').unbind('click').on('click', function () { |

1.4 KB
@@ -16,3 +16,25 @@ | @@ -16,3 +16,25 @@ | ||
16 | .protocol-btn i{ | 16 | .protocol-btn i{ |
17 | color:#ffffff; | 17 | color:#ffffff; |
18 | } | 18 | } |
19 | +.expand-container{ | ||
20 | + padding:5px 10px; | ||
21 | +} | ||
22 | +.expand-container .margin-top{ | ||
23 | + margin-top:10px; | ||
24 | +} | ||
25 | +.expand-container .el-descriptions__header{ | ||
26 | + padding:5px; | ||
27 | + background: #F1F6F9; | ||
28 | + margin-bottom: 0px; | ||
29 | +} | ||
30 | +.expand-container .el-descriptions__title{ | ||
31 | + font-size:14px; | ||
32 | + font-weight: normal; | ||
33 | +} | ||
34 | +.cmdb-descriptions{ | ||
35 | + width:300px; | ||
36 | +} | ||
37 | +.cmdb-descriptions .star{ | ||
38 | + font-size:14px; | ||
39 | + color:#d81e06; | ||
40 | +} |
@@ -115,6 +115,12 @@ const routes = [{ | @@ -115,6 +115,12 @@ const routes = [{ | ||
115 | name: 'cmdbdatasync', | 115 | name: 'cmdbdatasync', |
116 | component: () => myImport('views/cmdbdatasync/index'), | 116 | component: () => myImport('views/cmdbdatasync/index'), |
117 | }, | 117 | }, |
118 | + //ping详情列表 | ||
119 | + { | ||
120 | + path: '/ping', | ||
121 | + name: 'pingIndex', | ||
122 | + component: () => myImport('views/ping/index'), | ||
123 | + }, | ||
118 | ]; | 124 | ]; |
119 | 125 | ||
120 | // hash模式: createWebHashHistory | 126 | // hash模式: createWebHashHistory |
@@ -15,7 +15,41 @@ | @@ -15,7 +15,41 @@ | ||
15 | :expands="tableData.expands" | 15 | :expands="tableData.expands" |
16 | :height="height - 110"> | 16 | :height="height - 110"> |
17 | <template #expand="{scope}"> | 17 | <template #expand="{scope}"> |
18 | - aaa{{scope.row.expand}} | 18 | + <div class="expand-container" style="width:50%;"> |
19 | + <el-descriptions | ||
20 | + class="margin-top" | ||
21 | + :title="item.protocolName" | ||
22 | + :column="1" | ||
23 | + :size="''" | ||
24 | + border | ||
25 | + v-for="item in scope.row.extend" | ||
26 | + :key="item.protocolId" | ||
27 | + > | ||
28 | + <template #extra> | ||
29 | +<!-- <el-button type="primary">Operation</el-button>--> | ||
30 | + </template> | ||
31 | + <el-descriptions-item label-class-name="cmdb-descriptions" v-for="itemChild in item.protocolParamList" :key="itemChild.collParamId"> | ||
32 | + <template #label> | ||
33 | + <div class="cell-item"> | ||
34 | + {{itemChild.paramName}} | ||
35 | + <!--<span class="star">*</span>--> | ||
36 | + </div> | ||
37 | + </template> | ||
38 | + <el-input style="width: 220px;" v-model="itemChild.defaultValue" size="small"/> | ||
39 | + <!-- <el-input style="width: 220px;" v-if="itemChild.inputWay=='input'" v-model="itemChild.defaultValue" size="small"/> | ||
40 | + <el-select size="small" v-else-if="itemChild.inputWay=='select'" v-model="itemChild.defaultValue" class="m-2" placeholder="请选择"> | ||
41 | + <el-option | ||
42 | + v-for="itemDdic in optinos" | ||
43 | + :key="itemDdic.ddicCode" | ||
44 | + :label="itemDdic.ddicName" | ||
45 | + :value="itemDdic.ddicCode" | ||
46 | + /> | ||
47 | + </el-select> | ||
48 | + <span v-else>{{itemChild.defaultValue}}</span>--> | ||
49 | + </el-descriptions-item> | ||
50 | + | ||
51 | + </el-descriptions> | ||
52 | + </div> | ||
19 | </template> | 53 | </template> |
20 | <template #default="{row,prop,column}"> | 54 | <template #default="{row,prop,column}"> |
21 | <div> | 55 | <div> |
@@ -31,7 +65,7 @@ | @@ -31,7 +65,7 @@ | ||
31 | </template> | 65 | </template> |
32 | <template #tools="{scope}"> | 66 | <template #tools="{scope}"> |
33 | <div class="protocol-btn"> | 67 | <div class="protocol-btn"> |
34 | - <span class="icon-add" @click="addProtocol" title="协议参数"><i class="el-icon-plus"></i></span> | 68 | + <span class="icon-add" @click="addProtocol(scope.row)" title="协议参数"><i class="el-icon-plus"></i></span> |
35 | </div> | 69 | </div> |
36 | </template> | 70 | </template> |
37 | </cm-table-page> | 71 | </cm-table-page> |
@@ -14,20 +14,62 @@ export default { | @@ -14,20 +14,62 @@ export default { | ||
14 | const {proxy} = Vue.getCurrentInstance(); | 14 | const {proxy} = Vue.getCurrentInstance(); |
15 | let height = Vue.ref(window.innerHeight); | 15 | let height = Vue.ref(window.innerHeight); |
16 | let editTbaleData=Vue.ref(props.tableData.dataList); | 16 | let editTbaleData=Vue.ref(props.tableData.dataList); |
17 | + let resType=Vue.ref(props.tableData.resType); | ||
17 | // let columns=Vue.ref(props.tableData.columns); | 18 | // let columns=Vue.ref(props.tableData.columns); |
18 | // let getRowKeys=Vue.ref(props.tableData.getRowKeys); | 19 | // let getRowKeys=Vue.ref(props.tableData.getRowKeys); |
19 | // let expands=Vue.ref(props.tableData.expands); | 20 | // let expands=Vue.ref(props.tableData.expands); |
20 | //保存编辑 | 21 | //保存编辑 |
21 | let saveEdit=()=>{ | 22 | let saveEdit=()=>{ |
22 | //保存接口 todo | 23 | //保存接口 todo |
23 | - let param={ | 24 | + let idList=''; |
25 | + let idArr=[]; | ||
26 | + if(editTbaleData.value && editTbaleData.value.length>0){ | ||
27 | + editTbaleData.value.map(item=>{ | ||
28 | + idArr.push(item.id) | ||
29 | + }) | ||
30 | + } | ||
31 | + if(idArr.length>0){ | ||
32 | + idList=idArr.join(',') | ||
33 | + } | ||
34 | + /*let param={ | ||
35 | + // resType:resType.value, | ||
36 | + // idList:idList, | ||
37 | + bean:editTbaleData.value | ||
38 | + }*/ | ||
39 | + let data=editTbaleData.value; | ||
40 | + let arr=[]; | ||
41 | + data.map(item=>{ | ||
42 | + if(item.proto && item.proto.length>0){ | ||
43 | + item.proto.map(item=>{ | ||
44 | + item.paramValue=item.defaultValue; | ||
45 | + item.protocol=item.protocolId; | ||
46 | + }) | ||
47 | + } | ||
48 | + | ||
49 | + arr.push({ | ||
50 | + bean:item, | ||
51 | + proto:item.proto | ||
52 | + }) | ||
53 | + }) | ||
54 | + let param=arr; | ||
55 | + proxy.$http.post( '/api-web/cmdbSync/toMonitor1',param, function (res) { | ||
56 | + if (res && res.success) { | ||
57 | + proxy.$global.showMsg('保存成功','success'); | ||
58 | + }else{ | ||
59 | + proxy.$global.showMsg('保存失败','error'); | ||
60 | + } | ||
61 | + let backData={ | ||
24 | editTbaleData:editTbaleData.value, | 62 | editTbaleData:editTbaleData.value, |
25 | visibility:false | 63 | visibility:false |
26 | } | 64 | } |
27 | - emit("callbackedit",param) | 65 | + emit("callbackedit",backData) |
66 | + }); | ||
67 | + | ||
28 | } | 68 | } |
29 | //添加协议 | 69 | //添加协议 |
30 | - let addProtocol=()=>{ | 70 | + let clickResId=Vue.ref(''); |
71 | + let addProtocol=(row)=>{ | ||
72 | + clickResId.value=row.resId; | ||
31 | proxy.$global.layer.open({ | 73 | proxy.$global.layer.open({ |
32 | title:'资源协议', | 74 | title:'资源协议', |
33 | id:'resManageChooseProtocolHtml', | 75 | id:'resManageChooseProtocolHtml', |
@@ -39,20 +81,50 @@ export default { | @@ -39,20 +81,50 @@ export default { | ||
39 | proxy.$global.layui.view('resManageChooseProtocolHtml').render('/baseconfig/protocol/index',{'hasParam':'1'}); | 81 | proxy.$global.layui.view('resManageChooseProtocolHtml').render('/baseconfig/protocol/index',{'hasParam':'1'}); |
40 | }, | 82 | }, |
41 | yes:function (index,layero) { | 83 | yes:function (index,layero) { |
42 | - var data = proxy.$global.layui.table.checkStatus('protocol_table').data; | ||
43 | - formData.ip = $('#resManageAddForm').find('input[name="ip"]').val(); | ||
44 | - formData.port = $('#resManageAddForm').find('input[name="port"]').val(); | 84 | + let data = proxy.$global.layui.table.checkStatus('protocol_table').data; |
85 | + | ||
86 | + proxy.$global.layui.use('resManageAdd', function (fn) { | ||
87 | + // console.log("&&&&!!!!",data,fn(row)) | ||
88 | + // console.log(fn(row).createProtocolDom) | ||
89 | + | ||
90 | + }) | ||
91 | + let ip = row.ip; | ||
92 | + let port = row.port; | ||
45 | if(data.length>0){ | 93 | if(data.length>0){ |
46 | - createProtocolDom(data,false); | ||
47 | - form.render() | ||
48 | - layer.close(index); | 94 | + /*createProtocolDom(data,false); |
95 | + proxy.$global.layui.form.render()*/ | ||
96 | + editTbaleData.value.map(item=>{ | ||
97 | + // item.bean=item; | ||
98 | + if(item.resId==row.resId){ | ||
99 | + let arr=[] | ||
100 | + data.map(v=>{ | ||
101 | + arr=arr.concat(v.protocolParamList.flat()); | ||
102 | + }) | ||
103 | + item.extend=data; | ||
104 | + item.proto=arr; | ||
105 | + | ||
106 | + } | ||
107 | + }) | ||
108 | + proxy.$global.layer.close(index); | ||
49 | }else{ | 109 | }else{ |
50 | - layer.msg("无选中的数据或当",{ offset: '15px' , icon: 7 , time: 2000 }) | 110 | + proxy.$global.layer.msg("无选中的数据或当",{ offset: '15px' , icon: 7 , time: 2000 }) |
51 | return false; | 111 | return false; |
52 | } | 112 | } |
53 | } | 113 | } |
54 | }) | 114 | }) |
55 | } | 115 | } |
116 | + //协议参数中select的字典数据 | ||
117 | + let getSelectData=(param)=>{ | ||
118 | + | ||
119 | + proxy.$http.post( '/api-web/manage/ddic/findSucDdics/'+param.defaultValue, {}, function (res) { | ||
120 | + if (res && res.data) { | ||
121 | + let selectData= res.data; | ||
122 | + // protocolParamList | ||
123 | + }else{ | ||
124 | + proxy.$global.showMsg('暂无数据','error'); | ||
125 | + } | ||
126 | + }); | ||
127 | + } | ||
56 | // 挂载完 | 128 | // 挂载完 |
57 | Vue.onMounted(() => { | 129 | Vue.onMounted(() => { |
58 | }) | 130 | }) |
@@ -61,9 +133,12 @@ export default { | @@ -61,9 +133,12 @@ export default { | ||
61 | return { | 133 | return { |
62 | height, | 134 | height, |
63 | editTbaleData, | 135 | editTbaleData, |
136 | + resType, | ||
64 | // columns, | 137 | // columns, |
65 | saveEdit, | 138 | saveEdit, |
66 | addProtocol, | 139 | addProtocol, |
140 | + clickResId, | ||
141 | + getSelectData | ||
67 | // getRowKeys, | 142 | // getRowKeys, |
68 | // expands | 143 | // expands |
69 | } | 144 | } |
1 | <div class="container" :style="{'height':height+'px','max-height':height+'px','display':'flex'}"> | 1 | <div class="container" :style="{'height':height+'px','max-height':height+'px','display':'flex'}"> |
2 | <div class="async-left-tree" style="width:200px;overflow-x: auto;background: #fff;border-right:1px solid #f2f2f2;"> | 2 | <div class="async-left-tree" style="width:200px;overflow-x: auto;background: #fff;border-right:1px solid #f2f2f2;"> |
3 | - <el-tree style="padding-top:10px;" class="tree-div" ref="roleTree" :data="treeData" :props="defaultProps" @node-click="handleNodeClick" | ||
4 | - node-key="id" :default-checked-keys="checkedKeys" | 3 | + <el-tree ref="datasyncTree" style="padding-top:10px;" class="tree-div" ref="roleTree" :data="treeData" :props="defaultProps" @node-click="handleNodeClick" |
4 | + node-key="id" :current-node-key="checkedKeys" :default-expanded-keys="expendKeys" :highlight-current="true" | ||
5 | /> | 5 | /> |
6 | </div> | 6 | </div> |
7 | <div class="cm-card" :style="{'min-height':height+'px','max-height':height+'px','height':'100%','padding-top':'3px','flex':'1'}"> | 7 | <div class="cm-card" :style="{'min-height':height+'px','max-height':height+'px','height':'100%','padding-top':'3px','flex':'1'}"> |
8 | <div class="search"> | 8 | <div class="search"> |
9 | <div class="condition"> | 9 | <div class="condition"> |
10 | <el-form-item > | 10 | <el-form-item > |
11 | - <el-input v-model="search.keyword" placeholder="关键字"></el-input> | 11 | + <el-input style="width:120px;" v-model="search.keyword" placeholder="关键字"></el-input> |
12 | + </el-form-item> | ||
13 | + <el-form-item > | ||
14 | + <el-select style="width:200px;" v-model="search.provider" class="m-2" placeholder="厂商" clearable> | ||
15 | + <el-option | ||
16 | + v-for="item in providerData" | ||
17 | + :key="item.ddicCode" | ||
18 | + :label="item.ddicName" | ||
19 | + :value="item.ddicCode" | ||
20 | + /> | ||
21 | + </el-select> | ||
22 | + </el-form-item> | ||
23 | + <el-form-item > | ||
24 | + <el-select style="width:200px;" v-model="search.system" class="m-2" placeholder="系统" clearable> | ||
25 | + <el-option | ||
26 | + v-for="item in systemData" | ||
27 | + :key="item.ddicCode" | ||
28 | + :label="item.ddicName" | ||
29 | + :value="item.ddicCode" | ||
30 | + /> | ||
31 | + </el-select> | ||
32 | + </el-form-item> | ||
33 | + <el-form-item > | ||
34 | + <el-select style="width:200px;" v-model="search.resSyncState" class="m-2" placeholder="资源处理状态" clearable> | ||
35 | + <el-option | ||
36 | + v-for="item in resSyncStateData" | ||
37 | + :key="item.ddicCode" | ||
38 | + :label="item.ddicName" | ||
39 | + :value="item.ddicCode" | ||
40 | + /> | ||
41 | + </el-select> | ||
12 | </el-form-item> | 42 | </el-form-item> |
13 | <el-form-item > | 43 | <el-form-item > |
14 | <el-button @click="getDataList">查询</el-button> | 44 | <el-button @click="getDataList">查询</el-button> |
15 | </el-form-item> | 45 | </el-form-item> |
16 | <el-form-item > | 46 | <el-form-item > |
17 | - <el-button @click="handleEdit">编辑</el-button> | 47 | + <el-button @click="handleEdit">纳入监控</el-button> |
18 | </el-form-item> | 48 | </el-form-item> |
19 | <el-form-item > | 49 | <el-form-item > |
20 | <el-button @click="handleRefresh">同步</el-button> | 50 | <el-button @click="handleRefresh">同步</el-button> |
21 | </el-form-item> | 51 | </el-form-item> |
52 | + <el-form-item > | ||
53 | + <el-button @click="handleIgnore">忽略</el-button> | ||
54 | + </el-form-item> | ||
22 | </div> | 55 | </div> |
23 | </div> | 56 | </div> |
24 | <div class="search-table"> | 57 | <div class="search-table"> |
25 | - <cm-table-page :columns="tableData.columns" :dataList="tableData.dataList" | 58 | + <cm-table-page v-if="tableData.dataList " :columns="tableData.columns" :dataList="tableData.dataList" |
26 | :showIndex="true" | 59 | :showIndex="true" |
27 | :total="tableData.count" | 60 | :total="tableData.count" |
28 | @loaddata = "loaddata" | 61 | @loaddata = "loaddata" |
@@ -30,7 +63,7 @@ | @@ -30,7 +63,7 @@ | ||
30 | :showSelection="true" | 63 | :showSelection="true" |
31 | :showBorder="true" | 64 | :showBorder="true" |
32 | :loading="false" | 65 | :loading="false" |
33 | - :pageSize="pageSize" | 66 | + :pageSize="search.pageSize" |
34 | :showPage="true" | 67 | :showPage="true" |
35 | :showTools="true" | 68 | :showTools="true" |
36 | :height="height - 110"> | 69 | :height="height - 110"> |
@@ -41,7 +74,6 @@ | @@ -41,7 +74,6 @@ | ||
41 | </template> | 74 | </template> |
42 | <template #tools="{scope}"> | 75 | <template #tools="{scope}"> |
43 | <div class="list-handle"> | 76 | <div class="list-handle"> |
44 | - <span class="icon-bg" @click="handleEdit(1,scope.row)"><i class="el-icon-edit-outline" title="编辑"></i></span> | ||
45 | <span class="icon-bg" @click="handleRefresh(1,scope.row)"><i class="el-icon-refresh" title="同步"></i></span> | 77 | <span class="icon-bg" @click="handleRefresh(1,scope.row)"><i class="el-icon-refresh" title="同步"></i></span> |
46 | </div> | 78 | </div> |
47 | </template> | 79 | </template> |
@@ -53,7 +85,7 @@ | @@ -53,7 +85,7 @@ | ||
53 | <!--弹框--> | 85 | <!--弹框--> |
54 | <cm-dialog :title="dialog.title" width="90%" :showDialogVisible="dialog.show" @hidedialog="hideDialog" :showFooter="false"> | 86 | <cm-dialog :title="dialog.title" width="90%" :showDialogVisible="dialog.show" @hidedialog="hideDialog" :showFooter="false"> |
55 | <template v-slot> | 87 | <template v-slot> |
56 | - <cmdbdatasyncEdit :tableData="dialog.tableData" @callbackedit="callbackedit"/> | 88 | + <cmdbdatasyncEdit v-if="dialog.tableData && dialog.tableData.dataList.length>0" :tableData="dialog.tableData" @callbackedit="callbackedit"/> |
57 | </template> | 89 | </template> |
58 | </cm-dialog> | 90 | </cm-dialog> |
59 | 91 |
@@ -14,40 +14,42 @@ export default { | @@ -14,40 +14,42 @@ export default { | ||
14 | children: 'children', | 14 | children: 'children', |
15 | label: 'title' | 15 | label: 'title' |
16 | }) | 16 | }) |
17 | - let treeData=Vue.ref([]) // 所有的树结点 | 17 | + let treeData=Vue.ref([]) // 所有的树节点 |
18 | + let checkedKeys=Vue.ref('');//默认选中的树节点 | ||
19 | + let expendKeys=Vue.ref([]);//默认展开的树节点 | ||
18 | let defaultNode=Vue.ref(true);//默认节点 | 20 | let defaultNode=Vue.ref(true);//默认节点 |
19 | let resType=Vue.ref('');//选中的树节点值 | 21 | let resType=Vue.ref('');//选中的树节点值 |
22 | + let resTypeName=Vue.ref('');//选中的树节点值名称 | ||
20 | let handleNodeClick=(data,node)=>{ | 23 | let handleNodeClick=(data,node)=>{ |
21 | - //点击树节点,根据某个字段获取列表 todo | ||
22 | - console.log("*(*(*(*",data,node) | ||
23 | - proxy.$global.showMsg(data.id,'warning') | 24 | + //点击树节点,根据某个字段获取列表 |
24 | resType.value=data.value; | 25 | resType.value=data.value; |
26 | + resTypeName.value=data.title; | ||
25 | defaultNode.value=false; | 27 | defaultNode.value=false; |
26 | getDataList(); | 28 | getDataList(); |
27 | } | 29 | } |
28 | - | 30 | + let providerData=Vue.ref([]);//厂商 |
31 | + let systemData=Vue.ref([]);//系统 | ||
32 | + let resSyncStateData=Vue.ref([]);//资源处理状态 | ||
33 | + let currentPage=Vue.ref(1);//当前页 | ||
29 | let search = Vue.ref({ | 34 | let search = Vue.ref({ |
30 | keyword: '', | 35 | keyword: '', |
31 | pageNum: 1, | 36 | pageNum: 1, |
32 | pageSize: 20, | 37 | pageSize: 20, |
38 | + resSyncState:'', | ||
39 | + system: '', | ||
40 | + provider:'', | ||
33 | }); | 41 | }); |
34 | //表格字段 | 42 | //表格字段 |
35 | let tableData = Vue.ref({ | 43 | let tableData = Vue.ref({ |
36 | count:0, | 44 | count:0, |
37 | - dataList: [{ | ||
38 | - id:1, | ||
39 | - resName:'资源一' | ||
40 | - },{ | ||
41 | - id:2, | ||
42 | - resName:'资源34' | ||
43 | - }], | 45 | + dataList: [], |
44 | columns: [ | 46 | columns: [ |
45 | { | 47 | { |
46 | prop: 'resName', | 48 | prop: 'resName', |
47 | label: '资源名称', | 49 | label: '资源名称', |
48 | sortable: true, | 50 | sortable: true, |
49 | align: 'center', | 51 | align: 'center', |
50 | - width: '250' | 52 | + width: '200' |
51 | }, | 53 | }, |
52 | { | 54 | { |
53 | prop: 'resTypeName', | 55 | prop: 'resTypeName', |
@@ -56,31 +58,98 @@ export default { | @@ -56,31 +58,98 @@ export default { | ||
56 | align: 'center', | 58 | align: 'center', |
57 | width: '200' | 59 | width: '200' |
58 | }, { | 60 | }, { |
59 | - prop: 'host', | ||
60 | - label: 'IP地址', | 61 | + prop: 'resCategory', |
62 | + label: '资源分类', | ||
61 | sortable: true, | 63 | sortable: true, |
62 | align: 'center', | 64 | align: 'center', |
63 | - width: '200' | ||
64 | - }, { | ||
65 | - prop: 'type', | ||
66 | - label: '日志来源', | 65 | + width: '100' |
66 | + }, | ||
67 | + { | ||
68 | + prop: 'ip', | ||
69 | + label: 'ip', | ||
67 | sortable: true, | 70 | sortable: true, |
68 | align: 'center', | 71 | align: 'center', |
69 | width: '200' | 72 | width: '200' |
70 | }, | 73 | }, |
71 | { | 74 | { |
72 | - prop: 'program', | ||
73 | - label: '日志类型', | 75 | + prop: 'port', |
76 | + label: '端口', | ||
77 | + sortable: true, | ||
78 | + align: 'center', | ||
79 | + }, | ||
80 | + { | ||
81 | + prop: 'os', | ||
82 | + label: '操作系统类型', | ||
83 | + sortable: true, | ||
84 | + align: 'center', | ||
85 | + width: '130' | ||
86 | + }, | ||
87 | + { | ||
88 | + prop: 'provider', | ||
89 | + label: '厂商', | ||
90 | + sortable: true, | ||
91 | + align: 'center', | ||
92 | + width: '100' | ||
93 | + }, | ||
94 | + { | ||
95 | + prop: 'state', | ||
96 | + label: '资源处理状态', | ||
97 | + sortable: true, | ||
98 | + align: 'center', | ||
99 | + width: '130', | ||
100 | + render:function (row){ | ||
101 | + let str='已同步'; | ||
102 | + if(row.state=='1'){ | ||
103 | + str='纳入监控'; | ||
104 | + }else if(row.state=='2'){ | ||
105 | + str='忽略'; | ||
106 | + }else{ | ||
107 | + str='已同步'; | ||
108 | + } | ||
109 | + return `<span>${str}</span>` | ||
110 | + } | ||
111 | + }, | ||
112 | + { | ||
113 | + prop: 'synctype', | ||
114 | + label: 'cmdb数据同步类型', | ||
115 | + sortable: true, | ||
116 | + align: 'center', | ||
117 | + width: '200', | ||
118 | + render:function (row){ | ||
119 | + let str='自动同步'; | ||
120 | + if(row.synctype=='1'){ | ||
121 | + str='手动同步'; | ||
122 | + }else if(row.synctype=='2'){ | ||
123 | + str='自动覆盖同步'; | ||
124 | + }else if(row.synctype=='3'){ | ||
125 | + str='手动覆盖同步'; | ||
126 | + }else{ | ||
127 | + str='自动同步'; | ||
128 | + } | ||
129 | + return `<span>${str}</span>` | ||
130 | + } | ||
131 | + }, | ||
132 | + { | ||
133 | + prop: 'resSyncDate', | ||
134 | + label: '资源处理时间', | ||
74 | sortable: true, | 135 | sortable: true, |
75 | align: 'center', | 136 | align: 'center', |
76 | width: '200' | 137 | width: '200' |
77 | }, | 138 | }, |
78 | { | 139 | { |
79 | - prop: 'message', | ||
80 | - label: '日志内容', | 140 | + prop: 'syncDate', |
141 | + label: 'CMDB数据同步时间', | ||
81 | sortable: true, | 142 | sortable: true, |
82 | align: 'center', | 143 | align: 'center', |
144 | + width: '200' | ||
83 | }, | 145 | }, |
146 | + { | ||
147 | + prop: 'remark', | ||
148 | + label: '备注', | ||
149 | + sortable: true, | ||
150 | + align: 'center', | ||
151 | + width: '200' | ||
152 | + } | ||
84 | ] | 153 | ] |
85 | }) | 154 | }) |
86 | let dialog = Vue.ref({ | 155 | let dialog = Vue.ref({ |
@@ -91,9 +160,20 @@ export default { | @@ -91,9 +160,20 @@ export default { | ||
91 | let loaddata = ({page, limit}) => { | 160 | let loaddata = ({page, limit}) => { |
92 | search.value.pageNum = page; | 161 | search.value.pageNum = page; |
93 | search.value.pageSize = limit; | 162 | search.value.pageSize = limit; |
163 | + getDataList(); | ||
94 | } | 164 | } |
95 | - let hideDialog = (flg) => { | 165 | + let hideDialog = (flg,isSave) => { |
96 | dialog.value.show = flg; | 166 | dialog.value.show = flg; |
167 | + if(isSave){ | ||
168 | + setData(); | ||
169 | + } | ||
170 | + } | ||
171 | + //设置为空 | ||
172 | + let setData=()=>{ | ||
173 | + dialog.value.tableData.dataList=[]; | ||
174 | + tableData.value.dataList=[]; | ||
175 | + selectionData.value=[]; | ||
176 | + getDataList(); | ||
97 | } | 177 | } |
98 | //全选事件 | 178 | //全选事件 |
99 | let selectionData=Vue.ref([]);//选择的数据 | 179 | let selectionData=Vue.ref([]);//选择的数据 |
@@ -102,17 +182,18 @@ export default { | @@ -102,17 +182,18 @@ export default { | ||
102 | } | 182 | } |
103 | // 处理弹框 | 183 | // 处理弹框 |
104 | let handle = (row) =>{ | 184 | let handle = (row) =>{ |
105 | - hideDialog(true); | ||
106 | dialog.value.tableData.dataList= row; | 185 | dialog.value.tableData.dataList= row; |
107 | dialog.value.tableData.columns=tableData.value.columns; | 186 | dialog.value.tableData.columns=tableData.value.columns; |
108 | dialog.value.tableData.getRowKeys= 'id'; | 187 | dialog.value.tableData.getRowKeys= 'id'; |
188 | + dialog.value.tableData.resType= resType.value; | ||
189 | + dialog.value.tableData.resTypeName=resTypeName.value; | ||
109 | let arr=[]; | 190 | let arr=[]; |
110 | row.map(item=>{ | 191 | row.map(item=>{ |
111 | arr.push(item.id) | 192 | arr.push(item.id) |
112 | }) | 193 | }) |
113 | //默认展开第一行 | 194 | //默认展开第一行 |
114 | dialog.value.tableData.expands= [arr[0]]; | 195 | dialog.value.tableData.expands= [arr[0]]; |
115 | - | 196 | + hideDialog(true); |
116 | } | 197 | } |
117 | //编辑 | 198 | //编辑 |
118 | let handleEdit = (flag,row) =>{ | 199 | let handleEdit = (flag,row) =>{ |
@@ -126,24 +207,94 @@ export default { | @@ -126,24 +207,94 @@ export default { | ||
126 | } | 207 | } |
127 | } | 208 | } |
128 | } | 209 | } |
129 | - //同步 todo | 210 | + //同步 |
130 | let handleRefresh = (flag,row) =>{ | 211 | let handleRefresh = (flag,row) =>{ |
212 | + let ids=[]; | ||
213 | + let isAll=false; | ||
131 | if(flag==1){ | 214 | if(flag==1){ |
132 | //单个同步 row-->对象 | 215 | //单个同步 row-->对象 |
216 | + ids.push(row.id); | ||
217 | + isAll=true; | ||
133 | }else{ | 218 | }else{ |
134 | //多选同步 selectionData.value-->数组 | 219 | //多选同步 selectionData.value-->数组 |
135 | if(selectionData.value.length>0){ | 220 | if(selectionData.value.length>0){ |
136 | //... | 221 | //... |
222 | + selectionData.value.map(item=>{ | ||
223 | + ids.push(item.id) | ||
224 | + }) | ||
225 | + isAll=true; | ||
137 | }else{ | 226 | }else{ |
138 | - proxy.$global.showMsg('请选择数据','warning') | 227 | + isAll=false; |
228 | + } | ||
229 | + } | ||
230 | + let idList=''; | ||
231 | + if(ids.length>0){ | ||
232 | + idList=ids.join(','); | ||
233 | + } | ||
234 | + let param={ | ||
235 | + resType:resType.value, | ||
236 | + idList:idList | ||
237 | + } | ||
238 | + if(isAll){ | ||
239 | + proxy.$global.confirm('确认同步该资源类型"'+resTypeName.value +'"下的资源"'+idList+'"?', function () { | ||
240 | + proxy.$http.get(`/api-web/cmdbSync/sync`, param, function (res) { | ||
241 | + if (res && res.success) { | ||
242 | + proxy.$global.showMsg('同步成功','success'); | ||
243 | + selectionData.value=[]; | ||
244 | + }else{ | ||
245 | + proxy.$global.showMsg('同步失败','error'); | ||
246 | + } | ||
247 | + setData(); | ||
248 | + }); | ||
249 | + }) | ||
250 | + | ||
251 | + }else{ | ||
252 | + proxy.$global.confirm('确认同步该资源类型下所有资源?', function () { | ||
253 | + proxy.$http.get(`/api-web/cmdbSync/sync`, param, function (res) { | ||
254 | + if (res && res.success) { | ||
255 | + proxy.$global.showMsg('同步成功','success'); | ||
256 | + selectionData.value=[]; | ||
257 | + }else{ | ||
258 | + proxy.$global.showMsg('同步失败','error'); | ||
259 | + } | ||
260 | + setData(); | ||
261 | + }); | ||
262 | + }) | ||
263 | + } | ||
264 | + | ||
265 | + } | ||
266 | + //忽略 | ||
267 | + let handleIgnore=()=>{ | ||
268 | + //多选忽略 selectionData.value-->数组 | ||
269 | + if(selectionData.value.length>0){ | ||
270 | + let idList=''; | ||
271 | + let idArr=[] | ||
272 | + selectionData.value.map(item=>{ | ||
273 | + idArr.push(item.id) | ||
274 | + }) | ||
275 | + if(idArr.length>0){ | ||
276 | + idList=idArr.join(',') | ||
139 | } | 277 | } |
278 | + proxy.$global.confirm('确认忽略该资源类型"'+resTypeName.value +'"下的资源"'+idList+'"?', function () { | ||
279 | + proxy.$http.get(`/api-web/cmdbSync/ignore`, {idList:idList}, function (res) { | ||
280 | + if (res && res.success) { | ||
281 | + proxy.$global.showMsg('忽略成功','success'); | ||
282 | + selectionData.value=[]; | ||
283 | + }else{ | ||
284 | + proxy.$global.showMsg('忽略失败','error'); | ||
140 | } | 285 | } |
286 | + getDataList(); | ||
287 | + }); | ||
288 | + }) | ||
289 | + | ||
290 | + }else{ | ||
291 | + proxy.$global.showMsg('请选择数据','warning') | ||
292 | + } | ||
293 | + | ||
141 | } | 294 | } |
142 | //编辑返回数据 | 295 | //编辑返回数据 |
143 | let callbackedit=(obj)=>{ | 296 | let callbackedit=(obj)=>{ |
144 | - console.log("***",obj.editTbaleData,obj.visibility) | ||
145 | - hideDialog(obj.visibility) | ||
146 | - | 297 | + hideDialog(obj.visibility,true) |
147 | //obj.editTbaleData编辑后的数据,todo | 298 | //obj.editTbaleData编辑后的数据,todo |
148 | // getDataList();//获取列表数据 | 299 | // getDataList();//获取列表数据 |
149 | } | 300 | } |
@@ -157,41 +308,73 @@ export default { | @@ -157,41 +308,73 @@ export default { | ||
157 | proxy.$http.post(`/api-web/attribute/getTree`, {}, function (res) { | 308 | proxy.$http.post(`/api-web/attribute/getTree`, {}, function (res) { |
158 | if (res && res.data) { | 309 | if (res && res.data) { |
159 | treeData.value = res.data; | 310 | treeData.value = res.data; |
311 | + if( treeData.value && treeData.value.length>0){ | ||
312 | + expendKeys.value.push(treeData.value[0].id); | ||
313 | + checkedKeys.value=treeData.value[0].children[0].id; | ||
314 | + | ||
315 | + | ||
316 | + } | ||
317 | + getDataList();//获取列表数据 | ||
160 | } | 318 | } |
161 | }); | 319 | }); |
162 | } | 320 | } |
163 | - // 获取列表 todo | 321 | + // 获取列表 |
164 | let getDataList = () => { | 322 | let getDataList = () => { |
165 | - if(defaultNode.value){ | 323 | + if(defaultNode.value && treeData.value[0]){ |
166 | resType.value=treeData.value[0].children[0].value; | 324 | resType.value=treeData.value[0].children[0].value; |
325 | + resTypeName.value=treeData.value[0].children[0].title; | ||
167 | } | 326 | } |
168 | let params={ | 327 | let params={ |
169 | resType:resType.value, | 328 | resType:resType.value, |
170 | - pageNum: search.value.pageNum, | ||
171 | - pageSize: search.value.pageSize, | ||
172 | - keyword:search.value.keyword | ||
173 | - } | ||
174 | - proxy.$http.post(`/api-web/`, params, function (res) { | ||
175 | - if (res && res.object) { | ||
176 | - tableData.value.dataList = res.object; | ||
177 | - tableData.value.count = parseInt(res.object.total); | 329 | + page: search.value.pageNum, |
330 | + limit: search.value.pageSize, | ||
331 | + keyword:search.value.keyword, | ||
332 | + provider:search.value.provider,//厂商 | ||
333 | + system:search.value.system,//系统 linux | ||
334 | + resSyncState:search.value.resSyncState,//资源处理状态 0 监控同步成功 | ||
335 | + } | ||
336 | + proxy.$http.get(`/api-web/cmdbSync/getPage`, params, function (res) { | ||
337 | + if (res && res.data) { | ||
338 | + tableData.value.dataList = res.data; | ||
339 | + tableData.value.count = parseInt(res.count); | ||
178 | } else { | 340 | } else { |
179 | tableData.value.dataList = []; | 341 | tableData.value.dataList = []; |
180 | tableData.value.count = 0; | 342 | tableData.value.count = 0; |
181 | } | 343 | } |
182 | }); | 344 | }); |
183 | } | 345 | } |
346 | + //获取字典接口 | ||
347 | + let getDdicCode=(code)=>{ | ||
348 | + proxy.$http.post(`/api-web/manage/ddic/findSucDdics/`+code, {}, function (res) { | ||
349 | + if (res && res.data) { | ||
350 | + if(code == 'resSyncState'){ | ||
351 | + resSyncStateData.value=res.data; | ||
352 | + }else if(code == 'provider'){ | ||
353 | + providerData.value=res.data; | ||
354 | + }else if(code == 'os'){ | ||
355 | + systemData.value=res.data; | ||
356 | + } | ||
357 | + } | ||
358 | + }); | ||
359 | + } | ||
184 | 360 | ||
185 | // 挂载完 | 361 | // 挂载完 |
186 | Vue.onMounted(() => { | 362 | Vue.onMounted(() => { |
187 | - // getDataList();//获取列表数据 | ||
188 | getResData();//获取资源树数据 | 363 | getResData();//获取资源树数据 |
364 | + setTimeout(function (){ | ||
365 | + proxy.$refs.datasyncTree.setCurrentKey(checkedKeys.value); | ||
366 | + },350) | ||
367 | + getDdicCode('resSyncState'); | ||
368 | + getDdicCode('provider'); | ||
369 | + getDdicCode('os'); | ||
189 | }) | 370 | }) |
190 | 371 | ||
191 | 372 | ||
192 | return { | 373 | return { |
193 | defaultProps, | 374 | defaultProps, |
194 | treeData, | 375 | treeData, |
376 | + checkedKeys, | ||
377 | + expendKeys, | ||
195 | defaultNode, | 378 | defaultNode, |
196 | handleNodeClick, | 379 | handleNodeClick, |
197 | getResData, | 380 | getResData, |
@@ -199,6 +382,7 @@ export default { | @@ -199,6 +382,7 @@ export default { | ||
199 | search, | 382 | search, |
200 | dialog, | 383 | dialog, |
201 | hideDialog, | 384 | hideDialog, |
385 | + setData, | ||
202 | selectionChange, | 386 | selectionChange, |
203 | selectionData, | 387 | selectionData, |
204 | handle, | 388 | handle, |
@@ -209,7 +393,13 @@ export default { | @@ -209,7 +393,13 @@ export default { | ||
209 | handleRefresh, | 393 | handleRefresh, |
210 | callbackedit, | 394 | callbackedit, |
211 | goResDetail, | 395 | goResDetail, |
212 | - resType | 396 | + resType, |
397 | + resTypeName, | ||
398 | + getDdicCode, | ||
399 | + providerData, | ||
400 | + systemData, | ||
401 | + resSyncStateData, | ||
402 | + handleIgnore | ||
213 | } | 403 | } |
214 | } | 404 | } |
215 | 405 |
1 | +<div class="container" :style="{'height':height+'px','max-height':height+'px'}"> | ||
2 | + <div class="cm-card" :style="{'min-height':height+'px','max-height':height+'px','height':'100%','padding-top':'3px'}"> | ||
3 | + <div class="ping-detail"> | ||
4 | + <el-descriptions | ||
5 | + class="" | ||
6 | + title="" | ||
7 | + :column="2" | ||
8 | + :size="size" | ||
9 | + border | ||
10 | + > | ||
11 | + <el-descriptions-item> | ||
12 | + <template #label> | ||
13 | + <div class="cell-item"> | ||
14 | + 资源名称 | ||
15 | + </div> | ||
16 | + </template> | ||
17 | + {{detail.resName}} | ||
18 | + </el-descriptions-item> | ||
19 | + <el-descriptions-item> | ||
20 | + <template #label> | ||
21 | + <div class="cell-item"> | ||
22 | + IP地址 | ||
23 | + </div> | ||
24 | + </template> | ||
25 | + {{detail.ip}} | ||
26 | + </el-descriptions-item> | ||
27 | + <el-descriptions-item> | ||
28 | + <template #label> | ||
29 | + <div class="cell-item"> | ||
30 | + 资源类型 | ||
31 | + </div> | ||
32 | + </template> | ||
33 | + {{detail.resTypeName}} | ||
34 | + </el-descriptions-item> | ||
35 | + <el-descriptions-item> | ||
36 | + <template #label> | ||
37 | + <div class="cell-item"> | ||
38 | + 责任人 | ||
39 | + </div> | ||
40 | + </template> | ||
41 | + {{detail.adminName}} | ||
42 | + </el-descriptions-item> | ||
43 | + </el-descriptions> | ||
44 | + </div> | ||
45 | + <div class="search"> | ||
46 | + <div class="condition"> | ||
47 | + <el-form-item > | ||
48 | + <el-input v-model="search.keyword" placeholder="=资源名称、日志内容="></el-input> | ||
49 | + </el-form-item> | ||
50 | + <el-form-item > | ||
51 | + <el-select v-model="search.kpiId" class="m-2" placeholder="指标" clearable @change="kpiChange"> | ||
52 | + <el-option | ||
53 | + v-for="item in kpiData" | ||
54 | + :key="item.ddicCode" | ||
55 | + :label="item.ddicName" | ||
56 | + :value="item.ddicCode" | ||
57 | + | ||
58 | + /> | ||
59 | + </el-select> | ||
60 | + </el-form-item> | ||
61 | + <el-form-item > | ||
62 | + <el-select v-model="search.flag" class="m-2" placeholder="flag" clearable> | ||
63 | + <el-option | ||
64 | + v-for="item in flagData" | ||
65 | + :key="item.ddicCode" | ||
66 | + :label="item.ddicName" | ||
67 | + :value="item.ddicCode" | ||
68 | + /> | ||
69 | + </el-select> | ||
70 | + </el-form-item> | ||
71 | + | ||
72 | + <el-form-item> | ||
73 | + <el-date-picker | ||
74 | + v-model="search.dateTime" | ||
75 | + type="date" | ||
76 | + placeholder="日期" | ||
77 | + end-placeholder="结束时间" | ||
78 | + value-format="YYYY-MM-DD" | ||
79 | + /> | ||
80 | + | ||
81 | + </el-form-item> | ||
82 | + <el-form-item > | ||
83 | + <el-button @click="getDataList">查询</el-button> | ||
84 | + </el-form-item> | ||
85 | + </div> | ||
86 | + </div> | ||
87 | + | ||
88 | + <div class="search-table"> | ||
89 | + <cm-table-page :columns="tableData.columns" :dataList="tableData.dataList" | ||
90 | + :showIndex="true" | ||
91 | + :total="tableData.count" | ||
92 | + @loaddata = "loaddata" | ||
93 | + :showSelection="false" | ||
94 | + :showBorder="true" | ||
95 | + :loading="false" | ||
96 | + :pageSize="search.pageSize" | ||
97 | + :showPage="true" | ||
98 | + :showTools="true" | ||
99 | + :height="height - 110"> | ||
100 | + <template #default="{row,prop,column}"> | ||
101 | + <!--<div v-if="prop == 'message'" > | ||
102 | + <el-tooltip > | ||
103 | + <template #content> | ||
104 | + <div style="max-width:400px;overflow: hidden; text-overflow: ellipsis;display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;"> | ||
105 | + {{row.message}} | ||
106 | + </div> | ||
107 | + </template> | ||
108 | + <div v-html="row.message" style="overflow: hidden; text-overflow: ellipsis;display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;"></div> | ||
109 | + </el-tooltip> | ||
110 | + </div>--> | ||
111 | + </template> | ||
112 | + <template #tools="{scope}"> | ||
113 | + <div class="list-handle"> | ||
114 | + <span class="icon-bg"> | ||
115 | + <i class="el-icon-view" title="查看" @click="handleView(scope.row)"></i> | ||
116 | + </span> | ||
117 | + </div> | ||
118 | + </template> | ||
119 | + </cm-table-page> | ||
120 | + </div> | ||
121 | + </div> | ||
122 | +</div> | ||
123 | + | ||
124 | +<!--弹框--> | ||
125 | +<cm-dialog :title="dialog.title" width="60%" :showDialogVisible="dialog.show" @hidedialog="hideDialog" :showFooter="false"> | ||
126 | + <template v-slot> | ||
127 | + <pingDetail :detail="dialog.detail" /> | ||
128 | + </template> | ||
129 | +</cm-dialog> | ||
130 | + |
1 | +export default { | ||
2 | + name: 'pingIndex', | ||
3 | + template: '', | ||
4 | + components: { | ||
5 | + 'pingDetail': Vue.defineAsyncComponent( | ||
6 | + () => myImport('views/ping/pingDetail/index') | ||
7 | + ) | ||
8 | + }, | ||
9 | + props: [], | ||
10 | + setup(props, {attrs, slots, emit}) { | ||
11 | + const {proxy} = Vue.getCurrentInstance(); | ||
12 | + let height = Vue.ref(window.innerHeight); | ||
13 | + let resId=Vue.ref(''); | ||
14 | + let dateTime=Vue.ref([]); | ||
15 | + let kpiIdent=Vue.ref(''); | ||
16 | + let search = Vue.ref({ | ||
17 | + kpiId:'', | ||
18 | + sortBy:'dbTime', | ||
19 | + scopeBy:'dbTimeStr.keyword', | ||
20 | + keyword: '', | ||
21 | + type:'syslog', | ||
22 | + pageNum: 1, | ||
23 | + pageSize: 20, | ||
24 | + dateTime:[], | ||
25 | + resType:'', | ||
26 | + }); | ||
27 | + let dialog = Vue.ref({ | ||
28 | + title : "ping详情", | ||
29 | + show:false, | ||
30 | + esId : '' | ||
31 | + }); | ||
32 | + //表格字段 | ||
33 | + let tableData = Vue.ref({ | ||
34 | + count:0, | ||
35 | + dataList: [], | ||
36 | + columns: [ | ||
37 | + { | ||
38 | + prop: 'collTime', | ||
39 | + label: '采集时间', | ||
40 | + sortable: true, | ||
41 | + align: 'center', | ||
42 | + width: '250', | ||
43 | + }, | ||
44 | + { | ||
45 | + prop: 'dbTime', | ||
46 | + label: '入库时间', | ||
47 | + sortable: true, | ||
48 | + align: 'center', | ||
49 | + width: '250' | ||
50 | + }, | ||
51 | + { | ||
52 | + prop: 'kpiValue', | ||
53 | + label: '采集值', | ||
54 | + sortable: true, | ||
55 | + align: 'center', | ||
56 | + width: '200' | ||
57 | + }, | ||
58 | + { | ||
59 | + prop: 'taskName', | ||
60 | + label: '采集任务', | ||
61 | + sortable: true, | ||
62 | + align: 'center', | ||
63 | + width: '200' | ||
64 | + }, | ||
65 | + { | ||
66 | + prop: 'templateName', | ||
67 | + label: '采集模板', | ||
68 | + sortable: true, | ||
69 | + align: 'center', | ||
70 | + width: '200' | ||
71 | + }, | ||
72 | + { | ||
73 | + prop: 'directiveName', | ||
74 | + label: '指令名称', | ||
75 | + sortable: true, | ||
76 | + align: 'center', | ||
77 | + width: '200' | ||
78 | + }, { | ||
79 | + prop: 'ext', | ||
80 | + label: '扩展信息', | ||
81 | + sortable: true, | ||
82 | + align: 'center', | ||
83 | + width: '200', | ||
84 | + render:function (row){ | ||
85 | + return `<pre>${row.ext}</pre>` | ||
86 | + } | ||
87 | + }, { | ||
88 | + prop: 'message', | ||
89 | + label: '异常信息', | ||
90 | + sortable: true, | ||
91 | + align: 'center', | ||
92 | + render:function (row){ | ||
93 | + return `<pre>${row.message}</pre>` | ||
94 | + } | ||
95 | + } | ||
96 | + ] | ||
97 | + }) | ||
98 | + let resTypeArr = Vue.ref([]); | ||
99 | + let getResType = (arr) => { | ||
100 | + var types = arr.map(function (v) { | ||
101 | + return v.id; | ||
102 | + }); | ||
103 | + resTypeArr.value = types; | ||
104 | + search.value.resType=resTypeArr.value.join(','); | ||
105 | + // getDataList(); | ||
106 | + } | ||
107 | + //获取时间点 转年月日的方法 | ||
108 | + const getDateTime=(newDate)=>{ | ||
109 | + let dateTime=''; | ||
110 | + let year=newDate.getFullYear();//获取当前年 | ||
111 | + let month1=(newDate.getMonth()+1)+''; | ||
112 | + let month=timeFormat(month1);//获取当前月 | ||
113 | + let day=timeFormat(newDate.getDate());//获取当前日 | ||
114 | + let hours=timeFormat(newDate.getHours()+'');//获取当前时 | ||
115 | + let minutes=timeFormat(newDate.getMinutes()+'');//获取当前分 | ||
116 | + let seconds=timeFormat(newDate.getSeconds()+'');//获取当前秒 | ||
117 | + dateTime= year+'-'+month+'-'+day;//' '+hours+':'+minutes+':'+seconds; | ||
118 | + return dateTime; | ||
119 | + } | ||
120 | + //转换个位数为 00 | ||
121 | + let timeFormat =(number)=> { | ||
122 | + return number.length == 1 ? ('0' + number) : number | ||
123 | + } | ||
124 | + // 获取列表 | ||
125 | + let getDataList = () => { | ||
126 | + let nowDate=getDateTime(new Date()); | ||
127 | + let dateStr=''; | ||
128 | + if(kpiIdent.value==1){ | ||
129 | + dateStr='monitor-performance_'; | ||
130 | + }else{ | ||
131 | + dateStr='monitor-collector_'; | ||
132 | + } | ||
133 | + if(search.value.dateTime){ | ||
134 | + dateStr+=search.value.dateTime; | ||
135 | + }else { | ||
136 | + dateStr+=nowDate; | ||
137 | + } | ||
138 | + | ||
139 | + let params={ | ||
140 | + resId:resId.value, | ||
141 | + kpiId:search.value.kpiId, | ||
142 | + flag:search.value.flag, | ||
143 | + indexName:dateStr, | ||
144 | + pageNum: search.value.pageNum, | ||
145 | + pageSize: search.value.pageSize, | ||
146 | + type:search.value.type, | ||
147 | + sortBy:search.value.sortBy, | ||
148 | + scopeBy:search.value.scopeBy, | ||
149 | + resType:search.value.resType, | ||
150 | + param:{} | ||
151 | + } | ||
152 | + if(search.value.keyword){ | ||
153 | + params.param={ | ||
154 | + 'resName.keyword': search.value.keyword, | ||
155 | + 'host.keyword':search.value.keyword, | ||
156 | + 'message.keyword':search.value.keyword, | ||
157 | + } | ||
158 | + } | ||
159 | + if(search.value.kpiId){ | ||
160 | + params['param']['kpiId.keyword']=search.value.kpiId; | ||
161 | + } | ||
162 | + proxy.$http.post(`/api-web/esData/list`, params, function (res) { | ||
163 | + if (res && res.object) { | ||
164 | + let dataList=res.object.content; | ||
165 | + let arr=[]; | ||
166 | + dataList.map(item=>{ | ||
167 | + arr.push(item[0]) | ||
168 | + }) | ||
169 | + tableData.value.dataList = arr; | ||
170 | + tableData.value.count = parseInt(res.object.total); | ||
171 | + } else { | ||
172 | + tableData.value.dataList = []; | ||
173 | + tableData.value.count = 0; | ||
174 | + } | ||
175 | + }); | ||
176 | + } | ||
177 | + | ||
178 | + let loaddata = ({page, limit}) => { | ||
179 | + search.value.pageNum = page; | ||
180 | + search.value.pageSize = limit; | ||
181 | + getDataList(); | ||
182 | + } | ||
183 | + | ||
184 | + let hideDialog = (flg) => { | ||
185 | + dialog.value.show = flg; | ||
186 | + } | ||
187 | + | ||
188 | + // 处理弹框 | ||
189 | + let handle = (row) =>{ | ||
190 | + hideDialog(true); | ||
191 | + dialog.value.detail = row; | ||
192 | + } | ||
193 | + | ||
194 | + //查看详情 | ||
195 | + let handleView = (row) =>{ | ||
196 | + handle(row); | ||
197 | + } | ||
198 | + //查看资源详情 | ||
199 | + let goResDetail=(resId,resName,resType)=>{ | ||
200 | + proxy.$global.openDetail(resId, resType, proxy); | ||
201 | + | ||
202 | + } | ||
203 | + //指标数据 | ||
204 | + let kpiData=Vue.ref([]); | ||
205 | + let getKpiData=()=>{ | ||
206 | + proxy.$http.post(`/api-web/manage/ddic/findSucDdics/LOG_SOURCE_TYPE`, {}, function (res) { | ||
207 | + if (res && res.data) { | ||
208 | + kpiData.value = res.data; | ||
209 | + } | ||
210 | + }); | ||
211 | + } | ||
212 | + //flag数据 | ||
213 | + let flagData=Vue.ref([]); | ||
214 | + let getFlagData=()=>{ | ||
215 | + proxy.$http.post(`/api-web/manage/ddic/findSucDdics/LOG_SOURCE_TYPE?kpiId=`+search.kpiId+'&resId='+resId.value, {}, function (res) { | ||
216 | + if (res && res.data) { | ||
217 | + flagData.value = res.data; | ||
218 | + } | ||
219 | + }); | ||
220 | + } | ||
221 | + //指标改变事件 | ||
222 | + let kpiChange=(val)=>{ | ||
223 | + getFlagData(); | ||
224 | + } | ||
225 | + let detail=Vue.ref({}) | ||
226 | + //获取resId | ||
227 | + let getResId=()=>{ | ||
228 | + detail.value=proxy.$route.query; | ||
229 | + resId.value=proxy.$route.query.resId; | ||
230 | + | ||
231 | + } | ||
232 | + // 挂载完 | ||
233 | + Vue.onMounted(() => { | ||
234 | + getResId(); | ||
235 | + getDataList(); | ||
236 | + getKpiData(); | ||
237 | + }) | ||
238 | + | ||
239 | + | ||
240 | + return { | ||
241 | + resId, | ||
242 | + getResId, | ||
243 | + detail, | ||
244 | + kpiData, | ||
245 | + kpiIdent, | ||
246 | + getKpiData, | ||
247 | + flagData, | ||
248 | + getFlagData, | ||
249 | + kpiChange, | ||
250 | + dateTime, | ||
251 | + height, | ||
252 | + search, | ||
253 | + dialog, | ||
254 | + hideDialog, | ||
255 | + handle, | ||
256 | + loaddata, | ||
257 | + tableData, | ||
258 | + getDataList, | ||
259 | + resTypeArr, | ||
260 | + getResType, | ||
261 | + handleView, | ||
262 | + goResDetail, | ||
263 | + getDateTime | ||
264 | + } | ||
265 | + } | ||
266 | + | ||
267 | +} |
1 | +<div class="esData-detail-container"> | ||
2 | + <el-descriptions | ||
3 | + class="" | ||
4 | + title="日志信息" | ||
5 | + :column="2" | ||
6 | + :size="size" | ||
7 | + border | ||
8 | + > | ||
9 | + <el-descriptions-item> | ||
10 | + <template #label> | ||
11 | + <div class="cell-item"> | ||
12 | + 资源名称 | ||
13 | + </div> | ||
14 | + </template> | ||
15 | + {{detail.resName}} | ||
16 | + </el-descriptions-item> | ||
17 | + <el-descriptions-item> | ||
18 | + <template #label> | ||
19 | + <div class="cell-item"> | ||
20 | + IP地址 | ||
21 | + </div> | ||
22 | + </template> | ||
23 | + {{detail.host}} | ||
24 | + </el-descriptions-item> | ||
25 | + <el-descriptions-item> | ||
26 | + <template #label> | ||
27 | + <div class="cell-item"> | ||
28 | + 资源类型 | ||
29 | + </div> | ||
30 | + </template> | ||
31 | + {{detail.resTypeName}} | ||
32 | + </el-descriptions-item> | ||
33 | + <el-descriptions-item> | ||
34 | + <template #label> | ||
35 | + <div class="cell-item"> | ||
36 | + 日志来源 | ||
37 | + </div> | ||
38 | + </template> | ||
39 | + {{detail.type}} | ||
40 | + </el-descriptions-item> | ||
41 | + <el-descriptions-item> | ||
42 | + <template #label> | ||
43 | + <div class="cell-item"> | ||
44 | + 日志类型 | ||
45 | + </div> | ||
46 | + </template> | ||
47 | + {{detail.program}} | ||
48 | + </el-descriptions-item> | ||
49 | + <el-descriptions-item> | ||
50 | + <template #label> | ||
51 | + <div class="cell-item"> | ||
52 | + 采集时间 | ||
53 | + </div> | ||
54 | + </template> | ||
55 | + {{detail.dbTimeStr}} | ||
56 | + </el-descriptions-item> | ||
57 | + <el-descriptions-item> | ||
58 | + <template #label> | ||
59 | + <div class="cell-item"> | ||
60 | + 日志时间 | ||
61 | + </div> | ||
62 | + </template> | ||
63 | + {{detail.logDate}} | ||
64 | + </el-descriptions-item> | ||
65 | + </el-descriptions> | ||
66 | + <div class="info-title"> | ||
67 | + <span style="font-weight:bold">日志内容</span> | ||
68 | + </div> | ||
69 | + <div class="esData-detail-info-content" v-html="detail.message"> | ||
70 | + </div> | ||
71 | +</div> |
1 | +export default { | ||
2 | + name: 'esDataDetail', | ||
3 | + template: '', | ||
4 | + components: { | ||
5 | + | ||
6 | + }, | ||
7 | + props: { | ||
8 | + detail:{ | ||
9 | + type:Object, | ||
10 | + default: {} | ||
11 | + } | ||
12 | + }, | ||
13 | + setup(props, {attrs, slots, emit}) { | ||
14 | + const {proxy} = Vue.getCurrentInstance(); | ||
15 | + | ||
16 | + // 挂载完 | ||
17 | + Vue.onMounted(() => { | ||
18 | + }) | ||
19 | + | ||
20 | + | ||
21 | + return { | ||
22 | + | ||
23 | + } | ||
24 | + } | ||
25 | + | ||
26 | +} |
@@ -204,6 +204,18 @@ const routes = [{ | @@ -204,6 +204,18 @@ const routes = [{ | ||
204 | name: 'esDataIndex', | 204 | name: 'esDataIndex', |
205 | component: () => myImport('views/esData/index'), | 205 | component: () => myImport('views/esData/index'), |
206 | }, | 206 | }, |
207 | + //监控对接CMDB功能 | ||
208 | + { | ||
209 | + path: '/cmdbdatasync', | ||
210 | + name: 'cmdbdatasync', | ||
211 | + component: () => myImport('views/cmdbdatasync/index'), | ||
212 | + }, | ||
213 | + //ping详情列表 | ||
214 | + { | ||
215 | + path: '/ping', | ||
216 | + name: 'pingIndex', | ||
217 | + component: () => myImport('views/ping/index'), | ||
218 | + }, | ||
207 | ]; | 219 | ]; |
208 | 220 | ||
209 | // hash模式: createWebHashHistory | 221 | // hash模式: createWebHashHistory |
-
Please register or login to post a comment