From b2d0ac2db80c08783fd848933230618cc30d76a2 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期三, 30 八月 2023 11:38:24 +0800
Subject: [PATCH] 添加锦汇企业编码. 修复点位列表平铺的bug

---
 src/views/dataPush/components/point.vue |  764 +++++++++++++++++++++++++++------------------------------
 1 files changed, 363 insertions(+), 401 deletions(-)

diff --git a/src/views/dataPush/components/point.vue b/src/views/dataPush/components/point.vue
index ef048c4..b63d6af 100644
--- a/src/views/dataPush/components/point.vue
+++ b/src/views/dataPush/components/point.vue
@@ -1,29 +1,63 @@
 <template>
   <div class="sub-account" v-if="!isShowAdd">
+    <div class="search">
+      <div class="left">
+        <div class="id">
+          鐐逛綅鍚嶇О/浼佷笟缂栫爜/鍦烘櫙
+          <el-input v-model="inputText" placeholder="璇疯緭鍏�" clearable></el-input>
+        </div>
+      </div>
+
+      <div class="right">
+        <div class="button searchBtn" @click="checkCamerasList(1)">鎼滅储</div>
+      </div>
+    </div>
     <div class="btns">
       <div class="button add" @click="addPoint">
         <span class="iconfont">&#xe614;</span>
         <span>娣诲姞鐐逛綅</span>
       </div>
     </div>
-
+    <div class="switchBox">
+      <span style="margin-right:10px">寮�鍚笂鎶�</span>
+      <el-switch v-model="value1" active-color="#0065ff" @change="changeAll($event)"> </el-switch>
+    </div>
     <div class="table-area">
       <el-table
-        id="multipleTable"
-        ref="multipleTable"
+        v-loading="tbLoading"
+        id="pointTable"
+        ref="pointTable"
         :data="dataList"
         :fit="true"
-        :default-sort="{ prop: 'createTime', order: 'descending' }"
+        :default-sort="{ prop: 'companyCode', order: 'ascending' }"
       >
-        <el-table-column prop="a" label="鐐逛綅鍚嶇О" show-overflow-tooltip></el-table-column>
-        <el-table-column prop="b" label="鎶ヨ閫氶亾缂栫爜" show-overflow-tooltip></el-table-column>
-        <el-table-column prop="c" label="浼佷笟缂栫爜" show-overflow-tooltip></el-table-column>
-        <el-table-column prop="d" label="鎺ㄩ�佸満鏅�" show-overflow-tooltip></el-table-column>
-        <el-table-column prop="e" label="鎺ㄥ姩鏃堕棿" show-overflow-tooltip></el-table-column>
+        <el-table-column prop="cameraName" label="鐐逛綅鍚嶇О" width="130px" show-overflow-tooltip></el-table-column>
+        <el-table-column
+          prop="channelCode"
+          label="鎶ヨ閫氶亾缂栫爜"
+          min-width="250px"
+          show-overflow-tooltip
+        ></el-table-column>
+        <el-table-column prop="companyCode" label="浼佷笟缂栫爜" width="150px" show-overflow-tooltip>
+          <template slot-scope="scope">
+            {{ scope.row.companyCode | fillCompanyCode(companyCodeOptions) }}
+          </template>
+        </el-table-column>
+        <el-table-column prop="scenes" label="鎺ㄩ�佸満鏅�" min-width="100px" show-overflow-tooltip></el-table-column>
+        <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="60px" show-overflow-tooltip>
+          <template slot-scope="scope">
+            <el-switch v-model="scope.row.enable" @change="changeSwitch($event, scope.row)" active-color="#0065ff">
+            </el-switch>
+          </template>
+        </el-table-column>
 
         <el-table-column label="鎿嶄綔" align="center" width="100px">
           <template slot-scope="scope">
-            <span class="iconfont option" style="color:red" @click="delUser(scope.row)">鍒犻櫎</span>
+            <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>
       </el-table>
@@ -42,37 +76,72 @@
     </div>
   </div>
   <div class="sub-account" v-else-if="isShowAdd">
-    <!-- <div class="add-title" @click="isShowAdd = false">
-      <span class="iconfont">&#xe614;</span>
-      <span>瀛愯处鎴风鐞�</span>
-    </div> -->
     <div class="head-name" style="margin-bottom:20px">缂栬緫鐐逛綅</div>
     <el-form
       :model="ruleForm"
       :rules="rules"
       :label-position="'left'"
       ref="ruleForm"
-      label-width="100px"
+      label-width="120px"
       class="add-ruleForm"
     >
-      <el-form-item label="鐐逛綅鍚嶇О" prop="a">
-        <el-input v-model="ruleForm.a" placeholder="璇疯緭鍏ョ偣浣嶅悕绉�" style="width: 350px"></el-input>
+      <el-form-item label="鐐逛綅鍚嶇О" prop="CameraName">
+        <el-select filterable style="width: 350px" v-model="ruleForm.CameraName" placeholder="璇烽�夋嫨">
+          <el-option v-for="item in cameraOptions" :key="item.id" :label="item.name" :value="item.name"> </el-option>
+        </el-select>
       </el-form-item>
-      <el-form-item label="鎶ヨ閫氶亾缂栫爜" prop="b">
-        <el-input v-model="ruleForm.b" placeholder="璇疯緭鍏ユ姤璀﹂�氶亾缂栫爜" style="width: 350px"></el-input>
+      <el-form-item label="鎶ヨ閫氶亾缂栫爜" prop="ChannelCode">
+        <el-input v-model="ruleForm.ChannelCode" placeholder="璇疯緭鍏ユ姤璀﹂�氶亾缂栫爜" style="width: 350px"></el-input>
       </el-form-item>
-      <el-form-item label="浼佷笟缂栫爜" prop="c">
-        <el-input v-model="ruleForm.c" placeholder="璇疯緭鍏ヤ紒涓氱紪鐮�" style="width: 350px"></el-input>
+      <el-form-item label="浼佷笟缂栫爜" prop="CompanyCode">
+        <el-select style="width: 350px" v-model="ruleForm.CompanyCode" placeholder="璇烽�夋嫨">
+          <el-option v-for="item in companyCodeOptions" :key="item.value" :label="item.label" :value="item.value">
+          </el-option>
+        </el-select>
       </el-form-item>
-      <el-form-item label="鎺ㄩ�佸満鏅�" prop="d">
-        <el-input v-model="ruleForm.d" placeholder="璇疯緭鍏ユ帹閫佸満鏅�" style="width: 350px"></el-input>
+      <el-form-item label="鎺ㄩ�佸満鏅�" prop="Sceneslist">
+        <el-select multiple style="width: 350px" v-model="ruleForm.Sceneslist" filterable placeholder="璇烽�夋嫨">
+          <el-option v-for="item in scene_nameOptions" :key="item.value" :label="item.label" :value="item.value">
+          </el-option>
+        </el-select>
       </el-form-item>
-      <el-form-item label="鎺ㄥ姩鏃堕棿" prop="e">
-        <el-input v-model="ruleForm.e" placeholder="璇疯緭鍏ユ帹鍔ㄦ椂闂�" style="width: 350px"></el-input>
+      <el-form-item label="鎺ㄩ�佹椂闂�" required>
+        <el-col :span="12" style="width: 175px">
+          <el-form-item prop="StartTime">
+            <el-time-select
+              style="width: 175px"
+              placeholder="璧峰鏃堕棿"
+              v-model="ruleForm.StartTime"
+              :picker-options="{
+                start: '00:00',
+                step: '00:30',
+                end: ruleForm.EndTime ? ruleForm.EndTime : '24:00',
+                maxTime: ruleForm.EndTime
+              }"
+            >
+            </el-time-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12" style="width: 175px">
+          <el-form-item prop="EndTime">
+            <el-time-select
+              style="width: 175px"
+              placeholder="缁撴潫鏃堕棿"
+              v-model="ruleForm.EndTime"
+              :picker-options="{
+                start: ruleForm.StartTime ? ruleForm.StartTime : '00:00',
+                step: '00:30',
+                end: '24:00',
+                minTime: ruleForm.StartTime
+              }"
+            >
+            </el-time-select>
+          </el-form-item>
+        </el-col>
       </el-form-item>
     </el-form>
     <div class="right">
-      <div class="button searchBtn" @click="saveUser">淇濆瓨</div>
+      <div class="button searchBtn" @click="save">淇濆瓨</div>
       <div class="button resetBtn" @click="resetUser">閲嶇疆</div>
       <div class="button resetBtn" style="margin-left:20px" @click="goback">杩斿洖</div>
     </div>
@@ -80,424 +149,287 @@
 </template>
 
 <script>
-import { findUserList, saveSubUser, getMenu, getDataTree, deleteUser } from "@/api/user"
-import { findTaskById, updateTask } from "@/api/report"
-import { getAreas, getDic } from "@/api/login"
+import { getLocalCameraTree } from "@/api/area"
+import { getClusterDevList } from "@/api/clusterManage"
+import { camerasList, camerasCreate, camerasConfig, camerasSwitch, camerasUpdate, camerasDelete } from "@/api/report"
+import { traverse } from "./point/point"
+import "./point/point.scss"
 
 export default {
-  computed: {
-    taskOptions() {
-      return this.VideoPhotoData.tasks.filter((item) => !item.isDelete)
+  filters: {
+    fillCompanyCode(key, opts) {
+      let obj = opts.find((t) => t.value == key)
+      return obj ? obj.label : key
     }
   },
   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")], //鎼滅储鏃堕棿
-      page: 1,
-      size: 10, //鍒嗛〉鐩稿叧
-      total: 0, //鎬绘暟,
+      tbLoading: false,
+      activeColor: "",
+      inactiveColor: "#f0f3f5",
+      value1: false,
+      query: {},
       inputText: "", //杈撳叆妗嗗唴瀹�
-      activeStep: 0,
-      activeIndex: 0,
-      industrys: [],
-      treeHeight: 750,
-      treeData: [],
-      treeSettings: {
-        check: {
-          enable: true
-        }
-      },
-      options: {
-        lazy: true,
-        lazyLoad(node, resolve) {
-          // 鎳掑姞杞借妭鐐圭渷甯傛暟鎹�
-          const { level } = node
-          let nodes
-          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)
-            })
-        }
+      cameraOptions: [],
+      scene_nameOptions: [],
+      isShowAdd: false, //鏄惁灞曠ず鏂板寮圭獥
+      ruleForm: {
+        CameraName: "", // 鎽勫儚鏈哄悕绉�
+        ChannelCode: "", // 鎶ヨ閫氶亾缂栧彿
+        CompanyCode: "", // 鎵�灞炰紒涓氱紪鍙�
+        Scenes: "", // 鎺ㄩ�佸満鏅�
+        Sceneslist: [], // 鎺ㄩ�佸満鏅�
+        StartTime: "", // 寮�濮嬫椂闂�
+        EndTime: "", // 缁撴潫鏃堕棿
+
+        CameraId: "", // 鎽勫儚鏈篿d
+        Level: "",
+        Enable: false,
+        createdAt: "",
+        updatedAt: "",
+        id: ""
       },
       dataList: [],
-      isShowAdd: false, //鏄惁灞曠ず鏂板寮圭獥
-      isShowUnbind: false, //鏄惁灞曠ず瑙g粦寮圭獥
-      isShowRelate: false,
-      isEditing: false,
-      unbindId: "",
-      durationArr: [
-        {
-          value: 1,
-          label: "1骞�"
-        },
-        {
-          value: 2,
-          label: "2骞�"
-        },
-        {
-          value: 3,
-          label: "3骞�"
-        }
-      ], //鎵�灞為泦缇や笅鎷夋
-      timeLength: null, //閫変腑鐨勬巿鏉冩椂闀�
-      showQuit: false, //灞曠ず閫�鍑洪泦缇ょ殑寮圭獥
-      showJoin: false, //灞曠ず鍔犲叆闆嗙兢鐨勫脊绐�
-      activeEquipment: null, //澶勭悊涓殑璁惧
-      checkedData: [],
-      checkedMenu: [],
-      ruleForm: {
-        //y
-        a: "",
-        b: "",
-        c: "",
-        d: "",
-        e: "",
-        id: "",
-        username: "",
-        userType: "",
-        password: "",
-        trueName: "",
-        companyName: "",
-        phoneNum: "",
-        email: "basic",
-        isChangePwd: false,
-        industryId: "",
-        address: [],
-        authDuration: 3,
-        areaId: "",
-        provinceId: "",
-        menuIds: [],
-        dataIds: []
-      },
+      tip: 1, // 鍖哄垎淇濆瓨杩樻槸缂栬緫 浣嗘槸鐜板湪娌℃湁缂栬緫
       rules: {
-        //y
-        a: [{ required: true, message: "璇疯緭鍏ョ偣浣嶅悕绉�", trigger: "blur" }],
-        b: [{ required: true, message: "璇疯緭鍏ユ姤璀﹂�氶亾缂栫爜", trigger: "blur" }],
-        c: [{ required: true, message: "璇疯緭鍏ヤ紒涓氱紪鐮�", trigger: "blur" }],
-        d: [{ required: true, message: "璇疯緭鍏ユ帹閫佸満鏅�", trigger: "blur" }],
-        e: [{ required: true, message: "璇疯緭鍏ユ帹鍔ㄦ椂闂�", trigger: "blur" }]
+        CameraName: [{ required: true, message: "璇烽�夋嫨鐐逛綅鍚嶇О", trigger: "change" }],
+        ChannelCode: [{ required: true, message: "璇疯緭鍏ユ姤璀﹂�氶亾缂栫爜", trigger: "blur" }],
+        CompanyCode: [{ required: true, message: "璇疯緭鍏ヤ紒涓氱紪鐮�", trigger: "blur" }],
+        Sceneslist: [{ type: "array", required: true, message: "璇烽�夋嫨鎺ㄩ�佸満鏅�", trigger: "change" }],
+        StartTime: [{ type: "string", required: true, message: "璇烽�夋嫨寮�濮嬫椂闂�", trigger: "change" }],
+        EndTime: [{ type: "string", required: true, message: "璇烽�夋嫨缁撴潫鏃堕棿", trigger: "change" }]
       },
-      sysMenus: [],
-      DataTree: [],
-      smsSceneConfig: [],
-      smsLevelConfig: [],
-      smsEnable: false,
-      userInfo: {},
-      curEditId: "",
-      defaultProp: {
-        children: "children",
-        label: "name"
-      },
-      levelOptions: [
-        { value: "涓�绾�", label: "涓�绾�" },
-        { value: "浜岀骇", label: "浜岀骇" },
-        { value: "涓夌骇", label: "涓夌骇" },
-        { value: "鍥涚骇", label: "鍥涚骇" },
-        { value: "浜旂骇", label: "浜旂骇" }
+      page: 1,
+      size: 20, //鍒嗛〉鐩稿叧
+      total: 0, //鎬绘暟
+      companyCodeOptions: [
+        {
+          value: "370300010",
+          label: "370300010/姹囦赴"
+        },
+        {
+          value: "370300450",
+          label: "370300450/娴风泭"
+        },
+        {
+          value: "370300440",
+          label: "370300440/閲戞眹涓�"
+        },
+        {
+          value: "370300480",
+          label: "370300480/涓眹"
+        },
+        {
+          value: "370380545",
+          label: "370380545/閿︽眹"
+        }
       ]
     }
   },
-  // created() {
-  //   this.userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
-  //   this.findUserList()
-  //   this.getIndustrys()
-  //   this.fetchSysMenus()
-  //   this.fetchDataTree()
-  // },
-  // mounted() {
-  //   this.TreeDataPool.reset()
-  //   this.TreeDataPool.multiple = true
-  //   this.VideoPhotoData.queryTaskList()
-  // },
+  async created() {
+    let query = { pageIndex: this.page, pageSize: this.size, keyword: this.inputText }
+    this.query = query
+    let res = await camerasList(query)
+    this.dataList = res.data
+    this.total = res.total
+    this.scene_nameOptions = this.Constants.sceneNameOptions
+    this.pageInit()
+  },
+
   methods: {
-    fetchDataTree() {
-      getDataTree({ userId: this.userInfo.id }).then((res) => {
-        this.DataTree = res.data.dataTree
-      })
+    async changeAll(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()
+      }
     },
-    fetchSysMenus() {
-      getMenu().then((rsp) => {
-        if (rsp && rsp.success) {
-          this.sysMenus = rsp.data.menus
-          // this.userMenus = [];
+    changeSwitch(val, 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) => {
+        if (res && res.success) {
+          this.$message({
+            type: "success",
+            message: res.msg
+          })
         }
       })
     },
-    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()
+    editCameras(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 pageInit() {
+      // 杩涘叆椤甸潰鍓嶇殑鍒濆鍖�
+      let res = await camerasConfig()
+      // 鎬诲紑鍏�
+      if (res && res.success) {
+        res.data.enable === 0 ? (this.value1 = false) : (this.value1 = true)
       }
+      let clusterId = ""
+      let clusterReq = await getClusterDevList()
+      // 鏌ヨ
+      if (clusterReq && clusterReq.success) {
+        if (clusterReq.data.clusterList.length > 0) {
+          clusterId = clusterReq.data.clusterList[0].cluster_id
+        }
+      }
+      let camereReq = await getLocalCameraTree({ clusterId: clusterId })
+      // 杩欎釜鏄� 娣诲姞鏃剁殑鐐逛綅 鏄粠鎽勫儚鏈洪〉闈� 鏉ョ殑
+      let array = []
+      this.cameraOptions = traverse(camereReq.data.treeMenu, array)
     },
     addPoint() {
       this.isShowAdd = true
+      this.tip = 1
       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.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(",")
+    }, //y
+    save() {
+      this.$refs["ruleForm"].validate((valid) => {
+        if (valid) {
+          if (this.tip !== 1) {
+            // tip1 鏄坊鍔� 鍏朵粬鏄紪杈�
+            let obj = this.cameraOptions.find((item) => item.name === this.ruleForm.CameraName)
+            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) => {
+              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)
+            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
+            }
+            // 鏂板缓
+            camerasCreate(params).then((res) => {
+              if (res && res.success) {
+                this.$message({
+                  type: "success",
+                  message: res.msg
+                })
+                this.goback()
+                this.checkCamerasList()
+              }
+            })
           }
-          if (rsp.data.level != "") {
-            this.smsLevelConfig = rsp.data.level.split(",")
-          }
-          this.smsEnable = rsp.data.enable
+        } else {
+          return false
         }
       })
-
-      // 鏌ヨ褰撳墠鐢ㄦ埛鏉冮檺涓嬫墍鏈夊彲绠$悊鐨勬憚鍍忔満
-      if (row.dataIds) {
-        sessionStorage.setItem("clusterId", row.dataIds[0])
-        await this.TreeDataPool.fetchTreeData()
-      }
-
-      // 鐢╡mail瀛楁鏆傛椂浠f浛鎽勫儚鏈洪泦鍚堝瓧娈�
-      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("纭瑕佸垹闄よ鐢ㄦ埛鍚�, 鏄惁缁х画?", "鎻愮ず", {
+    handleSizeChange(size) {
+      this.size = size
+      this.checkCamerasList(1)
+    },
+    //鍒嗛〉鍔熻兘
+    refrash(page) {
+      this.page = page
+      this.checkCamerasList(1)
+    },
+    delCameras(row) {
+      this.$confirm("纭瑕佸垹闄よ鐐逛綅鍚�, 鏄惁缁х画?", "鎻愮ず", {
         confirmButtonText: "纭畾",
         cancelButtonText: "鍙栨秷",
         type: "warning"
       }).then(async () => {
-        let rsp = await deleteUser({ id: row.id })
+        let rsp = await camerasDelete({ id: row.id })
         if (rsp && rsp.success) {
           this.$message({
             type: "success",
             message: "鍒犻櫎鎴愬姛!"
           })
         }
-
-        this.findUserList()
+        this.checkCamerasList()
       })
+    },
+    async checkCamerasList(val) {
+      this.tbLoading = true
+      if (val === 1) {
+        let query = { pageIndex: this.page, pageSize: this.size, keyword: this.inputText }
+        this.query = query
+        let res = await camerasList(query)
+        this.dataList = res.data
+        this.total = res.total
+      } else {
+        let res = await camerasList(this.query)
+        this.dataList = res.data
+        this.total = res.total
+      }
+
+      setTimeout(() => {
+        this.tbLoading = false
+      }, 300)
     },
     resetUser() {
-      this.ruleForm = {
-        id: "",
-        username: "",
-        userType: "",
-        password: "",
-        trueName: "",
-        companyName: "",
-        phoneNum: "",
-        email: "",
-        isChangePwd: false,
-        address: [],
-        industryId: "",
-        areaId: "",
-        provinceId: "",
-        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()
-      if (res.success) {
-        this.industrys = res.data.dics
-      } else {
-        console.log("鏌ヨ琛屼笟鍒楄〃澶辫触锛�")
-      }
-    },
-    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() {
-      findUserList({
-        inputText: this.inputText,
-        page: this.page,
-        size: this.size,
-        authDuration: this.timeLength
-      })
-        .then((res) => {
-          if (res.success) {
-            this.dataList = res.data.dataList
-            this.total = res.data.total
-          } else {
-            this.$notify.error("鍔犺浇瀛愯处鎴峰垪琛ㄥけ璐�")
-          }
-        })
-        .catch((e) => {
-          this.$notify.error(e.msg)
-        })
+      // this.ruleForm. = {
+      this.ruleForm.CameraName = ""
+      this.ruleForm.ChannelCode = ""
+      this.ruleForm.CompanyCode = ""
+      this.ruleForm.Sceneslist = []
+      this.ruleForm.StartTime = ""
+      this.ruleForm.EndTime = ""
     },
     goback() {
       this.isShowAdd = false
-      this.isEditing = false
-      this.isShowRelate = false
-      this.activeIndex = 0
-    },
-    goto(i) {
-      this.activeIndex = i
-    },
-    reset() {
-      this.inputText = ""
-      this.timeLength = null
-    },
-
-    //鍒嗛〉鍔熻兘
-    handleSizeChange(size) {
-      this.size = size
-      this.findUserList()
-    },
-    //鍒嗛〉鍔熻兘
-    refrash(page) {
-      this.page = page
-      this.findUserList()
-    },
-
-    // 鐢熸垚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))
-      })
     }
   }
 }
@@ -667,6 +599,8 @@
     display: flex;
     margin: 20px 0;
     text-align: center;
+    justify-content: space-between;
+
     .add {
       margin-right: 20px;
       width: 126px;
@@ -693,7 +627,15 @@
       }
     }
   }
-
+  .switchBox {
+    display: flex;
+    align-items: center;
+    float: right;
+    position: absolute;
+    right: 20px;
+    top: 130px;
+    font-size: 14px;
+  }
   .el-table ::v-deep {
     background-color: rgb(233, 235, 238);
     padding: 1px;
@@ -796,6 +738,13 @@
 </style>
 
 <style>
+/* .el-switch__core {
+  height: 32px !important;
+}
+.el-switch__core::after {
+  height: 30px !important;
+  width: 30px !important;
+} */
 .el-date-table td.start-date span,
 .el-date-table td.end-date span {
   background-color: #0065ff;
@@ -810,4 +759,17 @@
   color: #0065ff;
   border-color: #0065ff;
 }
+
+/* .el-switch__core {
+  width: 40px !important;
+  height: 20px;
+}
+.el-switch__core::after {
+  width: 16px;
+  height: 16px;
+  margin-top: -1px;
+}
+.el-switch.is-checked .el-switch__core::after {
+  margin-left: -17px;
+} */
 </style>

--
Gitblit v1.8.0