<template>
  <view class="module-container">
    <template v-if="projectData?.companyList && projectData.companyList.length > 0">
      <view v-for="(company, index) in projectData.companyList" :key="index" class="party-card">
        <view class="party-title">合作单位 {{ Number(index) + 1 }}</view>
        <CommonInfoRow label="单位编号" :value="company.compCode" />
        <CommonInfoRow label="单位名称" :value="company.compName" />
        <CommonInfoRow label="单位类别" :value="getDictLabel('compType', company.compType)" />
        <CommonInfoRow label="合同方" :value="getDictLabel('project_company_type', company.contractParty)" />
        <CommonInfoRow label="单位地址" :value="company.compLocalArea" />
        <CommonInfoRow label="联系人" :value="company.compContact" />
        <CommonInfoRow label="联系电话" :value="company.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('compType', '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>
