subtask.vue 4.85 KB
<template>
  <div class="expande-table-row">
    <span class="label labelindex">{{ subindex + 1 }}</span>
    <span class="subtask-info taskstatus" v-html="formater(subTaskData)" @click="showinfo(subTaskData)"></span>
    <span class="label">视频源文件</span>
    <span class="subtask-info">{{ subTaskData.vchan_name }}</span>
    <span class="label">任务ID</span>
    <span class="subtask-info">{{ subTaskData.subtask_id }}</span>
    <!-- <span class="label">设备地址</span>
    <span class="subtask-info">{{ subTaskData.device_ip }}</span> -->
    <!-- <span class="label">已用资源</span>
    <span class="subtask-info">{{ subTaskData.video_busy }}</span>
    <span class="label">设备容量</span>
    <span class="subtask-info">{{ subTaskData.video_total }}</span> -->
    <span class="label">任务信息</span>
    <span class="subtask-info">{{ subTaskData.info }}</span>
    <!-- <span class="label">分析设备</span>
    <span class="subtask-info">
      <el-select v-model="assign_id">
        <el-option
          v-for="(item, index) in freeList"
          :key="index"
          :value="item.device_id"
          :label="item.in_ip"
          v-if="
            subTaskData.plate_type &&
              item.license_info.platType === subTaskData.plate_type
          "
        >
          {{ item.in_ip }} {{ item.license_info.platType }}
        </el-option>
        <el-option
          v-for="(item, index) in freeList"
          :key="index"
          :value="item.device_id"
          :label="item.in_ip"
          v-if="!subTaskData.plate_type"
        >
          {{ item.in_ip }} {{ item.license_info.platType }}
        </el-option>
      </el-select>
    </span> -->
    <span class="label sub-btn" @click="subMove" hidden>确定</span>
  </div>
</template>

<script>
export default {
  data() {
    return {
      assign_id: ""
    };
  },
  props: ["subTaskData", "freeList", "taskData", "subindex"],
  methods: {
    subMove() {
      let taskID = this.taskData.task_id;
      let subTaksID = this.subTaskData.subtask_id;
      this.$api.task.getTaskParams(taskID, subTaksID).then(res => {
        let obj = {};
        obj.mtasks = res.mtasks;
        obj.assign_to = {
          id: this.assign_id,
          flag: 0
        };
        this.subRoi(taskID, subTaksID, obj);
      });
    },
    subRoi(taskid, subtaskid, postObj) {
      this.$api.task
        .editRoi(taskid, subtaskid, postObj, {
          headers: {
            authorization: localStorage.getItem("atoken")
          }
        })
        .then(m => {
          if (m.ecode == "200") {
            this.$message({
              message: "设置成功!",
              type: "success"
            });
          }
        });
    },
    formater(data) {
      if (data.enableStatus == 2) {
        return "<span class='runningbox statusbox'>工作中</span>";
      } else if (data.enableStatus == 1) {
        return "<span class='nomoralbox statusbox'>部署中</span>";
      } else if (data.enableStatus == 3) {
        return "<span class='pausebox statusbox'>暂停中</span>";
      } else if (data.enableStatus == 4) {
        return "<span class='pausebox statusbox'>已暂停</span>";
      } else if (data.enableStatus == 5) {
        return "<span class='deletebox statusbox'>删除中</span>";
      } else if (data.enableStatus == 6) {
        return "<span class='deletebox statusbox'>已删除</span>";
      } else if (data.enableStatus == 7) {
        return "<span class='pausebox statusbox'>启动中</span>";
      } else if (data.enableStatus == 0) {
        return "<span class='nomoralbox statusbox'>未部署</span>";
      } else {
        return "<span class='errorbox statusbox'>异常</span>";
      }
    },
    showinfo(data) {
      console.log("任务状态信息:", data.info);
    }
  },
  created() {
    // console.log(this.subTaskData);
  },
  watch: {},
  mounted() {}
};
</script>

<style lang="scss" scoped>
.expande-table-row {
  width: 79vw;
  overflow: hidden;
  span {
    float: left;
    border-bottom: 1px solid #ccc;
    overflow: hidden;
  }
  span:last-child{
    border-bottom: 1px solid #333;
  }
  .label {
    width: 5vw;
    text-align: center;
    // border-left: 1px solid $border-color;
    background: #f0f0f0;
    height: 40px;
    line-height: 40px;
  }
  .labelindex {
    width: 4vw;
  }
  .taskstatus {
    width: 8vw;
  }
  .subtask-info {
    border-left: 1px solid #f0f0f0;
    text-align: center;
    overflow: hidden;
    height: 40px;
    line-height: 40px;
  }
  .subtask-info:nth-child(4) {
    width: 10vw;
    overflow: hidden;
  }
  .subtask-info:nth-child(6) {
    width: 18vw;
  }
  .subtask-info:nth-child(8) {
    width: 16vw;
    border-right: 1px solid #f0f0f0;
  }
  .subtask-info:nth-child(10) {
    width: 3vw;
  }
  .subtask-info:nth-child(12) {
    width: 3vw;
  }
  .subtask-info:nth-child(14) {
    width: 7vw;
  }
  .sub-btn {
    cursor: pointer;
  }
}
</style>