Browse Source

解除绑定先调用接口且成功后再处理socket

master
wangzhonglu 1 month ago
parent
commit
45e06ffb85
1 changed files with 23 additions and 18 deletions
  1. 23
    18
      src/views/schoolSection/deviceManage/deviceManage.vue

+ 23
- 18
src/views/schoolSection/deviceManage/deviceManage.vue View File

1648
     },
1648
     },
1649
     // 解除绑定
1649
     // 解除绑定
1650
     controlRemoveBind(snList, useridList) {
1650
     controlRemoveBind(snList, useridList) {
1651
-      let controlWSMsg = new ControlWSMsg(
1652
-        controlWs.ws,
1653
-        this.userInfo.adminid,
1654
-        snList
1655
-      );
1656
-      controlWSMsg.removeBind();
1657
-      controlWSMsg.send((isSend) => {
1658
-        if (isSend) {
1659
-          this.$Message.success("推送成功");
1660
-        } else {
1661
-          this.$Message.error("推送失败");
1662
-        }
1663
-      });
1664
       this.$refs.deviceTable.selectAll(false);
1651
       this.$refs.deviceTable.selectAll(false);
1665
       let form = {
1652
       let form = {
1666
         pushType: 8,
1653
         pushType: 8,
1667
         pushObj: 1
1654
         pushObj: 1
1668
       };
1655
       };
1669
       form.userids = useridList;
1656
       form.userids = useridList;
1670
-      this.addPushLog(form).then(() => {
1671
-        this.getList();
1672
-      });
1657
+      this.addPushLog(form)
1658
+        .then(() => {
1659
+          let controlWSMsg = new ControlWSMsg(
1660
+            controlWs.ws,
1661
+            this.userInfo.adminid,
1662
+            snList
1663
+          );
1664
+          controlWSMsg.removeBind();
1665
+          controlWSMsg.send((isSend) => {
1666
+            if (isSend) {
1667
+              this.$Message.success("推送成功");
1668
+            } else {
1669
+              this.$Message.error("推送失败");
1670
+            }
1671
+          });
1672
+          this.getList();
1673
+        })
1674
+        .catch(() => {
1675
+          this.getList();
1676
+        });
1673
     },
1677
     },
1674
     // 添加推送日志
1678
     // 添加推送日志
1675
     addPushLog(form) {
1679
     addPushLog(form) {
1676
-      return new Promise((resolve) => {
1680
+      return new Promise((resolve, reject) => {
1677
         if (form.userids && form.userids.length === 0) {
1681
         if (form.userids && form.userids.length === 0) {
1678
-          resolve();
1682
+          reject();
1679
           return;
1683
           return;
1680
         }
1684
         }
1681
         logPush_add(form).then((data) => {
1685
         logPush_add(form).then((data) => {
1682
           if (data.code === 0) {
1686
           if (data.code === 0) {
1683
             resolve();
1687
             resolve();
1684
           } else {
1688
           } else {
1689
+            reject();
1685
             this.$Message.error(data.msg);
1690
             this.$Message.error(data.msg);
1686
           }
1691
           }
1687
         });
1692
         });

Loading…
Cancel
Save