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

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

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