Commit 0cea681a authored by maple's avatar maple

[new]设施细节(1)

parent 54d57050
import React, { useState } from 'react';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import styles from './index.less';
import BackButton from '../BackButton/BackButton';
......@@ -12,6 +14,7 @@ import { gray } from 'chalk';
const TitleSearch= (props:any) => {
const { CommunityList } = props;
const key = props.listkey
const name = props.list;
......@@ -21,11 +24,15 @@ const TitleSearch= (props:any) => {
const time = props.time;
const community = props.community;
const [selectOptions, setSelectOptions] = useState(true)
const [communitys, setCommunitys] = useState(CommunityList)
const [datePicker, setDate]=useState(null)
const onFinish = values => {
if (datePicker) {
values[time[0]] = datePicker;
}
if (community) {
values.communitydata=communitys
}
console.log('Success:', values);
props.onSubmit(values)
};
......@@ -39,7 +46,7 @@ const TitleSearch= (props:any) => {
}
const printContent = (comment: any)=>{
console.log(comment)
setCommunitys(comment)
}
return (
<>
......@@ -87,7 +94,7 @@ const TitleSearch= (props:any) => {
{
community != null ?
<>
<SelectOptions list={["A", "B", "C", "D", "E", "F"].sort()} show={selectOptions} onSubmit={printContent} />
<SelectOptions list={CommunityList.sort()} show={selectOptions} onSubmit={printContent} />
<Form.Item><Button type="primary" htmlType="submit" style={{ backgroundColor: "#e7f4ff",color:"rgba(24,144,255,1)"}}>Search</Button></Form.Item>
</> : null
}
......@@ -101,5 +108,10 @@ const TitleSearch= (props:any) => {
</>
);
};
export default TitleSearch;
function mapStateToProps(state:any) {
const { CommunityList } = state.Init;
return {
CommunityList,
};
}
export default connect(mapStateToProps)(TitleSearch);
......@@ -30,13 +30,3 @@ export default {
},
};
// 'count', 'createTime',
// 'deleted', 'description',
// 'extend', 'id',
// 'tosUserEmail', 'tosUserId',
// 'tosUserName', 'tosUserPhone',
// 'tosUserPwd', 'tosUserServiceCell',
// 'tosUserToCompany', 'tosuserLevel',
// 'updateTime', 'userStatus'
\ No newline at end of file
......@@ -6,9 +6,9 @@ import { routerRedux } from 'dva/router'
export default {
namespace: 'FacilityBookings',
state: {
Data: null,
Data: {data:[],total:0},
DataPage:{totalRow:0},
Data2: null,
Data2: {data:[],total:0},
Data3: null,
Data4:null,
Data3Error: false,
......@@ -44,18 +44,6 @@ export default {
effects: {
// 模糊查询设施
*TosCommunityFacilitiesFuzzyQuery({ playload }, { call, put }) {
const resp = yield call(service.TosCommunityFacilitiesFuzzyQuery, playload);
console.log(resp)
if (resp.code == 500) {
window.location.href = '/500';
} else {
let Data2 = resp.data.list;
yield put({ type: 'returnPage2', Data2, });
}
},
//预订设施查询
*RA({ playload }, { call, put }) {
const resp = yield call(service.RA, playload);
......@@ -65,10 +53,10 @@ export default {
} else {
switch (playload.index) {
case 0:
case 9:
{
let DataPage = resp.data.page;
let Data = resp.data.list;
yield put({ type: 'returnPage', Data,DataPage });
let Data = {data:resp.data.list,total:resp.data.page} ;
yield put({ type: 'returnPage', Data });
}
break;
case 1:
......@@ -88,15 +76,9 @@ export default {
let DataSaveDetail = resp.data;
yield put({ type: 'DataSaveDetail', DataSaveDetail });
} break;
case 3: {
window.location.href = '/CommunityManagement/FacilityBookings';
} break;
case 4: {
window.location.href = '/CommunityManagement/FacilityBookings';
} break;
case 5: {
window.location.href = '/CommunityManagement/FacilityBookings';
} break;
case 3:
case 4:
case 5:
case 6: {
window.location.href = '/CommunityManagement/FacilityBookings';
} break;
......@@ -117,6 +99,10 @@ export default {
console.log(sourceData)
yield put({ type: 'returnSource', sourceData });
} break;
case 8: {
let Data2 = {data:resp.data.list,total:resp.data.page};
yield put({ type: 'returnPage2', Data2, });
} break;
}
}
......
......@@ -54,7 +54,7 @@ export default {
window.location.href = '/500';
} else {
var tmp = resp.data.rows[0].tosOwerModel;
var tmp2 = resp.data.rows[0].description;
var tmp2 = resp.data.rows[0].replyContent;
var CurDataDetail = {
community: tmp.communityName,
address: tmp.addressAndpostalCode,
......
......@@ -21,14 +21,15 @@ const statusDes = ["全部", "已申请", "已预订", "已使用", "已取消",
const FacilityBookings = (props:any) => {
const { formatMessage } = useIntl();
const { dispatch, location, Data,DataPage,Data2,token} = props;
const TosCommunityFacilitiesFuzzyQuery = (values: any) => { dispatch({ type: 'FacilityBookings/TosCommunityFacilitiesFuzzyQuery', playload: values }) };
const { dispatch, location, Data, DataPage, Data2, token } = props;
const RA = (values: any) => { dispatch({ type: 'FacilityBookings/RA', playload: {index:0, body:values } }) };
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 [tab, setTab] = useState(1)
const [curPage, setCurPage] = useState(1)
const [curPage2, setCurPage2] = useState(1)
const [loading, setLoading] = useState(false)
const [columns, setColumns] = useState([])
const [columns2, setColumns2] = useState([])
......@@ -73,10 +74,11 @@ const FacilityBookings = (props:any) => {
<a onClick={makeOperator.bind(this,record,2)}>预约</a>
</Space>)]
]
setColumns(objectColumns(key))
setColumns2(objectColumns(key2))
RA({ userToken: token, pageNum: 1 })
TosCommunityFacilitiesFuzzyQuery({ userToken: token, pageNum: 1 })
RA(0,{ userToken: token, pageNum: 1 })
RA(8,{ userToken: token, pageNum: 1 })
},[]);
......@@ -84,17 +86,29 @@ const FacilityBookings = (props:any) => {
setLoading(false)
},[Data]);
const TitleSearchContent = (comment: any) => {
if (tab == 1) {
console.log(comment)
console.log("comment")
if (comment.communitydata != null || comment.key != null || comment.status != null) {
RA(9, { userToken: token, pageNum: "1", subscribeDate: comment.key, status: comment.status })
}
} else {
console.log(comment)
// RA(8,{ userToken: token, pageNum: 1 })
}
}
function TabCallback(key: any) { setTab(key) }
function Pagechange(current: any, pageSize: any) {
setCurPage(current)
RA({ userToken: token, pageNum: current })
setLoading(true)
if (tab == 1) {
setCurPage(current)
RA(0, { userToken: token, pageNum: current })
} else {
setCurPage2(current)
// RA(0, { userToken: token, pageNum: current })
}
}
......@@ -103,7 +117,11 @@ const FacilityBookings = (props:any) => {
<div className={styles.base}>
{/* 头部组件 */}
<TitleSearch status={[{ name: ["status", "订单状态"], data: [[0, "未预约"], [1, "已缴费"]] }]} time={["key", "预订时间筛选"]} community={true} onSubmit={TitleSearchContent} />
<TitleSearch
status={[{ name: ["status", "订单状态"], data: [[0, "全部"], [1, "已申请"], [2, "已预订"], [3, "已使用"], [4, "已取消"]] }]}
time={["key", "预订时间筛选"]}
community={true}
onSubmit={TitleSearchContent} />
......@@ -113,11 +131,11 @@ const FacilityBookings = (props:any) => {
<Tabs defaultActiveKey="1" onChange={TabCallback}>
<TabPane tab="Facility Bookings" key="1">
<Table loading={loading} rowKey="id" style={{ marginTop: 16 }} dataSource={Data } columns={columns} pagination={{ current: curPage, total: DataPage.totalRow, showSizeChanger: false, onChange:Pagechange }} />
<Table loading={loading} rowKey="id" style={{ marginTop: 16 }} dataSource={Data.data } columns={columns} pagination={{ current: curPage, total: Data.total, showSizeChanger: false, onChange:Pagechange }} />
</TabPane>
<TabPane tab="Facility Management" key="2">
<Table rowKey="id" style={{ marginTop: 16 }} dataSource={Data2} columns={columns2} pagination={{ current: curPage, total: DataPage.totalRow, showSizeChanger: false, onChange: Pagechange }} />
<Table rowKey="id" style={{ marginTop: 16 }} dataSource={Data2.data} columns={columns2} pagination={{ current: curPage2, total: Data2.total, showSizeChanger: false, onChange: Pagechange }} />
</TabPane>
</Tabs>
......@@ -133,7 +151,7 @@ const FacilityBookings = (props:any) => {
};
function mapStateToProps(state:any) {
const { Data,DataPage,Data2 } = state.FacilityBookings;
const { Data, DataPage, Data2 } = state.FacilityBookings;
const { token } = state.login;
return {
Data,
......
......@@ -119,7 +119,7 @@ const FacilityManager = (props:any) => {
if (checkParam(result)) {
console.log('Success:', result);
// RA(6, values);
RA(6, values);
}else{message.error("Error,Please finish it,not empty!",3)}
};
......
import React, { useState, useEffect } from 'react';
import styles from './index.less';
import { Input ,Menu,Table,Space,Pagination,Tooltip, Button } from 'antd';
import { Input ,Menu,Table,Space,Pagination,Tooltip, Button,Form,Upload } from 'antd';
import { Link, useIntl, connect, Dispatch } from 'umi';
......@@ -17,6 +17,14 @@ const Guard = (props:any) => {
}, []);
const onFinish = (values:any) => {
console.log(values)
}
const uploadButton = (
<div>
<div className="ant-upload-text">Upload</div>
</div>
);
return (
<div className={styles.base}>
......@@ -26,6 +34,18 @@ const Guard = (props:any) => {
<Line />
<Form name="basic" onFinish={onFinish}>
<Form.Item name="name" ><Upload name={'file'} listType={'picture-card'}>
<Button>
{uploadButton}
</Button>
</Upload></Form.Item>
<Form.Item ><Button type="primary" htmlType="submit">Submit</Button></Form.Item>
</Form>
</div>
);
......
const Demo = () => {
const onFinish = values => {
console.log('Success:', values);
};
const onFinishFailed = errorInfo => {
console.log('Failed:', errorInfo);
};
<Form
{...layout}
name="basic"
initialValues={{ remember: true }}
onFinish={onFinish}
onFinishFailed={onFinishFailed}
>
<Form.Item
label="Username"
name="username"
rules={[{ required: true, message: 'Please input your username!' }]}
>
<Input />
</Form.Item>
<Form.Item
label="Password"
name="password"
rules={[{ required: true, message: 'Please input your password!' }]}
>
<Input.Password />
</Form.Item>
<Form.Item {...tailLayout} name="remember" valuePropName="checked">
<Checkbox>Remember me</Checkbox>
</Form.Item>
<Form.Item {...tailLayout}>
<Button type="primary" htmlType="submit">
Submit
</Button>
</Form.Item>
</Form>
\ No newline at end of file
......@@ -69,6 +69,8 @@ const requestList = [
"/tos/community/categories/subscribe/cancel",//5取消预约
"/tos/community/facilities/add",//6 新增小区设施
"/tos/bookingService/lookUp",//7 查看小区设施
"/tos/community/facilities/fuzzy/query",//8 查看设施管理模糊
"/tos/community/categories/subscribe/fuzzy/query",//9 预订列表模糊查询
]
function requestAuto(url:string,values:any) {
return request(url, Body(values))
......
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