he wei
2025-06-06 895129470d7ee48183fc15b9ee18ef0880503e5d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<script>
import createWs from "@/assets/js/websocket";
const WSMixin = createWs("hrTmpFlow");
 
export default {
  name: "ApproveDialog",
  mixins: [WSMixin],
  data() {
    return {
      isFirstShow: true,
    };
  },
  methods: {
    onWSOpen() {
      this.$nextTick(() => {
        this.sendMessage();
      });
    },
    sendMessage() {
      if (!this.isWSOpen) {
        return false;
      }
      let params = {
        pageNum: 1,
        pageSize: 10,
        type: 0, // 流程类型
        status: 1, // 状态-审批中
      };
      // console.log("=====9=", params, JSON.stringify(params));
      this.SOCKET.send(JSON.stringify(params));
    },
    onWSMessage(res) {
      res = JSON.parse(res.data);
      if (res.code === 1 && res.data && this.isFirstShow) {
        let approveNum = res.data.statistics.data[1];
        if (approveNum) {
          this.$confirm(
            "存在需要审批的任务:" + approveNum + "个",
            "系统提示",
            {
              confirmButtonText: "去审批",
              cancelButtonText: "取消",
              type: "info",
            }
          )
            .then(() => {
              this.$router.push("/OPSAllocation/flowManage");
            })
            .catch(() => {});
        }
      }
      this.isFirstShow = false;
    },
  },
  computed: {
    isWSOpen: {
      cache: false,
      get() {
        return this.SOCKET && 1 == this.SOCKET.readyState;
      },
    },
  },
  mounted() {},
};
</script>
 
<template>
  <div></div>
</template>
 
<style scoped></style>