<template>
  <div class="tab-content">
                  <div class="tab-content">
                    <el-form
                      :model="jcFormData"
                      :label-width="150"
                      :disabled="isPreview"
                    >
                      <el-collapse v-model="activeCollapse">
                        <el-collapse-item
                          title="项目投资总额（全口径）"
                          name="项目投资总额（全口径）"
                        >
                          <el-table
                            :data="jcTzzeqkjData"
                            style="width: 100%"
                            empty-text="暂无数据"
                            default-expand-all
                            row-key="xh"
                            border
                          >
                            <el-table-column prop="xh" label="序号" />
                            <el-table-column prop="zb" label="指标" />
                            <el-table-column prop="dw" label="" width="70" />
                            <el-table-column prop="rmbjj" label="人民币计价">
                              <template #default="scope">
                                <el-input
                                  v-if="!['一', '二'].includes(scope.row.xh)"
                                  v-model="scope.row.rmbjj"
                                  :min="0"
                                  :max="99999999999.99999999"
                                  controls-position="right"
                                />
                              </template>
                            </el-table-column>
                          </el-table>
                        </el-collapse-item>
                        <el-collapse-item
                          title="财务评价指标"
                          name="财务评价指标"
                        >
                          <el-table
                            :data="jcCwpjzbData"
                            style="width: 100%"
                            empty-text="暂无数据"
                            border
                          >
                            <el-table-column prop="name" label="指标" />
                            <el-table-column prop="unit" label="" width="70" />
                            <el-table-column
                              prop="num"
                              label="投资评估阶段批复值"
                            >
                              <template #default="scope">
                                <el-input
                                  v-model="scope.row.num"
                                  v-if="scope.row.type === 'year'"
                                />
                                <el-input
                                  v-else
                                  v-model="scope.row.num"
                                  :min="0"
                                  :max="99999999999.99999999"
                                  controls-position="right"
                                />
                              </template>
                            </el-table-column>
                          </el-table>
                        </el-collapse-item>
                        <el-collapse-item
                          title="核心边界条件"
                          name="核心边界条件"
                        >
                          <div class="tab-handle">
                            <el-button
                              type="primary"
                              size="small"
                              @click="addJchxbjtj"
                              >新增</el-button
                            >
                          </div>
                          <el-table
                            :data="jcHxbjtjData"
                            style="width: 100%"
                            empty-text="暂无数据"
                            border
                          >
                            <el-table-column type="index" width="50" />
                            <el-table-column
                              prop="type"
                              label="业务类型"
                              width="130"
                            >
                              <template #default="scope">
                                <CommonSelector
                                  v-model="scope.row.type"
                                  dictName="hxbjtjywlx"
                                />
                              </template>
                            </el-table-column>
                            <el-table-column label="单位工程造价">
                              <el-table-column
                                prop="dwgczjSz"
                                label="数值"
                                width="180"
                              >
                                <template #default="scope">
                                  <el-input
                                    v-model="scope.row.dwgczjSz"
                                    :min="0"
                                    :max="99999999999.99999999"
                                    controls-position="right"
                                  />
                                </template>
                              </el-table-column>
                              <el-table-column
                                prop="dwgczjDw"
                                label="单位"
                                width="130"
                              >
                                <template #default="scope">
                                  <CommonSelector
                                    v-model="scope.row.dwgczjDw"
                                    dictName="gczjdw"
                                  />
                                </template>
                              </el-table-column>
                            </el-table-column>
                            <el-table-column label="销售/服务能力">
                              <el-table-column
                                prop="xsfwnlSz"
                                label="数值"
                                width="180"
                              >
                                <template #default="scope">
                                  <el-input
                                    v-model="scope.row.xsfwnlSz"
                                    :min="0"
                                    :max="99999999999.99999999"
                                    controls-position="right"
                                  />
                                </template>
                              </el-table-column>
                              <el-table-column
                                prop="xsfwnlDw"
                                label="单位"
                                width="60"
                              />
                            </el-table-column>
                            <el-table-column label="年均负荷率">
                              <el-table-column
                                prop="njfhlSz"
                                label="数值"
                                width="180"
                              >
                                <template #default="scope">
                                  <el-input
                                    v-model="scope.row.njfhlSz"
                                    :min="0"
                                    :max="99999.99"
                                    controls-position="right"
                                  />
                                </template>
                              </el-table-column>
                              <el-table-column
                                prop="njfhlDw"
                                label="单位"
                                width="60"
                              />
                            </el-table-column>
                            <el-table-column label="单位生产/服务总成本">
                              <el-table-column
                                prop="dwscfwzcbSz"
                                label="数值"
                                width="180"
                              >
                                <template #default="scope">
                                  <el-input
                                    v-model="scope.row.dwscfwzcbSz"
                                    :min="0"
                                    :max="99999999999.99999999"
                                    controls-position="right"
                                  />
                                </template>
                              </el-table-column>
                              <el-table-column
                                prop="dwscfwzcbDw"
                                label="单位"
                                width="60"
                              />
                            </el-table-column>
                            <el-table-column label="单位售价（含税）">
                              <el-table-column
                                prop="dwsjSz"
                                label="数值"
                                width="180"
                              >
                                <template #default="scope">
                                  <el-input
                                    v-model="scope.row.dwsjSz"
                                    :min="0"
                                    :max="99999999999.99999999"
                                    controls-position="right"
                                  />
                                </template>
                              </el-table-column>
                              <el-table-column
                                prop="dwsjDw"
                                label="单位"
                                width="90"
                              >
                                <template #default="scope">
                                  <el-input v-model="scope.row.dwsjDw" />
                                </template>
                              </el-table-column>
                            </el-table-column>
                            <el-table-column label="盈亏平衡点">
                              <el-table-column
                                prop="ykphdlx"
                                label="类型"
                                width="130"
                              >
                                <template #default="scope">
                                  <CommonSelector
                                    v-model="scope.row.ykphdlx"
                                    dictName="ykphdlx"
                                  />
                                </template>
                              </el-table-column>
                              <el-table-column
                                prop="ykphdsz"
                                label="数值"
                                width="180"
                              >
                                <template #default="scope">
                                  <el-input
                                    v-model="scope.row.ykphdsz"
                                    :min="0"
                                    :max="99999999999.99999999"
                                    controls-position="right"
                                  />
                                </template>
                              </el-table-column>
                              <el-table-column
                                prop="ykphddw"
                                label="单位"
                                width="60"
                              />
                            </el-table-column>
                            <el-table-column
                              prop="bcsm"
                              label="核心边界条件补充说明"
                              width="180"
                            >
                              <template #default="scope">
                                <el-input
                                  v-model="scope.row.bcsm"
                                  type="textarea"
                                />
                              </template>
                            </el-table-column>
                            <el-table-column
                              label="操作"
                              width="60"
                              fixed="right"
                            >
                              <template #default="scope">
                                <el-button
                                  link
                                  type="danger"
                                  size="small"
                                  @click="deleteJchxbjtj(scope.$index)"
                                  >删除</el-button
                                >
                              </template>
                            </el-table-column>
                          </el-table>
                        </el-collapse-item>
                        <el-collapse-item
                          title="决策主体审核情况"
                          name="决策主体审核情况"
                        >
                          <div class="tab-handle">
                            <el-button
                              type="primary"
                              size="small"
                              @click="addJcztshqk"
                              >新增</el-button
                            >
                          </div>
                          <el-table
                            :data="jcztshqkData"
                            style="width: 100%"
                            empty-text="暂无数据"
                            border
                          >
                            <el-table-column type="index" width="50" />
                            <el-table-column prop="hylx" label="会议类型">
                              <template #default="scope">
                                <CommonSelector
                                  v-model="scope.row.hylx"
                                  dictName="hylx"
                                />
                              </template>
                            </el-table-column>
                            <el-table-column prop="hymc" label="会议名称">
                              <template #default="scope">
                                <el-input v-model="scope.row.hymc" />
                              </template>
                            </el-table-column>
                            <el-table-column
                              prop="jcsj"
                              label="决策时间"
                              width="260"
                            >
                              <template #default="scope">
                                <el-date-picker
                                  v-model="scope.row.jcsj"
                                  type="date"
                                  placeholder="请选择"
                                />
                              </template>
                            </el-table-column>
                            <el-table-column prop="jcjl" label="决策结论">
                              <template #default="scope">
                                <el-input
                                  v-model="scope.row.jcjl"
                                  type="textarea"
                                />
                              </template>
                            </el-table-column>
                            <el-table-column
                              label="会议纪要"
                              prop="hyjy"
                              width="170"
                            >
                              <template #default="scope">
                                <el-upload
                                  v-if="!scope.row.hyjy"
                                  :action="
                                    windowConfig.baseUrl + '/api/file/upload'
                                  "
                                  :headers="{ Authorization: token }"
                                  :show-file-list="false"
                                  :on-success="
                                    (res, file) =>
                                      addJcztshqkFile(res, file, scope.row)
                                  "
                                >
                                  <el-button link type="primary"
                                    >上传</el-button
                                  >
                                </el-upload>
                                <div class="upload-file-wrap" v-else>
                                  <span
                                    class="file-name"
                                    @click="downloadFile(scope.row.hyjy)"
                                    >{{ scope.row.hyjy.originalname }}</span
                                  >
                                  <span
                                    class="delete-btn"
                                    @click="
                                      deleteJcztshqkFile(
                                        scope.row,
                                        scope.$index,
                                      )
                                    "
                                  >
                                    <el-icon><CloseBold /></el-icon>
                                  </span>
                                </div>
                              </template>
                            </el-table-column>
                            <el-table-column prop="qtsm" label="其他说明">
                              <template #default="scope">
                                <el-input
                                  v-model="scope.row.qtsm"
                                  type="textarea"
                                />
                              </template>
                            </el-table-column>
                            <el-table-column
                              label="操作"
                              width="60"
                              fixed="right"
                            >
                              <template #default="scope">
                                <el-button
                                  link
                                  type="danger"
                                  size="small"
                                  @click="deleteJcztshqk(scope.$index)"
                                  >删除</el-button
                                >
                              </template>
                            </el-table-column>
                          </el-table>
                        </el-collapse-item>
                        <el-collapse-item
                          title="投资主体审核情况"
                          name="投资主体审核情况"
                        >
                          <div class="tab-handle">
                            <el-button
                              type="primary"
                              size="small"
                              @click="addTzztshqk"
                              >新增</el-button
                            >
                          </div>
                          <el-table
                            :data="tzztshqkData"
                            style="width: 100%"
                            empty-text="暂无数据"
                            border
                          >
                            <el-table-column type="index" width="50" />
                            <el-table-column prop="hylx" label="会议类型">
                              <template #default="scope">
                                <CommonSelector
                                  v-model="scope.row.hylx"
                                  dictName="hylx"
                                />
                              </template>
                            </el-table-column>
                            <el-table-column prop="hymc" label="会议名称">
                              <template #default="scope">
                                <el-input v-model="scope.row.hymc" />
                              </template>
                            </el-table-column>
                            <el-table-column
                              prop="shsj"
                              label="审核时间"
                              width="260"
                            >
                              <template #default="scope">
                                <el-date-picker
                                  v-model="scope.row.shsj"
                                  type="date"
                                  placeholder="请选择"
                                />
                              </template>
                            </el-table-column>
                            <el-table-column prop="jl" label="结论">
                              <template #default="scope">
                                <el-input
                                  v-model="scope.row.jl"
                                  type="textarea"
                                />
                              </template>
                            </el-table-column>
                            <el-table-column label="附件" prop="fj">
                              <template #default="scope">
                                <el-upload
                                  v-if="!scope.row.fj"
                                  :action="
                                    windowConfig.baseUrl + '/api/file/upload'
                                  "
                                  :headers="{ Authorization: token }"
                                  :show-file-list="false"
                                  :on-success="
                                    (res, file) =>
                                      addTzztshqkFile(res, file, scope.row)
                                  "
                                >
                                  <el-button link type="primary"
                                    >上传</el-button
                                  >
                                </el-upload>
                                <div class="upload-file-wrap" v-else>
                                  <span
                                    class="file-name"
                                    @click="downloadFile(scope.row.fj)"
                                    >{{ scope.row.fj.originalname }}</span
                                  >
                                  <span
                                    class="delete-btn"
                                    @click="
                                      deleteTzztshqkFile(
                                        scope.row,
                                        scope.$index,
                                      )
                                    "
                                  >
                                    <el-icon><CloseBold /></el-icon>
                                  </span>
                                </div>
                              </template>
                            </el-table-column>
                            <el-table-column prop="qtsm" label="其他说明">
                              <template #default="scope">
                                <el-input
                                  v-model="scope.row.qtsm"
                                  type="textarea"
                                />
                              </template>
                            </el-table-column>
                            <el-table-column
                              label="操作"
                              width="60"
                              fixed="right"
                            >
                              <template #default="scope">
                                <el-button
                                  link
                                  type="danger"
                                  size="small"
                                  @click="deleteTzztshqk(scope.$index)"
                                  >删除</el-button
                                >
                              </template>
                            </el-table-column>
                          </el-table>
                          <el-row :gutter="20">
                            <el-col :span="24">
                              <el-form-item label="其他会议审议情况">
                                <el-input
                                  v-model="jcFormData.jcqthysyqk"
                                  type="textarea"
                                  :autosize="{ minRows: 2, maxRows: 5 }"
                                />
                              </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="最终审批意见"
                                label-width="160"
                              >
                                <CommonSelector
                                  v-model="jcFormData.jczzpfyj"
                                  dictName="spyj"
                                />
                              </el-form-item>
                            </el-col>
                            <el-col :span="8">
                              <el-form-item label="项目批复时间">
                                <el-date-picker
                                  v-model="jcFormData.jcxmpfsj"
                                  type="date"
                                  placeholder="请选择"
                                />
                              </el-form-item>
                            </el-col>
                            <el-col :span="8">
                              <el-form-item label="项目批复文号">
                                <el-input v-model="jcFormData.jcxmpfwh" />
                              </el-form-item>
                            </el-col>
                            <el-col :span="24">
                              <el-form-item
                                label="未通过主要原因与要求"
                                label-width="160"
                              >
                                <el-input
                                  v-model="jcFormData.jcwtgzyyyyyq"
                                  type="textarea"
                                  :autosize="{ minRows: 2, maxRows: 5 }"
                                />
                              </el-form-item>
                            </el-col>
                          </el-row>
                        </el-collapse-item>
                        <el-collapse-item title="审批意见" name="审批意见">
                          <div class="tab-handle">
                            <el-button
                              type="primary"
                              size="small"
                              @click="addJcspyj"
                              >新增</el-button
                            >
                          </div>
                          <el-table
                            :data="jcspyjData"
                            style="width: 100%"
                            empty-text="暂无数据"
                            border
                          >
                            <el-table-column type="index" width="50" />
                            <el-table-column prop="lx" label="类型">
                              <template #default="scope">
                                <CommonSelector
                                  v-model="scope.row.lx"
                                  dictName="jcspyjlx"
                                />
                              </template>
                            </el-table-column>
                            <el-table-column prop="pfyj" label="批复意见">
                              <template #default="scope">
                                <el-input
                                  v-model="scope.row.pfyj"
                                  type="textarea"
                                />
                              </template>
                            </el-table-column>
                            <el-table-column
                              prop="pfyjsj"
                              label="批复意见时间"
                              width="260"
                            >
                              <template #default="scope">
                                <el-date-picker
                                  v-model="scope.row.pfyjsj"
                                  type="date"
                                  placeholder="请选择"
                                />
                              </template>
                            </el-table-column>
                            <el-table-column label="执行回复" prop="zxhf">
                              <template #default="scope">
                                <el-input
                                  v-model="scope.row.zxhf"
                                  type="textarea"
                                />
                              </template>
                            </el-table-column>
                            <el-table-column
                              label="执行回复时间"
                              prop="zxhfsj"
                              width="260"
                            >
                              <template #default="scope">
                                <el-date-picker
                                  v-model="scope.row.zxhfsj"
                                  type="date"
                                  placeholder="请选择"
                                />
                              </template>
                            </el-table-column>
                            <el-table-column label="执行回复附件" prop="zxhffj">
                              <template #default="scope">
                                <el-upload
                                  v-if="!scope.row.zxhffj"
                                  :action="
                                    windowConfig.baseUrl + '/api/file/upload'
                                  "
                                  :headers="{ Authorization: token }"
                                  :show-file-list="false"
                                  :on-success="
                                    (res, file) =>
                                      addJcspyjFile(res, file, scope.row)
                                  "
                                >
                                  <el-button link type="primary"
                                    >上传</el-button
                                  >
                                </el-upload>
                                <div class="upload-file-wrap" v-else>
                                  <span
                                    class="file-name"
                                    @click="downloadFile(scope.row.zxhffj)"
                                    >{{ scope.row.zxhffj.originalname }}</span
                                  >
                                  <span
                                    class="delete-btn"
                                    @click="
                                      deleteRowFile(scope.row, scope.$index)
                                    "
                                  >
                                    <el-icon><CloseBold /></el-icon>
                                  </span>
                                </div>
                              </template>
                            </el-table-column>
                            <el-table-column
                              label="操作"
                              width="60"
                              fixed="right"
                            >
                              <template #default="scope">
                                <el-button
                                  link
                                  type="danger"
                                  size="small"
                                  @click="deleteJcspyj(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="8">
                              <el-form-item
                                label-width="160"
                                label="投资主体首次申报时间"
                              >
                                <el-date-picker
                                  v-model="jcFormData.tzztscsbsj"
                                  type="date"
                                  placeholder="请选择"
                                />
                              </el-form-item>
                            </el-col>
                            <el-col :span="8">
                              <el-form-item
                                label-width="160"
                                label="会签完成时间"
                              >
                                <el-date-picker
                                  v-model="jcFormData.hqwcsj"
                                  type="date"
                                  placeholder="请选择"
                                />
                              </el-form-item>
                            </el-col>
                            <el-col :span="8">
                              <el-form-item
                                label-width="160"
                                label="首次发函时间"
                              >
                                <el-date-picker
                                  v-model="jcFormData.scfhsj"
                                  type="date"
                                  placeholder="请选择"
                                />
                              </el-form-item>
                            </el-col>
                            <el-col :span="8">
                              <el-form-item
                                label-width="160"
                                label="补充资料时间"
                              >
                                <el-date-picker
                                  v-model="jcFormData.bczlsj"
                                  type="date"
                                  placeholder="请选择"
                                />
                              </el-form-item>
                            </el-col>
                            <el-col :span="8">
                              <el-form-item label-width="160" label="审核人">
                                <el-input v-model="jcFormData.shr" />
                              </el-form-item>
                            </el-col>
                          </el-row>
                        </el-collapse-item>
                      </el-collapse>
                    </el-form>
                  </div>
  </div>
</template>

<script setup>
import { inject } from "vue";
import CommonSelector from "@/components/CommonSelector.vue";

const {
  jcFormData, isPreview, activeCollapse,
  jcTzzeqkjData, jcCwpjzbData, jcHxbjtjData,
  jcztshqkData, tzztshqkData, jcspyjData,
  addJchxbjtj, deleteJchxbjtj,
  addJcztshqk, deleteJcztshqk, addJcztshqkFile, deleteJcztshqkFile,
  addTzztshqk, deleteTzztshqk, addTzztshqkFile, deleteTzztshqkFile,
  addJcspyj, deleteJcspyj, addJcspyjFile, deleteRowFile,
  downloadFile,
  windowConfig, token,
} = inject("jcShared");
</script>
