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

2073 开发需求1229

上级 df3994ea
...@@ -134,7 +134,6 @@ class AuditPage extends Component { ...@@ -134,7 +134,6 @@ class AuditPage extends Component {
}, },
beforeSearchData: (data) => { beforeSearchData: (data) => {
let searcherKeyValue = {}; let searcherKeyValue = {};
console.log(data);
for (let item of searchCondition) { for (let item of searchCondition) {
if (typeof data[item.key] !== 'undefined' if (typeof data[item.key] !== 'undefined'
&& item.key !== 'taskDefKey' && item.key !== 'taskDefKey'
...@@ -178,7 +177,13 @@ class AuditPage extends Component { ...@@ -178,7 +177,13 @@ class AuditPage extends Component {
}; };
}; };
render() { componentDidMount() {
if(this.props.setRefInfo){
this.props.setRefInfo('AuditPage', this);
}
}
render() {
const { workId, dataBaseId, addFields, searchCondition } = this.props; const { workId, dataBaseId, addFields, searchCondition } = this.props;
return ( return (
<PageHeaderWrapper title=""> <PageHeaderWrapper title="">
...@@ -191,6 +196,8 @@ class AuditPage extends Component { ...@@ -191,6 +196,8 @@ class AuditPage extends Component {
addFields={addFields} addFields={addFields}
locationState={this.context.locationState} locationState={this.context.locationState}
pageSearch={this.handleSearchSet({})} pageSearch={this.handleSearchSet({})}
setRefInfo={this.props.setRefInfo}
keepAliveData={this.props.keepAliveData}
/> />
</PageHeaderWrapper> </PageHeaderWrapper>
); );
......
...@@ -11,6 +11,7 @@ import { handleColumns } from '@/webPublic/FormInsertDiy/AffairPage/destruction' ...@@ -11,6 +11,7 @@ import { handleColumns } from '@/webPublic/FormInsertDiy/AffairPage/destruction'
export default class List extends Component { export default class List extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
const { keepAliveData } = props;
this.state = { this.state = {
list: [], list: [],
selectRows: [], selectRows: [],
...@@ -18,7 +19,7 @@ export default class List extends Component { ...@@ -18,7 +19,7 @@ export default class List extends Component {
loading: true, loading: true,
sortGetPageFields: {}, sortGetPageFields: {},
pagination: { pagination: {
current: 1, current: (keepAliveData && keepAliveData.pageCurrent) || 1,
total: 1, total: 1,
pageSize: this.props.listConfig.pageSize || 10, pageSize: this.props.listConfig.pageSize || 10,
pageSizeOptions: ['10', '20', '50', '100', '500'], pageSizeOptions: ['10', '20', '50', '100', '500'],
...@@ -47,6 +48,12 @@ export default class List extends Component { ...@@ -47,6 +48,12 @@ export default class List extends Component {
} }
} }
} }
if (props.keepAliveData?.searchFormValues) {
formValues = {
...formValues,
...props.keepAliveData?.searchFormValues,
};
}
return formValues; return formValues;
}; };
...@@ -99,9 +106,9 @@ export default class List extends Component { ...@@ -99,9 +106,9 @@ export default class List extends Component {
data = search.beforeSearchData(data, { ...this.props }); data = search.beforeSearchData(data, { ...this.props });
} }
if (search.beforeSearchDataOutSide && typeof search.beforeSearchDataOutSide === 'function') { if (search.beforeSearchDataOutSide && typeof search.beforeSearchDataOutSide === 'function') {
data = search.beforeSearchDataOutSide(data, { ...this.props }); data = search.beforeSearchDataOutSide(data, { ...this.props });
} }
search.getPageService({ ...data, appId: workId }).then((response) => { search.getPageService({ ...data, appId: workId }).then((response) => {
this.setState({ this.setState({
...@@ -189,12 +196,11 @@ export default class List extends Component { ...@@ -189,12 +196,11 @@ export default class List extends Component {
if (!search.noNeedInitData) { if (!search.noNeedInitData) {
this.getPage(); this.getPage();
} }
if (this.props.setRefInfo) {
this.props.setRefInfo('List', this);
}
} }
componentWillMount() {}
componentWillUnmount() {}
resetFormValues = () => { resetFormValues = () => {
const { beforeResetFormValues } = this.props.pageSearch.search; const { beforeResetFormValues } = this.props.pageSearch.search;
let { formValues } = this.state; let { formValues } = this.state;
...@@ -335,7 +341,7 @@ export default class List extends Component { ...@@ -335,7 +341,7 @@ export default class List extends Component {
search={pageSearch.search} search={pageSearch.search}
getPage={this.getPage} getPage={this.getPage}
children={children} children={children}
columns={columns} columns={columns}
/> />
) : null} ) : null}
<StandardTable {...tableProps} /> <StandardTable {...tableProps} />
......
...@@ -9,84 +9,92 @@ import List from './List'; ...@@ -9,84 +9,92 @@ import List from './List';
const TabPane = Tabs.TabPane; const TabPane = Tabs.TabPane;
class ListTab extends Component { class ListTab extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
const { tabList } = this.props; const { tabList, keepAliveData } = this.props;
const tabKeys = Object.keys(tabList); const tabKeys = Object.keys(tabList);
this.state = { let activeKey = this.props.locationState?.activeKey || tabKeys[0];
activeKey: this.props.locationState?.activeKey || tabKeys[0], if(keepAliveData && keepAliveData.activeKey){
tabKeys: tabKeys, activeKey = keepAliveData.activeKey;
}; }
} this.state = {
activeKey: activeKey,
tabKeys: tabKeys,
};
}
handleChangeTab = (activeKey) => { handleChangeTab = (activeKey) => {
this.setState( this.setState(
{ {
activeKey: '-111111', activeKey: '-111111',
}, },
() => { () => {
setTimeout(() => { setTimeout(() => {
this.setState({ this.setState({
activeKey: activeKey, activeKey: activeKey,
}); });
}, 30); }, 30);
}, },
); );
}; };
render() { componentDidMount() {
const { if (this.props.setRefInfo) {
tabList, this.props.setRefInfo('ListTab', this);
pageSearch, }
pageButton, }
workId,
dataBaseId, render() {
addFields, const {
searchCondition, tabList,
} = this.props; pageSearch,
const { pageButton,
activeKey, workId,
tabKeys dataBaseId,
} = this.state; addFields,
return ( searchCondition,
<Fragment> } = this.props;
<Shell styleShell={{ marginTop: 0 }}> const { activeKey, tabKeys } = this.state;
{/*<SearchDom />*/} return (
<Tabs activeKey={activeKey} className={styles.ListTab} onChange={this.handleChangeTab}> <Fragment>
{tabKeys.map((item) => { <Shell styleShell={{ marginTop: 0 }}>
return <TabPane tab={tabList[item].name} key={item}/>; {/*<SearchDom />*/}
})} <Tabs activeKey={activeKey} className={styles.ListTab} onChange={this.handleChangeTab}>
</Tabs> {tabKeys.map((item) => {
</Shell> return <TabPane tab={tabList[item].name} key={item} />;
{tabKeys.map((item) => { })}
if (activeKey === item && pageSearch[item]) { </Tabs>
const search = pageSearch[item].search; </Shell>
if (search.mustHaveCondition && !search.condition.length) { {tabKeys.map((item) => {
// 如果配置了 mustHaveCondition 则 必须有搜索条件才渲染页面 保证 搜索条件正常传给后台 if (activeKey === item && pageSearch[item]) {
return null; const search = pageSearch[item].search;
} if (search.mustHaveCondition && !search.condition.length) {
} // 如果配置了 mustHaveCondition 则 必须有搜索条件才渲染页面 保证 搜索条件正常传给后台
return activeKey === item ? ( return null;
<List }
listConfig={tabList[item].listConfig} }
key={item} return activeKey === item ? (
workId={workId} <List
addFields={addFields} listConfig={tabList[item].listConfig}
searchCondition={searchCondition} key={item}
dataBaseId={dataBaseId} workId={workId}
pageSearch={pageSearch[item]} addFields={addFields}
pageButton={pageButton[item]} searchCondition={searchCondition}
/> dataBaseId={dataBaseId}
) : null; pageSearch={pageSearch[item]}
})} pageButton={pageButton[item]}
</Fragment> setRefInfo={this.props.setRefInfo}
); keepAliveData={this.props.keepAliveData}
} />
) : null;
})}
</Fragment>
);
}
} }
ListTab.contextType = CreateC; ListTab.contextType = CreateC;
ListTab.propTypes = {}; ListTab.propTypes = {};
ListTab.defaultProps = {}; ListTab.defaultProps = {};
......
...@@ -12,7 +12,12 @@ import * as destructionFunc from '../destruction'; ...@@ -12,7 +12,12 @@ import * as destructionFunc from '../destruction';
import { Link } from 'dva/router'; import { Link } from 'dva/router';
import CreateC from '../../ExportComponent/ContextCreate'; import CreateC from '../../ExportComponent/ContextCreate';
import exportHandledInfo from '@/webPublic/FormInsertDiy/AffairPage/AuditPage/exportHandledInfo'; import exportHandledInfo from '@/webPublic/FormInsertDiy/AffairPage/AuditPage/exportHandledInfo';
import { connect } from 'dva';
import router from 'umi/router';
@connect(({ keepAlive }) => ({
keepAlive,
}))
class Index extends React.Component { class Index extends React.Component {
static defaultProps = { static defaultProps = {
hasBatchAudit: false, // 是否有批量审核按钮 默认关掉 如果有需要再在外面包一层 2020年5月6日 18:44:11 钟是志 hasBatchAudit: false, // 是否有批量审核按钮 默认关掉 如果有需要再在外面包一层 2020年5月6日 18:44:11 钟是志
...@@ -36,8 +41,17 @@ class Index extends React.Component { ...@@ -36,8 +41,17 @@ class Index extends React.Component {
allConfigSetInfo: {}, // 返回的数据 allConfigSetInfo: {}, // 返回的数据
}; };
window.callbackSubmitInfoZhiYong = undefined; window.callbackSubmitInfoZhiYong = undefined;
this.refInfo = {
AuditPage: null,
ListTab: null,
List: null,
};
} }
setRefInfo = (key, component) => {
this.refInfo[key] = component;
};
getFormDetail = (workId) => { getFormDetail = (workId) => {
const { dataBaseId } = this.state; const { dataBaseId } = this.state;
service.getFormDetail(workId).then((response) => { service.getFormDetail(workId).then((response) => {
...@@ -45,8 +59,8 @@ class Index extends React.Component { ...@@ -45,8 +59,8 @@ class Index extends React.Component {
return false; return false;
} }
this.setState({ this.setState({
smartFormData: response, smartFormData: response,
}); });
destructionFunc.destructionGetDetail(response, workId).then((x) => { destructionFunc.destructionGetDetail(response, workId).then((x) => {
const { addFields, tableInfo, allConfigSetInfo, searchCondition } = x; const { addFields, tableInfo, allConfigSetInfo, searchCondition } = x;
this.setState( this.setState(
...@@ -80,22 +94,34 @@ class Index extends React.Component { ...@@ -80,22 +94,34 @@ class Index extends React.Component {
title: '操作', title: '操作',
fixed: 'right', fixed: 'right',
render: (text, record) => { render: (text, record) => {
return ( const { refInfo } = this;
<Link const { dispatch } = this.props;
to={{ function goDetail() {
pathname: './Detail', const data = {
state: { activeKey: refInfo.ListTab.state.activeKey || 'tab1',
workId, pageCurrent: refInfo.List.state.pagination.current || 1,
dataBaseId, searchFormValues: refInfo.List.state.formValues || {},
record, };
addFields, dispatch({
tableInfo, type: 'keepAlive/setAuditPageData',
showPrint: showPrint || routerConfig.showPrint === '1', payload: {
}, path: window.location.href.split('#')[1],
}}> value: data,
{text || '详情'} },
</Link> });
); router.push({
pathname: './Detail',
state: {
workId,
dataBaseId,
record,
addFields,
tableInfo,
showPrint: showPrint || routerConfig.showPrint === '1',
},
});
}
return <a onClick={goDetail}>{text || '详情'}</a>;
}, },
}); });
this.setState({ this.setState({
...@@ -162,37 +188,35 @@ class Index extends React.Component { ...@@ -162,37 +188,35 @@ class Index extends React.Component {
addFields, addFields,
allConfigSetInfo, allConfigSetInfo,
tableInfo, tableInfo,
smartFormData, smartFormData,
} = this.state; } = this.state;
const { const {
hasBatchAudit, hasBatchAudit,
batchAuditButtonName, batchAuditButtonName,
showPrint, showPrint,
noNeedForm, noNeedForm,
routerConfig : { routerConfig: {
isExport = '0', // 解决禅道 32898 在路由中增加配置项 如果 = '1' 表示 开启已处理数据的导出 isExport = '0', // 解决禅道 32898 在路由中增加配置项 如果 = '1' 表示 开启已处理数据的导出
}, },
} = this.props; } = this.props;
if (!workId || !smartFormData) { if (!workId || !smartFormData) {
return null; return null;
} }
const tab2Buttons = []; const tab2Buttons = [];
if (isExport === '1') { if (isExport === '1') {
tab2Buttons.push({ tab2Buttons.push({
type: 'export', type: 'export',
name: '导出', name: '导出',
component: 'Normal', component: 'Normal',
handleClick: (selectRows, formValues, getPage, search, columns) => { handleClick: (selectRows, formValues, getPage, search, columns) => {
exportHandledInfo({ exportHandledInfo({
columns, columns,
appId: workId, appId: workId,
handled: 'handled', handled: 'handled',
}); });
}, },
}); // 解决禅道 32366 二级学院审核,所有二级学院审核后在已处理中加导出功能 103152 }); // 解决禅道 32366 二级学院审核,所有二级学院审核后在已处理中加导出功能 103152
} }
if (Array.isArray(columns)) { if (Array.isArray(columns)) {
let d = []; let d = [];
...@@ -205,8 +229,7 @@ class Index extends React.Component { ...@@ -205,8 +229,7 @@ class Index extends React.Component {
} }
} }
} }
console.log(columns); return (
return (
<AuditPage <AuditPage
hasBatchAudit={hasBatchAudit} hasBatchAudit={hasBatchAudit}
workId={workId} workId={workId}
...@@ -220,6 +243,8 @@ class Index extends React.Component { ...@@ -220,6 +243,8 @@ class Index extends React.Component {
showPrint={showPrint} showPrint={showPrint}
noNeedForm={noNeedForm} noNeedForm={noNeedForm}
tab2Buttons={tab2Buttons} tab2Buttons={tab2Buttons}
keepAliveData={this.props.keepAlive?.AuditPageData[window.location.href.split('#')[1]]}
setRefInfo={this.setRefInfo}
/> />
); );
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论