利率定价模型联调

master
yujialong 7 months ago
parent 957ae65af6
commit 53913f3f19
  1. 28
      src/api/model.ts
  2. 2
      src/layout/components/AppSidebar/Menu.vue
  3. 2
      src/router/index.ts
  4. 85
      src/views/product/interestRate/772/Detail.vue
  5. 166
      src/views/product/interestRate/772/Index.vue
  6. 5
      src/views/product/interestRate/773.vue
  7. 73
      src/views/product/interestRate/935/Detail.vue
  8. 166
      src/views/product/interestRate/935/Index.vue
  9. 404
      src/views/product/interestRate/936/Detail.vue
  10. 166
      src/views/product/interestRate/936/Index.vue
  11. 102
      src/views/product/interestRate/CardList.vue
  12. 937
      src/views/product/strategy/Credit.vue

@ -121,17 +121,39 @@ export const detailRick = async (type: number): Promise<any> =>
).data;
export const saveRick = async (data: Record<string, any>): Promise<any> => (await axios.post(`/product/riskDegreeStrategy/saveOrUpdate`, data)).data;
export const businessInterestRateDetails = async (): Promise<any> => (await axios.post(`/product/interestRateModel/businessInterestRateDetails`, getIds())).data;
export const interestRateModelList = async (data: Record<string, any>): Promise<any> =>
(
await axios.post(`${host}/product/interestRateModel/list`, {
...getIds(),
...data,
})
).data;
export const businessInterestRateDetails = async (params: Record<string, any>): Promise<any> =>
(await axios.post(`/product/interestRateModel/businessInterestRateDetails`, {}, { params })).data;
export const businessInterestRateSaveOrUpdate = async (data: Record<string, any>): Promise<any> =>
(await axios.post(`/product/interestRateModel/businessInterestRateSaveOrUpdate`, data)).data;
export const personalInterestRateDetails = async (): Promise<any> => (await axios.post(`/product/interestRateModel/personalInterestRateDetails`, getIds())).data;
export const personalInterestRateDetails = async (params: Record<string, any>): Promise<any> =>
(await axios.post(`/product/interestRateModel/personalInterestRateDetails`, {}, { params })).data;
export const personalInterestRateSaveOrUpdate = async (data: Record<string, any>): Promise<any> =>
(await axios.post(`/product/interestRateModel/personalInterestRateSaveOrUpdate`, data)).data;
export const deleteBusinessInterestRate = async (data: Record<string, any>): Promise<any> =>
(await axios.post(`${host}/product/interestRateModel/deleteBusinessInterestRate`, data)).data;
export const deletePersonalInterestRate = async (data: Record<string, any>): Promise<any> =>
(await axios.post(`${host}/product/interestRateModel/deletePersonalInterestRate`, data)).data;
export const quotaModelList = async (data: Record<string, any>): Promise<any> =>
(
await axios.post(`/product/quotaModel/list`, {
...getIds(),
...data,
})
).data;
export const quotaModelDel = async (data: Record<string, any>): Promise<any> => (await axios.post(`${host}/product/quotaModel/delete`, data)).data;
export const businessQuotaModelDetails = async (): Promise<any> => (await axios.post(`/product/quotaModel/businessQuotaModelDetails`, getIds())).data;
export const businessQuotaModelSaveOrUpdate = async (data: Record<string, any>): Promise<any> =>
(await axios.post(`/product/quotaModel/businessQuotaModelSaveOrUpdate`, data)).data;
export const personalCreditModelDetails = async (): Promise<any> => (await axios.post(`/product/quotaModel/personalCreditModelDetails`, getIds())).data;
export const personalCreditModelDetails = async (params: Record<string, any>): Promise<any> =>
(await axios.post(`/product/quotaModel/personalCreditModelDetails`, {}, { params })).data;
export const personalCreditModelSaveOrUpdate = async (data: Record<string, any>): Promise<any> =>
(await axios.post(`/product/quotaModel/personalCreditModelSaveOrUpdate`, data)).data;

@ -52,7 +52,7 @@
<p class="text">贷前准入模型</p>
</li>
<li :class="{ active: active == 3 }"
@click="toPage('/product/interestRate/tab1?&i=3&role=42&id=772')">
@click="toPage('/product/interestRate?&i=3&role=42&id=772')">
<img class="icon"
src="@/assets/images/icon3.png"
alt="" />

@ -37,7 +37,7 @@ export const routes: Array<RouteRecordRaw> = [
{ path: 'strategy', component: () => import('@/views/product/strategy/CardList.vue'), meta: { title: '产品列表' } },
{ path: 'insurance', component: () => import('@/views/product/insurance/List.vue'), meta: { title: '保险产品' } },
{ path: 'insurance/:action', component: () => import('@/views/product/insurance/CardList.vue'), meta: { title: '保险产品' } },
{ path: 'interestRate/:action', component: () => import('@/views/product/interestRate/CardList.vue'), meta: { title: '利率定价模型' } },
{ path: 'interestRate', component: () => import('@/views/product/interestRate/CardList.vue'), meta: { title: '利率定价模型' } },
{ path: 'fund', component: () => import('@/views/product/fund/List.vue'), meta: { title: '基金产品' } },
{ path: 'fund/:action', component: () => import('@/views/product/fund/CardList.vue'), meta: { title: '基金产品' } },
{ path: 'afterLoan', component: () => import('@/views/product/afterLoan/CardList.vue'), meta: { title: '贷后管理' } },

@ -1,8 +1,18 @@
<template>
<!-- 个人额度模型 -->
<el-form label-width="80px"
<el-form label-width="90px"
label-suffix=":"
class="form"
status-icon>
:disabled="disabled">
<el-form-item label="模型名称">
<el-input class="w-[320px]"
placeholder="请输入20以内字符"
maxlength="20"
clearable
v-model="modelName"></el-input>
</el-form-item>
<el-form-item label="策略规则">
<div class="flex-1">
<h6 class="step-name mb-2">{{ formProcess[0]?.name }}</h6>
<el-form-item label="不超过">
<el-select v-model="form.firstMode">
@ -75,16 +85,23 @@
</el-table-column>
</el-table>
</el-form-item>
</div>
</el-form-item>
</el-form>
<div class="flex justify-end">
<div class="submit"
@click="submit">确认完成配置</div>
<div v-if="!disabled"
class="flex justify-end mt-3">
<div class="dia-btn cancel"
@click="emit('close')">取消</div>
<div class="dia-btn"
@click="confirmSubmit">确定</div>
</div>
<Confirm v-model="syncVisible"
@submit="submit" />
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ref, defineAsyncComponent, onMounted, toRefs } from 'vue';
import { ElMessage, ElLoading } from 'element-plus';
import { personalCreditModelDetails, personalCreditModelSaveOrUpdate } from '@/api/model';
import { getProcessInformationBasedOnRoles, addOperation } from '@/api/judgment';
@ -93,9 +110,15 @@ import { useRouter, useRoute } from 'vue-router';
import { handleId, getIds } from '@/utils/common';
import Cookies from 'js-cookie';
const router = useRouter();
const route = useRoute();
let loading = null;
const Confirm = defineAsyncComponent(() => import('@/components/StrategyConfirm.vue'));
const props = defineProps({
disabled: { type: Boolean, default: false },
row: { type: Object },
});
const emit = defineEmits(['clsoe']);
const { id, modelName } = toRefs(props.row);
const form = ref<Record<string, any>>({
...getIds(),
andThird: '',
@ -108,6 +131,7 @@ const form = ref<Record<string, any>>({
const formProcess = ref<Record<string, any>[]>([]);
const info = ref<Record<string, any>[]>([]);
const len = ref<number>(0);
const syncVisible = ref<boolean>(false);
//
const getConfig = async () => {
const { process } = await getProcessInformationBasedOnRoles(772);
@ -166,14 +190,14 @@ const getConfig = async () => {
});
}
form.value.individualCreditModels = result;
loading.close();
};
//
const getDetail = async (load?: number) => {
if (load) loading = ElLoading.service();
const getDetail = async () => {
try {
const { data } = await personalCreditModelDetails();
if (data) {
if (id.value) {
const { data } = await personalCreditModelDetails({
strategyId: id.value,
});
form.value = data;
info.value = data.individualCreditModels;
}
@ -181,9 +205,7 @@ const getDetail = async (load?: number) => {
} finally {
}
};
onMounted(() => {
getDetail(1);
});
onMounted(getDetail);
interface SpanMethodProps {
row: Record<string, any>;
@ -278,27 +300,34 @@ const addRecord = async (data: Record<string, any>) => {
parentId: preIds,
lcJudgmentRuleReq: rule,
});
ElMessage.success('提交成功!');
syncVisible.value = false;
emit('close', 1);
};
//
const submit = async () => {
const submit = async (synchronizeUpdate?: number) => {
const param = JSON.parse(JSON.stringify(form.value));
param?.individualCreditModels.forEach((e, i) => {
delete e.recordChildren;
delete e.subject;
});
loading = ElLoading.service();
await personalCreditModelSaveOrUpdate(param);
await personalCreditModelSaveOrUpdate({
...param,
id: id.value,
modelName: modelName.value,
synchronizeUpdate,
});
addRecord(param);
getDetail();
ElMessage.success('提交成功!');
};
const confirmSubmit = () => {
if (!modelName.value) return ElMessage.error('请输入模型名称!');
syncVisible.value = true;
};
</script>
<style lang="scss" scoped>
@import url(../../../styles/form.scss);
.c-table {
:deep(.el-input__inner) {
@apply px-2;
}
@import url(../../../../styles/form.scss);
.el-form-item .el-form-item {
@apply mb-[18px];
}
</style>

@ -0,0 +1,166 @@
<template>
<div class="block">
<div class="flex justify-between items-center mb-5">
<search v-model="keyWord"
@change="initList"></search>
<div class="filter">
<el-popconfirm title="确定要删除吗?"
:disabled="!multipleSelection.length"
@confirm.stop="delAll">
<template #reference>
<div :class="['add-btn mr-2', {'cursor-not-allowed': !multipleSelection.length}]">
<el-icon :size="24"
color="#fff">
<Delete />
</el-icon>
批量删除
</div>
</template>
</el-popconfirm>
<div class="add-btn"
@click="toAdd">
<img src="@/assets/images/plus.png"
alt=""
class="icon" />
新增
</div>
</div>
</div>
<el-table ref="table"
v-loading="loading"
:data="list"
@selection-change="handleSelectionChange">
<el-table-column type="selection"
width="55" />
<el-table-column label="序号"
type="index"
width="60"
align="center" />
<el-table-column prop="modelName"
label="个人额度模型名称"
min-width="180" />
<el-table-column prop="createTime"
label="新增日期"
min-width="140" />
<el-table-column label="操作"
width="140">
<template #default="{ row }">
<el-button type="text"
@click="toDetail(row, true)"
size="small">查看</el-button>
<el-button type="text"
@click="toDetail(row)"
size="small">编辑</el-button>
<el-popconfirm title="您确定删除吗?"
@confirm.stop="handleDelete([row.id])">
<template #reference>
<el-button type="text"
size="small">删除</el-button>
</template>
</el-popconfirm>
</template></el-table-column>
</el-table>
<el-pagination v-model:currentPage="currentPage"
v-model:pageSize="pageSize"
:total="total"
:page-sizes="pageSizes"
:layout="pageLayout"
@size-change="getList()"
@current-change="getList()"
small
background
class="px-3 py-2 justify-end"></el-pagination>
<el-drawer v-model="visible"
:title="(isDetail ? '查看' : curRow.id ? '编辑' : '新增') + '个人额度模型'"
size="100%"
custom-class="model-drawer">
<Detail v-model:row="curRow"
:disabled="isDetail"
:key="i"
@close="closeDrawer" />
</el-drawer>
</div>
</template>
<script setup lang="ts">
import { onMounted, ref, watch, defineAsyncComponent } from 'vue';
import { ElMessage } from 'element-plus';
import { Delete } from '@element-plus/icons-vue';
import { pageSizes, pageLayout } from '@/utils/common';
import { quotaModelList, quotaModelDel } from '@/api/model';
import Search from '@/components/Search.vue';
const Detail = defineAsyncComponent(() => import('./Detail.vue'));
const keyWord = ref<string>();
const currentPage = ref<number>(1);
const pageSize = ref<number>(10);
const total = ref<number>(0);
const table = ref<any>();
const multipleSelection = ref<Record<string, any>[]>([]);
const list = ref<Record<string, any>[]>([]);
const loading = ref<boolean>(false);
const visible = ref<boolean>(false);
const curRow = ref<Record<string, any>>({
id: '',
modelName: '',
});
const isDetail = ref<boolean>(false);
const i = ref<number>(0);
//
const getList = async () => {
loading.value = true;
try {
const { page } = await quotaModelList({ pageNum: currentPage.value, pageSize: pageSize.value, keyWord: keyWord.value, type: 1 });
list.value = page.records;
total.value = page.total;
} finally {
loading.value = false;
}
};
//
const initList = async () => {
currentPage.value = 1;
getList();
};
watch(keyWord, initList);
onMounted(getList);
//
const handleSelectionChange = (val: Record<string, any>[]) => {
multipleSelection.value = val;
};
//
const delAll = async () => {
handleDelete(multipleSelection.value.map((e) => e.id));
};
//
const toAdd = () => {
i.value++;
isDetail.value = false;
curRow.value = {
id: '',
modelName: '',
};
visible.value = true;
};
//
const toDetail = async (row: Record<string, any>, detail: boolean = false) => {
i.value++;
isDetail.value = detail;
curRow.value = row;
visible.value = true;
};
//
const closeDrawer = (refresh?: number) => {
visible.value = false;
refresh && initList();
};
const handleDelete = async (ids: number[]) => {
await quotaModelDel({ ids });
getList();
ElMessage.success('删除成功!');
};
</script>

@ -167,9 +167,4 @@ const submit = async () => {
<style lang="scss" scoped>
@import url(../../../styles/form.scss);
.c-table {
:deep(.el-input__inner) {
@apply px-2;
}
}
</style>

@ -1,8 +1,16 @@
<template>
<!-- 个人利率模型 -->
<el-form label-width="100px"
<el-form label-width="90px"
label-suffix=":"
class="form"
status-icon>
:disabled="disabled">
<el-form-item label="模型名称">
<el-input class="w-[320px]"
placeholder="请输入20以内字符"
maxlength="20"
clearable
v-model="modelName"></el-input>
</el-form-item>
<el-form-item label="利率模型">
<el-table class="c-table"
:data="form.individualInterestRateModels"
@ -79,25 +87,36 @@
</div>
</el-form-item>
</el-form>
<div class="flex justify-end">
<div class="submit"
@click="submit">确认完成配置</div>
<div v-if="!disabled"
class="flex justify-end mt-3">
<div class="dia-btn cancel"
@click="emit('close')">取消</div>
<div class="dia-btn"
@click="confirmSubmit">确定</div>
</div>
<Confirm v-model="syncVisible"
@submit="submit" />
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ref, defineAsyncComponent, onMounted, toRefs } from 'vue';
import { ElMessage, ElLoading } from 'element-plus';
import { personalInterestRateDetails, personalInterestRateSaveOrUpdate } from '@/api/model';
import { getProcessInformationBasedOnRoles, addOperation } from '@/api/judgment';
import type { TableColumnCtx } from 'element-plus';
import { useRouter, useRoute } from 'vue-router';
import { handleId, getIds } from '@/utils/common';
import Cookies from 'js-cookie';
const router = useRouter();
const route = useRoute();
const Confirm = defineAsyncComponent(() => import('@/components/StrategyConfirm.vue'));
const props = defineProps({
disabled: { type: Boolean, default: false },
row: { type: Object },
});
const emit = defineEmits(['clsoe']);
const { id, modelName } = toRefs(props.row);
let loading = null;
const form = ref<Record<string, any>>({
...getIds(),
@ -111,6 +130,7 @@ const form = ref<Record<string, any>>({
const formProcess = ref<Record<string, any>[]>([]);
const info = ref<Record<string, any>[]>([]);
const len = ref<number>(0);
const syncVisible = ref<boolean>(false);
//
const getConfig = async () => {
const { process } = await getProcessInformationBasedOnRoles(935);
@ -148,18 +168,21 @@ const getConfig = async () => {
});
}
form.value.individualInterestRateModels = result;
console.log('🚀 ~ getConfig ~ form.value.individualInterestRateModels:', form.value.individualInterestRateModels);
loading.close();
};
//
const getDetail = async (load?: number) => {
if (load) loading = ElLoading.service();
try {
const { data } = await personalInterestRateDetails();
if (id.value) {
const { data } = await personalInterestRateDetails({
strategyId: id.value,
});
if (data) {
form.value = data;
info.value = data.individualInterestRateModels;
}
}
getConfig();
} finally {
}
@ -233,27 +256,31 @@ const addRecord = async (data: Record<string, any>) => {
parentId: preIds,
lcJudgmentRuleReq: rule,
});
ElMessage.success('提交成功!');
syncVisible.value = false;
emit('close', 1);
};
//
const submit = async () => {
const submit = async (synchronizeUpdate?: number) => {
const param = JSON.parse(JSON.stringify(form.value));
param?.individualInterestRateModels.forEach((e, i) => {
delete e.recordChildren;
delete e.subject;
});
loading = ElLoading.service();
await personalInterestRateSaveOrUpdate(param);
await personalInterestRateSaveOrUpdate({
...param,
id: id.value,
modelName: modelName.value,
synchronizeUpdate,
});
addRecord(param);
getDetail();
ElMessage.success('提交成功!');
};
const confirmSubmit = () => {
if (!modelName.value) return ElMessage.error('请输入模型名称!');
syncVisible.value = true;
};
</script>
<style lang="scss" scoped>
@import url(../../../styles/form.scss);
.c-table {
:deep(.el-input__inner) {
@apply px-2;
}
}
@import url(../../../../styles/form.scss);
</style>

@ -0,0 +1,166 @@
<template>
<div class="block">
<div class="flex justify-between items-center mb-5">
<search v-model="keyWord"
@change="initList"></search>
<div class="filter">
<el-popconfirm title="确定要删除吗?"
:disabled="!multipleSelection.length"
@confirm.stop="delAll">
<template #reference>
<div :class="['add-btn mr-2', {'cursor-not-allowed': !multipleSelection.length}]">
<el-icon :size="24"
color="#fff">
<Delete />
</el-icon>
批量删除
</div>
</template>
</el-popconfirm>
<div class="add-btn"
@click="toAdd">
<img src="@/assets/images/plus.png"
alt=""
class="icon" />
新增
</div>
</div>
</div>
<el-table ref="table"
v-loading="loading"
:data="list"
@selection-change="handleSelectionChange">
<el-table-column type="selection"
width="55" />
<el-table-column label="序号"
type="index"
width="60"
align="center" />
<el-table-column prop="modelName"
label="个人利率模型名称"
min-width="180" />
<el-table-column prop="createTime"
label="新增日期"
min-width="140" />
<el-table-column label="操作"
width="140">
<template #default="{ row }">
<el-button type="text"
@click="toDetail(row, true)"
size="small">查看</el-button>
<el-button type="text"
@click="toDetail(row)"
size="small">编辑</el-button>
<el-popconfirm title="您确定删除吗?"
@confirm.stop="handleDelete([row.id])">
<template #reference>
<el-button type="text"
size="small">删除</el-button>
</template>
</el-popconfirm>
</template></el-table-column>
</el-table>
<el-pagination v-model:currentPage="currentPage"
v-model:pageSize="pageSize"
:total="total"
:page-sizes="pageSizes"
:layout="pageLayout"
@size-change="getList()"
@current-change="getList()"
small
background
class="px-3 py-2 justify-end"></el-pagination>
<el-drawer v-model="visible"
:title="(isDetail ? '查看' : curRow.id ? '编辑' : '新增') + '个人利率模型'"
size="100%"
custom-class="model-drawer">
<Detail v-model:row="curRow"
:disabled="isDetail"
:key="i"
@close="closeDrawer" />
</el-drawer>
</div>
</template>
<script setup lang="ts">
import { onMounted, ref, watch, defineAsyncComponent } from 'vue';
import { ElMessage } from 'element-plus';
import { Delete } from '@element-plus/icons-vue';
import { pageSizes, pageLayout } from '@/utils/common';
import { interestRateModelList, deletePersonalInterestRate } from '@/api/model';
import Search from '@/components/Search.vue';
const Detail = defineAsyncComponent(() => import('./Detail.vue'));
const keyWord = ref<string>();
const currentPage = ref<number>(1);
const pageSize = ref<number>(10);
const total = ref<number>(0);
const table = ref<any>();
const multipleSelection = ref<Record<string, any>[]>([]);
const list = ref<Record<string, any>[]>([]);
const loading = ref<boolean>(false);
const visible = ref<boolean>(false);
const curRow = ref<Record<string, any>>({
id: '',
modelName: '',
});
const isDetail = ref<boolean>(false);
const i = ref<number>(0);
//
const getList = async () => {
loading.value = true;
try {
const { page } = await interestRateModelList({ pageNum: currentPage.value, pageSize: pageSize.value, keyWord: keyWord.value, type: 1 });
list.value = page.records;
total.value = page.total;
} finally {
loading.value = false;
}
};
//
const initList = async () => {
currentPage.value = 1;
getList();
};
watch(keyWord, initList);
onMounted(getList);
//
const handleSelectionChange = (val: Record<string, any>[]) => {
multipleSelection.value = val;
};
//
const delAll = async () => {
handleDelete(multipleSelection.value.map((e) => e.id));
};
//
const toAdd = () => {
i.value++;
isDetail.value = false;
curRow.value = {
id: '',
modelName: '',
};
visible.value = true;
};
//
const toDetail = async (row: Record<string, any>, detail: boolean = false) => {
i.value++;
isDetail.value = detail;
curRow.value = row;
visible.value = true;
};
//
const closeDrawer = (refresh?: number) => {
visible.value = false;
refresh && initList();
};
const handleDelete = async (ids: number[]) => {
await deletePersonalInterestRate({ ids });
getList();
ElMessage.success('删除成功!');
};
</script>

@ -0,0 +1,404 @@
<template>
<!-- 企业利率模型 -->
<el-form label-width="90px"
label-suffix=":"
class="form"
:disabled="disabled">
<el-form-item label="模型名称">
<el-input class="w-[320px]"
placeholder="请输入20以内字符"
maxlength="20"
clearable
v-model="modelName"></el-input>
</el-form-item>
<el-form-item label="利率模型">
<el-table class="c-table"
:data="form.corporateInterestRateModelIndicators"
:span-method="span"
:cell-style="{background:'#fff'}"
border>
<el-table-column prop="indexName"
label="指标名称"
min-width="100"
align="center"></el-table-column>
<el-table-column label="计算公式"
min-width="100"
align="center">
<template #default="{ row, $index }">
<el-select v-if="row.recordChildren && row?.recordChildren?.length < 3"
class="w-full"
v-model="row.computationalFormula">
<el-option v-for="item in row.recordChildren[0]?.subject?.itemList"
:key="item"
:value="item.options" />
</el-select>
<span v-else-if="$index === 50"> =起始浮动比例+增减分值 不超过最高浮动比例</span>
<span v-else>--</span>
</template>
</el-table-column>
<el-table-column prop="standard"
label="标准"
min-width="150"
align="center"></el-table-column>
<el-table-column label="浮动系数"
min-width="150">
<template #default="{ row, $index }">
<span v-if="$index === 50">以上分值合计</span>
<el-input v-else-if="$index === 51 || $index === 52"
placeholder="请输入"
v-model="row.floatingCoefficient"></el-input>
<el-select v-else-if="row.subject"
class="w-full"
v-model="row.floatingCoefficient">
<el-option v-for="item in row?.subject?.itemList"
:key="item"
:value="item.options" />
</el-select>
</template>
</el-table-column>
</el-table>
</el-form-item>
<el-form-item :label="formProcess[0]?.name">
<div class="flex-1">
<p class="mb-1">{{ formProcess[0]?.recordChildren[0]?.name }}</p>
<el-select v-model="form.finalFloatingRatioEqual"
clearable>
<el-option v-for="item in formProcess[0]?.recordChildren[0]?.subject?.itemList"
:key="item"
:value="item.options" />
</el-select>
<p class="mt-3 mb-1">{{ formProcess[0]?.recordChildren[1]?.name }}</p>
<el-select v-model="form.finalFloatingRatioLess"
clearable>
<el-option v-for="item in formProcess[0]?.recordChildren[1]?.subject?.itemList"
:key="item"
:value="item.options" />
</el-select>
<p class="mt-3 mb-1">{{ formProcess[0]?.recordChildren[2]?.name }}</p>
<el-select v-model="form.finalFloatingRatioGreater"
clearable>
<el-option v-for="item in formProcess[0]?.recordChildren[2]?.subject?.itemList"
:key="item"
:value="item.options" />
</el-select>
</div>
</el-form-item>
<el-form-item :label="formProcess[1]?.name">
<div class="flex-1">
<p class="mb-1">{{ formProcess[1]?.recordChildren[0]?.name }}</p>
<el-select v-model="form.finalInterestRateEqual">
<el-option v-for="item in formProcess[1]?.recordChildren[0]?.subject?.itemList"
:key="item"
:value="item.options" />
</el-select>
</div>
</el-form-item>
</el-form>
<div v-if="!disabled"
class="flex justify-end mt-3">
<div class="dia-btn cancel"
@click="emit('close')">取消</div>
<div class="dia-btn"
@click="confirmSubmit">确定</div>
</div>
<Confirm v-model="syncVisible"
@submit="submit" />
</template>
<script setup lang="ts">
import { ref, defineAsyncComponent, onMounted, toRefs } from 'vue';
import { ElMessage, ElLoading } from 'element-plus';
import { businessInterestRateDetails, businessInterestRateSaveOrUpdate } from '@/api/model';
import { getProcessInformationBasedOnRoles, addOperation } from '@/api/judgment';
import type { TableColumnCtx } from 'element-plus';
import { useRouter, useRoute } from 'vue-router';
import { handleId, getIds } from '@/utils/common';
import Cookies from 'js-cookie';
const Confirm = defineAsyncComponent(() => import('@/components/StrategyConfirm.vue'));
const props = defineProps({
disabled: { type: Boolean, default: false },
row: { type: Object },
});
const emit = defineEmits(['clsoe']);
const { id, modelName } = toRefs(props.row);
let loading = null;
const form = ref<Record<string, any>>({
...getIds(),
finalFloatingRatioEqual: '',
finalFloatingRatioGreater: '',
finalFloatingRatioLess: '',
finalInterestRateEqual: '',
type: 2,
corporateInterestRateModelIndicators: [],
});
const formProcess = ref<Record<string, any>[]>([]);
const info = ref<Record<string, any>[]>([]);
const syncVisible = ref<boolean>(false);
//
const getConfig = async () => {
const { process } = await getProcessInformationBasedOnRoles(936);
formProcess.value = process.slice(1);
const list = process[0]?.recordChildren;
const result = [];
list?.forEach((e, i) => {
if (e.recordChildren) {
const children = e?.recordChildren?.length > 2 ? e?.recordChildren : e?.recordChildren[1]?.recordChildren;
let cur = info.value.length ? info.value[i] : {};
let temp = {
indexId: cur?.indexId || '',
modelId: cur?.modelId || '',
computationalFormula: cur?.computationalFormula || '',
indexName: e.name,
recordChildren: e.recordChildren || [],
stRecordId: e.id,
ruleId: children[0]?.id,
standard: children[0]?.name,
subject: children[0]?.subject,
floatingCoefficient: cur?.corporateInterestRateModels ? (cur?.corporateInterestRateModels[0].floatingCoefficient ?? '') + '' : '',
id: cur?.corporateInterestRateModels ? cur?.corporateInterestRateModels[0].id : '',
};
result.push(temp);
children.forEach((n, j) => {
if (j) {
cur = info.value.length ? info.value[i].corporateInterestRateModels[j] : {};
temp = JSON.parse(JSON.stringify(temp));
temp.standard = n.name;
temp.subject = n.subject;
temp.ruleId = n.id;
temp.floatingCoefficient = (cur?.floatingCoefficient ?? '') + '';
temp.id = cur?.id ?? '';
temp.rule = 1;
result.push(temp);
}
});
} else {
result.push({
stRecordId: e.id,
subject: e.subject,
indexId: info.value[i]?.indexId || '',
modelId: info.value[i]?.modelId || '',
indexName: e.name,
floatingCoefficient: '',
id: info.value[i]?.corporateInterestRateModels[info.value[i]?.corporateInterestRateModels?.length - 1]?.id || '',
floatingCoefficient: info.value[i]?.corporateInterestRateModels[info.value[i]?.corporateInterestRateModels?.length - 1]?.floatingCoefficient ?? '',
});
}
});
// result.push(
// {
// indexId: info.value[10]?.indexId || '',
// modelId: info.value[10]?.modelId || '',
// indexName: '',
// formula: ' =+ ',
// floatingCoefficient: '',
// },
// {
// indexId: info.value[11]?.indexId || '',
// modelId: info.value[11]?.modelId || '',
// indexName: '',
// formula: '--',
// id: info.value[11]?.corporateInterestRateModels[info.value[11]?.corporateInterestRateModels?.length - 1]?.id || '',
// floatingCoefficient: info.value[11]?.corporateInterestRateModels[info.value[11]?.corporateInterestRateModels?.length - 1]?.floatingCoefficient ?? '',
// },
// {
// indexId: info.value[12]?.indexId || '',
// modelId: info.value[12]?.modelId || '',
// indexName: '',
// formula: '--',
// id: info.value[12]?.corporateInterestRateModels[info.value[12]?.corporateInterestRateModels?.length - 1]?.id || '',
// floatingCoefficient: info.value[12]?.corporateInterestRateModels[info.value[12]?.corporateInterestRateModels?.length - 1]?.floatingCoefficient ?? '',
// },
// );
form.value.corporateInterestRateModelIndicators = result;
console.log('🚀 ~ getConfig ~ result:', result);
loading.close();
};
//
const getDetail = async (load?: number) => {
if (load) loading = ElLoading.service();
try {
if (id.value) {
const { data } = await businessInterestRateDetails({
strategyId: id.value,
});
if (data) {
form.value = data;
info.value = data.corporateInterestRateModelIndicators;
}
}
getConfig();
} finally {
}
};
onMounted(() => {
getDetail(1);
});
interface SpanMethodProps {
row: Record<string, any>;
column: TableColumnCtx<Record<string, any>>;
rowIndex: number;
columnIndex: number;
}
const rowMerge1 = [0, 15];
const rowMerge2 = [10, 19, 24, 29, 34, 39];
const rowMerge3 = [50, 51, 52];
//
const span = ({ row, column, rowIndex, columnIndex }: SpanMethodProps) => {
if (!columnIndex || columnIndex === 1) {
if (rowMerge1.includes(rowIndex)) {
return {
rowspan: 4,
colspan: 1,
};
} else if (rowMerge2.includes(rowIndex)) {
return {
rowspan: 5,
colspan: 1,
};
} else if (rowMerge3.includes(rowIndex)) {
if (columnIndex === 1) {
return {
rowspan: 1,
colspan: 2,
};
} else if (columnIndex !== 2) {
return {
rowspan: 1,
colspan: 1,
};
}
} else if (rowIndex === 4) {
return {
rowspan: 6,
colspan: 1,
};
} else if (rowIndex === 44) {
return {
rowspan: 6,
colspan: 1,
};
} else {
return {
rowspan: 0,
colspan: 0,
};
}
} else if (rowMerge3.includes(rowIndex) && columnIndex === 2) {
return {
rowspan: 0,
colspan: 0,
};
}
};
const getItemId = (name: string): number | string => {
if (!name) return '';
return formProcess.value[0]?.recordChildren[0]?.subject?.itemList.find((e) => e.options === name)?.itemId;
};
//
const addRecord = async (data: Record<string, any>) => {
const preIds = `1,${Cookies.get('sand-level')},42,68,757,936`; // 1id
const rule: Array<Record<string, any>> = [];
const listIds = preIds + ',938';
form.value.corporateInterestRateModelIndicators.forEach((e, i) => {
//
e.floatingCoefficient &&
e?.recordChildren?.length &&
rule.push(
handleId(
e.ruleId,
e?.subject?.subjectId,
e?.subject?.itemList?.find((n) => n.options === e.floatingCoefficient)?.itemId,
`${listIds},${e.stRecordId}${e?.recordChildren?.length > 2 ? '' : ',' + e?.recordChildren[1]?.id},${e.ruleId}`,
1,
),
);
//
e.computationalFormula &&
!e.rule &&
rule.push(
handleId(
e?.recordChildren[0]?.id,
e?.recordChildren[0]?.subjectId,
e?.recordChildren[0]?.subject?.itemList?.find((n) => n.options === e.computationalFormula)?.itemId,
`${listIds},${e.stRecordId},${e?.recordChildren[0]?.id}`,
1,
),
);
//
if (i === 51 || i === 52) {
e.floatingCoefficient && rule.push(handleId(e.stRecordId, e.subject.subjectId, e.floatingCoefficient, `${listIds},${e.stRecordId}`, 3));
}
});
data.finalFloatingRatioEqual && rule.push(handleId(1024, 279, getItemId(data.finalFloatingRatioEqual), preIds + ',1023,1024', 1));
data.finalFloatingRatioLess && rule.push(handleId(1025, 279, getItemId(data.finalFloatingRatioLess), preIds + ',1023,1025', 1));
data.finalFloatingRatioGreater && rule.push(handleId(1026, 279, getItemId(data.finalFloatingRatioGreater), preIds + ',1023,1026', 1));
data.finalInterestRateEqual &&
rule.push(
handleId(1028, 280, formProcess.value[1]?.recordChildren[0]?.subject?.itemList.find((e) => e.options === data.finalInterestRateEqual)?.itemId, preIds + ',1027,1028', 1),
);
await addOperation({
...getIds(),
parentId: preIds,
lcJudgmentRuleReq: rule,
});
ElMessage.success('提交成功!');
syncVisible.value = false;
emit('close', 1);
};
//
const submit = async (synchronizeUpdate?: number) => {
const param = JSON.parse(JSON.stringify(form.value));
const list = [];
param.corporateInterestRateModelIndicators.forEach((e, i) => {
const temp = {
floatingCoefficient: e.floatingCoefficient,
standard: e.standard,
id: e.id,
indexId: e.indexId,
};
if (e.rule) {
list.find((n) => n.indexName === e.indexName).corporateInterestRateModels.push(temp);
} else {
list.push({
indexId: e.indexId,
modelId: e.modelId,
computationalFormula: e.computationalFormula,
indexName: e.indexName,
corporateInterestRateModels: [temp],
});
}
});
param.corporateInterestRateModelIndicators = list;
param.type = 2;
await businessInterestRateSaveOrUpdate({
...param,
id: id.value,
modelName: modelName.value,
synchronizeUpdate,
});
addRecord(param);
};
const confirmSubmit = () => {
if (!modelName.value) return ElMessage.error('请输入模型名称!');
syncVisible.value = true;
};
</script>
<style lang="scss" scoped>
@import url(../../../../styles/form.scss);
</style>

@ -0,0 +1,166 @@
<template>
<div class="block">
<div class="flex justify-between items-center mb-5">
<search v-model="keyWord"
@change="initList"></search>
<div class="filter">
<el-popconfirm title="确定要删除吗?"
:disabled="!multipleSelection.length"
@confirm.stop="delAll">
<template #reference>
<div :class="['add-btn mr-2', {'cursor-not-allowed': !multipleSelection.length}]">
<el-icon :size="24"
color="#fff">
<Delete />
</el-icon>
批量删除
</div>
</template>
</el-popconfirm>
<div class="add-btn"
@click="toAdd">
<img src="@/assets/images/plus.png"
alt=""
class="icon" />
新增
</div>
</div>
</div>
<el-table ref="table"
v-loading="loading"
:data="list"
@selection-change="handleSelectionChange">
<el-table-column type="selection"
width="55" />
<el-table-column label="序号"
type="index"
width="60"
align="center" />
<el-table-column prop="modelName"
label="企业利率模型名称"
min-width="180" />
<el-table-column prop="createTime"
label="新增日期"
min-width="140" />
<el-table-column label="操作"
width="140">
<template #default="{ row }">
<el-button type="text"
@click="toDetail(row, true)"
size="small">查看</el-button>
<el-button type="text"
@click="toDetail(row)"
size="small">编辑</el-button>
<el-popconfirm title="您确定删除吗?"
@confirm.stop="handleDelete([row.id])">
<template #reference>
<el-button type="text"
size="small">删除</el-button>
</template>
</el-popconfirm>
</template></el-table-column>
</el-table>
<el-pagination v-model:currentPage="currentPage"
v-model:pageSize="pageSize"
:total="total"
:page-sizes="pageSizes"
:layout="pageLayout"
@size-change="getList()"
@current-change="getList()"
small
background
class="px-3 py-2 justify-end"></el-pagination>
<el-drawer v-model="visible"
:title="(isDetail ? '查看' : curRow.id ? '编辑' : '新增') + '企业利率模型'"
size="100%"
custom-class="model-drawer">
<Detail v-model:row="curRow"
:disabled="isDetail"
:key="i"
@close="closeDrawer" />
</el-drawer>
</div>
</template>
<script setup lang="ts">
import { onMounted, ref, watch, defineAsyncComponent } from 'vue';
import { ElMessage } from 'element-plus';
import { Delete } from '@element-plus/icons-vue';
import { pageSizes, pageLayout } from '@/utils/common';
import { interestRateModelList, deleteBusinessInterestRate } from '@/api/model';
import Search from '@/components/Search.vue';
const Detail = defineAsyncComponent(() => import('./Detail.vue'));
const keyWord = ref<string>();
const currentPage = ref<number>(1);
const pageSize = ref<number>(10);
const total = ref<number>(0);
const table = ref<any>();
const multipleSelection = ref<Record<string, any>[]>([]);
const list = ref<Record<string, any>[]>([]);
const loading = ref<boolean>(false);
const visible = ref<boolean>(false);
const curRow = ref<Record<string, any>>({
id: '',
modelName: '',
});
const isDetail = ref<boolean>(false);
const i = ref<number>(0);
//
const getList = async () => {
loading.value = true;
try {
const { page } = await interestRateModelList({ pageNum: currentPage.value, pageSize: pageSize.value, keyWord: keyWord.value, type: 2 });
list.value = page.records;
total.value = page.total;
} finally {
loading.value = false;
}
};
//
const initList = async () => {
currentPage.value = 1;
getList();
};
watch(keyWord, initList);
onMounted(getList);
//
const handleSelectionChange = (val: Record<string, any>[]) => {
multipleSelection.value = val;
};
//
const delAll = async () => {
handleDelete(multipleSelection.value.map((e) => e.id));
};
//
const toAdd = () => {
i.value++;
isDetail.value = false;
curRow.value = {
id: '',
modelName: '',
};
visible.value = true;
};
//
const toDetail = async (row: Record<string, any>, detail: boolean = false) => {
i.value++;
isDetail.value = detail;
curRow.value = row;
visible.value = true;
};
//
const closeDrawer = (refresh?: number) => {
visible.value = false;
refresh && initList();
};
const handleDelete = async (ids: number[]) => {
await deleteBusinessInterestRate({ ids });
getList();
ElMessage.success('删除成功!');
};
</script>

@ -1,89 +1,63 @@
<template>
<div class="block card-list py-0">
<el-tabs v-model="curTab"
@tab-click="tabChange">
<el-tab-pane label="额度模型"
name="tab1">
<div class="flex">
<div class="left">
<ul class="products">
<li v-for="(item, i) in list[0]?.recordChildren"
<div v-if="list.length">
<div class="menu-card">
<el-menu class="left"
:default-active="curMenu"
@select="handleSelect">
<el-sub-menu v-for="(item, i) in list"
:key="i"
:class="{ active: item.id === id }"
@click="switchProduct(item.id)">
<h6>{{ item.name }}</h6>
<p class="meta">{{ item.remark }}</p>
</li>
</ul>
</div>
:index="String(item.id)">
<template #title>
<span>{{ item.name }}</span>
</template>
<el-menu-item v-for="(child, j) in item?.recordChildren"
:key="j"
:index="String(child.id)">{{ child.name }}</el-menu-item>
</el-sub-menu>
</el-menu>
<div class="right">
<Com1 v-if="id == 772" />
<Com2 v-else-if="id == 773" />
</div>
</div>
</el-tab-pane>
<el-tab-pane label="利率模型"
name="tab2">
<div class="flex">
<div class="left w-[241px] min-w-[241px] pr-5 py-4">
<ul class="products">
<li v-for="(item, i) in list[1]?.recordChildren"
:key="i"
:class="{ active: item.id === id }"
@click="switchProduct(item.id)">
<h6>{{ item.name }}</h6>
<p class="meta">{{ item.remark }}</p>
</li>
</ul>
<component :is="curMenu" />
</div>
<div class="right flex-1 px-5 pt-2">
<Com3 v-if="id == 935" />
<Com4 v-else-if="id == 936" />
</div>
</div>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import type { TabsPaneContext } from 'element-plus';
import { computed, onBeforeUnmount, onMounted, ref, defineAsyncComponent, getCurrentInstance } from 'vue';
import { getProcessInformationBasedOnRoles } from '@/api/judgment';
import { useRouter, useRoute } from 'vue-router';
import Cookies from 'js-cookie';
import Com1 from './772.vue';
import Com2 from './773.vue';
import Com3 from './935.vue';
import Com4 from './936.vue';
const router = useRouter();
const route = useRoute();
const projectId = +Cookies.get('sand-projectId');
const levelId = +Cookies.get('sand-level');
const curTab = ref<string>(route.params.action);
const curMenu = ref<string>(route.query.id);
const list = ref<Array<Record<string, any>>>([]);
const id = computed(() => +route.query.id);
//
const switchProduct = (productId: number | string) => {
router.push(`/product/interestRate/${route.params.action}?i=3&role=42&id=${productId}`);
const dynamicComponentMap = {
'772': defineAsyncComponent(() => import('./772/Index.vue')),
'773': defineAsyncComponent(() => import('./773.vue')),
'935': defineAsyncComponent(() => import('./935/Index.vue')),
'936': defineAsyncComponent(() => import('./936/Index.vue')),
};
const app = getCurrentInstance().appContext.app;
for (const [name, asyncComponent] of Object.entries(dynamicComponentMap)) {
app.component(name, asyncComponent);
}
//
const getList = async () => {
const { process } = await getProcessInformationBasedOnRoles(68);
// eslint-disable-next-line no-unused-expressions
!id.value && switchProduct(process[curTab.value === 'tab1' ? 0 : 1].recordChildren[0].id);
!curMenu.value && handleSelect(process[0].recordChildren[0].id);
list.value = process;
};
onMounted(() => {
getList();
});
// tab
const tabChange = (tab: TabsPaneContext, event: Event) => {
router.push(`/product/interestRate/${curTab.value}?i=3&role=42`);
getList();
onMounted(getList);
// onBeforeUnmount(() => {
// console.log('🚀 ~ onBeforeUnmount ~ app:', app);
// app.component('148', null);
// app.component('150', null);
// });
const handleSelect = (key: string) => {
curMenu.value = key;
router.push(`/product/interestRate?i=${route.query.i}&role=${route.query.role}&id=${key}`);
};
</script>

@ -1,937 +0,0 @@
<template>
<!-- 信用评分策略 -->
<div id="wrap">
<div class="flex items-center">
<span class="mr-2 text-sm font-semibold text-[#333] whitespace-nowrap">评分卡名称</span>
<el-input class="w-[220px]"
maxlength="20"
v-model="form.scoreCardName"></el-input>
<span class="ml-10 mr-2 text-sm font-semibold text-[#333] whitespace-nowrap">评分对象</span>
<div class="w-[220px] ">
<el-select v-model="form.scoringObject">
<el-option v-for="item in scoringObjects"
:key="item"
:label="item.name"
:value="item.id" />
</el-select>
</div>
</div>
<h6 class="mt-5 mb-3 text-sm text-[#006BFF] font-semibold">评分表</h6>
<el-table v-if="form.scoringObject"
class="c-table"
:key="1"
:data="list1"
max-height="calc(100vh - 420px)"
:span-method="span1"
:cell-style="{background:'#fff'}"
border>
<el-table-column prop="name"
label="选用"
width="100">
<template #default="{ row, $index }">
<div class="items-center">
<el-checkbox v-if="!row.top"
class="mr-2"
v-model="row.isChoose"
@change="checkAll(row, $index)"></el-checkbox>
<span v-else>{{row.name}}</span>
</div>
</template>
</el-table-column>
<el-table-column prop="sub"
label="维度"
width="150"></el-table-column>
<el-table-column prop="remark"
label="计算公式">
<template #default="{ row }">
<span v-if="isSelect(row.answerId1)">{{ row.remark }}</span>
<span v-else-if="row.answerId2 === 643">年末正常类贷款占全部贷款余额比重</span>
<el-select v-else-if="row.recordChildren"
v-model="row.calculationFormula">
<el-option v-for="item in row?.recordChildren[1]?.subject?.itemList"
:key="item"
:value="item.options" />
</el-select>
</template>
</el-table-column>
<el-table-column prop="index"
label="指标"
width="110"
align="center">
<template #default="{ row }">
<span v-if="isSelect(row.answerId1)">{{ row.index }}</span>
<span v-else-if="row.recordChildren">{{ row?.recordChildren[2]?.recordChildren[0]?.name }}</span>
</template>
</el-table-column>
<el-table-column label="分值"
align="center">
<template #default="{ row }">
<el-select v-if="isSelect(row.answerId1) && row.subject"
clearable
v-model="row.score">
<el-option v-for="item in row?.subject?.itemList.sort((a, b) => +a.options - +b.options)"
:key="item"
:value="item.options" />
</el-select>
<div v-else
:class="'flex items-center'">
<span v-if="row.answerId2 === 643"
class="mr-2 whitespace-nowrap">全部为正常贷款满分</span>
<span v-if="row.answerId2 === 627"
class="whitespace-nowrap">每少1倍扣</span>
<span v-else-if="(row.answerId1 === 590 || row.answerId1 === 591 || row.answerId1 === 592) && row.recordChildren"
class="whitespace-nowrap">{{ row?.recordChildren[2]?.recordChildren[0]?.recordChildren[0]?.name.replace('分', '') }}</span>
<span v-else-if="row.answerId1 === 595 || row.answerId1 === 593"
class="whitespace-nowrap">每降1%</span>
<div class="w-[95px] mx-2">
<el-select v-if="row.recordChildren"
clearable
v-model="row.score">
<el-option v-for="item in row?.recordChildren[2]?.recordChildren[0]?.recordChildren[0]?.subject?.itemList.sort((a, b) => +a.options - +b.options)"
:key="item"
:value="item.options" />
</el-select>
</div>
<span></span>
<span v-if="row.answerId2 !== 627 && row.answerId2 !== 646"
class="mx-2 whitespace-nowrap">
{{
row.answerId2 === 607 || row.answerId2 === 609 ?
',大于等于' :
row.answerId2 === 667 || row.answerId2 === 668 || row.answerId2 === 670 || row.answerId2 === 694 || row.answerId2 === 695 ?
',负增长不计分' :
',小于等于'
}}
</span>
<template v-if="row.answerId2 !== 627 && row.answerId2 !== 646 && row.answerId2 !== 667 && row.answerId2 !== 668 && row.answerId2 !== 670 && row.answerId2 !== 694 && row.answerId2 !== 695">
<div class="w-[95px] mx-2">
<el-select v-if="row.recordChildren"
clearable
v-model="row.percentage">
<el-option v-for="item in row.answerId2 === 669 || row.answerId2 === 671 ? row?.recordChildren[2]?.recordChildren[0]?.recordChildren[1]?.subject?.itemList : row?.recordChildren[2]?.recordChildren[0]?.recordChildren[1]?.subject?.itemList.sort((a, b) => +(a.options.replace('%', '')) - +(b.options.replace('%', '')))"
:key="item"
:value="item.options" />
</el-select>
</div>
<span class="whitespace-nowrap">不计分</span>
</template>
</div>
</template>
</el-table-column>
</el-table>
<el-table v-else
class="c-table"
:key="2"
:data="list"
max-height="calc(100vh - 420px)"
:span-method="span"
:cell-style="{background:'#fff'}"
border>
<el-table-column prop="name"
label="选用"
width="100"
align="center">
<template #default="{ row }">
<el-checkbox v-model="row.isChoose"></el-checkbox>
</template>
</el-table-column>
<el-table-column prop="name"
label="维度"
min-width="150"
align="center"></el-table-column>
<el-table-column prop="sub"
label="指标"
min-width="150"
align="center"></el-table-column>
<el-table-column label="分值"
min-width="150"
align="center">
<template #default="{ row }">
<el-select v-if="row.itemList"
clearable
v-model="row.score">
<el-option v-for="item in row?.itemList.sort((a, b) => +a.options - +b.options)"
:key="item"
:value="item.options" />
</el-select>
</template>
</el-table-column>
</el-table>
<p class="mt-4 mb-2 text-sm font-semibold text-[#333] whitespace-nowrap">描述</p>
<el-input placeholder="请输入"
maxlength="100"
type="textarea"
v-model="form.description"></el-input>
<div class="flex justify-center">
<div class="submit"
@click="submit">完成配置</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, computed, watch } from 'vue';
import { ElLoading, ElMessage } from 'element-plus';
import { saveCredit, findCredit } from '@/api/model';
import { getProcessInformationBasedOnRoles, addOperation } from '@/api/judgment';
import { useRouter, useRoute } from 'vue-router';
import type { TableColumnCtx } from 'element-plus';
import { handleId, getIds } from '@/utils/common';
import Cookies from 'js-cookie';
const emit = defineEmits(['getList']);
const router = useRouter();
const route = useRoute();
const id = computed(() => +route.query.creditId);
let loading = null;
const list = ref<Record<string, any>[]>([]);
const list1 = ref<Record<string, any>[]>([]);
const detail = ref<Record<string, any>>({});
const scoringObjects = ref<Array<any>>([
{
id: 0,
name: '个人',
},
{
id: 1,
name: '企业',
},
]);
const form = reactive({
...getIds(),
description: '',
scoreCardName: '',
scoringObject: 0,
id: computed(() => route.query.creditId || ''),
});
//
const getConfig = async () => {
const { process } = await getProcessInformationBasedOnRoles(148);
//
const result = [];
process[0]?.recordChildren.slice(3).forEach((e, j) => {
e?.recordChildren.forEach((n, i) => {
if (i) {
const cur = !form.scoringObject && detail.value[j];
result.push({
answerId1: e.id,
answerId2: n.id,
subjectId: n.subjectId,
id: cur ? cur?.dimensionIndexList[i - 1]?.id : '',
dimensionId: cur ? cur?.dimensionId : '',
strategyId: cur ? cur?.strategyId : '',
name: e.name,
sub: n.name,
isChoose: cur ? !!cur?.isChoose : false,
score: cur ? cur?.dimensionIndexList[i - 1]?.score + '' : '',
span: i === 1 ? 1 : 0,
parent: i === 1 ? '' : j,
itemList: n?.subject?.itemList || [],
});
}
});
});
list.value = result;
//
const result1 = [];
process[1]?.recordChildren.slice(3).forEach((e, j) => {
const cur = form.scoringObject && detail.value[j];
result1.push({
answerId1: e.id,
dimensionId: '',
name: e.name,
isChoose: false,
top: 1,
});
e?.recordChildren.forEach((n, i) => {
if (i) {
let temp = {
answerId1: e.id,
answerId2: n.id,
innerId: n?.recordChildren[1]?.id,
id: '',
dimensionId: '',
name: e.name,
sub: n.name,
index: n?.recordChildren[1]?.name,
subject: n?.recordChildren[1]?.subject,
remark: n.remark,
isChoose: false,
calculationFormula: '',
score: '',
percentage: '',
span: i === 1 ? 1 : 0,
middle: 1, //
recordChildren: n?.recordChildren,
};
result1.push(temp);
if (e.id === 589 || e.id === 594) {
n?.recordChildren.forEach((m, o) => {
if (o > 1) {
temp = JSON.parse(JSON.stringify(temp));
temp.innerId = m.id;
temp.parent = i;
temp.index = m.name;
temp.subject = m.subject;
delete temp.middle;
result1.push(temp);
}
});
}
}
});
});
if (form.scoringObject && detail.value.length) {
result1[0].dimensionId = detail.value[0]?.dimensionId;
result1[0].isChoose = !!detail.value[0]?.isChoose;
// 4
result1[1].dimensionId = detail.value[1]?.dimensionId;
result1[1].isChoose = !!detail.value[1]?.isChoose;
result1[1].id = detail.value[1].dimensionIndexList[0]?.id;
result1[1].dimensionId = detail.value[1].dimensionIndexList[0]?.dimensionId;
result1[1].score = detail.value[1].dimensionIndexList[0]?.score;
result1[2].id = detail.value[1].dimensionIndexList[1]?.id;
result1[2].dimensionId = detail.value[1].dimensionIndexList[1]?.dimensionId;
result1[2].score = detail.value[1].dimensionIndexList[1]?.score;
result1[3].id = detail.value[1].dimensionIndexList[2]?.id;
result1[3].dimensionId = detail.value[1].dimensionIndexList[2]?.dimensionId;
result1[3].score = detail.value[1].dimensionIndexList[2]?.score;
result1[4].dimensionId = detail.value[2]?.dimensionId;
result1[4].isChoose = !!detail.value[2]?.isChoose;
result1[4].id = detail.value[2].dimensionIndexList[0]?.id;
result1[4].dimensionId = detail.value[2].dimensionIndexList[0]?.dimensionId;
result1[4].score = detail.value[2].dimensionIndexList[0]?.score;
result1[5].id = detail.value[2].dimensionIndexList[1]?.id;
result1[5].dimensionId = detail.value[2].dimensionIndexList[1]?.dimensionId;
result1[5].score = detail.value[2].dimensionIndexList[1]?.score;
result1[6].id = detail.value[2].dimensionIndexList[2]?.id;
result1[6].dimensionId = detail.value[2].dimensionIndexList[2]?.dimensionId;
result1[6].score = detail.value[2].dimensionIndexList[2]?.score;
result1[7].dimensionId = detail.value[3]?.dimensionId;
result1[7].isChoose = !!detail.value[3]?.isChoose;
result1[7].id = detail.value[3].dimensionIndexList[0]?.id;
result1[7].dimensionId = detail.value[3].dimensionIndexList[0]?.dimensionId;
result1[7].score = detail.value[3].dimensionIndexList[0]?.score;
result1[8].id = detail.value[3].dimensionIndexList[1]?.id;
result1[8].dimensionId = detail.value[3].dimensionIndexList[1]?.dimensionId;
result1[8].score = detail.value[3].dimensionIndexList[1]?.score;
result1[9].id = detail.value[3].dimensionIndexList[2]?.id;
result1[9].dimensionId = detail.value[3].dimensionIndexList[2]?.dimensionId;
result1[9].score = detail.value[3].dimensionIndexList[2]?.score;
result1[10].dimensionId = detail.value[4]?.dimensionId;
result1[10].isChoose = !!detail.value[4]?.isChoose;
result1[10].id = detail.value[4].dimensionIndexList[0]?.id;
result1[10].dimensionId = detail.value[4].dimensionIndexList[0]?.dimensionId;
result1[10].score = detail.value[4].dimensionIndexList[0]?.score;
result1[11].id = detail.value[4].dimensionIndexList[1]?.id;
result1[11].dimensionId = detail.value[4].dimensionIndexList[1]?.dimensionId;
result1[11].score = detail.value[4].dimensionIndexList[1]?.score;
result1[12].id = detail.value[4].dimensionIndexList[2]?.id;
result1[12].dimensionId = detail.value[4].dimensionIndexList[2]?.dimensionId;
result1[12].score = detail.value[4].dimensionIndexList[2]?.score;
// <>4
result1[13].dimensionId = detail.value[5]?.dimensionId;
result1[13].isChoose = !!detail.value[5]?.isChoose;
result1[14].dimensionId = detail.value[6]?.dimensionId;
result1[14].isChoose = !!detail.value[6]?.isChoose;
result1[14].calculationFormula = detail.value[6]?.calculationFormula;
result1[14].dimensionId = detail.value[6]?.dimensionIndexList[0]?.dimensionId;
result1[14].id = detail.value[6]?.dimensionIndexList[0]?.id;
result1[14].percentage = detail.value[6]?.dimensionIndexList[0]?.percentage;
result1[14].score = detail.value[6]?.dimensionIndexList[0]?.score;
result1[15].dimensionId = detail.value[7]?.dimensionId;
result1[15].isChoose = !!detail.value[7]?.isChoose;
result1[15].calculationFormula = detail.value[7]?.calculationFormula;
result1[15].dimensionId = detail.value[7]?.dimensionIndexList[0]?.dimensionId;
result1[15].id = detail.value[7]?.dimensionIndexList[0]?.id;
result1[15].percentage = detail.value[7]?.dimensionIndexList[0]?.percentage;
result1[15].score = detail.value[7]?.dimensionIndexList[0]?.score;
result1[16].dimensionId = detail.value[8]?.dimensionId;
result1[16].isChoose = !!detail.value[8]?.isChoose;
result1[16].calculationFormula = detail.value[8]?.calculationFormula;
result1[16].dimensionId = detail.value[8]?.dimensionIndexList[0]?.dimensionId;
result1[16].id = detail.value[8]?.dimensionIndexList[0]?.id;
result1[16].percentage = detail.value[8]?.dimensionIndexList[0]?.percentage;
result1[16].score = detail.value[8]?.dimensionIndexList[0]?.score;
result1[17].dimensionId = detail.value[9]?.dimensionId;
result1[17].isChoose = !!detail.value[9]?.isChoose;
result1[17].calculationFormula = detail.value[9]?.calculationFormula;
result1[17].dimensionId = detail.value[9]?.dimensionIndexList[0]?.dimensionId;
result1[17].id = detail.value[9]?.dimensionIndexList[0]?.id;
result1[17].percentage = detail.value[9]?.dimensionIndexList[0]?.percentage;
result1[17].score = detail.value[9]?.dimensionIndexList[0]?.score;
// <>7
result1[18].dimensionId = detail.value[10]?.dimensionId;
result1[18].isChoose = !!detail.value[10]?.isChoose;
result1[19].dimensionId = detail.value[11]?.dimensionId;
result1[19].isChoose = !!detail.value[11]?.isChoose;
result1[19].calculationFormula = detail.value[11]?.calculationFormula;
result1[19].dimensionId = detail.value[11]?.dimensionIndexList[0]?.dimensionId;
result1[19].id = detail.value[11]?.dimensionIndexList[0]?.id;
result1[19].percentage = detail.value[11]?.dimensionIndexList[0]?.percentage;
result1[19].score = detail.value[11]?.dimensionIndexList[0]?.score;
result1[20].dimensionId = detail.value[12]?.dimensionId;
result1[20].isChoose = !!detail.value[12]?.isChoose;
result1[20].calculationFormula = detail.value[12]?.calculationFormula;
result1[20].dimensionId = detail.value[12]?.dimensionIndexList[0]?.dimensionId;
result1[20].id = detail.value[12]?.dimensionIndexList[0]?.id;
result1[20].percentage = detail.value[12]?.dimensionIndexList[0]?.percentage;
result1[20].score = detail.value[12]?.dimensionIndexList[0]?.score;
result1[21].dimensionId = detail.value[13]?.dimensionId;
result1[21].isChoose = !!detail.value[13]?.isChoose;
result1[21].calculationFormula = detail.value[13]?.calculationFormula;
result1[21].dimensionId = detail.value[13]?.dimensionIndexList[0]?.dimensionId;
result1[21].id = detail.value[13]?.dimensionIndexList[0]?.id;
result1[21].percentage = detail.value[13]?.dimensionIndexList[0]?.percentage;
result1[21].score = detail.value[13]?.dimensionIndexList[0]?.score;
result1[22].dimensionId = detail.value[14]?.dimensionId;
result1[22].isChoose = !!detail.value[14]?.isChoose;
result1[22].calculationFormula = detail.value[14]?.calculationFormula;
result1[22].dimensionId = detail.value[14]?.dimensionIndexList[0]?.dimensionId;
result1[22].id = detail.value[14]?.dimensionIndexList[0]?.id;
result1[22].percentage = detail.value[14]?.dimensionIndexList[0]?.percentage;
result1[22].score = detail.value[14]?.dimensionIndexList[0]?.score;
result1[23].dimensionId = detail.value[15]?.dimensionId;
result1[23].isChoose = !!detail.value[15]?.isChoose;
result1[23].calculationFormula = detail.value[15]?.calculationFormula;
result1[23].dimensionId = detail.value[15]?.dimensionIndexList[0]?.dimensionId;
result1[23].id = detail.value[15]?.dimensionIndexList[0]?.id;
result1[23].percentage = detail.value[15]?.dimensionIndexList[0]?.percentage;
result1[23].score = detail.value[15]?.dimensionIndexList[0]?.score;
result1[24].dimensionId = detail.value[16]?.dimensionId;
result1[24].isChoose = !!detail.value[16]?.isChoose;
result1[24].calculationFormula = detail.value[16]?.calculationFormula;
result1[24].dimensionId = detail.value[16]?.dimensionIndexList[0]?.dimensionId;
result1[24].id = detail.value[16]?.dimensionIndexList[0]?.id;
result1[24].percentage = detail.value[16]?.dimensionIndexList[0]?.percentage;
result1[24].score = detail.value[16]?.dimensionIndexList[0]?.score;
result1[25].dimensionId = detail.value[17]?.dimensionId;
result1[25].isChoose = !!detail.value[17]?.isChoose;
result1[25].calculationFormula = detail.value[17]?.calculationFormula;
result1[25].dimensionId = detail.value[17]?.dimensionIndexList[0]?.dimensionId;
result1[25].id = detail.value[17]?.dimensionIndexList[0]?.id;
result1[25].percentage = detail.value[17]?.dimensionIndexList[0]?.percentage;
result1[25].score = detail.value[17]?.dimensionIndexList[0]?.score;
// <>6
result1[26].dimensionId = detail.value[18]?.dimensionId;
result1[26].isChoose = !!detail.value[18]?.isChoose;
result1[27].dimensionId = detail.value[19]?.dimensionId;
result1[27].isChoose = !!detail.value[19]?.isChoose;
result1[27].calculationFormula = detail.value[19]?.calculationFormula;
result1[27].dimensionId = detail.value[19]?.dimensionIndexList[0]?.dimensionId;
result1[27].id = detail.value[19]?.dimensionIndexList[0]?.id;
result1[27].percentage = detail.value[19]?.dimensionIndexList[0]?.percentage;
result1[27].score = detail.value[19]?.dimensionIndexList[0]?.score;
result1[28].dimensionId = detail.value[20]?.dimensionId;
result1[28].isChoose = !!detail.value[20]?.isChoose;
result1[28].calculationFormula = detail.value[20]?.calculationFormula;
result1[28].dimensionId = detail.value[20]?.dimensionIndexList[0]?.dimensionId;
result1[28].id = detail.value[20]?.dimensionIndexList[0]?.id;
result1[28].percentage = detail.value[20]?.dimensionIndexList[0]?.percentage;
result1[28].score = detail.value[20]?.dimensionIndexList[0]?.score;
result1[29].dimensionId = detail.value[21]?.dimensionId;
result1[29].isChoose = !!detail.value[21]?.isChoose;
result1[29].calculationFormula = detail.value[21]?.calculationFormula;
result1[29].dimensionId = detail.value[21]?.dimensionIndexList[0]?.dimensionId;
result1[29].id = detail.value[21]?.dimensionIndexList[0]?.id;
result1[29].percentage = detail.value[21]?.dimensionIndexList[0]?.percentage;
result1[29].score = detail.value[21]?.dimensionIndexList[0]?.score;
result1[30].dimensionId = detail.value[22]?.dimensionId;
result1[30].isChoose = !!detail.value[22]?.isChoose;
result1[30].calculationFormula = detail.value[22]?.calculationFormula;
result1[30].dimensionId = detail.value[22]?.dimensionIndexList[0]?.dimensionId;
result1[30].id = detail.value[22]?.dimensionIndexList[0]?.id;
result1[30].percentage = detail.value[22]?.dimensionIndexList[0]?.percentage;
result1[30].score = detail.value[22]?.dimensionIndexList[0]?.score;
result1[31].dimensionId = detail.value[23]?.dimensionId;
result1[31].isChoose = !!detail.value[23]?.isChoose;
result1[31].calculationFormula = detail.value[23]?.calculationFormula;
result1[31].dimensionId = detail.value[23]?.dimensionIndexList[0]?.dimensionId;
result1[31].id = detail.value[23]?.dimensionIndexList[0]?.id;
result1[31].percentage = detail.value[23]?.dimensionIndexList[0]?.percentage;
result1[31].score = detail.value[23]?.dimensionIndexList[0]?.score;
result1[32].dimensionId = detail.value[24]?.dimensionId;
result1[32].isChoose = !!detail.value[24]?.isChoose;
result1[32].calculationFormula = detail.value[24]?.calculationFormula;
result1[32].dimensionId = detail.value[24]?.dimensionIndexList[0]?.dimensionId;
result1[32].id = detail.value[24]?.dimensionIndexList[0]?.id;
result1[32].percentage = detail.value[24]?.dimensionIndexList[0]?.percentage;
result1[32].score = detail.value[24]?.dimensionIndexList[0]?.score;
// <>5
result1[33].dimensionId = detail.value[25]?.dimensionId;
result1[33].isChoose = !!detail.value[25]?.isChoose;
result1[34].dimensionId = detail.value[26]?.dimensionId;
result1[34].isChoose = !!detail.value[26]?.isChoose;
result1[34].calculationFormula = detail.value[26]?.calculationFormula;
result1[34].dimensionId = detail.value[26]?.dimensionIndexList[0]?.dimensionId;
result1[34].id = detail.value[26]?.dimensionIndexList[0]?.id;
result1[34].percentage = detail.value[26]?.dimensionIndexList[0]?.percentage;
result1[34].score = detail.value[26]?.dimensionIndexList[0]?.score;
result1[35].dimensionId = detail.value[27]?.dimensionId;
result1[35].isChoose = !!detail.value[27]?.isChoose;
result1[35].calculationFormula = detail.value[27]?.calculationFormula;
result1[35].dimensionId = detail.value[27]?.dimensionIndexList[0]?.dimensionId;
result1[35].id = detail.value[27]?.dimensionIndexList[0]?.id;
result1[35].percentage = detail.value[27]?.dimensionIndexList[0]?.percentage;
result1[35].score = detail.value[27]?.dimensionIndexList[0]?.score;
result1[36].dimensionId = detail.value[28]?.dimensionId;
result1[36].isChoose = !!detail.value[28]?.isChoose;
result1[36].calculationFormula = detail.value[28]?.calculationFormula;
result1[36].dimensionId = detail.value[28]?.dimensionIndexList[0]?.dimensionId;
result1[36].id = detail.value[28]?.dimensionIndexList[0]?.id;
result1[36].percentage = detail.value[28]?.dimensionIndexList[0]?.percentage;
result1[36].score = detail.value[28]?.dimensionIndexList[0]?.score;
result1[37].dimensionId = detail.value[29]?.dimensionId;
result1[37].isChoose = !!detail.value[29]?.isChoose;
result1[37].calculationFormula = detail.value[29]?.calculationFormula;
result1[37].dimensionId = detail.value[29]?.dimensionIndexList[0]?.dimensionId;
result1[37].id = detail.value[29]?.dimensionIndexList[0]?.id;
result1[37].percentage = detail.value[29]?.dimensionIndexList[0]?.percentage;
result1[37].score = detail.value[29]?.dimensionIndexList[0]?.score;
result1[38].dimensionId = detail.value[30]?.dimensionId;
result1[38].isChoose = !!detail.value[30]?.isChoose;
result1[38].calculationFormula = detail.value[30]?.calculationFormula;
result1[38].dimensionId = detail.value[30]?.dimensionIndexList[0]?.dimensionId;
result1[38].id = detail.value[30]?.dimensionIndexList[0]?.id;
result1[38].percentage = detail.value[30]?.dimensionIndexList[0]?.percentage;
result1[38].score = detail.value[30]?.dimensionIndexList[0]?.score;
// <>3
result1[39].dimensionId = detail.value[31]?.dimensionId;
result1[39].isChoose = !!detail.value[31]?.isChoose;
result1[40].dimensionId = detail.value[32]?.dimensionId;
result1[40].isChoose = !!detail.value[32]?.isChoose;
result1[40].id = detail.value[32].dimensionIndexList[0]?.id;
result1[40].dimensionId = detail.value[32].dimensionIndexList[0]?.dimensionId;
result1[40].score = detail.value[32].dimensionIndexList[0]?.score;
result1[41].id = detail.value[32].dimensionIndexList[1]?.id;
result1[41].dimensionId = detail.value[32].dimensionIndexList[1]?.dimensionId;
result1[41].score = detail.value[32].dimensionIndexList[1]?.score;
result1[42].id = detail.value[32].dimensionIndexList[2]?.id;
result1[42].dimensionId = detail.value[32].dimensionIndexList[2]?.dimensionId;
result1[42].score = detail.value[32].dimensionIndexList[2]?.score;
result1[43].dimensionId = detail.value[33]?.dimensionId;
result1[43].isChoose = !!detail.value[33]?.isChoose;
result1[43].id = detail.value[33].dimensionIndexList[0]?.id;
result1[43].dimensionId = detail.value[33].dimensionIndexList[0]?.dimensionId;
result1[43].score = detail.value[33].dimensionIndexList[0]?.score;
result1[44].id = detail.value[33].dimensionIndexList[1]?.id;
result1[44].dimensionId = detail.value[33].dimensionIndexList[1]?.dimensionId;
result1[44].score = detail.value[33].dimensionIndexList[1]?.score;
result1[45].id = detail.value[33].dimensionIndexList[2]?.id;
result1[45].dimensionId = detail.value[33].dimensionIndexList[2]?.dimensionId;
result1[45].score = detail.value[33].dimensionIndexList[2]?.score;
result1[46].dimensionId = detail.value[34]?.dimensionId;
result1[46].isChoose = !!detail.value[34]?.isChoose;
result1[46].id = detail.value[34].dimensionIndexList[0]?.id;
result1[46].dimensionId = detail.value[34].dimensionIndexList[0]?.dimensionId;
result1[46].score = detail.value[34].dimensionIndexList[0]?.score;
result1[47].id = detail.value[34].dimensionIndexList[1]?.id;
result1[47].dimensionId = detail.value[34].dimensionIndexList[1]?.dimensionId;
result1[47].score = detail.value[34].dimensionIndexList[1]?.score;
result1[48].id = detail.value[34].dimensionIndexList[2]?.id;
result1[48].dimensionId = detail.value[34].dimensionIndexList[2]?.dimensionId;
result1[48].score = detail.value[34].dimensionIndexList[2]?.score;
// <>2
result1[49].dimensionId = detail.value[35]?.dimensionId;
result1[49].isChoose = !!detail.value[35]?.isChoose;
result1[50].dimensionId = detail.value[36]?.dimensionId;
result1[50].isChoose = !!detail.value[36]?.isChoose;
result1[50].calculationFormula = detail.value[36]?.calculationFormula;
result1[50].dimensionId = detail.value[36]?.dimensionIndexList[0]?.dimensionId;
result1[50].id = detail.value[36]?.dimensionIndexList[0]?.id;
result1[50].percentage = detail.value[36]?.dimensionIndexList[0]?.percentage;
result1[50].score = detail.value[36]?.dimensionIndexList[0]?.score;
result1[51].dimensionId = detail.value[37]?.dimensionId;
result1[51].isChoose = !!detail.value[37]?.isChoose;
result1[51].calculationFormula = detail.value[37]?.calculationFormula;
result1[51].dimensionId = detail.value[37]?.dimensionIndexList[0]?.dimensionId;
result1[51].id = detail.value[37]?.dimensionIndexList[0]?.id;
result1[51].percentage = detail.value[37]?.dimensionIndexList[0]?.percentage;
result1[51].score = detail.value[37]?.dimensionIndexList[0]?.score;
}
list1.value = result1;
loading.close();
};
//
const getDetail = async (load?: number) => {
if (load) loading = ElLoading.service();
if (id.value) {
try {
const res = await findCredit(id.value);
const info = res.scoringStrategy;
if (info) {
detail.value = info.dimensionOfTheRatingTableList;
form.description = info.description;
form.scoreCardName = info.scoreCardName;
form.scoringObject = info.scoringObject;
}
getConfig();
} catch(e) {
if (loading) loading.close();
}
} else {
getConfig();
detail.value = [];
form.description = '';
form.scoreCardName = '';
form.scoringObject = 0;
}
};
watch(
() => route.query,
() => {
getDetail(1);
},
{
immediate: true,
},
);
const isSelect = (rule: number): boolean => {
return rule === 589 || rule === 594;
};
interface SpanMethodProps {
row: Record<string, any>;
column: TableColumnCtx<Record<string, any>>;
rowIndex: number;
columnIndex: number;
}
const rowMerge1 = [1, 4, 7, 10, 40, 43, 46];
const rowMerge2 = [2, 3, 5, 6, 8, 9, 11, 12, 41, 42, 44, 45, 47, 48];
const rowMerge3 = [0, 13, 18, 26, 33, 39, 49];
//
const span1 = ({ row, column, rowIndex, columnIndex }: SpanMethodProps) => {
if (rowMerge3.includes(rowIndex)) {
if (!columnIndex) {
return {
rowspan: 1,
colspan: 5,
};
} else {
return {
rowspan: 0,
colspan: 0,
};
}
}
if (!columnIndex || columnIndex === 1 || columnIndex === 2) {
if (rowMerge1.includes(rowIndex)) {
return {
rowspan: 3,
colspan: 1,
};
} else if (rowMerge2.includes(rowIndex)) {
return {
rowspan: 0,
colspan: 0,
};
}
}
};
const span = ({ row, column, rowIndex, columnIndex }: SpanMethodProps) => {
if (!columnIndex || columnIndex === 1) {
if (!rowIndex || rowIndex === 31) {
return {
rowspan: 5,
colspan: 1,
};
} else if (rowIndex === 5 || rowIndex === 11 || rowIndex === 39 || rowIndex === 53) {
return {
rowspan: 2,
colspan: 1,
};
} else if (rowIndex === 7 || rowIndex === 13 || rowIndex === 17 || rowIndex === 27 || rowIndex === 41 || rowIndex === 45 || rowIndex === 49) {
return {
rowspan: 4,
colspan: 1,
};
} else if (rowIndex === 21 || rowIndex === 24 || rowIndex === 36) {
return {
rowspan: 3,
colspan: 1,
};
} else {
return {
rowspan: 0,
colspan: 0,
};
}
}
};
//
const checkAll = (row: Record<string, any>, i: number) => {
const c = row.isChoose;
if (!i) {
list1.value[1].isChoose = c;
list1.value[4].isChoose = c;
list1.value[7].isChoose = c;
list1.value[10].isChoose = c;
} else if (i === 13) {
list1.value[14].isChoose = c;
list1.value[15].isChoose = c;
list1.value[16].isChoose = c;
list1.value[17].isChoose = c;
} else if (i === 18) {
list1.value[19].isChoose = c;
list1.value[20].isChoose = c;
list1.value[21].isChoose = c;
list1.value[22].isChoose = c;
list1.value[23].isChoose = c;
list1.value[24].isChoose = c;
list1.value[25].isChoose = c;
} else if (i === 26) {
list1.value[27].isChoose = c;
list1.value[28].isChoose = c;
list1.value[29].isChoose = c;
list1.value[30].isChoose = c;
list1.value[31].isChoose = c;
list1.value[32].isChoose = c;
} else if (i === 33) {
list1.value[34].isChoose = c;
list1.value[35].isChoose = c;
list1.value[36].isChoose = c;
list1.value[37].isChoose = c;
list1.value[38].isChoose = c;
} else if (i === 39) {
list1.value[40].isChoose = c;
list1.value[43].isChoose = c;
list1.value[46].isChoose = c;
} else if (i === 49) {
list1.value[50].isChoose = c;
list1.value[51].isChoose = c;
}
};
//
const submit = async () => {
if (!form.scoreCardName) return ElMessage.error('请输入评分卡名称');
loading = ElLoading.service();
const param = [];
const isEnterprise = form.scoringObject;
//
if (form.scoringObject) {
list1.value.forEach((e, i) => {
const child = {
id: e?.id || '',
dimensionId: e.dimensionId ?? '',
recordName: e.index ?? '',
score: e.score,
percentage: e.percentage,
};
const temp = {
calculationFormula: e.calculationFormula ?? '',
dimensionId: e.dimensionId ?? '',
strategyId: id.value || '',
recordName: e.name,
isChoose: +e.isChoose,
};
if (e.middle) {
temp.dimensionIndexList = [child];
if ((e.answerId2 > 595 && e.answerId2 < 600) || (e.answerId2 > 687 && e.answerId2 < 691))
temp.dimensionIndexList.push(
{
id: list1.value[i + 1].id ?? '',
dimensionId: list1.value[i + 1].dimensionId ?? '',
recordName: list1.value[i + 1].index ?? '',
score: list1.value[i + 1].score,
percentage: list1.value[i + 1].percentage,
},
{
id: list1.value[i + 2].id ?? '',
dimensionId: list1.value[i + 2].dimensionId ?? '',
recordName: list1.value[i + 2].index ?? '',
score: list1.value[i + 2].score,
percentage: list1.value[i + 2].percentage,
},
);
temp.recordName = e.sub;
param.push(temp);
} else if (e.top) {
param.push(temp);
}
});
} else {
//
list.value.forEach((e) => {
const child = {
id: e.id,
dimensionId: e.dimensionId,
recordName: e.sub,
score: e.score,
recordName: e.index,
percentage: e.percentage,
};
const temp = {
dimensionId: e.dimensionId,
strategyId: e.strategyId,
recordName: e.name,
isChoose: +e.isChoose,
dimensionIndexList: [child],
};
if (e.span) {
param.push(temp);
} else {
param[e.parent].dimensionIndexList.push(child);
}
});
}
// debugger;
const res = await saveCredit({
...form,
...getIds(),
dimensionOfTheRatingTableList: param,
});
addRecord();
ElMessage.success('提交成功!');
res.id && router.push(`/product/strategy?i=${route.query.i}&role=${route.query.role}&creditId=${res.id}`);
emit('getList');
id.value && getDetail();
};
//
const addRecord = async () => {
const isEnterprise = form.scoringObject;
const preIds = `1,${Cookies.get('sand-level')},42,67,148,${form.scoringObject ? 513 : 512}`; // 1id/512/513
const lcRule: Array<Record<string, any>> = [handleId(514, 190, form.scoreCardName, preIds + ',514', 3), handleId(515, 191, form.scoringObject ? 392 : 391, preIds + ',515', 1)];
form.description && lcRule.push(handleId(516, 192, form.description, preIds + ',516', 3));
//
if (isEnterprise) {
list1.value.forEach((e) => {
//
if (e.isChoose) {
e.middle ? lcRule.push(handleId(518, '', '', `${preIds},${e.answerId1},${e.answerId2},518`, '')) : lcRule.push(handleId(518, '', '', `${preIds},${e.answerId1},518`, ''));
}
//
if (isSelect(e.answerId1)) {
e.score &&
lcRule.push(
handleId(
e.answerId2,
e?.subject?.subjectId,
e?.subject?.itemList?.find((n) => n.options == e.score)?.itemId || '',
`${preIds},${e.answerId1},${e.answerId2},${e.innerId}`,
1,
),
);
} else if (e.recordChildren) {
//
e.calculationFormula &&
lcRule.push(
handleId(
e?.recordChildren[1]?.id,
e?.subject?.subjectId,
e?.subject?.itemList?.find((n) => n.options === e.calculationFormula)?.itemId || '',
`${preIds},${e.answerId1},${e.answerId2},${e?.recordChildren[1]?.id}`,
1,
),
);
//
e.score &&
lcRule.push(
handleId(
e?.recordChildren[2]?.recordChildren[0]?.recordChildren[0]?.id,
e?.recordChildren[2]?.recordChildren[0]?.recordChildren[0]?.subject?.subjectId,
e?.recordChildren[2]?.recordChildren[0]?.recordChildren[0]?.subject?.itemList?.find((n) => n.options === e.score)?.itemId || '',
`${preIds},${e.answerId1},${e.answerId2},${e?.recordChildren[2]?.id},${e?.recordChildren[2]?.recordChildren[0]?.id},${e?.recordChildren[2]?.recordChildren[0]?.recordChildren[0]?.id}`,
1,
),
);
//
e.percentage &&
lcRule.push(
handleId(
e?.recordChildren[2]?.recordChildren[0]?.recordChildren[1]?.id,
e?.recordChildren[2]?.recordChildren[0]?.recordChildren[1]?.subject?.subjectId,
e?.recordChildren[2]?.recordChildren[0]?.recordChildren[1]?.subject?.itemList?.find((n) => n.options === e.percentage)?.itemId || '',
`${preIds},${e.answerId1},${e.answerId2},${e?.recordChildren[2]?.id},${e?.recordChildren[2]?.recordChildren[0]?.id},${e?.recordChildren[2]?.recordChildren[0]?.recordChildren[1]?.id}`,
1,
),
);
}
});
} else {
//
list.value.forEach((e) => {
e.span && e.isChoose && lcRule.push(handleId(518, '', '', preIds + ',' + e.answerId1 + ',518', ''));
e.score && lcRule.push(handleId(e.answerId2, e.subjectId, e?.itemList?.find((n) => n.options == e.score)?.itemId || '', preIds + ',' + e.answerId1 + ',' + e.answerId2, 1));
});
}
await addOperation({
...getIds(),
parentId: preIds,
lcJudgmentRuleReq: lcRule,
});
};
</script>
<style lang="scss" scoped>
@import url(../../../styles/form.scss);
</style>
Loading…
Cancel
Save