Переглянути джерело

1、人脸下发时,显示已下发的设备

slowslo 4 роки тому
батько
коміт
682adce6a3

+ 8 - 0
src/api/estate/useraccesspermissions.js

@@ -73,3 +73,11 @@ export const deleteFace = (row) => {
     data: row
   })
 }
+
+export const listByUser = (params) => {
+  return request({
+    url: '/api/cyzh-estate/useraccesspermissions/listByUser',
+    method: 'post',
+    data: params
+  })
+}

+ 25 - 21
src/components/device-door/comps/device-door-crud.vue

@@ -10,9 +10,9 @@
       <template slot="menuLeft">
         <el-button @click="pushFace" size="mini" type="primary" v-if="$isNotEmpty(selectionList)">确认下发</el-button>
       </template>
-      <template slot="deviceStatus" slot-scope="{row}">
-        <el-tag v-if="row.deviceStatus === 0" type="danger">离线</el-tag>
-        <el-tag v-if="row.deviceStatus === 1" type="success">在线</el-tag>
+      <template slot="hasPush" slot-scope="{row}">
+        <el-tag v-if="row.hasPush === 0" type="danger">无权限</el-tag>
+        <el-tag v-if="row.hasPush === 1" type="success">已下发</el-tag>
       </template>
     </avue-crud>
   </div>
@@ -30,11 +30,11 @@
   import {
     mapGetters
   } from "vuex";
-  import customAvueMap from "@/components/residential/customAvueMap.vue"
-  import editPolygonMap from "@/components/residential/editPolygonMap.vue";
-  import SelectDialogResidential from "@/components/select-dialog/select-dialog-residential";
-  import {deepClone} from "@/util/util.js"
+  import {listByUser as getUserAccessPermissionsList} from "@/api/estate/useraccesspermissions.js"
   export default {
+    props:{
+      userData:{type:Object}
+    },
     data() {
       return {
         mapVisible: false,
@@ -46,6 +46,7 @@
           currentPage: 1,
           total: 0
         },
+        userAccessPermissionsList:[],
         selectionList: [],
         option: {
           height: 'auto',
@@ -206,22 +207,14 @@
               prop: "heartbeatTime"
             },
             {
-              label: "设备状态",
-              prop: "deviceStatus",
-              type: "select",
-              width: 100,
-              dicUrl: "/api/blade-system/dict-biz/dictionary?code=face_device_status",
-              props: {
-                label: 'dictValue',
-                value: 'dictKey'
-              },
-              dataType: "number",
-              display: false,
-              slot: true
+              label: "是否已下发",
+              prop: "hasPush",
+              slot: true,
+              value: 0
             }
-
           ]
         },
+        userPermissionSerialNumList:[],
         data: []
       };
     },
@@ -246,11 +239,17 @@
 
     watch: {
 
+    },
+    created(){
+      getUserAccessPermissionsList({userId:this.userData.id, userType: this.userData.userType}).then(res=>{
+        let data = res.data.data;
+        this.userPermissionSerialNumList = data.map(item => {return item.deviceSerialNum});
+      })
     },
     methods: {
       pushFace(){
         let deviceIds=this.selectionList.map(item=>item.id)
-        this.$emit("pushFace",deviceIds)
+        this.$emit("pushFace",deviceIds);
       },
       openDoor(row) {
         remoteOpenDoor(row.id, true).then(res => {
@@ -384,6 +383,11 @@
           this.page.total = data.total;
           this.data = data.records;
           this.loading = false;
+          this.data.forEach(item => {
+            if(this.userPermissionSerialNumList.indexOf(item.serialNum) > -1){
+              item.hasPush = 1;
+            }
+          })
         })
       },
       onLoad(page, params = {}) {

+ 12 - 39
src/components/device-door/comps/device-door-permissions-crud.vue

@@ -1,15 +1,18 @@
 <template>
   <div>
     <el-dialog title="请选择要下发的设备" :visible.sync="deviceShow" :destroy-on-close="true" center :append-to-body="true" :modal-append-to-body="true" width="55%">
-      <div style="display:flex;margin:6px;flex-wrap: wrap;overflow: hidden;">
-        <el-tag size="mini" type="info" style="margin:4px" class="animate__animated animate__fadeInDown animate__faster" @close="close(item)" closable v-for="(item,index) in selectionList" :key="index">{{item.name}}</el-tag>
-      </div>
+<!--      <div style="display:flex;margin:6px;flex-wrap: wrap;overflow: hidden;">-->
+<!--        <el-tag size="mini" type="info" style="margin:4px" class="animate__animated animate__fadeInDown animate__faster" @close="close(item)" closable v-for="(item,index) in selectionList" :key="index">{{item.name}}</el-tag>-->
+<!--      </div>-->
       <avue-crud :option="option" :table-loading="loading" :data="data" :page="page" :permission="permissionList"
         :before-open="beforeOpen" v-model="form" ref="crud"
         @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
         @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange">
         <template slot="menuLeft">
           <el-button @click="deleteFace" size="mini" type="danger" v-if="$isNotEmpty(selectionList)">确认下发</el-button>
+<!--          <div style="display:flex;margin:6px;flex-wrap: wrap;overflow: hidden;">-->
+          <el-tag size="mini" type="info" style="margin:4px" class="animate__animated animate__fadeInDown animate__faster" @close="close(item)" closable v-for="(item,index) in selectionList" :key="index">{{item.deviceName}}</el-tag>
+<!--          </div>-->
         </template>
         <template slot="deviceStatus" slot-scope="{row}">
           <el-tag v-if="row.deviceStatus === 0" type="danger">离线</el-tag>
@@ -63,25 +66,15 @@
           column: [
             {
               label: "设备名称",
-              prop: "name",
+              prop: "deviceName",
               search: true,
               overHidden: true,
-              rules: [{
-                required: true,
-                message: "请输入名称",
-                trigger: "blur"
-              }]
             },
             {
               label: "设备序列号",
-              prop: "macAddress",
+              prop: "deviceSerialNum",
               hide: true,
               width: 200,
-              rules: [{
-                required: true,
-                message: "请输入Mac编码",
-                trigger: "blur"
-              }]
             },
             {
               label: "所属区域",
@@ -113,7 +106,7 @@
             },
             {
               label: "安装位置",
-              prop: "address",
+              prop: "deviceAddress",
               width: 160,
               overHidden: true,
               rules: [{
@@ -122,26 +115,6 @@
                 trigger: "blur"
               }]
             },
-            {
-              label: "最近心跳",
-              width: 130,
-              prop: "heartbeatTime"
-            },
-            {
-              label: "设备状态",
-              prop: "deviceStatus",
-              type: "select",
-              width: 100,
-              dicUrl: "/api/blade-system/dict-biz/dictionary?code=face_device_status",
-              props: {
-                label: 'dictValue',
-                value: 'dictKey'
-              },
-              dataType: "number",
-              display: false,
-              slot: true
-            }
-
           ]
         },
         data: []
@@ -193,10 +166,9 @@
         let page = {
           pageSize: this.size,
           currentPage: this.current,
-        }
-        this.fetchList(page, {"userId": data.id});
-
+        };
         this.userData=data;
+        this.fetchList(page, {});
         this.deviceShow=true;
       },
       beforeOpen(done, type) {
@@ -246,6 +218,7 @@
       },
       fetchList(page, params) {
         this.loading = true;
+        params.userId = this.userData.id;
         getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
           const data = res.data.data;
           this.page.total = data.total;

+ 6 - 6
src/components/device-door/device-door.vue

@@ -66,7 +66,7 @@
         <!-- 楼层end -->
 
         <!-- 设备 -->
-        <device-door-crud ref="deviceDoorCrud"  @pushFace="pushFace"></device-door-crud>
+        <device-door-crud ref="deviceDoorCrud" :user-data="userData" @pushFace="pushFace"></device-door-crud>
       </div>
     </el-dialog>
   </div>
@@ -122,7 +122,7 @@
       };
     },
     created() {
-      this.fetchResidentialList()
+      this.fetchResidentialList();
     },
     watch: {
       dataChange: {
@@ -160,7 +160,7 @@
         let params={
           deviceIds:deviceIds.join(','),
           userId:this.userData.id,
-          userName: this.userData.name,
+          userName: this.userData.userName,
           userType:this.userData.userType,
           targetType:this.userData.targetType,
           userFace:this.userData.userFace
@@ -179,13 +179,13 @@
           this.$message.error('下发失败,人脸照片加载错误')
           return
         }
-        this.fetchResidentialList({"agencyId": data.agencyId});
-
         this.userData=data
+
+        this.fetchResidentialList({"agencyId": data.agencyId});
         this.deviceShow=true
       },
       hideDialog(){
-        this.deviceShow=false
+        this.deviceShow=false;
       },
       //获取区域
       async fetchResidentialList(params) {

+ 3 - 0
src/views/smartaccess/comps/face-card.vue

@@ -452,16 +452,19 @@
           item.targetType=1 //人脸入库(设备库)类型 1:白名单 2:访客 3:黑名单
           item.userType='QYYG_';  //用户类型,QYYG_:企业员工,FWY_:服务员,FK_:访客。ADMIN_:管理员
           item.userFace=item.face;
+          item.userName=item.realName;
         }else if (index==1) {
           //来访人员
           item.targetType=2;
           item.userType='FK_';
           item.userFace=item.imageUri;
+          item.userName=item.guestName;
         }else if (index==2) {
           //服务人员
           item.targetType=1;
           item.userType='FWY_';
           item.userFace=item.faceUrl;
+          item.userName=item.name;
         }
         this.$refs.deviceDoor.showDialog(item);
       },