提交 8f9c8bd9 authored 作者: 钟是志's avatar 钟是志

Merge remote-tracking branch 'origin/master'

......@@ -20,7 +20,8 @@ function AuditButton(props) {
const [affairOkParams, setAffairParams] = useState({});
function affairOk() {
const { dispatch, callback, data, form } = props;
// 有taskIds属性时,是批量审核,
const { dispatch, callback, data, form, taskIds } = props;
const { oldKey, btnValue } = affairOkParams;
form.validateFieldsAndScroll((err, values) => {
......@@ -30,13 +31,13 @@ function AuditButton(props) {
dispatch({
type: 'affair/getExamineProcess',
payload: {
taskIds: [data.taskId], // 接口里面的taskId 任务Id
code: data.code,
taskIds: taskIds || [data.taskId], // 接口里面的taskId 任务Id
code: taskIds ? undefined : data.code,
// 审核相关内容
examineMap: JSON.stringify({
[oldKey]: btnValue, // 每个配置按钮对应的对象内容 oldkey = 接口中 key btnValue = 接口中 value
// reason: value, // 审批理由
code: data.code,
code: taskIds ? undefined : data.code,
}),
taskForm: JSON.stringify(values), // 审批表单的参数值
},
......
import { Modal, Spin, Form } from 'antd';
import { useState, useEffect } from 'react';
import styles from '../../RenderForm/index.less';
import { getHistoryFormDetail } from '../../../Services';
import AuditButton from '@/webPublic/FormInsertDiy/AuditButton';
import HistoryForm from '@/webPublic/FormInsertDiy/HistoryForm';
import ButtonDiy from '@/baseComponent/ButtonDiy';
import { ModalInfo } from '@/baseComponent/Modal';
import { router } from 'umi';
const isNewForm = true;
function AuditModal({ form, selectRows, code, getPage }) {
const [visible, setVisible] = useState(false);
const disabled = !selectRows || !Array.isArray(selectRows) || !selectRows.length;
function submitCb(res) {
ModalInfo(`提交${res ? '成功' : '失败'}!`, { onOk: () => router.goBack() });
setVisible(false);
getPage();
}
const [data, setData] = useState(null);
const [loading, setLoading] = useState(false);
useEffect(
() => {
if (!visible) return;
if (typeof code === 'undefined') return;
setLoading(true);
getHistoryFormDetail({ code }).then(res => {
setLoading(false);
if (res && !res.errMsg) {
setData({...res, hisTaskForm: {...res.hisTaskForm, formKeys: []}});
}
});
},
[visible]
);
const footer = data ? (
<div style={{ padding: 16, textAlign: 'center' }}>
<AuditButton
data={data} // 为 'affair/getIdFormDetail' 接口请求到的数据
callback={submitCb} // 提交完成后回调函数
form={form} // form表单控件
taskIds={selectRows.map(i => i.taskId)}
/>
</div>
) : null;
return (
<>
<Modal width={900} visible={visible} title="批量审核" footer={footer} onCancel={() => setVisible(false)}>
<Spin spinning={loading}>
{data && (
<>
<div className={styles.zyd_onestop_style_class}>
<HistoryForm
data={data} // 'affair/getIdFormDetail' 接口返回数据
form={form} // form控件
isNewForm={!!isNewForm} // 是否渲染需要当前用户填写的审核表单 为false只会渲染历史回显表单
/>
</div>
</>
)}
</Spin>
</Modal>
<ButtonDiy name="批量审核" handleClick={() => setVisible(true)} disabled={disabled} />
</>
);
}
export default Form.create()(AuditModal);
import React, { useState } from 'react';
import PageTypeMatching from '@/highOrderComponent/PageTypeMatching';
import getInfoGenerator from '@/webPublic/FormInsertDiy/getInfoGenerator';
import AuditModal from './AuditModal'
import { findValueByKey } from '../../../../pages/zydtw/Cxcy/utils';
const defaultNameSpan = { big: 9, small: 9 };
const defaultFieldSpan = { big: 4, small: 4 };
const defaultPageSetting = {
selectRows: true,
paging: true,
searchArea: true,
buttonArea: true,
};
export default function BatchAudit({
appId,
flowNode,
getInfo,
condition,
nameSpan,
fieldSpan,
tableRowKey,
columns,
pageButton,
pageSetting,
}) {
const [code, setCode] = useState(null);
const pageSearch = {
search: {
searchType: 'cascadeSearchNew',
getInfo: getInfo || getInfoGenerator(condition),
url: '/common/assigneeTasks',
field: {
appId: {
required: true,
defaultValue: appId,
},
flowNode: {
required: true,
defaultValue: flowNode,
},
},
condition: condition || [],
nameSpan: nameSpan || defaultNameSpan,
fileSpan: fieldSpan || defaultFieldSpan,
responseCallBack: res => {
if (res && res.rows && res.rows[0]) {
setCode(findValueByKey(res.rows[0], 'code'));
}
return res;
}
},
tableRowKey: tableRowKey || 'buzinessId',
columns: columns || [],
};
const defaultPageButton = [
{
type:'create',
name: '批量审核',
component: 'RenderComponent',
render: ({ selectRows, getPage }) => {
return <AuditModal selectRows={selectRows} getPage={getPage} code={code} />;
}
},
];
return (
<PageTypeMatching
tabsShellStyle={{ marginTop: 0 }}
pageSetting={{ type: 'list', listConfig: { ...defaultPageSetting, ...pageSetting } }}
pageButton={pageButton || defaultPageButton}
pageSearch={pageSearch}
/>
);
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论