From 11f0d25d8910a6ba97aad36171cf6f12d962613e Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 26 Jan 2024 15:58:01 +0800 Subject: [PATCH] fix --- src/components/Panel/index.vue | 80 +++++++++++++++++++++++---- src/views/config/level/Index.vue | 2 +- src/views/product/bank/Approve.vue | 8 --- src/views/product/bank/Config.vue | 10 ++-- src/views/product/strategy/Credit.vue | 2 +- 5 files changed, 75 insertions(+), 27 deletions(-) diff --git a/src/components/Panel/index.vue b/src/components/Panel/index.vue index a0c1963..6e7337e 100644 --- a/src/components/Panel/index.vue +++ b/src/components/Panel/index.vue @@ -300,6 +300,8 @@ if (param.token) { Cookies.set('sand-resultAnnouncementTime', param.resultAnnouncementTime ?? ''); Cookies.set('sand-curriculumName', param.curriculumName ?? ''); Cookies.set('sand-stopTime', param.stopTime ?? ''); + Cookies.set('sand-userId', param.userId ?? ''); + Cookies.set('sand-account', param.account ?? ''); Cookies.set('sand-admin', param.admin ?? ''); // 从中台进来的标识 Cookies.remove('sand-submit'); router.replace(route.path); @@ -319,6 +321,8 @@ if (param.token) { param.resultAnnouncementTime = Cookies.get('sand-resultAnnouncementTime'); param.curriculumName = Cookies.get('sand-curriculumName'); param.stopTime = Cookies.get('sand-stopTime'); + param.userId = Cookies.get('sand-userId'); + param.account = Cookies.get('sand-account'); isSubmit.value = Cookies.get('sand-submit') === 'true'; } if (param.projectId) param.projectId = +param.projectId; @@ -412,12 +416,15 @@ const getAssStatus = async () => { if (!isSubmit.value) { const { data } = await getDetailById(param.assessmentId); const done = data ? data.status === 2 : false; // 状态(0、待开始 1、进行中 2、已结束) - // 如果考核已结束,则清除查询考核状态的定时器,并且自动提交 + // 如果考核已结束,自动提交 if (done) { - // this.$alert('考核时间已到,系统已自动交卷', '提示', { - // confirmButtonText: '确定', - // }); submit(); + ElMessageBox.alert(`考核时间已到,系统已自动交卷`, '提示', { + confirmButtonText: '确定', + callback: (action: Action) => { + logout(); + }, + }); } } }; @@ -434,9 +441,12 @@ const getCompetitionStatus = async () => { const now = await getNow(); // 如果已经结束 if (now >= endTime) { - // this.$alert('竞赛时间已到,系统已自动交卷', '提示', { - // confirmButtonText: '确定', - // }); + ElMessageBox.alert(`竞赛时间已到,系统已自动交卷`, '提示', { + confirmButtonText: '确定', + callback: (action: Action) => { + logout(); + }, + }); submit(); } else { // 没结束,则显示倒计时 @@ -533,12 +543,16 @@ const submit = async () => { // 非练习 per.value && - ElMessageBox.alert(`提交成功${param.resultsDetails == 0 && param.resultAnnouncementTime != 0 ? ',成绩将在' + param.resultAnnouncementTime + '小时后发布,请去参赛信息模块查看' : ''}`, '提示', { - confirmButtonText: '确定', - callback: (action: Action) => { - logout(); + ElMessageBox.alert( + `提交成功${param.resultsDetails == 0 && param.resultAnnouncementTime != 0 ? ',成绩将在' + param.resultAnnouncementTime + '小时后发布,请去参赛信息模块查看' : ''}`, + '提示', + { + confirmButtonText: '确定', + callback: (action: Action) => { + logout(); + }, }, - }); + ); }) .catch(() => { submiting.value = false; @@ -598,6 +612,46 @@ const getEntryTime = async () => { if (!now) now = await getNow(); entryTime.value = now; }; + +// websocket获取考核及竞赛信息,用于自动提交 +// socket连接成功 +const open = () => { + console.log('socket连接成功'); +}; +// socket连接失败 +const error = () => { + console.log('连接错误'); +}; +// 接收消息 +const getMessage = (msg) => { + console.log('==websocket接收数据=='); + console.log(JSON.parse(msg.data)); + const { content } = JSON.parse(msg.data); + // 1赛事、2创业、3考核、4模型。-号拼接携带id + if (content == 1) { + getCompetitionStatus(); + } else if (content.includes('3-')) { + // 考核:3-考核id + getAssStatus(); + } +}; +// 关闭socket +const close = () => { + console.log('socket已经关闭'); +}; +// 初始化socket +const initSocket = () => { + // 实例化socket + const socket = new WebSocket(`ws://${location.host}/nakadai/websocket/${param.userId}/${param.account}`); + // this.socket = new WebSocket(`ws://121.37.12.51:9100/nakadai/websocket/${id}/${account}`) + // 监听socket连接 + socket.onopen = open; + // 监听socket错误信息 + socket.onerror = error; + // 监听socket消息 + socket.onmessage = getMessage; +}; + onMounted(() => { getLevel.value = inject('getLevel'); // 关卡页面获取关卡方法 per.value = param.assessmentId ? 1 : param.competitionId ? 2 : 0; @@ -605,10 +659,12 @@ onMounted(() => { param.cid && getEntryTime(); if (param.assessmentId) { + initSocket(); getAssList(); } else { param.cid && getList(); if (param.competitionId) { + initSocket(); getCompetitionStatus(); } } diff --git a/src/views/config/level/Index.vue b/src/views/config/level/Index.vue index 748b7de..f677d9b 100644 --- a/src/views/config/level/Index.vue +++ b/src/views/config/level/Index.vue @@ -169,7 +169,7 @@ const route = useRoute(); const projectId = +Cookies.get('sand-projectId'); const levelId = +Cookies.get('sand-level'); const hadChange = ref(0); -const delTitle: string = '删除关卡后,这个关卡的数据将被删除,确定删除吗?'; +const delTitle: string = '删除关卡后,已关联该关卡的判分点将被禁用,确定删除吗?'; const params = reactive({ platformId: 3, customsPassName: '', diff --git a/src/views/product/bank/Approve.vue b/src/views/product/bank/Approve.vue index 95e7472..e1d93a0 100644 --- a/src/views/product/bank/Approve.vue +++ b/src/views/product/bank/Approve.vue @@ -97,13 +97,6 @@ const getConfig = async () => { const { process } = await getProcessInformationBasedOnRoles(43); // 专家委员会43 config.value = process; }; -// 获取操作日期 -const getDate = async () => { - const res = await getOperationTime(levelId, projectId); - if (res.operationTime) { - date.value = res.operationTime; - } -}; // 签章 const sign = async () => { const res = await getTheCurrentUserName(); @@ -145,7 +138,6 @@ const submit = async (formEl: FormInstance | undefined) => { }; onMounted(() => { getConfig(); - getDate(); }); diff --git a/src/views/product/bank/Config.vue b/src/views/product/bank/Config.vue index abe329c..07e6eb2 100644 --- a/src/views/product/bank/Config.vue +++ b/src/views/product/bank/Config.vue @@ -219,12 +219,12 @@ 所有基本信息 + :label="info.productType ? 261 : 114">{{ info.productType ? '所有基本信息' : '所有基本材料' }} 《用信调查申报表》 + :label="info.productType ? 262 : 115">《用信调查申报表》
@@ -232,12 +232,12 @@ 以上所有材料 + :label="info.productType ? 263 : 116">以上所有材料 《用信调查申报表》 + :label="info.productType ? 264 : 117">《用信调查申报表》
@@ -565,7 +565,7 @@ const addRecord = async (data: Record) => { data.riskDegreeStrategy && lcRule.push(handleId(130, 54, data.riskDegreeStrategy, preIds + ',114,130', 1)); data.interestRatePricingModelCheck && lcRule.push(handleId(305, 55, data.interestRatePricingModel, preIds + ',114,131,305', 1)); - data.individualInterestRateModel && lcRule.push(handleId(763, 305, data.individualInterestRateModel, preIds + ',114,131,304', 1)); + data.individualInterestRateModel && lcRule.push(handleId(304, 305, data.individualInterestRateModel, preIds + ',114,131,304', 1)); data.dueDiligenceMode && lcRule.push(handleId(132, 56, data.dueDiligenceMode, preIds + ',115,132', 1)); data.dueDiligenceContent && lcRule.push(handleId(133, 57, data.dueDiligenceContent, preIds + ',115,133', 1)); diff --git a/src/views/product/strategy/Credit.vue b/src/views/product/strategy/Credit.vue index e152c26..3342278 100644 --- a/src/views/product/strategy/Credit.vue +++ b/src/views/product/strategy/Credit.vue @@ -905,7 +905,7 @@ const addRecord = async () => { 1, ), ); - + console.log(111, e, e?.recordChildren[2]?.id); // 分值里的下拉选择百分比 e.percentage && lcRule.push(