mixin.js 912 Bytes
module.exports = {
  data(){
    return {
      workers: {
        video_free: 0,
        video_busy: 0
      },
      dev_unid: localStorage.getItem("dev_unid"),
      taskstatus:{
        running: 0,
        total: 0
      }
    }
  },
  methods: {
    getDevStatus() {
      this.$api.device.getDevStatus(this.dev_unid).then(res => {
        if (res.ecode != 500) {
          this.workers = res.works;
        } else {
          this.$message({
            type: "error",
            message: res.enote
          });
        }
      });
    },
    getSubTaskStatus() {
      this.$api.device.getSubTaskStatus().then(res => {
        if (res.ecode != 500) {
          this.taskstatus = res;
        } else {
          this.$message({
            type: "error",
            message: res.enote
          });
        }
      });
    }
  },
  created() {
    this.getSubTaskStatus();
    this.getDevStatus();
  }
}