Skip to content

Commit

Permalink
fix(通知配置): 通知配置保存
Browse files Browse the repository at this point in the history
通知配置保存后刷新界面参数错误

fix #201
  • Loading branch information
Lind-pro committed Sep 10, 2020
1 parent 2c3263d commit 1a82b5b
Showing 1 changed file with 39 additions and 37 deletions.
76 changes: 39 additions & 37 deletions src/pages/notice/config/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {PageHeaderWrapper} from '@ant-design/pro-layout';
import React, {Fragment, useEffect, useState} from 'react';
import {Button, Card, Col, Divider, Form, Icon, Input, message, Popconfirm, Row, Table} from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import React, { Fragment, useEffect, useState } from 'react';
import { Button, Card, Col, Divider, Form, Icon, Input, message, Popconfirm, Row, Table } from 'antd';
import apis from '@/services';
import {ConnectState, Dispatch} from '@/models/connect';
import {connect} from 'dva';
import {FormComponentProps} from 'antd/es/form';
import { ConnectState, Dispatch } from '@/models/connect';
import { connect } from 'dva';
import { FormComponentProps } from 'antd/es/form';
import encodeQueryParam from '@/utils/encodeParam';
import {downloadObject} from '@/utils/utils';
import { downloadObject } from '@/utils/utils';
import Upload from 'antd/lib/upload';
import {PaginationConfig} from 'antd/lib/table';
import { PaginationConfig } from 'antd/lib/table';
import Save from './save';
import StandardFormRow from '../components/standard-form-row';
import TagSelect from '../components/tag-select';
Expand All @@ -35,13 +35,13 @@ interface State {

const formItemLayout = {
wrapperCol: {
xs: {span: 24},
sm: {span: 16},
xs: { span: 24 },
sm: { span: 16 },
},
};

const Config: React.FC<Props> = props => {
const {noticeConfig, loading, dispatch} = props;
const { noticeConfig, loading, dispatch } = props;

const initState: State = {
typeList: [],
Expand Down Expand Up @@ -73,20 +73,21 @@ const Config: React.FC<Props> = props => {
const onSearch = (type?: string[], name?: string) => {
const tempType = type || filterType;
const tempName = name || filterName;
// console.log(tempName, 'name');
const param = {
paging: false,
sorts: {
field: 'id',
order: 'desc',
},
terms: {
type$IN: tempType,
name$LIKE: tempName,
},
};
setSearchParam(param);
dispatch({
type: 'noticeConfig/query',
payload: encodeQueryParam({
paging: false,
sorts: {
field: 'id',
order: 'desc',
},
terms: {
type$IN: tempType,
name$LIKE: tempName,
},
}),
payload: encodeQueryParam(param),
});
};

Expand Down Expand Up @@ -177,12 +178,13 @@ const Config: React.FC<Props> = props => {
},
};*/

console.log(searchParam, 'papaa');
return (
<PageHeaderWrapper title="通知配置">
<div className={styles.filterCardList}>
<Card bordered={false}>
<Form layout="inline">
<StandardFormRow title="组件类型" block style={{paddingBottom: 11}}>
<StandardFormRow title="组件类型" block style={{ paddingBottom: 11 }}>
<Form.Item>
<TagSelect
expandable
Expand Down Expand Up @@ -215,28 +217,28 @@ const Config: React.FC<Props> = props => {
</StandardFormRow>
</Form>
</Card>
<br/>
<br />
<Card>
<Button
onClick={() => {
setCurrentItem({});
setSaveVisible(true);
}}
type="primary"
style={{marginBottom: 16}}
style={{ marginBottom: 16 }}
>
新建
</Button>
<Divider type="vertical"/>
<Divider type="vertical" />
<Button
onClick={() => {
downloadObject(noticeConfig.result?.data, '通知配置');
}}
style={{marginBottom: 16}}
style={{ marginBottom: 16 }}
>
导出配置
</Button>
<Divider type="vertical"/>
<Divider type="vertical" />
{/*<Upload {...uploadProps}>
<Button type="primary" style={{ marginBottom: 16 }}>
导入配置
Expand All @@ -257,7 +259,7 @@ const Config: React.FC<Props> = props => {
}}
>
<Button>
<Icon type="upload"/>导入配置
<Icon type="upload" />导入配置
</Button>
</Upload>
<Table
Expand Down Expand Up @@ -295,7 +297,7 @@ const Config: React.FC<Props> = props => {
>
编辑
</a>
<Divider type="vertical"/>
<Divider type="vertical" />
<Popconfirm
title="确认删除?"
onConfirm={() => {
Expand All @@ -304,9 +306,9 @@ const Config: React.FC<Props> = props => {
>
<a>删除</a>
</Popconfirm>
<Divider type="vertical"/>
<Divider type="vertical" />
<a onClick={() => downloadObject(record, '通知配置')}>下载配置</a>
<Divider type="vertical"/>
<Divider type="vertical" />
<a
onClick={() => {
setCurrentItem(record);
Expand All @@ -315,7 +317,7 @@ const Config: React.FC<Props> = props => {
>
调试
</a>
<Divider type="vertical"/>
<Divider type="vertical" />
<a
onClick={() => {
setCurrentItem(record);
Expand Down Expand Up @@ -352,13 +354,13 @@ const Config: React.FC<Props> = props => {
save={(item: any) => saveData(item)}
/>
)}
{debugVisible && <Debug data={currentItem} close={() => setDebugVisible(false)}/>}
{logVisible && <Logger close={() => setLogVisible(false)} data={currentItem}/>}
{debugVisible && <Debug data={currentItem} close={() => setDebugVisible(false)} />}
{logVisible && <Logger close={() => setLogVisible(false)} data={currentItem} />}
</PageHeaderWrapper>
);
};

export default connect(({noticeConfig, loading}: ConnectState) => ({
export default connect(({ noticeConfig, loading }: ConnectState) => ({
noticeConfig,
loading: loading.models.noticeConfig,
}))(Form.create<Props>()(Config));

0 comments on commit 1a82b5b

Please sign in to comment.