Commit a2131b8a authored by cellee's avatar cellee

公告搜索栏更改

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 9670e42a
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import {connect,history,useModel,Loading} from 'umi'; import { connect, history, useModel, Loading } from 'umi';
import { Input ,Tabs,Table,Space, Button,Tooltip} from 'antd'; import { Input, Tabs, Table, Space, Button, Tooltip, Form, message } from 'antd';
const { TabPane } = Tabs; const { TabPane } = Tabs;
import { PlusOutlined,SearchOutlined,ClearOutlined } from '@ant-design/icons'; import { PlusOutlined, SearchOutlined, ClearOutlined } from '@ant-design/icons';
import ProTable from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table';
// import { objectColumns } from '@/utils/string'; // import { objectColumns } from '@/utils/string';
import {timestampToTime3, timestampToTime} from '@/utils/time' import { timestampToTime3, timestampToTime } from '@/utils/time';
import SearchOptionsCommnity from '@/components/SearchOptions/SearchOptionsCommnity';
// 搜索框
import TitleSearch from '../../../components/TitleSearch/TitleSearch';
// communityNum: "A7" // communityNum: "A7"
// count: 0 // count: 0
...@@ -27,168 +24,198 @@ import TitleSearch from '../../../components/TitleSearch/TitleSearch'; ...@@ -27,168 +24,198 @@ import TitleSearch from '../../../components/TitleSearch/TitleSearch';
// noticTitlel: "大家好,今年端午节不放假" // noticTitlel: "大家好,今年端午节不放假"
// updateTime: "Jun 28, 2020 7:38:39 PM" // updateTime: "Jun 28, 2020 7:38:39 PM"
// import { RA } from '@/utils/method'; // import { RA } from '@/utils/method';
const goToAdd = () => { const goToAdd = () => {
history.push("./CommunityAnnouncement/Add"); history.push('./CommunityAnnouncement/Add');
} };
const module="CommunityAnnouncement" const module = 'CommunityAnnouncement';
const CommunityAnnouncement = (props:any) => { const CommunityAnnouncement = (props: any) => {
const { dispatch, Data, curString, userListLoading } = props;
const { dispatch, Data, curString , loading } = props;
const columns = [ const columns = [
{ {
title:"community", title: 'community',
dataIndex:"communityNum", dataIndex: 'communityNum',
width: 400, width: 400,
ellipsis: { ellipsis: {
showTitle: false, showTitle: false,
}, },
}, },
{ {
title:"Title", title: 'Title',
dataIndex:"noticTitlel", dataIndex: 'noticTitlel',
}, },
{ {
title:"Publish Time", title: 'Publish Time',
dataIndex:"noticStartTime", dataIndex: 'noticStartTime',
render:(text: any, record: any) => ( render: (text: any, record: any) => (
<Space size="middle"> <Space size="middle">{text != null ? timestampToTime(text.time) : null}</Space>
{text!=null? timestampToTime(text.time):null} ),
</Space>
)
}, },
{ {
title:"noticScope", title: 'noticScope',
dataIndex:"noticScope", dataIndex: 'noticScope',
}, },
{ {
title:"Actions", title: 'Actions',
render:(text: any, record: any) => ( render: (text: any, record: any) => (
<Space size="middle"><a>Detail</a></Space> <Space size="middle">
<a>Detail</a>
</Space>
), ),
}, },
]; ];
useEffect(() => { useEffect(() => {
RA(25,{communityNum: "", noticTitlel: "" , pageNum:1 },module,dispatch) RA(25, { communityNum: '', noticTitlel: '', pageNum: 1 }, module, dispatch);
},[1]) }, [1]);
//
const RA = (index: any, values: any) => {
dispatch({
type: 'FacilityBookings/RA',
playload: { index: index, body: values },
});
};
const SA = (values: any) => {
dispatch({ type: 'FacilityBookings/SA', playload: values });
};
const QA = (values: any) => {
dispatch({ type: 'FacilityBookings/QA', playload: values });
};
// const CA = () => {
dispatch({ type: 'FacilityBookings/CA', playload: null });
const RA = (index:any,values: any) => {
dispatch({
type: 'FacilityBookings/RA',
playload: {index:index, body:values }
})
}; };
const [form] = Form.useForm();
const SA = (values: any) => { dispatch({ type: 'FacilityBookings/SA', playload: values }) }; // 重置
const QA = (values: any) => { dispatch({ type: 'FacilityBookings/QA', playload: values }) }; const onReset = () => {
form.resetFields();
const CA = () => { dispatch({ type: 'FacilityBookings/CA', playload: null }) }; let payload = {
index: 19,
// 点击搜索 page: {
const CallBackTitleSearch= (comment: any) => { pageNum: 1,
console.log(comment) },
};
if (curString.tab == 1) { // requst(payload);
if (comment.communityName != null || comment.key != null || comment.status != null) { };
var tmp = curString
tmp.subscribeDate = comment.key // 表单提交
if (comment.status == null||comment.status==undefined) { const onFinishContract = (value: any) => {
tmp.status = 0; // console.log(value)
} else { if (!value.communityName && !value.contractNumber && !value.contractTitle) {
tmp.status = comment.status message.error('Please enter one of them!');
}
tmp.communityNameList = comment.communityName
tmp.curPage=1
QA(tmp)
console.log(tmp)
//中断
RA(9, { userToken: token, pageNum: "1", subscribeDate: tmp.subscribeDate, status: tmp.status,communityNameList:comment.communityName })
}
} else { } else {
if (comment.communityName != null || comment.facilityName != null) { console.log(value);
var tmp = curString let payload = {
tmp.communityNameList = comment.communityName index: 19,
tmp.facilityName = comment.facilityName page: {
tmp.curPage=1 pageNum: 1,
QA(tmp) contractNumber: value.contractNumber,
RA(8, {communityNameList: comment.communityName, facilityName: comment.facilityName, pageNum: "1"}) contractTitle: value.contractTitle,
communityName: value.communityName,
} },
};
// requst(payload);
} }
} };
// 选择小区名字并赋值
const opname = (value: any) => {
form.setFieldsValue({
communityName: value,
});
};
return ( return (
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}> <>
{/* 搜索组件 */} <div style={{ width: '100%', padding: 20, marginBottom: 15, backgroundColor: '#ffffff' }}>
{ <Form
curString.tab == 1 ? autoComplete="off"
<> layout="inline"
<TitleSearch form={form}
status={[{ name="contract"
name: ["status", "Order status"], onFinish={onFinishContract}
data: [[0, "All"], [1, "Applied"], [2, "Reserved"], [3, "Used"], [4, "Cancelled"]] >
}]} <Form.Item name="communityName">
time={["key", "Booking time "]} <SearchOptionsCommnity
// ubmit={extendName}
community={"communityName"} opname={opname}
checklist={curString.communityNameList!=null?curString.communityNameList:null} />
onSubmit={CallBackTitleSearch} /> </Form.Item>
</> : <Form.Item name="contractNumber">
<> <Input allowClear placeholder="Contract Number" />
<TitleSearch </Form.Item>
listkey={['facilityName']} list={['Facility name']} <Form.Item name="contractTitle">
community={"communityName"} <Input allowClear placeholder="Contract Title" />
onSubmit={CallBackTitleSearch} /> </Form.Item>
</> <Form.Item>
} <Button
type="primary"
{Data!=null? htmlType="submit"
<ProTable icon={<SearchOutlined />}
loading={loading} loading={userListLoading}
rowKey="id" >
style={{ marginTop: 16 }} Search{' '}
dataSource={Data.rows} </Button>
columns={columns} <Button
pagination={false} // 隐藏默认分页 htmlType="button"
search={false} onClick={onReset}
toolBarRender={() => [ style={{ marginLeft: '15px' }}
<Button key="3" type="primary" onClick={goToAdd}> icon={<ClearOutlined />}
<PlusOutlined />Create new Announcement loading={userListLoading}
</Button>, >
]} {' '}
options={{ Reset
density: true, </Button>
fullScreen: true, </Form.Item>
reload: () => { </Form>
// resetHandler(); </div>
}, <div style={{ width: '100%', padding: 10, backgroundColor: '#ffffff' }}>
setting: false, {Data != null ? (
}} <ProTable
headerTitle="Announcement list" loading={userListLoading}
/>:null} rowKey="id"
</div> dataSource={Data.rows}
columns={columns}
pagination={false} // 隐藏默认分页
search={false}
toolBarRender={() => [
<Button key="3" type="primary" onClick={goToAdd}>
<PlusOutlined />
Create new Announcement
</Button>,
]}
options={{
density: true,
fullScreen: true,
reload: () => {
// resetHandler();
},
setting: false,
}}
headerTitle="Announcement list"
/>
) : null}
</div>
</>
); );
}; };
function map(state:any) { function map(state: any) {
const loading = state.loading.models.FacilityBookings; const userListLoading = state.loading.models.FacilityBookings;
const Data = state.FacilityBookings.NoticeList; const Data = state.FacilityBookings.NoticeList;
const { curString } = state.FacilityBookings; const { curString } = state.FacilityBookings;
return { Data,curString,loading } return { Data, curString, userListLoading };
} }
export default connect(map)(CommunityAnnouncement); export default connect(map)(CommunityAnnouncement);
// function mapStateToProps(state:any) { // function mapStateToProps(state:any) {
// const { Data, Data2,DataSave,curString,Result } = state.FacilityBookings; // const { Data, Data2,DataSave,curString,Result } = state.FacilityBookings;
// const { token } = state.login; // const { token } = state.login;
// return { // return {
// Data, // Data,
// Data2, // Data2,
...@@ -199,4 +226,4 @@ export default connect(map)(CommunityAnnouncement); ...@@ -199,4 +226,4 @@ export default connect(map)(CommunityAnnouncement);
// }; // };
// } // }
// export default connect(mapStateToProps)(FacilityBookings); // export default connect(mapStateToProps)(FacilityBookings);
//备注 发布人缺少 发布时间格式错误 //备注 发布人缺少 发布时间格式错误
\ No newline at end of file
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