ZZJ
2022-04-02 45faaf27722588e92050e2e3eace9b3704377048
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
<template>
  <div class="UnbindBox">
    <div class="icon iconfont">&#xe601;</div>
    <div class="warn">解绑后该设备将从设备列表中移除,请确认是否移除</div>
    <div class="des">如需移除,请输入管理员密码,然后点击“确认”按钮</div>
    <el-input v-model="password" placeholder="请输入管理员密码"></el-input>
    <div class="btns">
      <div class="button cancel" @click="close">取消</div>
      <div class="button confirm" @click="confirm">确定</div>
    </div>
 
    <div class="close iconfont" @click="close">&#xe60f;</div>
  </div>
</template>
 
<script>
import { unbind } from "@/api/device";
 
export default {
  props: {
    id: {},
  },
  data() {
    return {
      password: "",
    };
  },
  methods: {
    close() {
      this.$emit("close");
    },
    async confirm() {
      let res = {};
      try {
        res = await unbind({
          ids: [this.id],
          password: this.password,
          username: JSON.parse(sessionStorage.getItem("userInfo")).username,
        });
      } catch (err) {
        this.$notify({
          type: "error",
          message: "解绑失败",
          duration: 2500,
          offset: 57,
        });
      }
      if (res.success == true) {
        this.$notify({
          type: "success",
          message: "解绑成功",
          duration: 2500,
          offset: 57,
        });
        this.$emit("close");
      } else {
        this.$notify({
          type: "error",
          message: "解绑失败",
          duration: 2500,
          offset: 57,
        });
      }
    },
  },
};
</script>
 
<style lang="scss" scoped>
.UnbindBox {
  position: fixed;
  top: 230px;
  left: 50%;
  margin-left: -230px;
  box-sizing: border-box;
  padding: 0 30px;
  width: 460px;
  height: 312px;
  text-align: center;
  font-size: 14px;
  background: #ffffff;
  box-shadow: 0px 2px 16px rgba(0, 43, 106, 0.25);
  z-index: 2;
 
  .icon {
    margin: 30px 0 20px 0;
    font-size: 48px;
    color: rgb(255, 75, 51);
  }
 
  .warn {
    line-height: 28px;
    font-weight: 700;
    color: #ff4b33;
  }
 
  .des {
    margin-bottom: 20px;
  }
 
  .el-input ::v-deep {
    margin-bottom: 28px;
 
    .el-input__inner {
      color: #3d3d3d;
      border-radius: 0;
      border-color: #c0c5cc;
      &::-webkit-input-placeholder {
        color: #999999;
      }
 
      &:focus {
        border-color: #0065ff;
      }
    }
  }
 
  .btns {
    display: flex;
    justify-content: end;
    text-align: center;
    line-height: 40px;
 
    .confirm {
      margin-left: 10px;
      width: 104px;
      height: 40px;
      background: #0065ff;
      color: #fff;
    }
 
    .cancel {
      width: 104px;
      height: 40px;
      border: 1px solid #0065ff;
      color: #0065ff;
    }
  }
 
  .close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1px;
    color: 187, 187, 187;
    cursor: pointer;
  }
}
</style>