<template>
  <PageWrapper>
    <a-spin :spinning="spinning">
      <a-row :gutter="24">
          <a-col :span="10">
              <a-card>
                  <div style="height: 75vh;overflow-y: auto;">
                    <a-input-search v-show="false"
                        v-model:value="searchVal"
                        placeholder="请输入"
                        enter-button
                        @search="onSearch"
                      />
                      评估要素
                      <BasicTree
                          ref="treeRef"
                          :style="{ minWidth: '20px' }"
                          selectable
                          defaultExpandAll="true"
                          @select="onSelect"
                          :treeData="treeData"
                          :selectedKeys="selectedDepIds"
                          :expandedKeys="expandedKeys"
                          :clickRowToExpand="true"
                      >
                      </BasicTree>
                  </div>
              </a-card>
          </a-col>
          <a-col :span="14">
              <a-card>
                  <div style="height: 75vh;overflow-y: auto;">
                 
                    <a-empty v-if="!showFlag">
                      <template #description>
                          <span>
                            请选择左侧具体的条目
                          </span>
                        </template>
                      </a-empty>
                      <a-empty v-if="hasOptFlag">
                        <template #description>
                            <span>
                              请选择评估要素
                            </span>
                        </template>
                      </a-empty>
                      <a-empty v-if="!hasOptFlag && rateOptions.length==0">
                        <template #description>
                        <!--
                            <span>
                              无评分选项数据，请检查评分规则
                            </span>
                            -->
                        </template>
                      </a-empty>
                      <div v-if="showFlag && !hasOptFlag && rateOptions.length >0">
                        <a-form
                          ref="formRef"
                          :model="formData"
                          @finish="onFinish"
                        >
                        <a-form-item name="rateName" style="margin-bottom: 0px;font-weight: bold;">
                          {{ formData.rateName }}
                        </a-form-item>
                          <a-form-item name="rateCheck">
                           <a-checkbox-group v-model:value="formData.rateCheck"  :disabled="isDetail">
                              <a-checkbox :style="radioStyle" style="margin-left:10px" v-for="(item,i) in rateOptions" :value="item.value" :disabled="isDetail" :key="i">
                               <p style="color: black"> {{ item.label }}</p>
                              </a-checkbox>
                          </a-checkbox-group>
                          </a-form-item>
                          <a-form-item style="margin-bottom: 0px;font-weight: bold;">
                            现状描述：
                          </a-form-item>
                          <a-form-item :wrapper-col="{span:23}">
                            <a-textarea style="color:black"
                                v-model:value="formData.des"
                                placeholder="请输入"
                                :auto-size="{ minRows: 2, maxRows: 5 }"
                                :disabled="isDetail"
                              />
                          </a-form-item>
                          <a-form-item style="margin-bottom: 0px;font-weight: bold;">
                            相关附件：
                          </a-form-item>
                          <a-form-item>
                          <div  v-if="rateKeyItemFileList.length==1">
                          <a-form-item>
                          <a-space :span="5" >
                            {{ rateKeyItemFileList[0].label }} <JUpload v-model:value="formData.fileUploadPath1" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                           </a-space>
                           </a-form-item>
                            </div>
                           <div  v-if="rateKeyItemFileList.length==2">
                          <a-form-item>
                          <a-space :span="5" >
                            {{ rateKeyItemFileList[0].label }} <JUpload v-model:value="formData.fileUploadPath1" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                           </a-space>
                           </a-form-item>
                           <a-form-item>
                           <a-space :span="5" >
                            {{ rateKeyItemFileList[1].label }} <JUpload v-model:value="formData.fileUploadPath2" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                           </a-space>
                           </a-form-item>
                            </div> 
                          <div  v-if="rateKeyItemFileList.length==3">
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[0].label }} <JUpload v-model:value="formData.fileUploadPath1" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[1].label }} <JUpload v-model:value="formData.fileUploadPath2" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                              </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[2].label }} <JUpload v-model:value="formData.fileUploadPath3" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                          </div>
                        <div  v-if="rateKeyItemFileList.length==4">
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[0].label }} <JUpload v-model:value="formData.fileUploadPath1" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[1].label }} <JUpload v-model:value="formData.fileUploadPath2" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                              </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[2].label }} <JUpload v-model:value="formData.fileUploadPath3" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[3].label }} <JUpload v-model:value="formData.fileUploadPath34" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                          </div>

                           <div  v-if="rateKeyItemFileList.length==5">
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[0].label }} <JUpload v-model:value="formData.fileUploadPath1" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[1].label }} <JUpload v-model:value="formData.fileUploadPath2" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                              </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[2].label }} <JUpload v-model:value="formData.fileUploadPath3" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[3].label }} <JUpload v-model:value="formData.fileUploadPath4" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[4].label }} <JUpload v-model:value="formData.fileUploadPath5" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                          </div>

                          <div  v-if="rateKeyItemFileList.length==6">
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[0].label }} <JUpload v-model:value="formData.fileUploadPath1" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[1].label }} <JUpload v-model:value="formData.fileUploadPath2" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                              </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[2].label }} <JUpload v-model:value="formData.fileUploadPath3" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[3].label }} <JUpload v-model:value="formData.fileUploadPath4" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[4].label }} <JUpload v-model:value="formData.fileUploadPath5" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[5].label }} <JUpload v-model:value="formData.fileUploadPath6" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                          </div>

                          <div  v-if="rateKeyItemFileList.length==7">
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[0].label }} <JUpload v-model:value="formData.fileUploadPath1" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[1].label }} <JUpload v-model:value="formData.fileUploadPath2" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                              </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[2].label }} <JUpload v-model:value="formData.fileUploadPath3" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[3].label }} <JUpload v-model:value="formData.fileUploadPath4" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[4].label }} <JUpload v-model:value="formData.fileUploadPath5" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[6].label }} <JUpload v-model:value="formData.fileUploadPath7" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                          </div>

                           <div  v-if="rateKeyItemFileList.length==8">
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[0].label }} <JUpload v-model:value="formData.fileUploadPath1" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[1].label }} <JUpload v-model:value="formData.fileUploadPath2" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                              </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[2].label }} <JUpload v-model:value="formData.fileUploadPath3" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[3].label }} <JUpload v-model:value="formData.fileUploadPath4" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[4].label }} <JUpload v-model:value="formData.fileUploadPath5" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[6].label }} <JUpload v-model:value="formData.fileUploadPath7" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>

                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[7].label }} <JUpload v-model:value="formData.fileUploadPath8" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>

                          </div>

                          <div  v-if="rateKeyItemFileList.length==9">
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[0].label }} <JUpload v-model:value="formData.fileUploadPath1" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[1].label }} <JUpload v-model:value="formData.fileUploadPath2" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                              </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[2].label }} <JUpload v-model:value="formData.fileUploadPath3" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[3].label }} <JUpload v-model:value="formData.fileUploadPath4" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[4].label }} <JUpload v-model:value="formData.fileUploadPath5" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[6].label }} <JUpload v-model:value="formData.fileUploadPath7" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>

                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[7].label }} <JUpload v-model:value="formData.fileUploadPath8" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[8].label }} <JUpload v-model:value="formData.fileUploadPath9" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>

                          </div>

                          <div  v-if="rateKeyItemFileList.length==10">
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[0].label }} <JUpload v-model:value="formData.fileUploadPath1" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[1].label }} <JUpload v-model:value="formData.fileUploadPath2" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                              </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[2].label }} <JUpload v-model:value="formData.fileUploadPath3" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[3].label }} <JUpload v-model:value="formData.fileUploadPath4" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[4].label }} <JUpload v-model:value="formData.fileUploadPath5" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[6].label }} <JUpload v-model:value="formData.fileUploadPath7" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>

                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[7].label }} <JUpload v-model:value="formData.fileUploadPath8" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>
                            <a-form-item>
                              <a-space :span="5" >
                              {{ rateKeyItemFileList[9].label }} <JUpload v-model:value="formData.fileUploadPath10" :disabled="isDetail" :buttonVisible="!isDetail" desText="支持扩展名: .rar .zip .doc .docx .pdf .jpg..." />
                              </a-space>
                            </a-form-item>

                          </div>




                          </a-form-item>

                          <a-form-item style="margin-bottom: 0px;font-weight: bold;">
                            {{ formData.jsKftitle }}
                          </a-form-item>
                          <a-form-item :wrapper-col="{span:23}">
                           <a-input v-model:value="formData.kf"  :disabled="isDetail"></a-input>
                          </a-form-item>

                          <a-form-item style="margin-bottom: 0px;font-weight: bold;">
                            评分理由：
                          </a-form-item>
                          <a-form-item :wrapper-col="{span:23}">
                            <a-textarea
                                v-model:value="formData.rateremark"
                                placeholder="请输入"
                                :disabled="isDetail"
                                :auto-size="{ minRows: 2, maxRows: 5 }"
                                
                              />
                          </a-form-item>

                          <a-form-item>
                            <a-space :span="5">
                            <a-button type="primary" v-if="treeNextIndex>0" @click="onUpperStep">上一步</a-button>
                            <a-button type="primary" v-if="treeNextIndex<(treeNextKeys.length-1)" @click="onNextStep">下一步</a-button>
                           <!-- <a-button type="primary"   @click="closeCurrent">关闭</a-button> -->
                          </a-space>
                          </a-form-item>
                        </a-form>
                      </div>
                  </div>
              </a-card>
          </a-col>
      </a-row>
      </a-spin>
  </PageWrapper>
</template>
<script setup>
import { message } from 'ant-design-vue';
import { onMounted, reactive, ref,toRaw,inject  } from 'vue';
import { getRateStdOptionList, saveaddRateRate,successRateRate ,getRaterateKeyItemTreeViewList,getRateKeyItemFileList} from './RateWri.api';
import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
import { PageWrapper } from '/@/components/Page';
import { BasicTree } from '/@/components/Tree/index';
import { useRoute } from 'vue-router';
import { useTabs } from '/@/hooks/web/useTabs';
const { closeCurrent, refreshPage, setTitle } = useTabs();
const route = useRoute();
//const store = tabStore();
const spinning = ref(true)
const searchVal = ref('')
const showFlag =ref(false)
const isDetail = ref(true)
const fistData = ref({})
const hasOptFlag = ref(false)
//const closeCurrent = inject('closeCurrent')
const radioStyle = reactive({
      display: 'flex',
      width:'100%',
      
      lineHeight: '30px',
    });
const formData = ref({
  id:'',
  rateId:'',
  rateName:'',
  rateCheck: '',
  des:'',
  kf:'',
  jsKf:'',
  rateremark:'',
  jsKftitle:'',
  kfmax:'',
  pfmodel:'',
  fileUploadPath1:'',
  fileUploadPath2:'',
  fileUploadPath3:'',
  fileUploadPath4:'',
  fileUploadPath5:'',
  fileUploadPath6:'',
  fileUploadPath7:'',
  fileUploadPath8:'',
  fileUploadPath9:'',
  fileUploadPath10:'',
  fileUploadPath:[]
})
const rateKeyItemFileList= ref([])
const rateOptions = ref([])
const treeData = ref([
]);
// 进行数据记录
const record = ref([])
const treeNextKeys = ref([])
const treeNextIndex = ref(0)
const selectedDepIds = ref([]);
const expandedKeys = ref([]);
let id = ref('');
// 设置treeIndex
function settingTreeeIndex(key){
  let size = treeNextKeys.value.length
  for(var i=0;i<size;i++){
    if(treeNextKeys.value[i]==key){
      treeNextIndex.value = i;
      break;
    }
  }
}
function onSelect(selectedKeys, info){
  if(selectedKeys.length==0){
    message.warning("请选择评估要素！")
    rateOptions.value = []
    hasOptFlag.value = true
    return
  }

  hasOptFlag.value = false
  if(info.selectedNodes[0].leaf){
    let tempkey=info.selectedNodes[0].key.replace('index', '');
    
    initRateOptions(tempkey)
    formData.value.rateId = info.selectedNodes[0].key
    formData.value.rateName = info.selectedNodes[0].des || info.selectedNodes[0].title_bak
    settingTreeeIndex(info.selectedNodes[0].key)

    //formData.value.rateCheck=record.value[treeNextIndex.value].rateCheck;
    formData.value = Object.assign(formData.value,record.value[treeNextIndex.value])
    
  }else{
    message.warning("请选择评估要素！")
    rateOptions.value = []
    hasOptFlag.value = true
  }
}
function initRateOptions(key){
  getRateStdOptionList({key:key}).then(rep=>{
    rateOptions.value = rep
  })

getRateKeyItemFileList({key:key}).then(rep=>{
    rateKeyItemFileList.value = rep
  })

}
function autoFirst(){
  initRateOptions(fistData.value.key)
  selectedDepIds.value = [fistData.value.key]
  formData.value = Object.assign(formData.value,record.value[0])
  showFlag.value = true

}
function handlerExpandedKeys(){
  var len = treeData.value.length
  if(len==0){
    return
  }
  var keys = []
  for(var i=0;i<len;i++){
    if(i==0){
      fistData.value = treeData.value[i].children[0].children[0]
    }
    //keys.push(treeData.value[i].key)
  }
  //expandedKeys.value = keys
}
onMounted(() => {
   id = toRaw(route.query).id
  formData.value.id = id
  getRaterateKeyItemTreeViewList({id:id}).then(rep=>{
    treeData.value = rep.treeList
    treeNextKeys.value = rep.keys
    record.value = rep.record
    expandedKeys.value = rep.expandedKeys
    
    if(!!treeData.value){
      handlerExpandedKeys()
      autoFirst()
    }
    spinning.value = false
  })


 

})
function onNextStep(){
  let index = treeNextIndex.value
  index ++
  // 索引相等标识到最后一项
  if(index >= treeNextKeys.value.length){
    return
  }
  if(!formData.value.id){
    message.error("项目关联信息丢失，请关闭后重新打开页面")
    return
  }



  
  


  formData.value = Object.assign(formData.value,record.value[index])
  treeNextIndex.value = index
  let key = treeNextKeys.value[index]
  selectedDepIds.value = [key]
  initRateOptions(key)




}
function onUpperStep(){
  let index = treeNextIndex.value
  index --
  if(index <0){
    return;
  }
  formData.value = Object.assign(formData.value,record.value[index])
  treeNextIndex.value = index
  let key = treeNextKeys.value[index]
  selectedDepIds.value = [key]
  initRateOptions(key)
}

</script>

<style scope>
.ant-checkbox-disabled + span {
  color: black !important;
}

.ant-input[disabled] {
  color: black !important;
}
</style>