Browse Source

智能门禁接口调整

fanghuisheng 2 months ago
parent
commit
c569e69419

+ 7 - 0
src/api/business/door.js

@@ -46,6 +46,13 @@ export function doorApi() {
                 data,
             });
         },
+        MyPage: (data) => {
+            return request({
+                url: `/service-eg/egDevice/wePage`,
+                method: 'POST',
+                data,
+            });
+        },
         RecordSelect: (data) => {
             return request({
                 url: `/service-eg/egRecord/page`,

+ 1 - 1
src/pages/business/doorManage/list/index.vue

@@ -102,7 +102,7 @@ const { tabsList, tabsCurrent, dataList } = toRefs(state);
 function init() {
   state.loading = true;
   doorApi()
-    .Select({
+    .MyPage({
       current: state.current, //页数
       size: state.pageSize, //条数
     })

+ 18 - 3
src/store/modules/control.js

@@ -12,7 +12,8 @@ import permission from "@/plugins/permission.plugins.js";
 
 const controlStore = defineStore("control", {
     state: () => ({
-        pageFunction: [],
+        pageFunction: [], //被包含的功能
+        isClicked: false, //按钮是否被点击
         form: {
             linkUrl: "",
             port: "",
@@ -21,7 +22,7 @@ const controlStore = defineStore("control", {
             doorName: undefined,
         },
         modal: {
-            show: false,
+            show: true,
         },
         picker: {
             show: false,
@@ -241,6 +242,14 @@ const controlStore = defineStore("control", {
          */
         openDoor(event) {
             var that = this
+
+            if (this.isClicked) {
+                modal.msg("请勿重复点击!");
+                return;
+            } else {
+                this.isClicked = true;
+            }
+
             doorApi()
                 .control({
                     domain: !getToken() ? this.form.domain : undefined, //域名
@@ -252,11 +261,17 @@ const controlStore = defineStore("control", {
                     commandValue: 1,
                 })
                 .then((item) => {
-                    console.log("开门成功");
+                    modal.msg("开门成功");
+                    setTimeout(() => {
+                        this.isClicked = false;
+                    }, 2000);
                     that.insertDoorRecord(event, "成功");
                 })
                 .catch((err) => {
                     console.log(err);
+                    setTimeout(() => {
+                        this.isClicked = false;
+                    }, 2000);
                     that.insertDoorRecord(event, "失败:" + err);
                 });
         },