<script setup lang="ts">
defineProps<{ data: any }>()

function getOrderTypeName1(type: number) {
  switch (type) {
    case 0:
    case 1:
      return "发起人"
    case 2:
      return "督查审核"
    case 3:
      return "督查转交"
    case 4:
      return "现场督查"
    case 5:
      return "企业上传"
  }
}

function getOrderTypeName2(type: number) {
  switch (type) {
    case 0:
    case 2:
    case 3:
    case 4:
      return "督查部门"
    case 1:
    case 5:
      return "企业用户"
  }
}

function getOrderTypeName3(type: number) {
  switch (type) {
    case 0:
      return "催办内容"
    case 1:
      return "上报备注"
    case 2:
      return "审核人"
    case 3:
      return "备注"
    case 4:
    case 5:
      return "上报备注"
  }
}
</script>

<template>
  <el-row>
    <el-col :span="12">
      <dl>
        <dt>企业名称：</dt>
        <dd>{{ data.warnDetail?.company_name }}</dd>
      </dl>
    </el-col>
    <el-col :span="12">
      <dl>
        <dt>异常类型：</dt>
        <dd>{{ data.warnDetail?.warn_type_name }}</dd>
      </dl>
    </el-col>
    <el-col :span="12">
      <dl>
        <dt>告警设备：</dt>
        <dd>{{ data.warnDetail?.device_name }}</dd>
      </dl>
    </el-col>
    <el-col :span="12">
      <dl>
        <dt>告警时间：</dt>
        <dd>{{ data.warnDetail?.warn_start_time }}</dd>
      </dl>
    </el-col>
  </el-row>
  <div class="separator mt-2 mb-5"></div>
  <template v-for="(item, i) in data.processInfoList" :key="i">
    <el-row>
      <el-col :span="12">
        <dl class="text-primary">
          <dt>时间：</dt>
          <dd>{{ item.work_order_process_time }}</dd>
        </dl>
      </el-col>
      <el-col :span="12">
        <dl class="text-primary">
          <dt>{{ getOrderTypeName1(item.work_order_type) }}：</dt>
          <dd>{{ getOrderTypeName2(item.work_order_type) }}</dd>
        </dl>
      </el-col>
      <el-col :span="24">
        <dl>
          <dt>{{ getOrderTypeName3(item.work_order_type) }}：</dt>
          <dd v-if="item.work_order_type == 2">{{ item.audit_state_name }}</dd>
          <dd v-else>{{ item.content }}</dd>
        </dl>
      </el-col>
      <el-col v-if="item.work_order_type == 2" :span="24">
        <dl>
          <dt>审核意见：</dt>
          <dd>{{ item.content }}</dd>
        </dl>
      </el-col>
    </el-row>
    <el-row v-if="item.work_order_type == 1 || item.work_order_type == 4 || item.work_order_type == 5">
      <el-col :span="6" v-for="(pic, j) in item.fileList" :key="j">
        <el-image
          :src="pic.url"
          :initial-index="j"
          :preview-src-list="
                pic.map((v:any) => {
                  return v.url
                })
              "
          fit="scale-down"
        ></el-image>
      </el-col>
    </el-row>
    <div class="separator mt-2 mb-5"></div>
  </template>
</template>
