Commit 03f019c0 authored by Sixiang_Zzb's avatar Sixiang_Zzb

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

parent e332d6f6
......@@ -3,37 +3,39 @@ import { connect } from 'umi';
import SearchOptions from './SearchOptions';
import SearchOptionsTow from './SearchOptionsTow';
const SearchOptionsCommnity = (props: any) => {
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(() => {
if (CommunityList == null) {
tosCommunityget(null)
tosCommunityget(null);
}
}, []);
const extendName = (values: any) => {
// console.log(values)
opname(values)
}
opname(values);
};
return (
<>{CommunityList != null ?
// <SearchOptions
// titleSearch={titleSearch}
// disabled={disabled}
// placeholder={placeholder}
// defaultValue={props.defaultValue!=null?props.defaultValue:value}
// list={CommunityList}
// onSubmit={extendName} />
<SearchOptionsTow list={CommunityList} extendName={extendName} def={defaultName}></SearchOptionsTow>
: null
}
<>
{CommunityList != null ? (
// <SearchOptions
// titleSearch={titleSearch}
// disabled={disabled}
// placeholder={placeholder}
// defaultValue={props.defaultValue!=null?props.defaultValue:value}
// list={CommunityList}
// onSubmit={extendName} />
<SearchOptionsTow
list={CommunityList}
extendName={extendName}
def={defaultName}
></SearchOptionsTow>
) : null}
</>
);
};
......
import React from 'react'
import React from 'react';
import { Select } from 'antd';
const { Option } = Select;
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;
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
export default SearchOptionsTow;
......@@ -14,11 +14,7 @@ import { gray } from 'chalk';
import SearchOptionsCommnity from '../SearchOptions/SearchOptionsCommnity';
const TitleSearch = (props: any) => {
// console.log("===================================", props)
const { dispatch, CommunityList } = props;
const key = props.listkey
const key = props.listkey;
const name = props.list;
// const single = props.single
// const checklist = props.checklist;
......@@ -26,60 +22,63 @@ const TitleSearch = (props: any) => {
// const communitySelect = props.communitySelect
// 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 community = props.community;
const [selectOptions, setSelectOptions] = useState(true)
const [communitys, setCommunitys] = useState(CommunityList)
const [communitySingle, setCommunitySingle] = useState(null)
const [datePicker, setDate] = useState(null)
const [selectOptions, setSelectOptions] = useState(true);
const [communitys, setCommunitys] = useState(CommunityList);
const [communitySingle, setCommunitySingle] = 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(() => {
// console.log("标题搜寻组件初始化") OK
if (CommunityList == null) {
// console.log("小区数量初始化") OK
tosCommunityget(null)
tosCommunityget(null);
}
if (defaultValue != null) {
form.setFieldsValue(defaultValue)
form.setFieldsValue(defaultValue);
}
}, []);
useEffect(() => {
if (defaultValue != null) {
form.setFieldsValue(defaultValue)
form.setFieldsValue(defaultValue);
}
}, [defaultValue])
useEffect(() => {
// console.log(CommunityList)
}, [defaultValue]);
useEffect(() => {
if (CommunityList != null) {
// console.log("小区数量初始化完毕") OK
var tmp = {}
tmp[community] = CommunityList
var tmp = {};
tmp[community] = CommunityList;
// props.onSubmit(tmp) 禁用 改用组件初始化
setCommunitys(CommunityList)
setCommunitys(CommunityList);
}
}, [CommunityList])
}, [CommunityList]);
const onFinish = (values: any) => {
if (datePicker) {
values[time[0]] = datePicker;
}
if (community) {
values[community] = communitys
values[community] = communitys;
}
console.log('Success:', values);
props.onSubmit(values)
props.onSubmit(values);
};
const onFinishFailed = (errorInfo: any) => {
......@@ -87,90 +86,107 @@ const TitleSearch = (props: any) => {
};
const onChange = (date: any, dateString: string) => {
setDate(dateString)
}
setDate(dateString);
};
const printContent = (comment: any) => {
setCommunitys(comment)
}
setCommunitys(comment);
};
// 选择小区名字并赋值
const opname = (value: any) => {
form.setFieldsValue({
'communityName': value
})
}
communityName: value,
});
};
return (
<>
<Form form={form} name="basic" onFinish={onFinish} onFinishFailed={onFinishFailed}>
<Row gutter={32}>
{
communitySelect != null ?
<Col key={"communitySelect_"} ><Form.Item name={"communityName"}><SearchOptionsCommnity titleSearch={true} opname={opname} /></Form.Item></Col>
: null
}
{
key != null ?
key.map((item, index) => {
{communitySelect != null ? (
<Col key={'communitySelect_'}>
<Form.Item name={'communityName'}>
<SearchOptionsCommnity
titleSearch={true}
opname={opname}
defaultName={
defaultValue && defaultValue.communityName ? defaultValue.communityName : null
}
/>
</Form.Item>
</Col>
) : null}
{key != null
? key.map((item, index) => {
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
}
{
status != null ?
status.map((item, index) => {
: null}
{status != null
? status.map((item, index) => {
return (
<Col key={"StatusCol_" + index}>
<Col key={'StatusCol_' + index}>
<Form.Item name={item.name[0]}>
<Select style={{ width: 160 }} placeholder={item.name[1]} allowClear={true}>
{
item.data.map(word => {
return (
<Option key={word} value={word[0]}>{word[1]}</Option>
)
})
}
{item.data.map((word) => {
return (
<Option key={word} value={word[0]}>
{word[1]}
</Option>
);
})}
</Select>
</Form.Item>
</Col>
)
);
})
: null
}
{
time != null ?
<Col key={"datePicker_"} > <DatePicker placeholder={time[1]} onChange={onChange} /></Col>
: null
}
{
community == null ?
<Col><Form.Item><Button type="primary" htmlType="submit">Search</Button></Form.Item></Col>
: null
}
: null}
{time != null ? (
<Col key={'datePicker_'}>
{' '}
<DatePicker placeholder={time[1]} onChange={onChange} />
</Col>
) : null}
{community == null ? (
<Col>
<Form.Item>
<Button type="primary" htmlType="submit">
Search
</Button>
</Form.Item>
</Col>
) : null}
</Row>
{
community != null ?
<>
{
CommunityList != null ?
<SelectOptions checklist={checklist} single={single} list={CommunityList.sort()} show={selectOptions} onSubmit={printContent} /> :
null
}
<Form.Item><Button type="primary" htmlType="submit" style={{ backgroundColor: "#e7f4ff", color: "rgba(24,144,255,1)" }}>Search</Button></Form.Item>
</> : null
}
{community != null ? (
<>
{CommunityList != null ? (
<SelectOptions
checklist={checklist}
single={single}
list={CommunityList.sort()}
show={selectOptions}
onSubmit={printContent}
/>
) : null}
<Form.Item>
<Button
type="primary"
htmlType="submit"
style={{ backgroundColor: '#e7f4ff', color: 'rgba(24,144,255,1)' }}
>
Search
</Button>
</Form.Item>
</>
) : null}
</Form>
</>
);
};
......@@ -194,4 +210,4 @@ export default connect(mapStateToProps)(TitleSearch);
// time={["key", "预订时间筛选"]}
// community={"communityName"}
// // single={true}
// onSubmit={CallBackTitleSearch} />
\ No newline at end of file
// onSubmit={CallBackTitleSearch} />
......@@ -9,124 +9,162 @@ import { timestampToTime3 } from '../../utils/time';
import TitleSearch from '../../components/TitleSearch/TitleSearch';
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 { dispatch, location, Data } = props;
const [loading, setLoading] = useState(false)
const [pageNum, setPageNum] = useState(1)
const [serviceTypeGobal, setServiceType] = useState("")
const [readyData, setReadyData] = useState(null)
const [loading, setLoading] = useState(false);
// const [pageNum, setPageNum] = useState(1)
const [serviceTypeGobal, setServiceType] = useState('');
const [readyData, setReadyData] = useState(null);
const columns = [
{ title: "Community Name", dataIndex: 'community_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: "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>) },
{ title: 'Community Name', dataIndex: 'community_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: '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) => {
console.log(value);
console.log(serviceTypeGobal);
console.log(record);
//页面递进
history.push(
location.pathname + (value == 0 ? "/Edit" : "/Detail") + urlEncode(
{
location.pathname +
(value == 0 ? '/Edit' : '/Detail') +
urlEncode({
serviceType: serviceTypeGobal,
id: record.id,
user_id: record.user_id,
community_id: record.community_id
}
)
)
}
community_id: record.community_id,
}),
);
};
useEffect(() => {
if (Data != null) { setLoading(false) }
if (Data != null) {
setLoading(false);
}
}, [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(() => {
if (location != null) {
//细分类:页面指令
var serviceType = ""
var serviceType = '';
pathname.map((item, index) => {
if ((location.pathname).indexOf(item) > -1) {
serviceType = "" + (index + 1)
setServiceType(serviceType)
if (location.pathname.indexOf(item) > -1) {
serviceType = '' + (index + 1);
setServiceType(serviceType);
}
})
});
//分页设置
if (location.query.current != null) {
setPageNum(parseInt(location.query.current))
if (location.query.pageNum != null) {
pageNum = parseInt(location.query.pageNum);
} else {
setPageNum(1)
pageNum = 1;
}
//前置数据
console.log("前置数据");
var tmp = filterObjbyTg(location.query, ["handleStatus", "ownerName", "communityName"])
tmp.handleStatus = handle_Status[parseInt(tmp.handleStatus)] //特殊处理
setReadyData(tmp)
var tmp: any = filterObjbyTg(location.query, ['handleStatus', 'ownerName', 'communityName']);
tmp.handleStatus = handle_Status[parseInt(tmp.handleStatus)]; //特殊处理
setReadyData(tmp);
console.log(tmp);
//获取数据
setLoading(true)
console.log(serviceType)
console.log(location.query)
RA(40, {
serviceType: serviceType,
handleStatus: location.query.handleStatus != undefined ? parseInt(location.query.handleStatus) : null,
ownerName: location.query.ownerName != undefined ? (location.query.ownerName) : null,
communityName: location.query.communityName != undefined ? (location.query.communityName) : null,
pageNum,
}, module, dispatch)
setLoading(true);
RA(
40,
{
serviceType: serviceType,
handleStatus:
location.query.handleStatus != undefined ? parseInt(location.query.handleStatus) : null,
ownerName: location.query.ownerName != undefined ? location.query.ownerName : null,
communityName:
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 (
<div className={styles.base}>
<TitleSearch
communitySelect={true}
listkey={['ownerName']}
list={['Owner Name']}
status={[{ name: ["handleStatus", "Status"], data: handle_Status }]}
status={[{ name: ['handleStatus', 'Status'], data: handle_Status }]}
defaultValue={readyData}
onSubmit={ClickTitleSearch}
/>
<Table
rowKey={"id"}
rowKey={'id'}
style={{ marginTop: 16 }}
loading={loading}
columns={columns}
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}
/>
</div>
......@@ -136,7 +174,7 @@ const PropertyServices = (props: any) => {
function mapStateToProps(state: any) {
const { Data } = state.CommunityService;
return {
Data
Data,
};
}
export default connect(mapStateToProps)(PropertyServices);
......@@ -49,6 +49,7 @@ const Renovation = (props: any) => {
setReadyData(tmp)
//获取数据
setLoading(true)
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