新增产品

V0.1
yujialong 1 year ago
parent f69fdd1a8a
commit 1e3e64e19a
  1. 65
      src/views/product/Add.vue
  2. 12
      src/views/product/CardList.vue

@ -55,7 +55,7 @@
<el-checkbox-group v-if="form.edu" <el-checkbox-group v-if="form.edu"
class="mt-2 ml-5" class="mt-2 ml-5"
v-model="form.educationalRequirements"> v-model="form.educationalRequirements">
<el-checkbox v-for="(item, i) in config[3]?.subject?.itemList?.slice(2, 6)" <el-checkbox v-for="(item, i) in config[3]?.recordChildren[1]?.subject?.itemList"
:key="i" :key="i"
:label="item.itemId">{{ item.options }}</el-checkbox> :label="item.itemId">{{ item.options }}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
@ -67,7 +67,7 @@
<el-checkbox-group v-if="form.curWL" <el-checkbox-group v-if="form.curWL"
class="mt-2 ml-5" class="mt-2 ml-5"
v-model="form.currentWorkingLife"> v-model="form.currentWorkingLife">
<el-checkbox v-for="(item, i) in config[3]?.subject?.itemList?.slice(7, 11)" <el-checkbox v-for="(item, i) in config[3]?.recordChildren[2]?.subject?.itemList"
:key="i" :key="i"
:label="item.itemId">{{ item.options }}</el-checkbox> :label="item.itemId">{{ item.options }}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
@ -81,12 +81,11 @@
<div class="flex-1"> <div class="flex-1">
<p class="field-name">选择本产品贷款资金的用途</p> <p class="field-name">选择本产品贷款资金的用途</p>
<el-radio-group v-model="form.loanPurpose"> <el-radio-group v-model="form.loanPurpose">
<el-radio v-for="(item, i) in config[4]?.subject?.itemList" <el-radio v-for="(item, i) in config[4]?.recordChildren"
:key="i" :key="i"
:label="item.itemId">{{ item.options }}</el-radio> :label="item.id">{{ item.name }}</el-radio>
<el-radio :label="4">其他</el-radio>
</el-radio-group> </el-radio-group>
<el-input v-if="form?.loanPurpose === 4" <el-input v-if="form?.loanPurpose === 107"
class="w-[250px] ml-5" class="w-[250px] ml-5"
placeholder="请描述其他贷款用途可用于哪些方面。" placeholder="请描述其他贷款用途可用于哪些方面。"
maxlength="10" maxlength="10"
@ -97,14 +96,15 @@
prop="bankGuaranteeTypeIds"> prop="bankGuaranteeTypeIds">
<div class="flex-1"> <div class="flex-1">
<p class="field-name">选择本产品的担保种类</p> <p class="field-name">选择本产品的担保种类</p>
<div v-for="(item, i) in guaranteees" <div v-for="(item, i) in config[5]?.recordChildren"
:key="i" :key="i"
class="mb-2"> class="mb-2">
<el-checkbox-group v-model="form.bankGuaranteeTypeIds"> <el-checkbox-group v-model="form.bankGuaranteeTypeIds">
<el-checkbox :label="item.id">{{ item.guarantyStyle }}</el-checkbox> <el-checkbox :label="item.id">{{ item.name }}</el-checkbox>
<el-checkbox v-for="(child, j) in item?.children" <el-checkbox v-show="(item.id === 110 && form.bankGuaranteeTypeIds.includes(110)) || (item.id === 111 && form.bankGuaranteeTypeIds.includes(111))"
v-for="(child, j) in item?.subject?.itemList"
:key="j" :key="j"
:label="child.id">{{ child.guarantyStyle }}</el-checkbox> :label="child.itemId">{{ child.options }}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</div> </div>
</div> </div>
@ -220,7 +220,6 @@ const router = useRouter();
const route = useRoute(); const route = useRoute();
const curTab = ref<string>('tab1'); const curTab = ref<string>('tab1');
const config = ref<any>({}); const config = ref<any>({});
const guaranteees = ref<any[]>([]);
const formRef = ref<FormInstance>(); const formRef = ref<FormInstance>();
const form = reactive<RuleForm>({ const form = reactive<RuleForm>({
productDefinition: '', productDefinition: '',
@ -265,9 +264,6 @@ const tabChange = (tab: TabsPaneContext, event: Event) => {
const getConfig = async () => { const getConfig = async () => {
const { process } = await getProcessInformationBasedOnRoles(41); const { process } = await getProcessInformationBasedOnRoles(41);
config.value = process; config.value = process;
const { data } = await typeOfGuarantee();
guaranteees.value = data;
}; };
// //
const submit = async (formEl: FormInstance | undefined) => { const submit = async (formEl: FormInstance | undefined) => {
@ -282,10 +278,10 @@ const submit = async (formEl: FormInstance | undefined) => {
param.providentFundAndSocialSecurity = param.providentFundAndSocialSecurity ? 13 : ''; param.providentFundAndSocialSecurity = param.providentFundAndSocialSecurity ? 13 : '';
param.whetherToSupportEarlyRepayment = param.whetherToSupportEarlyRepayment ? 58 : ''; param.whetherToSupportEarlyRepayment = param.whetherToSupportEarlyRepayment ? 58 : '';
console.log(33, form, param); console.log(33, form, param);
const { data } = await save(param); await save(param);
addRecord(param); addRecord(param);
ElMessage.success('提交成功!'); ElMessage.success('提交成功!');
emit('getList'); emit('getList', 1);
// setTimeout(() => { // setTimeout(() => {
// router.push(``) // router.push(``)
// }, 1500); // }, 1500);
@ -298,28 +294,39 @@ const submit = async (formEl: FormInstance | undefined) => {
}; };
// //
const addRecord = async (data: any) => { const addRecord = async (data: any) => {
const preIds = `1,2,41,44`; const preIds = `1,2,41,${data.productType ? 45 : 44}`; // 1id/44/45
const lcRule = <Record<string, any>[]>[ const lcRule = <Record<string, any>[]>[
handleId(48, 1, data.productDefinition, preIds + ',48', 3), handleId(48, 1, data.productDefinition, preIds + ',48', 3),
handleId(49, 2, data.productName, preIds + ',49', 3), handleId(49, 2, data.productName, preIds + ',49', 3),
handleId(50, 3, 1, preIds + ',50', 1), handleId(50, 3, 1, preIds + ',50', 1),
]; ];
if (data.age) { data.age && lcRule.push(handleId(100, 41, '[' + data.minimumAge + ',' + data.maximumAge + ']' + '', preIds + ',51,100', 5));
lcRule.push(handleId(51, 41, 2, preIds + ',51', 1), handleId(51, 41, '[' + data.minimumAge + ',' + data.maximumAge + ']' + '', preIds + ',51', 5)); data.edu && lcRule.push(handleId(101, 42, data.educationalRequirements, preIds + ',51,101', 1));
} data.curWL && lcRule.push(handleId(102, 43, data.currentWorkingLife, preIds + ',51,102', 1));
if (data.edu) { data.providentFundAndSocialSecurity && lcRule.push(handleId(103, '', '', preIds + ',51,103', '')); //
lcRule.push(handleId(51, 4, '3,' + data.educationalRequirements, preIds + ',51', 1));
}
if (data.curWL) {
lcRule.push(handleId(51, 4, '3,' + data.currentWorkingLife, preIds + ',51', 1));
}
data.providentFundAndSocialSecurity && lcRule.push(handleId(51, 4, '3,13', preIds + ',51', 1));
// //
lcRule.push(data.loanPurpose === 4 ? handleId(52, 11, data.otherPurposesOfLoan, preIds + ',52', 3) : handleId(52, 10, data.loanPurpose, preIds + ',52', 1)); lcRule.push(
data.loanPurpose === 107 ? handleId(107, 11, data.otherPurposesOfLoan, preIds + ',52,107', 3) : handleId(data.loanPurpose, '', '', preIds + ',52,' + data.loanPurpose, 1),
);
//
data.bankGuaranteeTypeIds.includes(108) && lcRule.push(handleId(108, '', '', preIds + ',53,108', ''));
data.bankGuaranteeTypeIds.includes(109) && lcRule.push(handleId(109, '', '', preIds + ',53,109', ''));
data.bankGuaranteeTypeIds.includes(110) && lcRule.push(handleId(110, 13, data.bankGuaranteeTypeIds.filter((e: number) => e > 22 && e < 33).join(), preIds + ',53,110', 1));
data.bankGuaranteeTypeIds.includes(111) && lcRule.push(handleId(111, 14, data.bankGuaranteeTypeIds.filter((e: number) => e > 32 && e < 38).join(), preIds + ',53,111', 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),
);
data.whetherToSupportEarlyRepayment && lcRule.push(handleId(58, '', '', preIds + ',58', ''));
await addOperation({ await addOperation({
parentId: '1,2,41,44', parentId: preIds,
lcJudgmentRuleReq: lcRule, lcJudgmentRuleReq: lcRule,
projectId: 1, projectId: 1,
}); });

@ -20,7 +20,7 @@
<li v-for="(item, i) in list" <li v-for="(item, i) in list"
:key="i" :key="i"
:class="{ active: item.id === id }" :class="{ active: item.id === id }"
@click="switchProduct(item)"> @click="switchProduct(item.id)">
<el-popconfirm title="您确定删除吗?" <el-popconfirm title="您确定删除吗?"
@confirm="handleDelete(item.id)"> @confirm="handleDelete(item.id)">
<template #reference> <template #reference>
@ -74,11 +74,12 @@ const loading = ref<boolean>(false);
const productType = computed(() => +route.query.type); // / const productType = computed(() => +route.query.type); // /
const id = computed(() => +route.query.id); const id = computed(() => +route.query.id);
// //
const getList = async () => { const getList = async (first: any) => {
loading.value = true; loading.value = true;
try { try {
const { data } = await bankingProductsList({ pageNum: 1, pageSize: 1000, productType: productType.value }); const { data } = await bankingProductsList({ pageNum: 1, pageSize: 1000, productType: productType.value });
list.value = data.message.records; list.value = data.message.records;
first && list.value.length && switchProduct(list.value[0].id);
} finally { } finally {
loading.value = false; loading.value = false;
} }
@ -97,15 +98,14 @@ watch(
}, },
); );
// //
const switchProduct = (item: any) => { const switchProduct = (id: number) => {
router.push({ router.push({
path: `/product/cardList/detail`, path: `/product/cardList/detail`,
query: { query: {
...route.query, ...route.query,
id: item.id, id,
}, },
}); });
console.log(33, item);
}; };
// //
const toAdd = () => { const toAdd = () => {
@ -116,7 +116,7 @@ const toAdd = () => {
}; };
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {
await batchDeletion([id]); await batchDeletion([id]);
getList(); getList(1);
ElMessage.success('删除成功!'); ElMessage.success('删除成功!');
}; };
</script> </script>

Loading…
Cancel
Save