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
import { Modal, Spin, Form, Input, message } from 'antd';
import { useState, useEffect } from 'react';
import { getHistoryFormDetail, getTaskDefinition } from '../../../Services';
import AuditButton from '@/webPublic/FormInsertDiy/AuditButton';
import RenderForm from '../../RenderForm';
const TextArea = Input.TextArea;
function AuditModal({ form, selectRows, children, getPage, noNeedForm }) {
const [visible, setVisible] = useState(false);
function submitCb(res) {
// ModalInfo(`提交${res ? '成功' : '失败'}!`, { onOk: () => router.goBack() });
message.info(`提交${res ? '成功' : '失败'}!`);
setVisible(false);
getPage();
// 19684 优秀学生奖学金---班主任审核页面--弹框提醒优化处理 禅道bug
// ModalInfo(`提交${res ? '成功' : '失败'}!`, {
// onOk: () => {
// setVisible(false);
// getPage();
// },
// });
}
const [data, setData] = useState(null);
const [taskDefinition, setTaskDefinition] = useState({});
const [configNoNeedForm, setConfigNeedForm] = useState(true);
const [loading, setLoading] = useState(false);
useEffect(
() => {
if (!visible) {
return form.resetFields();
}
const code = selectRows && selectRows[0] && selectRows[0].code;
if (typeof code === 'undefined') return;
setLoading(true);
getHistoryFormDetail({ code }).then((res) => {
setLoading(false);
if (res && !res.errMsg) {
setData({ ...res, hisTaskForm: { ...res.hisTaskForm, formKeys: [] } });
getTaskDefinition({
appId: res.appId,
key: res.taskDefinitionKey,
}).then((res2) =>{
if(res2){
setTaskDefinition(res2);
if(res2.id && res2.formProperties){ // 从流程的配置项里面去取 批量审批时是否显示表单的配置项
let check = res2.formProperties.find((g) => g.name === 'batchAuditHiddenForm');
if(!check || check.expression !== 'true'){
setConfigNeedForm(false);
}
}else{
setConfigNeedForm(false);
}
}
});
}
});
},
[visible],
);
const footer = data ? (
<div style={{ padding: 16, textAlign: 'center' }}>
<AuditButton
data={data} // 为 'affair/getIdFormDetail' 接口请求到的数据
callback={submitCb} // 提交完成后回调函数
form={form} // form表单控件
selectRows={selectRows}
taskIds={selectRows.map((i) => i.taskId)}
/>
</div>
) : null;
const { getFieldDecorator } = form;
return (
<>
<Modal
width={900}
visible={visible}
title="批量审核"
footer={footer}
onCancel={() => setVisible(false)}>
<Spin spinning={loading}>
{data && data.isHandle && !!data.taskFormKey && !noNeedForm && !configNoNeedForm ? (
<RenderForm
postData={data}
get="web"
isCg="no"
obj={data.hisTaskForm.formData}
table="new"
form={form}
/>
) : null}
<div>
<h3 style={{ padding: 12, paddingBottom: 0, fontWeight: 'bold' }}>审批说明:</h3>
<span style={{ display: 'block', textAlign: 'center' }}>
{getFieldDecorator('reason')(
<TextArea
placeholder="请输入审批理由"
style={{ width: '95%', margin: 12, height: 120, color: '#7F8B95' }}
/>,
)}
</span>
</div>
</Spin>
</Modal>
{children({ onShow: () => setVisible(true) })}
</>
);
}
export default Form.create()(AuditModal);