Authored by 王涛

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

机柜机房组件数据更改为接口返回



See merge request !175
1 <div class="machine-room"> 1 <div class="machine-room">
2 <div class="room-top"> 2 <div class="room-top">
3 <el-tabs type="card" @tab-click="handleCommand" v-model="commandVal"> 3 <el-tabs type="card" @tab-click="handleCommand" v-model="commandVal">
4 - <el-tab-pane v-for="item in commandNameData" :label="item.name" :name="item.val"></el-tab-pane> 4 + <el-tab-pane v-for="item in commandNameData" :label="item.machineRoomName" :name="item.machineRoomCode"></el-tab-pane>
5 5
6 </el-tabs> 6 </el-tabs>
7 - <!--<el-dropdown @command="handleCommand" class="elSelf" :popper-append-to-body="false">  
8 - <span class="el-dropdown-link">  
9 - {{commandName}}  
10 - <i class="icon-arrow"></i>  
11 - </span>  
12 - <template #dropdown>  
13 - <el-dropdown-menu class="cpuDropdown">  
14 - <el-dropdown-item v-for="item in commandNameData" :command="item.val">{{item.name}}</el-dropdown-item>  
15 -  
16 -  
17 - </el-dropdown-menu>  
18 - </template>  
19 - </el-dropdown>-->  
20 </div> 7 </div>
21 <div class="room-html"> 8 <div class="room-html">
22 <el-row> 9 <el-row>
23 <el-col class="video-item" :span="24" > 10 <el-col class="video-item" :span="24" >
24 - <MachineRoom v-if="src" :src="src" ref="machineRoom" ></MachineRoom> 11 + <MachineRoom v-if="src" :src="src" :commandNameDataItem="commandNameDataItem" ref="machineRoom" ></MachineRoom>
25 </el-col> 12 </el-col>
26 </el-row> 13 </el-row>
27 </div> 14 </div>
@@ -22,7 +22,7 @@ export default { @@ -22,7 +22,7 @@ export default {
22 return { 22 return {
23 domainName:sessionStorage.getItem('domainName'), 23 domainName:sessionStorage.getItem('domainName'),
24 accessToken:localStorage.getItem('access_token'), 24 accessToken:localStorage.getItem('access_token'),
25 - commandName:'',//下拉选择默认显示名称 25 + // commandName:'',//下拉选择默认显示名称
26 htmlName:'',//机房组件名称-html名称 26 htmlName:'',//机房组件名称-html名称
27 commandVal:'',//下拉选择选中值 27 commandVal:'',//下拉选择选中值
28 src:'',//机房布局html地址 28 src:'',//机房布局html地址
@@ -34,30 +34,34 @@ export default { @@ -34,30 +34,34 @@ export default {
34 const {proxy} = Vue.getCurrentInstance(); 34 const {proxy} = Vue.getCurrentInstance();
35 proxy.htmlName=Vue.ref(); 35 proxy.htmlName=Vue.ref();
36 proxy.commandVal=Vue.ref() 36 proxy.commandVal=Vue.ref()
37 - proxy.commandName=Vue.ref(); 37 + // proxy.commandName=Vue.ref();
38 proxy.src=Vue.ref(); 38 proxy.src=Vue.ref();
  39 + const commandNameDataItem=Vue.ref();
  40 + const allComponents=Vue.ref();
39 // 获取状态 41 // 获取状态
40 const { changeIndex} = indirectManage() 42 const { changeIndex} = indirectManage()
41 43
42 // 挂载完 44 // 挂载完
43 Vue.onMounted(() => { 45 Vue.onMounted(() => {
44 - proxy.commandVal='one'; 46 + proxy.commandVal=props.commandNameData[0].machineRoomCode;
45 proxy.getMachine(proxy.commandVal); 47 proxy.getMachine(proxy.commandVal);
46 48
47 }) 49 })
48 //初始获取默认机房选择信息 50 //初始获取默认机房选择信息
49 const getMachine=(command)=>{ 51 const getMachine=(command)=>{
50 //commandNameData机房机柜数据 52 //commandNameData机房机柜数据
  53 + let allComponent=[];
51 props.commandNameData.map((item,index)=>{ 54 props.commandNameData.map((item,index)=>{
52 - if(command==item.val){  
53 - proxy.htmlName=item.htmlName;  
54 - proxy.commandName=item.name;  
55 - proxy.commandVal=item.val; 55 + if(command==item.machineRoomCode){
  56 + // proxy.htmlName=item.htmlName;
  57 + // proxy.commandName=item.name;
  58 + proxy.commandVal=item.machineRoomCode;
  59 + proxy.commandNameDataItem=item;
56 } 60 }
57 }) 61 })
58 // proxy.src='/h5/machineroom/'+proxy.htmlName+'.html?access_token='+proxy.accessToken+'&changeIndex='+proxy.changeIndex 62 // proxy.src='/h5/machineroom/'+proxy.htmlName+'.html?access_token='+proxy.accessToken+'&changeIndex='+proxy.changeIndex
59 //根据htmlName确定引入的机房 63 //根据htmlName确定引入的机房
60 - proxy.src=proxy.htmlName 64 + proxy.src=proxy.commandVal
61 65
62 } 66 }
63 const handleCommand=(command,event)=>{ 67 const handleCommand=(command,event)=>{
@@ -70,7 +74,9 @@ export default { @@ -70,7 +74,9 @@ export default {
70 74
71 return{ 75 return{
72 getMachine, 76 getMachine,
73 - handleCommand 77 + handleCommand,
  78 + commandNameDataItem,
  79 + allComponents
74 } 80 }
75 } 81 }
76 } 82 }
1 -<!--<iframe v-if="src" style="width:90%;height:720px;" :src="src" frameborder="0" ref="machineIframe" ></iframe>-->  
2 -<HuzhouOne v-if="showNum==1" :src="machineData"></HuzhouOne>  
3 -<HuzhouTwo v-if="showNum==2" :src="machineData"></HuzhouTwo>  
4 -<HuzhouThree v-if="showNum==3" :src="machineData"></HuzhouThree>  
5 -<Xiaoshansecond v-if="showNum==4" :src="machineData"></Xiaoshansecond>  
6 -<Xiaoshanthird v-if="showNum==5" :src="machineData"></Xiaoshanthird>  
7 -<Xiaoshanseven v-if="showNum==6" :src="machineData"></Xiaoshanseven> 1 +<component :is="srcName" :src="machineData" />
@@ -19,23 +19,16 @@ export default { @@ -19,23 +19,16 @@ export default {
19 ), 19 ),
20 'Xiaoshanseven': Vue.defineAsyncComponent( 20 'Xiaoshanseven': Vue.defineAsyncComponent(
21 () => myImport('views/commonComponents/xiaoshanseven/index') 21 () => myImport('views/commonComponents/xiaoshanseven/index')
22 - ), 22 + )
23 }, 23 },
24 - props:['src'], 24 + props:['src','commandNameDataItem'],
25 data(){ 25 data(){
26 return { 26 return {
27 domainName:sessionStorage.getItem('domainName'), 27 domainName:sessionStorage.getItem('domainName'),
28 accessToken:localStorage.getItem('access_token'), 28 accessToken:localStorage.getItem('access_token'),
29 isDetailShow:false,//详情页 29 isDetailShow:false,//详情页
30 // changeIndexNav:this.changeIndex,//nav是否点击变化 30 // changeIndexNav:this.changeIndex,//nav是否点击变化
31 - htmmlNameData:[  
32 - {name:'huzhouzaibeione',val:'湖州灾备机房一'},  
33 - {name:'huzhouzaibeitwo',val:'湖州灾备机房二'},  
34 - {name:'huzhouzaibeithree',val:'湖州灾备机房三'},  
35 - {name:'xiaoshansecond',val:'萧山IDC二号机房'},  
36 - {name:'xiaoshanthird',val:'萧山IDC三号机房'},  
37 - {name:'xiaoshanseven',val:'萧山IDC七号机房'},  
38 - ], 31 +
39 srcName:this.src, 32 srcName:this.src,
40 machineData:'',//机房信息数据 33 machineData:'',//机房信息数据
41 // src:'/h5/machineroom/huzhouzaibeione.html?access_token='+this.accessToken 34 // src:'/h5/machineroom/huzhouzaibeione.html?access_token='+this.accessToken
@@ -54,27 +47,24 @@ export default { @@ -54,27 +47,24 @@ export default {
54 setup(props, {attrs, slots, emit}) { 47 setup(props, {attrs, slots, emit}) {
55 const {proxy} = Vue.getCurrentInstance(); 48 const {proxy} = Vue.getCurrentInstance();
56 const showNum=Vue.ref() 49 const showNum=Vue.ref()
  50 + const componentName=Vue.ref();
57 51
58 52
59 // 挂载完 53 // 挂载完
60 Vue.onMounted(() => { 54 Vue.onMounted(() => {
61 -  
62 proxy.getName(); 55 proxy.getName();
63 }) 56 })
64 const getName=()=>{ 57 const getName=()=>{
65 - proxy.htmmlNameData.map((item,index)=>{  
66 - if(proxy.srcName==item.name){  
67 - proxy.showNum=index+1;  
68 - proxy.machineData=item;  
69 - }  
70 - })  
71 - console.log("src",proxy.src,proxy.showNum) 58 + console.log("accept",proxy.srcName, props.commandNameDataItem)
  59 +
  60 + proxy.machineData= props.commandNameDataItem;
72 } 61 }
73 62
74 return{ 63 return{
75 // src:'/h5/machineroom/'+props.htmlName+'.html?access_token='+proxy.accessToken 64 // src:'/h5/machineroom/'+props.htmlName+'.html?access_token='+proxy.accessToken
76 getName, 65 getName,
77 - showNum 66 + showNum,
  67 + componentName
78 68
79 } 69 }
80 } 70 }
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 <div class='img-serve' > 12 <div class='img-serve' >
13 13
14 <img src="/vue3/src/assets/images/machineRoom/icon-state.png" alt="" class='state'> 14 <img src="/vue3/src/assets/images/machineRoom/icon-state.png" alt="" class='state'>
15 - <div class='img-serve-text'>{{item.provider}}</div> 15 + <div class='img-serve-text'>{{item.resName}}</div>
16 <div class='lamp'> 16 <div class='lamp'>
17 <img src="/vue3/src/assets/images/machineRoom/icon-weblogical.png" alt="" class='img-weblog'> 17 <img src="/vue3/src/assets/images/machineRoom/icon-weblogical.png" alt="" class='img-weblog'>
18 <div class='img-lamp'> 18 <div class='img-lamp'>
@@ -35,7 +35,7 @@ @@ -35,7 +35,7 @@
35 <div class='info-contain'> 35 <div class='info-contain'>
36 <div class='info-text'>机柜信息</div> 36 <div class='info-text'>机柜信息</div>
37 <div class='info-text-bot'> 37 <div class='info-text-bot'>
38 - <p>机 房:{{machineData.val}}</p> 38 + <p>机 房:{{machineData.machineRoomName}}</p>
39 <p>机柜编号:{{detailData.name}}</p> 39 <p>机柜编号:{{detailData.name}}</p>
40 <p>机柜容量:{{infoData.cabinetCapacity}}</p> 40 <p>机柜容量:{{infoData.cabinetCapacity}}</p>
41 <p>设备数量:{{infoData.deviceNum}}台</p> 41 <p>设备数量:{{infoData.deviceNum}}台</p>
@@ -14,7 +14,8 @@ export default { @@ -14,7 +14,8 @@ export default {
14 isCenter:false,//是否居中--true代表湖州机房,false代表萧山机房 14 isCenter:false,//是否居中--true代表湖州机房,false代表萧山机房
15 serviceData:[],//机柜的服务器数据 15 serviceData:[],//机柜的服务器数据
16 deviceDataInfo:'',//设备详细信息 16 deviceDataInfo:'',//设备详细信息
17 - deviceDatas: [ 17 + deviceDatas:[],
  18 + /* deviceDatas: [
18 { 19 {
19 name:'E12',//机柜名称 20 name:'E12',//机柜名称
20 21
@@ -158,7 +159,7 @@ export default { @@ -158,7 +159,7 @@ export default {
158 deviceNum:'1', 159 deviceNum:'1',
159 cabinetCapacity :'42U', 160 cabinetCapacity :'42U',
160 }, 161 },
161 - ],//服务器设备信息 162 + ],//服务器设备信息*/
162 infoData:'',//设备详细信息 163 infoData:'',//设备详细信息
163 // isShowDevice:false,//是否显示设备信息 164 // isShowDevice:false,//是否显示设备信息
164 165
@@ -173,26 +174,17 @@ export default { @@ -173,26 +174,17 @@ export default {
173 174
174 // 挂载完 175 // 挂载完
175 Vue.onMounted(() => { 176 Vue.onMounted(() => {
176 - if(props.machineData.name.indexOf('huzhou')!=-1){  
177 - proxy.isCenter=true;  
178 - proxy.theirRoom='湖州灾备';  
179 - }else{  
180 - proxy.isCenter=false;  
181 - proxy.theirRoom='兴议机房'; 177 + console.log('&&&',proxy.machineData)
182 178
183 - }  
184 proxy.getData(); 179 proxy.getData();
185 - // proxy.getDeviceInfo();  
186 180
187 }) 181 })
188 const getData=()=>{ 182 const getData=()=>{
189 let parmas={ 183 let parmas={
190 - theirRoom:proxy.theirRoom, 184 + theirRoomId:props.machineData.machineRoomId,
191 theirCabinet:CabinetNum 185 theirCabinet:CabinetNum
192 } 186 }
193 $.get(proxy.domainName+'/api-web/v32/res/cabinet?access_token='+proxy.accessToken,parmas,function (res){ 187 $.get(proxy.domainName+'/api-web/v32/res/cabinet?access_token='+proxy.accessToken,parmas,function (res){
194 -  
195 - console.log("res1",res)  
196 if(res){ 188 if(res){
197 let resData=res.data; 189 let resData=res.data;
198 let deviceDatas=[]; 190 let deviceDatas=[];
@@ -204,7 +196,6 @@ export default { @@ -204,7 +196,6 @@ export default {
204 deviceData:resData 196 deviceData:resData
205 }) 197 })
206 proxy.deviceDatas=deviceDatas; 198 proxy.deviceDatas=deviceDatas;
207 - console.log("devdats",proxy.deviceDatas)  
208 proxy.getDeviceInfo() 199 proxy.getDeviceInfo()
209 200
210 } 201 }
@@ -232,7 +223,7 @@ export default { @@ -232,7 +223,7 @@ export default {
232 itemD.serviceClass='img-serve-'+serveNum;//设备的css的class 223 itemD.serviceClass='img-serve-'+serveNum;//设备的css的class
233 itemD.uClass=''; 224 itemD.uClass='';
234 if(leftStr>1){ 225 if(leftStr>1){
235 - let bottom=(leftStr-1)*17; 226 + let bottom=(leftStr-1)*16;
236 itemD.uClass='bottom:'+bottom+'px'; 227 itemD.uClass='bottom:'+bottom+'px';
237 228
238 } 229 }
@@ -14,46 +14,6 @@ export default { @@ -14,46 +14,6 @@ export default {
14 jfdata:'', 14 jfdata:'',
15 dialogMachineName:'', 15 dialogMachineName:'',
16 commandNameData:'', 16 commandNameData:'',
17 - commandNameDataH:[  
18 - {  
19 - name:'湖州灾备机房一',  
20 - htmlName:'huzhouzaibeione',  
21 - val:'one'  
22 - },  
23 - {  
24 - name:'湖州灾备机房二',  
25 - htmlName:'huzhouzaibeitwo',  
26 - val:'two'  
27 - },  
28 - {  
29 - name:'湖州灾备机房三',  
30 - htmlName:'huzhouzaibeithree',  
31 - val:'three'  
32 - }  
33 - ],//机房布局html数据  
34 - commandNameDataX:[  
35 - {  
36 - name:'萧山IDC二号机房',  
37 - htmlName:'xiaoshansecond',  
38 - val:'one'  
39 - },  
40 - {  
41 - name:'萧山IDC三号机房',  
42 - htmlName:'xiaoshanthird',  
43 - val:'two'  
44 - },  
45 - {  
46 - name:'萧山IDC七号机房',  
47 - htmlName:'xiaoshanseven',  
48 - val:'three'  
49 - }  
50 - // {  
51 - // name:'兴议二号机房',  
52 - // htmlName:'xiaoshansecond',  
53 - // val:'one'  
54 - // }  
55 - ],  
56 - commandName:'',//下拉选择默认显示名称  
57 htmlName:'',//机房组件名称-html名称 17 htmlName:'',//机房组件名称-html名称
58 commandVal:'',//下拉选择选中值 18 commandVal:'',//下拉选择选中值
59 src:'',//机房布局html地址 19 src:'',//机房布局html地址
@@ -63,7 +23,6 @@ export default { @@ -63,7 +23,6 @@ export default {
63 const {proxy} = Vue.getCurrentInstance(); 23 const {proxy} = Vue.getCurrentInstance();
64 proxy.htmlName=Vue.ref(); 24 proxy.htmlName=Vue.ref();
65 proxy.commandVal=Vue.ref() 25 proxy.commandVal=Vue.ref()
66 - proxy.commandName=Vue.ref();  
67 proxy.src=Vue.ref(); 26 proxy.src=Vue.ref();
68 27
69 // 挂载完 28 // 挂载完
@@ -71,22 +30,7 @@ export default { @@ -71,22 +30,7 @@ export default {
71 $.get(proxy.domainName +proxy.apiUrl+'?access_token='+localStorage.getItem('access_token'),function (res) { 30 $.get(proxy.domainName +proxy.apiUrl+'?access_token='+localStorage.getItem('access_token'),function (res) {
72 if(res.data){ 31 if(res.data){
73 proxy.jfdata=res.data; 32 proxy.jfdata=res.data;
74 - /* const html = $("#sjzx_machineroom_id_Tmpl").render(res.data);  
75 - $("#sjzx_machineroom_id").html(html);  
76 - //机房点击事件  
77 - $(".sjzx_machineroom").on("click",function () {  
78 - const name = $(this).attr("name");  
79 - layer.open({  
80 - type:2  
81 - , shade: 0.6 //遮罩透明度  
82 - , maxmin: false //允许全屏最小化  
83 - , anim: 1 //0-6的动画形式,-1不开启  
84 - , content:['http://127.0.0.1:8081/video.html?type='+name+'','no']  
85 - , area:["1100px",'720px']  
86 - // , title: true //不显示标题栏  
87 - // , title: name  
88 - })  
89 - });*/ 33 +
90 } 34 }
91 }) 35 })
92 36
@@ -98,12 +42,7 @@ export default { @@ -98,12 +42,7 @@ export default {
98 const isShowOuter=(item)=>{ 42 const isShowOuter=(item)=>{
99 proxy.dialogMachineName=item.machineRoomName; 43 proxy.dialogMachineName=item.machineRoomName;
100 proxy.outerVisible = true; 44 proxy.outerVisible = true;
101 - if(item.layout == 0){  
102 - proxy.commandNameData=proxy.commandNameDataH;//湖州机房布局数据  
103 - }else{  
104 - proxy.commandNameData=proxy.commandNameDataX;//兴议机房布局数据  
105 -  
106 - } 45 + proxy.getData(item);
107 } 46 }
108 //关闭弹框时清空数据 47 //关闭弹框时清空数据
109 const closeDialog=()=>{ 48 const closeDialog=()=>{
@@ -111,13 +50,38 @@ export default { @@ -111,13 +50,38 @@ export default {
111 50
112 } 51 }
113 52
  53 + /*获取机房数据
  54 + * */
  55 + let roomSecondData=Vue.ref([]);//兴议或者湖州下层机房数据
  56 + const getData=(roomRow)=>{
  57 + proxy.$http.get('/api-web/machineroom/list',{},function (res){
  58 + if(res && res.data){
  59 + let roomSecondDataArr=res.data;
  60 + let roomSecondData=[];
  61 +
  62 + roomSecondDataArr.map((item,index)=>{
  63 + if(item.parentId!='0' && roomRow.machineRoomId==item.parentId){
  64 + roomSecondData.push(item)
  65 + }
  66 + })
  67 + proxy.roomSecondData=roomSecondData;
  68 +
  69 + proxy.commandNameData=proxy.roomSecondData;//机房布局数据
  70 +
  71 + console.log("下层机房数据",proxy.roomSecondData)
  72 + }
  73 + })
  74 + }
  75 +
114 return{ 76 return{
115 centerDialogVisible: Vue.ref(false), 77 centerDialogVisible: Vue.ref(false),
116 outerVisible: Vue.ref(false), 78 outerVisible: Vue.ref(false),
117 innerVisible: Vue.ref(false), 79 innerVisible: Vue.ref(false),
118 isShowOuter, 80 isShowOuter,
119 isShow, 81 isShow,
120 - closeDialog 82 + closeDialog,
  83 + roomSecondData,
  84 + getData
121 } 85 }
122 } 86 }
123 } 87 }