zhangzengfei
2023-06-30 db5872786c1e1697a59af41386136ee002bb68ad
src/views/personalCenter/components/SubAccount.vue
@@ -1,22 +1,17 @@
<template>
  <div class="sub-account" v-if="!isShowAdd && !isShowRelate">
    <div class="head-name">子账户管理</div>
    <div class="head-name" v-show="showHeadName">子账号管理</div>
    <div class="search">
      <div class="left">
        <div class="id">
          姓名/手机号
          <el-input v-model="inputText" placeholder="请输入"></el-input>
          用户名/姓名/手机号
          <el-input v-model="inputText" placeholder="请输入" clearable></el-input>
        </div>
        <div class="cluster">
        <div class="cluster" v-show="false">
          授权时长
          <el-select v-model="timeLength" placeholder="请选择">
            <el-option
              v-for="item in durationArr"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
          <el-select @change="findUserList" v-model="timeLength" placeholder="请选择">
            <el-option v-for="item in durationArr" :key="item.value" :label="item.label" :value="item.value">
            </el-option>
          </el-select>
        </div>
@@ -29,68 +24,59 @@
    </div>
    <div class="btns">
      <div class="button add" @click="isShowAdd = true">
      <div class="button add" @click="addSubCount">
        <span class="iconfont">&#xe614;</span>
        <span>添加子账号</span>
      </div>
      <div class="button export" @click="isShowRelate = true">
      <!-- <div class="button export" @click="isShowRelate = true">
        <span class="iconfont">&#xe614;</span>
        <span>关联子账号</span>
      </div>
      </div> -->
    </div>
    <div class="table-area">
      <el-table
        id="multipleTable"
        ref="multipleTable"
        tooltip-effect="dark"
        :data="dataList"
        :fit="true"
        :default-sort="{ prop: 'createTime', order: 'descending' }"
        :stripe="true"
        v-loading="tbLoading"
      >
        <el-table-column label="序号" width="55" class-name="index">
          <template slot-scope="scope">{{
            scope.$index + 1 + (page - 1) * size
          }}</template>
          <template slot-scope="scope">{{ scope.$index + 1 + (page - 1) * size }}</template>
        </el-table-column>
        <el-table-column
          prop="trueName"
          label="姓名"
          show-overflow-tooltip
        ></el-table-column>
        <el-table-column
          prop="username"
          label="用户名"
          show-overflow-tooltip
        ></el-table-column>
        <el-table-column prop="username" label="用户名" show-overflow-tooltip></el-table-column>
        <el-table-column prop="trueName" label="姓名" show-overflow-tooltip></el-table-column>
        <el-table-column prop="phoneNum" label="手机号" show-overflow-tooltip></el-table-column>
        <el-table-column prop="userType" label="用户类型">
          <template slot-scope="scope">
            <span>{{ scope.row.userType == 1 ? "个人" : "公司" }}</span>
            <span>{{ scope.row.userType == 1 ? "本地" : "OA账户" }}</span>
          </template>
        </el-table-column>
        <el-table-column prop="authDuration" label="授权时长" > </el-table-column>
        <el-table-column prop="dataNames" label="权限">
        </el-table-column>
        <!-- <el-table-column prop="authDuration" label="授权时长">
          <template slot-scope="scope">
            <span>{{ scope.row.authDuration + " 年" }} </span>
          </template>
        </el-table-column> -->
        <el-table-column label="状态">
        <!-- <el-table-column prop="authDuration" label="授权时长">
        </el-table-column> -->
        <!-- <el-table-column prop="dataNames" label="公司"> </el-table-column> -->
        <el-table-column prop="companyName" label="部门" show-overflow-tooltip min-width="200px"></el-table-column>
        <!-- <el-table-column label="状态">
          <template slot-scope="scope">
            <div v-if="scope.row.isBind == 1" class="status green">已绑定</div>
            <div v-else class="status">未绑定</div>
          </template>
        </el-table-column>
        </el-table-column> -->
        <el-table-column label="操作">
        <el-table-column label="操作" align="center" width="100px">
          <template slot-scope="scope">
            <!-- 编辑 -->
            <span class="iconfont option" @click="editUser(scope.row)"
              >编辑</span
            >
            <!-- 解绑 -->
            <!-- <span class="iconfont option" @click="Untying(scope.row)"
              >解绑</span
            > -->
            <span class="iconfont option" @click="editUser(scope.row)">编辑</span>
            <span class="iconfont option" style="color:red" @click="delUser(scope.row)">删除</span>
          </template>
        </el-table-column>
      </el-table>
@@ -109,10 +95,11 @@
    </div>
  </div>
  <div class="sub-account" v-else-if="isShowAdd">
    <div class="add-title" @click="isShowAdd = false">
    <!-- <div class="add-title" @click="isShowAdd = false">
      <span class="iconfont">&#xe614;</span>
      <span>添加子账户</span>
    </div>
      <span>子账户管理</span>
    </div> -->
    <div class="head-name" style="margin-bottom:20px">子账户编辑</div>
    <el-form
      :model="ruleForm"
      :rules="rules"
@@ -124,61 +111,49 @@
      <el-form-item label="用户名" prop="username">
        <el-input v-model="ruleForm.username" style="width: 350px"></el-input>
      </el-form-item>
      <el-form-item label="密码" prop="password">
      <el-form-item label="密码" prop="password" v-show="!isEditing">
        <el-input v-model="ruleForm.password" style="width: 350px"></el-input>
      </el-form-item>
      <el-form-item label="重置密码" prop="isChangePwd">
      <!--  <el-form-item label="重置密码">
        <el-checkbox v-model="ruleForm.isChangePwd"
          >首次登陆修改密码</el-checkbox
        >
      </el-form-item>
      </el-form-item> -->
      <el-form-item label="用户类型" prop="userType">
        <el-radio v-model="ruleForm.userType" :label="1">个人</el-radio>
        <el-radio v-model="ruleForm.userType" :label="2">公司</el-radio>
        <el-radio v-model="ruleForm.userType" :label="1">本地</el-radio>
        <el-radio v-model="ruleForm.userType" :label="2">OA账户</el-radio>
      </el-form-item>
      <el-form-item label="姓名" prop="trueName">
        <el-input v-model="ruleForm.trueName" style="width: 350px"></el-input>
      </el-form-item>
      <el-form-item label="邮箱" prop="email">
        <el-input v-model="ruleForm.email" style="width: 350px"></el-input>
      <el-form-item label="手机号">
        <el-input v-model="ruleForm.phoneNum" style="width: 350px"></el-input>
      </el-form-item>
      <el-form-item label="行业" prop="industryId">
        <el-select
          v-model="ruleForm.industryId"
          placeholder="请选择行业"
          style="width: 350px"
        >
          <el-option
            v-for="(item, index) in industrys"
            :label="item.name"
            :value="item.id"
            :key="index"
          ></el-option>
      <el-form-item label="部门">
        <el-input v-model="ruleForm.companyName" style="width: 350px"></el-input>
      </el-form-item>
      <!-- <el-form-item label="行业">
        <el-select v-model="ruleForm.industryId" placeholder="请选择行业" style="width: 350px">
          <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="address">
        <el-cascader
          v-model="ruleForm.address"
          :props="options"
          style="width: 350px"
          @change="handleChange"
        ></el-cascader>
      </el-form-item>
      <el-form-item label="授权时长" prop="authDuration">
        <el-select
          v-model="ruleForm.authDuration"
          style="width: 350px"
          placeholder="请选择授权时长"
        >
          <el-option label="一年" value="一年"></el-option>
          <el-option label="两年" value="两年"></el-option>
      <el-form-item label="地区">
        <el-cascader v-model="ruleForm.address" :props="options" style="width: 350px"></el-cascader>
      </el-form-item> -->
      <!-- <el-form-item label="授权时长">
        <el-select v-model="ruleForm.authDuration" style="width: 350px" placeholder="请选择授权时长">
          <el-option label="一年" :value="1"></el-option>
          <el-option label="两年" :value="2"></el-option>
          <el-option label="三年" :value="3"></el-option>
        </el-select>
      </el-form-item>
      </el-form-item> -->
      <el-form-item label="用户权限" prop="menuIds" class="user-tree">
        <!-- <TreeBox :defaultProp="defaultProp" :treeData="sysMenus"></TreeBox> -->
        <!-- <TreeBox :defaultProp="defaultProp2" :treeData="data2"></TreeBox> -->
        <div class="tree-box">
          <div class="t">菜单权限</div>
          <el-tree
@@ -204,14 +179,51 @@
            :props="defaultProp"
            :default-checked-keys="checkedData"
            check-on-click-node
            @check-change="selectDevice"
          >
          </el-tree>
        </div>
        <div class="tree-box">
          <div class="t">摄像机权限</div>
          <tree-menu
            ref="ztreeMenus"
            app="Camera"
            treeName="localTree"
            :node="TreeDataPool.treeData"
            :height="treeHeight"
            :setting="treeSettings"
            style="width:330px;max-height:440px"
          />
        </div>
      </el-form-item>
      <el-form-item label="短信推送" v-show="isEditing">
        <el-select v-model="smsSceneConfig" multiple collapse-tags style="width: 250px" placeholder="请选择">
          <el-option
            v-for="item in taskOptions"
            style="font-size: 12px"
            :key="item.value"
            :value="item.value"
            :label="item.value"
            :title="item.value"
          ></el-option>
        </el-select>
        <el-select
          v-model="smsLevelConfig"
          multiple
          collapse-tags
          style="margin-left:10px;width: 150px"
          placeholder="请选择"
        >
          <el-option v-for="item in levelOptions" :key="item.value" :label="item.label" :value="item.value">
          </el-option>
        </el-select>
        <el-checkbox v-model="smsEnable" style="margin-left:20px">启用</el-checkbox>
      </el-form-item>
    </el-form>
    <div class="right">
      <div class="button searchBtn" @click="saveSubUser">保存</div>
      <div class="button searchBtn" @click="saveUser">保存</div>
      <div class="button resetBtn" @click="resetUser">重置</div>
      <div class="button resetBtn" style="margin-left:20px" @click="goback">返回</div>
    </div>
  </div>
  <div class="sub-account" v-else-if="isShowRelate">
@@ -219,161 +231,267 @@
      <span class="iconfont">&#xe614;</span>
      <span>关联子账户</span>
    </div>
    <Steps
      :titleList="['关联子账号信息', '权限设置', '完成']"
      :activeIndex="activeIndex"
    ></Steps>
    <Steps :titleList="['关联子账号信息', '权限设置', '完成']" :activeIndex="activeIndex"></Steps>
    <StepsCard @goback="goback" @goto="goto"></StepsCard>
  </div>
</template>
<script>
import { findUserList, saveSubUser, getMenu, getDataTree} from "@/api/user";
import { getAreas, getDic } from "@/api/login";
import { findUserList, saveSubUser, getMenu, getDataTree, deleteUser } from "@/api/user"
import { findTaskById, updateTask } from "@/api/report"
import { getAreas, getDic } from "@/api/login"
import Steps from "./Steps";
import StepsCard from "./StepCard";
import TreeBox from "./TreeBox";
import Steps from "./Steps"
import StepsCard from "./StepCard"
import TreeMenu from "@/components/giantTree/index"
export default {
  components: {
    Steps,
    StepsCard,
    TreeBox,
    TreeMenu
  },
  computed: {
    showHeadName() {
      return this.$route.path === "/personalCenter"
    }
  },
  data() {
    const validateTree = (rule, value, callback) => {
      if (
        this.ruleForm.menuIds &&
        this.ruleForm.dataIds &&
        this.ruleForm.menuIds.length > 0 &&
        this.ruleForm.dataIds.length > 0
      ) {
        callback()
      } else {
        callback(new Error("请选菜单权限和数据权限"))
      }
    }
    return {
      searchTime: [
        this.$moment().format("YYYY-MM-DD 00:00:00"),
        this.$moment().format("YYYY-MM-DD HH:mm:ss"),
      ], //搜索时间
      tbLoading: false,
      searchTime: [this.$moment().format("YYYY-MM-DD 00:00:00"), this.$moment().format("YYYY-MM-DD HH:mm:ss")], //搜索时间
      page: 1,
      size: 10, //分页相关
      total: 0, //总数,
      inputText: "", //输入框内容
      activeStep: 0,
      activeIndex: 0,
      industrys: [],
      total: 0, //总数
      treeHeight: 750,
      treeData: [],
      treeSettings: {
        check: {
          enable: true
        }
      },
      taskOptions: [],
      options: {
        lazy: true,
        lazyLoad(node, resolve) {
          // 懒加载节点省市数据
          const { level } = node;
          let nodes;
          const { level } = node
          let nodes
          getAreas({ parentId: level == 0 ? 0 : node.value })
            .then((json) => {
              nodes = json.data.list;
              nodes = json.data.list
              nodes = nodes.map((item) => ({
                value: item.id,
                label: item.name,
                level: item.level,
                leaf: level >= 1,
              }));
              resolve(nodes);
                leaf: level >= 1
              }))
              resolve(nodes)
            })
            .catch((err) => {
              console.log(err);
            });
        },
              console.log(err)
            })
        }
      },
      dataList: [],
      isShowAdd: false, //是否展示新增弹窗
      isShowUnbind: false, //是否展示解绑弹窗
      isShowRelate: false,isEditing: false,
      isShowRelate: false,
      isEditing: false,
      unbindId: "",
      durationArr: [
        {
          value: "一年",
          label: "一年",
          value: 1,
          label: "1年"
        },
        {
          value: "两年",
          label: "两年",
          value: 2,
          label: "2年"
        },
        {
          value: 3,
          label: "3年"
        }
      ], //所属集群下拉框
      timeLength: null, //选中的授权时长
      showQuit: false, //展示退出集群的弹窗
      showJoin: false, //展示加入集群的弹窗
      activeEquipment: null, //处理中的设备
      checkedData:[],
      checkedMenu:[],
      checkedData: [],
      checkedMenu: [],
      ruleForm: {
        id: "",
        username: "",
        userType: "",
        password: "",
        trueName: "",
        email: "",
        companyName: "",
        phoneNum: "",
        email: "basic",
        isChangePwd: false,
        industryId: "",
        address: [],
        authDuration: "",
        authDuration: 3,
        areaId: "",
        provinceId: "",
        menuIds: [],
        dataIds: [],
        dataIds: []
      },
      rules: {
        name: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
          { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
        ],
        region: [
          { required: true, message: "请选择活动区域", trigger: "change" },
        ],
        resource: [
          { required: true, message: "请选择活动资源", trigger: "change" },
        ],
        desc: [{ required: true, message: "请填写活动形式", trigger: "blur" }],
        username: [{ required: true, message: "请输入用户名", trigger: "blur" }],
        // password: [{ required: true, message: "请输入密码", trigger: "blur" }],
        userType: [{ required: true, message: "请选择用户类型", trigger: "blur" }],
        trueName: [{ required: true, message: "请输入姓名", trigger: "blur" }]
        // menuIds: [{ validator: validateTree, trigger: "blur" }]
      },
      sysMenus: [],
      DataTree: [],
      smsSceneConfig: [],
      smsLevelConfig: [],
      smsEnable: false,
      userInfo: {},
      curEditId: "",
      defaultProp: {
        children: "children",
        label: "name",
        label: "name"
      },
    };
      levelOptions: [
        { value: "一级", label: "一级" },
        { value: "二级", label: "二级" },
        { value: "三级", label: "三级" },
        { value: "四级", label: "四级" },
        { value: "五级", label: "五级" }
      ]
    }
  },
  created() {
    this.userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
    this.findUserList();
    this.getIndustrys();
    this.fetchSysMenus();
    this.fetchDataTree();
    this.userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
    this.findUserList()
    this.getIndustrys()
    this.fetchSysMenus()
    this.fetchDataTree()
  },
  mounted() {
    this.taskOptions = this.Constants.sceneNameOptions
    this.TreeDataPool.reset()
    this.TreeDataPool.multiple = true
    this.VideoPhotoData.queryTaskList()
  },
  methods: {
    fetchDataTree() {
      getDataTree({ userId: this.userInfo.id }).then((res) => {
        this.DataTree = res.data.dataTree;
      });
        this.DataTree = res.data.dataTree
      })
    },
    fetchSysMenus() {
      getMenu().then((rsp) => {
        if (rsp && rsp.success) {
          this.sysMenus = rsp.data.menus;
          this.sysMenus = rsp.data.menus
          // this.userMenus = [];
        }
      });
      })
    },
    editUser(row) {
      this.isShowAdd = true;
    selectDevice(node, checked, hasChildren) {
      if (checked) {
        sessionStorage.setItem("clusterId", node.id)
        this.TreeDataPool.fetchTreeData()
        this.treeData = this.TreeDataPool.treeData
      } else {
        this.treeData = []
        this.TreeDataPool.reset()
      }
    },
    addSubCount() {
      this.isShowAdd = true
      this.resetUser()
    },
    async editUser(row) {
      this.isShowAdd = true
      this.isEditing = true
      this.ruleForm.id = row.id;
      this.ruleForm.username = row.username;
      this.ruleForm.userType = row.userType;
      this.ruleForm.password = row.password;
      this.ruleForm.trueName = row.trueName;
      this.ruleForm.email = row.email;
      this.ruleForm.isChangePwd = row.isChangePwd;
      this.ruleForm.industryId = row.industryId;
      this.ruleForm.areaId =row.areaId ;
      debugger
      this.ruleForm.address  = [ row.provinceId,row.areaId]
      this.ruleForm.provinceId = row.provinceId;
      this.ruleForm.authDuration = row.authDuration;
      this.checkedMenu = row.menuIds;
      this.checkedData = row.dataIds;
      this.ruleForm.id = row.id
      this.ruleForm.username = row.username
      this.ruleForm.userType = row.userType
      this.ruleForm.password = row.password
      this.ruleForm.trueName = row.trueName
      this.ruleForm.companyName = row.companyName
      this.ruleForm.phoneNum = row.phoneNum
      this.ruleForm.email = row.email
      this.ruleForm.isChangePwd = false
      this.ruleForm.industryId = row.industryId
      this.ruleForm.areaId = row.areaId
      this.ruleForm.address = [row.provinceId, row.areaId]
      this.ruleForm.provinceId = row.provinceId
      this.ruleForm.authDuration = row.authDuration
      this.checkedMenu = row.menuIds
      this.checkedData = row.dataIds
      this.smsSceneConfig = []
      this.smsLevelConfig = []
      this.smsEnable = false
      findTaskById({ id: row.id }).then((rsp) => {
        if (rsp && rsp.success && rsp.data != "") {
          if (rsp.data.taskName != "") {
            this.smsSceneConfig = rsp.data.taskName.split(",")
          }
          if (rsp.data.level != "") {
            this.smsLevelConfig = rsp.data.level.split(",")
          }
          this.smsEnable = rsp.data.enable
        }
      })
      // 查询当前用户权限下所有可管理的摄像机
      if (row.dataIds) {
        sessionStorage.setItem("clusterId", row.dataIds[0])
        await this.TreeDataPool.fetchTreeData()
      }
      // 用email字段暂时代替摄像机集合字段
      let checkedCameras = row.email
      // basic 为子账户默认的空字段,表示可管理的摄像机目录为空
      if (checkedCameras == "basic") {
        return
      }
      // 反选摄像机
      if (checkedCameras.length) {
        let cameraIds = checkedCameras.split(",")
        this.$refs.ztreeMenus.updateNodes(cameraIds)
      }
    },
    delUser(row) {
      this.$confirm("确认要删除该用户吗, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(async () => {
        let rsp = await deleteUser({ id: row.id })
        if (rsp && rsp.success) {
          this.$message({
            type: "success",
            message: "删除成功!"
          })
        }
        this.findUserList()
      })
    },
    resetUser() {
      this.ruleForm = {
@@ -382,160 +500,177 @@
        userType: "",
        password: "",
        trueName: "",
        companyName: "",
        phoneNum: "",
        email: "",
        isChangePwd: false,
        address: [],
        industryId: "",
        areaId: "",
        provinceId: "",
        authDuration: "",
      };
      this.$refs.treeMenus.setCheckedKeys([]);
      this.$refs.treeData.setCheckedKeys([]);
        authDuration: 1
      }
      this.smsSceneConfig = []
      this.smsLevelConfig = []
      this.smsEnable = false
      this.$nextTick(() => {
        this.$refs.treeMenus.setCheckedKeys([])
        this.$refs.treeData.setCheckedKeys([])
      })
    },
    async getIndustrys() {
      let res = await getDic();
      let res = await getDic()
      if (res.success) {
        this.industrys = res.data.dics;
        this.industrys = res.data.dics
      } else {
        console.log("查询行业列表失败!");
        console.log("查询行业列表失败!")
      }
    },
    saveSubUser() {
      this.ruleForm.menuIds = this.$refs.treeMenus.getCheckedKeys();
      this.ruleForm.dataIds = this.$refs.treeData.getCheckedKeys();
      let json = {
        id: this.isEditing? this.ruleForm.id:"",
        username: this.ruleForm.username,
        password: this.ruleForm.password,
        isChangePwd: this.ruleForm.isChangePwd,
        userType: this.ruleForm.userType,
        trueName: this.ruleForm.trueName,
        email: this.ruleForm.email,
        industryId: this.ruleForm.industryId,
        areaId: this.ruleForm.address[1],
        authDuration: this.ruleForm.authDuration,
        menuIds: this.ruleForm.menuIds,
        dataIds: this.ruleForm.dataIds,
      };
      debugger
      saveSubUser(json).then((res) => {
        debugger;
      });
    saveUser() {
      let _this = this
      this.ruleForm.menuIds = this.$refs.treeMenus.getCheckedKeys()
      this.ruleForm.dataIds = this.$refs.treeData.getCheckedKeys()
      this.$refs["ruleForm"].validate((valid) => {
        if (valid) {
          let json = {
            id: this.isEditing ? this.ruleForm.id : "",
            username: this.ruleForm.username,
            password: this.ruleForm.password,
            isChangePwd: this.ruleForm.isChangePwd,
            userType: this.ruleForm.userType,
            trueName: this.ruleForm.trueName,
            companyName: this.ruleForm.companyName,
            phoneNum: this.ruleForm.phoneNum,
            industryId: this.ruleForm.industryId,
            areaId: this.ruleForm.address.length == 2 ? this.ruleForm.address[1] : "",
            authDuration: this.ruleForm.authDuration,
            menuIds: this.ruleForm.menuIds,
            dataIds: this.ruleForm.dataIds
          }
          // 获取子账户选中的摄像机列表
          let cameraIds = this.TreeDataPool.selectedNodes
          if (cameraIds.length == 0) {
            json.email = "basic"
          } else {
            json.email = cameraIds.join(",")
          }
          // 编辑不提交密码
          if (this.isEditing) {
            delete json.password
            json.isChangePwd = false
          }
          if (typeof json.areaId === "string") {
            delete json.areaId
          }
          if (typeof json.authDuration === "string") {
            delete json.authDuration
          }
          // return
          saveSubUser(json)
            .then((res) => {
              if (res.success) {
                // 保存消息推送
                if (_this.isEditing) {
                  let smsTaskInfo = {
                    id: _this.ruleForm.id,
                    taskName: _this.smsSceneConfig.join(","),
                    level: _this.smsLevelConfig.join(","),
                    cameras: json.email,
                    person: json.trueName,
                    tel: json.phoneNum,
                    enable: _this.smsEnable,
                    IsDel: "0"
                  }
                  updateTask(smsTaskInfo).then((rsp) => {
                    // console.log(rsp)
                  })
                }
                _this.$notify.success(res.data)
                _this.isShowAdd = false
                _this.isEditing = false
                _this.findUserList()
              } else {
                _this.$notify.error(res.msg)
              }
            })
            .catch((err) => {
              _this.$notify.error(err.data.msg)
            })
        } else {
          return false
        }
      })
    },
    findUserList() {
      this.tbLoading = true
      if (this.inputText.length) {
        this.inputText = this.inputText.trim()
      }
      findUserList({
        inputText: this.inputText,
        page: this.page,
        size: this.size,
      }).then((res) => {
        if (res.success) {
          this.dataList = res.data.dataList;
        }
      });
        authDuration: this.timeLength
      })
        .then((res) => {
          if (res.success) {
            this.dataList = res.data.dataList
            this.total = res.data.total
          } else {
            this.$notify.error("加载子账户列表失败")
          }
          this.tbLoading = false
        })
        .catch((e) => {
          this.$notify.error(e.msg)
          this.tbLoading = false
        })
    },
    goback() {
      this.isShowAdd = false;
      this.isEditing =false
      this.isShowRelate = false;
      this.activeIndex = 0;
      this.isShowAdd = false
      this.isEditing = false
      this.isShowRelate = false
      this.activeIndex = 0
    },
    goto(i) {
      this.activeIndex = i;
      this.activeIndex = i
    },
    reset() {
      this.inputText = "";
      this.timeLength = null;
    },
    // 跳到设备详情
    checkDetail(row) {
      this.$router.push({
        path: "/equipmentDetail",
        query: {
          id: row.devId,
          ip: row.devIp,
          port: row.serverPort,
          ndid: row.id,
        },
      });
      this.inputText = ""
      this.timeLength = null
    },
    // 跳到算法详情
    algorithmDetail(row) {
      this.$router.push({
        path: "/algorithmDetail",
        query: {
          id: row.devId,
          ip: row.devIp,
          port: row.serverPort,
        },
      });
    },
    // 查询列表
    save() {},
    //分页功能
    handleSizeChange(size) {
      this.size = size;
      this.size = size
      this.findUserList()
    },
    //分页功能
    refrash(page) {
      this.page = page;
      this.page = page
      this.findUserList()
    },
    //解绑按钮
    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"),
      ];
    },
    // 关闭解绑弹窗
    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;
    },
  },
};
    // 生成uuid
    getUuid() {
      let originStr = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      let originChar = "0123456789abcdef"
      let len = originChar.length
      return originStr.replace(/x/g, function(match) {
        return originChar.charAt(Math.floor(Math.random() * len))
      })
    }
  }
}
</script>
<style scoped lang="scss">
@@ -572,6 +707,11 @@
      border-color: #c0c5cc;
    }
    .user-tree {
      .el-form-item__label:before {
        content: "*";
        color: #f52323;
        margin-right: 4px;
      }
      .el-form-item__content {
        display: flex;
        .tree-box {
@@ -593,9 +733,10 @@
    }
  }
  .searchBtn {
    width: 60px;
    height: 32px;
    line-height: 32px;
    width: 50px;
    height: 25px;
    line-height: 25px;
    font-size: 14px;
    text-align: center;
    color: #fff;
    background: #0065ff;
@@ -605,9 +746,10 @@
    display: flex;
  }
  .resetBtn {
    width: 60px;
    height: 32px;
    line-height: 32px;
    width: 50px;
    height: 25px;
    line-height: 25px;
    font-size: 14px;
    text-align: center;
    color: #0065ff;
    box-sizing: border-box;
@@ -773,7 +915,7 @@
    .option {
      margin-right: 10px;
         font-size: 14px;
      font-size: 14px;
      color: rgb(0, 101, 255);
      cursor: pointer;
    }
@@ -816,10 +958,16 @@
      }
    }
  }
  .el-select ::v-deep {
    .el-select__tags-text {
      color: #3d3d3d;
    }
  }
}
</style>
<style >
<style>
.el-date-table td.start-date span,
.el-date-table td.end-date span {
  background-color: #0065ff;
@@ -834,4 +982,4 @@
  color: #0065ff;
  border-color: #0065ff;
}
</style>
</style>