cmdb数据同步页列表接口、忽略接口、同步接口、纳入监控接口数据调用
Showing
5 changed files
with
369 additions
and
53 deletions
@@ -15,4 +15,26 @@ | @@ -15,4 +15,26 @@ | ||
15 | } | 15 | } |
16 | .protocol-btn i{ | 16 | .protocol-btn i{ |
17 | color:#ffffff; | 17 | color:#ffffff; |
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; | ||
18 | } | 40 | } |
@@ -15,7 +15,40 @@ | @@ -15,7 +15,40 @@ | ||
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}} <span class="star">*</span> | ||
35 | + </div> | ||
36 | + </template> | ||
37 | + <el-input style="width: 220px;" v-model="itemChild.defaultValue" size="small"/> | ||
38 | + <!-- <el-input style="width: 220px;" v-if="itemChild.inputWay=='input'" v-model="itemChild.defaultValue" size="small"/> | ||
39 | + <el-select size="small" v-else-if="itemChild.inputWay=='select'" v-model="itemChild.defaultValue" class="m-2" placeholder="请选择"> | ||
40 | + <el-option | ||
41 | + v-for="itemDdic in optinos" | ||
42 | + :key="itemDdic.ddicCode" | ||
43 | + :label="itemDdic.ddicName" | ||
44 | + :value="itemDdic.ddicCode" | ||
45 | + /> | ||
46 | + </el-select> | ||
47 | + <span v-else>{{itemChild.defaultValue}}</span>--> | ||
48 | + </el-descriptions-item> | ||
49 | + | ||
50 | + </el-descriptions> | ||
51 | + </div> | ||
19 | </template> | 52 | </template> |
20 | <template #default="{row,prop,column}"> | 53 | <template #default="{row,prop,column}"> |
21 | <div> | 54 | <div> |
@@ -31,7 +64,7 @@ | @@ -31,7 +64,7 @@ | ||
31 | </template> | 64 | </template> |
32 | <template #tools="{scope}"> | 65 | <template #tools="{scope}"> |
33 | <div class="protocol-btn"> | 66 | <div class="protocol-btn"> |
34 | - <span class="icon-add" @click="addProtocol" title="协议参数"><i class="el-icon-plus"></i></span> | 67 | + <span class="icon-add" @click="addProtocol(scope.row)" title="协议参数"><i class="el-icon-plus"></i></span> |
35 | </div> | 68 | </div> |
36 | </template> | 69 | </template> |
37 | </cm-table-page> | 70 | </cm-table-page> |
@@ -14,20 +14,56 @@ export default { | @@ -14,20 +14,56 @@ 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 | - editTbaleData:editTbaleData.value, | ||
25 | - visibility:false | 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 | + }) | ||
26 | } | 30 | } |
27 | - emit("callbackedit",param) | 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 | + arr.push({ | ||
43 | + bean:item, | ||
44 | + proto:item.proto | ||
45 | + }) | ||
46 | + }) | ||
47 | + let param=arr; | ||
48 | + proxy.$http.post( '/api-web/cmdbSync/toMonitor1',param, function (res) { | ||
49 | + if (res && res.success) { | ||
50 | + proxy.$global.showMsg('保存成功','error'); | ||
51 | + }else{ | ||
52 | + proxy.$global.showMsg('保存失败','error'); | ||
53 | + } | ||
54 | + let backData={ | ||
55 | + editTbaleData:editTbaleData.value, | ||
56 | + visibility:false | ||
57 | + } | ||
58 | + emit("callbackedit",backData) | ||
59 | + }); | ||
60 | + | ||
28 | } | 61 | } |
29 | //添加协议 | 62 | //添加协议 |
30 | - let addProtocol=()=>{ | 63 | + let clickResId=Vue.ref(''); |
64 | + let addProtocol=(row)=>{ | ||
65 | + console.log("^^^^^",proxy.$global.layui) | ||
66 | + clickResId.value=row.resId; | ||
31 | proxy.$global.layer.open({ | 67 | proxy.$global.layer.open({ |
32 | title:'资源协议', | 68 | title:'资源协议', |
33 | id:'resManageChooseProtocolHtml', | 69 | id:'resManageChooseProtocolHtml', |
@@ -39,20 +75,50 @@ export default { | @@ -39,20 +75,50 @@ export default { | ||
39 | proxy.$global.layui.view('resManageChooseProtocolHtml').render('/baseconfig/protocol/index',{'hasParam':'1'}); | 75 | proxy.$global.layui.view('resManageChooseProtocolHtml').render('/baseconfig/protocol/index',{'hasParam':'1'}); |
40 | }, | 76 | }, |
41 | yes:function (index,layero) { | 77 | 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(); | 78 | + let data = proxy.$global.layui.table.checkStatus('protocol_table').data; |
79 | + | ||
80 | + proxy.$global.layui.use('resManageAdd', function (fn) { | ||
81 | + // console.log("&&&&!!!!",data,fn(row)) | ||
82 | + // console.log(fn(row).createProtocolDom) | ||
83 | + | ||
84 | + }) | ||
85 | + let ip = row.ip; | ||
86 | + let port = row.port; | ||
45 | if(data.length>0){ | 87 | if(data.length>0){ |
46 | - createProtocolDom(data,false); | ||
47 | - form.render() | ||
48 | - layer.close(index); | 88 | + /*createProtocolDom(data,false); |
89 | + proxy.$global.layui.form.render()*/ | ||
90 | + editTbaleData.value.map(item=>{ | ||
91 | + // item.bean=item; | ||
92 | + if(item.resId==row.resId){ | ||
93 | + let arr=[] | ||
94 | + data.map(v=>{ | ||
95 | + arr=arr.concat(v.protocolParamList.flat()); | ||
96 | + }) | ||
97 | + item.extend=data; | ||
98 | + item.proto=arr; | ||
99 | + | ||
100 | + } | ||
101 | + }) | ||
102 | + proxy.$global.layer.close(index); | ||
49 | }else{ | 103 | }else{ |
50 | - layer.msg("无选中的数据或当",{ offset: '15px' , icon: 7 , time: 2000 }) | 104 | + proxy.$global.layer.msg("无选中的数据或当",{ offset: '15px' , icon: 7 , time: 2000 }) |
51 | return false; | 105 | return false; |
52 | } | 106 | } |
53 | } | 107 | } |
54 | }) | 108 | }) |
55 | } | 109 | } |
110 | + //协议参数中select的字典数据 | ||
111 | + let getSelectData=(param)=>{ | ||
112 | + | ||
113 | + proxy.$http.post( '/api-web/manage/ddic/findSucDdics/'+param.defaultValue, {}, function (res) { | ||
114 | + if (res && res.data) { | ||
115 | + let selectData= res.data; | ||
116 | + // protocolParamList | ||
117 | + }else{ | ||
118 | + proxy.$global.showMsg('暂无数据','error'); | ||
119 | + } | ||
120 | + }); | ||
121 | + } | ||
56 | // 挂载完 | 122 | // 挂载完 |
57 | Vue.onMounted(() => { | 123 | Vue.onMounted(() => { |
58 | }) | 124 | }) |
@@ -61,9 +127,12 @@ export default { | @@ -61,9 +127,12 @@ export default { | ||
61 | return { | 127 | return { |
62 | height, | 128 | height, |
63 | editTbaleData, | 129 | editTbaleData, |
130 | + resType, | ||
64 | // columns, | 131 | // columns, |
65 | saveEdit, | 132 | saveEdit, |
66 | addProtocol, | 133 | addProtocol, |
134 | + clickResId, | ||
135 | + getSelectData | ||
67 | // getRowKeys, | 136 | // getRowKeys, |
68 | // expands | 137 | // expands |
69 | } | 138 | } |
@@ -8,21 +8,54 @@ | @@ -8,21 +8,54 @@ | ||
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.count" :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" |
@@ -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> |
@@ -18,36 +18,33 @@ export default { | @@ -18,36 +18,33 @@ export default { | ||
18 | let defaultNode=Vue.ref(true);//默认节点 | 18 | let defaultNode=Vue.ref(true);//默认节点 |
19 | let resType=Vue.ref('');//选中的树节点值 | 19 | let resType=Vue.ref('');//选中的树节点值 |
20 | let handleNodeClick=(data,node)=>{ | 20 | let handleNodeClick=(data,node)=>{ |
21 | - //点击树节点,根据某个字段获取列表 todo | ||
22 | - console.log("*(*(*(*",data,node) | ||
23 | - proxy.$global.showMsg(data.id,'warning') | 21 | + //点击树节点,根据某个字段获取列表 |
24 | resType.value=data.value; | 22 | resType.value=data.value; |
25 | defaultNode.value=false; | 23 | defaultNode.value=false; |
26 | getDataList(); | 24 | getDataList(); |
27 | } | 25 | } |
28 | - | 26 | + let providerData=Vue.ref([]);//厂商 |
27 | + let systemData=Vue.ref([]);//系统 | ||
28 | + let resSyncStateData=Vue.ref([]);//资源处理状态 | ||
29 | let search = Vue.ref({ | 29 | let search = Vue.ref({ |
30 | keyword: '', | 30 | keyword: '', |
31 | pageNum: 1, | 31 | pageNum: 1, |
32 | pageSize: 20, | 32 | pageSize: 20, |
33 | + resSyncState:'', | ||
34 | + system: '', | ||
35 | + provider:'', | ||
33 | }); | 36 | }); |
34 | //表格字段 | 37 | //表格字段 |
35 | let tableData = Vue.ref({ | 38 | let tableData = Vue.ref({ |
36 | count:0, | 39 | count:0, |
37 | - dataList: [{ | ||
38 | - id:1, | ||
39 | - resName:'资源一' | ||
40 | - },{ | ||
41 | - id:2, | ||
42 | - resName:'资源34' | ||
43 | - }], | 40 | + dataList: [], |
44 | columns: [ | 41 | columns: [ |
45 | { | 42 | { |
46 | prop: 'resName', | 43 | prop: 'resName', |
47 | label: '资源名称', | 44 | label: '资源名称', |
48 | sortable: true, | 45 | sortable: true, |
49 | align: 'center', | 46 | align: 'center', |
50 | - width: '250' | 47 | + width: '200' |
51 | }, | 48 | }, |
52 | { | 49 | { |
53 | prop: 'resTypeName', | 50 | prop: 'resTypeName', |
@@ -56,31 +53,98 @@ export default { | @@ -56,31 +53,98 @@ export default { | ||
56 | align: 'center', | 53 | align: 'center', |
57 | width: '200' | 54 | width: '200' |
58 | }, { | 55 | }, { |
59 | - prop: 'host', | ||
60 | - label: 'IP地址', | 56 | + prop: 'resCategory', |
57 | + label: '资源分类', | ||
61 | sortable: true, | 58 | sortable: true, |
62 | align: 'center', | 59 | align: 'center', |
63 | - width: '200' | ||
64 | - }, { | ||
65 | - prop: 'type', | ||
66 | - label: '日志来源', | 60 | + width: '100' |
61 | + }, | ||
62 | + { | ||
63 | + prop: 'ip', | ||
64 | + label: 'ip', | ||
67 | sortable: true, | 65 | sortable: true, |
68 | align: 'center', | 66 | align: 'center', |
69 | width: '200' | 67 | width: '200' |
70 | }, | 68 | }, |
71 | { | 69 | { |
72 | - prop: 'program', | ||
73 | - label: '日志类型', | 70 | + prop: 'port', |
71 | + label: '端口', | ||
72 | + sortable: true, | ||
73 | + align: 'center', | ||
74 | + }, | ||
75 | + { | ||
76 | + prop: 'os', | ||
77 | + label: '操作系统类型', | ||
78 | + sortable: true, | ||
79 | + align: 'center', | ||
80 | + width: '130' | ||
81 | + }, | ||
82 | + { | ||
83 | + prop: 'provider', | ||
84 | + label: '厂商', | ||
85 | + sortable: true, | ||
86 | + align: 'center', | ||
87 | + width: '100' | ||
88 | + }, | ||
89 | + { | ||
90 | + prop: 'state', | ||
91 | + label: '资源处理状态', | ||
92 | + sortable: true, | ||
93 | + align: 'center', | ||
94 | + width: '130', | ||
95 | + render:function (row){ | ||
96 | + let str='已同步'; | ||
97 | + if(row.state=='1'){ | ||
98 | + str='纳入监控'; | ||
99 | + }else if(row.state=='2'){ | ||
100 | + str='忽略'; | ||
101 | + }else{ | ||
102 | + str='已同步'; | ||
103 | + } | ||
104 | + return `<span>${str}</span>` | ||
105 | + } | ||
106 | + }, | ||
107 | + { | ||
108 | + prop: 'syncType', | ||
109 | + label: 'cmdb数据同步类型', | ||
110 | + sortable: true, | ||
111 | + align: 'center', | ||
112 | + width: '200', | ||
113 | + render:function (row){ | ||
114 | + let str='自动同步'; | ||
115 | + if(row.syncType=='1'){ | ||
116 | + str='手动同步'; | ||
117 | + }else if(row.syncType=='2'){ | ||
118 | + str='自动覆盖同步'; | ||
119 | + }else if(row.syncType=='3'){ | ||
120 | + str='手动覆盖同步'; | ||
121 | + }else{ | ||
122 | + str='自动同步'; | ||
123 | + } | ||
124 | + return `<span>${str}</span>` | ||
125 | + } | ||
126 | + }, | ||
127 | + { | ||
128 | + prop: 'resSyncDate', | ||
129 | + label: '资源处理时间', | ||
74 | sortable: true, | 130 | sortable: true, |
75 | align: 'center', | 131 | align: 'center', |
76 | width: '200' | 132 | width: '200' |
77 | }, | 133 | }, |
78 | { | 134 | { |
79 | - prop: 'message', | ||
80 | - label: '日志内容', | 135 | + prop: 'syncDate', |
136 | + label: 'CMDB数据同步时间', | ||
81 | sortable: true, | 137 | sortable: true, |
82 | align: 'center', | 138 | align: 'center', |
139 | + width: '200' | ||
83 | }, | 140 | }, |
141 | + { | ||
142 | + prop: 'remark', | ||
143 | + label: '备注', | ||
144 | + sortable: true, | ||
145 | + align: 'center', | ||
146 | + width: '200' | ||
147 | + } | ||
84 | ] | 148 | ] |
85 | }) | 149 | }) |
86 | let dialog = Vue.ref({ | 150 | let dialog = Vue.ref({ |
@@ -94,6 +158,10 @@ export default { | @@ -94,6 +158,10 @@ export default { | ||
94 | } | 158 | } |
95 | let hideDialog = (flg) => { | 159 | let hideDialog = (flg) => { |
96 | dialog.value.show = flg; | 160 | dialog.value.show = flg; |
161 | + if(!flg){ | ||
162 | + // selectionData.value=[]; | ||
163 | + getDataList(); | ||
164 | + } | ||
97 | } | 165 | } |
98 | //全选事件 | 166 | //全选事件 |
99 | let selectionData=Vue.ref([]);//选择的数据 | 167 | let selectionData=Vue.ref([]);//选择的数据 |
@@ -106,6 +174,7 @@ export default { | @@ -106,6 +174,7 @@ export default { | ||
106 | dialog.value.tableData.dataList= row; | 174 | dialog.value.tableData.dataList= row; |
107 | dialog.value.tableData.columns=tableData.value.columns; | 175 | dialog.value.tableData.columns=tableData.value.columns; |
108 | dialog.value.tableData.getRowKeys= 'id'; | 176 | dialog.value.tableData.getRowKeys= 'id'; |
177 | + dialog.value.tableData.resType= resType.value; | ||
109 | let arr=[]; | 178 | let arr=[]; |
110 | row.map(item=>{ | 179 | row.map(item=>{ |
111 | arr.push(item.id) | 180 | arr.push(item.id) |
@@ -126,18 +195,84 @@ export default { | @@ -126,18 +195,84 @@ export default { | ||
126 | } | 195 | } |
127 | } | 196 | } |
128 | } | 197 | } |
129 | - //同步 todo | 198 | + //同步 |
130 | let handleRefresh = (flag,row) =>{ | 199 | let handleRefresh = (flag,row) =>{ |
200 | + let ids=[]; | ||
201 | + let isAll=false; | ||
131 | if(flag==1){ | 202 | if(flag==1){ |
132 | //单个同步 row-->对象 | 203 | //单个同步 row-->对象 |
204 | + ids.push(row.id); | ||
205 | + isAll=true; | ||
133 | }else{ | 206 | }else{ |
134 | //多选同步 selectionData.value-->数组 | 207 | //多选同步 selectionData.value-->数组 |
135 | if(selectionData.value.length>0){ | 208 | if(selectionData.value.length>0){ |
136 | //... | 209 | //... |
210 | + selectionData.value.map(item=>{ | ||
211 | + ids.push(item.id) | ||
212 | + }) | ||
213 | + isAll=true; | ||
137 | }else{ | 214 | }else{ |
138 | - proxy.$global.showMsg('请选择数据','warning') | 215 | + isAll=false; |
216 | + } | ||
217 | + } | ||
218 | + let idList=''; | ||
219 | + if(ids.length>0){ | ||
220 | + idList=ids.join(','); | ||
221 | + } | ||
222 | + let param={ | ||
223 | + resType:resType.value, | ||
224 | + idList:idList | ||
225 | + } | ||
226 | + if(isAll){ | ||
227 | + proxy.$http.get(`/api-web/cmdbSync/sync`, param, function (res) { | ||
228 | + if (res && res.success) { | ||
229 | + proxy.$global.showMsg('同步成功','success'); | ||
230 | + selectionData.value=[]; | ||
231 | + }else{ | ||
232 | + proxy.$global.showMsg('同步失败','error'); | ||
233 | + } | ||
234 | + getDataList(); | ||
235 | + }); | ||
236 | + }else{ | ||
237 | + proxy.$global.confirm('确认同步该资源类型下所有资源?', function () { | ||
238 | + proxy.$http.get(`/api-web/cmdbSync/sync`, param, function (res) { | ||
239 | + if (res && res.success) { | ||
240 | + proxy.$global.showMsg('同步成功','success'); | ||
241 | + selectionData.value=[]; | ||
242 | + }else{ | ||
243 | + proxy.$global.showMsg('同步失败','error'); | ||
244 | + } | ||
245 | + getDataList(); | ||
246 | + }); | ||
247 | + }) | ||
248 | + } | ||
249 | + | ||
250 | + } | ||
251 | + //忽略 | ||
252 | + let handleIgnore=()=>{ | ||
253 | + //多选忽略 selectionData.value-->数组 | ||
254 | + if(selectionData.value.length>0){ | ||
255 | + let idList=''; | ||
256 | + let idArr=[] | ||
257 | + selectionData.value.map(item=>{ | ||
258 | + idArr.push(item.id) | ||
259 | + }) | ||
260 | + if(idArr.length>0){ | ||
261 | + idList=idArr.join(',') | ||
139 | } | 262 | } |
263 | + proxy.$http.get(`/api-web/cmdbSync/ignore`, {idList:idList}, function (res) { | ||
264 | + if (res && res.success) { | ||
265 | + proxy.$global.showMsg('忽略成功','success'); | ||
266 | + selectionData.value=[]; | ||
267 | + }else{ | ||
268 | + proxy.$global.showMsg('忽略失败','error'); | ||
269 | + } | ||
270 | + getDataList(); | ||
271 | + }); | ||
272 | + }else{ | ||
273 | + proxy.$global.showMsg('请选择数据','warning') | ||
140 | } | 274 | } |
275 | + | ||
141 | } | 276 | } |
142 | //编辑返回数据 | 277 | //编辑返回数据 |
143 | let callbackedit=(obj)=>{ | 278 | let callbackedit=(obj)=>{ |
@@ -157,35 +292,55 @@ export default { | @@ -157,35 +292,55 @@ export default { | ||
157 | proxy.$http.post(`/api-web/attribute/getTree`, {}, function (res) { | 292 | proxy.$http.post(`/api-web/attribute/getTree`, {}, function (res) { |
158 | if (res && res.data) { | 293 | if (res && res.data) { |
159 | treeData.value = res.data; | 294 | treeData.value = res.data; |
295 | + getDataList();//获取列表数据 | ||
160 | } | 296 | } |
161 | }); | 297 | }); |
162 | } | 298 | } |
163 | - // 获取列表 todo | 299 | + // 获取列表 |
164 | let getDataList = () => { | 300 | let getDataList = () => { |
165 | - if(defaultNode.value){ | 301 | + if(defaultNode.value && treeData.value[0]){ |
166 | resType.value=treeData.value[0].children[0].value; | 302 | resType.value=treeData.value[0].children[0].value; |
167 | } | 303 | } |
168 | let params={ | 304 | let params={ |
169 | resType:resType.value, | 305 | resType:resType.value, |
170 | - pageNum: search.value.pageNum, | ||
171 | - pageSize: search.value.pageSize, | ||
172 | - keyword:search.value.keyword | 306 | + page: search.value.pageNum, |
307 | + limit: search.value.pageSize, | ||
308 | + keyword:search.value.keyword, | ||
309 | + provider:search.value.provider,//厂商 | ||
310 | + system:search.value.system,//系统 linux | ||
311 | + resSyncState:search.value.resSyncState,//资源处理状态 0 监控同步成功 | ||
173 | } | 312 | } |
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); | 313 | + proxy.$http.get(`/api-web/cmdbSync/getPage`, params, function (res) { |
314 | + if (res && res.data) { | ||
315 | + tableData.value.dataList = res.data; | ||
316 | + tableData.value.count = parseInt(res.count); | ||
178 | } else { | 317 | } else { |
179 | tableData.value.dataList = []; | 318 | tableData.value.dataList = []; |
180 | tableData.value.count = 0; | 319 | tableData.value.count = 0; |
181 | } | 320 | } |
182 | }); | 321 | }); |
183 | } | 322 | } |
323 | + //获取字典接口 | ||
324 | + let getDdicCode=(code)=>{ | ||
325 | + proxy.$http.post(`/api-web/manage/ddic/findSucDdics/`+code, {}, function (res) { | ||
326 | + if (res && res.data) { | ||
327 | + if(code == 'resSyncState'){ | ||
328 | + resSyncStateData.value=res.data; | ||
329 | + }else if(code == 'provider'){ | ||
330 | + providerData.value=res.data; | ||
331 | + }else if(code == 'os'){ | ||
332 | + systemData.value=res.data; | ||
333 | + } | ||
334 | + } | ||
335 | + }); | ||
336 | + } | ||
184 | 337 | ||
185 | // 挂载完 | 338 | // 挂载完 |
186 | Vue.onMounted(() => { | 339 | Vue.onMounted(() => { |
187 | - // getDataList();//获取列表数据 | ||
188 | getResData();//获取资源树数据 | 340 | getResData();//获取资源树数据 |
341 | + getDdicCode('resSyncState'); | ||
342 | + getDdicCode('provider'); | ||
343 | + getDdicCode('os'); | ||
189 | }) | 344 | }) |
190 | 345 | ||
191 | 346 | ||
@@ -209,7 +364,12 @@ export default { | @@ -209,7 +364,12 @@ export default { | ||
209 | handleRefresh, | 364 | handleRefresh, |
210 | callbackedit, | 365 | callbackedit, |
211 | goResDetail, | 366 | goResDetail, |
212 | - resType | 367 | + resType, |
368 | + getDdicCode, | ||
369 | + providerData, | ||
370 | + systemData, | ||
371 | + resSyncStateData, | ||
372 | + handleIgnore | ||
213 | } | 373 | } |
214 | } | 374 | } |
215 | 375 |
-
Please register or login to post a comment