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

流程审核页面增加带参数跳转

上级 3eeb325a
......@@ -75,7 +75,6 @@ class AffairPage extends React.Component {
getFormDetail = (workId) => {
service.getFormDetail(workId).then((response) => {
console.log(response);
if (typeof response.unifiedServicePatternModel === 'undefined') {
return false;
}
......
import pageSetting from './pageSetting';
import React, { Component } from 'react';
import React, { Component, useContext } from 'react';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import ListTab from './ListTab';
import { getHandledPage, getWaitPage } from '../publicApiService';
import AuditModal from '@/webPublic/FormInsertDiy/AuditPage/BatchAudit/AuditModal';
import { ModalInfo } from '@/baseComponent/Modal';
import ButtonDiy from '@/baseComponent/ButtonDiy';
import CreateC from '@/webPublic/FormInsertDiy/ExportComponent/ContextCreate';
export default class AuditPage extends Component {
class AuditPage extends Component {
constructor(props) {
super(props);
this.state = {};
}
componentDidMount() {}
// componentDidMount() {
// console.log(this.context);
// }
handleButtonSet = () => {
const { hasBatchAudit, batchAuditButtonName, noNeedForm, tab2Buttons = [] } = this.props;
......@@ -76,6 +80,7 @@ export default class AuditPage extends Component {
scroll: { x: 'max-content' },
getPageService: getWaitPage,
beforeSearchData: (data) => {
console.log(data);
let searcherKeyValue = {};
for (let item of searchCondition) {
if (typeof data[item.key] !== 'undefined' && item.key !== 'taskDefKey') {
......@@ -109,6 +114,7 @@ export default class AuditPage extends Component {
tableRowKey: 'id',
columns,
};
console.log(this.context.locationState?.tab2Props?.search?.field);
const tab2 = {
search: {
field: {},
......@@ -119,7 +125,8 @@ export default class AuditPage extends Component {
},
beforeSearchData: (data) => {
let searcherKeyValue = {};
for (let item of searchCondition) {
console.log(data);
for (let item of searchCondition) {
if (typeof data[item.key] !== 'undefined' && item.key !== 'taskDefKey') {
searcherKeyValue[item.base52] = data[item.key];
}
......@@ -144,9 +151,11 @@ export default class AuditPage extends Component {
big: 4,
small: 4,
},
...this.context.locationState?.tab2Props?.search,
},
tableRowKey: 'id',
columns,
};
return {
tab1,
......@@ -154,10 +163,11 @@ export default class AuditPage extends Component {
};
};
render() {
const { workId, dataBaseId, addFields, searchCondition } = this.props;
return (
render() {
const { workId, dataBaseId, addFields, searchCondition } = this.props;
// const { locationState } = useContext(CreateC);
// console.log(locationState);
return (
<PageHeaderWrapper title="">
<ListTab
tabList={pageSetting.tabList}
......@@ -166,9 +176,15 @@ export default class AuditPage extends Component {
dataBaseId={dataBaseId}
searchCondition={searchCondition}
addFields={addFields}
locationState={this.context.locationState}
pageSearch={this.handleSearchSet({})}
/>
</PageHeaderWrapper>
);
}
}
AuditPage.contextType = CreateC;
export default AuditPage;
......@@ -55,16 +55,16 @@ export default class List extends Component {
const { pagination, formValues } = this.state;
const search = pageSearch.search;
let data = deepCopy(formValues);
/** 如果配置了默认值 则 加进去 **/
for (let item in search.field) {
let one = search.field[item];
if (one.required && typeof data[item] === 'undefined') {
/**
* 存在必填项 且当前必填项没有值时 则传入. 如果必填项有值则不需要修改
* */
data[item] = one.defaultValue;
}
}
// /** 如果配置了默认值 则 加进去 **/
// for (let item in search.field) {
// let one = search.field[item];
// if (one.required && typeof data[item] === 'undefined') {
// /**
// * 存在必填项 且当前必填项没有值时 则传入. 如果必填项有值则不需要修改
// * */
// data[item] = one.defaultValue;
// }
// }
if (listConfig.paging) {
// 是否分页
data.pageSize = pagination.pageSize;
......
import React, { Component, Fragment } from 'react';
import { Tabs } from 'antd';
import styles from '@/baseComponent/index.less';
import PropTypes from 'prop-types';
import CreateC from '@/webPublic/FormInsertDiy/ExportComponent/ContextCreate';
import Shell from '@/baseComponent/Shell';
import List from './List';
const TabPane = Tabs.TabPane;
export default class ListTab extends Component {
constructor(props) {
super(props);
const { tabList } = this.props;
const tabKeys = Object.keys(tabList);
this.state = {
activeKey: tabKeys[0],
tabKeys: tabKeys,
};
}
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,
};
}
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) => {
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>
);
}
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>
);
}
}
ListTab.propTypes = {};
ListTab.contextType = CreateC;
ListTab.propTypes = {};
ListTab.defaultProps = {};
export default ListTab;
......@@ -10,7 +10,7 @@ import * as service from '../publicApiService';
import AuditPage from './AuditPage';
import * as destructionFunc from '../destruction';
import { Link } from 'dva/router';
import { CreateC } from '../../ExportComponent/ActiveMenuComponent';
import CreateC from '../../ExportComponent/ContextCreate';
class Index extends React.Component {
static defaultProps = {
......@@ -134,7 +134,6 @@ class Index extends React.Component {
response = response.filter((x) => {
return x.title !== '流程进度';
});
console.log(response);
if (response && response.length) {
this.setState(
{
......@@ -199,7 +198,7 @@ class Index extends React.Component {
});
}
}
console.log(JSON.stringify(d));
// console.log(JSON.stringify(d));
}
return (
<AuditPage
......@@ -222,5 +221,6 @@ class Index extends React.Component {
export default function Pr(props) {
const { routerConfig } = useContext(CreateC);
// console.log(routerConfig);
return <Index {...props} routerConfig={routerConfig}/>;
}
......@@ -17,10 +17,7 @@ import exportHandledInfo from '@/webPublic/FormInsertDiy/AffairPage/AuditPage/ex
import ApplyMerge from './ApplyMerge'; // merge
import AuditMerge from './AuditMerge';
import CheckRecordMerge from './CheckRecordMerge';
export const CreateC = createContext({
routerConfig: {},
});
import CreateC from './ContextCreate';
window.iframeParentComponent = {
Modal,
......@@ -116,10 +113,12 @@ function ActiveMenuComponent({ routerConfig, ...otherProps }) {
default:
break;
}
console.log('112233');
return (
<CreateC.Provider
value={{
routerConfig,
locationState: location?.state,
}}>
{Res}
</CreateC.Provider>
......
import { createContext } from 'react';
const CreateC = createContext({
routerConfig: {},
locationState: {},
});
export default CreateC;
......@@ -183,7 +183,6 @@ export async function requestOrigin(url, data, options = {}){
})
.then(response => {
// console.log(response);
if (response && response.errMsg) {
response.errMsg = response.errMsg.slice(0, 50);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论