|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<el-tabs v-model="curTab">
|
|
|
|
<el-tab-pane :label="id ? '配置要素' : '新增产品'"
|
|
|
|
name="tab1">
|
|
|
|
<el-form ref="formRef"
|
|
|
|
:model="form"
|
|
|
|
:rules="rules"
|
|
|
|
label-width="100px"
|
|
|
|
label-suffix=":"
|
|
|
|
class="form"
|
|
|
|
status-icon>
|
|
|
|
<div class="h-[calc(100vh-230px)] pr-1 overflow-auto">
|
|
|
|
<el-form-item label="产品定义"
|
|
|
|
prop="productDefinition">
|
|
|
|
<el-input type="textarea"
|
|
|
|
placeholder="用一段话简单介绍一下这个产品或者描述产品的设计理念。例如:本产品根据个人客户的信用状况,为其提供的一种短期融资便利产品,借款人可在额度金额内可循环周转使用贷款。"
|
|
|
|
maxlength="200"
|
|
|
|
v-model="form.productDefinition"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="产品名称"
|
|
|
|
prop="productName">
|
|
|
|
<el-input placeholder="取个有吸引力的产品名,限20字。"
|
|
|
|
maxlength="20"
|
|
|
|
v-model="form.productName"></el-input>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="产品币种"
|
|
|
|
prop="productCurrency">
|
|
|
|
<el-select v-model="form.productCurrency"
|
|
|
|
placeholder="请选择">
|
|
|
|
<el-option label="人民币"
|
|
|
|
:value="1" />
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="贷款对象"
|
|
|
|
required>
|
|
|
|
<div class="flex-1">
|
|
|
|
<!-- 企业 -->
|
|
|
|
<template v-if="productType">
|
|
|
|
<div class="flex items-center">
|
|
|
|
<span class="mr-3 text-[#333] text-sm">企业类型</span>
|
|
|
|
<el-select v-model="form.productObject"
|
|
|
|
placeholder="请选择">
|
|
|
|
<el-option v-for="(item, i) in config.find((e) => e.name === '企业产品-贷款对象')?.recordChildren[0]?.subject?.itemList"
|
|
|
|
:key="i"
|
|
|
|
:label="item.options"
|
|
|
|
:value="item.itemId" />
|
|
|
|
</el-select>
|
|
|
|
</div>
|
|
|
|
<div class="flex items-center mt-4">
|
|
|
|
<span class="mr-3 text-[#333] text-sm">借款人年龄</span>
|
|
|
|
<div class="num-inputs ml-7">
|
|
|
|
<el-input placeholder="最小年龄"
|
|
|
|
v-model.number="form.minimumAge"></el-input>
|
|
|
|
<span class="split">-</span>
|
|
|
|
<el-input placeholder="最大年龄"
|
|
|
|
v-model.number="form.maximumAge"></el-input>
|
|
|
|
<span class="unit">周岁</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<!-- 个人 -->
|
|
|
|
<template v-else>
|
|
|
|
<p class="field-name">选择本产品的贷款对象。</p>
|
|
|
|
<div class="flex items-center mb-2">
|
|
|
|
<div class="radio-wrap">
|
|
|
|
<span class="label">1、年龄</span>
|
|
|
|
<span class="whether">是否启用</span>
|
|
|
|
<el-radio-group v-model="form.ageSelectedState">
|
|
|
|
<el-radio v-for="(item, i) in whethers"
|
|
|
|
:key="i"
|
|
|
|
:label="item.id">{{ item.name }}</el-radio>
|
|
|
|
</el-radio-group>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div v-if="form.ageSelectedState === 795"
|
|
|
|
class="num-inputs ml-7">
|
|
|
|
<el-input placeholder="最小年龄"
|
|
|
|
v-model.number="form.minimumAge"></el-input>
|
|
|
|
<span class="split">-</span>
|
|
|
|
<el-input placeholder="最大年龄"
|
|
|
|
v-model.number="form.maximumAge"></el-input>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="flex items-center h-[47px] mb-2">
|
|
|
|
<div class="radio-wrap">
|
|
|
|
<span class="label">2、学历要求</span>
|
|
|
|
<span class="whether">是否启用</span>
|
|
|
|
<el-radio-group v-model="form.degreeSelectedStatus">
|
|
|
|
<el-radio v-for="(item, i) in whethers"
|
|
|
|
:key="i"
|
|
|
|
:label="item.id">{{ item.name }}</el-radio>
|
|
|
|
</el-radio-group>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<el-checkbox-group v-if="form.degreeSelectedStatus === 795"
|
|
|
|
class="mt-2 ml-5"
|
|
|
|
v-model="form.educationalRequirements">
|
|
|
|
<el-checkbox v-for="(item, i) in config.find((e) => e.name === '个人产品-贷款对象')?.recordChildren[1]?.recordChildren[1]?.subject?.itemList"
|
|
|
|
:key="i"
|
|
|
|
:label="item.itemId">{{ item.options }}</el-checkbox>
|
|
|
|
</el-checkbox-group>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="flex items-center h-[47px] mb-2">
|
|
|
|
<div class="radio-wrap">
|
|
|
|
<span class="label">3、工作年限</span>
|
|
|
|
<span class="whether">是否启用</span>
|
|
|
|
<el-radio-group v-model="form.workingLifeSelectedState">
|
|
|
|
<el-radio v-for="(item, i) in whethers"
|
|
|
|
:key="i"
|
|
|
|
:label="item.id">{{ item.name }}</el-radio>
|
|
|
|
</el-radio-group>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<el-checkbox-group v-if="form.workingLifeSelectedState === 795"
|
|
|
|
class="mt-2 ml-5"
|
|
|
|
v-model="form.currentWorkingLife">
|
|
|
|
<el-checkbox v-for="(item, i) in config.find((e) => e.name === '个人产品-贷款对象')?.recordChildren[2]?.recordChildren[1]?.subject?.itemList"
|
|
|
|
:key="i"
|
|
|
|
:label="item.itemId">{{ item.options }}</el-checkbox>
|
|
|
|
</el-checkbox-group>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="radio-wrap">
|
|
|
|
<span class="label">4、公积金/社保</span>
|
|
|
|
<span class="whether">是否启用</span>
|
|
|
|
<el-radio-group v-model="form.providentFundAndSocialSecurity">
|
|
|
|
<el-radio v-for="(item, i) in whethers"
|
|
|
|
:key="i"
|
|
|
|
:label="item.id">{{ item.name }}</el-radio>
|
|
|
|
</el-radio-group>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="贷款用途"
|
|
|
|
prop="loanPurpose"
|
|
|
|
:rules="[
|
|
|
|
{ required: true, message: '请选择贷款用途', trigger: 'change' },
|
|
|
|
{
|
|
|
|
asyncValidator: async (rule, value, callback) => {
|
|
|
|
if (value === 107 && !form.otherPurposesOfLoan) {
|
|
|
|
callback('请输入其他贷款用途')
|
|
|
|
} else {
|
|
|
|
callback()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]">
|
|
|
|
<div class="flex-1">
|
|
|
|
<p class="field-name">选择本产品贷款资金的用途。</p>
|
|
|
|
<el-radio-group v-model="form.loanPurpose">
|
|
|
|
<template v-if="productType">
|
|
|
|
<el-radio v-for="(item, i) in config.find((e) => e.name === '企业产品-贷款用途')?.subject?.itemList"
|
|
|
|
:key="i"
|
|
|
|
:label="item.itemId">{{ item.options }}</el-radio>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<el-radio v-for="(item, i) in config.find(e => e.name === '个人产品-贷款用途')?.recordChildren[0]?.subject?.itemList"
|
|
|
|
:key="i"
|
|
|
|
:label="item.itemId">{{ item.options }}</el-radio>
|
|
|
|
</template>
|
|
|
|
</el-radio-group>
|
|
|
|
<el-input v-if="form?.loanPurpose === 822"
|
|
|
|
class="w-[300px] ml-5"
|
|
|
|
placeholder="请描述其他贷款用途可用于哪些方面。"
|
|
|
|
maxlength="10"
|
|
|
|
v-model="form.otherPurposesOfLoan"></el-input>
|
|
|
|
</div>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="担保方式"
|
|
|
|
prop="bankGuaranteeTypeIds"
|
|
|
|
:rules="[
|
|
|
|
{
|
|
|
|
asyncValidator: async (rule, value, callback) => {
|
|
|
|
if (form.mortgageSelectedStatus === 795 && !value.find(e => e > 22 && e < 33)) {
|
|
|
|
callback('请选择抵押物')
|
|
|
|
} else if (form.hypothecatedSelectedStatus === 795 && !value.find(e => e > 32 && e < 38)) {
|
|
|
|
callback('请选择质押贷')
|
|
|
|
} else {
|
|
|
|
callback()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
]">
|
|
|
|
<div class="flex-1">
|
|
|
|
<p class="field-name">选择本产品的担保种类。</p>
|
|
|
|
<div class="radio-wrap">
|
|
|
|
<span class="label">信用贷</span>
|
|
|
|
<el-radio-group v-model="form.creditSelectedStatus">
|
|
|
|
<el-radio v-for="(item, i) in whethers"
|
|
|
|
:key="i"
|
|
|
|
:label="item.id">{{ item.name }}</el-radio>
|
|
|
|
</el-radio-group>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="radio-wrap my-1">
|
|
|
|
<span class="label">保证贷</span>
|
|
|
|
<el-radio-group v-model="form.guaranteeLoanSelectedStatus">
|
|
|
|
<el-radio v-for="(item, i) in whethers"
|
|
|
|
:key="i"
|
|
|
|
:label="item.id">{{ item.name }}</el-radio>
|
|
|
|
</el-radio-group>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="radio-wrap">
|
|
|
|
<span class="label">抵押贷</span>
|
|
|
|
<el-radio-group v-model="form.mortgageSelectedStatus">
|
|
|
|
<el-radio v-for="(item, i) in whethers"
|
|
|
|
:key="i"
|
|
|
|
:label="item.id">{{ item.name }}</el-radio>
|
|
|
|
</el-radio-group>
|
|
|
|
</div>
|
|
|
|
<el-checkbox-group v-if="form.mortgageSelectedStatus === 795"
|
|
|
|
v-model="form.bankGuaranteeTypeIds">
|
|
|
|
<el-checkbox v-for="(child, j) in config.find((e) => e.name === '担保方式')?.recordChildren[2]?.recordChildren[0]?.subject?.itemList"
|
|
|
|
:key="j"
|
|
|
|
:label="child.itemId">{{ child.options }}</el-checkbox>
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
|
|
|
<div class="radio-wrap mt-1">
|
|
|
|
<span class="label">质押贷</span>
|
|
|
|
<el-radio-group v-model="form.hypothecatedSelectedStatus">
|
|
|
|
<el-radio v-for="(item, i) in whethers"
|
|
|
|
:key="i"
|
|
|
|
:label="item.id">{{ item.name }}</el-radio>
|
|
|
|
</el-radio-group>
|
|
|
|
</div>
|
|
|
|
<el-checkbox-group v-if="form.hypothecatedSelectedStatus === 795"
|
|
|
|
v-model="form.bankGuaranteeTypeIds">
|
|
|
|
<el-checkbox v-for="(child, j) in config.find((e) => e.name === '担保方式')?.recordChildren[3]?.recordChildren[0]?.subject?.itemList"
|
|
|
|
:key="j"
|
|
|
|
:label="child.itemId">{{ child.options }}</el-checkbox>
|
|
|
|
</el-checkbox-group>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="贷款额度"
|
|
|
|
prop="minimumLoan"
|
|
|
|
:rules="[
|
|
|
|
{ required: true, message: '请输入贷款额度', trigger: 'blur' },
|
|
|
|
]">
|
|
|
|
<div class="flex-1">
|
|
|
|
<div class="num-inputs">
|
|
|
|
<el-input placeholder="最小额度"
|
|
|
|
v-model="form.minimumLoan"></el-input>
|
|
|
|
<span class="split">-</span>
|
|
|
|
<el-input placeholder="最高额度"
|
|
|
|
v-model="form.loanCeiling"></el-input>
|
|
|
|
<span class="unit">万元</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="贷款利率"
|
|
|
|
prop="minimumAprOnLoan"
|
|
|
|
:rules="[
|
|
|
|
{ required: true, message: '请输入贷款利率', trigger: 'blur' },
|
|
|
|
]">
|
|
|
|
<div class="flex-1">
|
|
|
|
<div class="num-inputs">
|
|
|
|
<el-input placeholder="最小年利率"
|
|
|
|
min="0"
|
|
|
|
v-model="form.minimumAprOnLoan"></el-input>
|
|
|
|
<span class="split">-</span>
|
|
|
|
<el-input placeholder="最高年利率"
|
|
|
|
min="0"
|
|
|
|
v-model="form.maximumAnnualInterestRate"></el-input>
|
|
|
|
<span class="unit">%</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="贷款期限"
|
|
|
|
prop="minimumTermOfLoan"
|
|
|
|
:rules="[
|
|
|
|
{ required: true, message: '请输入贷款期限', trigger: 'blur' },
|
|
|
|
]">
|
|
|
|
<div class="flex-1">
|
|
|
|
<div class="num-inputs">
|
|
|
|
<el-input placeholder="最小期限"
|
|
|
|
v-model="form.minimumTermOfLoan"></el-input>
|
|
|
|
<span class="split">-</span>
|
|
|
|
<el-input placeholder="最大期限"
|
|
|
|
v-model="form.maximumTermOfLoan"></el-input>
|
|
|
|
<span class="unit">月</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="还款方式"
|
|
|
|
prop="modeRepayment">
|
|
|
|
<div class="flex-1">
|
|
|
|
<p class="field-name">选择本产品可以选择的还款方式。</p>
|
|
|
|
<el-checkbox-group v-model="form.modeRepayment">
|
|
|
|
<el-checkbox v-for="(item, i) in config.find((e) => e.name === '还款方式')?.subject?.itemList"
|
|
|
|
:key="i"
|
|
|
|
:label="item.itemId">{{ item.options }}</el-checkbox>
|
|
|
|
</el-checkbox-group>
|
|
|
|
</div>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="提前还款"
|
|
|
|
prop="whetherToSupportEarlyRepayment">
|
|
|
|
<div class="flex-1 flex items-center">
|
|
|
|
<el-switch v-model="form.whetherToSupportEarlyRepayment" />
|
|
|
|
<p class="tips ml-4">本产品是否支持提前还款。</p>
|
|
|
|
</div>
|
|
|
|
</el-form-item>
|
|
|
|
</div>
|
|
|
|
<div class="flex justify-end">
|
|
|
|
<div class="submit"
|
|
|
|
@click="submit(formRef)">完成,提交风控经理</div>
|
|
|
|
</div>
|
|
|
|
</el-form>
|
|
|
|
</el-tab-pane>
|
|
|
|
<el-tab-pane v-if="id"
|
|
|
|
label="产品详情"
|
|
|
|
name="tab2">
|
|
|
|
<div class="h-[calc(100vh-170px)] pr-1 overflow-auto">
|
|
|
|
<info />
|
|
|
|
</div>
|
|
|
|
</el-tab-pane>
|
|
|
|
</el-tabs>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { ref, reactive, computed, watch, onMounted, defineEmits } from 'vue';
|
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
|
import type { FormInstance, FormRules } from 'element-plus';
|
|
|
|
import { findById, save, update, elementDetail } from '@/api/bank';
|
|
|
|
import { getProcessInformationBasedOnRoles, addOperation } from '@/api/judgment';
|
|
|
|
import { useRouter, useRoute } from 'vue-router';
|
|
|
|
import { handleId, isIllegalNum, getIds, whethers, getUsername } from '@/utils/common';
|
|
|
|
import Info from './Info.vue';
|
|
|
|
import Cookies from 'js-cookie';
|
|
|
|
import { getStat } from '@/store/useProduct';
|
|
|
|
|
|
|
|
const emit = defineEmits(['getList']);
|
|
|
|
interface RuleForm {
|
|
|
|
productDefinition: string;
|
|
|
|
productName: string;
|
|
|
|
productCurrency: number;
|
|
|
|
bankGuaranteeTypeIds: number[];
|
|
|
|
currentWorkingLife?: number[];
|
|
|
|
degreeSelectedStatus?: number;
|
|
|
|
educationalRequirements?: number[];
|
|
|
|
loanCeiling?: string;
|
|
|
|
loanPurpose?: number;
|
|
|
|
maximumAge?: number;
|
|
|
|
maximumAnnualInterestRate?: string;
|
|
|
|
maximumTermOfLoan?: string;
|
|
|
|
ageSelectedState?: number;
|
|
|
|
workingLifeSelectedState?: number;
|
|
|
|
minimumAge?: number;
|
|
|
|
minimumAprOnLoan?: string;
|
|
|
|
minimumLoan?: string;
|
|
|
|
minimumTermOfLoan?: string;
|
|
|
|
modeRepayment?: number[];
|
|
|
|
otherPurposesOfLoan: string;
|
|
|
|
productObject?: number;
|
|
|
|
productType?: number;
|
|
|
|
providentFundAndSocialSecurity: number | string;
|
|
|
|
whetherToSupportEarlyRepayment: boolean;
|
|
|
|
creditSelectedStatus?: number;
|
|
|
|
guaranteeLoanSelectedStatus?: number;
|
|
|
|
mortgageSelectedStatus?: number;
|
|
|
|
hypothecatedSelectedStatus?: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
|
|
const route = useRoute();
|
|
|
|
const id = computed(() => route.query.id);
|
|
|
|
const productType = +route.query.type;
|
|
|
|
const curTab = ref<string>(route.query.show ? 'tab2' : 'tab1');
|
|
|
|
const config = ref<any[]>([]);
|
|
|
|
const info = ref<Record<string, any>>(null);
|
|
|
|
|
|
|
|
const formRef = ref<FormInstance>();
|
|
|
|
const userName = ref<string>();
|
|
|
|
|
|
|
|
let form = reactive<RuleForm>({
|
|
|
|
...getIds(),
|
|
|
|
productDefinition: '',
|
|
|
|
productName: '',
|
|
|
|
productCurrency: 1,
|
|
|
|
bankGuaranteeTypeIds: [],
|
|
|
|
currentWorkingLife: [],
|
|
|
|
degreeSelectedStatus: '',
|
|
|
|
educationalRequirements: [],
|
|
|
|
loanCeiling: '',
|
|
|
|
loanPurpose: '',
|
|
|
|
maximumAge: '',
|
|
|
|
maximumAnnualInterestRate: '',
|
|
|
|
maximumTermOfLoan: '',
|
|
|
|
ageSelectedState: '',
|
|
|
|
workingLifeSelectedState: '',
|
|
|
|
minimumAge: '',
|
|
|
|
minimumAprOnLoan: '',
|
|
|
|
minimumLoan: '',
|
|
|
|
minimumTermOfLoan: '',
|
|
|
|
modeRepayment: [],
|
|
|
|
otherPurposesOfLoan: '',
|
|
|
|
productObject: '',
|
|
|
|
productType: '',
|
|
|
|
providentFundAndSocialSecurity: '',
|
|
|
|
whetherToSupportEarlyRepayment: false,
|
|
|
|
creditSelectedStatus: '',
|
|
|
|
guaranteeLoanSelectedStatus: '',
|
|
|
|
mortgageSelectedStatus: '',
|
|
|
|
hypothecatedSelectedStatus: '',
|
|
|
|
});
|
|
|
|
const rules = reactive<FormRules<RuleForm>>({
|
|
|
|
productDefinition: [{ required: true, message: '请输入产品定义', trigger: 'blur' }],
|
|
|
|
productName: [{ required: true, message: '请输入产品名称', trigger: 'blur' }],
|
|
|
|
productCurrency: [{ required: true, message: '请选择产品币种', trigger: 'change' }],
|
|
|
|
modeRepayment: [{ required: true, message: '请选择还款方式', trigger: 'change' }],
|
|
|
|
});
|
|
|
|
|
|
|
|
// 配置项
|
|
|
|
const getConfig = async () => {
|
|
|
|
const { process } = await getProcessInformationBasedOnRoles(productType === 1 ? 45 : 44);
|
|
|
|
config.value = process;
|
|
|
|
};
|
|
|
|
// 详情
|
|
|
|
const getDetail = async () => {
|
|
|
|
if (!route.query.show) curTab.value = 'tab1';
|
|
|
|
userName.value = await getUsername();
|
|
|
|
|
|
|
|
info.value = null;
|
|
|
|
if (id.value) {
|
|
|
|
try {
|
|
|
|
// 只返回name的详情
|
|
|
|
const { data } = await findById(id.value);
|
|
|
|
info.value = data;
|
|
|
|
|
|
|
|
// 只返回id的详情
|
|
|
|
const res = await elementDetail(id.value);
|
|
|
|
if (res) {
|
|
|
|
const e = res.data.bankProducts;
|
|
|
|
e.currentWorkingLife = e.currentWorkingLife.split(',').map((n) => +n);
|
|
|
|
e.educationalRequirements = e.educationalRequirements.split(',').map((n) => +n);
|
|
|
|
e.modeRepayment = e.modeRepayment.split(',').map((n) => +n);
|
|
|
|
e.whetherToSupportEarlyRepayment = !!e.whetherToSupportEarlyRepayment;
|
|
|
|
e.bankGuaranteeTypeIds = [];
|
|
|
|
if (e.bankGuaranteeAllocationList) {
|
|
|
|
e.bankGuaranteeAllocationList.map((n) => {
|
|
|
|
n.guaranteeTypeId && e.bankGuaranteeTypeIds.push(n.guaranteeTypeId);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
for (const i in e) {
|
|
|
|
if (e.hasOwnProperty(i)) {
|
|
|
|
form[i] = e[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
watch(
|
|
|
|
() => route.query,
|
|
|
|
() => {
|
|
|
|
route.params.action === 'add' && getDetail();
|
|
|
|
},
|
|
|
|
{
|
|
|
|
immediate: true,
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
// 新增判分记录
|
|
|
|
const addRecord = async (data: Record<string, any>) => {
|
|
|
|
getStat(299);
|
|
|
|
const isEnterprise = productType === 1;
|
|
|
|
const preIds = `1,${Cookies.get('sand-level')},41,${productType ? 45 : 44}`; // 1,关卡id,角色(这个页面是产品经理新增产品),个人/企业(44/45)
|
|
|
|
const lcRule: Array<Record<string, any>> = [
|
|
|
|
handleId(48, 1, data.productDefinition, preIds + ',48', 3),
|
|
|
|
handleId(49, 2, data.productName, preIds + ',49', 3),
|
|
|
|
handleId(50, 3, 1, preIds + ',50', 1),
|
|
|
|
];
|
|
|
|
|
|
|
|
// 贷款用途
|
|
|
|
if (isEnterprise) {
|
|
|
|
// 企业
|
|
|
|
lcRule.push(
|
|
|
|
handleId(62, 7, data.productObject, preIds + ',61,62', 1),
|
|
|
|
handleId(63, 8, data.minimumAge + '~' + data.maximumAge + '', preIds + ',61,63', 5),
|
|
|
|
handleId(65, 19, data.loanPurpose, preIds + ',65', 1),
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
// 个人
|
|
|
|
data.ageSelectedState && lcRule.push(handleId(1235, 324, data.ageSelectedState, preIds + ',51,1234,1235', 1));
|
|
|
|
data.ageSelectedState === 795 && lcRule.push(handleId(1236, 41, data.minimumAge + '~' + data.maximumAge, preIds + ',51,1234,1236', 5));
|
|
|
|
|
|
|
|
data.degreeSelectedStatus && lcRule.push(handleId(1238, 324, data.degreeSelectedStatus, preIds + ',51,1237,1238', 1));
|
|
|
|
data.degreeSelectedStatus === 795 && lcRule.push(handleId(1239, 42, data.educationalRequirements, preIds + ',51,1237,1239', 1));
|
|
|
|
|
|
|
|
data.workingLifeSelectedState && lcRule.push(handleId(1241, 324, data.workingLifeSelectedState, preIds + ',51,1240,1241', 1));
|
|
|
|
data.workingLifeSelectedState === 795 && lcRule.push(handleId(1242, 43, data.currentWorkingLife, preIds + ',51,1240,1242', 1));
|
|
|
|
|
|
|
|
data.providentFundAndSocialSecurity && lcRule.push(handleId(1244, 324, data.providentFundAndSocialSecurity, preIds + ',51,1243,1244', 1)); // 公积金社保
|
|
|
|
lcRule.push(handleId(1316, 328, data.loanPurpose, preIds + ',52,1316', 1));
|
|
|
|
data.loanPurpose === 822 && lcRule.push(handleId(1317, 11, data.otherPurposesOfLoan, preIds + ',52,1317', 3));
|
|
|
|
}
|
|
|
|
|
|
|
|
// 担保方式
|
|
|
|
data.creditSelectedStatus && lcRule.push(handleId(108, 324, data.creditSelectedStatus, preIds + ',53,108', 1));
|
|
|
|
data.guaranteeLoanSelectedStatus && lcRule.push(handleId(109, 324, data.guaranteeLoanSelectedStatus, preIds + ',53,109', 1));
|
|
|
|
data.mortgageSelectedStatus && lcRule.push(handleId(1277, 324, data.mortgageSelectedStatus, preIds + ',53,110,1277', 1));
|
|
|
|
data.hypothecatedSelectedStatus && lcRule.push(handleId(1278, 324, data.hypothecatedSelectedStatus, preIds + ',53,111,1278', 1));
|
|
|
|
data.mortgageSelectedStatus === 795 && lcRule.push(handleId(1275, 13, data.bankGuaranteeTypeIds.filter((e: number) => e > 22 && e < 33).join(), preIds + ',53,110,1275', 1));
|
|
|
|
data.hypothecatedSelectedStatus === 795 && lcRule.push(handleId(1276, 14, data.bankGuaranteeTypeIds.filter((e: number) => e > 32 && e < 38).join(), preIds + ',53,111,1276', 1));
|
|
|
|
|
|
|
|
lcRule.push(
|
|
|
|
handleId(54, 15, data.minimumLoan + '~' + data.loanCeiling, preIds + ',54', 5),
|
|
|
|
handleId(55, 16, data.minimumAprOnLoan + '~' + data.maximumAnnualInterestRate, preIds + ',55', 5),
|
|
|
|
handleId(56, 17, data.minimumTermOfLoan + '~' + data.maximumTermOfLoan, preIds + ',56', 5),
|
|
|
|
handleId(57, 18, data.modeRepayment, preIds + ',57', 1),
|
|
|
|
);
|
|
|
|
|
|
|
|
lcRule.push(handleId(58, 140, data.whetherToSupportEarlyRepayment ? 345 : 346, preIds + ',58', 1));
|
|
|
|
|
|
|
|
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 param = JSON.parse(JSON.stringify(form));
|
|
|
|
// 企业
|
|
|
|
if (productType) {
|
|
|
|
if (!param.productObject) return ElMessage.error('请选择企业类型');
|
|
|
|
}
|
|
|
|
if ((!param.productType && param.ageSelectedState === 795) || productType) {
|
|
|
|
if (!param.minimumAge) return ElMessage.error('请输入最小年龄');
|
|
|
|
if (!param.maximumAge) return ElMessage.error('请输入最大年龄');
|
|
|
|
if (isIllegalNum(param.minimumAge) || isIllegalNum(param.maximumAge)) return ElMessage.error('请输入合理的年龄');
|
|
|
|
if (param.minimumAge > param.maximumAge) return ElMessage.error('最小年龄不得大于最大年龄');
|
|
|
|
}
|
|
|
|
|
|
|
|
// 个人
|
|
|
|
if (!productType) {
|
|
|
|
if (param.degreeSelectedStatus === 795 && !param.educationalRequirements.length) return ElMessage.error('请选择学历要求');
|
|
|
|
if (param.workingLifeSelectedState === 795 && !param.currentWorkingLife.length) return ElMessage.error('请选择工作年限');
|
|
|
|
}
|
|
|
|
if (isIllegalNum(param.minimumLoan) || isIllegalNum(param.loanCeiling) || +param.minimumLoan > +param.loanCeiling) return ElMessage.error('请输入合理的贷款额度');
|
|
|
|
if (isIllegalNum(param.minimumAprOnLoan) || isIllegalNum(param.maximumAnnualInterestRate) || +param.minimumAprOnLoan > +param.maximumAnnualInterestRate)
|
|
|
|
return ElMessage.error('请输入合理的贷款利率');
|
|
|
|
if (isIllegalNum(param.minimumTermOfLoan) || isIllegalNum(param.maximumTermOfLoan) || +param.minimumTermOfLoan > +param.maximumTermOfLoan)
|
|
|
|
return ElMessage.error('请输入合理的贷款期限');
|
|
|
|
|
|
|
|
if (!productType && param.ageSelectedState !== 795) {
|
|
|
|
param.minimumAge = '';
|
|
|
|
param.maximumAge = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (param.degreeSelectedStatus !== 795) param.educationalRequirements = [];
|
|
|
|
if (param.workingLifeSelectedState !== 795) param.currentWorkingLife = [];
|
|
|
|
|
|
|
|
param.currentWorkingLife = param.currentWorkingLife.join();
|
|
|
|
param.educationalRequirements = param.educationalRequirements.join();
|
|
|
|
param.modeRepayment = param.modeRepayment.join();
|
|
|
|
param.whetherToSupportEarlyRepayment = param.whetherToSupportEarlyRepayment ? 58 : '';
|
|
|
|
// 担保方式
|
|
|
|
const graIds = [];
|
|
|
|
// 信用贷
|
|
|
|
param.creditSelectedStatus === 795 &&
|
|
|
|
graIds.push({
|
|
|
|
bankGuaranteeTypeId: '',
|
|
|
|
pid: 108,
|
|
|
|
});
|
|
|
|
// 保证贷
|
|
|
|
param.guaranteeLoanSelectedStatus === 795 &&
|
|
|
|
graIds.push({
|
|
|
|
bankGuaranteeTypeId: '',
|
|
|
|
pid: 109,
|
|
|
|
});
|
|
|
|
|
|
|
|
param.bankGuaranteeTypeIds.forEach((e: number) => {
|
|
|
|
// 抵押贷
|
|
|
|
if (param.mortgageSelectedStatus === 795 && e > 22 && e < 33) {
|
|
|
|
graIds.push({
|
|
|
|
bankGuaranteeTypeId: e,
|
|
|
|
pid: 110,
|
|
|
|
});
|
|
|
|
} else if (param.hypothecatedSelectedStatus === 795 && e > 32 && e < 38) {
|
|
|
|
// 质押贷
|
|
|
|
graIds.push({
|
|
|
|
bankGuaranteeTypeId: e,
|
|
|
|
pid: 111,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
param.addBankProductsGuarantyStyleReqList = graIds;
|
|
|
|
param.productType = productType;
|
|
|
|
let res;
|
|
|
|
if (id.value) {
|
|
|
|
param.id = id.value;
|
|
|
|
param.status = 295;
|
|
|
|
await update(param);
|
|
|
|
addRecord(param);
|
|
|
|
} else {
|
|
|
|
res = await save(param);
|
|
|
|
addRecord(param);
|
|
|
|
}
|
|
|
|
|
|
|
|
router.push(`/product/bank/detail?type=${route.query.type || ''}&i=${route.query.i}&role=${route.query.role}&id=${res?.message || ''}`);
|
|
|
|
ElMessage.success('提交成功!');
|
|
|
|
emit('getList');
|
|
|
|
} finally {
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
console.log('error submit!', fields);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
onMounted(() => {
|
|
|
|
getConfig();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import url(../../../styles/form.scss);
|
|
|
|
</style>
|