<template>
  <div v-if="enabled" class="section-container">
    <div class="section-title">
      <i class="el-icon-s-order"></i>
      <span>流程总览 <span class="en-sub">· Process Overview</span></span>
    </div>
    <el-steps :active="activeStep" align-center class="flow-steps">
      <el-step title="待审核" icon="el-icon-document" />
      <el-step title="意见填写" icon="el-icon-edit-outline" />
      <el-step title="汇总方案" icon="el-icon-s-data" />
      <el-step title="全部办结" icon="el-icon-circle-check" />
    </el-steps>
    <div class="current-status">
      <span class="status-label">当前阶段：</span>
      <el-tag :type="tagType" size="small">{{ flowStatusText }}</el-tag>
    </div>
  </div>
</template>

<script>
export default {
  name: 'FlowOverviewSection',
  props: {
    enabled: {
      type: Boolean,
      default: true
    },
    flowStatus: {
      type: [Number, String],
      default: undefined
    }
  },
  computed: {
    /**
     * el-steps active 从 0 开始。
     * 1=待审核→0, 2=意见填写→1, 3=汇总方案→2, 4=全部办结→3
     */
    activeStep() {
      if (this.flowStatus == null) return -1;
      const v = Number(this.flowStatus);
      if (v >= 4) return 3;
      return v - 1;
    },
    flowStatusText() {
      const map = {
        1: '待审核',
        2: '意见填写中',
        3: '待汇总方案',
        4: '全部办结'
      };
      return map[this.flowStatus] || '未知';
    },
    tagType() {
      const map = {
        1: 'info',
        2: 'warning',
        3: '',
        4: 'success'
      };
      return map[this.flowStatus] || '';
    }
  }
}
</script>

<style scoped>
.section-container {
  margin-bottom: 6px;
}

.section-title {
  font-family: 'Georgia', 'Times New Roman', 'Noto Serif SC', 'SimSun', serif;
  width: 100%;
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 32px 0 16px 0;
  padding: 0 0 10px 0;
  border-bottom: 1px solid #d4d0c8;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.3px;
}

.section-title .en-sub {
  font-size: 11px;
  font-weight: 400;
  color: #8c8c8c;
  letter-spacing: 0.5px;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-style: italic;
}

.section-title i {
  font-size: 16px;
  color: #1a3c6e;
}

.flow-steps {
  padding: 8px 0 4px;
}

.flow-steps >>> .el-step.is-wait .el-step__icon-inner,
.flow-steps >>> .el-step.is-wait .el-step__title {
  color: #c0c4cc;
}

.flow-steps >>> .el-step.is-process .el-step__icon-inner,
.flow-steps >>> .el-step.is-process .el-step__title {
  color: #409eff;
}

.flow-steps >>> .el-step.is-finish .el-step__icon-inner,
.flow-steps >>> .el-step.is-finish .el-step__title {
  color: #67c23a;
}

.flow-steps >>> .el-step__description {
  display: none;
}

.current-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed #e0dcd6;
}

.status-label {
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 11px;
  color: #8c8c8c;
  letter-spacing: 0.3px;
}
</style>
