zhangzengfei
2022-09-02 904b214f0395fcd670fb60f84d31a0be842c4f73
合并推送和子账户管理功能
5个文件已修改
228 ■■■■■ 已修改文件
src/Pool/VideoPhotoData.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/report.ts 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/manageCenter/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/personalCenter/components/SubAccount.vue 200 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/report/index.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Pool/VideoPhotoData.ts
@@ -307,7 +307,7 @@
    if (this.searchFrom == "cluster") {
      params.isPlatform = 1
    }
    console.log(params)
    // console.log(params)
    const rsp: any = await getTaskList(params)
    if (rsp && rsp.success) {
      // this.tasks.splice(0, this.tasks.length)
src/api/report.ts
@@ -11,6 +11,13 @@
    params: query
  })
}
export const findTaskById = (query: any) => {
  return request({
    url: "/api-a/v1/task/getById",
    method: "get",
    params: query
  })
}
/**
 * 事件推送新增
src/views/manageCenter/index.vue
@@ -314,7 +314,7 @@
        },
        {
          name: "推送管理",
          name: "用户管理",
          icon: "/images/manageCenter/push.png",
          openPath: "/report",
          path: "/report",
src/views/personalCenter/components/SubAccount.vue
@@ -94,10 +94,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"
@@ -194,9 +195,32 @@
          />
        </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.id"
            :value="item.name"
            :label="item.name"
            :title="item.name"
          ></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>
@@ -213,6 +237,7 @@
<script>
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"
@@ -224,6 +249,11 @@
    Steps,
    StepsCard,
    TreeMenu
  },
  computed: {
    taskOptions() {
      return this.VideoPhotoData.tasks.filter((item) => !item.isDelete)
    }
  },
  data() {
    const validateTree = (rule, value, callback) => {
@@ -329,12 +359,22 @@
      },
      sysMenus: [],
      DataTree: [],
      smsSceneConfig: [],
      smsLevelConfig: [],
      smsEnable: false,
      userInfo: {},
      curEditId: "",
      defaultProp: {
        children: "children",
        label: "name"
      }
      },
      levelOptions: [
        { value: "一级", label: "一级" },
        { value: "二级", label: "二级" },
        { value: "三级", label: "三级" },
        { value: "四级", label: "四级" },
        { value: "五级", label: "五级" }
      ]
    }
  },
  created() {
@@ -347,6 +387,7 @@
  mounted() {
    this.TreeDataPool.reset()
    this.TreeDataPool.multiple = true
    this.VideoPhotoData.queryTaskList()
  },
  methods: {
    fetchDataTree() {
@@ -396,11 +437,23 @@
      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 != "") {
          this.smsSceneConfig = rsp.data.taskName.split(",")
          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
@@ -449,6 +502,9 @@
        provinceId: "",
        authDuration: 1
      }
      this.smsSceneConfig = []
      this.smsLevelConfig = []
      this.smsEnable = false
      this.$nextTick(() => {
        this.$refs.treeMenus.setCheckedKeys([])
        this.$refs.treeData.setCheckedKeys([])
@@ -462,7 +518,7 @@
        console.log("查询行业列表失败!")
      }
    },
    saveSubUser() {
    saveUser() {
      let _this = this
      this.ruleForm.menuIds = this.$refs.treeMenus.getCheckedKeys()
      this.ruleForm.dataIds = this.$refs.treeData.getCheckedKeys()
@@ -509,16 +565,34 @@
          saveSubUser(json)
            .then((res) => {
              if (res.success) {
                this.$notify.success(res.data)
                this.isShowAdd = false
                this.isEditing = false
                this.findUserList()
                // 保存消息推送
                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)
                _this.$notify.error(res.msg)
              }
            })
            .catch((err) => {
              this.$notify.error(err.data.msg)
              _this.$notify.error(err.data.msg)
            })
        } else {
          return false
@@ -557,34 +631,7 @@
      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
        }
      })
    },
    // 跳到算法详情
    algorithmDetail(row) {
      this.$router.push({
        path: "/algorithmDetail",
        query: {
          id: row.devId,
          ip: row.devIp,
          port: row.serverPort
        }
      })
    },
    // 查询列表
    save() {},
    //分页功能
    handleSizeChange(size) {
      this.size = size
@@ -596,53 +643,14 @@
      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))
      })
    }
  }
}
@@ -708,9 +716,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;
@@ -720,9 +729,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;
@@ -931,6 +941,12 @@
      }
    }
  }
  .el-select ::v-deep {
    .el-select__tags-text {
      color: #3d3d3d;
    }
  }
}
</style>
src/views/report/index.vue
@@ -11,7 +11,9 @@
    </div>
    <!-- 主要内容 -->
    <DevList></DevList>
    <div class="content">
      <SubAccount></SubAccount>
    </div>
    <!-- 页尾 -->
    <Footer :isBlack="true"></Footer>
@@ -20,14 +22,15 @@
<script>
import IndexHeader from "@/components/IndexHeader"
import DevList from "@/views/report/components/DevList"
// import DevList from "@/views/report/components/DevList"
import SubAccount from "@/views/personalCenter/components/SubAccount.vue"
// import SettingBox from "@/views/report/components/SettingBox"
import Footer from "@/components/Footer"
export default {
  components: {
    IndexHeader,
    DevList,
    SubAccount,
    // SettingBox,
    Footer
  }
@@ -51,7 +54,13 @@
      color: #666;
    }
  }
  .content {
    min-height: 856px;
    box-sizing: border-box;
    background-color: #fff;
    width: 1036px;
    margin: 0 auto;
  }
  .Footer {
    position: absolute;
    left: 0;