信用评分联调

master
yujialong 7 months ago
parent 0d12df5652
commit 957ae65af6
  1. 2
      .env
  2. 2
      src/api/model.ts
  3. 3
      src/views/product/strategy/150/Detail.vue
  4. 291
      src/views/product/strategy/512/Detail.vue
  5. 164
      src/views/product/strategy/512/Index.vue
  6. 820
      src/views/product/strategy/513/Detail.vue
  7. 164
      src/views/product/strategy/513/Index.vue
  8. 3
      src/views/product/strategy/CardList.vue

@ -2,7 +2,7 @@ VITE_APP_TITLE=金融产品设计及数字化营销沙盘
VITE_PORT=9520
# VITE_PROXY=http://192.168.31.125:8080
VITE_PUBLIC_PATH=./
VITE_BASE_API=http://192.168.31.217:9000
VITE_BASE_API=http://192.168.31.51:9000
# VITE_BASE_API=http://121.37.12.51
# VITE_BASE_API=https://www.occupationlab.com
VITE_I18N_LOCALE=zh-cn

@ -101,7 +101,7 @@ export const accessStrategyNegativeIndustryStrategySave = async (data: Record<st
export const accessStrategyNegativeIndustryStrategyDel = async (data: Record<string, any>): Promise<any> =>
(await axios.post(`${host}/product/accessStrategyNegativeIndustryStrategy/delete`, data)).data;
export const delCredit = async (id: number): Promise<any> => (await axios.post(`/product/creditScoringStrategy/delete?strategyId=${id}`)).data;
export const delCredit = async (data: Record<string, any>): Promise<any> => (await axios.post(`/product/creditScoringStrategy/delete`, data)).data;
export const findCredit = async (id: number): Promise<any> => (await axios.post(`/product/creditScoringStrategy/details?strategyId=${id}`)).data;
export const listCredit = async (data: Record<string, any>): Promise<any> =>
(

@ -3,8 +3,7 @@
label-suffix=":"
class="form"
:disabled="disabled">
<el-form-item label="策略名称"
prop="fundName">
<el-form-item label="策略名称">
<el-input class="w-[320px]"
placeholder="请输入20以内字符"
maxlength="20"

@ -0,0 +1,291 @@
<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="form.scoreCardName"></el-input>
</el-form-item>
<el-form-item label="策略规则">
<el-table class="c-table"
:data="list"
:max-height="'calc(100vh - ' + (disabled ? 260 : 300) + 'px)'"
: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>
</el-form-item>
<el-form-item label="描述"
prop="description">
<el-input placeholder="请输入"
maxlength="100"
type="textarea"
v-model="form.description" />
</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, reactive } 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 Confirm = defineAsyncComponent(() => import('@/components/StrategyConfirm.vue'));
const props = defineProps({
disabled: { type: Boolean, default: false },
row: { type: Object },
});
const emit = defineEmits(['clsoe']);
const { id } = toRefs(props.row);
const list = ref<Record<string, any>[]>([]);
const detail = ref<Record<string, any>>({});
const form = reactive({
...getIds(),
scoreCardName: '',
description: '',
scoringObject: 0,
});
const syncVisible = ref<boolean>(false);
//
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 getDetail = async () => {
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) {}
} else {
getConfig();
detail.value = [];
form.description = '';
form.scoreCardName = '';
form.scoringObject = 0;
}
};
onMounted(getDetail);
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 addRecord = async () => {
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));
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,
});
ElMessage.success('提交成功!');
syncVisible.value = false;
emit('close', 1);
};
//
const submit = async (synchronizeUpdate?: number) => {
if (!form.scoreCardName) return ElMessage.error('请输入评分卡名称');
const param = [];
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);
}
});
await saveCredit({
id: id.value,
...form,
...getIds(),
synchronizeUpdate,
dimensionOfTheRatingTableList: param,
});
addRecord();
};
const confirmSubmit = () => {
if (!form.scoreCardName) return ElMessage.error('请输入策略名称!');
syncVisible.value = true;
};
</script>
<style lang="scss" scoped>
@import url(../../../../styles/form.scss);
</style>

@ -0,0 +1,164 @@
<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="scoreCardName"
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.strategyId ? '编辑' : '新增') + '个人信用评分策略'"
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 { listCredit, delCredit } 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: '',
});
const isDetail = ref<boolean>(false);
const i = ref<number>(0);
//
const getList = async () => {
loading.value = true;
try {
const { data } = await listCredit({ pageNum: currentPage.value, pageSize: pageSize.value, keyWord: keyWord.value, type: 0 });
list.value = data.records;
total.value = data.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.strategyId));
};
//
const toAdd = () => {
i.value++;
isDetail.value = false;
curRow.value = {
id: '',
};
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 delCredit({ ids });
getList();
ElMessage.success('删除成功!');
};
</script>

@ -0,0 +1,820 @@
<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="form.scoreCardName"></el-input>
</el-form-item>
<el-form-item label="策略规则">
<el-table class="c-table"
:data="list"
:max-height="'calc(100vh - ' + (disabled ? 260 : 300) + 'px)'"
: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-form-item>
<el-form-item label="描述"
prop="description">
<el-input placeholder="请输入"
maxlength="100"
type="textarea"
v-model="form.description" />
</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, reactive } 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 Confirm = defineAsyncComponent(() => import('@/components/StrategyConfirm.vue'));
const props = defineProps({
disabled: { type: Boolean, default: false },
row: { type: Object },
});
const emit = defineEmits(['clsoe']);
const { id } = toRefs(props.row);
const list = ref<Record<string, any>[]>([]);
const detail = ref<Record<string, any>>({});
const form = reactive({
...getIds(),
scoreCardName: '',
description: '',
scoringObject: 1,
});
const syncVisible = ref<boolean>(false);
//
const getConfig = async () => {
const { process } = await getProcessInformationBasedOnRoles(148);
const result = [];
process[1]?.recordChildren.slice(3).forEach((e, j) => {
result.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,
};
result.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;
result.push(temp);
}
});
}
}
});
});
if (detail.value.length) {
result[0].dimensionId = detail.value[0]?.dimensionId;
result[0].isChoose = !!detail.value[0]?.isChoose;
// 4
result[1].dimensionId = detail.value[1]?.dimensionId;
result[1].isChoose = !!detail.value[1]?.isChoose;
result[1].id = detail.value[1].dimensionIndexList[0]?.id;
result[1].dimensionId = detail.value[1].dimensionIndexList[0]?.dimensionId;
result[1].score = detail.value[1].dimensionIndexList[0]?.score;
result[2].id = detail.value[1].dimensionIndexList[1]?.id;
result[2].dimensionId = detail.value[1].dimensionIndexList[1]?.dimensionId;
result[2].score = detail.value[1].dimensionIndexList[1]?.score;
result[3].id = detail.value[1].dimensionIndexList[2]?.id;
result[3].dimensionId = detail.value[1].dimensionIndexList[2]?.dimensionId;
result[3].score = detail.value[1].dimensionIndexList[2]?.score;
result[4].dimensionId = detail.value[2]?.dimensionId;
result[4].isChoose = !!detail.value[2]?.isChoose;
result[4].id = detail.value[2].dimensionIndexList[0]?.id;
result[4].dimensionId = detail.value[2].dimensionIndexList[0]?.dimensionId;
result[4].score = detail.value[2].dimensionIndexList[0]?.score;
result[5].id = detail.value[2].dimensionIndexList[1]?.id;
result[5].dimensionId = detail.value[2].dimensionIndexList[1]?.dimensionId;
result[5].score = detail.value[2].dimensionIndexList[1]?.score;
result[6].id = detail.value[2].dimensionIndexList[2]?.id;
result[6].dimensionId = detail.value[2].dimensionIndexList[2]?.dimensionId;
result[6].score = detail.value[2].dimensionIndexList[2]?.score;
result[7].dimensionId = detail.value[3]?.dimensionId;
result[7].isChoose = !!detail.value[3]?.isChoose;
result[7].id = detail.value[3].dimensionIndexList[0]?.id;
result[7].dimensionId = detail.value[3].dimensionIndexList[0]?.dimensionId;
result[7].score = detail.value[3].dimensionIndexList[0]?.score;
result[8].id = detail.value[3].dimensionIndexList[1]?.id;
result[8].dimensionId = detail.value[3].dimensionIndexList[1]?.dimensionId;
result[8].score = detail.value[3].dimensionIndexList[1]?.score;
result[9].id = detail.value[3].dimensionIndexList[2]?.id;
result[9].dimensionId = detail.value[3].dimensionIndexList[2]?.dimensionId;
result[9].score = detail.value[3].dimensionIndexList[2]?.score;
result[10].dimensionId = detail.value[4]?.dimensionId;
result[10].isChoose = !!detail.value[4]?.isChoose;
result[10].id = detail.value[4].dimensionIndexList[0]?.id;
result[10].dimensionId = detail.value[4].dimensionIndexList[0]?.dimensionId;
result[10].score = detail.value[4].dimensionIndexList[0]?.score;
result[11].id = detail.value[4].dimensionIndexList[1]?.id;
result[11].dimensionId = detail.value[4].dimensionIndexList[1]?.dimensionId;
result[11].score = detail.value[4].dimensionIndexList[1]?.score;
result[12].id = detail.value[4].dimensionIndexList[2]?.id;
result[12].dimensionId = detail.value[4].dimensionIndexList[2]?.dimensionId;
result[12].score = detail.value[4].dimensionIndexList[2]?.score;
// <>4
result[13].dimensionId = detail.value[5]?.dimensionId;
result[13].isChoose = !!detail.value[5]?.isChoose;
result[14].dimensionId = detail.value[6]?.dimensionId;
result[14].isChoose = !!detail.value[6]?.isChoose;
result[14].calculationFormula = detail.value[6]?.calculationFormula;
result[14].dimensionId = detail.value[6]?.dimensionIndexList[0]?.dimensionId;
result[14].id = detail.value[6]?.dimensionIndexList[0]?.id;
result[14].percentage = detail.value[6]?.dimensionIndexList[0]?.percentage;
result[14].score = detail.value[6]?.dimensionIndexList[0]?.score;
result[15].dimensionId = detail.value[7]?.dimensionId;
result[15].isChoose = !!detail.value[7]?.isChoose;
result[15].calculationFormula = detail.value[7]?.calculationFormula;
result[15].dimensionId = detail.value[7]?.dimensionIndexList[0]?.dimensionId;
result[15].id = detail.value[7]?.dimensionIndexList[0]?.id;
result[15].percentage = detail.value[7]?.dimensionIndexList[0]?.percentage;
result[15].score = detail.value[7]?.dimensionIndexList[0]?.score;
result[16].dimensionId = detail.value[8]?.dimensionId;
result[16].isChoose = !!detail.value[8]?.isChoose;
result[16].calculationFormula = detail.value[8]?.calculationFormula;
result[16].dimensionId = detail.value[8]?.dimensionIndexList[0]?.dimensionId;
result[16].id = detail.value[8]?.dimensionIndexList[0]?.id;
result[16].percentage = detail.value[8]?.dimensionIndexList[0]?.percentage;
result[16].score = detail.value[8]?.dimensionIndexList[0]?.score;
result[17].dimensionId = detail.value[9]?.dimensionId;
result[17].isChoose = !!detail.value[9]?.isChoose;
result[17].calculationFormula = detail.value[9]?.calculationFormula;
result[17].dimensionId = detail.value[9]?.dimensionIndexList[0]?.dimensionId;
result[17].id = detail.value[9]?.dimensionIndexList[0]?.id;
result[17].percentage = detail.value[9]?.dimensionIndexList[0]?.percentage;
result[17].score = detail.value[9]?.dimensionIndexList[0]?.score;
// <>7
result[18].dimensionId = detail.value[10]?.dimensionId;
result[18].isChoose = !!detail.value[10]?.isChoose;
result[19].dimensionId = detail.value[11]?.dimensionId;
result[19].isChoose = !!detail.value[11]?.isChoose;
result[19].calculationFormula = detail.value[11]?.calculationFormula;
result[19].dimensionId = detail.value[11]?.dimensionIndexList[0]?.dimensionId;
result[19].id = detail.value[11]?.dimensionIndexList[0]?.id;
result[19].percentage = detail.value[11]?.dimensionIndexList[0]?.percentage;
result[19].score = detail.value[11]?.dimensionIndexList[0]?.score;
result[20].dimensionId = detail.value[12]?.dimensionId;
result[20].isChoose = !!detail.value[12]?.isChoose;
result[20].calculationFormula = detail.value[12]?.calculationFormula;
result[20].dimensionId = detail.value[12]?.dimensionIndexList[0]?.dimensionId;
result[20].id = detail.value[12]?.dimensionIndexList[0]?.id;
result[20].percentage = detail.value[12]?.dimensionIndexList[0]?.percentage;
result[20].score = detail.value[12]?.dimensionIndexList[0]?.score;
result[21].dimensionId = detail.value[13]?.dimensionId;
result[21].isChoose = !!detail.value[13]?.isChoose;
result[21].calculationFormula = detail.value[13]?.calculationFormula;
result[21].dimensionId = detail.value[13]?.dimensionIndexList[0]?.dimensionId;
result[21].id = detail.value[13]?.dimensionIndexList[0]?.id;
result[21].percentage = detail.value[13]?.dimensionIndexList[0]?.percentage;
result[21].score = detail.value[13]?.dimensionIndexList[0]?.score;
result[22].dimensionId = detail.value[14]?.dimensionId;
result[22].isChoose = !!detail.value[14]?.isChoose;
result[22].calculationFormula = detail.value[14]?.calculationFormula;
result[22].dimensionId = detail.value[14]?.dimensionIndexList[0]?.dimensionId;
result[22].id = detail.value[14]?.dimensionIndexList[0]?.id;
result[22].percentage = detail.value[14]?.dimensionIndexList[0]?.percentage;
result[22].score = detail.value[14]?.dimensionIndexList[0]?.score;
result[23].dimensionId = detail.value[15]?.dimensionId;
result[23].isChoose = !!detail.value[15]?.isChoose;
result[23].calculationFormula = detail.value[15]?.calculationFormula;
result[23].dimensionId = detail.value[15]?.dimensionIndexList[0]?.dimensionId;
result[23].id = detail.value[15]?.dimensionIndexList[0]?.id;
result[23].percentage = detail.value[15]?.dimensionIndexList[0]?.percentage;
result[23].score = detail.value[15]?.dimensionIndexList[0]?.score;
result[24].dimensionId = detail.value[16]?.dimensionId;
result[24].isChoose = !!detail.value[16]?.isChoose;
result[24].calculationFormula = detail.value[16]?.calculationFormula;
result[24].dimensionId = detail.value[16]?.dimensionIndexList[0]?.dimensionId;
result[24].id = detail.value[16]?.dimensionIndexList[0]?.id;
result[24].percentage = detail.value[16]?.dimensionIndexList[0]?.percentage;
result[24].score = detail.value[16]?.dimensionIndexList[0]?.score;
result[25].dimensionId = detail.value[17]?.dimensionId;
result[25].isChoose = !!detail.value[17]?.isChoose;
result[25].calculationFormula = detail.value[17]?.calculationFormula;
result[25].dimensionId = detail.value[17]?.dimensionIndexList[0]?.dimensionId;
result[25].id = detail.value[17]?.dimensionIndexList[0]?.id;
result[25].percentage = detail.value[17]?.dimensionIndexList[0]?.percentage;
result[25].score = detail.value[17]?.dimensionIndexList[0]?.score;
// <>6
result[26].dimensionId = detail.value[18]?.dimensionId;
result[26].isChoose = !!detail.value[18]?.isChoose;
result[27].dimensionId = detail.value[19]?.dimensionId;
result[27].isChoose = !!detail.value[19]?.isChoose;
result[27].calculationFormula = detail.value[19]?.calculationFormula;
result[27].dimensionId = detail.value[19]?.dimensionIndexList[0]?.dimensionId;
result[27].id = detail.value[19]?.dimensionIndexList[0]?.id;
result[27].percentage = detail.value[19]?.dimensionIndexList[0]?.percentage;
result[27].score = detail.value[19]?.dimensionIndexList[0]?.score;
result[28].dimensionId = detail.value[20]?.dimensionId;
result[28].isChoose = !!detail.value[20]?.isChoose;
result[28].calculationFormula = detail.value[20]?.calculationFormula;
result[28].dimensionId = detail.value[20]?.dimensionIndexList[0]?.dimensionId;
result[28].id = detail.value[20]?.dimensionIndexList[0]?.id;
result[28].percentage = detail.value[20]?.dimensionIndexList[0]?.percentage;
result[28].score = detail.value[20]?.dimensionIndexList[0]?.score;
result[29].dimensionId = detail.value[21]?.dimensionId;
result[29].isChoose = !!detail.value[21]?.isChoose;
result[29].calculationFormula = detail.value[21]?.calculationFormula;
result[29].dimensionId = detail.value[21]?.dimensionIndexList[0]?.dimensionId;
result[29].id = detail.value[21]?.dimensionIndexList[0]?.id;
result[29].percentage = detail.value[21]?.dimensionIndexList[0]?.percentage;
result[29].score = detail.value[21]?.dimensionIndexList[0]?.score;
result[30].dimensionId = detail.value[22]?.dimensionId;
result[30].isChoose = !!detail.value[22]?.isChoose;
result[30].calculationFormula = detail.value[22]?.calculationFormula;
result[30].dimensionId = detail.value[22]?.dimensionIndexList[0]?.dimensionId;
result[30].id = detail.value[22]?.dimensionIndexList[0]?.id;
result[30].percentage = detail.value[22]?.dimensionIndexList[0]?.percentage;
result[30].score = detail.value[22]?.dimensionIndexList[0]?.score;
result[31].dimensionId = detail.value[23]?.dimensionId;
result[31].isChoose = !!detail.value[23]?.isChoose;
result[31].calculationFormula = detail.value[23]?.calculationFormula;
result[31].dimensionId = detail.value[23]?.dimensionIndexList[0]?.dimensionId;
result[31].id = detail.value[23]?.dimensionIndexList[0]?.id;
result[31].percentage = detail.value[23]?.dimensionIndexList[0]?.percentage;
result[31].score = detail.value[23]?.dimensionIndexList[0]?.score;
result[32].dimensionId = detail.value[24]?.dimensionId;
result[32].isChoose = !!detail.value[24]?.isChoose;
result[32].calculationFormula = detail.value[24]?.calculationFormula;
result[32].dimensionId = detail.value[24]?.dimensionIndexList[0]?.dimensionId;
result[32].id = detail.value[24]?.dimensionIndexList[0]?.id;
result[32].percentage = detail.value[24]?.dimensionIndexList[0]?.percentage;
result[32].score = detail.value[24]?.dimensionIndexList[0]?.score;
// <>5
result[33].dimensionId = detail.value[25]?.dimensionId;
result[33].isChoose = !!detail.value[25]?.isChoose;
result[34].dimensionId = detail.value[26]?.dimensionId;
result[34].isChoose = !!detail.value[26]?.isChoose;
result[34].calculationFormula = detail.value[26]?.calculationFormula;
result[34].dimensionId = detail.value[26]?.dimensionIndexList[0]?.dimensionId;
result[34].id = detail.value[26]?.dimensionIndexList[0]?.id;
result[34].percentage = detail.value[26]?.dimensionIndexList[0]?.percentage;
result[34].score = detail.value[26]?.dimensionIndexList[0]?.score;
result[35].dimensionId = detail.value[27]?.dimensionId;
result[35].isChoose = !!detail.value[27]?.isChoose;
result[35].calculationFormula = detail.value[27]?.calculationFormula;
result[35].dimensionId = detail.value[27]?.dimensionIndexList[0]?.dimensionId;
result[35].id = detail.value[27]?.dimensionIndexList[0]?.id;
result[35].percentage = detail.value[27]?.dimensionIndexList[0]?.percentage;
result[35].score = detail.value[27]?.dimensionIndexList[0]?.score;
result[36].dimensionId = detail.value[28]?.dimensionId;
result[36].isChoose = !!detail.value[28]?.isChoose;
result[36].calculationFormula = detail.value[28]?.calculationFormula;
result[36].dimensionId = detail.value[28]?.dimensionIndexList[0]?.dimensionId;
result[36].id = detail.value[28]?.dimensionIndexList[0]?.id;
result[36].percentage = detail.value[28]?.dimensionIndexList[0]?.percentage;
result[36].score = detail.value[28]?.dimensionIndexList[0]?.score;
result[37].dimensionId = detail.value[29]?.dimensionId;
result[37].isChoose = !!detail.value[29]?.isChoose;
result[37].calculationFormula = detail.value[29]?.calculationFormula;
result[37].dimensionId = detail.value[29]?.dimensionIndexList[0]?.dimensionId;
result[37].id = detail.value[29]?.dimensionIndexList[0]?.id;
result[37].percentage = detail.value[29]?.dimensionIndexList[0]?.percentage;
result[37].score = detail.value[29]?.dimensionIndexList[0]?.score;
result[38].dimensionId = detail.value[30]?.dimensionId;
result[38].isChoose = !!detail.value[30]?.isChoose;
result[38].calculationFormula = detail.value[30]?.calculationFormula;
result[38].dimensionId = detail.value[30]?.dimensionIndexList[0]?.dimensionId;
result[38].id = detail.value[30]?.dimensionIndexList[0]?.id;
result[38].percentage = detail.value[30]?.dimensionIndexList[0]?.percentage;
result[38].score = detail.value[30]?.dimensionIndexList[0]?.score;
// <>3
result[39].dimensionId = detail.value[31]?.dimensionId;
result[39].isChoose = !!detail.value[31]?.isChoose;
result[40].dimensionId = detail.value[32]?.dimensionId;
result[40].isChoose = !!detail.value[32]?.isChoose;
result[40].id = detail.value[32].dimensionIndexList[0]?.id;
result[40].dimensionId = detail.value[32].dimensionIndexList[0]?.dimensionId;
result[40].score = detail.value[32].dimensionIndexList[0]?.score;
result[41].id = detail.value[32].dimensionIndexList[1]?.id;
result[41].dimensionId = detail.value[32].dimensionIndexList[1]?.dimensionId;
result[41].score = detail.value[32].dimensionIndexList[1]?.score;
result[42].id = detail.value[32].dimensionIndexList[2]?.id;
result[42].dimensionId = detail.value[32].dimensionIndexList[2]?.dimensionId;
result[42].score = detail.value[32].dimensionIndexList[2]?.score;
result[43].dimensionId = detail.value[33]?.dimensionId;
result[43].isChoose = !!detail.value[33]?.isChoose;
result[43].id = detail.value[33].dimensionIndexList[0]?.id;
result[43].dimensionId = detail.value[33].dimensionIndexList[0]?.dimensionId;
result[43].score = detail.value[33].dimensionIndexList[0]?.score;
result[44].id = detail.value[33].dimensionIndexList[1]?.id;
result[44].dimensionId = detail.value[33].dimensionIndexList[1]?.dimensionId;
result[44].score = detail.value[33].dimensionIndexList[1]?.score;
result[45].id = detail.value[33].dimensionIndexList[2]?.id;
result[45].dimensionId = detail.value[33].dimensionIndexList[2]?.dimensionId;
result[45].score = detail.value[33].dimensionIndexList[2]?.score;
result[46].dimensionId = detail.value[34]?.dimensionId;
result[46].isChoose = !!detail.value[34]?.isChoose;
result[46].id = detail.value[34].dimensionIndexList[0]?.id;
result[46].dimensionId = detail.value[34].dimensionIndexList[0]?.dimensionId;
result[46].score = detail.value[34].dimensionIndexList[0]?.score;
result[47].id = detail.value[34].dimensionIndexList[1]?.id;
result[47].dimensionId = detail.value[34].dimensionIndexList[1]?.dimensionId;
result[47].score = detail.value[34].dimensionIndexList[1]?.score;
result[48].id = detail.value[34].dimensionIndexList[2]?.id;
result[48].dimensionId = detail.value[34].dimensionIndexList[2]?.dimensionId;
result[48].score = detail.value[34].dimensionIndexList[2]?.score;
// <>2
result[49].dimensionId = detail.value[35]?.dimensionId;
result[49].isChoose = !!detail.value[35]?.isChoose;
result[50].dimensionId = detail.value[36]?.dimensionId;
result[50].isChoose = !!detail.value[36]?.isChoose;
result[50].calculationFormula = detail.value[36]?.calculationFormula;
result[50].dimensionId = detail.value[36]?.dimensionIndexList[0]?.dimensionId;
result[50].id = detail.value[36]?.dimensionIndexList[0]?.id;
result[50].percentage = detail.value[36]?.dimensionIndexList[0]?.percentage;
result[50].score = detail.value[36]?.dimensionIndexList[0]?.score;
result[51].dimensionId = detail.value[37]?.dimensionId;
result[51].isChoose = !!detail.value[37]?.isChoose;
result[51].calculationFormula = detail.value[37]?.calculationFormula;
result[51].dimensionId = detail.value[37]?.dimensionIndexList[0]?.dimensionId;
result[51].id = detail.value[37]?.dimensionIndexList[0]?.id;
result[51].percentage = detail.value[37]?.dimensionIndexList[0]?.percentage;
result[51].score = detail.value[37]?.dimensionIndexList[0]?.score;
}
list.value = result;
};
//
const getDetail = async () => {
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) {}
} else {
getConfig();
detail.value = [];
form.description = '';
form.scoreCardName = '';
form.scoringObject = 0;
}
};
onMounted(getDetail);
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) {
list.value[1].isChoose = c;
list.value[4].isChoose = c;
list.value[7].isChoose = c;
list.value[10].isChoose = c;
} else if (i === 13) {
list.value[14].isChoose = c;
list.value[15].isChoose = c;
list.value[16].isChoose = c;
list.value[17].isChoose = c;
} else if (i === 18) {
list.value[19].isChoose = c;
list.value[20].isChoose = c;
list.value[21].isChoose = c;
list.value[22].isChoose = c;
list.value[23].isChoose = c;
list.value[24].isChoose = c;
list.value[25].isChoose = c;
} else if (i === 26) {
list.value[27].isChoose = c;
list.value[28].isChoose = c;
list.value[29].isChoose = c;
list.value[30].isChoose = c;
list.value[31].isChoose = c;
list.value[32].isChoose = c;
} else if (i === 33) {
list.value[34].isChoose = c;
list.value[35].isChoose = c;
list.value[36].isChoose = c;
list.value[37].isChoose = c;
list.value[38].isChoose = c;
} else if (i === 39) {
list.value[40].isChoose = c;
list.value[43].isChoose = c;
list.value[46].isChoose = c;
} else if (i === 49) {
list.value[50].isChoose = c;
list.value[51].isChoose = c;
}
};
//
const addRecord = async () => {
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));
list.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,
),
);
}
});
await addOperation({
...getIds(),
parentId: preIds,
lcJudgmentRuleReq: lcRule,
});
ElMessage.success('提交成功!');
syncVisible.value = false;
emit('close', 1);
};
//
const submit = async (synchronizeUpdate?: number) => {
if (!form.scoreCardName) return ElMessage.error('请输入评分卡名称');
const param = [];
list.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: list.value[i + 1].id ?? '',
dimensionId: list.value[i + 1].dimensionId ?? '',
recordName: list.value[i + 1].index ?? '',
score: list.value[i + 1].score,
percentage: list.value[i + 1].percentage,
},
{
id: list.value[i + 2].id ?? '',
dimensionId: list.value[i + 2].dimensionId ?? '',
recordName: list.value[i + 2].index ?? '',
score: list.value[i + 2].score,
percentage: list.value[i + 2].percentage,
},
);
temp.recordName = e.sub;
param.push(temp);
} else if (e.top) {
param.push(temp);
}
});
await saveCredit({
id: id.value,
...form,
...getIds(),
synchronizeUpdate,
dimensionOfTheRatingTableList: param,
});
addRecord();
};
const confirmSubmit = () => {
if (!form.scoreCardName) return ElMessage.error('请输入策略名称!');
syncVisible.value = true;
};
</script>
<style lang="scss" scoped>
@import url(../../../../styles/form.scss);
</style>

@ -0,0 +1,164 @@
<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="scoreCardName"
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.strategyId ? '编辑' : '新增') + '企业信用评分策略'"
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 { listCredit, delCredit } 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: '',
});
const isDetail = ref<boolean>(false);
const i = ref<number>(0);
//
const getList = async () => {
loading.value = true;
try {
const { data } = await listCredit({ pageNum: currentPage.value, pageSize: pageSize.value, keyWord: keyWord.value, type: 1 });
list.value = data.records;
total.value = data.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.strategyId));
};
//
const toAdd = () => {
i.value++;
isDetail.value = false;
curRow.value = {
id: '',
};
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 delCredit({ ids });
getList();
ElMessage.success('删除成功!');
};
</script>

@ -40,7 +40,8 @@ const dynamicComponentMap = {
'154': defineAsyncComponent(() => import('./154/Index.vue')),
'155': defineAsyncComponent(() => import('./155/Index.vue')),
'156': defineAsyncComponent(() => import('./156/Index.vue')),
'148': defineAsyncComponent(() => import('./Credit.vue')),
'512': defineAsyncComponent(() => import('./512/Index.vue')),
'513': defineAsyncComponent(() => import('./513/Index.vue')),
'702': defineAsyncComponent(() => import('./Risk1.vue')),
'703': defineAsyncComponent(() => import('./Risk2.vue')),
'704': defineAsyncComponent(() => import('./Risk3.vue')),

Loading…
Cancel
Save