1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
import React from 'react';
import { openToast } from './components/Notification';
import { preHandle } from '@/webPublic/one_stop_public/utils/myutils';
import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { callbackSubmitData } from '@/webPublic/one_stop_public/models/callbackExamineProcess';
import { getModal } from '@/webPublic/one_stop_public/utils/utils';
import { isJSON } from '@/webPublic/one_stop_public/copy';
import beforeAuditSubmit from '@/webPublic/one_stop_public/utils/beforeAuditSubmit';
import beforeApplySubmit from '@/webPublic/one_stop_public/utils/beforeApplySubmit';
const Modal = getModal();
const must = (
<span
style={{
color: '#FF5350',
marginLeft: 5,
marginRight: 5,
}}>
*
</span>
);
// 检查是否启用表单校验
const checkNeedFormValidateFieldsAndScroll = ({ btns, btnValue }) => {
let btnInfo = btns.find((g) => g.value + '' === btnValue + '');
let checkSumbitInfo = true;
if (btnInfo && btnInfo.isValidateForm === false) {
checkSumbitInfo = false; // 23425 学生事务/学生违纪管理/违纪上报/审核,2013010255 学生处干事选择驳回 这些字段不用填
}
return checkSumbitInfo;
};
// 校验是否该按钮需要填写审批意见
const checkNeedWriteAuditInfo = ({ btns, btnValue }) => {
let btnInfo = btns.find((g) => g.value + '' === btnValue + '');
let needWrite = false;
if (btnInfo && isJSON(btnInfo?.documentation)) {
let documentation = JSON.parse(btnInfo.documentation);
if (documentation.needAuditInfo) {
needWrite = true; // 26589 毕业生毕业去向中签约和改签审核拒绝必须要填审批说明
}
}
return needWrite;
};
/**
* 流程审批 提交数据
* */
const submitValues = ({
values,
isCloseFlowPath,
radiovalue,
isSecond,
taskId,
code,
btnValue,
oldkey,
value,
checked,
setData,
data,
userInfo,
btns,
dispatch,
that,
handleUser,
}) => {
if (isCloseFlowPath) {
} else if (!radiovalue && isSecond) {
openToast('success', '请选择紧急度');
return;
}
that.setState(
{
isSumbitLoading: true,
},
() => {
preHandle(values); // 引入 import {preHandle} from '@/webPublic/one_stop_public/utils/myutils.js'
// console.log(JSON.stringify(values));
// return ;
let payload = {
taskIds: [taskId], // 接口里面的taskId 任务Id
// taskIds: [this.state.taskId], // 接口里面的taskId 任务Id
level: radiovalue && isSecond ? radiovalue : '', // 流程紧急度 可不传
// code: this.state.code, // 接口里面的code 为表单编号
code: code, // 接口里面的code 为表单编号
// 所有审核内容都在这里面
examineMap: JSON.stringify({
// 接口里面的btns数组, key值和value没有值问题后期已修复
// 是否同意 0同意 1拒绝
[oldkey]: btnValue, // 每个配置按钮对应的对象内容 oldkey = 接口中 key btnValue = 接口中 value
reason: value, // 审批理由
// code: this.state.code, // 接口里面的code 为表单编号
code: code, // 接口里面的code 为表单编号
sign: checked ? setData?.userSign : '', // 加签
}),
taskForm: JSON.stringify(values), // 审批表单的参数值
handleUser, // 表单处理人
apiData: data,
taskFormKey: data.taskFormKey,
userNowInfo: userInfo,
buttonInfo: btns && btns.length ? btns.find((x) => x.value === btnValue) : {},
token: getToken(),
};
payload = callbackSubmitData(payload);
const beforeAuditSubmitFunc = (valuesPayload = {}) => { // 提交数据到审批接口
beforeAuditSubmit(valuesPayload).then((resParams) => {
if (!resParams) {
that.setState({
isSumbitLoading: false,
});
return false;
} else {
dispatch({
type: 'affair/getExamineProcess',
payload: resParams,
callback: (val) => {
if (val) {
// that.getInit();
that.setState({
isHandle: false,
isSumbitLoading: false,
isSign: checked,
});
Modal.success({
title: '操作成功',
content: (
<div>
<p>操作成功,点击确认刷新页面!</p>
</div>
),
onOk: () => {
that.props.getFormDetailData();
},
okText: '确认',
});
} else {
openToast('error', '失败', '请稍后重试');
}
},
});
}
});
};
/**
* 29943 北电]违纪-违纪上报辅导员,驳回修改的处分不生效
* 27696 [黔南一站式1.0]单位申请数据撤销之后,就业管理员审核报错
* */
const taskInfo = that.state?.data?.taskInfo;
if (
btnValue === '0' && // 只有通过 或者同意 或者 提交 才能使用申请回调
Array.isArray(taskInfo) &&
taskInfo.length >= 2 &&
taskInfo[0].taskDefKey &&
taskInfo[0].taskDefKey === taskInfo[taskInfo.length - 1].taskDefKey
) {
console.log('驳回到发起人了,并且发起人重新提交了 则执行这个发起回调');
beforeApplySubmit({
appId: window.smartFormGlobalProps.data.appId,
content: payload.taskForm,
}).then((res) => {
if(!res){ // 如果返回false 中止提交.
that.setState({
isSumbitLoading: false,
});
return false;
}
if (res && res.content && isJSON(res.content)) {
payload.taskForm = res.content; // 替换表单数据
}
beforeAuditSubmitFunc(payload); // 提交数据到审批接口
});
} else {
beforeAuditSubmitFunc(payload); // 提交数据到审批接口
}
/**
* 29943 北电]违纪-违纪上报辅导员,驳回修改的处分不生效
* */
},
);
};
export { must, checkNeedFormValidateFieldsAndScroll, submitValues, checkNeedWriteAuditInfo };