<template>
  <div>
    <h3>任务详情</h3>
    <el-form label-width="110px">
      <el-row class="el-row-table">
        <el-col :span="12">
          <el-form-item label="任务名称">
            <span v-if="detailInfo.fName">{{ detailInfo.fName }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="任务唯一编码">
            <span v-if="detailInfo.fUniqueCode">{{ detailInfo.fUniqueCode }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="任务归属">
            <span v-if="detailInfo.fTaskBelong">{{ detailInfo.fTaskBelong }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="任务类型">
            <span v-if="detailInfo.fTaskType">{{ fTaskTypeFormat(detailInfo) }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="是否下发">
            <span v-if="detailInfo.fDistributeFlag">{{ fDistributeFlagFormat(detailInfo) }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="24">
          <el-form-item label="任务说明">
            <span v-if="detailInfo.fDesc">{{ detailInfo.fDesc }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="任务开始时间">
            <span v-if="detailInfo.fStartTime">{{ detailInfo.fStartTime }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>


        <el-col :span="12">
          <el-form-item label="任务截至时间">
            <span v-if="detailInfo.fEndTime">{{ detailInfo.fEndTime }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="任务状态">
            <span v-if="detailInfo.fStatus">{{ fStatusFormat(detailInfo) }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="删除标记">
            <span v-if="detailInfo.fDeleteFlag && detailInfo.fDeleteFlag.toString()">{{ fDeleteFlagFormat(detailInfo) }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="日常检查频率">
            <span v-if="detailInfo.inspectionFrequency">{{ detailInfo.inspectionFrequency }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="对象数量比例">
            <span v-if="detailInfo.quantityRatio">{{ detailInfo.quantityRatio }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="24">
          <el-form-item label="描述">
            <span v-if="detailInfo.fRemark">{{ detailInfo.fRemark }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="创建时间">
            <span v-if="detailInfo.fCreateTime">{{ detailInfo.fCreateTime }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="创建人">
            <span v-if="detailInfo.fCreateBy">{{ detailInfo.fCreateBy }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="修改时间">
            <span v-if="detailInfo.fUpdateTime">{{ detailInfo.fUpdateTime }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="修改人">
            <span v-if="detailInfo.fModifyBy">{{ detailInfo.fModifyBy }}</span>
            <span v-else>-</span>
          </el-form-item>
        </el-col>

      </el-row>
    </el-form>
  </div>
</template>

<script>
  export default {
    name: "task-info",
    props:{
        detailInfo:{
          type: Object
        }
    },
    data(){
      return{
        fTaskTypeOptions: [],
        // 是否下发 0-不下发 1 - 下发字典
        fDistributeFlagOptions: [],
        // 任务状态，NEW-未开始，ING-进行中，DON-已完结，OVD-超期未完成字典
        fStatusOptions: [],
        // 删除标记，0-可用，1-已删除字典
        fDeleteFlagOptions: [],
      }
    },
    created(){
      this.getTaskDict();
    },
    methods:{
      getTaskDict(){
        this.getDicts("t_supervision_task_type").then(response => {
            this.fTaskTypeOptions = response.data;
        });
        this.getDicts("t_distribute_flag").then(response => {
            this.fDistributeFlagOptions = response.data;
        });
        this.getDicts("t_supervision_task_status").then(response => {
            this.fStatusOptions = response.data;
        });
        this.getDicts("t_delete_flag").then(response => {
            this.fDeleteFlagOptions = response.data;
        });
      },
      // 任务类型 0-专项 1-日常 2-第三方评估抽查 3-随机抽查字典翻译
      fTaskTypeFormat(row, column) {
        return this.selectDictLabel(this.fTaskTypeOptions, row.fTaskType);
      },
      // 是否下发 0-不下发 1 - 下发字典翻译
      fDistributeFlagFormat(row, column) {
        return this.selectDictLabel(this.fDistributeFlagOptions, row.fDistributeFlag);
      },
      // 任务状态，NEW-未开始，ING-进行中，DON-已完结，OVD-超期未完成字典翻译
      fStatusFormat(row, column) {
        return this.selectDictLabel(this.fStatusOptions, row.fStatus);
      },
      // 删除标记，0-可用，1-已删除字典翻译
      fDeleteFlagFormat(row, column) {
        return this.selectDictLabel(this.fDeleteFlagOptions, row.fDeleteFlag);
      },
    }
  }
</script>

<style scoped>

</style>
