<template>
  <view class="module-container">
    <template v-if="projectData?.companyList && projectData.companyList.length > 0">
      <view v-for="(item, index) in projectData.companyList" :key="index" class="party-card">
        <view class="party-title">单位 {{ Number(index) + 1 }}</view>
        <CommonInfoRow label="单位编号" :value="item.compCode || '-'" />
        <CommonInfoRow label="单位名称" :value="item.compName || '-'" />
        <CommonInfoRow label="单位类别" :value="getDictLabel('sci_tripartite_type', item.compType)" />
        <CommonInfoRow v-if="projectType !== 'vertical'" label="合同方" :value="getDictLabel('project_company_type', item.contractParty)" />
        <CommonInfoRow label="单位地址" :value="item.compLocalArea || '-'" />
        <CommonInfoRow label="联系人" :value="item.compContact || '-'" />
        <CommonInfoRow label="联系电话" :value="item.compPhoneNum || '-'" noBorder />
      </view>
    </template>
    <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
  </view>
</template>

<script setup lang="ts">
import { useDict } from '@/hooks/useDict';
import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';

const props = defineProps<{
  projectId: string;
  projectType: string;
  projectData: any;
}>();

const { getDictLabel } = useDict('sci_tripartite_type', 'project_company_type');
</script>

<style lang="scss" scoped>
.module-container {
  padding: 30rpx;
  background-color: #fff;
  border-radius: 16rpx;
  min-height: 400rpx;
  box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.03);
}

.party-card {
  background-color: #f7f9fc;
  border-radius: 12rpx;
  padding: 24rpx;
  margin-bottom: 20rpx;

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

  .party-title {
    font-size: 28rpx;
    font-weight: bold;
    color: #1c9bfd;
    margin-bottom: 16rpx;
    border-bottom: 2rpx solid rgba(#1c9bfd, 0.1);
    padding-bottom: 12rpx;
  }
}
</style>
