|
|
@@ -102,6 +102,9 @@ import { formatDate } from '@/utils/date';
|
|
|
import { HOME_NAV_LIST } from '@/constants';
|
|
|
import { useFundApi, useExpenseRemindApi } from '@/api/fund';
|
|
|
import { useSystemApi } from '@/api/system';
|
|
|
+import { useExecutionApi } from '@/api/execution';
|
|
|
+import { useProjectApi } from '@/api/project';
|
|
|
+import to from 'await-to-js';
|
|
|
import * as dd from 'dingtalk-jsapi';
|
|
|
|
|
|
const userStore = useUserStore();
|
|
|
@@ -110,6 +113,8 @@ const todoStore = useTodoStore();
|
|
|
const fundApi = useFundApi();
|
|
|
const expenseRemindApi = useExpenseRemindApi();
|
|
|
const systemApi = useSystemApi();
|
|
|
+const executionApi = useExecutionApi();
|
|
|
+const projectApi = useProjectApi();
|
|
|
|
|
|
/**
|
|
|
* 状态变量定义
|
|
|
@@ -171,8 +176,51 @@ const getExpendseList = async () => {
|
|
|
* 根据待办事项的属性跳转到相应的详情页面
|
|
|
* @param item 待办事项对象
|
|
|
*/
|
|
|
-const handleApprove = (item: TodoItem) => {
|
|
|
- onRouterPush(`/pages/todo/detail?mode=approval&id=${item.id || ''}&taskId=${item.taskId || ''}&taskCode=${item.businessCode || ''}&defCode=${item.defCode || ''}`);
|
|
|
+const handleApprove = async (item: TodoItem) => {
|
|
|
+ // 审批前增加学术不端行为校验
|
|
|
+ uni.showLoading({ title: '校验中...', mask: true });
|
|
|
+
|
|
|
+ // 1. 获取参与者列表,找出发起人
|
|
|
+ const [err, res] = await to(executionApi.getParticipantByProcInstID({ id: item.id }));
|
|
|
+
|
|
|
+ if (err || !res?.data) {
|
|
|
+ uni.hideLoading();
|
|
|
+ // 如果获取失败,出于流程通畅考虑,直接跳转
|
|
|
+ onRouterPush(`/pages/todo/detail?mode=approval&id=${item.id || ''}&taskId=${item.taskId || ''}&taskCode=${item.businessCode || ''}&defCode=${item.defCode || ''}`);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const participants = res.data as any[];
|
|
|
+ const startUser = participants.find(p => p.type === 'start');
|
|
|
+ const startUserId = startUser?.userId;
|
|
|
+
|
|
|
+ if (!startUserId) {
|
|
|
+ uni.hideLoading();
|
|
|
+ onRouterPush(`/pages/todo/detail?mode=approval&id=${item.id || ''}&taskId=${item.taskId || ''}&taskCode=${item.businessCode || ''}&defCode=${item.defCode || ''}`);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2. 调用学术不端校验接口
|
|
|
+ const [err2, res2] = await to(projectApi.checkUserViolationStatus({ personId: startUserId }));
|
|
|
+ uni.hideLoading();
|
|
|
+
|
|
|
+ if (!err2 && res2?.data?.hasViolation) {
|
|
|
+ const { restrictions } = res2.data;
|
|
|
+ let restrictionList = [];
|
|
|
+ if (restrictions.limitProjectApply) restrictionList.push('限制项目申报');
|
|
|
+ if (restrictions.limitFundApply) restrictionList.push('限制申请经费');
|
|
|
+ if (restrictions.limitRewardApply) restrictionList.push('限制成为奖励对象');
|
|
|
+
|
|
|
+ uni.showModal({
|
|
|
+ title: '学术不端行为提醒',
|
|
|
+ content: `发起人 [${startUser?.userName || '未知'}] 存在学术不端记录,已被限制:${restrictionList.join('、')}。`,
|
|
|
+ confirmText: '我知道了',
|
|
|
+ showCancel: false
|
|
|
+ });
|
|
|
+ // 不跳转
|
|
|
+ } else {
|
|
|
+ onRouterPush(`/pages/todo/detail?mode=approval&id=${item.id || ''}&taskId=${item.taskId || ''}&taskCode=${item.businessCode || ''}&defCode=${item.defCode || ''}`);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
/**
|