mark
2022-09-29 7a2b07ad2b0715c6e2dffb5102cd1d1c05c28d6a
点位信息 all
1个文件已添加
3个文件已修改
272 ■■■■ 已修改文件
src/api/report.ts 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dataPush/components/device.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dataPush/components/point.js 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/dataPush/components/point.vue 230 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/report.ts
@@ -124,6 +124,14 @@
    data: query
  })
}
// 编辑
export const camerasUpdate = (query: any) => {
  return request({
    url: "/api-a/v1/cameras/update",
    method: "post",
    data: query
  })
}
//删除
export const camerasDelete = (query: any) => {
  return request({
@@ -132,3 +140,18 @@
    params: query
  })
}
// 总开关
export const camerasSwitch = (query: any) => {
  return request({
    url: "/api-a/v1/cameras/switch",
    method: "get",
    params: query
  })
}
export const camerasConfig = () => {
  return request({
    url: "/api-a/v1/cameras/config",
    method: "get"
  })
}
src/views/dataPush/components/device.vue
@@ -32,13 +32,13 @@
        <!-- <el-table-column prop="devId" label="设备ID" show-overflow-tooltip></el-table-column> -->
        <el-table-column prop="devIp" label="设备IP" show-overflow-tooltip></el-table-column>
        <el-table-column prop="devCode" label="设备编码" show-overflow-tooltip></el-table-column>
        <el-table-column prop="companyCode" label="企业编码" show-overflow-tooltip></el-table-column>
        <el-table-column prop="state" label="状态" show-overflow-tooltip>
          <template slot-scope="scope">
            <div v-if="scope.row.state == 0" class="status green">离线</div>
            <div v-else class="status">在线</div>
          </template>
        </el-table-column>
        <el-table-column prop="companyCode" label="企业编码" show-overflow-tooltip></el-table-column>
        <el-table-column label="操作" align="center" width="100px">
          <template slot-scope="scope">
@@ -159,7 +159,7 @@
    },
    delUser(row) {
      console.log(row, "row")
      this.$confirm("确认要删除该用户吗, 是否继续?", "提示", {
      this.$confirm("确认要删除设备吗, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
@@ -226,6 +226,7 @@
                  message: res.data
                })
                this.goback()
                this.fetchDevicesList()
              }
            })
          } else if (this.tip === 2) {
@@ -248,6 +249,7 @@
                  message: res.msg
                })
                this.goback()
                this.fetchDevicesList()
              }
            })
          }
@@ -259,7 +261,7 @@
    goback() {
      this.isShowAdd = false
    },
    async editUser(row) {
    editUser(row) {
      this.tip = 2
      this.isShowAdd = true
      this.ruleForm.devName = row.devName
src/views/dataPush/components/point.js
New file
@@ -0,0 +1,11 @@
export const traverse = (arr, newArr = []) => {
  for (let i = 0; i < arr.length; i++) {
    let a = { ...arr[i] }
    if (a.type === "4") {
      newArr.push(a)
    } else {
      traverse(a.children, newArr)
    }
  }
  return newArr
}
src/views/dataPush/components/point.vue
@@ -18,6 +18,10 @@
        <span class="iconfont">&#xe614;</span>
        <span>添加点位</span>
      </div>
      <div class="switchBox">
        <el-switch v-model="value1" @change="changeAll($event)" active-text="总点位开" inactive-text="总点位关">
        </el-switch>
      </div>
    </div>
    <div class="table-area">
@@ -32,12 +36,24 @@
        <el-table-column prop="channelCode" label="报警通道编码" show-overflow-tooltip></el-table-column>
        <el-table-column prop="companyCode" label="企业编码" show-overflow-tooltip></el-table-column>
        <el-table-column prop="scenes" label="推送场景" show-overflow-tooltip></el-table-column>
        <el-table-column prop="updatedAt" label="推送时间" show-overflow-tooltip>
        <el-table-column prop="updatedAt" label="推送时间" width="100px" show-overflow-tooltip>
          <template slot-scope="scope">{{ scope.row.startTime }}-{{ scope.row.endTime }}</template>
        </el-table-column>
        <el-table-column prop="Enable" label="开关" width="70px" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-switch
              v-model="scope.row.enable"
              @change="changeSwitch($event, scope.row)"
              active-color="#13ce66"
              inactive-color="#f0f3f5"
            >
            </el-switch>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" width="100px">
          <template slot-scope="scope">
            <span class="iconfont option" @click="editCameras(scope.row)">编辑</span>
            <span class="iconfont option" style="color:red" @click="delCameras(scope.row)">删除</span>
          </template>
        </el-table-column>
@@ -63,7 +79,7 @@
      :rules="rules"
      :label-position="'left'"
      ref="ruleForm"
      label-width="100px"
      label-width="120px"
      class="add-ruleForm"
    >
      <el-form-item label="点位名称" prop="CameraName">
@@ -83,7 +99,7 @@
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="推送时间">
      <el-form-item label="推送时间" required>
        <el-col :span="12" style="width: 175px">
          <el-form-item prop="StartTime">
            <el-time-select
@@ -93,7 +109,8 @@
              :picker-options="{
                start: '00:00',
                step: '00:30',
                end: '23:30'
                end: ruleForm.EndTime ? ruleForm.EndTime : '23:30',
                maxTime: ruleForm.EndTime
              }"
            >
            </el-time-select>
@@ -106,9 +123,10 @@
              placeholder="结束时间"
              v-model="ruleForm.EndTime"
              :picker-options="{
                start: '00:00',
                start: ruleForm.StartTime ? ruleForm.StartTime : '00:00',
                step: '00:30',
                end: '23:30'
                end: '23:30',
                minTime: ruleForm.StartTime
              }"
            >
            </el-time-select>
@@ -126,12 +144,14 @@
<script>
import { getLocalCameraTree } from "@/api/area"
import { traverse } from "./point"
import { getClusterDevList } from "@/api/clusterManage"
import { camerasList, camerasCreate, camerasDelete } from "@/api/report"
import { camerasList, camerasCreate, camerasConfig, camerasSwitch, camerasUpdate, camerasDelete } from "@/api/report"
export default {
  data() {
    return {
      value1: false,
      query: {},
      inputText: "", //输入框内容
      cameraOptions: [],
@@ -193,7 +213,10 @@
        CameraId: "", // 摄像机id
        Level: "",
        Enable: true
        Enable: false,
        createdAt: "",
        updatedAt: "",
        id: ""
      },
      dataList: [],
@@ -224,7 +247,69 @@
  // const rsp: any = await getLocalCameraTree(params)
  // console.log(rsp, "rsp")
  methods: {
    async changeAll(val) {
      console.log(val)
      let enable
      val ? (enable = 1) : (enable = 0)
      let rsp = await camerasSwitch({ enable: enable })
      if (rsp && rsp.success) {
        this.$message({
          type: "success",
          message: "成功!"
        })
        this.checkCamerasList()
      }
    },
    changeSwitch(val, row) {
      console.log(val, row, "val, rowval, row")
      let params = {
        CameraName: row.cameraName,
        ChannelCode: row.channelCode,
        CompanyCode: row.companyCode,
        Scenes: row.scenes,
        StartTime: row.startTime,
        EndTime: row.endTime,
        CameraId: row.cameraId, //
        Level: row.level,
        Enable: val,
        createdAt: row.createdAt,
        updatedAt: row.updatedAt,
        id: row.id
      }
      camerasUpdate(params).then((res) => {
        console.log(res, "res")
        if (res && res.success) {
          this.$message({
            type: "success",
            message: res.msg
          })
        }
      })
    },
    editCameras(row) {
      console.log(row, "row")
      this.tip = 2
      this.isShowAdd = true
      this.resetUser()
      this.ruleForm.StartTime = row.startTime
      this.ruleForm.EndTime = row.endTime
      this.ruleForm.CameraName = row.cameraName
      this.ruleForm.ChannelCode = row.channelCode
      this.ruleForm.CompanyCode = row.companyCode
      this.ruleForm.Sceneslist = row.scenes.split(",")
      this.ruleForm.Level = row.level
      this.ruleForm.Enable = row.enable
      this.ruleForm.createdAt = row.createdAt
      this.ruleForm.updatedAt = row.updatedAt
      this.ruleForm.id = row.id
    },
    async aaaaa() {
      let res = await camerasConfig()
      if (res && res.success) {
        res.data.enable === 0 ? (this.value1 = false) : (this.value1 = true)
        console.log(this.value1)
      }
      let clusterId = ""
      let clusterReq = await getClusterDevList()
      if (clusterReq && clusterReq.success) {
@@ -234,15 +319,8 @@
      }
      console.log(clusterId)
      let camereReq = await getLocalCameraTree({ clusterId: clusterId })
      console.log(camereReq.data.treeMenu, "camereReqcamereReqcamereReq")
      let array = camereReq.data.treeMenu
      for (let i = 0; i < array.length; i++) {
        console.log(array[i].children, "11111111")
        for (let j = 0; j < array[i].children.length; j++) {
          this.cameraOptions.push(array[i].children[j])
        }
      }
      console.log(this.cameraOptions, "arrrrrrrrrrrrrrrr")
      let array = []
      this.cameraOptions = traverse(camereReq.data.treeMenu, array)
    },
    addPoint() {
      this.isShowAdd = true
@@ -252,30 +330,61 @@
    saveUser() {
      this.$refs["ruleForm"].validate((valid) => {
        if (valid) {
          let obj = this.cameraOptions.find((item) => item.name === this.ruleForm.CameraName)
          console.log(obj, "dddddddd")
          let params = {
            CameraName: this.ruleForm.CameraName,
            ChannelCode: this.ruleForm.ChannelCode,
            CompanyCode: this.ruleForm.CompanyCode,
            Scenes: this.ruleForm.Sceneslist.toString(),
            StartTime: this.ruleForm.StartTime,
            EndTime: this.ruleForm.EndTime,
            CameraId: obj.id, //
            Level: this.ruleForm.Level,
            Enable: this.ruleForm.Enable
          }
          console.log(params, "paramsv")
          camerasCreate(params).then((res) => {
            console.log(res, "res")
            if (res && res.success) {
              this.$message({
                type: "success",
                message: res.msg
              })
              this.goback()
          if (this.tip !== 1) {
            let obj = this.cameraOptions.find((item) => item.name === this.ruleForm.CameraName)
            console.log(obj, "dddddddd")
            let params = {
              CameraName: this.ruleForm.CameraName,
              ChannelCode: this.ruleForm.ChannelCode,
              CompanyCode: this.ruleForm.CompanyCode,
              Scenes: this.ruleForm.Sceneslist.toString(),
              StartTime: this.ruleForm.StartTime,
              EndTime: this.ruleForm.EndTime,
              CameraId: obj.id, //
              Level: this.ruleForm.Level,
              Enable: this.ruleForm.Enable,
              createdAt: this.ruleForm.createdAt,
              updatedAt: this.ruleForm.updatedAt,
              id: this.ruleForm.id
            }
          })
            camerasUpdate(params).then((res) => {
              console.log(res, "res")
              if (res && res.success) {
                this.$message({
                  type: "success",
                  message: res.msg
                })
                this.goback()
                this.checkCamerasList()
              }
            })
          } else {
            let obj = this.cameraOptions.find((item) => item.name === this.ruleForm.CameraName)
            console.log(obj, "dddddddd")
            let params = {
              CameraName: this.ruleForm.CameraName,
              ChannelCode: this.ruleForm.ChannelCode,
              CompanyCode: this.ruleForm.CompanyCode,
              Scenes: this.ruleForm.Sceneslist.toString(),
              StartTime: this.ruleForm.StartTime,
              EndTime: this.ruleForm.EndTime,
              CameraId: obj.id, //
              Level: this.ruleForm.Level,
              Enable: this.ruleForm.Enable
            }
            console.log(params, "paramsv")
            camerasCreate(params).then((res) => {
              console.log(res, "res")
              if (res && res.success) {
                this.$message({
                  type: "success",
                  message: res.msg
                })
                this.goback()
                this.checkCamerasList()
              }
            })
          }
        } else {
          return false
        }
@@ -320,14 +429,22 @@
      }
    },
    resetUser() {
      this.ruleForm = {
        CameraName: "",
        ChannelCode: "",
        CompanyCode: "",
        Sceneslist: [],
        StartTime: "",
        EndTime: ""
      }
      // this.ruleForm. = {
      this.ruleForm.CameraName = ""
      this.ruleForm.ChannelCode = ""
      this.ruleForm.CompanyCode = ""
      this.ruleForm.Sceneslist = []
      this.ruleForm.StartTime = ""
      this.ruleForm.EndTime = ""
      //   Scenes: "",
      //   CameraId: "", // 摄像机id
      //   Level: "",
      //   Enable: false,
      //   createdAt: "",
      //   updatedAt: "",
      //   id: ""
      // }
    },
    goback() {
      this.isShowAdd = false
@@ -336,6 +453,19 @@
}
</script>
//
<style scoped lang="scss">
// /deep/ .el-switch .is-checked {
//   .el-switch__core {
//     height: 32px !important;
//   }
//   .el-switch__core::after {
//     height: 30px !important;
//     width: 30px !important;
//   }
// }
//
</style>
<style scoped lang="scss">
.sub-account {
  padding: 20px;
@@ -497,6 +627,10 @@
  }
  .btns {
    .switchBox {
      display: flex;
      align-items: center;
    }
    display: flex;
    margin: 20px 0;
    text-align: center;