<script setup name="markScore">
import { onMounted, ref } from 'vue'
import { templateDetail } from '@/http/apis/performanceEvaluation/unitSelfEvaluation'
import { useRoute } from 'vue-router'
import Accessory from '@/components/accessory/index.vue'
import NoData from '@/components/noData/index.vue'
import store from '@/store'
import { fileFormatVerification, handleFileSuccess, fileTypes, fileDesc, handleFileError, handleFilePreview } from '@/utils/uploadAction.js'

const uploadUrl = store.dictStore.uploadUrl,
  route = useRoute(),
  collapseModal = ref(['1']),
  loading = ref(false),
  isTemp = ref(true),
  form = ref({}),
  formRef = ref(),
  getDetail = async () => {
    loading.value = true
    try {
      const res = await templateDetail(route.query.projectCode)
      isTemp.value = true
      form.value = {
        ...res.data,
        templateDetails: changeTemplate(res.data.templateDetails),
        additionalIndexDetails: res.data.additionalIndexDetails ? changeTemplate(res.data.additionalIndexDetails) : undefined
      }
      loading.value = false
    } catch (e) {
      isTemp.value = false
      loading.value = false
    }
  },
  changeTemplate = (data) => {
    data.forEach(one => {
      one.children.forEach(two => {
        two.children.forEach(three => {
          three['selfAppraisalScoreInfo1'] = three?.selfAppraisalScoreInfo?.find(i => i.appraisalType === 1) || { appraisalScore: undefined, appraisalBasisAppendix: [], appraisalBasis: '' }
          three['selfAppraisalScoreInfo2'] = { appraisalScore: undefined, appraisalBasisAppendix: [], appraisalBasis: '' }
          three['selfAppraisalScoreInfo3'] = { appraisalScore: undefined, appraisalBasisAppendix: [], appraisalBasis: '' }
          three['selfAppraisalScoreInfo4'] = { appraisalScore: undefined, appraisalBasisAppendix: [], appraisalBasis: '' }
        })
      })
    })
    return data
  }
defineExpose({ formRef, form })
onMounted(() => {
  getDetail()
})
</script>

<template>
  <el-form
    v-if="isTemp"
    ref="formRef"
    v-loading="loading"
    :model="form"
    label-suffix=":"
    scroll-to-error
    label-width="90"
    class="scoreForm"
  >
    <el-collapse v-model="collapseModal">
      <el-collapse-item name="1" class="mb-16">
        <template #title>
          <div class="collapse-title">评价指标</div>
        </template>
        <el-collapse class="customCollapse">
          <el-collapse-item v-for="(one,index) in form.templateDetails" :key="index">
            <template #title>
              <div class="collapse-title">一级指标：{{ one.name }}</div>
            </template>
            <el-collapse class="customCollapse">
              <el-collapse-item v-for="(two,key) in one.children" :key="key">
                <template #title>
                  <div class="collapse-title">二级指标：{{ two.name }}</div>
                </template>
                <div v-for="(three,i) in two.children" :key="i" class="pl-16">
                  <el-form-item label="三级指标" style="margin-bottom: 0">
                    <span>{{ three.name }}（{{ three.indexScore }}分）</span>
                  </el-form-item>
                  <el-form-item label="指标细则" style="margin-bottom: 0">
                    <span class="text-info">{{ three.indexDetail }}</span>
                  </el-form-item>
                  <el-form-item label="评分细则" style="margin-bottom: 0">
                    <span class="text-info">{{ three.gradeDetail }}</span>
                  </el-form-item>
                  <el-form-item label="佐证材料" style="margin-bottom: 0">
                    <span class="text-info">{{ three.supportMaterial }}</span>
                  </el-form-item>
                  <template v-if="$route.name==='unitSelfGiveScore'">
                    <el-row>
                      <el-col :span="24">
                        <el-form-item
                          label="自评得分"
                          :prop="`templateDetails[${index}].children[${key}].children[${i}].selfAppraisalScoreInfo1.appraisalScore`"
                          :rules="{
                            required: true,
                            message: '请输入',
                          }"
                        >
                          <el-input-number
                            v-model="three.selfAppraisalScoreInfo1.appraisalScore"
                            placeholder="请填写"
                            :min="0"
                            :max="three.indexScore"
                            :precision="2"
                            :controls="false"
                            @mousewheel.prevent
                          />
                        </el-form-item>
                      </el-col>
                      <el-col :span="24">
                        <el-form-item label="评价依据">
                          <el-input
                            v-model="three.selfAppraisalScoreInfo1.appraisalBasis"
                            placeholder="请填写"
                            maxlength="500"
                            show-word-limit
                            type="textarea"
                          />
                          <el-upload
                            v-model:file-list="form['templateDetails'][index].children[key].children[i].selfAppraisalScoreInfo1.appraisalBasisAppendix"
                            class="w-full"
                            :action="uploadUrl"
                            :limit="5"
                            :on-error="handleFileError"
                            :on-preview="handleFilePreview"
                            :on-success="res => handleFileSuccess(res, form['templateDetails'][index].children[key].children[i].selfAppraisalScoreInfo1.appraisalBasisAppendix)"
                            :before-upload="file=>fileFormatVerification(file, {types: fileTypes})"
                            :accept="fileTypes.map(i=>`.${i}`).join(',')"
                          >
                            <el-button type="primary" plain size="small">选择文件</el-button>
                            <template #tip>
                              <div class="el-upload__tip">
                                支持{{ fileDesc }}文件
                              </div>
                            </template>
                          </el-upload>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </template>
                  <template v-else>
                    <el-row :gutter="16" class="w-full">
                      <el-col :span="12">
                        <el-form-item label="自评得分" style="margin-bottom: 0">
                          {{ three.selfAppraisalScoreInfo1.appraisalScore }}分
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="自评依据" style="margin-bottom: 0">
                          <div>
                            <p>{{ three.selfAppraisalScoreInfo1.appraisalBasis }}</p>
                            <p v-for="(file,fileIndex) in three.selfAppraisalScoreInfo1.appraisalBasisAppendix&&JSON.parse(three.selfAppraisalScoreInfo1.appraisalBasisAppendix)" :key="fileIndex" class="mb-4">
                              <accessory :file-name="file.originalFileName" :file-id="file.id" />
                            </p>
                          </div>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </template>
                  <template v-if="$route.name==='reviewGiveScore'||$route.name==='checkGiveScore'||$route.name==='reformCheckHandle'">
                    <el-row>
                      <el-col v-for="(item,infoIndex) in three.reAppraisalScoreInfo&&Object.values(three.reAppraisalScoreInfo)?.length&& Object.values(three.reAppraisalScoreInfo).reduce((arr, cur) => arr.concat((cur), []))" :key="infoIndex" :span="12">
                        <el-col :span="24">
                          <el-form-item label="复评员" style="margin-bottom: 0">
                            {{ item.appraisalEmployeeName }}
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <el-form-item label="复评得分" style="margin-bottom: 0">
                            {{ item.appraisalScore }}分
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <el-form-item label="复评依据" style="margin-bottom: 0">
                            <div v-if="item.appraisalBasis||item.appraisalBasisAppendix">
                              <p>{{ item.appraisalBasis }}</p>
                              <p v-for="(file,fileIndex) in item.appraisalBasisAppendix&&JSON.parse(item.appraisalBasisAppendix)" :key="fileIndex" class="mb-4">
                                <accessory :file-name="file.originalFileName" :file-id="file.id" />
                              </p>
                            </div>
                            <span v-else>-</span>
                          </el-form-item>
                        </el-col>
                      </el-col>
                    </el-row>
                  </template>
                  <template v-if="$route.name==='reviewGiveScore'">
                    <el-row>
                      <el-col>
                        <el-col :span="24">
                          <el-form-item
                            label="复评得分"
                            :prop="`templateDetails[${index}].children[${key}].children[${i}].selfAppraisalScoreInfo2.appraisalScore`"
                            :rules="{
                              required: true,
                              message: '请输入',
                            }"
                          >
                            <el-input-number
                              v-model="three.selfAppraisalScoreInfo2.appraisalScore"
                              placeholder="请填写"
                              :min="0"
                              :max="three.indexScore"
                              :precision="2"
                              :controls="false"
                              @mousewheel.prevent
                            />
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <el-form-item label="评价依据">
                            <el-input
                              v-model="three.selfAppraisalScoreInfo2.appraisalBasis"
                              placeholder="请填写"
                              maxlength="500"
                              show-word-limit
                              type="textarea"
                            />
                            <el-upload
                              v-model:file-list="form['templateDetails'][index].children[key].children[i].selfAppraisalScoreInfo2.appraisalBasisAppendix"
                              class="w-full"
                              :action="uploadUrl"
                              :limit="5"
                              :on-error="handleFileError"
                              :on-preview="handleFilePreview"
                              :on-success="res => handleFileSuccess(res, form['templateDetails'][index].children[key].children[i].selfAppraisalScoreInfo2.appraisalBasisAppendix)"
                              :before-upload="file=>fileFormatVerification(file, {types: fileTypes})"
                              :accept="fileTypes.map(i=>`.${i}`).join(',')"
                            >
                              <el-button type="primary" plain size="small">选择文件</el-button>
                              <template #tip>
                                <div class="el-upload__tip">
                                  支持{{ fileDesc }}文件
                                </div>
                              </template>
                            </el-upload>
                          </el-form-item>
                        </el-col>
                      </el-col>
                    </el-row>
                  </template>
                  <template v-if="$route.name==='checkGiveScore'||$route.name==='reformCheckHandle'">
                    <el-row>
                      <el-col v-for="(item,infoIndex) in three.verifyScoreInfo&&Object.values(three.verifyScoreInfo)?.length&& Object.values(three.verifyScoreInfo).reduce((arr, cur) => arr.concat((cur), []))" :key="infoIndex" :span="12">
                        <el-col :span="24">
                          <el-form-item label="核查员" style="margin-bottom: 0">
                            {{ item.appraisalEmployeeName }}
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <el-form-item label="核查得分" style="margin-bottom: 0">
                            {{ item.appraisalScore }}分
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <el-form-item label="核查依据" style="margin-bottom: 0">
                            <div v-if="item.appraisalBasis||item.appraisalBasisAppendix">
                              <p>{{ item.appraisalBasis }}</p>
                              <p v-for="(file,fileIndex) in item.appraisalBasisAppendix&&JSON.parse(item.appraisalBasisAppendix)" :key="fileIndex" class="mb-4">
                                <accessory :file-name="file.originalFileName" :file-id="file.id" />
                              </p>
                            </div>
                            <span v-else>-</span>
                          </el-form-item>
                        </el-col>
                      </el-col>
                      <template v-if="$route.name==='checkGiveScore'">
                        <el-col :span="24">
                          <el-form-item
                            label="核查得分"
                            :prop="`templateDetails[${index}].children[${key}].children[${i}].selfAppraisalScoreInfo3.appraisalScore`"
                            :rules="{
                              required: true,
                              message: '请输入',
                            }"
                          >
                            <el-input-number
                              v-model="three.selfAppraisalScoreInfo3.appraisalScore"
                              placeholder="请填写"
                              :min="0"
                              :max="three.indexScore"
                              :precision="2"
                              :controls="false"
                              @mousewheel.prevent
                            />
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <el-form-item label="评价依据">
                            <el-input
                              v-model="three.selfAppraisalScoreInfo3.appraisalBasis"
                              placeholder="请填写"
                              maxlength="500"
                              show-word-limit
                              type="textarea"
                            />
                            <el-upload
                              v-model:file-list="form['templateDetails'][index].children[key].children[i].selfAppraisalScoreInfo3.appraisalBasisAppendix"
                              class="w-full"
                              :action="uploadUrl"
                              :limit="5"
                              :on-error="handleFileError"
                              :on-preview="handleFilePreview"
                              :on-success="res => handleFileSuccess(res, form['templateDetails'][index].children[key].children[i].selfAppraisalScoreInfo3.appraisalBasisAppendix)"
                              :before-upload="file=>fileFormatVerification(file, {types: fileTypes})"
                              :accept="fileTypes.map(i=>`.${i}`).join(',')"
                            >
                              <el-button type="primary" plain size="small">选择文件</el-button>
                              <template #tip>
                                <div class="el-upload__tip">
                                  支持{{ fileDesc }}文件
                                </div>
                              </template>
                            </el-upload>
                          </el-form-item>
                        </el-col>
                      </template>
                    </el-row>
                  </template>
                  <template v-if="$route.name==='reformCheckHandle'">
                    <el-col :span="24">
                      <el-form-item
                        label="复核得分"
                        :prop="`templateDetails[${index}].children[${key}].children[${i}].selfAppraisalScoreInfo4.appraisalScore`"
                        :rules="{
                          required: true,
                          message: '请输入',
                        }"
                      >
                        <el-input-number
                          v-model="three.selfAppraisalScoreInfo4.appraisalScore"
                          placeholder="请填写"
                          :min="0"
                          :max="three.indexScore"
                          :precision="2"
                          :controls="false"
                          @mousewheel.prevent
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="评价依据">
                        <el-input
                          v-model="three.selfAppraisalScoreInfo4.appraisalBasis"
                          placeholder="请填写"
                          maxlength="500"
                          show-word-limit
                          type="textarea"
                        />
                        <el-upload
                          v-model:file-list="form['templateDetails'][index].children[key].children[i].selfAppraisalScoreInfo4.appraisalBasisAppendix"
                          class="w-full"
                          :action="uploadUrl"
                          :limit="5"
                          :on-error="handleFileError"
                          :on-preview="handleFilePreview"
                          :on-success="res => handleFileSuccess(res, form['templateDetails'][index].children[key].children[i].selfAppraisalScoreInfo4.appraisalBasisAppendix)"
                          :before-upload="file=>fileFormatVerification(file, {types: fileTypes})"
                          :accept="fileTypes.map(i=>`.${i}`).join(',')"
                        >
                          <el-button type="primary" plain size="small">选择文件</el-button>
                          <template #tip>
                            <div class="el-upload__tip">
                              支持{{ fileDesc }}文件
                            </div>
                          </template>
                        </el-upload>
                      </el-form-item>
                    </el-col>
                  </template>
                </div>
              </el-collapse-item>
            </el-collapse>
          </el-collapse-item>
        </el-collapse>
      </el-collapse-item>
      <el-collapse-item name="4" class="mb-16">
        <template #title>
          <div class="collapse-title">附加阶段</div>
        </template>
        <el-collapse v-if="form.additionalIndexDetails" class="customCollapse">
          <el-collapse-item v-for="(one,index) in form.additionalIndexDetails" :key="index">
            <template #title>
              <div class="collapse-title">一级指标：{{ one.name }}</div>
            </template>
            <el-collapse class="customCollapse">
              <el-collapse-item v-for="(two,key) in one.children" :key="key">
                <template #title>
                  <div class="collapse-title">二级指标：{{ two.name }}</div>
                </template>
                <div v-for="(three,i) in two.children" :key="i" class="pl-16">
                  <el-form-item label="三级指标" style="margin-bottom: 0">
                    <span>{{ three.name }}（{{ three.indexScore }}分）</span>
                  </el-form-item>
                  <el-form-item label="指标细则" style="margin-bottom: 0">
                    <span class="text-info">{{ three.indexDetail }}</span>
                  </el-form-item>
                  <el-form-item label="评分细则" style="margin-bottom: 0">
                    <span class="text-info">{{ three.gradeDetail }}</span>
                  </el-form-item>
                  <el-form-item label="佐证材料" style="margin-bottom: 0">
                    <span class="text-info">{{ three.supportMaterial }}</span>
                  </el-form-item>
                  <template v-if="$route.name==='unitSelfGiveScore'">
                    <el-row>
                      <el-col :span="24">
                        <el-form-item
                          label="自评得分"
                          :prop="`additionalIndexDetails[${index}].children[${key}].children[${i}].selfAppraisalScoreInfo1.appraisalScore`"
                          :rules="{
                            required: true,
                            message: '请输入',
                          }"
                        >
                          <el-input-number
                            v-model="three.selfAppraisalScoreInfo1.appraisalScore"
                            placeholder="请填写"
                            :min="three.indexScore>0?0:three.indexScore"
                            :max="three.indexScore>=0?three.indexScore:0"
                            :precision="2"
                            :controls="false"
                            @mousewheel.prevent
                          />
                        </el-form-item>
                      </el-col>
                      <el-col :span="24">
                        <el-form-item label="评价依据">
                          <el-input
                            v-model="three.selfAppraisalScoreInfo1.appraisalBasis"
                            placeholder="请填写"
                            maxlength="500"
                            show-word-limit
                            type="textarea"
                          />
                          <el-upload
                            v-model:file-list="form['additionalIndexDetails'][index].children[key].children[i].selfAppraisalScoreInfo1.appraisalBasisAppendix"
                            class="w-full"
                            :action="uploadUrl"
                            :limit="5"
                            :on-error="handleFileError"
                            :on-preview="handleFilePreview"
                            :on-success="res => handleFileSuccess(res, form['additionalIndexDetails'][index].children[key].children[i].selfAppraisalScoreInfo1.appraisalBasisAppendix)"
                            :before-upload="file=>fileFormatVerification(file, {types: fileTypes})"
                            :accept="fileTypes.map(i=>`.${i}`).join(',')"
                          >
                            <el-button type="primary" plain size="small">选择文件</el-button>
                            <template #tip>
                              <div class="el-upload__tip">
                                支持{{ fileDesc }}文件
                              </div>
                            </template>
                          </el-upload>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </template>
                  <template v-else>
                    <el-row :gutter="16" class="w-full">
                      <el-col :span="12">
                        <el-form-item label="自评得分">
                          {{ three.selfAppraisalScoreInfo1.appraisalScore }}分
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="自评依据">
                          <div>
                            <p>{{ three.selfAppraisalScoreInfo1.appraisalBasis }}</p>
                            <p v-for="(file,fileIndex) in three.selfAppraisalScoreInfo1?.appraisalBasisAppendix&&JSON.parse(three.selfAppraisalScoreInfo1.appraisalBasisAppendix)" :key="fileIndex" class="mb-4">
                              <accessory :file-name="file.originalFileName" :file-id="file.id" />
                            </p>
                          </div>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </template>
                  <template v-if="$route.name==='reviewGiveScore'||$route.name==='checkGiveScore'||$route.name==='reformCheckHandle'">
                    <el-row>
                      <el-col v-for="(item,infoIndex) in three.reAppraisalScoreInfo&&Object.values(three.reAppraisalScoreInfo)?.length&& Object.values(three.reAppraisalScoreInfo).reduce((arr, cur) => arr.concat((cur), []))" :key="infoIndex" :span="12">
                        <el-col :span="24">
                          <el-form-item label="复评员" style="margin-bottom: 0">
                            {{ item.appraisalEmployeeName }}
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <el-form-item label="复评得分" style="margin-bottom: 0">
                            {{ item.appraisalScore }}分
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <el-form-item label="复评依据" style="margin-bottom: 0">
                            <div v-if="item.appraisalBasis||item.appraisalBasisAppendix">
                              <p>{{ item.appraisalBasis }}</p>
                              <p v-for="(file,fileIndex) in item?.appraisalBasisAppendix&&JSON.parse(item.appraisalBasisAppendix)" :key="fileIndex" class="mb-4">
                                <accessory :file-name="file.originalFileName" :file-id="file.id" />
                              </p>
                            </div>
                            <span v-else>-</span>
                          </el-form-item>
                        </el-col>
                      </el-col>
                    </el-row>
                  </template>
                  <template v-if="$route.name==='reviewGiveScore'">
                    <el-row>
                      <el-col :span="24">
                        <el-form-item
                          label="复评得分"
                          :prop="`additionalIndexDetails[${index}].children[${key}].children[${i}].selfAppraisalScoreInfo2.appraisalScore`"
                          :rules="{
                            required: true,
                            message: '请输入',
                          }"
                        >
                          <el-input-number
                            v-model="three.selfAppraisalScoreInfo2.appraisalScore"
                            placeholder="请填写"
                            :min="three.indexScore>0?0:three.indexScore"
                            :max="three.indexScore>=0?three.indexScore:0"
                            :precision="2"
                            :controls="false"
                            @mousewheel.prevent
                          />
                        </el-form-item>
                      </el-col>
                      <el-col :span="24">
                        <el-form-item label="评价依据">
                          <el-input
                            v-model="three.selfAppraisalScoreInfo2.appraisalBasis"
                            placeholder="请填写"
                            maxlength="500"
                            show-word-limit
                            type="textarea"
                          />
                          <el-upload
                            v-model:file-list="form['additionalIndexDetails'][index].children[key].children[i].selfAppraisalScoreInfo2.appraisalBasisAppendix"
                            class="w-full"
                            :action="uploadUrl"
                            :limit="5"
                            :on-error="handleFileError"
                            :on-preview="handleFilePreview"
                            :on-success="res => handleFileSuccess(res, form['additionalIndexDetails'][index].children[key].children[i].selfAppraisalScoreInfo2.appraisalBasisAppendix)"
                            :before-upload="file=>fileFormatVerification(file, {types: fileTypes})"
                            :accept="fileTypes.map(i=>`.${i}`).join(',')"
                          >
                            <el-button type="primary" plain size="small">选择文件</el-button>
                            <template #tip>
                              <div class="el-upload__tip">
                                支持{{ fileDesc }}文件
                              </div>
                            </template>
                          </el-upload>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </template>
                  <template v-if="$route.name==='checkGiveScore'||$route.name==='reformCheckHandle'">
                    <el-row>
                      <el-col v-for="(item,infoIndex) in three.verifyScoreInfo&&Object.values(three.verifyScoreInfo)?.length&& Object.values(three.verifyScoreInfo).reduce((arr, cur) => arr.concat((cur), []))" :key="infoIndex" :span="12">
                        <el-col :span="24">
                          <el-form-item label="核查员" style="margin-bottom: 0">
                            {{ item.appraisalEmployeeName }}
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <el-form-item label="核查得分" style="margin-bottom: 0">
                            {{ item.appraisalScore }}分
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <el-form-item label="核查依据" style="margin-bottom: 0">
                            <div v-if="item.appraisalBasis||item.appraisalBasisAppendix">
                              <p>{{ item.appraisalBasis }}</p>
                              <p v-for="(file,fileIndex) in item.appraisalBasisAppendix&&JSON.parse(item.appraisalBasisAppendix)" :key="fileIndex" class="mb-4">
                                <accessory :file-name="file.originalFileName" :file-id="file.id" />
                              </p>
                            </div>
                            <span v-else>-</span>
                          </el-form-item>
                        </el-col>
                      </el-col>
                      <template v-if="$route.name==='checkGiveScore'">
                        <el-col :span="24">
                          <el-form-item
                            label="核查得分"
                            :prop="`additionalIndexDetails[${index}].children[${key}].children[${i}].selfAppraisalScoreInfo3.appraisalScore`"
                            :rules="{
                              required: true,
                              message: '请输入',
                            }"
                          >
                            <el-input-number
                              v-model="three.selfAppraisalScoreInfo3.appraisalScore"
                              placeholder="请填写"
                              :min="three.indexScore>0?0:three.indexScore"
                              :max="three.indexScore>=0?three.indexScore:0"
                              :precision="2"
                              :controls="false"
                              @mousewheel.prevent
                            />
                          </el-form-item>
                        </el-col>
                        <el-col :span="24">
                          <el-form-item label="评价依据">
                            <el-input
                              v-model="three.selfAppraisalScoreInfo3.appraisalBasis"
                              placeholder="请填写"
                              maxlength="500"
                              show-word-limit
                              type="textarea"
                            />
                            <el-upload
                              v-model:file-list="form['additionalIndexDetails'][index].children[key].children[i].selfAppraisalScoreInfo3.appraisalBasisAppendix"
                              class="w-full"
                              :action="uploadUrl"
                              :limit="5"
                              :on-error="handleFileError"
                              :on-preview="handleFilePreview"
                              :on-success="res => handleFileSuccess(res, form['additionalIndexDetails'][index].children[key].children[i].selfAppraisalScoreInfo3.appraisalBasisAppendix)"
                              :before-upload="file=>fileFormatVerification(file, {types: fileTypes})"
                              :accept="fileTypes.map(i=>`.${i}`).join(',')"
                            >
                              <el-button type="primary" plain size="small">选择文件</el-button>
                              <template #tip>
                                <div class="el-upload__tip">
                                  支持{{ fileDesc }}文件
                                </div>
                              </template>
                            </el-upload>
                          </el-form-item>
                        </el-col>
                      </template>
                    </el-row>
                  </template>
                  <template v-if="$route.name==='reformCheckHandle'">
                    <el-col :span="24">
                      <el-form-item
                        label="复核得分"
                        :prop="`additionalIndexDetails[${index}].children[${key}].children[${i}].selfAppraisalScoreInfo4.appraisalScore`"
                        :rules="{
                          required: true,
                          message: '请输入',
                        }"
                      >
                        <el-input-number
                          v-model="three.selfAppraisalScoreInfo4.appraisalScore"
                          placeholder="请填写"
                          :min="three.indexScore>0?0:three.indexScore"
                          :max="three.indexScore>=0?three.indexScore:0"
                          :precision="2"
                          :controls="false"
                          @mousewheel.prevent
                        />
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="评价依据">
                        <el-input
                          v-model="three.selfAppraisalScoreInfo4.appraisalBasis"
                          placeholder="请填写"
                          maxlength="500"
                          show-word-limit
                          type="textarea"
                        />
                        <el-upload
                          v-model:file-list="form['additionalIndexDetails'][index].children[key].children[i].selfAppraisalScoreInfo4.appraisalBasisAppendix"
                          class="w-full"
                          :action="uploadUrl"
                          :limit="5"
                          :on-error="handleFileError"
                          :on-preview="handleFilePreview"
                          :on-success="res => handleFileSuccess(res, form['additionalIndexDetails'][index].children[key].children[i].selfAppraisalScoreInfo4.appraisalBasisAppendix)"
                          :before-upload="file=>fileFormatVerification(file, {types: fileTypes})"
                          :accept="fileTypes.map(i=>`.${i}`).join(',')"
                        >
                          <el-button type="primary" plain size="small">选择文件</el-button>
                          <template #tip>
                            <div class="el-upload__tip">
                              支持{{ fileDesc }}文件
                            </div>
                          </template>
                        </el-upload>
                      </el-form-item>
                    </el-col>
                  </template>
                </div>
              </el-collapse-item>
            </el-collapse>
          </el-collapse-item>
        </el-collapse>
        <no-data v-else />
      </el-collapse-item>
    </el-collapse>
  </el-form>
  <el-card v-else>
    <el-result
      icon="error"
      title="该项目匹配不到指标模板，请返回上一页或刷新重试"
    >
      <template #extra>
        <el-button @click="$router.go(-1)">返回列表</el-button>
        <el-button type="primary" @click="$router.go(0)">刷新</el-button>
      </template>
    </el-result>
  </el-card>
</template>
<style lang="less">
.scoreForm{
  font-size: 14px;
  .module-box{
    background: #f5f8fa;
    border-radius: 4px;
    padding: 16px 24px;
    margin-bottom: 16px;
  }
  .customCollapse{
    border: 0;
    .el-collapse-item__header{
      border: 0;
    }
    .el-collapse-item__wrap{
      border: 0;
    }
    .el-collapse-item__content{
      padding: 8px 24px 0;
    }
    .el-collapse-item{
      border-bottom: 1px solid rgba(0,0,0,0.1);
    }
  }
}
</style>

