ZZJ
2022-07-27 0daac085e308ab5dd5557048bbcb28473ae1b7df
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<template>
  <div class="DevList">
    <div class="title">GB28181配置</div>
    <div class="empty" v-if="devList.length === 0">
      <img src="/images/search/1.png" alt="" />
      <div class="des">您还未添加集群或设备,请在设备管理中添加</div>
      <div class="button add" @click="$router.push('/equipmentList')">
        立即添加
      </div>
    </div>
    <div class="list scroll">
      <div class="devItem" v-for="(item, index) in clusterList" :key="index">
        <div class="mainInfo">
          <img src="/images/hashrate/cluster.png" alt="" />
 
          <div class="right">
            <div class="name">{{ item.cluster_name }}</div>
            <div class="ip">{{ item.virtual_ip }}</div>
            <div class="number">设备总量:{{ item.nodeNum }}</div>
          </div>
 
          <div
            class="button set"
            @click="setting({ clusterId: item.cluster_id }, item.nodeList)"
          >
            配置
          </div>
        </div>
      </div>
      <div
        class="devItem"
        v-for="(item, index) in devList"
        :key="index + 'dev'"
      >
        <div class="mainInfo">
          <img src="/images/hashrate/equipment.png" alt="" />
 
          <div class="right">
            <div class="name">{{ item.devName }}</div>
            <div class="ip">{{ item.devIp }}</div>
          </div>
 
          <div class="button set" @click="setting({ devId: item.devId })">
            配置
          </div>
        </div>
      </div>
    </div>
 
    <SettingBox
      v-if="showSettingBox"
      @close="showSettingBox = false"
      :id="idObj"
      :nodeList="nodeList"
    ></SettingBox>
  </div>
</template>
 
<script>
import SettingBox from "@/views/GB28181/components/SettingBox";
import { getClusterDevList } from "@/api/clusterManage";
 
export default {
  components: {
    SettingBox,
  },
  created() {
    this.getClusterDevList();
  },
  data() {
    return {
      clusterList: [],
      devList: [],
      showSettingBox: false,
      idObj: {},
      nodeList: [],
    };
  },
  methods: {
    async getClusterDevList() {
      const res = await getClusterDevList();
      if (res && res.success) {
        this.clusterList = res.data.clusterList;
        this.devList = res.data.devList;
      }
    },
    setting(id, nodeList) {
      this.idObj = id;
      this.nodeList = nodeList ? nodeList : [];
      this.showSettingBox = true;
    },
  },
};
</script>
 
<style lang="scss" scoped >
.DevList {
  position: relative;
  box-sizing: border-box;
  padding: 20px;
  width: 1280px;
  height: 770px;
  background-color: #fff;
  margin: 0 auto;
 
  .title {
    margin-bottom: 20px;
    height: 20px;
    padding-left: 20px;
    font-weight: 700;
    font-size: 16px;
    border-left: 4px solid #0065ff;
  }
 
  .empty {
    text-align: center;
 
    img {
      margin-top: 150px;
      margin-bottom: 10px;
      width: 260px;
    }
 
    .des {
      margin-bottom: 30px;
      font-size: 14px;
    }
 
    .add {
      margin: 0 auto;
      width: 112px;
      height: 40px;
      text-align: center;
      line-height: 40px;
      color: #fff;
      background-color: #0065ff;
    }
  }
 
  .list {
    display: flex;
    flex-wrap: wrap;
    overflow-y: auto;
    height: 710px;
 
    .devItem {
      position: relative;
      margin: 0 15px 20px 0;
      width: 295px;
      height: 150px;
      border: 1px solid #c0c5cc;
      border-radius: 5px;
 
      .mainInfo {
        display: flex;
        padding: 20px;
 
        img {
          margin-right: 20px;
          width: 88px;
        }
      }
 
      .right {
        .name {
          margin-bottom: 6px;
          font-size: 16px;
          font-weight: 700;
        }
 
        .ip,
        .number {
          margin-bottom: 2px;
          font-size: 12px;
          color: #666;
        }
      }
 
      .set {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 40px;
        line-height: 40px;
        text-align: center;
        border: 1px solid #c0c5cc;
        font-size: 16px;
        color: #0065ff;
      }
 
      &:nth-child(4n) {
        margin-right: 0;
      }
 
      &:hover {
        box-shadow: 0px 2px 16px 0px rgba(0, 43, 106, 0.25);
 
        .set {
          color: #fff;
          background-color: #0065ff;
          border-color: #0065ff;
        }
      }
    }
  }
}
</style>