<template>
  <div class="add-project-container">
    <div class="add-project-content" v-loading="loading">
      <routerBack />

      <div class="tabs-content">
        <div class="project-tab-content">
          <div class="tab-content">
            <el-form :model="formData" label-width="150" :disabled="isPreview">
              <el-collapse v-model="activeCollapse">
                <!-- 基本信息 -->
                <el-collapse-item title="基本信息" name="基本信息">
                  <el-row :gutter="20">
                    <el-col :span="12">
                      <el-form-item label="参股公司名称" required>
                        <el-select
                          v-model="formData.projectId"
                          placeholder="请选择参股公司名称"
                          no-data-text="暂无数据"
                          @change="changeProject"
                        >
                          <el-option
                            v-for="item in projectList"
                            :key="item.key"
                            :label="item.projectName"
                            :value="item.id"
                          ></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="统一社会信用代码">
                        <el-input
                          v-model="formData.sqnzw"
                          placeholder="请输入统一社会信用代码"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="境内/外">
                        <el-select
                          v-model="formData.jnw"
                          placeholder="请选择境内/外"
                        >
                          <el-option label="境内" value="境内"></el-option>
                          <el-option label="境外" value="境外"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="省(境)内/洲(境)外">
                        <el-input
                          v-model="formData.sqnzw"
                          placeholder="请输入省(境)内/洲(境)外"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="区县(境)内/国家(境)外">
                        <el-input
                          v-model="formData.qxnzwgw"
                          placeholder="请输入区县(境)内/国家(境)外"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="区县（境内）/国家（境外）">
                        <el-input
                          v-model="formData.qxnzwgw"
                          placeholder="请输入区县（境内）/国家（境外）"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="项目名称">
                        <el-input
                          v-model="formData.xmmc"
                          placeholder="请输入项目名称"
                        />
                      </el-form-item>
                    </el-col>

                    <el-col :span="12">
                      <el-form-item label="项目编号">
                        <el-input
                          v-model="formData.xmbh"
                          placeholder="请输入项目编号"
                        />
                      </el-form-item>
                    </el-col>

                    <el-col :span="12">
                      <el-form-item label="申报单位">
                        <el-input
                          v-model="formData.sbdw"
                          placeholder="请输入申报单位"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="所属二级单位">
                        <el-input
                          v-model="formData.ssejdw"
                          placeholder="请输入所属二级单位"
                        />
                      </el-form-item>
                    </el-col>

                    <el-col :span="6">
                      <el-form-item label="投资主体层级">
                        <el-select
                          v-model="formData.sfjwqy"
                          placeholder="请选择投资主体层级"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="投资主体法人层级">
                        <el-select
                          v-model="formData.sfjwqy"
                          placeholder="请选择投资主体法人层级"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="形成参股原因">
                        <el-select
                          v-model="formData.xccgyy"
                          placeholder="请选择形成参股原因"
                        >
                          <el-option
                            label="合资设立"
                            value="合资设立"
                          ></el-option>
                          <el-option
                            label="股权受让"
                            value="股权受让"
                          ></el-option>
                          <el-option
                            label="增资扩股"
                            value="增资扩股"
                          ></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="其他参股原因">
                        <el-input
                          v-model="formData.qtcgyy"
                          placeholder="请输入其他参股原因"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="参股分类">
                        <el-select
                          v-model="formData.cgfl"
                          placeholder="请选择参股分类"
                        >
                          <el-option
                            label="绝对控股"
                            value="绝对控股"
                          ></el-option>
                          <el-option
                            label="相对控股"
                            value="相对控股"
                          ></el-option>
                          <el-option label="参股" value="参股"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>

                    <el-col :span="6">
                      <el-form-item label="项目状态">
                        <el-input
                          v-model="formData.xmzt"
                          placeholder="请输入项目状态"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="是否集团主业">
                        <el-select
                          v-model="formData.sfjtzy"
                          placeholder="请选择是否集团主业"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="是否属主业关联产业">
                        <el-select
                          v-model="formData.sfzyglcy"
                          placeholder="请选择是否属主业关联产业"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="是否属于战略性持有或有培育期">
                        <el-select
                          v-model="formData.sfgzxccyypyq"
                          placeholder="请选择"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>

                    <el-col :span="6">
                      <el-form-item label="财务报表类型">
                        <el-input
                          v-model="formData.sshy"
                          placeholder="请输入财务报表类型"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="所属行业">
                        <el-input
                          v-model="formData.sshy"
                          placeholder="请输入所属行业"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="是否为民营企业">
                        <el-select
                          v-model="formData.sfwmqy"
                          placeholder="请选择是否为民营企业"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="决策批复时间">
                        <el-date-picker
                          v-model="formData.jcpfsj"
                          type="date"
                          placeholder="请选择决策批复时间"
                          format="YYYY-MM-DD"
                          value-format="YYYY-MM-DD"
                        />
                      </el-form-item>
                    </el-col>

                    <el-col :span="6">
                      <el-form-item label="参股形成时间">
                        <el-date-picker
                          v-model="formData.cgxcjsj"
                          type="date"
                          placeholder="请选择参股形成时间"
                          format="YYYY-MM-DD"
                          value-format="YYYY-MM-DD"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="是否上市公司">
                        <el-select
                          v-model="formData.sfssgs"
                          placeholder="请选择是否上市公司"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>

                    <el-col :span="6">
                      <el-form-item label="是否民企股份">
                        <el-select
                          v-model="formData.sfmqysjyy"
                          placeholder="请选择是否民企股份"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="是否计划退出">
                        <el-select
                          v-model="formData.sfwtzgxm"
                          placeholder="请选择是否计划退出"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="计划退出年份">
                        <el-input
                          v-model="formData.jhtcnf"
                          placeholder="请输入计划退出年份"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="是否为问题整改项目">
                        <el-select
                          v-model="formData.sfwtzgxm"
                          placeholder="请选择是否为问题整改项目"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="是否整改完成">
                        <el-select
                          v-model="formData.sfzgwc"
                          placeholder="请选择是否整改完成"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="风险金额(万元)">
                        <el-input-number
                          precision="2"
                          v-model="formData.fxje"
                          placeholder="请输入风险金额(万元)"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="是否我方控股非并表企业">
                        <el-select
                          v-model="formData.sfwfkgfbbqy"
                          placeholder="请选择是否我方控股非并表企业"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="是否民营企业实际运营">
                        <el-select
                          v-model="formData.sflh"
                          placeholder="请选择是否民营企业实际运营"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="是否落号">
                        <el-select
                          v-model="formData.sflh"
                          placeholder="请选择是否落号"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>

                    <el-col :span="6">
                      <el-form-item label="参股权持有损益">
                        <el-select
                          v-model="formData.sflh"
                          placeholder="请选择参股权持有损益"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>

                    <el-col :span="24">
                      <el-form-item label="主营业务">
                        <el-input
                          v-model="formData.zyyw"
                          type="textarea"
                          :rows="2"
                          placeholder="请输入主营业务"
                        />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <DynamicTable
                    :showAddButton="!isPreview"
                    :columns="transferColumns"
                    :disabled="isPreview"
                    v-model="formData.projectGdxxs"
                  />
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="批复文件">
                        <FileUploader
                          v-model="formData.wj"
                          :disabled="isPreview"
                        ></FileUploader>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="营业执照">
                        <FileUploader
                          v-model="formData.wj"
                          :disabled="isPreview"
                        ></FileUploader>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="合作协议">
                        <FileUploader
                          v-model="formData.wj"
                          :disabled="isPreview"
                        ></FileUploader>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-collapse-item>

                <!-- 填报信息 -->
                <el-collapse-item title="填报信息" name="填报信息">
                  <el-row>
                    <el-col :span="6">
                      <el-form-item label="参股公司管理人员">
                        <el-input
                          v-model="formData.sfwjskzr"
                          placeholder="请选择参股公司管理人员"
                        ></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="在参股公司任职务">
                        <el-input
                          v-model="formData.sfwjskzr"
                          placeholder="请选择在参股公司任职务"
                        ></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="电话">
                        <el-input
                          v-model="formData.sfwjskzr"
                          placeholder="请选择电话"
                        ></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="信息填报人">
                        <el-input
                          v-model="formData.sfwjskzr"
                          placeholder="请选择信息填报人"
                        ></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="单位及职务">
                        <el-input
                          v-model="formData.sfwjskzr"
                          placeholder="请选择单位及职务"
                        ></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="联系电话">
                        <el-input
                          v-model="formData.sfwjskzr"
                          placeholder="请选择联系电话"
                        ></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="更新上报年度">
                        <el-input
                          v-model="formData.sfwjskzr"
                          placeholder="请选择更新上报年度"
                        ></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="更新上报季度">
                        <el-input
                          v-model="formData.sfwjskzr"
                          placeholder="请选择更新上报季度"
                        ></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="更新日期">
                        <el-input
                          v-model="formData.sfwjskzr"
                          placeholder="请选择更新日期"
                        ></el-input>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-collapse-item>
                <el-collapse-item title="大股东信息" name="大股东信息">
                  <DynamicTable
                    :showAddButton="!isPreview"
                    :columns="dgdxxCok1"
                    :disabled="isPreview"
                    v-model="formData.projectGdxxs"
                  />
                  <DynamicTable
                    :showAddButton="!isPreview"
                    :columns="dgdxxCok2"
                    :disabled="isPreview"
                    v-model="formData.projectGdxxs"
                  />
                  <DynamicTable
                    :showAddButton="!isPreview"
                    :columns="dgdxxCok3"
                    :disabled="isPreview"
                    v-model="formData.projectGdxxs"
                  />

                  <el-row>
                    <el-col :span="8">
                      <el-form-item label="国有股东合计股比（%）">
                        <el-input
                          v-model="formData.sfwjskzr"
                          placeholder="请选择国有股东合计股比（%）"
                        ></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="能见参股合计（%）">
                        <el-input
                          v-model="formData.sfwjskzr"
                          placeholder="请选择能见参股合计（%）"
                        ></el-input>
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="一致行动人股比合计（%）">
                        <el-input
                          v-model="formData.sfwjskzr"
                          placeholder="请选择一致行动人股比合计（%）"
                        ></el-input>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-collapse-item>
                <el-collapse-item title="股东信息" name="股东信息">
                  <DynamicTable
                    :showAddButton="!isPreview"
                    :columns="dgdxxCok4"
                    :disabled="isPreview"
                    v-model="formData.projectGdxxs"
                  />
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label-width="90" label="章程">
                        <FileUploader
                          v-model="formData.wj"
                          :disabled="isPreview"
                        ></FileUploader>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-collapse-item>

                <!-- 出资信息 -->
                <el-collapse-item title="出资信息" name="出资信息">
                  <el-row :gutter="20">
                    <el-col :span="8">
                      <el-form-item label="企业工商注册资本金（万元）">
                        <el-input-number
                          precision="2"
                          v-model="formData.qygszczij"
                          placeholder="请输入企业工商注册资本金（万元）"
                        />
                      </el-form-item>
                    </el-col>

                    <el-col :span="8">
                      <el-form-item label="我方认缴企业工商注册资本金（万元）">
                        <el-input-number
                          precision="2"
                          v-model="formData.wfrjqygszczij"
                          placeholder="请输入我方认缴企业工商注册资本金（万元）"
                        />
                      </el-form-item>
                    </el-col>

                    <el-col :span="8">
                      <el-form-item
                        label="工商注册资本金我方实际已出资金额（万元）"
                      >
                        <el-input-number
                          precision="2"
                          v-model="formData.gszczijwfysjczje"
                          placeholder="请输入工商注册资本金我方实际已出资金额（万元）"
                        />
                      </el-form-item>
                    </el-col>

                    <el-col :span="8">
                      <el-form-item label="企业工商注册资本金我方首次出资时间">
                        <el-date-picker
                          v-model="formData.qygszczijwfscczsj"
                          type="date"
                          placeholder="请选择企业工商注册资本金我方首次出资时间"
                          format="YYYY-MM-DD"
                          value-format="YYYY-MM-DD"
                        />
                      </el-form-item>
                    </el-col>

                    <el-col :span="8">
                      <el-form-item label="我方参股比例（%）">
                        <el-input-number
                          precision="2"
                          v-model="formData.wfcgbl"
                          placeholder="请输入我方参股比例（%）"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="能建合计认缴工商注册资本金比例（%）">
                        <el-input-number
                          precision="2"
                          v-model="formData.njhjrjqygszczijbl"
                          placeholder="请输入能建合计认缴工商注册资本金比例（%）"
                        />
                      </el-form-item>
                    </el-col>

                    <el-col :span="8">
                      <el-form-item label="能建合计认缴工商注册资本金（万元）">
                        <el-input-number
                          precision="2"
                          v-model="formData.njhjrjqygszczij"
                          placeholder="请输入能建合计认缴工商注册资本金（万元）"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="能建合计实缴工商注册资本金（万元）">
                        <el-input-number
                          precision="2"
                          v-model="formData.njhjsjqygszczij"
                          placeholder="请输入能建合计实缴工商注册资本金（万元）"
                        />
                      </el-form-item>
                    </el-col>
                  </el-row>

                  <el-row :gutter="20">
                    <el-col :span="6">
                      <el-form-item label="项目资本金（万元）">
                        <el-input-number
                          precision="2"
                          v-model="formData.xmzbj"
                          placeholder="请输入项目资本金（万元）"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="我方认缴项目资本金比例（%）">
                        <el-input-number
                          precision="2"
                          v-model="formData.wfrjxmzbjbl"
                          placeholder="请输入我方认缴项目资本金比例（%）"
                        />
                      </el-form-item>
                    </el-col>

                    <el-col :span="6">
                      <el-form-item label="我方认缴项目资本金（万元）">
                        <el-input-number
                          precision="2"
                          v-model="formData.wfrjxmzbj"
                          placeholder="请输入我方认缴项目资本金（万元）"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="我方实缴项目资本金（万元）">
                        <el-input-number
                          precision="2"
                          v-model="formData.wfsjxmzbj"
                          placeholder="请输入我方实缴项目资本金（万元）"
                        />
                      </el-form-item>
                    </el-col>

                    <el-col :span="6">
                      <el-form-item label="项目资本金能建合计持股比例（%）">
                        <el-input-number
                          precision="2"
                          v-model="formData.xmzbjnjhjcgbll"
                          placeholder="请输入项目资本金能建合计持股比例（%）"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="能建合计认缴项目资本金（万元）">
                        <el-input-number
                          precision="2"
                          v-model="formData.njhjrjxmzbj"
                          placeholder="请输入能建合计认缴项目资本金（万元）"
                        />
                      </el-form-item>
                    </el-col>

                    <el-col :span="6">
                      <el-form-item label="能建合计实缴项目资本金（万元）">
                        <el-input-number
                          precision="2"
                          v-model="formData.njhjsjxmzbj"
                          placeholder="请输入能建合计实缴项目资本金（万元）"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="出资文件">
                        <el-button type="primary">上传</el-button>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-collapse-item>

                <!-- 财务经营信息 -->
                <el-collapse-item title="财务经营信息" name="财务经营信息">
                  <DynamicTable
                    :showAddButton="!isPreview"
                    :columns="dgdxxCok5"
                    :disabled="isPreview"
                    v-model="formData.projectGdxxs"
                  />

                  <div class="tab-handle">
                    <el-button type="primary" @click="addCwxx">新增</el-button>
                  </div>
                  <el-table
                    :data="cwxxList"
                    style="width: 100%"
                    empty-text="暂无数据"
                    border
                  >
                    <el-table-column type="index" width="60" label="序号" />
                    <el-table-column prop="nd" label="年度" width="100">
                      <template #default="scope">
                        <el-input
                          v-model="scope.row.nd"
                          placeholder="请输入年度"
                        />
                      </template>
                    </el-table-column>
                    <el-table-column
                      prop="zzc"
                      label="总资产（万元）"
                      width="140"
                    >
                      <template #default="scope">
                        <el-input-number
                          precision="2"
                          v-model="scope.row.zzc"
                          placeholder="请输入"
                          :controls="false"
                        />
                      </template>
                    </el-table-column>
                    <el-table-column
                      prop="jzc"
                      label="净资产（审计后）（万元）"
                      width="180"
                    >
                      <template #default="scope">
                        <el-input-number
                          precision="2"
                          v-model="scope.row.jzc"
                          placeholder="请输入"
                          :controls="false"
                        />
                      </template>
                    </el-table-column>
                    <el-table-column
                      prop="gsnjfznc"
                      label="归属能建方净资产（万元）"
                      width="180"
                    >
                      <template #default="scope">
                        <el-input-number
                          precision="2"
                          v-model="scope.row.gsnjfznc"
                          placeholder="请输入"
                          :controls="false"
                        />
                      </template>
                    </el-table-column>
                    <el-table-column
                      prop="yysr"
                      label="营业收入（万元）"
                      width="140"
                    >
                      <template #default="scope">
                        <el-input-number
                          precision="2"
                          v-model="scope.row.yysr"
                          placeholder="请输入"
                          :controls="false"
                        />
                      </template>
                    </el-table-column>
                    <el-table-column
                      prop="jlr"
                      label="净利润（万元）"
                      width="140"
                    >
                      <template #default="scope">
                        <el-input-number
                          precision="2"
                          v-model="scope.row.jlr"
                          placeholder="请输入"
                          :controls="false"
                        />
                      </template>
                    </el-table-column>
                    <el-table-column
                      prop="gsnjfndjdfh"
                      label="归属能建方年度决策分红（万元）"
                      width="220"
                    >
                      <template #default="scope">
                        <el-input-number
                          precision="2"
                          v-model="scope.row.gsnjfndjdfh"
                          placeholder="请输入"
                          :controls="false"
                        />
                      </template>
                    </el-table-column>
                    <el-table-column
                      prop="gdhjcdffhsj"
                      label="股东会决策分红时间"
                      width="160"
                    >
                      <template #default="scope">
                        <el-date-picker
                          v-model="scope.row.gdhjcdffhsj"
                          type="date"
                          placeholder="请选择"
                          format="YYYY-MM-DD"
                          value-format="YYYY-MM-DD"
                        />
                      </template>
                    </el-table-column>
                    <el-table-column
                      prop="gsnjfndysdfh"
                      label="归属能建方年度已收到分红（万元）"
                      width="240"
                    >
                      <template #default="scope">
                        <el-input-number
                          precision="2"
                          v-model="scope.row.gsnjfndysdfh"
                          placeholder="请输入"
                          :controls="false"
                        />
                      </template>
                    </el-table-column>
                    <el-table-column
                      prop="sjsdfhsj"
                      label="实际收到分红时间"
                      width="160"
                    >
                      <template #default="scope">
                        <el-date-picker
                          v-model="scope.row.sjsdfhsj"
                          type="date"
                          placeholder="请选择"
                          format="YYYY-MM-DD"
                          value-format="YYYY-MM-DD"
                        />
                      </template>
                    </el-table-column>
                    <el-table-column
                      prop="bndjtnzyjtzttzrb"
                      label="本年度与集团内投资主体关联交易收入占该被投资企业营业收入比例（%）"
                      width="360"
                    >
                      <template #default="scope">
                        <el-input-number
                          precision="2"
                          v-model="scope.row.bndjtnzyjtzttzrb"
                          placeholder="请输入"
                          :controls="false"
                        />
                      </template>
                    </el-table-column>
                    <el-table-column label="操作" width="80" fixed="right">
                      <template #default="scope">
                        <el-button
                          link
                          type="danger"
                          size="small"
                          @click="deleteCwxx(scope.$index)"
                          >删除</el-button
                        >
                      </template>
                    </el-table-column>
                  </el-table>
                </el-collapse-item>

                <!-- 分红与投资情况 -->
                <el-collapse-item title="分红与投资情况" name="分红与投资情况">
                  <el-row :gutter="20">
                    <el-col :span="12">
                      <el-form-item label="2019年以前累计确认分红金额（万元）">
                        <el-input-number
                          precision="2"
                          v-model="formData.enyqljfhje"
                          placeholder="请输入2019年以前累计确认分红金额（万元）"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="2019年以前累计收到分红金额（万元）">
                        <el-input-number
                          precision="2"
                          v-model="formData.esnqljsdfhje"
                          placeholder="请输入2019年以前累计收到分红金额（万元）"
                        />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row :gutter="20">
                    <el-col :span="12">
                      <el-form-item label="历年累计确认分红金额（万元）">
                        <el-input-number
                          precision="2"
                          v-model="formData.lnljsdfhje"
                          placeholder="请输入历年累计确认分红金额（万元）"
                        />
                      </el-form-item>
                    </el-col>

                    <el-col :span="12">
                      <el-form-item label="累计参股投资回报率（%）">
                        <el-input-number
                          precision="2"
                          v-model="formData.ljcgtzhibl"
                          placeholder="请输入累计参股投资回报率（%）"
                        />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row :gutter="20">
                    <el-col :span="12">
                      <el-form-item label="归属集团内投资主体所有权益（万元）">
                        <el-input-number
                          precision="2"
                          v-model="formData.gsjtntzztzsuyq"
                          placeholder="请输入归属集团内投资主体所有权益（万元）"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="总体参股投资保值增值率（%）">
                        <el-input-number
                          precision="2"
                          v-model="formData.ztcgtzbzzzl"
                          placeholder="请输入总体参股投资保值增值率（%）"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="是否能够及时掌握财务数据和经营情况">
                        <el-select
                          v-model="formData.sfnkjzwsjyjjyqk"
                          placeholder="请选择是否能够及时掌握财务数据和经营情况"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="逾期超过1年的应收款金额（万元）">
                        <el-select
                          v-model="formData.sfnkjzwsjyjjyqk"
                          placeholder="请选择逾期超过1年的应收款金额（万元）"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="收回逾期超过1年的应收款金额（万元）">
                        <el-select
                          v-model="formData.sfnkjzwsjyjjyqk"
                          placeholder="请选择收回逾期超过1年的应收款金额（万元）"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="是否满五年未分红">
                        <el-select
                          v-model="formData.sflxwnlcqks"
                          placeholder="请选择是否满五年未分红"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="是否连续5年长期亏损">
                        <el-select
                          v-model="formData.sflxwnlcqks"
                          placeholder="请选择是否连续5年长期亏损"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="是否非持续经营">
                        <el-select
                          v-model="formData.sffcxjy"
                          placeholder="请选择是否非持续经营"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>

                    <el-col :span="12">
                      <el-form-item label="是否属于低效无效资产">
                        <el-select
                          v-model="formData.sfdydwxzc"
                          placeholder="请选择是否属于低效无效资产"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>

                    <el-col :span="12">
                      <el-form-item label="拉动营收">
                        <el-input-number
                          precision="2"
                          v-model="formData.ldys"
                          placeholder="请输入拉动营收"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="拉动利润">
                        <el-input-number
                          precision="2"
                          v-model="formData.ldlr"
                          placeholder="请输入拉动利润"
                        />
                      </el-form-item>
                    </el-col>

                    <el-col :span="12">
                      <el-form-item label="当前持有损益">
                        <el-input-number
                          precision="2"
                          v-model="formData.dqcygs"
                          placeholder="请输入当前持有损益"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="财务报表文件">
                        <FileUploader
                          v-model="formData.wj"
                          :disabled="isPreview"
                        ></FileUploader>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-collapse-item>

                <!-- 法人治理 -->
                <el-collapse-item title="法人治理" name="法人治理">
                  <DynamicTable
                    :showAddButton="!isPreview"
                    :columns="dgdxxCok8"
                    :disabled="isPreview"
                    v-model="formData.projectGdxxs"
                  />

                  <DynamicTable
                    :showAddButton="!isPreview"
                    :columns="dgdxxCok9"
                    :disabled="isPreview"
                    v-model="formData.projectGdxxs"
                  />

                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="董监高任命文件">
                        <FileUploader
                          v-model="formData.wj"
                          :disabled="isPreview"
                        ></FileUploader>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="股东会文件">
                        <FileUploader
                          v-model="formData.wj"
                          :disabled="isPreview"
                        ></FileUploader>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="董事会决议文件">
                        <FileUploader
                          v-model="formData.wj"
                          :disabled="isPreview"
                        ></FileUploader>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-collapse-item>

                <!-- 集团内投资主体相关信息 -->
                <el-collapse-item title="其他信息" name="其他信息">
                  <DynamicTable
                    :showAddButton="!isPreview"
                    :columns="dgdxxCok6"
                    :disabled="isPreview"
                    v-model="formData.projectGdxxs"
                  />
                  <DynamicTable
                    :showAddButton="!isPreview"
                    :columns="dgdxxCok7"
                    :disabled="isPreview"
                    v-model="formData.projectGdxxs"
                  />
                </el-collapse-item>

                <!-- 股权退出信息 -->
                <el-collapse-item title="股权退出信息" name="股权退出信息">
                  <el-row :gutter="20">
                    <el-col :span="12">
                      <el-form-item label="股权是否退出" required>
                        <el-select
                          v-model="formData.gqsfct"
                          placeholder="请选择股权是否退出"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="股权退出收回资金（万元）">
                        <el-input-number
                          precision="2"
                          v-model="formData.gqcthszj"
                          placeholder="请输入股权退出收回资金（万元）"
                        />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row :gutter="20">
                    <el-col :span="12">
                      <el-form-item label="股权退出时间">
                        <el-date-picker
                          v-model="formData.gqctsj"
                          type="date"
                          placeholder="请选择股权退出时间"
                          format="YYYY-MM-DD"
                          value-format="YYYY-MM-DD"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="股权退出收回资金到账金额（万元）">
                        <el-input-number
                          precision="2"
                          v-model="formData.gqcthszjdzje"
                          placeholder="请输入股权退出收回资金到账金额（万元）"
                        />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row :gutter="20">
                    <el-col :span="12">
                      <el-form-item label="股权退出收回资金到账时间">
                        <el-date-picker
                          v-model="formData.gqcthszjdzsj"
                          type="date"
                          placeholder="请选择股权退出收回资金到账时间"
                          format="YYYY-MM-DD"
                          value-format="YYYY-MM-DD"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="股权退出原因">
                        <el-input
                          v-model="formData.gqctyy"
                          type="textarea"
                          :rows="3"
                          placeholder="请输入股权退出原因"
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="退出文件">
                        <FileUploader
                          v-model="formData.wj"
                          :disabled="isPreview"
                        ></FileUploader>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-collapse-item>

                <!-- 自查问题整改信息 -->
                <el-collapse-item
                  title="自查问题整改信息"
                  name="自查问题整改信息"
                >
                  <el-row :gutter="20">
                    <el-col :span="12">
                      <el-form-item label="自查是否发现问题" required>
                        <el-select
                          v-model="formData.zcsffjwt"
                          placeholder="请选择自查是否发现问题"
                        >
                          <el-option label="是" value="是"></el-option>
                          <el-option label="否" value="否"></el-option>
                        </el-select>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row :gutter="20">
                    <el-col :span="24">
                      <el-form-item label="自查发现的主要问题及整改计划">
                        <el-input
                          v-model="formData.zcfxdzzywtjzgjh"
                          type="textarea"
                          :rows="4"
                          placeholder="请输入自查发现的主要问题及整改计划"
                        />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row :gutter="20">
                    <el-col :span="24">
                      <el-form-item label="备注">
                        <el-input
                          v-model="formData.bz"
                          type="textarea"
                          :rows="4"
                          placeholder="请输入备注"
                        />
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-collapse-item>
              </el-collapse>
            </el-form>
          </div>
        </div>
      </div>
      <div class="add-project-header">
        <div class="header-left"></div>
        <div class="header-right">
          <el-button type="default" @click="backClick">返回</el-button>
          <template v-if="!loading && !isPreview">
            <el-button type="primary" @click="saveClick">保存</el-button>
          </template>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { reactive, ref, onMounted, getCurrentInstance } from "vue";
import { useRouter, useRoute } from "vue-router";
import { ElMessage, ElMessageBox } from "element-plus";
import routerBack from "@/components/common/routerBack.vue";
import DynamicTable from "@/components/FormDynamicTable/index.vue";
import FileUploader from "@/components/FileUploader/index.vue";

const router = useRouter();
const route = useRoute();
const { proxy } = getCurrentInstance();

// 规模指标及额度表格列配置
const transferColumns = ref([
  {
    prop: "njfcgbl1",
    label: "十二大业务板块",
    type: "input",
    headerGroup: "规模指标及额度",
    placeholder: "十二大业务板块名称",
  },
  {
    prop: "njfcgbl2",
    label: "指标名称",
    type: "input",
    headerGroup: "规模指标及额度",
    placeholder: "指标名称",
  },
  {
    prop: "njfcgbl3",
    label: "数量",
    type: "input",
    headerGroup: "规模指标及额度",
    placeholder: "数量",
  },
  {
    prop: "njfcgbl4",
    label: "单位",
    type: "input",
    headerGroup: "规模指标及额度",
    placeholder: "单位",
  },
]);

// 折叠面板默认展开项
const activeCollapse = ref([
  "基本信息",
  "规模指标及额度",
  "填报信息",
  "大股东信息",
  "出资信息",
  "财务经营信息",
  "分红与投资情况",
  "法人治理",
  "其他信息",
  "股权退出信息",
  "自查问题整改信息",
]);

// 大股东信息表格列配置
const dgdxxCok1 = ref([
  {
    prop: "njfcgbl1",
    label: "控股股东",
    type: "input",
    placeholder: "控股股东名称",
  },
  {
    prop: "njfcgbl1",
    label: "股东性质",
    type: "input",
    placeholder: "股东性质名称",
  },
  {
    prop: "njfcgbl1",
    label: "股比（%）",
    type: "input",
    placeholder: "股比（%）名称",
  },
  {
    prop: "njfcgbl1",
    label: "是否集团内成员单位",
    type: "input",
    placeholder: "是否集团内成员单位名称",
  },
]);

const dgdxxCok2 = ref([
  {
    prop: "njfcgbl1",
    label: "第一大股东",
    type: "input",
    placeholder: "第一大股东名称",
  },
  {
    prop: "njfcgbl1",
    label: "股东性质",
    type: "input",
    placeholder: "股东性质名称",
  },
  {
    prop: "njfcgbl1",
    label: "股比（%）",
    type: "input",
    placeholder: "股比（%）名称",
  },
  {
    prop: "njfcgbl1",
    label: "是否集团内成员单位",
    type: "input",
    placeholder: "是否集团内成员单位名称",
  },
]);

const dgdxxCok3 = ref([
  {
    prop: "njfcgbl1",
    label: "平股",
    type: "input",
    placeholder: "平股名称",
  },
  {
    prop: "njfcgbl1",
    label: "股东性质",
    type: "input",
    placeholder: "股东性质名称",
  },
  {
    prop: "njfcgbl1",
    label: "股比（%）",
    type: "input",
    placeholder: "股比（%）名称",
  },
  {
    prop: "njfcgbl1",
    label: "是否集团内成员单位",
    type: "input",
    placeholder: "是否集团内成员单位",
  },
]);

const dgdxxCok4 = ref([
  {
    prop: "njfcgbl1",
    label: "股东名称",
    type: "input",
    placeholder: "股东名称",
  },
  {
    prop: "njfcgbl1",
    label: "股东性质",
    type: "input",
    placeholder: "股东性质",
  },
  {
    prop: "njfcgbl1",
    label: "股比（%）",
    type: "input",
    placeholder: "股比（%）",
  },
  {
    prop: "njfcgbl1",
    label: "是否控股股东",
    type: "input",
    placeholder: "是否控股股东",
  },
  {
    prop: "njfcgbl1",
    label: "是否集团内成员单位",
    type: "input",
    placeholder: "是否集团内成员单位",
  },
  {
    prop: "njfcgbl1",
    label: "是否失控单位",
    type: "input",
    placeholder: "是否失控单位",
  },
  {
    prop: "njfcgbl1",
    label: "是否一致行动人",
    type: "input",
    placeholder: "是否一致行动人",
  },
]);

const dgdxxCok5 = ref([
  {
    prop: "njfcgbl1",
    headerGroup: "最新年份财务经营信息",
    label: "总资产（万元）",
    type: "input",
    placeholder: "总资产（万元）",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "最新年份财务经营信息",
    label: "净资产（审计后）万元",
    type: "input",
    placeholder: "净资产（审计后）万元",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "最新年份财务经营信息",
    label: "归属能建方净资产（万元）",
    type: "input",
    placeholder: "归属能建方净资产（万元）",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "最新年份财务经营信息",
    label: "营业收入（万元）",
    type: "input",
    placeholder: "营业收入（万元）",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "最新年份财务经营信息",
    label: "净利润（万元）",
    type: "input",
    placeholder: "净利润（万元）",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "最新年份财务经营信息",
    label: "归属能建方年度决策分红（万元）",
    type: "input",
    placeholder: "归属能建方年度决策分红（万元）",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "最新年份财务经营信息",
    label: "股东会决策分红时间",
    type: "input",
    placeholder: "股东会决策分红时间",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "最新年份财务经营信息",
    label: "股东会决策分红时间",
    type: "input",
    placeholder: "股东会决策分红时间",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "最新年份财务经营信息",
    label: "古树能建方年度已收到分工（万元）",
    type: "input",
    placeholder: "古树能建方年度已收到分工（万元）",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "最新年份财务经营信息",
    label: "实际收到分红时间",
    type: "input",
    placeholder: "实际收到分红时间",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "最新年份财务经营信息",
    label: "本年度与集团内投资主体关联交易收入占该被投资企业营业收入比例（%）",
    type: "input",
    placeholder:
      "本年度与集团内投资主体关联交易收入占该被投资企业营业收入比例（%）",
  },
]);

const dgdxxCok6 = ref([
  {
    prop: "njfcgbl1",
    headerGroup: "是否使用集团内投资主体字号、经营资质",
    label: "是否",
    type: "input",
    placeholder: "是否",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "是否使用集团内投资主体字号、经营资质",
    label: "字号及经营资质名称",
    type: "input",
    placeholder: "字号及经营资质名称",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "是否使用集团内投资主体产品注册商标",
    label: "是否",
    type: "input",
    placeholder: "是否",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "是否使用集团内投资主体产品注册商标",
    label: "是否采取公允价格",
    type: "input",
    placeholder: "是否采取公允价格",
  },
]);

const dgdxxCok7 = ref([
  {
    prop: "njfcgbl1",
    headerGroup: "集团内投资主体实际担保",
    label: "是否",
    type: "input",
    placeholder: "是否",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "集团内投资主体实际担保",
    label: "担保金额（万元）",
    type: "input",
    placeholder: "担保金额（万元）",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "集团内投资主体实际担保",
    label: "其中：超级权比担保金额",
    type: "input",
    placeholder: "是否",
  },
  {
    prop: "njfcgbl1",
    label: "是否办理国有产权登记",
    headerGroup: " ",
    type: "input",
    placeholder: "是否办理国有产权登记",
  },
]);

const dgdxxCok8 = ref([
  {
    prop: "njfcgbl1",
    headerGroup: " ",
    label: "章程约定派出股东代表人数",
    type: "input",
    placeholder: "章程约定派出股东代表人数",
  },
  {
    prop: "njfcgbl1",
    headerGroup: " ",
    label: "实际派出股东代表人数",
    type: "input",
    placeholder: "实际派出股东代表人数",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "章程约定选派董事、监事或重要岗位人员情况",
    label: "选派类型",
    type: "input",
    placeholder: "选派类型",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "章程约定选派董事、监事或重要岗位人员情况",
    label: "重要岗位名称",
    type: "input",
    placeholder: "重要岗位名称",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "章程约定选派董事、监事或重要岗位人员情况",
    label: "总共人数",
    type: "input",
    placeholder: "总共人数",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "实际约定选派董事、监事或重要岗位人员情况",
    label: "选派类型",
    type: "input",
    placeholder: "选派类型",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "实际约定选派董事、监事或重要岗位人员情况",
    label: "重要岗位名称",
    type: "input",
    placeholder: "重要岗位名称",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "实际约定选派董事、监事或重要岗位人员情况",
    label: "总共人数",
    type: "input",
    placeholder: "总共人数",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "是否有特定事项否决权",
    label: "是否",
    type: "input",
    placeholder: "是否",
  },
  {
    prop: "njfcgbl1",
    headerGroup: "是否有特定事项否决权",
    label: "是否权内容",
    type: "input",
    placeholder: "是否权内容",
  },
]);
const dgdxxCok9 = ref([
  {
    prop: "njfcgbl1",

    label: "2020年自查整改至今新派出和调整参股企业董事监事及重要岗位人员人数",
    type: "input",
    placeholder:
      "2020年自查整改至今新派出和调整参股企业董事监事及重要岗位人员人数",
  },
  {
    prop: "njfcgbl1",

    label: "2020年自查整改至今规范领导人员兼职人数",
    type: "input",
    placeholder: "2020年自查整改至今规范领导人员兼职人数",
  },
  {
    prop: "njfcgbl1",

    label: "2020年自查整改至今新增或修订参股企业公司章程条数",
    type: "input",
    placeholder: "2020年自查整改至今新增或修订参股企业公司章程条数",
  },
  {
    prop: "njfcgbl1",

    label: "是否简历党的组织",
    type: "input",
    placeholder: "是否简历党的组织",
  },
]);

// 表单数据
const formData = reactive({
  projectGdxxs: [{}],
});

// 财务信息列表
const cwxxList = ref([]);

// 新增财务信息
const addCwxx = () => {
  cwxxList.value.push({
    nd: "",
    zzc: null,
    jzc: null,
    gsnjfznc: null,
    yysr: null,
    jlr: null,
    gsnjfndjdfh: null,
    gdhjcdffhsj: "",
    gsnjfndysdfh: null,
    sjsdfhsj: "",
    bndjtnzyjtzttzrb: null,
  });
};

// 删除财务信息
const deleteCwxx = (index) => {
  ElMessageBox.confirm("确认删除该项？", "提示", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  }).then(() => {
    cwxxList.value.splice(index, 1);
  });
};

// 加载状态
const loading = ref(false);
// 是否预览模式
const isPreview = ref(!!route.query.isPreview);
// 项目列表数据
const projectList = ref([]);
// 当前编辑的记录ID
const rcCgqyglId = ref(route.query.id || "");

// 获取项目列表
const getProjectData = (params = {}) => {
  proxy.$post({
    url: "/api/project/listProject",
    data: {
      page: 1,
      pagesize: 1000,
      attributes: [],
      menuType: "xmjc",
      ...params,
    },
    callback: (data) => {
      projectList.value = data.rows || [];
    },
  });
};

// 选择项目后同步项目名称
const changeProject = (val) => {
  const selectItem = projectList.value.find((item) => item.id === val);
  if (selectItem) {
    formData.projectName = selectItem.projectName;
  }
};

// 获取单条记录详情（编辑/预览）
const getRcCgqyglDetail = () => {
  if (!rcCgqyglId.value) return;

  loading.value = true;
  proxy.$post({
    url: "/api/project/getCgqygl",
    data: { id: rcCgqyglId.value },
    callback: (data) => {
      loading.value = false;
      Object.assign(formData, data);

      // 处理财务信息列表
      if (data.cwxxList) {
        cwxxList.value = data.cwxxList;
      }
    },
  });
};

// 返回按钮
const backClick = () => {
  router.back(-1);
};

// 保存/提交表单
const saveClick = () => {
  // 基础校验
  if (!formData.projectId) {
    ElMessage.warning("请选择项目信息");
    return;
  }

  loading.value = true;
  // 区分新增/编辑
  const url = rcCgqyglId.value
    ? "/api/project/updateCgqygl"
    : "/api/project/createCgqygl";

  // 组装提交数据
  const submitData = {
    ...formData,
    projectId: formData.projectId + "",
    cwxxList: cwxxList.value,
  };

  proxy.$post({
    url: url,
    data: submitData,
    callback: (res) => {
      loading.value = false;
      ElMessage.success(rcCgqyglId.value ? "编辑成功" : "新增成功");
      router.back(-1);
    },
  });
};

// 页面初始化
onMounted(() => {
  // 获取项目列表
  getProjectData();
  // 如果有ID则加载详情
  if (rcCgqyglId.value) {
    getRcCgqyglDetail();
  }
});
</script>

<style scoped lang="less">
.tab-handle {
  margin-bottom: 10px;
}
</style>
