From 246772ecc677b15cc9be2fbdd63d50f6216e099f Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期三, 20 四月 2022 16:18:24 +0800
Subject: [PATCH] 注册登录验证码
---
src/views/equipmentManagement/equipmentList/components/AddBox.vue | 259 +++++++++++++++++++++++----------------------------
1 files changed, 118 insertions(+), 141 deletions(-)
diff --git a/src/views/equipmentManagement/equipmentList/components/AddBox.vue b/src/views/equipmentManagement/equipmentList/components/AddBox.vue
index 86a3bdb..24e66fe 100644
--- a/src/views/equipmentManagement/equipmentList/components/AddBox.vue
+++ b/src/views/equipmentManagement/equipmentList/components/AddBox.vue
@@ -1,6 +1,6 @@
<template>
<div class="addBox">
- <div class="title">鍔犲叆闆嗙兢</div>
+ <div class="title">娣诲姞璁惧</div>
<div class="close iconfont" @click="close()"></div>
@@ -9,8 +9,8 @@
v-model="searchContent"
placeholder="璇疯緭鍏ラ泦缇P/闆嗙兢鍚嶇О/璁惧IP/璁惧鍚嶇О"
></el-input>
- <div class="button" @click="listType = 'cluster'">鎼滅储闆嗙兢</div>
- <div class="button" @click="listType = 'equipment'">鎼滅储璁惧</div>
+ <div class="button" @click="searchCluster">鎼滅储闆嗙兢</div>
+ <div class="button" @click="searchDevice">鎼滅储璁惧</div>
</div>
<div class="clusterList">
@@ -28,21 +28,28 @@
<div class="row" v-for="(item, index) in clusterList" :key="index">
<div class="content">
<div class="rowItem index">{{ index + 1 }}</div>
- <div class="rowItem name">{{ item.name }}</div>
- <div class="rowItem ip">{{ item.ip }}</div>
+ <div class="rowItem name">{{ item.clusterName }}</div>
+ <div class="rowItem ip">{{ item.virtualIp }}</div>
<div class="rowItem status">
- <div v-if="item.status == 1" class="status green">宸叉坊鍔�</div>
+ <div v-if="!item.canAdd" class="status green">宸叉坊鍔�</div>
<div v-else class="status">鏈坊鍔�</div>
</div>
<div class="rowItem options">
<!-- 娣诲姞 -->
- <span class="iconfont option" @click="showPasswordBox = true"
- ></span
- >
- <!-- 闆嗙兢璇︽儏 -->
- <span class="iconfont option" @click="showChildrenLIst(index)"
- ></span
- >
+ <span v-if="!item.canAdd">-</span>
+ <template v-else>
+ <span
+ class="iconfont option"
+ @click="showBox('cluster', item.clusterId)"
+ ></span
+ >
+ <!-- 闆嗙兢璇︽儏 -->
+ <span
+ class="iconfont option"
+ @click="showChildrenLIst(index, item.clusterId)"
+ ></span
+ >
+ </template>
</div>
</div>
@@ -63,19 +70,19 @@
>
</el-table-column>
<el-table-column
- prop="id"
+ prop="dev_id"
label="璁惧ID"
width="146"
></el-table-column>
<el-table-column
- prop="ip"
+ prop="dev_ip"
label="璁惧IP"
width="146"
></el-table-column>
<el-table-column
- prop="name"
+ prop="dev_name"
label="璁惧鍚嶇О"
width="240"
></el-table-column>
@@ -101,21 +108,29 @@
class-name="index"
>
</el-table-column>
- <el-table-column prop="id" label="璁惧ID" width="107"></el-table-column>
<el-table-column
- prop="name"
+ prop="devId"
+ label="璁惧ID"
+ width="107"
+ ></el-table-column>
+ <el-table-column
+ prop="devName"
label="璁惧鍚嶇О"
width="107"
></el-table-column>
- <el-table-column prop="ip" label="璁惧IP" width="107"></el-table-column>
<el-table-column
- prop="cluster"
+ prop="devIp"
+ label="璁惧IP"
+ width="107"
+ ></el-table-column>
+ <el-table-column
+ prop="clusterName"
label="鎵�灞為泦缇�"
width="107"
></el-table-column>
<el-table-column label="鐘舵��" width="107">
<template slot-scope="scope">
- <div v-if="scope.row.status == 1" class="status green">宸叉坊鍔�</div>
+ <div v-if="!scope.row.canAdd" class="status green">宸叉坊鍔�</div>
<div v-else class="status">鏈坊鍔�</div>
</template>
</el-table-column>
@@ -124,7 +139,11 @@
<template slot-scope="scope">
<div class="options" v-if="scope">
<!-- 娣诲姞 -->
- <span class="iconfont option" @click="showPasswordBox = true"
+ <span v-if="!scope.row.canAdd">-</span>
+ <span
+ v-else
+ class="iconfont option"
+ @click="showBox('dev', scope.row.devId, scope.row.clusterId)"
></span
>
</div>
@@ -144,13 +163,21 @@
<el-input v-model="auth_password"></el-input>
<div class="btns">
<div class="cancel button" @click="showPasswordBox = false">鍙栨秷</div>
- <div class="submit button" @click="showPasswordBox = false">鎻愪氦</div>
+ <div class="submit button" @click="submit">鎻愪氦</div>
</div>
</div>
</div>
</template>
<script>
+import {
+ findDeviceListAll,
+ findClustersBySearch,
+ getDevicesByCluster,
+ addCluster,
+ addDeviceToUser,
+} from "@/api/device";
+
export default {
data() {
return {
@@ -159,131 +186,19 @@
showClusterChild: null, //灞曠ず闆嗙兢鍒楄〃涓嬫媺鍒楄〃
clusterHeader: ["搴忓彿", "闆嗙兢鍚嶇О", "IP鍦板潃", "鐘舵��", "鎿嶄綔"], //闆嗙兢鍒楄〃琛ㄥご
showPasswordBox: false,
- clusterList: [
- {
- name: "闆嗙兢1",
- ip: "192.168.7.45",
- status: "1",
- },
- {
- name: "闆嗙兢1",
- ip: "192.168.7.45",
- status: "1",
- },
- {
- name: "闆嗙兢1",
- ip: "192.168.7.45",
- status: "0",
- },
- {
- name: "闆嗙兢1",
- ip: "192.168.7.45",
- status: "0",
- },
- ],
- equipmentList: [
- {
- id: "BJS23123132",
- name: "鏈嶅姟鍣�20.10",
- ip: "192.168.7.45",
- cluster: "闆嗙兢1",
- status: "1",
- },
- {
- id: "BJS23123132",
- name: "鏈嶅姟鍣�20.10",
- ip: "192.168.7.45",
- cluster: "闆嗙兢1",
- status: "1",
- },
- {
- id: "BJS23123132",
- name: "鏈嶅姟鍣�20.10",
- ip: "192.168.7.45",
- cluster: "闆嗙兢1",
- status: "1",
- },
- {
- id: "BJS23123132",
- name: "鏈嶅姟鍣�20.10",
- ip: "192.168.7.45",
- cluster: "闆嗙兢1",
- status: "1",
- },
- {
- id: "BJS23123132",
- name: "鏈嶅姟鍣�20.10",
- ip: "192.168.7.45",
- cluster: "闆嗙兢1",
- status: "1",
- },
- {
- id: "BJS23123132",
- name: "鏈嶅姟鍣�20.10",
- ip: "192.168.7.45",
- cluster: "闆嗙兢1",
- status: "1",
- },
- {
- id: "BJS23123132",
- name: "鏈嶅姟鍣�20.10",
- ip: "192.168.7.45",
- cluster: "闆嗙兢1",
- status: "1",
- },
- {
- id: "BJS23123132",
- name: "鏈嶅姟鍣�20.10",
- ip: "192.168.7.45",
- cluster: "闆嗙兢1",
- status: "1",
- },
- {
- id: "BJS23123132",
- name: "鏈嶅姟鍣�20.10",
- ip: "192.168.7.45",
- cluster: "闆嗙兢1",
- status: "1",
- },
- ],
- overList: [
- {
- id: "BJS23123132",
- name: "鏈嶅姟鍣�20.10",
- ip: "192.168.7.45",
- cluster: "闆嗙兢1",
- status: "1",
- },
- {
- id: "BJS23123132",
- name: "鏈嶅姟鍣�20.10",
- ip: "192.168.7.45",
- cluster: "闆嗙兢1",
- status: "1",
- },
- {
- id: "BJS23123132",
- name: "鏈嶅姟鍣�20.10",
- ip: "192.168.7.45",
- cluster: "闆嗙兢1",
- status: "1",
- },
- {
- id: "BJS23123132",
- name: "鏈嶅姟鍣�20.10",
- ip: "192.168.7.45",
- cluster: "闆嗙兢1",
- status: "1",
- },
- ],
+ clusterList: [],
+ equipmentList: [],
+ overList: [],
auth_password: "", //鎺堟潈绉橀挜
+ addObj: {},
};
},
+
methods: {
close() {
this.$emit("close");
},
- showChildrenLIst(index) {
+ async showChildrenLIst(index, id) {
if (this.showClusterChild === index) {
this.showClusterChild = null;
return;
@@ -294,6 +209,68 @@
setTimeout(() => {
this.showClusterChild = index;
}, 400);
+
+ const res = await getDevicesByCluster({
+ clusterId: id,
+ });
+ if (res && res.success) {
+ this.overList = res.data.list;
+ }
+ },
+ async getCluster() {
+ const res = await findClustersBySearch({
+ InputText: this.searchContent,
+ Page: 1,
+ Size: 10000,
+ });
+ if (res && res.success) {
+ this.clusterList = res.data.list;
+ }
+ },
+
+ async getDevice() {
+ const res = await findDeviceListAll({
+ InputText: this.searchContent,
+ Page: 1,
+ Size: 10000,
+ });
+ if (res && res.success) {
+ this.equipmentList = res.data.list;
+ }
+ },
+
+ searchCluster() {
+ this.getCluster();
+ this.listType = "cluster";
+ },
+
+ searchDevice() {
+ this.getDevice();
+ this.listType = "equipment";
+ },
+
+ async submit() {
+ if (this.addObj.type == "cluster") {
+ const res = await addCluster({
+ clusterPwd: this.auth_password,
+ clusterId: this.addObj.id,
+ });
+ } else {
+ const res = await addDeviceToUser({
+ clusterPwd: this.auth_password,
+ deviceId: this.addObj.id,
+ clusterId: this.addObj.cid,
+ });
+ }
+ },
+ showBox(type, id, cid) {
+ console.log(cid);
+ this.showPasswordBox = true;
+ this.addObj = {
+ type,
+ id,
+ cid,
+ };
},
},
};
--
Gitblit v1.8.0