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

2073 开发需求1229

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