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

Merge remote-tracking branch 'origin/master'

import pageSetting from './pageSetting';
import React, { Component, Fragment } from 'react';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
......@@ -7,34 +5,66 @@ import List from '../ApplyPage/List';
import ListTab from './ListTab';
import { deepCopy } from '@/baseComponent/utils';
import { getApplyPage, getHandledPage, getWaitPage } from '../publicApiService';
import AuditModal from '@/webPublic/FormInsertDiy/AuditPage/BatchAudit/AuditModal';
import { ModalInfo } from '@/baseComponent/Modal';
import ButtonDiy from '@/baseComponent/ButtonDiy';
export default class AuditPage extends Component {
constructor(props) {
super(props);
this.state={
this.state = {};
}
};
componentDidMount(){
}
componentDidMount() {}
handleButtonSet = () => {
const { addFields, workId } = this.props;
return {
tab1: [
{
type: 'audit',
component: 'RenderComponent',
render: ({ selectRows, getPage }) => {
const disabled = !selectRows || !Array.isArray(selectRows) || !selectRows.length;
function handleClick(onShow) {
const taskName = selectRows[0].taskName;
const differentTask = selectRows.slice(1).find(i => i.taskName !== taskName);
if (differentTask) {
return ModalInfo((
<div>
<strong style={{color: "red"}}> {differentTask.taskName} </strong>
<strong> {taskName} </strong>不能一起审核。<br />
请将分开操作。
</div>
));
}
onShow();
}
return (
<AuditModal selectRows={selectRows} getPage={getPage}>
{({ onShow }) => (
<ButtonDiy
name="批量审核"
handleClick={() => handleClick(onShow)}
disabled={disabled}
/>
)}
</AuditModal>
);
},
},
],
tab2: [],
};
};
handleSearchSet = () => {
const { columns, searchCondition} = this.props;
const { columns, searchCondition } = this.props;
const tab1 = {
search: {
field: {
},
field: {},
getPageService: getWaitPage,
responseCallBack: (response) => {
responseCallBack: response => {
return response;
},
condition: searchCondition,
......@@ -46,10 +76,9 @@ export default class AuditPage extends Component {
};
const tab2 = {
search: {
field: {
},
field: {},
getPageService: getHandledPage,
responseCallBack: (response) => {
responseCallBack: response => {
return response;
},
condition: searchCondition,
......@@ -70,22 +99,15 @@ export default class AuditPage extends Component {
return (
<PageHeaderWrapper title="">
<ListTab tabList={pageSetting.tabList}
pageButton={this.handleButtonSet({
})}
<ListTab
tabList={pageSetting.tabList}
pageButton={this.handleButtonSet({})}
workId={workId}
dataBaseId={dataBaseId}
addFields={addFields}
pageSearch={this.handleSearchSet({
})}/>
pageSearch={this.handleSearchSet({})}
/>
</PageHeaderWrapper>
);
}
}
......@@ -301,8 +301,8 @@ export default class List extends Component {
/> : null}
<Shell>
{this.pageButton().length ?
<ButtonListDom config={this.pageButton()}
{pageButton.length ?
<ButtonListDom config={pageButton}
handleSelectRows={this.handleSelectRows}
selectRows={selectRows}
formValues={formValues}
......
......@@ -7,31 +7,37 @@ import HistoryForm from '@/webPublic/FormInsertDiy/HistoryForm';
import ButtonDiy from '@/baseComponent/ButtonDiy';
import { ModalInfo } from '@/baseComponent/Modal';
import { router } from 'umi';
import RenderForm from '../../RenderForm';
const isNewForm = true;
function AuditModal({ form, selectRows, code, getPage }) {
function AuditModal({ form, selectRows, children, getPage }) {
const [visible, setVisible] = useState(false);
const disabled = !selectRows || !Array.isArray(selectRows) || !selectRows.length;
function submitCb(res) {
ModalInfo(`提交${res ? '成功' : '失败'}!`, { onOk: () => router.goBack() });
// ModalInfo(`提交${res ? '成功' : '失败'}!`, { onOk: () => router.goBack() });
ModalInfo(`提交${res ? '成功' : '失败'}!`, {
onOk: () => {
setVisible(false);
getPage();
},
});
}
const [data, setData] = useState(null);
const [loading, setLoading] = useState(false);
useEffect(
() => {
if (!visible) return;
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: []}});
setData({ ...res, hisTaskForm: { ...res.hisTaskForm, formKeys: [] } });
}
});
},
......@@ -48,24 +54,32 @@ function AuditModal({ form, selectRows, code, getPage }) {
/>
</div>
) : null;
return (
<>
<Modal width={900} visible={visible} title="批量审核" footer={footer} onCancel={() => setVisible(false)}>
<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只会渲染历史回显表单
{data && data.isHandle && !!data.taskFormKey ? (
<div style={{ width: 800, margin: 'auto' }}>
<RenderForm
postData={data}
get="web"
isCg="no"
obj={data.hisTaskForm.formData}
table="new"
form={form}
/>
</div>
</>
)}
) : null}
</Spin>
</Modal>
<ButtonDiy name="批量审核" handleClick={() => setVisible(true)} disabled={disabled} />
{children({ onShow: () => setVisible(true) })}
</>
);
}
......
......@@ -4,6 +4,7 @@ import getInfoGenerator from '@/webPublic/FormInsertDiy/getInfoGenerator';
import AuditModal from './AuditModal';
import { findValueByKey } from '../../../../pages/zydtw/Cxcy/utils';
import withGoBack from '@/highOrderComponent/withGoBack';
import ButtonDiy from '@/baseComponent/ButtonDiy';
const defaultNameSpan = { big: 9, small: 9 };
const defaultFieldSpan = { big: 4, small: 4 };
......@@ -27,7 +28,6 @@ export default withGoBack(function BatchAudit({
pageButton,
pageSetting,
}) {
const [code, setCode] = useState(null);
const pageSearch = {
search: {
searchType: 'cascadeSearchNew',
......@@ -46,12 +46,6 @@ export default withGoBack(function BatchAudit({
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 || [],
......@@ -63,7 +57,12 @@ export default withGoBack(function BatchAudit({
name: '批量审核',
component: 'RenderComponent',
render: ({ selectRows, getPage }) => {
return <AuditModal selectRows={selectRows} getPage={getPage} code={code} />;
const disabled = !selectRows || !Array.isArray(selectRows) || !selectRows.length;
return (
<AuditModal selectRows={selectRows.map(i => ({...i, code: findValueByKey(i, 'code')}))} getPage={getPage}>
{({ onShow }) => <ButtonDiy name="批量审核" handleClick={onShow} disabled={disabled} />}
</AuditModal>
);
},
},
];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论