<template>
  <div>
    <el-tabs v-model="curTab">
      <el-tab-pane label="配置风控" name="tab1">
        <el-form ref="formRef" :model="form" label-width="120px" label-suffix="：" class="form h-[calc(100vh-230px)] pr-1 overflow-auto" status-icon>
          <div class="step">
            <h6 class="step-name mb-7">办理账户</h6>
            <el-form-item label="提供材料" prop="accountMaterials">
              <div>
                <div class="radio-wrap flex-col items-start mb-1">
                  <el-radio-group v-model="form.provideMaterialSelectedStatus">
                    <el-radio v-for="(item, i) in whethers" :key="i" :label="item.id">{{ item.name }}</el-radio>
                  </el-radio-group>
                </div>
                <template v-if="form.provideMaterialSelectedStatus === 797">
                  <p class="tips">选择需要提供的申请人材料（至少选一样）</p>
                  <el-checkbox-group v-if="config.length" v-model="form.accountMaterials">
                    <el-checkbox v-for="(item, i) in config[0]?.recordChildren[0]?.recordChildren[1]?.subject?.itemList" :key="i" :label="item.itemId">{{
                      item.options
                    }}</el-checkbox>
                  </el-checkbox-group>
                </template>
              </div>
            </el-form-item>
            <el-form-item label="发放账户" prop="sendingAccount">
              <div>
                <div class="radio-wrap flex-col items-start">
                  <el-radio-group v-if="config.length" v-model="form.issueAccountSelectStatus">
                    <el-radio v-for="(item, i) in config[0]?.recordChildren[1]?.recordChildren[1]?.subject?.itemList" :key="i" :label="item.itemId">{{ item.options }}</el-radio>
                  </el-radio-group>
                </div>
                <template v-if="form.issueAccountSelectStatus === 801 && config.length">
                  <p class="tips">选择需要发放的账户（至少选一样）</p>

                  <el-checkbox-group v-model="form.sendingAccount">
                    <el-checkbox v-for="(item, i) in config[0]?.recordChildren[1]?.recordChildren[0]?.subject?.itemList" :key="i" :label="item.itemId">{{
                      item.options
                    }}</el-checkbox>
                  </el-checkbox-group>
                </template>
              </div>
            </el-form-item>
          </div>
          <div class="step">
            <h6 class="step-name mb-7">贷款申请</h6>
            <el-form-item label="申请方式" prop="loanApplicationMethod">
              <p class="mr-5 text-xs text-[#666]">选择申请方式（至少选一样）</p>
              <el-checkbox-group v-if="config.length" style="font-size: 14px" v-model="form.loanApplicationMethod">
                <el-checkbox v-for="(item, i) in config[1]?.recordChildren[0]?.subject?.itemList" :key="i" :label="item.itemId">{{ item.options }}</el-checkbox>
              </el-checkbox-group>
            </el-form-item>
            <el-form-item label="提供材料" prop="borrowerMaterial">
              <div class="flex-1">
                <div>
                  <p class="field-name mb-0">借款人材料</p>
                  <div class="radio-wrap flex-col items-start">
                    <el-radio-group v-model="form.borrowerMaterialSelectedStatus">
                      <el-radio v-for="(item, i) in whethers" :key="i" :label="item.id">{{ item.name }}</el-radio>
                    </el-radio-group>
                  </div>
                </div>
                <div v-if="form.borrowerMaterialSelectedStatus === 797">
                  <p class="my-2 text-xs text-[#666]">选择需要提供的借款人材料（至少选一样）</p>
                  <el-checkbox-group v-if="config.length" v-model="form.borrowerMaterial">
                    <el-checkbox v-for="(item, i) in config[1]?.recordChildren[1]?.recordChildren[0]?.subject?.itemList" :key="i" :label="item.itemId">{{
                      item.options
                    }}</el-checkbox>
                  </el-checkbox-group>
                </div>

                <!-- 企业 -->
                <template v-if="info.productType">
                  <p class="field-name mt-5">企业材料</p>
                  <div>
                    <div class="radio-wrap flex-col items-start mb-2">
                      <el-radio-group v-model="form.enterpriseMaterialSelectedStatus">
                        <el-radio v-for="(item, i) in whethers" :key="i" :label="item.id">{{ item.name }}</el-radio>
                      </el-radio-group>
                    </div>

                    <template v-if="form.enterpriseMaterialSelectedStatus === 797">
                      <p class="tips">选择需要提供的企业材料（至少选一样）</p>
                      <el-checkbox-group v-if="config.length" v-model="form.enterpriseMaterial">
                        <el-checkbox v-for="(item, i) in config[1]?.recordChildren[2]?.subject?.itemList" :key="i" :label="item.itemId">{{ item.options }}</el-checkbox>
                      </el-checkbox-group>
                    </template>
                  </div>
                  <p class="field-name mt-5">抵押物</p>
                  <div>
                    <div class="radio-wrap flex-col items-start mb-2">
                      <el-radio-group v-model="form.mortgagedPropertySelectedStatus">
                        <el-radio v-for="(item, i) in whethers" :key="i" :label="item.id">{{ item.name }}</el-radio>
                      </el-radio-group>
                    </div>
                    <template v-if="form.mortgagedPropertySelectedStatus === 797">
                      <p class="tips">选择需要提供的抵押物材料（至少选一样）</p>
                      <el-checkbox-group v-if="config.length" v-model="form.collateral">
                        <el-checkbox v-for="(item, i) in config[1]?.recordChildren[3]?.subject?.itemList" :key="i" :label="item.itemId">{{ item.options }}</el-checkbox>
                      </el-checkbox-group>
                    </template>
                  </div>
                </template>
                <!-- 个人 -->
                <template v-else>
                  <p class="field-name mt-5 mb-0">配偶材料</p>
                  <div>
                    <div class="radio-wrap flex-col items-start mb-1">
                      <el-radio-group v-model="form.mateMaterialSelectedStatus">
                        <el-radio v-for="(item, i) in whethers" :key="i" :label="item.id">{{ item.name }}</el-radio>
                      </el-radio-group>
                    </div>

                    <template v-if="form.mateMaterialSelectedStatus === 797">
                      <p class="tips">选择需要提供的配偶材料（至少选一样）</p>
                      <el-checkbox-group v-if="config.length" v-model="form.mateMaterial">
                        <el-checkbox v-for="(item, i) in config[1]?.recordChildren[2]?.subject?.itemList" :key="i" :label="item.itemId">{{ item.options }}</el-checkbox>
                      </el-checkbox-group>
                    </template>
                  </div>
                  <p class="field-name mt-5">经营类材料</p>
                  <div>
                    <div class="radio-wrap flex-col items-start mb-1">
                      <el-radio-group v-model="form.businessMaterialsSelectedStatus">
                        <el-radio v-for="(item, i) in whethers" :key="i" :label="item.id">{{ item.name }}</el-radio>
                      </el-radio-group>
                    </div>

                    <template v-if="form.businessMaterialsSelectedStatus === 797">
                      <p class="tips">选择需要提供的经营类材料（至少选一样）</p>
                      <el-checkbox-group v-if="config.length" v-model="form.businessMaterials">
                        <el-checkbox v-for="(item, i) in config[1]?.recordChildren[3]?.subject?.itemList" :key="i" :label="item.itemId">{{ item.options }}</el-checkbox>
                      </el-checkbox-group>
                    </template>
                  </div>
                </template>
                <p class="field-name mt-5">补充材料</p>
                <div>
                  <div class="radio-wrap flex-col items-start mb-1">
                    <el-radio-group v-model="form.supplementMaterialSelectedStatus">
                      <el-radio v-for="(item, i) in whethers" :key="i" :label="item.id">{{ item.name }}</el-radio>
                    </el-radio-group>
                  </div>

                  <template v-if="form.supplementMaterialSelectedStatus === 797">
                    <p class="tips">选择需要提供的补充材料（至少选一样）</p>
                    <el-checkbox-group v-if="config.length" v-model="form.supplementaryMaterials">
                      <el-checkbox v-for="(item, i) in config[1]?.recordChildren[4]?.subject?.itemList" :key="i" :label="item.itemId">{{ item.options }}</el-checkbox>
                    </el-checkbox-group>
                  </template>
                </div>
              </div>
            </el-form-item>
          </div>
          <div class="step">
            <h6 class="step-name mb-7">系统跑批准入风控策略</h6>
            <el-form-item label="跑批对象" prop="runBatchObject">
              <div>
                <div class="radio-wrap flex-col items-start mb-2">
                  <el-radio-group v-if="config.length" v-model="form.runBatchObjectSelectedStatus">
                    <el-radio v-for="(item, i) in whethers1" :key="i" :label="item.itemId">{{ item.options }}</el-radio>
                  </el-radio-group>
                </div>
                <template v-if="form.runBatchObjectSelectedStatus === 803">
                  <p class="tips">选择需要跑批的对象（至少选一样）</p>
                  <el-checkbox-group v-if="config.length" v-model="form.runBatchObject">
                    <el-checkbox v-for="(item, i) in config[2]?.recordChildren[0]?.recordChildren[0]?.subject?.itemList" :key="i" :label="item.itemId">{{
                      item.options
                    }}</el-checkbox>
                  </el-checkbox-group>
                </template>
              </div>
            </el-form-item>
            <el-form-item label="准入策略" label-width="130px">
              <div v-if="config.length && form.bankRiskControlAllocationTacticsList.length" class="flex-1">
                <div v-for="(item, i) in config[2]?.recordChildren[1]?.recordChildren" :key="i" class="flex items-center mb-3">
                  <div class="radio-wrap">
                    <span class="label min-w-[130px]">{{ item.name }}</span>
                    <el-radio-group v-model="form.bankRiskControlAllocationTacticsList[i].tacticsSelectedStatus" @change="getAccess(i)">
                      <el-radio v-for="(option, j) in whethers1" :key="j" :label="option.itemId">{{ option.options }}</el-radio>
                    </el-radio-group>
                  </div>

                  <template v-if="form.bankRiskControlAllocationTacticsList[i].tacticsSelectedStatus === 803 && item.blackList">
                    <el-select class="ml-5 mr-3" v-model="form.bankRiskControlAllocationTacticsList[i].tacticsId" placeholder="请选择" clearable>
                      <el-option v-for="(option, i) in item?.blackList" :key="i" :label="option.strategyName" :value="option.strategyId" />
                      <template #footer>
                        <el-button type="primary" size="small" @click="addStratety(i)"> 新增策略 </el-button>
                      </template>
                    </el-select>

                    <img v-if="form.bankRiskControlAllocationTacticsList[i].tacticsId" src="@/assets/svgs/preview.svg" alt="" class="cursor-pointer" @click="preview(item, i)" />
                  </template>
                </div>
              </div>
            </el-form-item>
            <el-form-item label="信用评分策略" label-width="130px" prop="personalCreditScoringStrategySelectedStatus">
              <div v-if="config.length" class="flex-1">
                <div v-for="(item, i) in config[2]?.recordChildren[2]?.recordChildren" :key="i" class="flex items-center mb-3">
                  <div class="radio-wrap">
                    <span class="label">{{ item.name }}</span>
                    <el-radio-group v-model="form.creditScoringStrategyList[i].tacticsSelectedStatus" @change="getCredits(i)">
                      <el-radio v-for="(option, j) in whethers1" :key="j" :label="option.itemId">{{ option.options }}</el-radio>
                    </el-radio-group>
                  </div>

                  <template v-if="form.creditScoringStrategyList[i].tacticsSelectedStatus === 803 && item.blackList">
                    <el-select class="ml-5 mr-3" v-model="form.creditScoringStrategyList[i].tacticsId" placeholder="请选择" clearable>
                      <el-option v-for="(option, j) in item?.blackList" :key="j" :label="option.scoreCardName" :value="option.id" />
                      <template #footer>
                        <el-button type="primary" size="small" @click="addStratety(i + 7)"> 新增策略 </el-button>
                      </template>
                    </el-select>

                    <img v-if="form.creditScoringStrategyList[i].tacticsId" src="@/assets/svgs/preview.svg" alt="" class="cursor-pointer" @click="previewCredits(item, i)" />
                  </template>
                </div>
              </div>
            </el-form-item>
            <el-form-item label="风险度策略">
              <div class="flex-1">
                <div class="flex items-center mb-3">
                  <div class="radio-wrap">
                    <span class="label">个人风险度策略</span>
                    <el-radio-group v-model="form.personalRiskDegreeStrategySelectedStatus">
                      <el-radio v-for="(item, i) in whethers1" :key="i" :label="item.itemId">{{ item.options }}</el-radio>
                    </el-radio-group>
                  </div>
                </div>
                <div class="flex items-center mb-3">
                  <div class="radio-wrap">
                    <span class="label">企业风险度策略</span>
                    <el-radio-group v-model="form.enterpriseRiskDegreeStrategySelectedStatus">
                      <el-radio v-for="(item, i) in whethers1" :key="i" :label="item.itemId">{{ item.options }}</el-radio>
                    </el-radio-group>
                  </div>
                </div>
              </div>
            </el-form-item>
            <el-form-item label="利率定价模型" label-width="130px">
              <div v-if="config.length" class="flex-1">
                <div v-for="(item, i) in config[2]?.recordChildren[4]?.recordChildren.slice(0, 2)" :key="i" class="radio-wrap mb-3">
                  <span class="label">{{ item.name }}</span>
                  <el-radio-group v-model="form.interestRatePricingModelList[i].tacticsSelectedStatus" @change="getRate(i)">
                    <el-radio v-for="(option, j) in whethers1" :key="j" :label="option.itemId">{{ option.options }}</el-radio>
                  </el-radio-group>

                  <template v-if="form.interestRatePricingModelList[i].tacticsSelectedStatus === 803 && item.blackList">
                    <el-select class="ml-5 mr-3" v-model="form.interestRatePricingModelList[i].tacticsId" placeholder="请选择" clearable>
                      <el-option v-for="(option, j) in item?.blackList" :key="j" :label="option.modelName" :value="option.id" />
                      <template #footer>
                        <el-button type="primary" size="small" @click="addStratety(i + 9)"> 新增策略 </el-button>
                      </template>
                    </el-select>

                    <img v-if="form.interestRatePricingModelList[i].tacticsId" src="@/assets/svgs/preview.svg" alt="" class="cursor-pointer" @click="previewRate(item, i)" />
                  </template>
                </div>

                <div class="radio-wrap items-start mb-3">
                  <span class="label">企业额度模型</span>
                  <el-radio-group v-model="form.enterpriseQuotaModelSelectedStatus">
                    <el-radio v-for="(option, j) in whethers1" :key="j" :label="option.itemId">{{ option.options }}</el-radio>
                  </el-radio-group>

                  <el-checkbox-group v-if="form.enterpriseQuotaModelSelectedStatus === 803" v-model="form.enterpriseQuotaModel" class="ml-5">
                    <el-checkbox
                      v-for="(item, i) in config[2]?.recordChildren[4]?.recordChildren[2]?.recordChildren[1]?.subject?.itemList"
                      :key="i"
                      :label="item.itemId"
                      class="flex"
                      >{{ item.options }}</el-checkbox
                    >
                  </el-checkbox-group>
                </div>

                <div class="radio-wrap mb-3">
                  <span class="label">企业利率模型</span>
                  <el-radio-group v-model="form.interestRatePricingModelList[2].tacticsSelectedStatus" @change="getRate(2)">
                    <el-radio v-for="(option, j) in whethers1" :key="j" :label="option.itemId">{{ option.options }}</el-radio>
                  </el-radio-group>

                  <template v-if="form.interestRatePricingModelList[2].tacticsSelectedStatus === 803 && form.interestRatePricingModelList[2].blackList">
                    <el-select class="ml-5 mr-3" v-model="form.interestRatePricingModelList[2].tacticsId" placeholder="请选择">
                      <el-option v-for="item in form.interestRatePricingModelList[2].blackList" :key="item.itemId" :label="item.modelName" :value="item.id" />
                      <template #footer>
                        <el-button type="primary" size="small" @click="addStratety(11)"> 新增策略 </el-button>
                      </template>
                    </el-select>

                    <img
                      v-if="form.interestRatePricingModelList[2].tacticsId"
                      src="@/assets/svgs/preview.svg"
                      alt=""
                      class="cursor-pointer"
                      @click="previewRate(form.interestRatePricingModelList[2], 2)"
                    />
                  </template>
                </div>
              </div>
            </el-form-item>
          </div>
          <div class="step">
            <h6 class="step-name mb-7">尽职调查</h6>
            <el-form-item label="尽调方式" prop="dueDiligenceMode">
              <div>
                <p class="tips leading-[32px]">选择尽调方式（至少选一样）</p>
                <el-checkbox-group v-if="config.length" v-model="form.dueDiligenceMode">
                  <el-checkbox v-for="(item, i) in config[3]?.recordChildren[0]?.subject?.itemList" :key="i" :label="item.itemId">{{ item.options }}</el-checkbox>
                </el-checkbox-group>
              </div>
            </el-form-item>
            <el-form-item label="尽调内容" prop="dueDiligenceContent">
              <div>
                <p class="tips leading-[32px]">选择尽调内容（至少选一样）</p>
                <el-checkbox-group v-if="config.length" v-model="form.dueDiligenceContent">
                  <el-checkbox v-for="(item, i) in config[3]?.recordChildren[1]?.subject?.itemList" :key="i" :label="item.itemId">{{ item.options }}</el-checkbox>
                </el-checkbox-group>
              </div>
            </el-form-item>
          </div>
          <div class="step">
            <h6 class="step-name mb-7">贷款审查</h6>
            <el-form-item label="审查内容" prop="reviewContent">
              <div>
                <p class="tips leading-[32px]">选择审查材料（至少选一样）</p>
                <el-checkbox-group v-if="config.length" v-model="form.reviewContent">
                  <el-checkbox v-for="(item, i) in config[4]?.recordChildren[0]?.subject?.itemList" :key="i" :label="item.itemId">{{ item.options }}</el-checkbox>
                </el-checkbox-group>
              </div>
            </el-form-item>
            <el-form-item label="审查签字" prop="reviewSignature">
              <div>
                <p class="tips leading-[32px]">选择签字表单（至少选一样）</p>
                <el-radio v-model="form.reviewSignature" :label="info.productType ? 262 : 115">《用信调查申报表》</el-radio>
              </div>
            </el-form-item>
          </div>
          <div class="step">
            <h6 class="step-name mb-7">贷款审批</h6>
            <el-form-item label="审批内容" prop="reviewApproveContent">
              <div>
                <p class="tips leading-[32px]">选择审批材料（至少选一样）</p>
                <el-checkbox-group v-if="config.length" v-model="form.reviewApproveContent">
                  <el-checkbox v-for="(item, i) in config[5]?.recordChildren[0]?.subject?.itemList" :key="i" :label="item.itemId">{{ item.options }}</el-checkbox>
                </el-checkbox-group>
              </div>
            </el-form-item>
            <el-form-item label="审批签字" prop="approvalSignature">
              <div>
                <p class="tips leading-[32px]">选择签字表单（至少选一样）</p>
                <el-radio v-model="form.approvalSignature" :label="info.productType ? 264 : 117">《用信调查申报表》</el-radio>
              </div>
            </el-form-item>
          </div>
          <div class="step">
            <h6 class="step-name mb-7">签订合同</h6>
            <el-form-item label="提供的材料" prop="contractMaterials">
              <div>
                <div class="radio-wrap mr-5">
                  <el-radio-group v-model="form.contractSupplyMaterialsSelectedStatus">
                    <el-radio v-for="(item, i) in whethers" :key="i" :label="item.id">{{ item.name }}</el-radio>
                  </el-radio-group>
                </div>
                <el-radio v-if="form.contractSupplyMaterialsSelectedStatus === 797" v-model="form.contractMaterials" :label="info.productType ? 265 : 118"
                  >抵押物所有权证明</el-radio
                >
              </div>
            </el-form-item>
            <el-form-item label="合同模板">
              <div class="flex-1">
                <div class="flex items-center mb-3">
                  <div class="radio-wrap">
                    <span class="label">借贷合同</span>
                    <el-radio-group v-model="form.loanContractSelectedStatus">
                      <el-radio v-for="(item, i) in whethers" :key="i" :label="item.id">{{ item.name }}</el-radio>
                    </el-radio-group>
                  </div>

                  <el-select v-if="form.loanContractSelectedStatus === 797 && config.length" class="ml-5" v-model="form.loanContract" placeholder="请选择">
                    <el-option
                      v-for="item in config[6]?.recordChildren[1]?.recordChildren[0]?.recordChildren[0]?.subject?.itemList"
                      :key="item.itemId"
                      :label="item.options"
                      :value="item.itemId"
                    />
                  </el-select>
                </div>
                <div class="flex items-center mb-3">
                  <div class="radio-wrap">
                    <span class="label">抵押合同</span>
                    <el-radio-group v-model="form.mortgageContractSelectedStatus">
                      <el-radio v-for="(item, i) in whethers" :key="i" :label="item.id">{{ item.name }}</el-radio>
                    </el-radio-group>
                  </div>

                  <el-select v-if="form.mortgageContractSelectedStatus === 797 && config.length" class="ml-5" v-model="form.mortgageContract" placeholder="请选择">
                    <el-option
                      v-for="item in config[6]?.recordChildren[1]?.recordChildren[1]?.recordChildren[0]?.subject?.itemList"
                      :key="item.itemId"
                      :label="item.options"
                      :value="item.itemId"
                    />
                  </el-select>
                </div>
                <div class="flex items-center mb-3">
                  <div class="radio-wrap">
                    <span class="label">质押合同</span>
                    <el-radio-group v-model="form.pledgeContractSelectedStatus">
                      <el-radio v-for="(item, i) in whethers" :key="i" :label="item.id">{{ item.name }}</el-radio>
                    </el-radio-group>
                  </div>
                  <el-select v-if="form.pledgeContractSelectedStatus === 797 && config.length" class="ml-5" v-model="form.pledgeContract" placeholder="请选择">
                    <el-option
                      v-for="item in config[6]?.recordChildren[1]?.recordChildren[2]?.recordChildren[0]?.subject?.itemList"
                      :key="item.itemId"
                      :label="item.options"
                      :value="item.itemId"
                    />
                  </el-select>
                </div>
                <div class="flex items-center">
                  <div class="radio-wrap">
                    <span class="label">担保合同</span>
                    <el-radio-group v-model="form.guaranteeContractSelectedStatus">
                      <el-radio v-for="(item, i) in whethers" :key="i" :label="item.id">{{ item.name }}</el-radio>
                    </el-radio-group>
                  </div>
                  <el-select v-if="form.guaranteeContractSelectedStatus === 797 && config.length" class="ml-5" v-model="form.guaranteeContract" placeholder="请选择">
                    <el-option
                      v-for="item in config[6]?.recordChildren[1]?.recordChildren[3]?.recordChildren[0]?.subject?.itemList"
                      :key="item.itemId"
                      :label="item.options"
                      :value="item.itemId"
                    />
                  </el-select>
                </div>
              </div>
            </el-form-item>
          </div>
          <div class="step">
            <h6 class="step-name mb-7">贷后管理</h6>
            <el-form-item label="选择策略">
              <div v-if="config.length" class="flex-1">
                <div v-for="(item, i) in config[7]?.recordChildren" :key="i" class="radio-wrap mb-3">
                  <span class="label min-w-[85px]">{{ item.name }}</span>
                  <el-radio-group v-model="form.postLoanSelectionStrategyList[i].tacticsSelectedStatus" @change="getAfter(i)">
                    <el-radio v-for="(option, j) in item?.recordChildren[0]?.subject?.itemList" :key="j" :label="option.itemId">{{ option.options }}</el-radio>
                  </el-radio-group>

                  <template v-if="form.postLoanSelectionStrategyList[i].tacticsSelectedStatus === 803 && item.blackList">
                    <el-select
                      v-if="form.postLoanSelectionStrategyList[i].tacticsSelectedStatus === 803"
                      class="ml-5 mr-3"
                      v-model="form.postLoanSelectionStrategyList[i].tacticsId"
                      placeholder="请选择"
                    >
                      <el-option v-for="(option, j) in item.blackList" :key="j" :label="option.strategyName" :value="option.strategyId" />
                      <template #footer>
                        <el-button type="primary" size="small" @click="addStratety(i + 12)"> 新增策略 </el-button>
                      </template>
                    </el-select>

                    <img v-if="form.postLoanSelectionStrategyList[i].tacticsId" src="@/assets/svgs/preview.svg" alt="" class="cursor-pointer" @click="previewAfter(item, i)" />
                  </template>
                </div>
              </div>
            </el-form-item>
          </div>
        </el-form>
        <div class="forms step-form">
          <div class="flex justify-end">
            <div class="submit" @click="submit(formRef)">完成，提交审批</div>
          </div>
        </div>
      </el-tab-pane>
      <el-tab-pane :label="info.approvalTime ? '产品详情' : '产品要素'" name="tab2">
        <div class="h-[calc(100vh-170px)] pr-1 overflow-auto">
          <info />
        </div>
      </el-tab-pane>
    </el-tabs>

    <el-drawer v-model="visible" :title="curPreviewTitle" size="100%" class="model-drawer">
      <component v-if="loadedComponents[activeComponent]" :is="loadedComponents[activeComponent]" v-model:row="curRow" disabled :key="curRow.strategyId" />
    </el-drawer>
  </div>
</template>

<script setup lang="ts">
import { ref, reactive, computed, watch, defineAsyncComponent, markRaw } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import type { FormInstance } from 'element-plus';
import { findById, riskSave, riskUpdate, riskControlDetailsAreDisplayed } from '@/api/bank';
import { getProcessInformationBasedOnRoles, addOperation } from '@/api/judgment';
import {
  accessStrategyGovernmentBlacklistList,
  accessStrategyCreditBlacklist,
  accessStrategyBusinessBlacklist,
  accessStrategyInlineBlacklist,
  accessStrategyEnterpriseBlacklist,
  accessStrategyAntiFraudStrategy,
  accessStrategyNegativeIndustryStrategy,
  listCredit,
  quotaModelList,
  interestRateModelList,
  fiveLevelClassification,
  postLoanInspection,
  postCreditScore,
  postLoanWarning,
  collectionAfterLoan,
} from '@/api/model';
import { useRouter, useRoute } from 'vue-router';
import { handleId, getIds } from '@/utils/common';
import Cookies from 'js-cookie';
import { getStat } from '@/store/useProduct';
import Info from './Info.vue';

const emit = defineEmits(['getList']);
interface RuleForm {
  provideMaterialSelectedStatus: number | string;
  accountMaterials?: number[];
  approvalSignature: number | string;
  borrowerMaterialSelectedStatus: number | string;
  borrowerMaterial?: number[];
  businessMaterialsSelectedStatus: number | string;
  businessMaterials?: number[];
  mortgagedPropertySelectedStatus: number | string;
  collateral?: number[];
  contractSupplyMaterialsSelectedStatus: number | string;
  contractMaterials: number | string;
  corporateInterestRateModel?: number[];
  dueDiligenceContent?: number[];
  dueDiligenceMode?: number[];
  enterpriseMaterialSelectedStatus: number | string;
  enterpriseMaterial?: number[];
  guaranteeContractSelectedStatus: number | string;
  guaranteeContract: number | string;
  loanApplicationMethod?: number[];
  loanContractSelectedStatus: number | string;
  loanContract: number | string;
  mateMaterialSelectedStatus: number | string;
  mateMaterial?: number[];
  materialsForLoanApproval?: number[];
  mortgageContractSelectedStatus: number | string;
  mortgageContract: number | string;
  pledgeContractSelectedStatus: number | string;
  pledgeContract: number | string;
  reviewApproveContent?: number[];
  reviewContent?: number[];
  reviewSignature: number | string;
  runBatchObjectSelectedStatus: number | string;
  runBatchObject?: number[];
  issueAccountSelectStatus: number | string;
  sendingAccount?: number[];
  supplementMaterialSelectedStatus: number | string;
  supplementaryMaterials?: number[];
  bankRiskControlAllocationTacticsList: Record<string, any>[];
  creditScoringStrategyList: Record<string, any>[];
  interestRatePricingModelList: Record<string, any>[];
  postLoanSelectionStrategyList: Record<string, any>[];
  enterpriseRiskDegreeStrategySelectedStatus: number | string;
  personalRiskDegreeStrategySelectedStatus: number | string;
  enterpriseQuotaModelSelectedStatus: number | string;
  enterpriseQuotaModel?: number[];
}
const router = useRouter();
const route = useRoute();
const id = computed(() => +route.query.id);
const curTab = ref<string>(route.query.show ? 'tab2' : 'tab1');
const config = ref<any[]>([]);
const info = ref<Record<string, any>>({});
const whethers = ref<Record<string, any>>([
  {
    id: 797,
    name: '需要提供',
  },
  {
    id: 798,
    name: '无需提供',
  },
]);
const whethers1 = ref<Record<string, any>>([
  {
    itemId: 803,
    options: '需要跑批',
  },
  {
    itemId: 804,
    options: '无需跑批',
  },
]);
const formRef = ref<FormInstance>();
const curRow = ref<Record<string, any>>();
const strategyParams = { pageNum: 1, pageSize: 100, keyWord: '', ...getIds() };
const visible = ref<boolean>(false);
let form = reactive<RuleForm>({
  ...getIds(),
  provideMaterialSelectedStatus: '',
  accountMaterials: [],
  approvalSignature: '',
  borrowerMaterialSelectedStatus: '',
  borrowerMaterial: [],
  businessMaterialsSelectedStatus: '',
  businessMaterials: [],
  mortgagedPropertySelectedStatus: '',
  collateral: [],
  contractSupplyMaterialsSelectedStatus: '',
  contractMaterials: '',
  corporateInterestRateModel: [],
  dueDiligenceContent: [],
  dueDiligenceMode: [],
  enterpriseMaterialSelectedStatus: '',
  enterpriseMaterial: [],
  guaranteeContractSelectedStatus: '',
  guaranteeContract: '',
  loanApplicationMethod: [],
  loanContractSelectedStatus: '',
  loanContract: '',
  mateMaterialSelectedStatus: '',
  mateMaterial: [],
  materialsForLoanApproval: [],
  mortgageContractSelectedStatus: '',
  mortgageContract: '',
  pledgeContractSelectedStatus: '',
  pledgeContract: '',
  reviewApproveContent: [],
  reviewContent: [],
  reviewSignature: '',
  runBatchObjectSelectedStatus: '',
  runBatchObject: [],
  issueAccountSelectStatus: '',
  sendingAccount: [],
  supplementMaterialSelectedStatus: '',
  supplementaryMaterials: [],
  bankRiskControlAllocationTacticsList: [],
  creditScoringStrategyList: [],
  interestRatePricingModelList: [],
  postLoanSelectionStrategyList: [],
  enterpriseRiskDegreeStrategySelectedStatus: '',
  personalRiskDegreeStrategySelectedStatus: '',
  enterpriseQuotaModelSelectedStatus: '',
  enterpriseQuotaModel: [],
});

const curPreviewTitle = ref<string>();
const assessNames = ['政务黑名单', '征信黑名单', '商采黑名单', '行内黑名单', '企业黑名单', '反欺诈策略', '负面行业黑名单策略'];
const interestNames = ['个人利率模型', '个人额度模型', '企业利率模型'];
const afterNames = ['五级分类策略', '贷后检查策略', '贷后评分卡', '贷后预警策略', '贷后催收策略'];
const asyncComponents = {
  150: defineAsyncComponent(() => import('../strategy/150/Detail.vue')),
  151: defineAsyncComponent(() => import('../strategy/151/Detail.vue')),
  152: defineAsyncComponent(() => import('../strategy/152/Detail.vue')),
  153: defineAsyncComponent(() => import('../strategy/153/Detail.vue')),
  154: defineAsyncComponent(() => import('../strategy/154/Detail.vue')),
  155: defineAsyncComponent(() => import('../strategy/155/Detail.vue')),
  156: defineAsyncComponent(() => import('../strategy/156/Detail.vue')),
  512: defineAsyncComponent(() => import('../strategy/512/Detail.vue')),
  513: defineAsyncComponent(() => import('../strategy/513/Detail.vue')),
  935: defineAsyncComponent(() => import('../interestRate/935/Detail.vue')),
  772: defineAsyncComponent(() => import('../interestRate/772/Detail.vue')),
  936: defineAsyncComponent(() => import('../interestRate/936/Detail.vue')),
  1029: defineAsyncComponent(() => import('../afterLoan/1029/Detail.vue')),
  1030: defineAsyncComponent(() => import('../afterLoan/1030/Detail.vue')),
  1031: defineAsyncComponent(() => import('../afterLoan/1031/Detail.vue')),
  1032: defineAsyncComponent(() => import('../afterLoan/1032/Detail.vue')),
  1033: defineAsyncComponent(() => import('../afterLoan/1033/Detail.vue')),
};
const loadedComponents = markRaw({});
const activeComponent = ref<string>('');

// 加载组件的方法
const loadComponent = async (componentName: string) => {
  if (!loadedComponents[componentName]) {
    try {
      loadedComponents[componentName] = asyncComponents[componentName];
      activeComponent.value = componentName;
    } catch (error) {
      console.error(`Failed to load component ${componentName}`, error);
    }
  } else {
    activeComponent.value = componentName;
  }
};

// 准入策略
const getAccess = async (i: number) => {
  const list = config.value[2].recordChildren[1].recordChildren;
  if (!list[i].blackList) {
    try {
      let res;
      if (!i) res = await accessStrategyGovernmentBlacklistList(strategyParams); // 政务
      if (i === 1) res = await accessStrategyCreditBlacklist(strategyParams); // 征信
      if (i === 2) res = await accessStrategyBusinessBlacklist(strategyParams); // 商采
      if (i === 3) res = await accessStrategyInlineBlacklist(strategyParams); // 行内
      if (i === 4) res = await accessStrategyEnterpriseBlacklist(strategyParams); // 企业
      if (i === 5) res = await accessStrategyAntiFraudStrategy(strategyParams); // 反欺诈
      if (i === 6) res = await accessStrategyNegativeIndustryStrategy(strategyParams); // 负面行业
      if (res) list[i].blackList = res.page.records;
    } catch (e) {}
  }
};
// 信用评分策略
const getCredits = async (i: number) => {
  const list = config.value[2]?.recordChildren[2]?.recordChildren;
  if (!list[i].blackList) {
    try {
      const res = await listCredit({
        ...strategyParams,
        type: i,
      });
      if (res) list[i].blackList = res.data.records;
    } catch (e) {}
  }
};
// 利率定价模型
const getRate = async (i: number) => {
  const list = config.value[2].recordChildren[4].recordChildren;
  if (!list[i].blackList) {
    try {
      let res;
      if (!i) {
        res = await interestRateModelList({
          ...strategyParams,
          type: 1,
        }); // 个人利率模型
      } else if (i === 1) {
        res = await quotaModelList({
          ...strategyParams,
          type: 1,
        }); // 个人额度模型
      } else if (i === 2) {
        res = await interestRateModelList({
          ...strategyParams,
          type: 2,
        }); // 企业利率模型
        form.interestRatePricingModelList[2].blackList = res.page.records;
      }
      if (res && i !== 2) list[i].blackList = res.page.records;
    } finally {
    }
  }
};
// 贷后管理
const getAfter = async (i: number) => {
  const list = config.value[7]?.recordChildren;
  if (!list[i].blackList) {
    try {
      let res;
      if (!i) res = await fiveLevelClassification(strategyParams); // 五级分类策略
      if (i === 1) res = await postLoanInspection(strategyParams); // 贷后检查策略
      if (i === 2) res = await postCreditScore(strategyParams); // 贷后评分卡
      if (i === 3) res = await postLoanWarning(strategyParams); // 贷后预警策略
      if (i === 4) res = await collectionAfterLoan(strategyParams); // 贷后催收策略
      if (res) list[i].blackList = res.page.records;
    } finally {
    }
  }
};
// 配置项
const getConfig = async () => {
  const { process } = await getProcessInformationBasedOnRoles(info.value.productType ? 71 : 70); // 个人70，企业71
  config.value = process;

  // 准入策略
  if (!form.bankRiskControlAllocationTacticsList.length) {
    process[2].recordChildren[1].recordChildren.map((e) => {
      form.bankRiskControlAllocationTacticsList.push({
        type: 1,
        bankId: id.value,
        id: '',
        tacticsId: '',
        tacticsPointId: e.id,
        tacticsSelectedStatus: '',
      });
    });
  } else {
    // 查询对应策略列表
    form.bankRiskControlAllocationTacticsList.map((e, i) => {
      if (!e.tacticsId) e.tacticsId = '';
      e.tacticsSelectedStatus === 803 && getAccess(i);
    });
  }

  // 信用评分策略
  if (!form.creditScoringStrategyList.length) {
    process[2].recordChildren[2].recordChildren.map((e) => {
      form.creditScoringStrategyList.push({
        type: 2,
        bankId: id.value,
        id: '',
        tacticsId: '',
        tacticsPointId: e.id,
        tacticsSelectedStatus: '',
      });
    });
  } else {
    // 查询对应策略列表
    form.creditScoringStrategyList.map((e, i) => {
      if (!e.tacticsId) e.tacticsId = '';
      e.tacticsSelectedStatus === 803 && getCredits(i);
    });
  }

  // 利率定价模型
  if (!form.interestRatePricingModelList.length) {
    process[2].recordChildren[4].recordChildren.map((e, i) => {
      i !== 2 &&
        form.interestRatePricingModelList.push({
          type: 3,
          bankId: id.value,
          id: '',
          tacticsId: '',
          tacticsPointId: e.id,
          tacticsSelectedStatus: '',
        });
    });
  } else {
    // 查询对应策略列表
    form.interestRatePricingModelList.map((e, i) => {
      if (!e.tacticsId) e.tacticsId = '';
      e.tacticsSelectedStatus === 803 && getRate(i);
    });
  }

  // 贷后选择
  if (!form.postLoanSelectionStrategyList.length) {
    process[7].recordChildren.map((e) => {
      form.postLoanSelectionStrategyList.push({
        type: 4,
        bankId: id.value,
        id: '',
        tacticsId: '',
        tacticsPointId: e.id,
        tacticsSelectedStatus: '',
      });
    });
  } else {
    // 查询对应策略列表
    form.postLoanSelectionStrategyList.map((e, i) => {
      if (!e.tacticsId) e.tacticsId = '';
      e.tacticsSelectedStatus === 803 && getAfter(i);
    });
  }
};
// 详情
const getDetail = async () => {
  if (id.value) {
    try {
      // 查询产品要素详情
      const { data } = await findById(id.value);
      info.value = data;

      // 只返回id的详情
      const res = await riskControlDetailsAreDisplayed(id.value);
      const e = res.data;
      if (e) {
        if (e.personalRiskDegreeStrategySelectedStatus) e.personalRiskDegreeStrategySelectedStatus = +e.personalRiskDegreeStrategySelectedStatus;
        if (e.enterpriseRiskDegreeStrategySelectedStatus) e.enterpriseRiskDegreeStrategySelectedStatus = +e.enterpriseRiskDegreeStrategySelectedStatus;
        if (e.enterpriseQuotaModelSelectedStatus) e.enterpriseQuotaModelSelectedStatus = +e.enterpriseQuotaModelSelectedStatus;
        e.enterpriseQuotaModel = e?.enterpriseQuotaModel?.split(',').map((e) => +e);
        e.reviewSignature = e?.reviewSignature?.length ? e.reviewSignature[0] : '';
        e.approvalSignature = e?.approvalSignature?.length ? e.approvalSignature[0] : '';

        e.loanContract = e?.loanContract?.length ? e.loanContract[0] : '';
        e.mortgageContract = e?.mortgageContract?.length ? e.mortgageContract[0] : '';
        e.pledgeContract = e?.pledgeContract?.length ? e.pledgeContract[0] : '';
        e.guaranteeContract = e?.guaranteeContract?.length ? e.guaranteeContract[0] : '';
        e.contractMaterials = e.contractMaterials ? +e.contractMaterials : '';
        form = Object.assign(form, e);
      }
      getConfig();
    } catch (e) {}
  }
};
watch(
  () => route.query,
  () => {
    route.params.action === 'config' && getDetail();
  },
  {
    immediate: true,
  },
);

// 新增判分记录
const addRecord = async (data: Record<string, any>) => {
  getStat(295);
  const isEnterprise = info.value.productType === 1;
  const preIds = `1,${Cookies.get('sand-level')},42,66,${isEnterprise ? 71 : 70}`; // 1，关卡id，角色（这个页面是风控经理配置风控），个人/企业（70/71）
  const lcRule: Array<Record<string, any>> = [];

  // 企业
  if (isEnterprise) {
    data.provideMaterialSelectedStatus && lcRule.push(handleId(1246, 325, data.provideMaterialSelectedStatus, `${preIds},112,120,1246`, 1));
    data.accountMaterials && lcRule.push(handleId(1254, 44, data.accountMaterials, `${preIds},112,120,1254`, 1));
    data.issueAccountSelectStatus && lcRule.push(handleId(1257, 326, data.issueAccountSelectStatus, `${preIds},112,121,1257`, 1));
    data.sendingAccount && lcRule.push(handleId(1255, 45, data.sendingAccount, `${preIds},112,121,1255`, 1));
    data.loanApplicationMethod && lcRule.push(handleId(122, 46, data.loanApplicationMethod, `${preIds},113,122`, 1));

    data.enterpriseMaterialSelectedStatus && lcRule.push(handleId(1294, 325, data.enterpriseMaterialSelectedStatus, `${preIds},113,124,1294`, 1));
    data.enterpriseMaterial && lcRule.push(handleId(1258, 48, data.enterpriseMaterial, `${preIds},113,124,1258`, 1));

    form.borrowerMaterialSelectedStatus && lcRule.push(handleId(1294, 325, form.borrowerMaterialSelectedStatus, `${preIds},113,123,1294`, 1));

    data.borrowerMaterial && lcRule.push(handleId(316, 47, data.borrowerMaterial, `${preIds},113,123,316`, 1));

    data.mortgagedPropertySelectedStatus && lcRule.push(handleId(1294, 325, data.mortgagedPropertySelectedStatus, `${preIds},113,125,1294`, 1));
    data.collateral && lcRule.push(handleId(1259, 49, data.collateral, `${preIds},113,125,1259`, 1));

    data.supplementMaterialSelectedStatus && lcRule.push(handleId(1294, 325, data.supplementMaterialSelectedStatus, `${preIds},113,126,1294`, 1));
    data.supplementaryMaterials && lcRule.push(handleId(1260, 50, data.supplementaryMaterials, `${preIds},113,126,1260`, 1));

    data.runBatchObjectSelectedStatus && lcRule.push(handleId(1302, 327, data.runBatchObjectSelectedStatus, `${preIds},114,127,1302`, 1));
    data.runBatchObject && lcRule.push(handleId(1261, 51, data.runBatchObject, `${preIds},114,127,1261`, 1));

    // 准入策略
    const list1 = data.bankRiskControlAllocationTacticsList;
    if (list1.length) {
      const list = config.value[2].recordChildren[1].recordChildren;
      list1[0].tacticsSelectedStatus && lcRule.push(handleId(1376, 327, list1[0].tacticsSelectedStatus, `${preIds},114,128,1369,1376`, 1));
      list1[0].tacticsId &&
        lcRule.push(handleId(1377, 331, list[0].blackList.find((e) => e.strategyId === list1[0].tacticsId)?.strategyName || '', `${preIds},114,128,1369,1377`, 3));

      list1[1].tacticsSelectedStatus && lcRule.push(handleId(1378, 327, list1[1].tacticsSelectedStatus, `${preIds},114,128,1370,1378`, 1));
      list1[1].tacticsId &&
        lcRule.push(handleId(1379, 332, list[1].blackList.find((e) => e.strategyId === list1[1].tacticsId)?.strategyName || '', `${preIds},114,128,1370,1379`, 3));

      list1[2].tacticsSelectedStatus && lcRule.push(handleId(1380, 327, list1[2].tacticsSelectedStatus, `${preIds},114,128,1371,1380`, 1));
      list1[2].tacticsId &&
        lcRule.push(handleId(1381, 333, list[2].blackList.find((e) => e.strategyId === list1[2].tacticsId)?.strategyName || '', `${preIds},114,128,1371,1381`, 3));

      list1[3].tacticsSelectedStatus && lcRule.push(handleId(1382, 327, list1[3].tacticsSelectedStatus, `${preIds},114,128,1372,1382`, 1));
      list1[3].tacticsId &&
        lcRule.push(handleId(1383, 334, list[3].blackList.find((e) => e.strategyId === list1[3].tacticsId)?.strategyName || '', `${preIds},114,128,1372,1383`, 3));

      list1[4].tacticsSelectedStatus && lcRule.push(handleId(1384, 327, list1[4].tacticsSelectedStatus, `${preIds},114,128,1373,1384`, 1));
      list1[4].tacticsId &&
        lcRule.push(handleId(1385, 335, list[4].blackList.find((e) => e.strategyId === list1[4].tacticsId)?.strategyName || '', `${preIds},114,128,1373,1385`, 3));

      list1[5].tacticsSelectedStatus && lcRule.push(handleId(1386, 327, list1[5].tacticsSelectedStatus, `${preIds},114,128,1374,1386`, 1));
      list1[5].tacticsId &&
        lcRule.push(handleId(1387, 336, list[5].blackList.find((e) => e.strategyId === list1[5].tacticsId)?.strategyName || '', `${preIds},114,128,1374,1387`, 3));

      list1[6].tacticsSelectedStatus && lcRule.push(handleId(1388, 327, list1[6].tacticsSelectedStatus, `${preIds},114,128,1375,1388`, 1));
      list1[6].tacticsId &&
        lcRule.push(handleId(1389, 337, list[6].blackList.find((e) => e.strategyId === list1[6].tacticsId)?.strategyName || '', `${preIds},114,128,1375,1389`, 3));
    }

    // 信用评分策略
    const list2 = data.creditScoringStrategyList;
    if (list2.length) {
      const list = config.value[2]?.recordChildren[2]?.recordChildren;
      list2[0].tacticsSelectedStatus && lcRule.push(handleId(1307, 327, list2[0].tacticsSelectedStatus, `${preIds},114,129,1046,1307`, 1));
      list2[0].tacticsId && lcRule.push(handleId(1390, 339, list[0].blackList.find((e) => e.id === list2[0].tacticsId)?.scoreCardName || '', `${preIds},114,129,1046,1390`, 3));

      list2[1].tacticsSelectedStatus && lcRule.push(handleId(1391, 327, list2[1].tacticsSelectedStatus, `${preIds},114,129,1047,1391`, 1));
      list2[1].tacticsId && lcRule.push(handleId(1392, 339, list[1].blackList.find((e) => e.id === list2[1].tacticsId)?.scoreCardName || '', `${preIds},114,129,1047,1392`, 3));
    }

    // 风险度策略
    data.personalRiskDegreeStrategySelectedStatus && lcRule.push(handleId(1301, 327, data.personalRiskDegreeStrategySelectedStatus, `${preIds},114,130,1301`, 1));
    data.enterpriseRiskDegreeStrategySelectedStatus && lcRule.push(handleId(1393, 327, data.enterpriseRiskDegreeStrategySelectedStatus, `${preIds},114,130,1393`, 1));

    // 利率定价模型
    const list3 = data.interestRatePricingModelList;
    if (list3.length) {
      const list = config.value[2].recordChildren[4].recordChildren;
      list3[0].tacticsSelectedStatus && lcRule.push(handleId(1398, 327, list3[0].tacticsSelectedStatus, `${preIds},114,131,1394,1398`, 1));
      list3[0].tacticsId && lcRule.push(handleId(1399, 339, list[0].blackList.find((e) => e.id === list3[0].tacticsId)?.modelName || '', `${preIds},114,131,1394,1399`, 3));

      list3[1].tacticsSelectedStatus && lcRule.push(handleId(1400, 327, list3[1].tacticsSelectedStatus, `${preIds},114,131,1395,1400`, 1));
      list3[1].tacticsId && lcRule.push(handleId(1401, 339, list[1].blackList.find((e) => e.id === list3[1].tacticsId)?.modelName || '', `${preIds},114,131,1395,1401`, 3));

      data.enterpriseQuotaModelSelectedStatus && lcRule.push(handleId(1402, 327, data.enterpriseQuotaModelSelectedStatus, `${preIds},114,131,1396,1402`, 1));
      data.enterpriseQuotaModel && lcRule.push(handleId(1403, 338, data.enterpriseQuotaModel, `${preIds},114,131,1396,1403`, 1));

      list3[2].tacticsSelectedStatus && lcRule.push(handleId(1404, 327, list3[2].tacticsSelectedStatus, `${preIds},114,131,1397,1404`, 1));
      list3[2].tacticsId && lcRule.push(handleId(1405, 339, list3[2].blackList.find((e) => e.id === list3[2].tacticsId)?.modelName || '', `${preIds},114,131,1397,1405`, 3));
    }

    data.dueDiligenceMode && lcRule.push(handleId(132, 56, data.dueDiligenceMode, `${preIds},115,132`, 1));
    data.dueDiligenceContent && lcRule.push(handleId(133, 57, data.dueDiligenceContent, `${preIds},115,133`, 1));
    data.reviewContent && lcRule.push(handleId(134, 58, data.reviewContent, `${preIds},116,134`, 1));
    data.reviewSignature && lcRule.push(handleId(135, 59, data.reviewSignature, `${preIds},116,135`, 1));
    data.reviewApproveContent && lcRule.push(handleId(136, 60, data.reviewApproveContent, `${preIds},117,136`, 1));
    data.approvalSignature && lcRule.push(handleId(137, 61, data.approvalSignature, `${preIds},117,137`, 1));

    data.contractSupplyMaterialsSelectedStatus && lcRule.push(handleId(1264, 325, data.contractSupplyMaterialsSelectedStatus, `${preIds},118,138,1264`, 1));
    data.contractMaterials && lcRule.push(handleId(1263, 62, data.contractMaterials, `${preIds},118,138,1263`, 1));

    data.loanContractSelectedStatus && lcRule.push(handleId(1273, 325, data.loanContractSelectedStatus, `${preIds},118,139,306,1273`, 1));
    data.loanContract && lcRule.push(handleId(1269, 63, data.loanContract, `${preIds},118,139,306,1269`, 1));

    data.mortgageContractSelectedStatus && lcRule.push(handleId(1273, 325, data.mortgageContractSelectedStatus, `${preIds},118,139,307,1273`, 1));
    data.mortgageContract && lcRule.push(handleId(1270, 142, data.mortgageContract, `${preIds},118,139,307,1270`, 1));

    data.pledgeContractSelectedStatus && lcRule.push(handleId(1273, 325, data.pledgeContractSelectedStatus, `${preIds},118,139,308,1273`, 1));
    data.pledgeContract && lcRule.push(handleId(1271, 143, data.pledgeContract, `${preIds},118,139,308,1271`, 1));

    data.guaranteeContractSelectedStatus && lcRule.push(handleId(1273, 325, data.guaranteeContractSelectedStatus, `${preIds},118,139,309,1273`, 1));
    data.guaranteeContract && lcRule.push(handleId(1272, 144, data.guaranteeContract, `${preIds},118,139,309,1272`, 1));

    // 贷后管理
    const list4 = data.postLoanSelectionStrategyList;
    if (list4.length) {
      const list = config.value[7]?.recordChildren;
      list4[0].tacticsSelectedStatus && lcRule.push(handleId(1411, 327, list4[0].tacticsSelectedStatus, `${preIds},119,1406,1411`, 1));
      list4[0].tacticsId && lcRule.push(handleId(1412, 339, list[0].blackList.find((e) => e.strategyId === list4[0].tacticsId)?.strategyName || '', `${preIds},119,1406,1412`, 3));

      list4[1].tacticsSelectedStatus && lcRule.push(handleId(1413, 327, list4[1].tacticsSelectedStatus, `${preIds},119,1407,1413`, 1));
      list4[1].tacticsId && lcRule.push(handleId(1414, 339, list[1].blackList.find((e) => e.strategyId === list4[1].tacticsId)?.strategyName || '', `${preIds},119,1407,1414`, 3));

      list4[2].tacticsSelectedStatus && lcRule.push(handleId(1415, 327, list4[2].tacticsSelectedStatus, `${preIds},119,1408,1415`, 1));
      list4[2].tacticsId && lcRule.push(handleId(1416, 339, list[2].blackList.find((e) => e.strategyId === list4[2].tacticsId)?.strategyName || '', `${preIds},119,1408,1416`, 3));

      list4[3].tacticsSelectedStatus && lcRule.push(handleId(1417, 327, list4[3].tacticsSelectedStatus, `${preIds},119,1409,1417`, 1));
      list4[3].tacticsId && lcRule.push(handleId(1418, 339, list[3].blackList.find((e) => e.strategyId === list4[3].tacticsId)?.strategyName || '', `${preIds},119,1409,1418`, 3));

      list4[4].tacticsSelectedStatus && lcRule.push(handleId(1419, 327, list4[4].tacticsSelectedStatus, `${preIds},119,1410,1419`, 1));
      list4[4].tacticsId && lcRule.push(handleId(1420, 339, list[4].blackList.find((e) => e.strategyId === list4[4].tacticsId)?.strategyName || '', `${preIds},119,1410,1420`, 3));
    }
  } else {
    data.provideMaterialSelectedStatus && lcRule.push(handleId(1294, 325, data.provideMaterialSelectedStatus, `${preIds},72,75,1294`, 1));
    data.accountMaterials && lcRule.push(handleId(1295, 20, data.accountMaterials, `${preIds},72,75,1295`, 1));

    data.issueAccountSelectStatus && lcRule.push(handleId(1312, 326, data.issueAccountSelectStatus, `${preIds},72,76,1312`, 1));
    data.sendingAccount && lcRule.push(handleId(1296, 21, data.sendingAccount, `${preIds},72,76,1296`, 1));
    data.loanApplicationMethod && lcRule.push(handleId(1289, 22, data.loanApplicationMethod, `${preIds},73,77,1289`, 1));

    form.borrowerMaterialSelectedStatus && lcRule.push(handleId(1294, 325, form.borrowerMaterialSelectedStatus, `${preIds},73,78,1294`, 1));

    data.borrowerMaterial && lcRule.push(handleId(314, 23, data.borrowerMaterial, `${preIds},73,78,314`, 1));

    data.mateMaterialSelectedStatus && lcRule.push(handleId(1294, 325, data.mateMaterialSelectedStatus, `${preIds},73,79,1294`, 1));
    data.mateMaterial && lcRule.push(handleId(1291, 24, data.mateMaterial, `${preIds},73,79,1291`, 1));

    data.businessMaterialsSelectedStatus && lcRule.push(handleId(1294, 325, data.businessMaterialsSelectedStatus, `${preIds},73,80,1294`, 1));
    data.businessMaterials && lcRule.push(handleId(1292, 25, data.businessMaterials, `${preIds},73,80,1292`, 1));

    data.supplementMaterialSelectedStatus && lcRule.push(handleId(1294, 325, data.supplementMaterialSelectedStatus, `${preIds},73,81,1294`, 1));
    data.supplementaryMaterials && lcRule.push(handleId(1293, 26, data.supplementaryMaterials, `${preIds},73,81,1293`, 1));

    data.runBatchObjectSelectedStatus && lcRule.push(handleId(1302, 327, data.runBatchObjectSelectedStatus, `${preIds},74,82,1302`, 1));
    data.runBatchObject && lcRule.push(handleId(1297, 27, data.runBatchObject, `${preIds},74,82,1297`, 1));

    // 准入策略
    const list1 = data.bankRiskControlAllocationTacticsList;
    if (list1.length) {
      const list = config.value[2].recordChildren[1].recordChildren;
      list1[0].tacticsSelectedStatus && lcRule.push(handleId(1325, 327, list1[0].tacticsSelectedStatus, `${preIds},74,83,1318,1325`, 1));
      list1[0].tacticsId &&
        lcRule.push(handleId(1326, 331, list[0].blackList.find((e) => e.strategyId === list1[0].tacticsId)?.strategyName || '', `${preIds},74,83,1318,1326`, 3));

      list1[1].tacticsSelectedStatus && lcRule.push(handleId(1327, 327, list1[1].tacticsSelectedStatus, `${preIds},74,83,1319,1327`, 1));
      list1[1].tacticsId &&
        lcRule.push(handleId(1328, 332, list[1].blackList.find((e) => e.strategyId === list1[1].tacticsId)?.strategyName || '', `${preIds},74,83,1319,1328`, 3));

      list1[2].tacticsSelectedStatus && lcRule.push(handleId(1329, 327, list1[2].tacticsSelectedStatus, `${preIds},74,83,1320,1329`, 1));
      list1[2].tacticsId &&
        lcRule.push(handleId(1330, 333, list[2].blackList.find((e) => e.strategyId === list1[2].tacticsId)?.strategyName || '', `${preIds},74,83,1320,1330`, 3));

      list1[3].tacticsSelectedStatus && lcRule.push(handleId(1331, 327, list1[3].tacticsSelectedStatus, `${preIds},74,83,1321,1331`, 1));
      list1[3].tacticsId &&
        lcRule.push(handleId(1332, 334, list[3].blackList.find((e) => e.strategyId === list1[3].tacticsId)?.strategyName || '', `${preIds},74,83,1321,1332`, 3));

      list1[4].tacticsSelectedStatus && lcRule.push(handleId(1333, 327, list1[4].tacticsSelectedStatus, `${preIds},74,83,1322,1333`, 1));
      list1[4].tacticsId &&
        lcRule.push(handleId(1334, 335, list[4].blackList.find((e) => e.strategyId === list1[4].tacticsId)?.strategyName || '', `${preIds},74,83,1322,1334`, 3));

      list1[5].tacticsSelectedStatus && lcRule.push(handleId(1335, 327, list1[5].tacticsSelectedStatus, `${preIds},74,83,1323,1335`, 1));
      list1[5].tacticsId &&
        lcRule.push(handleId(1336, 336, list[5].blackList.find((e) => e.strategyId === list1[5].tacticsId)?.strategyName || '', `${preIds},74,83,1323,1336`, 3));

      list1[6].tacticsSelectedStatus && lcRule.push(handleId(1337, 327, list1[6].tacticsSelectedStatus, `${preIds},74,83,1324,1337`, 1));
      list1[6].tacticsId &&
        lcRule.push(handleId(1338, 337, list[6].blackList.find((e) => e.strategyId === list1[6].tacticsId)?.strategyName || '', `${preIds},74,83,1324,1338`, 3));
    }

    // 信用评分策略
    const list2 = data.creditScoringStrategyList;
    if (list2.length) {
      const list = config.value[2]?.recordChildren[2]?.recordChildren;
      list2[0].tacticsSelectedStatus && lcRule.push(handleId(1364, 327, list2[0].tacticsSelectedStatus, `${preIds},74,84,1304,1364`, 1));
      list2[0].tacticsId && lcRule.push(handleId(1366, 339, list[0].blackList.find((e) => e.id === list2[0].tacticsId)?.scoreCardName || '', `${preIds},74,84,1304,1366`, 3));

      list2[1].tacticsSelectedStatus && lcRule.push(handleId(1365, 327, list2[1].tacticsSelectedStatus, `${preIds},74,84,1305,1365`, 1));
      list2[1].tacticsId && lcRule.push(handleId(1367, 339, list[1].blackList.find((e) => e.id === list2[1].tacticsId)?.scoreCardName || '', `${preIds},74,84,1305,1367`, 3));
    }

    // 风险度策略
    data.personalRiskDegreeStrategySelectedStatus && lcRule.push(handleId(1339, 327, data.personalRiskDegreeStrategySelectedStatus, `${preIds},74,85,1339`, 1));
    data.enterpriseRiskDegreeStrategySelectedStatus && lcRule.push(handleId(1340, 327, data.enterpriseRiskDegreeStrategySelectedStatus, `${preIds},74,85,1340`, 1));

    // 利率定价模型
    const list3 = data.interestRatePricingModelList;
    if (list3.length) {
      const list = config.value[2].recordChildren[4].recordChildren;
      list3[0].tacticsSelectedStatus && lcRule.push(handleId(1310, 327, list3[0].tacticsSelectedStatus, `${preIds},74,86,1308,1310`, 1));
      list3[0].tacticsId && lcRule.push(handleId(1360, 339, list[0].blackList.find((e) => e.id === list3[0].tacticsId)?.modelName || '', `${preIds},74,86,1308,1360`, 3));

      list3[1].tacticsSelectedStatus && lcRule.push(handleId(1311, 327, list3[1].tacticsSelectedStatus, `${preIds},74,86,1309,1311`, 1));
      list3[1].tacticsId && lcRule.push(handleId(1361, 339, list[1].blackList.find((e) => e.id === list3[1].tacticsId)?.modelName || '', `${preIds},74,86,1309,1361`, 3));

      data.enterpriseQuotaModelSelectedStatus && lcRule.push(handleId(1343, 327, data.enterpriseQuotaModelSelectedStatus, `${preIds},74,86,1341,1343`, 1));
      data.enterpriseQuotaModel && lcRule.push(handleId(1362, 338, data.enterpriseQuotaModel, `${preIds},74,86,1341,1362`, 1));

      list3[2].tacticsSelectedStatus && lcRule.push(handleId(1344, 327, list3[2].tacticsSelectedStatus, `${preIds},74,86,1342,1344`, 1));
      list3[2].tacticsId && lcRule.push(handleId(1363, 339, list3[2].blackList.find((e) => e.id === list3[2].tacticsId)?.modelName || '', `${preIds},74,86,1342,1363`, 3));
    }

    data.dueDiligenceMode && lcRule.push(handleId(88, 32, data.dueDiligenceMode, `${preIds},87,88`, 1));
    data.dueDiligenceContent && lcRule.push(handleId(89, 33, data.dueDiligenceContent, `${preIds},87,89`, 1));
    data.reviewContent && lcRule.push(handleId(91, 34, data.reviewContent, `${preIds},90,91`, 1));
    data.reviewSignature && lcRule.push(handleId(92, 35, data.reviewSignature, `${preIds},90,92`, 1));
    data.reviewApproveContent && lcRule.push(handleId(94, 36, data.reviewApproveContent, `${preIds},93,94`, 1));
    data.approvalSignature && lcRule.push(handleId(95, 37, data.approvalSignature, `${preIds},93,95`, 1));

    data.contractSupplyMaterialsSelectedStatus && lcRule.push(handleId(1248, 325, data.contractSupplyMaterialsSelectedStatus, `${preIds},96,97,1248`, 1));
    data.contractMaterials && lcRule.push(handleId(1247, 38, data.contractMaterials, `${preIds},96,97,1247`, 1));

    data.loanContractSelectedStatus && lcRule.push(handleId(1253, 325, data.loanContractSelectedStatus, `${preIds},96,98,310,1253`, 1));
    data.loanContract && lcRule.push(handleId(1249, 39, data.loanContract, `${preIds},96,98,310,1249`, 1));

    data.mortgageContractSelectedStatus && lcRule.push(handleId(1253, 325, data.mortgageContractSelectedStatus, `${preIds},96,98,311,1253`, 1));
    data.mortgageContract && lcRule.push(handleId(1250, 145, data.mortgageContract, `${preIds},96,98,311,1250`, 1));

    data.pledgeContractSelectedStatus && lcRule.push(handleId(1253, 325, data.pledgeContractSelectedStatus, `${preIds},96,98,312,1253`, 1));
    data.pledgeContract && lcRule.push(handleId(1251, 146, data.pledgeContract, `${preIds},96,98,312,1251`, 1));

    data.guaranteeContractSelectedStatus && lcRule.push(handleId(1253, 325, data.guaranteeContractSelectedStatus, `${preIds},96,98,313,1253`, 1));
    data.guaranteeContract && lcRule.push(handleId(1252, 147, data.guaranteeContract, `${preIds},96,98,313,1252`, 1));

    // 贷后管理
    const list4 = data.postLoanSelectionStrategyList;
    if (list4.length) {
      const list = config.value[7]?.recordChildren;
      list4[0].tacticsSelectedStatus && lcRule.push(handleId(1350, 327, list4[0].tacticsSelectedStatus, `${preIds},99,1345,1350`, 1));
      list4[0].tacticsId && lcRule.push(handleId(1355, 339, list[0].blackList.find((e) => e.strategyId === list4[0].tacticsId)?.strategyName || '', `${preIds},99,1345,1355`, 3));

      list4[1].tacticsSelectedStatus && lcRule.push(handleId(1351, 327, list4[1].tacticsSelectedStatus, `${preIds},99,1346,1351`, 1));
      list4[1].tacticsId && lcRule.push(handleId(1356, 339, list[1].blackList.find((e) => e.strategyId === list4[1].tacticsId)?.strategyName || '', `${preIds},99,1346,1356`, 3));

      list4[2].tacticsSelectedStatus && lcRule.push(handleId(1352, 327, list4[2].tacticsSelectedStatus, `${preIds},99,1347,1352`, 1));
      list4[2].tacticsId && lcRule.push(handleId(1357, 339, list[2].blackList.find((e) => e.strategyId === list4[2].tacticsId)?.strategyName || '', `${preIds},99,1347,1357`, 3));

      list4[3].tacticsSelectedStatus && lcRule.push(handleId(1353, 327, list4[3].tacticsSelectedStatus, `${preIds},99,1348,1353`, 1));
      list4[3].tacticsId && lcRule.push(handleId(1358, 339, list[3].blackList.find((e) => e.strategyId === list4[3].tacticsId)?.strategyName || '', `${preIds},99,1348,1358`, 3));

      list4[4].tacticsSelectedStatus && lcRule.push(handleId(1354, 327, list4[4].tacticsSelectedStatus, `${preIds},99,1349,1354`, 1));
      list4[4].tacticsId && lcRule.push(handleId(1359, 339, list[4].blackList.find((e) => e.strategyId === list4[4].tacticsId)?.strategyName || '', `${preIds},99,1349,1359`, 3));
    }
  }

  await addOperation({
    ...getIds(),
    parentId: preIds,
    lcJudgmentRuleReq: lcRule,
  });
};
// 提交
const submit = async (formEl: FormInstance | undefined) => {
  if (!formEl) return;
  await formEl.validate(async (valid, fields) => {
    if (valid) {
      try {
        const isEnterprise = info.value.productType === 1;
        const param = JSON.parse(JSON.stringify(form));

        if (param.provideMaterialSelectedStatus === 797 && !param.accountMaterials.length) return ElMessage.error('请选择需要提供的申请人材料');
        if (param.issueAccountSelectStatus === 801 && !param.sendingAccount.length) return ElMessage.error('请选择需要发放的账户');
        if (!param.loanApplicationMethod.length) return ElMessage.error('请选择申请方式');
        if (param.borrowerMaterialSelectedStatus === 797 && !param.borrowerMaterial.length) return ElMessage.error('请选择借款人材料');

        if (isEnterprise) {
          // 企业
          if (param.enterpriseMaterialSelectedStatus === 797 && !param.enterpriseMaterial.length) return ElMessage.error('请选择需要提供的企业材料');
          if (param.mortgagedPropertySelectedStatus === 797 && !param.collateral.length) return ElMessage.error('请选择需要提供的抵押物材料');
        } else {
          // 个人
          if (param.mateMaterialSelectedStatus === 797 && !param.mateMaterial.length) return ElMessage.error('请选择需要提供的配偶材料');
          if (param.businessMaterialsSelectedStatus === 797 && !param.businessMaterials.length) return ElMessage.error('请选择需要提供的经营类材料');
        }

        if (param.supplementMaterialSelectedStatus === 797 && !param.supplementaryMaterials.length) return ElMessage.error('请选择需要提供的补充材料');
        if (param.runBatchObjectSelectedStatus === 803 && !param.runBatchObject.length) return ElMessage.error('请选择需要跑批的对象');

        const list1 = param.bankRiskControlAllocationTacticsList;
        if (list1[0].tacticsSelectedStatus === 803 && !list1[0].tacticsId) return ElMessage.error('请选择政务黑名单策略');
        if (list1[1].tacticsSelectedStatus === 803 && !list1[1].tacticsId) return ElMessage.error('请选择征信黑名单策略');
        if (list1[2].tacticsSelectedStatus === 803 && !list1[2].tacticsId) return ElMessage.error('请选择商采黑名单策略');
        if (list1[3].tacticsSelectedStatus === 803 && !list1[3].tacticsId) return ElMessage.error('请选择行内黑名单策略');
        if (list1[4].tacticsSelectedStatus === 803 && !list1[4].tacticsId) return ElMessage.error('请选择企业黑名单策略');
        if (list1[5].tacticsSelectedStatus === 803 && !list1[5].tacticsId) return ElMessage.error('请选择反欺诈策略');
        if (list1[6].tacticsSelectedStatus === 803 && !list1[6].tacticsId) return ElMessage.error('请选择负面行业黑名单策略');

        const list2 = param.creditScoringStrategyList;
        if (list2[0].tacticsSelectedStatus === 803 && !list2[0].tacticsId) return ElMessage.error('请选择个人信用评分策略');
        if (list2[1].tacticsSelectedStatus === 803 && !list2[1].tacticsId) return ElMessage.error('请选择企业信用评分策略');

        const list3 = param.interestRatePricingModelList;
        if (list3[0].tacticsSelectedStatus === 803 && !list3[0].tacticsId) return ElMessage.error('请选择个人利率模型');
        if (list3[1].tacticsSelectedStatus === 803 && !list3[1].tacticsId) return ElMessage.error('请选择个人额度模型');
        if (param.enterpriseQuotaModelSelectedStatus === 803 && !param.enterpriseQuotaModel.length) return ElMessage.error('请选择企业额度模型');
        if (list3[2].tacticsSelectedStatus === 803 && !list3[2].tacticsId) return ElMessage.error('请选择企业利率模型');

        if (!param.dueDiligenceMode.length) return ElMessage.error('请选择尽调方式');
        if (!param.dueDiligenceContent.length) return ElMessage.error('请选择尽调内容');
        if (!param.reviewContent.length) return ElMessage.error('请选择审查材料');
        if (!param.reviewSignature) return ElMessage.error('请选择签字表单');
        if (!param.reviewApproveContent.length) return ElMessage.error('请选择审批材料');
        if (!param.approvalSignature) return ElMessage.error('请选择签字表单');

        const list4 = param.postLoanSelectionStrategyList;
        if (list4[0].tacticsSelectedStatus === 803 && !list4[0].tacticsId) return ElMessage.error('请选择五级分类策略');
        if (list4[1].tacticsSelectedStatus === 803 && !list4[1].tacticsId) return ElMessage.error('请选择贷后检查策略');
        if (list4[2].tacticsSelectedStatus === 803 && !list4[2].tacticsId) return ElMessage.error('请选择贷后评分卡');
        if (list4[3].tacticsSelectedStatus === 803 && !list4[3].tacticsId) return ElMessage.error('请选择贷后预警策略');
        if (list4[4].tacticsSelectedStatus === 803 && !list4[4].tacticsId) return ElMessage.error('请选择贷后催收策略');

        param.borrowerMaterial = param.borrowerMaterialSelectedStatus === 797 ? param.borrowerMaterial.join() : '';
        param.accountMaterials = param.provideMaterialSelectedStatus === 797 ? param.accountMaterials.join() : '';
        param.sendingAccount = param.issueAccountSelectStatus === 801 ? param.sendingAccount.join() : '';
        // 企业
        param.collateral = param.mortgagedPropertySelectedStatus === 797 ? param.collateral.join() : '';
        param.enterpriseMaterial = param.enterpriseMaterialSelectedStatus === 797 ? param.enterpriseMaterial.join() : '';
        param.corporateInterestRateModel = param.corporateInterestRateModel.join();
        param.materialsForLoanApproval = param.materialsForLoanApproval.join();
        // 个人
        param.businessMaterials = param.businessMaterialsSelectedStatus === 797 ? param.businessMaterials.join() : '';
        param.mateMaterial = param.mateMaterialSelectedStatus === 797 ? param.mateMaterial.join() : '';

        if (param.loanContractSelectedStatus !== 797) param.loanContract = '';
        if (param.mortgageContractSelectedStatus !== 797) param.mortgageContract = '';
        if (param.pledgeContractSelectedStatus !== 797) param.pledgeContract = '';
        if (param.guaranteeContractSelectedStatus !== 797) param.guaranteeContract = '';

        param.dueDiligenceMode = param.dueDiligenceMode.join();
        param.dueDiligenceContent = param.dueDiligenceContent.join();
        param.reviewContent = param.reviewContent.join();
        param.reviewApproveContent = param.reviewApproveContent.join();
        param.loanApplicationMethod = param.loanApplicationMethod.join();
        param.runBatchObject = param.runBatchObjectSelectedStatus === 803 ? param.runBatchObject.join() : '';

        // 准入策略
        list1.map((e) => {
          if (e.tacticsSelectedStatus !== 803 && e.tacticsId) e.tacticsId = '';
        });
        list2.map((e) => {
          if (e.tacticsSelectedStatus !== 803 && e.tacticsId) e.tacticsId = '';
        });
        list3.map((e) => {
          if (e.tacticsSelectedStatus !== 803 && e.tacticsId) e.tacticsId = '';
        });
        list4.map((e) => {
          if (e.tacticsSelectedStatus !== 803 && e.tacticsId) e.tacticsId = '';
        });

        param.enterpriseQuotaModel = param.enterpriseQuotaModelSelectedStatus === 803 ? param.enterpriseQuotaModel.join() : '';

        param.supplementaryMaterials = param.supplementMaterialSelectedStatus === 797 ? param.supplementaryMaterials.join() : '';
        if (param.contractSupplyMaterialsSelectedStatus !== 797) param.contractMaterials = '';
        param.bankProductsId = id.value;

        if (info.value.riskControlDetails) {
          param.id = info.value.riskControlDetails.id;
          await riskUpdate(param);
          addRecord(param);
        } else {
          await riskSave(param);
          addRecord(param);
        }
        router.push(`/product/bank/detail?type=${route.query.type || ''}&i=${route.query.i}&role=${route.query.role}&id=${id.value}`);
        ElMessage.success('提交成功！');
        emit('getList');
      } finally {
      }
    } else {
      console.log('error submit!', fields);
    }
  });
};

// 新增策略
const addStratety = (i: number) => {
  ElMessageBox.confirm('<p class="text-danger whitespace-nowrap">即将跳转到可以新增策略的界面，当前界面数据会清空。</p><p>确定离开当前界面？</p>', '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning',
    closeOnClickModal: false,
    dangerouslyUseHTMLString: true,
  })
    .then(() => {
      const path = i < 9 ? `/product/strategy?i=2&role=42&id=` : i < 12 ? `/product/interestRate?i=3&role=42&id=` : `/product/afterLoan?i=4&role=42&id=`;
      router.push(path + (i === 9 ? 935 : i === 10 ? 772 : i === 11 ? 936 : Object.keys(asyncComponents)[i]));
    })
    .catch(() => {});
};

// 预览策略
const preview = async (row: Record<string, any>, i: number) => {
  const { tacticsId } = form.bankRiskControlAllocationTacticsList[i];
  curRow.value = {
    strategyId: tacticsId,
    strategyName: row.blackList.find((e) => e.strategyId === tacticsId)?.strategyName,
  };
  await loadComponent(Object.keys(asyncComponents)[i]);
  curPreviewTitle.value = `查看${assessNames[i]}策略`;
  visible.value = true;
};

// 预览信用评分策略
const previewCredits = async (row: Record<string, any>, i: number) => {
  const { tacticsId } = form.creditScoringStrategyList[i];
  curRow.value = {
    id: tacticsId,
  };
  await loadComponent(i ? '513' : '512');
  curPreviewTitle.value = `查看${i ? '企业' : '个人'}信用评分策略`;
  visible.value = true;
};

// 预览利率模型
const previewRate = async (row: Record<string, any>, i: number) => {
  const { tacticsId } = form.interestRatePricingModelList[i];
  curRow.value = {
    id: tacticsId,
    modelName: row.blackList.find((e) => e.id === tacticsId)?.modelName,
  };
  await loadComponent(i === 2 ? '936' : i ? '772' : '935');
  curPreviewTitle.value = `查看${interestNames[i]}`;
  visible.value = true;
};

// 预览贷后管理
const previewAfter = async (row: Record<string, any>, i: number) => {
  const { tacticsId } = form.postLoanSelectionStrategyList[i];
  curRow.value = {
    strategyId: tacticsId,
    strategyName: row.blackList.find((e) => e.strategyId === tacticsId)?.strategyName,
  };
  await loadComponent(Object.keys(asyncComponents)[i + 12]);
  curPreviewTitle.value = `查看${afterNames[i]}策略`;
  visible.value = true;
};
</script>

<style lang="scss" scoped>
@import url(../../../styles/form.scss);
</style>
