diff --git a/.env b/.env index 97571e0..0c43f01 100644 --- a/.env +++ b/.env @@ -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_I18N_LOCALE=zh-cn VITE_I18N_FALLBACK_LOCALE=zh-cn diff --git a/src/api/bank.ts b/src/api/bank.ts index ea65645..4db4a51 100644 --- a/src/api/bank.ts +++ b/src/api/bank.ts @@ -18,3 +18,5 @@ export const riskById = async (id: number): Promise => (await axios.post(`/ export const examineAndApprove = async (id: number | string, opinionDescription: string, status: number, approvalTime: string): Promise => (await axios.post(`/product/product/bank/products/examineAndApprove?id=${id}&opinionDescription=${opinionDescription}&status=${status}&approvalTime=${approvalTime}`)).data; export const update = async (data: Record): Promise => (await axios.post(`/product/product/bank/products/update`, data)).data; +export const cancelCollection = async (id: number): Promise => (await axios.post(`/product/checkPointCollect/cancelCollection?favoriteId=${id}`)).data; +export const collect = async (data: Record): Promise => (await axios.post(`/product/checkPointCollect/collect`, data)).data; diff --git a/src/api/model.ts b/src/api/model.ts index b25a20c..0f359b8 100644 --- a/src/api/model.ts +++ b/src/api/model.ts @@ -2,35 +2,35 @@ import axios from '@/utils/request'; export const accessStrategyGovernmentBlacklistFind = async (checkpointId: number, projectId: number): Promise => (await axios.post(`/product/accessStrategyGovernmentBlacklist/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; -export const accessStrategyGovernmentBlacklistSave = async (data: Record[]): Promise => +export const accessStrategyGovernmentBlacklistSave = async (data: Record): Promise => (await axios.post(`/product/accessStrategyGovernmentBlacklist/saveOrUpdate`, data)).data; export const accessStrategyEnterpriseBlacklistFind = async (checkpointId: number, projectId: number): Promise => (await axios.post(`/product/accessStrategyEnterpriseBlacklist/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; -export const accessStrategyEnterpriseBlacklistSave = async (data: Record[]): Promise => +export const accessStrategyEnterpriseBlacklistSave = async (data: Record): Promise => (await axios.post(`/product/accessStrategyEnterpriseBlacklist/saveOrUpdate`, data)).data; export const accessStrategyAntiFraudStrategyFind = async (checkpointId: number, projectId: number): Promise => (await axios.post(`/product/accessStrategyAntiFraudStrategy/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; -export const accessStrategyAntiFraudStrategySave = async (data: Record[]): Promise => +export const accessStrategyAntiFraudStrategySave = async (data: Record): Promise => (await axios.post(`/product/accessStrategyAntiFraudStrategy/saveOrUpdate`, data)).data; export const accessStrategyBusinessBlacklistFind = async (checkpointId: number, projectId: number): Promise => (await axios.post(`/product/accessStrategyBusinessBlacklist/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; -export const accessStrategyBusinessBlacklistSave = async (data: Record[]): Promise => +export const accessStrategyBusinessBlacklistSave = async (data: Record): Promise => (await axios.post(`/product/accessStrategyBusinessBlacklist/saveOrUpdate`, data)).data; export const accessStrategyCreditBlacklistFind = async (checkpointId: number, projectId: number): Promise => (await axios.post(`/product/accessStrategyCreditBlacklist/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; -export const accessStrategyCreditBlacklistSave = async (data: Record[]): Promise => +export const accessStrategyCreditBlacklistSave = async (data: Record): Promise => (await axios.post(`/product/accessStrategyCreditBlacklist/saveOrUpdate`, data)).data; export const accessStrategyInlineBlacklistFind = async (checkpointId: number, projectId: number): Promise => (await axios.post(`/product/accessStrategyInlineBlacklist/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; -export const accessStrategyInlineBlacklistSave = async (data: Record[]): Promise => +export const accessStrategyInlineBlacklistSave = async (data: Record): Promise => (await axios.post(`/product/accessStrategyInlineBlacklist/saveOrUpdate`, data)).data; export const accessStrategyNegativeIndustryStrategyFind = async (checkpointId: number, projectId: number): Promise => (await axios.post(`/product/accessStrategyNegativeIndustryStrategy/details?checkpointId=${checkpointId}&projectId=${projectId}`)).data; -export const accessStrategyNegativeIndustryStrategySave = async (data: Record[]): Promise => +export const accessStrategyNegativeIndustryStrategySave = async (data: Record): Promise => (await axios.post(`/product/accessStrategyNegativeIndustryStrategy/saveOrUpdate`, data)).data; diff --git a/src/assets/images/role/icon/选择关卡/连接线/竖直.png b/src/assets/images/level/line3.png similarity index 100% rename from src/assets/images/role/icon/选择关卡/连接线/竖直.png rename to src/assets/images/level/line3.png diff --git a/src/utils/common.ts b/src/utils/common.ts index 2f0bb9e..3ae4443 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -132,3 +132,34 @@ export const handleId = ( type, }; }; + +/** + * 阿拉伯数字转化为中文数字 + */ +export const numToChinese = (num: number): string => { + const arr1 = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九']; + const arr2 = ['', '十', '百', '千', '万', '亿', '点', '']; + const a = `${num}`.replace(/(^0*)/g, '').split('.'); + let k = 0; + let re = ''; + for (let i = a[0].length - 1; i >= 0; i--) { + switch (k) { + case 0: + re = arr2[7] + re; + break; + case 4: + if (!new RegExp(`0{4}//d{${a[0].length - i - 1}}$`).test(a[0])) re = arr2[4] + re; + break; + case 8: + re = arr2[5] + re; + arr2[7] = arr2[5]; + k = 0; + break; + default: + } + if (k % 4 == 2 && a[0].charAt(i + 2) != 0 && a[0].charAt(i + 1) == 0) re = arr1[0] + re; + if (a[0].charAt(i) != 0) re = arr1[a[0].charAt(i)] + arr2[k % 4] + re; + k++; + } + return num > 9 && num < 20 ? re.slice(1) : re; +}; diff --git a/src/utils/getPageTitle.ts b/src/utils/getPageTitle.ts index 7fdb79a..97c7fd6 100644 --- a/src/utils/getPageTitle.ts +++ b/src/utils/getPageTitle.ts @@ -1,7 +1,7 @@ import defaultSettings from '@/settings'; import i18n from '@/i18n'; -const title = defaultSettings.title || 'UJCMS'; +const { title } = defaultSettings; export default function getPageTitle(pageTitle: string | undefined): string { if (pageTitle) { diff --git a/src/views/Home.vue b/src/views/Home.vue index c49d122..160170c 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -34,25 +34,32 @@ @click="selecLevel(item)"> LV.{{ i + 1 }}
-
第一关
-

{{ item.name }}

- 第{{ numToChinese(i + 1) }}关 +

{{ item.name.split(' ')[1] }}

+ + + alt="" + @click.stop="collectItem(item)" />
- - - -
import { ref, onMounted } from 'vue'; import { checkPointList } from '@/api/judgment'; +import { cancelCollection, collect } from '@/api/bank'; import Panel from '@/components/Panel/index.vue'; import { useRouter, useRoute } from 'vue-router'; import { ElMessage } from 'element-plus'; import { logout } from '@/store/useCurrentUser'; +import { numToChinese } from '@/utils/common'; import Cookies from 'js-cookie'; const router = useRouter(); const route = useRoute(); -const { token, referrer } = route.query; const collected = ref(false); const curLevel = ref(''); const levels = ref[]>([]); +const projectId = +Cookies.get('sand-projectId'); // 关卡列表 const getLevel = async () => { - const { data } = await checkPointList(1); + const { data } = await checkPointList(projectId); levels.value = data; }; // 点击关卡回调 const selecLevel = (item: Record) => { curLevel.value = item.id; }; +// 收藏 +const collectItem = async (item: Record) => { + if (item.collect) { + await cancelCollection(item.favoriteId); + } else { + await collect({ + checkPointId: item.id, + projectId, + }); + } + getLevel(); +}; // 确定 const toRole = () => { if (curLevel.value) { @@ -106,13 +127,18 @@ onMounted(() => { diff --git a/src/views/product/bank/Add.vue b/src/views/product/bank/Add.vue index c0b0d9a..9d094ea 100644 --- a/src/views/product/bank/Add.vue +++ b/src/views/product/bank/Add.vue @@ -449,10 +449,10 @@ const submit = async (formEl: FormInstance | undefined) => { param.id = id.value; param.status = 295; await update(param); - addRecord(param, id.value); + addRecord(param); } else { - const { message } = await save(param); - addRecord(param, message); + await save(param); + addRecord(param); } ElMessage.success('提交成功!'); emit('getList', 1); @@ -464,9 +464,9 @@ const submit = async (formEl: FormInstance | undefined) => { }); }; // 新增判分记录 -const addRecord = async (data: Record, newId: number) => { +const addRecord = async (data: Record) => { const isEnterprise = data.productType === 1; - const preIds = `1,${Cookies.get('sand-level')},41,${data.productType ? 45 : 44},${newId}`; // 1,关卡id,角色(这个页面是产品经理新增产品),个人/企业(44/45) + const preIds = `1,${Cookies.get('sand-level')},41,${data.productType ? 45 : 44}`; // 1,关卡id,角色(这个页面是产品经理新增产品),个人/企业(44/45) const lcRule = []>[ handleId(48, 1, data.productDefinition, preIds + ',48', 3), handleId(49, 2, data.productName, preIds + ',49', 3), diff --git a/src/views/product/bank/CardList.vue b/src/views/product/bank/CardList.vue index 28ec274..8a697b1 100644 --- a/src/views/product/bank/CardList.vue +++ b/src/views/product/bank/CardList.vue @@ -115,8 +115,7 @@ const handleDelete = async (id: number) => { } .products { li { - @apply relative p-5 pt-7 mb-5 rounded-[10px] cursor-pointer border border-solid; - background: url(../../assets/images/10.png) 0 0/100% 100% no-repeat; + @apply relative p-5 pt-7 mb-5 rounded-[10px] cursor-pointer border border-solid border-[transparent] bg-[url('@/assets/images/10.png')] bg-no-repeat; &.active { @apply border-[#CAE0FF]; } diff --git a/src/views/product/bank/Config.vue b/src/views/product/bank/Config.vue index da4968e..c6b8de6 100644 --- a/src/views/product/bank/Config.vue +++ b/src/views/product/bank/Config.vue @@ -530,10 +530,10 @@ const submit = async (formEl: FormInstance | undefined) => { if (info.value.riskControlDetails) { param.id = info.value.riskControlDetails.id; await riskUpdate(param); - addRecord(param, id.value); + addRecord(param); } else { - const { message } = await riskSave(param); - addRecord(param, message); + await riskSave(param); + addRecord(param); } ElMessage.success('提交成功!'); @@ -546,9 +546,9 @@ const submit = async (formEl: FormInstance | undefined) => { }); }; // 新增判分记录 -const addRecord = async (data: Record, newId: number) => { +const addRecord = async (data: Record) => { const isEnterprise = info.value.productType === 1; - const preIds = `1,${Cookies.get('sand-level')},42,${data.productType ? 71 : 70},${newId}`; // 1,关卡id,角色(这个页面是风控经理配置风控),个人/企业(70/71) + const preIds = `1,${Cookies.get('sand-level')},42,${data.productType ? 71 : 70}`; // 1,关卡id,角色(这个页面是风控经理配置风控),个人/企业(70/71) const lcRule = []>[]; // 企业 diff --git a/src/views/product/strategy/150.vue b/src/views/product/strategy/150.vue index 3f655a3..6b50038 100644 --- a/src/views/product/strategy/150.vue +++ b/src/views/product/strategy/150.vue @@ -122,12 +122,13 @@ import { useRouter, useRoute } from 'vue-router'; import { handleId } from '@/utils/common'; import Cookies from 'js-cookie'; -const emit = defineEmits(['getList']); - const router = useRouter(); const route = useRoute(); +const projectId = +Cookies.get('sand-projectId'); +const levelId = +Cookies.get('sand-level'); const id = computed(() => +route.query.id); const form = ref[]>([]); +const info = ref[]>([]); const height = window.innerHeight - 270; const symbols = []>[ { @@ -151,28 +152,39 @@ const getConfig = async () => { const { process } = await getProcessInformationBasedOnRoles(150); const result = []; process.map((e) => { + const cur = info.value.find((n) => n.stRecordId === e.id); + let num = cur?.ruleOne.match(/\d+/g); + let symbol = cur?.ruleOne.match(/[<>=]+/g); + let had = cur?.ruleOne.match(/[有无]+/g); let temp = { - checkpointId: 1, - projectId: 1, + checkpointId: Cookies.get('sand-level'), + projectId: Cookies.get('sand-projectId'), name: e.name, recordChildren: e.recordChildren, isRule: isRule(e.id) ? 1 : 0, - corporateMajorityHitRejected: false, - mateHitRejected: false, - otherFamilyMembersHitRejected: false, - parentsHitRejected: false, - personalHitBlacklist: false, - symbol: '>=', - had: '', - num: '', + corporateMajorityHitRejected: !!cur?.corporateMajorityHitRejected, + mateHitRejected: !!cur?.mateHitRejected, + otherFamilyMembersHitRejected: !!cur?.otherFamilyMembersHitRejected, + parentsHitRejected: !!cur?.parentsHitRejected, + personalHitBlacklist: !!cur?.personalHitBlacklist, + symbol: isRule(e.id) ? symbol[0] : '>=', + had: e.id === 167 && had.length ? had[0] : '', + num: isRule(e.id) && num?.length ? num[0] : '', ruleOne: '', ruleTwo: '', + subjectId: e.subjectId, stRecordId: e.id, }; result.push(temp); if (isRule(e.id)) { temp = JSON.parse(JSON.stringify(temp)); temp.span = 1; + + num = cur?.ruleTwo.match(/\d+/g); + if (num?.length) temp.num = num[0]; + symbol = cur?.ruleTwo.match(/[<>=]+/g); + if (symbol?.length) temp.symbol = symbol[0]; + if (e.id === 167) temp.had = cur?.ruleTwo; result.push(temp); } }); @@ -182,18 +194,18 @@ const getConfig = async () => { const getDetail = async () => { if (id.value) { try { - const { data } = await accessStrategyGovernmentBlacklistFind(1, 1); - // info.value = data; + const { data } = await accessStrategyGovernmentBlacklistFind(levelId, projectId); + info.value = data; getConfig(); } finally { } } }; + watch( () => route.query, () => { - // getDetail(); - getConfig(); + getDetail(); }, { immediate: true, @@ -226,11 +238,11 @@ const span = ({ row, column, rowIndex, columnIndex }: SpanMethodProps) => { } } }; -onMounted(() => {}); // 提交 const submit = async () => { let param = JSON.parse(JSON.stringify(form.value)); param.map((e, i) => { + if (info.value.length) e.id = info.value.find((n) => n.stRecordId === e.stRecordId)?.id; e.corporateMajorityHitRejected = +e.corporateMajorityHitRejected; e.mateHitRejected = +e.mateHitRejected; e.otherFamilyMembersHitRejected = +e.otherFamilyMembersHitRejected; @@ -256,22 +268,25 @@ const submit = async () => { const recordParam = JSON.parse(JSON.stringify(param)); param.map((e) => { delete e.recordChildren; + delete e.had; + delete e.name; + delete e.symbol; + delete e.num; }); - const { message } = await accessStrategyGovernmentBlacklistSave(recordParam); - // addRecord(param, message); - + await accessStrategyGovernmentBlacklistSave({ governmentBlacklistList: param }); + addRecord(recordParam); + getDetail(); ElMessage.success('提交成功!'); - emit('getList', 1); }; // 新增判分记录 -const addRecord = async (data: Record, newId: number) => { - const preIds = `1,${Cookies.get('sand-level')},42,${newId}`; // 1,关卡id,角色(这个页面是风控经理策略) +const addRecord = async (data: Record) => { + const preIds = `1,${Cookies.get('sand-level')},42,67,147,150`; // 1,关卡id,角色(这个页面是风控经理策略) const rule = []>[]; data.map((e, i) => { - if (e.stRecordId == 161 || e.stRecordId == 164) { - e.recordChildren.map((n, j) => { - rule.push(handleId(n.id, e.subjectId, j ? e.ruleTwo : e.ruleOne, preIds + ',' + e.id + ',' + n.id, 5)); + if (isRule(e.stRecordId)) { + e?.recordChildren.map((n, j) => { + rule.push(handleId(n.id, e.subjectId, j ? e.ruleTwo : e.ruleOne, preIds + ',' + e.stRecordId + ',' + n.id, 5)); }); } @@ -281,13 +296,13 @@ const addRecord = async (data: Record, newId: number) => { e.parentsHitRejected && temp.push(302); e.otherFamilyMembersHitRejected && temp.push(303); e.corporateMajorityHitRejected && temp.push(304); - rule.push(handleId(e.id, e.subjectId, temp.join(), preIds + ',' + e.id, 1)); + rule.push(handleId(e.stRecordId, e.subjectId, temp.join(), preIds + ',' + e.stRecordId, 1)); }); await addOperation({ parentId: preIds, lcJudgmentRuleReq: rule, - projectId: 1, + projectId, }); }; diff --git a/src/views/product/strategy/151.vue b/src/views/product/strategy/151.vue index 0c213b2..a698234 100644 --- a/src/views/product/strategy/151.vue +++ b/src/views/product/strategy/151.vue @@ -86,19 +86,19 @@ diff --git a/src/views/product/strategy/CardList.vue b/src/views/product/strategy/CardList.vue index c0f7a4d..30d2859 100644 --- a/src/views/product/strategy/CardList.vue +++ b/src/views/product/strategy/CardList.vue @@ -18,8 +18,7 @@
- +
@@ -96,8 +95,7 @@ const tabChange = (tab: TabsPaneContext, event: Event) => { } .products { li { - @apply relative p-5 mb-5 rounded-[10px] cursor-pointer border border-solid; - background: url(../../assets/images/10.png) 0 0/100% 100% no-repeat; + @apply relative p-5 pt-7 mb-5 rounded-[10px] cursor-pointer border border-solid border-[transparent] bg-[url('@/assets/images/10.png')] bg-[length:100%_100%] bg-no-repeat; &.active { @apply border-[#CAE0FF]; }