ZZJ
2022-07-14 2b99047683332624832c1dfcae596e957a710b7d
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
<template>
  <div class="basic-info">
    <div class="head-name">基本资料</div>
 
    <el-form
      :model="userInfo"
      :rules="rules"
      :label-position="'left'"
      ref="ruleForm"
      label-width="90px"
      class="add-ruleForm"
    >
      <div class="area-title">基本信息</div>
      <el-form-item label="用户名" prop="username">
        <el-input v-model="userInfo.username" style="width: 200px"></el-input>
      </el-form-item>
      <el-form-item label="注册类型" prop="userType">
        <el-radio-group v-model="userInfo.userType">
          <el-radio :label="1">个人</el-radio>
          <el-radio :label="2">公司</el-radio>
        </el-radio-group>
      </el-form-item>
 
      <el-form-item label="姓名" prop="trueName">
        <el-input v-model="userInfo.trueName" style="width: 200px"></el-input>
      </el-form-item>
 
      <div class="area-title" style="margin-top: 50px">业务信息</div>
 
      <el-form-item label="行业应用" prop="industryId">
        <el-select
          v-model="userInfo.industryId"
          placeholder="行业"
          style="width: 410px"
        >
          <el-option
            v-for="(item, index) in industrys"
            :label="item.name"
            :value="item.id"
            :key="index"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="公司名称" prop="companyName">
        <el-input
          v-model="userInfo.companyName"
          style="width: 410px"
        ></el-input>
      </el-form-item>
 
      <div class="area-title" style="margin-top: 50px">联系信息</div>
 
      <el-form-item label="所在地区" prop="areaId">
        <el-cascader
          v-model="userInfo.address"
          :props="options"
          style="width: 410px"
        ></el-cascader>
      </el-form-item>
      <el-form-item label="手机号" prop="phoneNum">
        <el-input v-model="userInfo.phoneNum" style="width: 200px"></el-input>
      </el-form-item>
 
      <el-form-item label="邮箱" prop="email">
        <el-input v-model="userInfo.email" style="width: 410px"></el-input>
      </el-form-item>
    </el-form>
    <div class="btns">
      <div class="searchBtn" @click="save">保存</div>
    </div>
  </div>
</template>
 
<script>
import { getUserInfo, getAreas, getDic, entireUserInfo } from "@/api/login";
 
export default {
  components: {},
  data() {
    return {
      searchTime: [
        this.$moment().format("YYYY-MM-DD 00:00:00"),
        this.$moment().format("YYYY-MM-DD HH:mm:ss"),
      ], //搜索时间
      page: 1,
      size: 10, //分页相关
      inputText: "", //输入框内容
      industrys: [],
      activeIndex: 0,
      total: 0, //总数
      isShowAdd: false, //是否展示新增弹窗
      isShowUnbind: false, //是否展示解绑弹窗
      isShowRelate: false,
      unbindId: "",
      options: {
        lazy: true,
        lazyLoad(node, resolve) {
          // 懒加载节点省市数据
          const { level } = node;
          let nodes;
          console.log("节点:", level, node);
          getAreas({ parentId: level == 0 ? 0 : node.value })
            .then((json) => {
              nodes = json.data.list;
              nodes = nodes.map((item) => ({
                value: item.id,
                label: item.name,
                level: item.level,
                leaf: level >= 1,
              }));
              resolve(nodes);
            })
            .catch((err) => {
              console.log(err);
            });
        },
      },
      userInfo: {
        userId: "",
        username: "",
        phoneNum: "",
        type: 1, // 普通用户还是开发者
        userType: 1, // 个人还是公司
        industryId: "",
        address: [110100, 110105],
        areaId: "",
        provinceId: "",
        trueName: "",
        companyName: "",
        email: "",
      },
      durationArr: [
        {
          value: 0,
          label: "一年",
        },
        {
          value: 1,
          label: "两年",
        },
      ], //所属集群下拉框
      cluster: null, //选中的集群类型
      showQuit: false, //展示退出集群的弹窗
      showJoin: false, //展示加入集群的弹窗
      activeEquipment: null, //处理中的设备
      rules: {
        trueName: [
          { required: true, message: "请填写真实姓名", trigger: "blur" },
        ],
        username: [
          { required: true, message: "请填写用户名", trigger: "blur" },
        ],
        phoneNum: [
          { required: true, message: "请填写手机号", trigger: "blur" },
        ],
        userType: [
          { required: true, message: "请选择注册类型", trigger: "blur" },
        ],
      },
    };
  },
  methods: {
    goback() {
      this.isShowRelate = false;
      this.activeIndex = 0;
    },
    goto(i) {
      this.activeIndex = i;
    },
    async getIndustrys() {
      let res = await getDic();
      if (res.success) {
        this.industrys = res.data.dics;
      } else {
        console.log("查询行业列表失败!");
      }
    },
    save() {
      this.$refs["ruleForm"].validate((valid) => {
        if (valid) {
          this.userInfo.provinceId = this.userInfo.address[0];
          this.userInfo.areaId = this.userInfo.address[1];
          entireUserInfo(this.userInfo)
            .then((res) => {
              this.$notify.success("账户信息保存成功");
              // this.$emit("gotolist")
            })
            .catch((err) => {
              if (err && err.status == 401) {
                return;
              }
              this.$notify.error("账户信息保存失败");
            });
        }
      });
    },
    // 跳到设备详情
    checkDetail(row) {
      this.$router.push({
        path: "/equipmentDetail",
        query: {
          id: row.devId,
          ip: row.devIp,
          port: row.serverPort,
          ndid: row.id,
        },
      });
    },
 
    // 跳到算法详情
    algorithmDetail(row) {
      this.$router.push({
        path: "/algorithmDetail",
        query: {
          id: row.devId,
          ip: row.devIp,
          port: row.serverPort,
        },
      });
    },
    //分页功能
    handleSizeChange(size) {
      this.size = size;
    },
    //分页功能
    refrash(page) {
      this.page = page;
    },
 
    //解绑按钮
    Untying(row) {
      console.log(row);
      this.unbindId = row.id;
      this.isShowUnbind = true;
    },
 
    //获得默认时间
    getDateInit() {
      // 要求 默认一个月
      const end = new Date();
      const start = new Date();
      const nowDate = new Date();
      nowDate.setHours(0);
      nowDate.setMinutes(0);
      nowDate.setSeconds(0);
      nowDate.setMilliseconds(0);
      start.setTime(nowDate.getTime() - 3600 * 1000 * 24 * 30);
      end.setTime(nowDate.getTime() + 3600 * 1000 * 24 - 1);
      return [
        this.$moment(start).format("YYYY-MM-DD HH:mm:ss"),
        this.$moment(end).format("YYYY-MM-DD HH:mm:ss"),
      ];
    },
 
    //关闭新增弹窗
    closeAddBox() {
      this.isShowAdd = false;
    },
    // 关闭解绑弹窗
    closeUnbindBox() {
      this.isShowUnbind = false;
    },
 
    //解绑成功回调
    reflash() {
      this.isShowUnbind = false;
    },
 
    clearSearch() {
      this.searchTime = this.getDateInit();
      this.inputText = "";
    },
 
    //退出集群
    quitCluster(equipment) {
      this.activeEquipment = equipment;
      this.showQuit = true;
    },
 
    //加入集群
    joinCluster(equipment) {
      this.activeEquipment = equipment;
      this.showJoin = true;
    },
  },
  mounted() {},
  created() {
    getUserInfo().then((res) => {
      this.userInfo = res.data;
      this.userInfo.address = [this.userInfo.provinceId, this.userInfo.areaId];
    });
    this.getIndustrys();
  },
};
</script>
 
<style scoped lang="scss">
.basic-info {
  padding: 20px;
  .head-name {
    font-weight: 700;
    font-size: 16px;
    line-height: 22px;
    color: #3d3d3d;
    border-left: 4px solid #0065ff;
    padding-left: 10px;
    margin-bottom: 30px;
  }
  .add-ruleForm::v-deep {
    .el-form-item__label {
      font-size: 14px;
      color: #999999;
    }
    .area-title {
      font-weight: 700;
      color: #666666;
      font-size: 14px;
      line-height: 20px;
      margin-bottom: 20px;
    }
    .el-input__inner {
      // width: 200px;
      color: #3d3d3d;
      border-radius: 3px;
      border-color: #c0c5cc;
      height: 32px;
      line-height: 32px;
    }
  }
  .searchBtn {
    width: 80px;
    margin-top: 50px;
    height: 40px;
    line-height: 40px;
    border-radius: 3px;
    cursor: pointer;
    text-align: center;
    color: #fff;
    background: #0065ff;
  }
}
</style>
 
<style >
.el-date-table td.start-date span,
.el-date-table td.end-date span {
  background-color: #0065ff;
}
 
.el-button--text span {
  color: #0065ff;
}
 
.el-button.is-plain:hover,
.el-button.is-plain:focus {
  color: #0065ff;
  border-color: #0065ff;
}
</style>