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,141 +24,169 @@ import TitleSearch from '../../../components/TitleSearch/TitleSearch'; ...@@ -27,141 +24,169 @@ 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) => { const RA = (index: any, values: any) => {
dispatch({ dispatch({
type: 'FacilityBookings/RA', type: 'FacilityBookings/RA',
playload: {index:index, body:values } 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 SA = (values: any) => { dispatch({ type: 'FacilityBookings/SA', playload: values }) }; const CA = () => {
const QA = (values: any) => { dispatch({ type: 'FacilityBookings/QA', playload: values }) }; dispatch({ type: 'FacilityBookings/CA', playload: null });
};
const CA = () => { dispatch({ type: 'FacilityBookings/CA', playload: null }) }; const [form] = Form.useForm();
// 点击搜索 // 重置
const CallBackTitleSearch= (comment: any) => { const onReset = () => {
console.log(comment) form.resetFields();
let payload = {
index: 19,
page: {
pageNum: 1,
},
};
// requst(payload);
};
if (curString.tab == 1) { // 表单提交
if (comment.communityName != null || comment.key != null || comment.status != null) { const onFinishContract = (value: any) => {
var tmp = curString // console.log(value)
tmp.subscribeDate = comment.key if (!value.communityName && !value.contractNumber && !value.contractTitle) {
if (comment.status == null||comment.status==undefined) { message.error('Please enter one of them!');
tmp.status = 0;
} else { } else {
tmp.status = comment.status console.log(value);
} let payload = {
tmp.communityNameList = comment.communityName index: 19,
tmp.curPage=1 page: {
QA(tmp) pageNum: 1,
console.log(tmp) contractNumber: value.contractNumber,
//中断 contractTitle: value.contractTitle,
RA(9, { userToken: token, pageNum: "1", subscribeDate: tmp.subscribeDate, status: tmp.status,communityNameList:comment.communityName }) communityName: value.communityName,
},
};
// requst(payload);
} }
} else { };
if (comment.communityName != null || comment.facilityName != null) {
var tmp = curString
tmp.communityNameList = comment.communityName
tmp.facilityName = comment.facilityName
tmp.curPage=1
QA(tmp)
RA(8, {communityNameList: comment.communityName, facilityName: comment.facilityName, pageNum: "1"})
} // 选择小区名字并赋值
} const opname = (value: any) => {
} form.setFieldsValue({
communityName: value,
});
};
return ( return (
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}>
{/* 搜索组件 */}
{
curString.tab == 1 ?
<> <>
<TitleSearch <div style={{ width: '100%', padding: 20, marginBottom: 15, backgroundColor: '#ffffff' }}>
status={[{ <Form
name: ["status", "Order status"], autoComplete="off"
data: [[0, "All"], [1, "Applied"], [2, "Reserved"], [3, "Used"], [4, "Cancelled"]] layout="inline"
}]} form={form}
time={["key", "Booking time "]} name="contract"
onFinish={onFinishContract}
community={"communityName"} >
checklist={curString.communityNameList!=null?curString.communityNameList:null} <Form.Item name="communityName">
onSubmit={CallBackTitleSearch} /> <SearchOptionsCommnity
</> : // ubmit={extendName}
<> opname={opname}
<TitleSearch />
listkey={['facilityName']} list={['Facility name']} </Form.Item>
community={"communityName"} <Form.Item name="contractNumber">
onSubmit={CallBackTitleSearch} /> <Input allowClear placeholder="Contract Number" />
</> </Form.Item>
} <Form.Item name="contractTitle">
<Input allowClear placeholder="Contract Title" />
{Data!=null? </Form.Item>
<Form.Item>
<Button
type="primary"
htmlType="submit"
icon={<SearchOutlined />}
loading={userListLoading}
>
Search{' '}
</Button>
<Button
htmlType="button"
onClick={onReset}
style={{ marginLeft: '15px' }}
icon={<ClearOutlined />}
loading={userListLoading}
>
{' '}
Reset
</Button>
</Form.Item>
</Form>
</div>
<div style={{ width: '100%', padding: 10, backgroundColor: '#ffffff' }}>
{Data != null ? (
<ProTable <ProTable
loading={loading} loading={userListLoading}
rowKey="id" rowKey="id"
style={{ marginTop: 16 }}
dataSource={Data.rows} dataSource={Data.rows}
columns={columns} columns={columns}
pagination={false} // 隐藏默认分页 pagination={false} // 隐藏默认分页
search={false} search={false}
toolBarRender={() => [ toolBarRender={() => [
<Button key="3" type="primary" onClick={goToAdd}> <Button key="3" type="primary" onClick={goToAdd}>
<PlusOutlined />Create new Announcement <PlusOutlined />
Create new Announcement
</Button>, </Button>,
]} ]}
options={{ options={{
...@@ -173,16 +198,18 @@ const CommunityAnnouncement = (props:any) => { ...@@ -173,16 +198,18 @@ const CommunityAnnouncement = (props:any) => {
setting: false, setting: false,
}} }}
headerTitle="Announcement list" headerTitle="Announcement list"
/>:null} />
) : null}
</div> </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);
......
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