Commit 03f019c0 authored by Sixiang_Zzb's avatar Sixiang_Zzb

接口更新,小区保养模块bug处理

parent e332d6f6
...@@ -3,37 +3,39 @@ import { connect } from 'umi'; ...@@ -3,37 +3,39 @@ import { connect } from 'umi';
import SearchOptions from './SearchOptions'; import SearchOptions from './SearchOptions';
import SearchOptionsTow from './SearchOptionsTow'; import SearchOptionsTow from './SearchOptionsTow';
const SearchOptionsCommnity = (props: any) => { const SearchOptionsCommnity = (props: any) => {
const { dispatch, CommunityList, opname, defaultName } = props; const { dispatch, CommunityList, opname, defaultName } = props;
const tosCommunityget = (values: any) => { dispatch({ type: 'Init/tosCommunityget', playload: values }) }; const tosCommunityget = (values: any) => {
dispatch({ type: 'Init/tosCommunityget', playload: values });
};
useEffect(() => { useEffect(() => {
if (CommunityList == null) { if (CommunityList == null) {
tosCommunityget(null) tosCommunityget(null);
} }
}, []); }, []);
const extendName = (values: any) => { const extendName = (values: any) => {
// console.log(values) // console.log(values)
opname(values) opname(values);
} };
return ( return (
<>{CommunityList != null ? <>
// <SearchOptions {CommunityList != null ? (
// titleSearch={titleSearch} // <SearchOptions
// disabled={disabled} // titleSearch={titleSearch}
// placeholder={placeholder} // disabled={disabled}
// defaultValue={props.defaultValue!=null?props.defaultValue:value} // placeholder={placeholder}
// list={CommunityList} // defaultValue={props.defaultValue!=null?props.defaultValue:value}
// onSubmit={extendName} /> // list={CommunityList}
// onSubmit={extendName} />
<SearchOptionsTow list={CommunityList} extendName={extendName} def={defaultName}></SearchOptionsTow>
: null <SearchOptionsTow
} list={CommunityList}
extendName={extendName}
def={defaultName}
></SearchOptionsTow>
) : null}
</> </>
); );
}; };
......
import React from 'react' import React from 'react';
import { Select } from 'antd'; import { Select } from 'antd';
const { Option } = Select; const { Option } = Select;
const SearchOptionsTow = (porps: any) => { const SearchOptionsTow = (porps: any) => {
const { list, extendName, def } = porps;
const options = list.map((d: any, index: number) => (
<Option value={d} key={index}>
{d}
</Option>
));
function onChange(value: any) {
// console.log(`selected ${value}`);
extendName(value);
}
console.log(def);
return (
<div>
<Select
showSearch
style={{ width: 200 }}
placeholder="Community Name"
optionFilterProp="children"
onChange={onChange}
defaultValue={def}
>
{options}
</Select>
</div>
);
};
const { list, extendName, def } = porps; export default SearchOptionsTow;
const options = list.map((d: any, index: number) => <Option value={d} key={index}>{d}</Option>);
function onChange(value: any) {
// console.log(`selected ${value}`);
extendName(value)
}
return (
<div>
<Select
showSearch
style={{ width: 200 }}
placeholder="Community Name"
optionFilterProp="children"
onChange={onChange}
defaultValue={def}
>
{options}
</Select>
</div>
)
}
export default SearchOptionsTow
...@@ -14,11 +14,7 @@ import { gray } from 'chalk'; ...@@ -14,11 +14,7 @@ import { gray } from 'chalk';
import SearchOptionsCommnity from '../SearchOptions/SearchOptionsCommnity'; import SearchOptionsCommnity from '../SearchOptions/SearchOptionsCommnity';
const TitleSearch = (props: any) => { const TitleSearch = (props: any) => {
// console.log("===================================", props) const key = props.listkey;
const { dispatch, CommunityList } = props;
const key = props.listkey
const name = props.list; const name = props.list;
// const single = props.single // const single = props.single
// const checklist = props.checklist; // const checklist = props.checklist;
...@@ -26,60 +22,63 @@ const TitleSearch = (props: any) => { ...@@ -26,60 +22,63 @@ const TitleSearch = (props: any) => {
// const communitySelect = props.communitySelect // const communitySelect = props.communitySelect
// const defaultValue = props.defaultValue; // const defaultValue = props.defaultValue;
const { single, checklist, status, communitySelect, defaultValue } = props; const {
dispatch,
CommunityList,
single,
checklist,
status,
communitySelect,
defaultValue,
} = props;
const time = props.time; const time = props.time;
const community = props.community; const community = props.community;
const [selectOptions, setSelectOptions] = useState(true) const [selectOptions, setSelectOptions] = useState(true);
const [communitys, setCommunitys] = useState(CommunityList) const [communitys, setCommunitys] = useState(CommunityList);
const [communitySingle, setCommunitySingle] = useState(null) const [communitySingle, setCommunitySingle] = useState(null);
const [datePicker, setDate] = useState(null) const [datePicker, setDate] = useState(null);
const [form] = Form.useForm() const [form] = Form.useForm();
const tosCommunityget = (values: any) => { dispatch({ type: 'Init/tosCommunityget', playload: values }) }; const tosCommunityget = (values: any) => {
dispatch({ type: 'Init/tosCommunityget', playload: values });
};
useEffect(() => { useEffect(() => {
// console.log("标题搜寻组件初始化") OK // console.log("标题搜寻组件初始化") OK
if (CommunityList == null) { if (CommunityList == null) {
// console.log("小区数量初始化") OK // console.log("小区数量初始化") OK
tosCommunityget(null) tosCommunityget(null);
} }
if (defaultValue != null) { if (defaultValue != null) {
form.setFieldsValue(defaultValue) form.setFieldsValue(defaultValue);
} }
}, []); }, []);
useEffect(() => { useEffect(() => {
if (defaultValue != null) { if (defaultValue != null) {
form.setFieldsValue(defaultValue) form.setFieldsValue(defaultValue);
} }
}, [defaultValue]) }, [defaultValue]);
useEffect(() => {
// console.log(CommunityList)
useEffect(() => {
if (CommunityList != null) { if (CommunityList != null) {
// console.log("小区数量初始化完毕") OK var tmp = {};
var tmp = {} tmp[community] = CommunityList;
tmp[community] = CommunityList
// props.onSubmit(tmp) 禁用 改用组件初始化 // props.onSubmit(tmp) 禁用 改用组件初始化
setCommunitys(CommunityList) setCommunitys(CommunityList);
} }
}, [CommunityList]) }, [CommunityList]);
const onFinish = (values: any) => { const onFinish = (values: any) => {
if (datePicker) { if (datePicker) {
values[time[0]] = datePicker; values[time[0]] = datePicker;
} }
if (community) { if (community) {
values[community] = communitys values[community] = communitys;
} }
console.log('Success:', values); console.log('Success:', values);
props.onSubmit(values) props.onSubmit(values);
}; };
const onFinishFailed = (errorInfo: any) => { const onFinishFailed = (errorInfo: any) => {
...@@ -87,90 +86,107 @@ const TitleSearch = (props: any) => { ...@@ -87,90 +86,107 @@ const TitleSearch = (props: any) => {
}; };
const onChange = (date: any, dateString: string) => { const onChange = (date: any, dateString: string) => {
setDate(dateString) setDate(dateString);
} };
const printContent = (comment: any) => { const printContent = (comment: any) => {
setCommunitys(comment) setCommunitys(comment);
} };
// 选择小区名字并赋值 // 选择小区名字并赋值
const opname = (value: any) => { const opname = (value: any) => {
form.setFieldsValue({ form.setFieldsValue({
'communityName': value communityName: value,
}) });
} };
return ( return (
<> <>
<Form form={form} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed}> <Form form={form} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed}>
<Row gutter={32}> <Row gutter={32}>
{ {communitySelect != null ? (
communitySelect != null ? <Col key={'communitySelect_'}>
<Col key={"communitySelect_"} ><Form.Item name={"communityName"}><SearchOptionsCommnity titleSearch={true} opname={opname} /></Form.Item></Col> <Form.Item name={'communityName'}>
: null <SearchOptionsCommnity
} titleSearch={true}
{ opname={opname}
key != null ? defaultName={
key.map((item, index) => { defaultValue && defaultValue.communityName ? defaultValue.communityName : null
}
/>
</Form.Item>
</Col>
) : null}
{key != null
? key.map((item, index) => {
return ( return (
<Col key={"KeyCol_" + index}><Form.Item name={item}><Input placeholder={name[index]} allowClear /></Form.Item></Col> <Col key={'KeyCol_' + index}>
) <Form.Item name={item}>
<Input placeholder={name[index]} allowClear />
</Form.Item>
</Col>
);
}) })
: null : null}
} {status != null
{ ? status.map((item, index) => {
status != null ?
status.map((item, index) => {
return ( return (
<Col key={"StatusCol_" + index}> <Col key={'StatusCol_' + index}>
<Form.Item name={item.name[0]}> <Form.Item name={item.name[0]}>
<Select style={{ width: 160 }} placeholder={item.name[1]} allowClear={true}> <Select style={{ width: 160 }} placeholder={item.name[1]} allowClear={true}>
{ {item.data.map((word) => {
item.data.map(word => { return (
return ( <Option key={word} value={word[0]}>
<Option key={word} value={word[0]}>{word[1]}</Option> {word[1]}
) </Option>
}) );
} })}
</Select> </Select>
</Form.Item> </Form.Item>
</Col> </Col>
) );
}) })
: null : null}
} {time != null ? (
{ <Col key={'datePicker_'}>
time != null ? {' '}
<Col key={"datePicker_"} > <DatePicker placeholder={time[1]} onChange={onChange} /></Col> <DatePicker placeholder={time[1]} onChange={onChange} />
: null </Col>
} ) : null}
{ {community == null ? (
community == null ? <Col>
<Col><Form.Item><Button type="primary" htmlType="submit">Search</Button></Form.Item></Col> <Form.Item>
: null <Button type="primary" htmlType="submit">
} Search
</Button>
</Form.Item>
</Col>
) : null}
</Row> </Row>
{ {community != null ? (
community != null ? <>
<> {CommunityList != null ? (
{ <SelectOptions
CommunityList != null ? checklist={checklist}
<SelectOptions checklist={checklist} single={single} list={CommunityList.sort()} show={selectOptions} onSubmit={printContent} /> : single={single}
null 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 ) : null}
}
<Form.Item>
<Button
type="primary"
htmlType="submit"
style={{ backgroundColor: '#e7f4ff', color: 'rgba(24,144,255,1)' }}
>
Search
</Button>
</Form.Item>
</>
) : null}
</Form> </Form>
</> </>
); );
}; };
...@@ -194,4 +210,4 @@ export default connect(mapStateToProps)(TitleSearch); ...@@ -194,4 +210,4 @@ export default connect(mapStateToProps)(TitleSearch);
// time={["key", "预订时间筛选"]} // time={["key", "预订时间筛选"]}
// community={"communityName"} // community={"communityName"}
// // single={true} // // single={true}
// onSubmit={CallBackTitleSearch} /> // onSubmit={CallBackTitleSearch} />
\ No newline at end of file
...@@ -9,124 +9,162 @@ import { timestampToTime3 } from '../../utils/time'; ...@@ -9,124 +9,162 @@ import { timestampToTime3 } from '../../utils/time';
import TitleSearch from '../../components/TitleSearch/TitleSearch'; import TitleSearch from '../../components/TitleSearch/TitleSearch';
import { RA, urlEncode, filterObj, filterObjbyTg } from '@/utils/method'; import { RA, urlEncode, filterObj, filterObjbyTg } from '@/utils/method';
const pathname = [
'CommunityMaintenance',
'ShelfLifeService',
'OwnerComplaints',
'ReportOnline',
'ProblemFeedback',
];
const handle_Status = [
[0, 'Pending'],
[1, 'Processed'],
]; //["未处理","处理","拒绝"] , [2,"Rejected"]
const goToName = ['Reply', 'Detail'];
const module = 'CommunityService';
// 页码
let pageNum = 1;
const pathname = ["CommunityMaintenance", "ShelfLifeService", "OwnerComplaints", "ReportOnline", "ProblemFeedback"]
const handle_Status = [[0, "Pending"], [1, "Processed"]]//["未处理","处理","拒绝"] , [2,"Rejected"]
const goToName = ["Reply", "Detail"];
const module = "CommunityService"
const PropertyServices = (props: any) => { const PropertyServices = (props: any) => {
const { dispatch, location, Data } = props; const { dispatch, location, Data } = props;
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false);
const [pageNum, setPageNum] = useState(1) // const [pageNum, setPageNum] = useState(1)
const [serviceTypeGobal, setServiceType] = useState("") const [serviceTypeGobal, setServiceType] = useState('');
const [readyData, setReadyData] = useState(null) const [readyData, setReadyData] = useState(null);
const columns = [ const columns = [
{ title: "Community Name", dataIndex: 'community_name', }, { title: 'Community Name', dataIndex: 'community_name' },
{ title: "Ower Name", dataIndex: 'ower_name', }, { title: 'Ower Name', dataIndex: 'ower_name' },
{ title: "service Content", dataIndex: 'service_content', ellipsis: true, width: 500, render: (text: any) => (<Space size="middle">{text != null ? text : "--"}</Space>) }, {
{ title: "Create Time", dataIndex: "create_time", render: (text: any, record: any) => (<Space size="middle">{timestampToTime3(text.time)}</Space>) }, title: 'service Content',
{ title: "Handle status", dataIndex: 'handle_status', render: (text: any, record: any) => (<Space size="middle">{handle_Status[text][1]}</Space>) }, dataIndex: 'service_content',
{ title: "Actions", dataIndex: 'handle_status', render: (text: any, record: any) => (<Space size="middle"><a onClick={goToDetail.bind(this, text, record)}>{goToName[text]}</a></Space>) }, ellipsis: true,
width: 500,
render: (text: any) => <Space size="middle">{text != null ? text : '--'}</Space>,
},
{
title: 'Create Time',
dataIndex: 'create_time',
render: (text: any, record: any) => (
<Space size="middle">{timestampToTime3(text.time)}</Space>
),
},
{
title: 'Handle status',
dataIndex: 'handle_status',
render: (text: any, record: any) => <Space size="middle"> {handle_Status[text][1]}</Space>,
},
{
title: 'Actions',
dataIndex: 'handle_status',
render: (text: any, record: any) => (
<Space size="middle">
<a onClick={goToDetail.bind(this, text, record)}>{goToName[text]}</a>
</Space>
),
},
]; ];
const goToDetail = (value: any, record: any, e: any) => { const goToDetail = (value: any, record: any, e: any) => {
console.log(value);
console.log(serviceTypeGobal);
console.log(record);
//页面递进 //页面递进
history.push( history.push(
location.pathname + (value == 0 ? "/Edit" : "/Detail") + urlEncode( location.pathname +
{ (value == 0 ? '/Edit' : '/Detail') +
urlEncode({
serviceType: serviceTypeGobal, serviceType: serviceTypeGobal,
id: record.id, id: record.id,
user_id: record.user_id, user_id: record.user_id,
community_id: record.community_id community_id: record.community_id,
} }),
) );
) };
}
useEffect(() => { useEffect(() => {
if (Data != null) { setLoading(false) } if (Data != null) {
setLoading(false);
}
}, [Data]); }, [Data]);
const ClickTitleSearch = (comment: any) => {
//页面搜索
comment.serviceType = serviceTypeGobal
comment.current = 1
history.push(location.pathname + urlEncode(filterObj(comment)))
}
const PageChange = (values: any) => { //.current
//页面跳转参数
var tmp = filterObjbyTg(location.query, ["handleStatus", "ownerName", "communityName"])
tmp["current"] = values.current
history.push(location.pathname + urlEncode(tmp))
}
useEffect(() => { useEffect(() => {
if (location != null) { if (location != null) {
//细分类:页面指令 //细分类:页面指令
var serviceType = "" var serviceType = '';
pathname.map((item, index) => { pathname.map((item, index) => {
if ((location.pathname).indexOf(item) > -1) { if (location.pathname.indexOf(item) > -1) {
serviceType = "" + (index + 1) serviceType = '' + (index + 1);
setServiceType(serviceType) setServiceType(serviceType);
} }
}) });
//分页设置 //分页设置
if (location.query.current != null) { if (location.query.pageNum != null) {
setPageNum(parseInt(location.query.current)) pageNum = parseInt(location.query.pageNum);
} else { } else {
setPageNum(1) pageNum = 1;
} }
//前置数据 //前置数据
console.log("前置数据"); var tmp: any = filterObjbyTg(location.query, ['handleStatus', 'ownerName', 'communityName']);
var tmp = filterObjbyTg(location.query, ["handleStatus", "ownerName", "communityName"]) tmp.handleStatus = handle_Status[parseInt(tmp.handleStatus)]; //特殊处理
tmp.handleStatus = handle_Status[parseInt(tmp.handleStatus)] //特殊处理 setReadyData(tmp);
setReadyData(tmp) console.log(tmp);
//获取数据 //获取数据
setLoading(true) setLoading(true);
console.log(serviceType) RA(
console.log(location.query) 40,
RA(40, { {
serviceType: serviceType, serviceType: serviceType,
handleStatus: location.query.handleStatus != undefined ? parseInt(location.query.handleStatus) : null, handleStatus:
ownerName: location.query.ownerName != undefined ? (location.query.ownerName) : null, location.query.handleStatus != undefined ? parseInt(location.query.handleStatus) : null,
communityName: location.query.communityName != undefined ? (location.query.communityName) : null, ownerName: location.query.ownerName != undefined ? location.query.ownerName : null,
pageNum, communityName:
}, module, dispatch) location.query.communityName != undefined ? location.query.communityName : null,
pageNum,
},
module,
dispatch,
);
} }
}, [location]) }, [location]);
const PageChange = (values: any) => {
//页面跳转参数
var tmp = filterObjbyTg(location.query, ['handleStatus', 'ownerName', 'communityName']);
tmp['pageNum'] = values.current;
history.push(location.pathname + urlEncode(tmp));
};
const ClickTitleSearch = (comment: any) => {
//页面搜索
comment.serviceType = serviceTypeGobal;
comment.pageNum = 1;
history.push(location.pathname + urlEncode(filterObj(comment)));
};
return ( return (
<div className={styles.base}> <div className={styles.base}>
<TitleSearch <TitleSearch
communitySelect={true} communitySelect={true}
listkey={['ownerName']} listkey={['ownerName']}
list={['Owner Name']} list={['Owner Name']}
status={[{ name: ["handleStatus", "Status"], data: handle_Status }]} status={[{ name: ['handleStatus', 'Status'], data: handle_Status }]}
defaultValue={readyData} defaultValue={readyData}
onSubmit={ClickTitleSearch} onSubmit={ClickTitleSearch}
/> />
<Table <Table
rowKey={"id"} rowKey={'id'}
style={{ marginTop: 16 }} style={{ marginTop: 16 }}
loading={loading} loading={loading}
columns={columns} columns={columns}
dataSource={Data != null ? Data.data.rows : []} dataSource={Data != null ? Data.data.rows : []}
pagination={Data != null ? { current: pageNum, total: Data.data.rows.length } : {}} pagination={{
defaultPageSize: 15,
current: pageNum,
total: Data != null ? Data.data.page.totalRow : 0,
showSizeChanger: false,
}}
onChange={PageChange} onChange={PageChange}
/> />
</div> </div>
...@@ -136,7 +174,7 @@ const PropertyServices = (props: any) => { ...@@ -136,7 +174,7 @@ const PropertyServices = (props: any) => {
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
const { Data } = state.CommunityService; const { Data } = state.CommunityService;
return { return {
Data Data,
}; };
} }
export default connect(mapStateToProps)(PropertyServices); export default connect(mapStateToProps)(PropertyServices);
...@@ -49,6 +49,7 @@ const Renovation = (props: any) => { ...@@ -49,6 +49,7 @@ const Renovation = (props: any) => {
setReadyData(tmp) setReadyData(tmp)
//获取数据 //获取数据
setLoading(true) setLoading(true)
RA(23, { serviceType: "6", id: "" }, module, dispatch) RA(23, { serviceType: "6", id: "" }, module, dispatch)
} }
......
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