examinationDetail.vue 8.54 KB
<template>
  <view class="detail-page">
    <!-- 基本信息 -->
    <view class="section">
      <view class="section-header">
        <uni-icons type="paperclip" size="18" color="#AD181F"></uni-icons>
        <text class="section-title">基本信息</text>
      </view>
      <view class="info-card">
        <view class="info-row">
          <text class="label">申请单位</text>
          <text class="value">{{ form.memName || '-' }}</text>
        </view>
        <view class="info-row">
          <text class="label">所属协会</text>
          <text class="value">{{ form.shenMemName || '-' }}</text>
        </view>
        <view class="info-row">
          <text class="label">审核状态</text>
          <text class="value" :class="getStatusClass(form.auditStatus)">
            {{ getStatusText(form.auditStatus) }}
          </text>
        </view>
        <view class="info-row">
          <text class="label">是否需要</text>
          <text class="value">{{ form.selfSelect == 1 ? '否' : '是' }}</text>
        </view>
        <view class="info-row">
          <text class="label">会员有效期</text>
          <text class="value">{{ formatDate(form.memValidDate) }}</text>
        </view>
        <view class="info-row">
          <text class="label">申请日期</text>
          <text class="value">{{ formatDate(form.commitTime) }}</text>
        </view>
        <view class="info-row">
          <text class="label">审核日期</text>
          <text class="value">{{ formatDate(form.auditTime) }}</text>
        </view>
        <view class="info-row">
          <text class="label">考官</text>
          <text class="value">{{ form.examiners || '-' }}</text>
        </view>
      </view>
    </view>

    <!-- 审核记录 -->
    <view class="section" v-if="auditList.length > 0">
      <view class="section-header">
        <uni-icons type="checkmark-circle" size="18" color="#AD181F"></uni-icons>
        <text class="section-title">审核记录</text>
      </view>
      <view class="audit-list">
        <view class="audit-item" v-for="(item, index) in auditList" :key="index">
          <view class="audit-dot" :class="item.auditResult == 2 ? 'pass' : 'fail'"></view>
          <view class="audit-content">
            <view class="audit-row">
              <text class="audit-label">审核协会</text>
              <text class="audit-value">{{ item.auditDeptName || '-' }}</text>
            </view>
            <view class="audit-row">
              <text class="audit-label">审核时间</text>
              <text class="audit-value">{{ formatDateTime(item.auditTime) }}</text>
            </view>
            <view class="audit-row">
              <text class="audit-label">审核状态</text>
              <text class="audit-value" :class="item.auditResult == 2 ? 'text-success' : 'text-danger'">
                {{ item.auditResult == 2 ? '通过' : '拒绝' }}
              </text>
            </view>
            <view class="audit-row" v-if="item.auditMsg">
              <text class="audit-label">备注</text>
              <text class="audit-value">{{ item.auditMsg }}</text>
            </view>
          </view>
        </view>
      </view>
    </view>

    <!-- 考官信息 -->
    <view class="section" v-if="examinerList.length > 0">
      <view class="section-header">
        <uni-icons type="person" size="18" color="#AD181F"></uni-icons>
        <text class="section-title">考官信息</text>
      </view>
      <view class="examiner-table" v-if="examinerList.length > 0">
        <view class="table-header">
          <view class="th th-name">姓名</view>
          <view class="th th-code">会员号</view>
          <view class="th th-idcard">证件号码</view>
        </view>
        <view class="table-body">
          <view class="table-row" v-for="(item, index) in examinerList" :key="index">
            <view class="td td-name">{{ item.perName }}</view>
            <view class="td td-code">{{ item.perCode || '-' }}</view>
            <view class="td td-idcard">{{ item.perIdcCode || '-' }}</view>
          </view>
        </view>
      </view>
      <view class="no-data" v-else>
        <text>暂无考官信息</text>
      </view>
    </view>
  </view>
</template>

<script setup>
import * as api from '@/common/api_exam.js'
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'

const form = ref({})
const auditList = ref([])
const examinerList = ref([])

const auditStatusMap = { 1: '审核中', 2: '审核通过', 3: '审核拒绝' }

onLoad((options) => {
  if (options.item) {
    try {
      const itemData = JSON.parse(decodeURIComponent(options.item))
      form.value = itemData
      if (itemData.auditList) {
        auditList.value = itemData.auditList
      }
      if (itemData.memId) {
        getExaminerList(itemData.memId)
      }
    } catch (e) {
      console.error('解析数据失败', e)
    }
  }
})

function getExaminerList(memId) {
  api.listInfo({ memId: memId }).then(res => {
    if (res.rows) {
      examinerList.value = res.rows
    }
  }).catch(err => {
    console.error('获取考官列表失败', err)
  })
}

function getStatusText(status) {
  return auditStatusMap[status] || '-'
}

function getStatusClass(status) {
  const classMap = {
    1: 'text-warning',
    2: 'text-success',
    3: 'text-danger'
  }
  return classMap[status] || ''
}

function formatDate(dateStr) {
  if (!dateStr) return '-'
  return dateStr.substring(0, 10)
}

function formatDateTime(dateStr) {
  if (!dateStr) return '-'
  if (typeof dateStr === 'string' && dateStr.indexOf('T') > -1) {
    const [date, time] = dateStr.split('T')
    return `${date} ${time?.slice(0, 5) || ''}`
  }
  return dateStr
}
</script>

<style lang="scss" scoped>
.detail-page {
  min-height: 100vh;
  background-color: #f5f5f5;
  padding: 20rpx;
  padding-bottom: 40rpx;
}

.section {
  background-color: #fff;
  border-radius: 16rpx;
  padding: 30rpx;
  margin-bottom: 20rpx;
}

.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 24rpx;

  .section-title {
    font-size: 30rpx;
    font-weight: 600;
    color: #333;
    margin-left: 10rpx;
  }
}

.info-card {
  .info-row {
    display: flex;
    justify-content: space-between;
    padding: 16rpx 0;
    border-bottom: 1px solid #f0f0f0;

    &:last-child {
      border-bottom: none;
    }

    .label {
      font-size: 26rpx;
      color: #999;
      flex-shrink: 0;
    }

    .value {
      font-size: 26rpx;
      color: #333;
      text-align: right;
      margin-left: 20rpx;

      &.text-success {
        color: #4caf50;
      }

      &.text-warning {
        color: #ff9800;
      }

      &.text-danger {
        color: #f44336;
      }
    }
  }
}

/* 审核记录 */
.audit-list {
  .audit-item {
    display: flex;
    padding: 20rpx 0;
    border-bottom: 1px dashed #eee;

    &:last-child {
      border-bottom: none;
    }

    .audit-dot {
      width: 14rpx;
      height: 14rpx;
      border-radius: 50%;
      margin-top: 8rpx;
      margin-right: 20rpx;
      flex-shrink: 0;

      &.pass {
        background-color: #4caf50;
      }

      &.fail {
        background-color: #f44336;
      }
    }

    .audit-content {
      flex: 1;

      .audit-row {
        display: flex;
        margin-bottom: 10rpx;

        &:last-child {
          margin-bottom: 0;
        }

        .audit-label {
          font-size: 24rpx;
          color: #999;
          width: 140rpx;
          flex-shrink: 0;
        }

        .audit-value {
          font-size: 26rpx;
          color: #333;
          flex: 1;

          &.text-success {
            color: #4caf50;
          }

          &.text-danger {
            color: #f44336;
          }
        }
      }
    }
  }
}

/* 考官表格 */
.examiner-table {
  border: 1px solid #eee;
  border-radius: 12rpx;
  overflow: hidden;

  .table-header {
    display: flex;
    background-color: #f5f5f5;

    .th {
      padding: 20rpx 0;
      text-align: center;
      font-size: 24rpx;
      color: #666;
      font-weight: 500;
    }
  }

  .th-name { width: 25%; }
  .th-code { width: 30%; }
  .th-idcard { width: 45%; }

  .table-body {
    .table-row {
      display: flex;
      border-bottom: 1px solid #eee;

      &:last-child {
        border-bottom: none;
      }

      .td {
        padding: 20rpx 0;
        text-align: center;
        font-size: 24rpx;
        color: #333;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }

    .td-name { width: 25%; }
    .td-code { width: 30%; }
    .td-idcard { width: 45%; }
  }
}

.no-data {
  padding: 60rpx 0;
  text-align: center;
  color: #999;
  font-size: 26rpx;
}
</style>