瀏覽代碼

1、人脸下发禁用成功

slowslo 4 年之前
父節點
當前提交
f08ef95270

+ 3 - 38
src/components/device-door/comps/device-door-crud.vue

@@ -10,28 +10,6 @@
       <template slot="menuLeft">
         <el-button @click="pushFace" size="mini" type="primary" v-if="$isNotEmpty(selectionList)">确认下发</el-button>
       </template>
-      <template slot="menu" slot-scope="{row}">
-        <el-button @click="openDoor(row)" size="small" type="text">远程开门</el-button>
-      </template>
-
-
-      <template slot="mapSelectForm" slot-scope="scope">
-        <div>
-          <el-button @click="mapVisible = true">选择地址</el-button>
-
-          <el-dialog :append-to-body="true" :close-on-click-modal="false" :modal-append-to-body="false"
-            :visible.sync="mapVisible" title="编辑地址" width="80%">
-            <editPolygonMap v-if="mapVisible" :editForm.sync="scope.row" :region.sync="scope.row.address"
-              :latitude.sync="scope.row.latitude" :longitude.sync="scope.row.longitude" :visible.sync="mapVisible">
-            </editPolygonMap>
-          </el-dialog>
-        </div>
-      </template>
-      <template slot="residentialId" slot-scope="scope">{{scope.row.residentialName}}</template>
-      <template slot="residentialIdForm" slot-scope="scope">
-        <select-dialog-residential :id="form.residentialId" :name="form.residentialName" :callback="selectCallback">
-        </select-dialog-residential>
-      </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>
@@ -57,11 +35,6 @@
   import SelectDialogResidential from "@/components/select-dialog/select-dialog-residential";
   import {deepClone} from "@/util/util.js"
   export default {
-    components: {
-      SelectDialogResidential,
-      customAvueMap,
-      editPolygonMap
-    },
     data() {
       return {
         mapVisible: false,
@@ -92,7 +65,8 @@
           menuAlign: 'center',
           dialogClickModal: false,
           menuWidth: 350,
-          column: [{
+          column: [
+            {
               label: "设备名称",
               prop: "name",
               search: true,
@@ -271,16 +245,7 @@
     },
 
     watch: {
-      'form.mapSelect': {
-        handler: function(value) {
-          if (!value) {
-            return
-          } else {
-            this.form.longitude = this.form.mapSelect.longitude;
-            this.form.latitude = this.form.mapSelect.latitude;
-          }
-        },
-      }
+
     },
     methods: {
       pushFace(){

+ 44 - 117
src/components/device-door/comps/device-door-simple-crud.vue → src/components/device-door/comps/device-door-permissions-crud.vue

@@ -1,50 +1,41 @@
 <template>
   <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" @on-load="onLoad">
-      <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>
-    </avue-crud>
+    <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>
+      <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>
+        </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>
+      </avue-crud>
+    </el-dialog>
   </div>
 </template>
 
 <script>
   import {
     getList,
-    getDetail,
-    add,
-    update,
-    remove,
-    remoteOpenDoor
-  } from "@/api/device/doordevice.js";
+    deleteFace
+  } from "@/api/estate/useraccesspermissions.js";
   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 {deepClone} from "@/util/util.js";
   export default {
-    components: {
-      SelectDialogResidential,
-      customAvueMap,
-      editPolygonMap
-    },
     data() {
       return {
-        mapVisible: false,
+        deviceShow:false,
         form: {},
         query: {},
+        userData:{},
         loading: true,
         page: {
           pageSize: 10,
@@ -176,101 +167,37 @@
     },
 
     watch: {
-      'form.mapSelect': {
-        handler: function(value) {
-          if (!value) {
-            return
-          } else {
-            this.form.longitude = this.form.mapSelect.longitude;
-            this.form.latitude = this.form.mapSelect.latitude;
-          }
-        },
-      }
+
     },
     methods: {
-      pushFace(){
-        let deviceIds=this.selectionList.map(item=>item.id)
-        this.$emit("pushFace",deviceIds)
-      },
-      openDoor(row) {
-        remoteOpenDoor(row.id, true).then(res => {
-          this.$message({
-            type: "success",
-            message: "操作成功!"
-          });
-        });
-      },
-      selectCallback(row) {
-        this.form.latitude = row.latitude;
-        this.form.longitude = row.longitude;
-        this.form.address = row.address;
-        this.form.residentialId = row.id;
-        this.form.residentialName = row.name;
-      },
-      rowSave(row, done, loading) {
-        add(row).then(() => {
-          this.onLoad(this.page);
-          this.$message({
-            type: "success",
-            message: "操作成功!"
-          });
-          done();
-        }, error => {
-          loading();
-          window.console.log(error);
-        });
-      },
-      rowUpdate(row, index, done, loading) {
-        update(row).then(() => {
-          this.onLoad(this.page);
+      deleteFace(){
+        let deviceIdList=this.selectionList.map(item=>item.id);
+        let params ={
+          deviceIds: deviceIdList.join(","),
+          userId: this.userData.id,
+          userType: this.userData.userType
+        };
+        deleteFace(params).then(res =>{
+          this.deviceShow = false;
           this.$message({
             type: "success",
             message: "操作成功!"
           });
-          done();
-        }, error => {
-          loading();
-          console.log(error);
         });
       },
-      rowDel(row) {
-        this.$confirm("确定将选择数据删除?", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning"
-          })
-          .then(() => {
-            return remove(row.id);
-          })
-          .then(() => {
-            this.onLoad(this.page);
-            this.$message({
-              type: "success",
-              message: "操作成功!"
-            });
-          });
-      },
-      handleDelete() {
-        if (this.selectionList.length === 0) {
-          this.$message.warning("请选择至少一条数据");
-          return;
+      showDialog(data){
+        if (data.imgError===true) {
+          this.$message.error('下发失败,人脸照片加载错误')
+          return
         }
-        this.$confirm("确定将选择数据删除?", {
-            confirmButtonText: "确定",
-            cancelButtonText: "取消",
-            type: "warning"
-          })
-          .then(() => {
-            return remove(this.ids);
-          })
-          .then(() => {
-            this.onLoad(this.page);
-            this.$message({
-              type: "success",
-              message: "操作成功!"
-            });
-            this.$refs.crud.toggleSelection();
-          });
+        let page = {
+          pageSize: this.size,
+          currentPage: this.current,
+        }
+        this.fetchList(page, {"userId": data.id});
+
+        this.userData=data;
+        this.deviceShow=true;
       },
       beforeOpen(done, type) {
         if (["edit", "view"].includes(type)) {

+ 5 - 0
src/components/device-door/device-door.vue

@@ -166,6 +166,11 @@
           userFace:this.userData.userFace
         }
         pushFace(params).then(res=>{
+          this.deviceShow = false;
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
           console.log(res);
         })
       },

+ 36 - 14
src/views/smartaccess/comps/face-card.vue

@@ -158,14 +158,14 @@
     <server-form v-if="menuObj.index==2" ref="formRef" @reloadData="fetchData"></server-form>
     <snap-form v-if="menuObj.index==3" ref="formRef" @reloadData="fetchData"></snap-form>
     <device-door ref="deviceDoor"></device-door>
-    <el-dialog title="请选择要下发的设备" :visible.sync="deviceShow" :destroy-on-close="true" center :append-to-body="true" :modal-append-to-body="true" width="55%">
-      <device-door-simple-crud ref="deviceDoorSimpleCrud" @deleteFace="deleteFace"></device-door-simple-crud>
-    </el-dialog>
+<!--    <el-dialog title="请选择要下发的设备" :visible.sync="deviceShow" :destroy-on-close="true" center :append-to-body="true" :modal-append-to-body="true" width="55%" @close="closeDoorDevicePermissionsDialog">-->
+    <device-door-permissions-crud ref="deviceDoorPermissionsCrud"></device-door-permissions-crud>
+<!--    </el-dialog>-->
   </div>
 </template>
 <script>
   import deviceDoor from "@/components/device-door/device-door.vue"
-  import deviceDoorSimpleCrud from "@/components/device-door/comps/device-door-simple-crud.vue"
+  import deviceDoorPermissionsCrud from "@/components/device-door/comps/device-door-permissions-crud.vue"
   import {
     getToken
   } from '@/util/auth';
@@ -207,7 +207,7 @@
     name: "face-card",
     components: {
       deviceDoor,
-      deviceDoorSimpleCrud,
+      deviceDoorPermissionsCrud,
       staffForm,
       guestForm,
       serverForm,
@@ -224,7 +224,6 @@
           index: 0
         },
         statusObj: {},
-        deviceShow: false,
         selectedUser: null,
 
         current: 1,
@@ -363,6 +362,10 @@
       this.fetchData()
     },
     methods: {
+      closeDoorDevicePermissionsDialog(){
+        this.selectedUser = null;
+        this.deviceShow = false;
+      },
       deleteFace(deviceIds) {
         if (this.$isEmpty(deviceIds)) {
           this.$message.error('请选择要下发的设备')
@@ -421,8 +424,24 @@
         } else if (name == '删除') {
           this.$refs.formRef.rowDel(item.id);
         } else if (name == '禁用') {
-          this.deviceShow = true;
-          this.selectedUser = item;
+          let index=this.menuObj.index || 0
+          if (index==0) {
+            //常驻人员
+            item.targetType=1 //人脸入库(设备库)类型 1:白名单 2:访客 3:黑名单
+            item.userType='QYYG_';  //用户类型,QYYG_:企业员工,FWY_:服务员,FK_:访客。ADMIN_:管理员
+            item.userFace=item.face;
+          }else if (index==1) {
+            //来访人员
+            item.targetType=2;
+            item.userType='FK_';
+            item.userFace=item.imageUri;
+          }else if (index==2) {
+            //服务人员
+            item.targetType=1;
+            item.userType='FWY_';
+            item.userFace=item.faceUrl;
+          }
+          this.$refs.deviceDoorPermissionsCrud.showDialog(item);
         }
       },
       //下发人脸
@@ -431,17 +450,20 @@
         if (index==0) {
           //常驻人员
           item.targetType=1 //人脸入库(设备库)类型 1:白名单 2:访客 3:黑名单
-          item.userType='QYYG_'  //用户类型,QYYG_:企业员工,FWY_:服务员,FK_:访客。ADMIN_:管理员
+          item.userType='QYYG_';  //用户类型,QYYG_:企业员工,FWY_:服务员,FK_:访客。ADMIN_:管理员
+          item.userFace=item.face;
         }else if (index==1) {
           //来访人员
-          item.targetType=2
-          item.userType='FK_'
+          item.targetType=2;
+          item.userType='FK_';
+          item.userFace=item.imageUri;
         }else if (index==2) {
           //服务人员
-          item.targetType=1
-          item.userType='FWY_'
+          item.targetType=1;
+          item.userType='FWY_';
+          item.userFace=item.faceUrl;
         }
-        this.$refs.deviceDoor.showDialog(item, true, true);
+        this.$refs.deviceDoor.showDialog(item);
       },
       actived(e) {
         this.resetPageParams();

+ 6 - 2
src/views/smartaccess/form/staff.vue

@@ -36,6 +36,7 @@
     pushFace,
     deleteFace,
   } from "@/api/estate/useraccesspermissions";
+  import {deepClone} from "@/util/util.js";
   export default {
     data() {
       return {
@@ -139,12 +140,14 @@
           }, {
             label: '企业信息',
             prop: 'group2',
-            column: [{
+            column: [
+              {
                 label: "所属园区",
                 prop: "agencyId",
                 type: "select",
                 overHidden: true,
                 remote: true,
+                dataType: "string",
                 cascaderItem: ['enterpriseId'],
                 dicUrl: '/api/cyzh-community/agency/list?size=100&name={{key}}',
                 dicFormatter: (res) => {
@@ -174,6 +177,7 @@
                   label: "enterpriseName",
                   value: "id"
                 },
+                dataType: "string",
                 rules: [{
                   required: true,
                   message: "请输入所属企业",
@@ -268,7 +272,7 @@
         this.model = {}
       },
       submit(form, done) {
-        let data = this.$deepClone(form)
+        let data = deepClone(form)
         if (this.isAdd) {
           data.id = ''
         }