Commit e23bed6c authored by cellee's avatar cellee

组件通过参数显示不同内容

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent cc8e125a
......@@ -4,7 +4,8 @@ import SearchOptions from './SearchOptions';
import SearchOptionsTow from './SearchOptionsTow';
const SearchOptionsCommnity = (props: any) => {
const { dispatch, CommunityList, opname, defaultName , SearchOptionsCommnity } = props;
const { dispatch, CommunityList, opname, defaultName, type } = props;
const tosCommunityget = (values: any) => {
dispatch({ type: 'Init/tosCommunityget', playload: values });
};
......@@ -34,6 +35,7 @@ const SearchOptionsCommnity = (props: any) => {
list={CommunityList}
extendName={extendName}
def={defaultName}
type={type}
></SearchOptionsTow>
) : null}
</>
......
......@@ -3,7 +3,8 @@ import { Select } from 'antd';
const { Option } = Select;
const SearchOptionsTow = (porps: any) => {
const { list, extendName, def } = porps;
const { list, extendName, def, type } = porps;
const options = list.map((d: any, index: number) => (
<Option value={d} key={index}>
{d}
......@@ -15,10 +16,12 @@ const SearchOptionsTow = (porps: any) => {
}
return (
<div>
{type ? (
<Select
showSearch
allowClear
mode="multiple"
autoClearSearchValue
style={{ width: 320 }}
placeholder="Community Name"
optionFilterProp="children"
......@@ -27,6 +30,19 @@ const SearchOptionsTow = (porps: any) => {
>
{options}
</Select>
) : (
<Select
showSearch
allowClear
style={{ width: 200 }}
placeholder="Community Name"
optionFilterProp="children"
onChange={onChange}
defaultValue={def}
>
{options}
</Select>
)}
</div>
);
};
......
......@@ -36,7 +36,6 @@ const CommunityAnnouncement = (props: any) => {
dispatch({ type: module + '/returnDataSaveDetail', playload: { DataSaveDetail: null } });
}, [1]);
// 表头
const columns = [
{
......@@ -85,10 +84,20 @@ const CommunityAnnouncement = (props: any) => {
title: 'Actions',
render: (text: any, record: any) => (
<Space size="middle">
<Button type="link" onClick={() => {goToAdd(1, record);}}>
<Button
type="link"
onClick={() => {
goToAdd(1, record);
}}
>
Edit
</Button>
<Button type="link" onClick={() => {goToAdd(2, record);}}>
<Button
type="link"
onClick={() => {
goToAdd(2, record);
}}
>
Detail
</Button>
</Space>
......@@ -100,11 +109,11 @@ const CommunityAnnouncement = (props: any) => {
const DetailPage = (page: any) => {
let data = {
Method: 'returnDataSaveDetail',
DefaultName: "DataSaveDetail",
Data: page
DefaultName: 'DataSaveDetail',
Data: page,
};
return data;
}
};
// 分页数据一改变就发起请求
useEffect(() => {
......@@ -122,16 +131,15 @@ const CommunityAnnouncement = (props: any) => {
function goToAdd(num: any, record: any) {
if (num == 0) {
history.push('./CommunityAnnouncement/Add');
}else if (num == 1) {
} else if (num == 1) {
// 传递列表信息
dispatch({ type: module + '/returnDataSave', playload: { DataSave: record } });
history.push('./CommunityAnnouncement/Edit');
}else if (num == 2) {
} else if (num == 2) {
// 传递列表信息
dispatch({ type: module + '/returnDataSave', playload: { DataSave: record } });
history.push('./CommunityAnnouncement/Detail');
}
}
const [form] = Form.useForm();
......@@ -145,21 +153,21 @@ const CommunityAnnouncement = (props: any) => {
pageNum: 1,
};
// 把内容存进去
SA(DetailPage(page), module, dispatch)
SA(DetailPage(page), module, dispatch);
};
// 表单提交
const onFinishContract = (value: any) => {
console.log(value)
console.log(value);
if (!value.communityNumList && !value.noticTitlel && !value.creator) {
message.error('Please enter one of them!');
} else {
// 要看是哪里分页
let mlist = { ...value }
mlist.communityNumList = value.communityNumList
let mlist = { ...value };
mlist.communityNumList = value.communityNumList;
mlist.pageNum = 1;
// 把内容存进去
SA(DetailPage(mlist), module, dispatch)
SA(DetailPage(mlist), module, dispatch);
// requst(payload);
}
};
......@@ -174,10 +182,10 @@ const CommunityAnnouncement = (props: any) => {
// 页面切换
const paginationHandler = (page: number, pageSize?: number) => {
// 要看是哪里分页
let mlist = { ...DataSaveDetail }
let mlist = { ...DataSaveDetail };
mlist.pageNum = page;
// 把内容存进去
SA(DetailPage(mlist), module, dispatch)
SA(DetailPage(mlist), module, dispatch);
};
return (
......@@ -194,6 +202,7 @@ const CommunityAnnouncement = (props: any) => {
<SearchOptionsCommnity
// ubmit={extendName}
opname={opname}
type={1}
/>
</Form.Item>
<Form.Item name="noticTitlel">
......@@ -225,7 +234,6 @@ const CommunityAnnouncement = (props: any) => {
</Form>
</div>
<div style={{ width: '100%', paddingLeft: 10, paddingRight: 10, backgroundColor: '#ffffff' }}>
<ProTable
loading={userListLoading}
rowKey="id"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment