subtask.vue 2.67 KB
<template>
  <div class="expande-table-row">
    <span class="label">视频源文件</span>
    <span class="subtask-info">{{ subTaskData.vchan_name }}</span>
    <span class="label">设备地址</span>
    <span class="subtask-info">192.178.99.99</span>
    <span class="label">已用资源</span>
    <span class="subtask-info">22</span>
    <span class="label">设备容量</span>
    <span class="subtask-info">33</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"
        >
          {{ item.in_ip }}
        </el-option>
      </el-select>
    </span>
    <span class="label sub-btn" @click="subMove">确定</span>
  </div>
</template>

<script>
export default {
  data() {
    return {
      assign_id: ""
    };
  },
  props: ["subTaskData", "freeList", "taskData"],
  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"
            });
          }
        });
    }
  },
  created() {},
  watch: {
    
  },
  mounted() {
    this.assign_id = this.subTaskData.assign_id
      ? this.subTaskData.assign_id
      : "";
  }
};
</script>

<style lang="scss" scoped>
.expande-table-row {
  overflow: hidden;
  span {
    float: left;
    border-bottom: 1px solid #ccc;
    overflow: hidden;
  }
  .label {
    width: 6vw;
    text-align: center;
    border-left: 1px solid $border-color;
    background: #f0f0f0;
    height: 40px;
    line-height: 40px;
  }
  .subtask-info {
    border-left: 1px solid #f0f0f0;
    text-align: center;
    overflow: hidden;
    height: 40px;
    line-height: 40px;
  }
  .subtask-info:nth-child(2) {
    width: 9vw;
    overflow: hidden;
  }
  .subtask-info:nth-child(4) {
    width: 6vw;
  }
  .subtask-info:nth-child(6) {
    width: 4.5vw;
  }
  .subtask-info:nth-child(8) {
    width: 4vw;
  }
  .subtask-info:nth-child(10) {
    width: 12vw;
  }
  .sub-btn {
    cursor: pointer;
  }
}
</style>