<!--
 * @Author: wrh
 * @Date: 2024-03-25 17:38:39
 * @LastEditors: wrh
 * @LastEditTime: 2026-02-27 11:09:38
-->
<template>
  <div>
    <el-table :data="tableData" style="width: 100%" height="660px" :row-style="{ height: '60px' }">
      <!-- <el-table-column type="expand">
        <template slot-scope="props">
          <div style="background-color: #F0F2F5;">
            <el-descriptions direction="vertical" :column="3" border>
              <el-descriptions-item label="工作内容">XXXXXX</el-descriptions-item>
              <el-descriptions-item label="工作量">XXXXXX</el-descriptions-item>
              <el-descriptions-item label="单位" :span="2">km²</el-descriptions-item>
            </el-descriptions>
          </div>
        </template>
</el-table-column> -->
      <el-table-column label="项目编号" width="100px" prop="projectNumber">
      </el-table-column>
      <el-table-column label="项目名称" prop="projectName">
      </el-table-column>
      <el-table-column label="项目负责人" width="100px" prop="projectLeader">
        <template slot-scope="scope">
          {{ getUserName(scope.row.projectLeader) }}
        </template>
      </el-table-column>
      <el-table-column label="承担部门" prop="undertakingDeptName">
      </el-table-column>
    </el-table>
    <!-- <el-collapse v-model="activeNames" @change="handleChange">
      <el-collapse-item :name="item.projectNumber" v-for="item in tableData" :key="item.projectNumber">
        <template slot="title">
          <div>
            <svg-icon icon-class="ArrowRight" class="info-icon"></svg-icon> -->
    <!-- {{ item.projectNumber + ' ' + ' ' + item.projectName + ' ' + ' ' + item.projectLeaderUser.nickName }} -->
    <!-- </div>
        </template>
        <div>暂无信息，敬请期待</div>
      </el-collapse-item>
    </el-collapse> -->
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getListByProjectLeader" />
  </div>
</template>

<script>

import { listProject } from "@/api/oa/project/project";
export default {
  props: {
    userId: {
      type: Number
    }
  },
  data() {
    return {
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        projectLeader: null
      },
      // 总条数
      total: 0,
      tableData: [],
      activeNames: ['1'],
    }
  },
  created() {
    this.getListByProjectLeader();
  },
  methods: {
    handleChange(val) {

    },
    getListByProjectLeader() {
      if (this.$route.query.userId)
        this.queryParams.projectLeader = this.$route.query.userId;
      else
        this.queryParams.projectLeader = this.userId;
      listProject(this.queryParams).then(res => {
        this.tableData = res.rows
        this.total = res.total
      });
    }
  }
}
</script>

<style lang="scss" scoped>
.info-icon {
  font-size: 20px;
}
</style>