<template>
  <el-dialog
    title="详情"
    v-model="visible"
    width="1000px"
    height="1500px"
    @close="close"
    append-to-body
    draggable
  >
  <div class="form-container">
      <div style="padding: 16px 16px 0 16px;">
      <el-row :gutter="20">
        <el-col :span="5">
          <span  >工序:</span>
          <span style="margin-left: 15px;" >{{ info.processAlias}}</span>
        </el-col>
        <el-col :span="5">
          <span  >检查状态:</span>
          <span style="margin-left: 15px;">{{ detail.processInspection?detail.processInspection.status == 0 ?'待确认':detail.processInspection.status == 1?'合格':'不合格':'未序检' }}</span>
        </el-col>
        <!-- <el-col :span="5">
          <span>废品总数:</span>
          <span style="margin-left: 15px;">{{ detail.processInspection?detail.processInspection.rejectNum:0}}</span>
        </el-col> -->
        <el-col :span="7">
          <span >备注:</span>
          <span style="margin-left: 15px;">{{detail.processInspection?detail.processInspection.remark:""  }}</span>
        </el-col>
      </el-row>
      </div>
      </div>
      <div class="form-container">
        <el-row :gutter="20" style="margin: 15px 0 0 6px; margin-bottom: 15px">
          <el-col :span="5">
            <span style="font-size: 15px; width: 120px; font-weight: bold"
              >检测详情</span
            >
          </el-col>
        </el-row>
      </div>
          <el-table
            v-loading="loading"
            :data="detail.groupRejectList"
            size="small"
            border
            height="95%"
          >
            <el-table-column
              label="检查标准"
              align="center"
              prop="checkStandard"
            />
            <el-table-column
              label="检查结果"
              align="center"
              prop="reason"
            />
            <el-table-column
              label="废品数量"
              align="center"
              prop="rejectNum"
              width="150"
            />
          </el-table>
      <div class="form-container">
        <el-row :gutter="20" style="margin: 15px 0 0 6px; margin-bottom: 15px">
          <el-col :span="5">
            <span style="font-size: 15px; width: 120px; font-weight: bold"
              >咨询详情</span
            >
          </el-col>
        </el-row>
      </div>
          <el-table
            v-loading="loading"
            :data="detail.consultList"
            size="small"
            border
            height="95%"
          >
          <el-table-column
              label="咨询部门"
              align="center"
              prop="consultDepartment"
              width="300"
            >
          <template #default="scope">
            <template v-if="scope.row.consultDepartment == 0">技术</template>
            <template v-if="scope.row.consultDepartment == 1">品管</template>
          </template>
          </el-table-column>
            <el-table-column label="咨询内容" align="center" prop="content" />
            <el-table-column
              label="回复状态"
              align="center"
              prop="status"
              width="300"
            >
          <template #default="scope">
            <template v-if="scope.row.status == 0">未回复</template>
            <template v-if="scope.row.status == 1">不合格</template>
            <template v-if="scope.row.status == 2">合格</template>
          </template>
          </el-table-column>
          </el-table>
  </el-dialog>
</template>
<script setup>
import { getDayworkItemDetail } from "@/api/business/daywork";
const { proxy } = getCurrentInstance();
const visible = ref(false);
const loading = ref(false);
const detail = ref({})
const info = ref({})

/**
 * 对话框打开 事件
 */
function open(data) {
  visible.value = true;
  console.log(data)
  info.value = data
  getList(data);
}
/**
 * 对话框关闭 事件
 */
function close() {
  visible.value = false;
}
/**
 * 加载数据
 */
function getList(data) {
  loading.value = true;
  getDayworkItemDetail({id:data.id}).then((res) => {
    detail.value = res.data;
    console.log(detail.value.processInspection ==null)
    loading.value = false;
  });
}


defineExpose({
  open,
});
</script>
<style scoped>

</style>
