Commit c66f055c authored by Sixiang_Zzb's avatar Sixiang_Zzb

小区保养列表显示 bug处理

parent 0837b343
...@@ -13,7 +13,6 @@ const SearchOptionsTow = (porps: any) => { ...@@ -13,7 +13,6 @@ const SearchOptionsTow = (porps: any) => {
// console.log(`selected ${value}`); // console.log(`selected ${value}`);
extendName(value); extendName(value);
} }
console.log(def);
return ( return (
<div> <div>
<Select <Select
......
...@@ -2,7 +2,7 @@ import * as service from '@/services/tos'; ...@@ -2,7 +2,7 @@ import * as service from '@/services/tos';
import { message } from 'antd'; import { message } from 'antd';
import { Link, useIntl, connect, Dispatch, history } from 'umi'; import { Link, useIntl, connect, Dispatch, history } from 'umi';
import { routerRedux } from 'dva/router' import { routerRedux } from 'dva/router';
import { timestampToTime, timestampToTime4 } from '@/utils/time'; import { timestampToTime, timestampToTime4 } from '@/utils/time';
import { picFromate, Fromate } from '@/utils/method'; import { picFromate, Fromate } from '@/utils/method';
...@@ -11,13 +11,13 @@ export default { ...@@ -11,13 +11,13 @@ export default {
namespace: 'CommunityService', namespace: 'CommunityService',
state: { state: {
Data: null, Data: null,
DataSave:null, DataSave: null,
CurData: null, CurData: null,
CurDataDetail: null, CurDataDetail: null,
Data7: null, Data7: null,
Data8: null, Data8: null,
Result: null, Result: null,
DataSaveDetail:null, DataSaveDetail: null,
}, },
reducers: { reducers: {
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
return { ...state, Data }; return { ...state, Data };
}, },
returnDataSave(state, { DataSave }) { returnDataSave(state, { DataSave }) {
return { ...state, DataSave } return { ...state, DataSave };
}, },
returnCurData(state, { CurData }) { returnCurData(state, { CurData }) {
return { ...state, CurData }; return { ...state, CurData };
...@@ -45,99 +45,107 @@ export default { ...@@ -45,99 +45,107 @@ export default {
returnDataSaveDetail(state, { DataSaveDetail }) { returnDataSaveDetail(state, { DataSaveDetail }) {
return { ...state, DataSaveDetail }; return { ...state, DataSaveDetail };
}, },
}, },
effects: { effects: {
//预订设施查询
*RA({ playload }, { call, put }) {
//预订设施查询 switch (playload.index) {
*RA({ playload }, { call, put }) { case 40:
switch (playload.index) { {
case 40: { var Data = null;
var Data = null yield put({ type: 'returnPage', Data });
yield put({ type: 'returnPage', Data});
} break;
}
const resp = yield call(service.RA, playload);
console.log(resp)
if (resp.code == 500||resp.error_code!="0000") {
// window.location.href = '/500';
} }
if (resp.error_code != "0000") { break;
console.log("请求错误码:" + "(" + playload.index + ")" + resp.error_code) }
console.log(playload) const resp = yield call(service.RA, playload);
} else { console.log(resp);
if (resp.code == 500 || resp.error_code != '0000') {
switch (playload.index) { // window.location.href = '/500';
}
case 21: if (resp.error_code != '0000') {
{ console.log('请求错误码:' + '(' + playload.index + ')' + resp.error_code);
var tmp = resp.data.rows[0].tosOwerModel; console.log(playload);
var tmp2 = resp.data.rows[0]; } else {
switch (playload.index) {
console.log(resp.data.rows[0].replyImgUrl) case 21:
console.log(Fromate(resp.data.rows[0].replyImgUrl,[["url",null]])) {
var CurDataDetail = { var tmp = resp.data.rows[0].tosOwerModel;
community: tmp.communityName, var tmp2 = resp.data.rows[0];
address: tmp.addressAndpostalCode,
home: tmp.buildingNumber + "#" + tmp.floorNumber + "-" + tmp.roomNumber, console.log(resp.data.rows[0].replyImgUrl);
name: tmp.owerName, console.log(Fromate(resp.data.rows[0].replyImgUrl, [['url', null]]));
phone: tmp.accountLogin!=null?tmp.accountLogin:tmp.owerPhone, var CurDataDetail = {
email: tmp.owerEmail, community: tmp.communityName,
content: resp.data.rows[0].serviceContent, address: tmp.addressAndpostalCode,
replyContent: resp.data.rows[0].replyContent, home: tmp.buildingNumber + '#' + tmp.floorNumber + '-' + tmp.roomNumber,
replyImgUrl: Fromate(resp.data.rows[0].replyImgUrl,[["url",null]]), name: tmp.owerName,
status: tmp2.handleStatus, phone: tmp.accountLogin != null ? tmp.accountLogin : tmp.owerPhone,
pictrues: picFromate(tmp2.imgUrl), email: tmp.owerEmail,
time: timestampToTime4(tmp2.createTime.time) content: resp.data.rows[0].serviceContent,
}; replyContent: resp.data.rows[0].replyContent,
yield put({ type: 'returnCurDataDetail', CurDataDetail, }); replyImgUrl: Fromate(resp.data.rows[0].replyImgUrl, [['url', null]]),
} break; status: tmp2.handleStatus,
case 33: pictrues: picFromate(tmp2.imgUrl),
case 22: { time: timestampToTime4(tmp2.createTime.time),
message.success("Success Operation!", 3) };
history.go(-1) yield put({ type: 'returnCurDataDetail', CurDataDetail });
// history.push("/CommercialService/CommunityMaintenance")
} break;
case 23: {
let Data8 = resp;
yield put({ type: 'returnPage8', Data8, });
} break;
case 31: {
let Data7 = resp;
yield put({ type: 'returnPage7', Data7 })
} break;
case 35: {
let Result = resp;
yield put({ type: 'returnResult', Result })
} break;
case 37:
case 36: {
let DataSaveDetail = resp;
yield put({ type: 'returnDataSaveDetail', DataSaveDetail, });
} break;
case 40: {
let Data = resp;
yield put({ type: 'returnPage', Data, });
} break;
} }
} break;
case 33:
case 22:
{
message.success('Success Operation!', 3);
history.go(-1);
// history.push("/CommercialService/CommunityMaintenance")
}
break;
case 23:
{
let Data8 = resp;
yield put({ type: 'returnPage8', Data8 });
}
break;
case 31:
{
let Data7 = resp;
yield put({ type: 'returnPage7', Data7 });
}
break;
case 35:
{
let Result = resp;
yield put({ type: 'returnResult', Result });
}
break;
case 37:
case 36:
{
let DataSaveDetail = resp;
yield put({ type: 'returnDataSaveDetail', DataSaveDetail });
}
break;
case 40:
{
let Data = resp;
yield put({ type: 'returnPage', Data });
}
break;
}
}
}, },
// *TosCommunityServiceGetDetail({ playload }, { call, put }) { // *TosCommunityServiceGetDetail({ playload }, { call, put }) {
// const resp = yield call(service.TosCommunityServiceGetDetail, playload); // const resp = yield call(service.TosCommunityServiceGetDetail, playload);
// console.log(resp) // console.log(resp)
// if (resp.error_code !=0 ) { // if (resp.error_code !=0 ) {
// window.location.href = '/500'; // window.location.href = '/500';
// } else { // } else {
// var tmp = resp.data.rows[0].tosOwerModel; // var tmp = resp.data.rows[0].tosOwerModel;
// var tmp2 = resp.data.rows[0]; // var tmp2 = resp.data.rows[0];
// console.log(tmp2.imgUrl) // console.log(tmp2.imgUrl)
// // TODO:还差图片 // // TODO:还差图片
// var CurDataDetail = { // var CurDataDetail = {
// community: tmp.communityName, // community: tmp.communityName,
// address: tmp.addressAndpostalCode, // address: tmp.addressAndpostalCode,
...@@ -154,25 +162,23 @@ export default { ...@@ -154,25 +162,23 @@ export default {
// }, // },
*SA({ playload }, { call, put }) { *SA({ playload }, { call, put }) {
var DataSave = playload; var DataSave = playload;
yield put({ type: 'returnDataSave', DataSave, }); yield put({ type: 'returnDataSave', DataSave });
}, },
*setCurData({ playload }, { call, put }) { *setCurData({ playload }, { call, put }) {
var CurData = playload; var CurData = playload;
yield put({ type: 'returnCurData', CurData, }); yield put({ type: 'returnCurData', CurData });
}, },
*setCurDataDetail({ playload }, { call, put }) { *setCurDataDetail({ playload }, { call, put }) {
var CurDataDetail=null var CurDataDetail = null;
yield put({ type: 'returnCurDataDetail', CurDataDetail, }); yield put({ type: 'returnCurDataDetail', CurDataDetail });
}, },
*ResultClear({}, { put }) {
*ResultClear({ }, { put }) { var Result = null;
var Result = null console.log('清除');
console.log("清除") yield put({ type: 'returnResult', Result });
yield put({type: 'returnResult', Result} )
}, },
}, },
}; };
...@@ -14,180 +14,215 @@ import { getCookie } from '@/utils/method'; ...@@ -14,180 +14,215 @@ import { getCookie } from '@/utils/method';
import { timestampToTime } from '@/utils/time'; import { timestampToTime } from '@/utils/time';
import { validateMessages } from '@/utils/params'; import { validateMessages } from '@/utils/params';
const treatStatus = ["Pending", "Processed"] const treatStatus = ['Pending', 'Processed'];
const Detail = (props: any) => { const Detail = (props: any) => {
const [editorFlag, setEditorFlag] = useState(true); const [editorFlag, setEditorFlag] = useState(true);
const { dispatch, location, CurDataDetail } = props; const { dispatch, location, CurDataDetail } = props;
const fromRef = useRef(null) const fromRef = useRef(null);
const RA = (index: any, values: any) => { dispatch({ type: 'CommunityService/RA', playload: { index: index, body: values } }) }; const RA = (index: any, values: any) => {
dispatch({ type: 'CommunityService/RA', playload: { index: index, body: values } });
};
const [curString, setCurString] = useState({ readyState: false }) const [curString, setCurString] = useState({ readyState: false });
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false);
const [headTitle, setHeadTitle] = useState(""); const [headTitle, setHeadTitle] = useState('');
const headTitles = [ const headTitles = [
"Reply To Community maintenance", 'Reply To Community maintenance',
"Reply To Shelf life Service", 'Reply To Shelf life Service',
"Reply To Owner Complaints", 'Reply To Owner Complaints',
"Reply To Report Online", 'Reply To Report Online',
"Reply To Problem Feedback"] 'Reply To Problem Feedback',
];
useEffect(() => { useEffect(() => {
if ((location.pathname).indexOf("/Edit") > -1) { if (location.pathname.indexOf('/Edit') > -1) {
setEditorFlag(true) setEditorFlag(true);
} else { } else {
setEditorFlag(false) setEditorFlag(false);
} }
RA(21, { RA(21, {
serviceType: location.query.serviceType, serviceType: location.query.serviceType,
id: location.query.id id: location.query.id,
}) });
setHeadTitle(headTitles[parseInt(location.query.serviceType) - 1]) setHeadTitle(headTitles[parseInt(location.query.serviceType) - 1]);
setLoading(true) setLoading(true);
}, [location.pathname]); }, [location.pathname]);
useEffect(() => { useEffect(() => {
setCurString({ readyState: true });
console.log('页面准备好了');
}, []);
useEffect(() => {
console.log(CurDataDetail);
if (CurDataDetail != null && curString.readyState == true) { if (CurDataDetail != null && curString.readyState == true) {
console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@") console.log('@@@@@@@@@@@@@@@@@@@@@@@@@@@@');
console.log(CurDataDetail) console.log(CurDataDetail);
if (!editorFlag) { if (!editorFlag) {
var tmp = { replyContent: CurDataDetail.replyContent, file: CurDataDetail.replyImgUrl } var tmp = { replyContent: CurDataDetail.replyContent, file: CurDataDetail.replyImgUrl };
fromRef.current.setFieldsValue(tmp) fromRef.current.setFieldsValue(tmp);
} }
setLoading(false) setLoading(false);
} }
}, [CurDataDetail]) }, [CurDataDetail]);
useEffect(() => {
setCurString({ readyState: true })
console.log("页面准备好了")
}, [])
const onFinish = (values: any) => { const onFinish = (values: any) => {
console.log(values) console.log(values);
var val = values; var val = values;
val.handleName = getCookie("name") val.handleName = getCookie('name');
val.handleContacts = getCookie("phone") val.handleContacts = getCookie('phone');
val.type = "" + location.query.serviceType val.type = '' + location.query.serviceType;
val.id = location.query.id val.id = location.query.id;
val.userId = location.query.user_id val.userId = location.query.user_id;
val.communityId = location.query.community_id val.communityId = location.query.community_id;
val.handleStatus = "1" val.handleStatus = '1';
// val.file=fileList // val.file=fileList
console.log('Success:', val) console.log('Success:', val);
RA(22, val); RA(22, val);
setLoading(true) setLoading(true);
}; };
const titleProps = { const titleProps = {
sublist: CurDataDetail != null ? ['Status : ' + treatStatus[CurDataDetail.status], 'Create Time : ' + CurDataDetail.time] : null, sublist:
title: headTitle CurDataDetail != null
} ? ['Status : ' + treatStatus[CurDataDetail.status], 'Create Time : ' + CurDataDetail.time]
: null,
title: headTitle,
};
return ( return (
<div> <div>
{CurDataDetail != null ? {CurDataDetail != null ? (
<> <>
<Spin spinning={loading}> <Spin spinning={loading}>
<div className={styles.base}> <div className={styles.base}>
<TitleBack {...titleProps} /> <TitleBack {...titleProps} />
<Descriptions> <Descriptions>
<Descriptions.Item >{CurDataDetail.community}</Descriptions.Item> <Descriptions.Item>{CurDataDetail.community}</Descriptions.Item>
<Descriptions.Item span={2}>{CurDataDetail.home}</Descriptions.Item> <Descriptions.Item span={2}>{CurDataDetail.home}</Descriptions.Item>
<Descriptions.Item label="Address" span={3}>{CurDataDetail.address} </Descriptions.Item> <Descriptions.Item label="Address" span={3}>
{CurDataDetail.address}{' '}
</Descriptions.Item>
<Descriptions.Item label="User Name">{CurDataDetail.name}</Descriptions.Item> <Descriptions.Item label="User Name">{CurDataDetail.name}</Descriptions.Item>
<Descriptions.Item label="Contact Details">{CurDataDetail.phone} </Descriptions.Item> <Descriptions.Item label="Contact Details">
<Descriptions.Item >{CurDataDetail.email}</Descriptions.Item> {CurDataDetail.phone}{' '}
</Descriptions.Item>
<Descriptions.Item>{CurDataDetail.email}</Descriptions.Item>
</Descriptions> </Descriptions>
<Row gutter={16}> <Row gutter={16}>
<Col span={3}>Description:</Col> <Col span={3}>Description:</Col>
<Col><TextArea style={{ width: 394, height: 80, padding: 8 }} autoSize={false} disabled value={CurDataDetail.content} /></Col> <Col>
<TextArea
style={{ width: 394, height: 80, padding: 8 }}
autoSize={false}
disabled
value={CurDataDetail.content}
/>
</Col>
</Row> </Row>
<Row gutter={16} style={{ marginTop: 20 }}> <Row gutter={16} style={{ marginTop: 20 }}>
<Col span={3}>Picture:</Col> <Col span={3}>Picture:</Col>
<Col>{ <Col>
CurDataDetail != null ? {CurDataDetail != null ? (
<PictureOptionsRow <PictureOptionsRow
action="/tos/communtiy/service/reply/img" action="/tos/communtiy/service/reply/img"
disabled={true} disabled={true}
defaultValue={CurDataDetail.pictrues} defaultValue={CurDataDetail.pictrues}
data={{ data={{
userToken: "token", userToken: 'token',
imageType: 'tosCommunityImageReply', imageType: 'tosCommunityImageReply',
extends: "", extends: '',
}} }}
// //
/> : null />
}</Col> ) : null}
</Col>
</Row> </Row>
<Line /> <Line />
<Form ref={fromRef} name="basic" onFinish={onFinish} validateMessages={validateMessages}> <Form
{!editorFlag ? ref={fromRef}
name="basic"
onFinish={onFinish}
validateMessages={validateMessages}
>
{!editorFlag ? (
<Row gutter={16}> <Row gutter={16}>
<Col>Response:</Col> <Col>Response:</Col>
<Col span={6}>{getCookie("name")}</Col> <Col span={6}>{getCookie('name')}</Col>
<Col>Contract Detail:</Col> <Col>Contract Detail:</Col>
<Col>{getCookie("phone")}</Col> <Col>{getCookie('phone')}</Col>
</Row> </Row>
: null} ) : null}
<Row gutter={16} style={{ marginTop: 20 }}> <Row gutter={16} style={{ marginTop: 20 }}>
<Col span={3}>Solution & Conclusion:</Col> <Col span={3}>Solution & Conclusion:</Col>
<Col ><Form.Item name="replyContent" rules={[{ required: true, max: 300 }]} ><TextArea style={{ padding: 8, width: 394, height: 80 }} autoSize={false} disabled={!editorFlag} /></Form.Item></Col> <Col>
<Form.Item name="replyContent" rules={[{ required: true, max: 300 }]}>
<TextArea
style={{ padding: 8, width: 394, height: 80 }}
autoSize={false}
disabled={!editorFlag}
/>
</Form.Item>
</Col>
</Row> </Row>
<Row gutter={16}> <Row gutter={16}>
<Col span={3}></Col> <Col span={3}></Col>
<Col > <Col>
{/* putSubmit={PictureOptionsRowRef} */} {/* putSubmit={PictureOptionsRowRef} */}
{ {CurDataDetail.replyImgUrl != null ? (
CurDataDetail.replyImgUrl != null ? <> <>
<Form.Item name="file"> <Form.Item name="file">
<PictureOptionsRow <PictureOptionsRow
action="/tos/communtiy/service/reply/img" action="/tos/communtiy/service/reply/img"
disabled={!editorFlag} disabled={!editorFlag}
data={{ data={{
userToken: "token", userToken: 'token',
imageType: 'tosCommunityImageReply', imageType: 'tosCommunityImageReply',
extends: "", extends: '',
}} /> }}
/>
</Form.Item> </Form.Item>
</> : null </>
} ) : null}
</Col> </Col>
</Row> </Row>
{ {editorFlag ? (
editorFlag ? <>
<><Line /><Row><Col span={3}></Col><Col><Form.Item><Button type="primary" htmlType="submit">Submit</Button></Form.Item></Col></Row></> : null <Line />
} <Row>
<Col span={3}></Col>
<Col>
<Form.Item>
<Button type="primary" htmlType="submit">
Submit
</Button>
</Form.Item>
</Col>
</Row>
</>
) : null}
</Form> </Form>
</div> </div>
</Spin> </Spin>
</> </>
: null} ) : null}
</div> </div>
); );
}; };
function mapStateToProps(state: any) { function mapStateToProps(state: any) {
const { CurDataDetail } = state.CommunityService; const { CurDataDetail } = state.CommunityService;
console.log(CurDataDetail);
return { return {
CurDataDetail CurDataDetail,
}; };
} }
export default connect(mapStateToProps)(Detail); export default connect(mapStateToProps)(Detail);
...@@ -10,12 +10,13 @@ import TitleSearch from '../../components/TitleSearch/TitleSearch'; ...@@ -10,12 +10,13 @@ import TitleSearch from '../../components/TitleSearch/TitleSearch';
import { RA, urlEncode, filterObj, filterObjbyTg } from '@/utils/method'; import { RA, urlEncode, filterObj, filterObjbyTg } from '@/utils/method';
const pathname = [ const pathname = [
'CommunityMaintenance', 'CommunityMaintenance', // 小区保养
'ShelfLifeService', 'ShelfLifeService', // 保质期服务
'OwnerComplaints', 'OwnerComplaints', // 业主投诉
'ReportOnline', 'ReportOnline', // 在线报事
'ProblemFeedback', 'ProblemFeedback', // 问题反馈
]; ];
const handle_Status = [ const handle_Status = [
[0, 'Pending'], [0, 'Pending'],
[1, 'Processed'], [1, 'Processed'],
...@@ -25,7 +26,7 @@ const goToName = ['Reply', 'Detail']; ...@@ -25,7 +26,7 @@ const goToName = ['Reply', 'Detail'];
const module = 'CommunityService'; const module = 'CommunityService';
// 页码 // 页码
let pageNum = 1; let pageNum: number = 1;
const PropertyServices = (props: any) => { const PropertyServices = (props: any) => {
const { dispatch, location, Data } = props; const { dispatch, location, Data } = props;
...@@ -38,13 +39,15 @@ const PropertyServices = (props: any) => { ...@@ -38,13 +39,15 @@ const PropertyServices = (props: any) => {
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', title: parseInt(serviceTypeGobal) - 1 === 0 ? 'Replier' : 'Content',
dataIndex: 'service_content', dataIndex: parseInt(serviceTypeGobal) - 1 === 0 ? 'handle_name' : 'service_content',
ellipsis: true, ellipsis: true,
width: 500, width: 400,
render: (text: any) => <Space size="middle">{text != null ? text : '--'}</Space>, render: (text: any) => <Space size="middle">{text != null ? text : '--'}</Space>,
}, },
{ {
title: 'Create Time', title: 'Create Time',
dataIndex: 'create_time', dataIndex: 'create_time',
...@@ -109,7 +112,6 @@ const PropertyServices = (props: any) => { ...@@ -109,7 +112,6 @@ const PropertyServices = (props: any) => {
var tmp: any = filterObjbyTg(location.query, ['handleStatus', 'ownerName', 'communityName']); var tmp: any = 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);
RA( RA(
...@@ -138,7 +140,7 @@ const PropertyServices = (props: any) => { ...@@ -138,7 +140,7 @@ const PropertyServices = (props: any) => {
const ClickTitleSearch = (comment: any) => { const ClickTitleSearch = (comment: any) => {
//页面搜索 //页面搜索
comment.serviceType = serviceTypeGobal; // comment.serviceType = serviceTypeGobal;
comment.pageNum = 1; comment.pageNum = 1;
history.push(location.pathname + urlEncode(filterObj(comment))); history.push(location.pathname + urlEncode(filterObj(comment)));
}; };
......
...@@ -10,92 +10,126 @@ import { RA, SA, urlEncode, filterObj, filterObjbyTg } from '@/utils/method'; ...@@ -10,92 +10,126 @@ import { RA, SA, urlEncode, filterObj, filterObjbyTg } from '@/utils/method';
import { objectColumns, stringTab } from '@/utils/string'; import { objectColumns, stringTab } from '@/utils/string';
import { timestampToTime } from '@/utils/time'; import { timestampToTime } from '@/utils/time';
const module = "CommunityService" const module = 'CommunityService';
const Renovation = (props: any) => { const Renovation = (props: any) => {
// const decoration_status = [[0, "待处理"], [1, "已批准"], [2, "已拒绝"]] // const decoration_status = [[0, "待处理"], [1, "已批准"], [2, "已拒绝"]]
const decoration_status = [[0, "Pending"], [1, "Approved"], [2, "Rejected"]] const decoration_status = [
const pathname = ["CommunityMaintenance", "ShelfLifeService", "OwnerComplaints", "ReportOnline", "ProblemFeedback"] [0, 'Pending'],
[1, 'Approved'],
const [loading, setLoading] = useState(false) [2, 'Rejected'],
const [serviceTypeGobal, setServiceType] = useState("") ];
const [pageNum, setPageNum] = useState(1) const pathname = [
const [readyData, setReadyData] = useState(null) 'CommunityMaintenance',
'ShelfLifeService',
'OwnerComplaints',
'ReportOnline',
'ProblemFeedback',
];
const [loading, setLoading] = useState(false);
const [serviceTypeGobal, setServiceType] = useState('');
const [pageNum, setPageNum] = useState(1);
const [readyData, setReadyData] = useState(null);
const columns = objectColumns([ const columns = objectColumns([
["Community", "community_name"], ['Community', 'community_name'],
["Applicant", "applyfor_name"], ['Applicant', 'applyfor_name'],
["Unit", null, (text: any, record: any) => (<div>{record.community_build_decorate}#{record.community_floor_decorate}-{record.community_room_decoate}</div>)], [
["Content", "decoration_content", (text: any) => (<div>{stringTab(text)}</div>)], 'Unit',
["Request Time", "create_time", (text: any) => (<div>{timestampToTime(text.time)}</div>)], null,
["status", "decoration_status", (text: any) => (<div>{decoration_status[parseInt(text)][1]}</div>)], (text: any, record: any) => (
["Actions", "decoration_status", (text: any, record: any) => (<Space size="middle"> <a onClick={goToDetail.bind(this, record)}> {text === 0 ? "Reply" : "Detail"} </a></Space>)], <div>
]) {record.community_build_decorate}#{record.community_floor_decorate}-
{record.community_room_decoate}
</div>
),
],
['Content', 'decoration_content', (text: any) => <div>{stringTab(text)}</div>],
['Request Time', 'create_time', (text: any) => <div>{timestampToTime(text.time)}</div>],
[
'status',
'decoration_status',
(text: any) => <div>{decoration_status[parseInt(text)][1]}</div>,
],
[
'Actions',
'decoration_status',
(text: any, record: any) => (
<Space size="middle">
{' '}
<a onClick={goToDetail.bind(this, record)}> {text === 0 ? 'Reply' : 'Detail'} </a>
</Space>
),
],
]);
const { dispatch, Data8, location } = props; const { dispatch, Data8, location } = props;
useEffect(() => { useEffect(() => {
if (Data8 != null) { setLoading(false) }
}, [Data8]);
useEffect(() => {
if (location != null) { if (location != null) {
//前置数据 //前置数据
console.log("前置数据"); console.log('前置数据');
let tmp: any = filterObjbyTg(location.query, ["handleStatus", "ownerName", "communityName", "current"]) let tmp: any = filterObjbyTg(location.query, [
tmp.handleStatus = decoration_status[parseInt(tmp.handleStatus)] //特殊处理 'handleStatus',
'ownerName',
setReadyData(tmp) 'communityName',
'current',
]);
tmp.handleStatus = decoration_status[parseInt(tmp.handleStatus)]; //特殊处理
setReadyData(tmp);
//获取数据 //获取数据
setLoading(true) setLoading(true);
RA(23, { serviceType: "6", id: "" }, module, dispatch) RA(23, { serviceType: '6', id: '' }, module, dispatch);
} }
}, [location]);
}, [location]) useEffect(() => {
if (Data8 != null) {
setLoading(false);
}
}, [Data8]);
//页面搜索 //页面搜索
const ClickTitleSearch = (comment: any) => { const ClickTitleSearch = (comment: any) => {
let tmp = filterObjbyTg(comment, ["handleStatus", "ownerName", "communityName"]) let tmp = filterObjbyTg(comment, ['handleStatus', 'ownerName', 'communityName']);
tmp["current"] = 1 tmp['current'] = 1;
history.push(location.pathname + urlEncode(tmp)) history.push(location.pathname + urlEncode(tmp));
} };
const goToDetail = (values: any, e: any) => { const goToDetail = (values: any, e: any) => {
SA(values, module, dispatch) SA(values, module, dispatch);
history.push('./RenovationApplication/Detail') history.push('./RenovationApplication/Detail');
} };
return ( return (
<div style={{ width: "100%", minWidth: 1020, padding: 34, backgroundColor: "#ffffff" }}> <div style={{ width: '100%', minWidth: 1020, padding: 34, backgroundColor: '#ffffff' }}>
{ {Data8 != null ? (
Data8 != null ? <>
<> <TitleSearch
<TitleSearch communitySelect={true}
communitySelect={true} listkey={['ownerName']}
listkey={['ownerName']} list={['Owner Name']}
list={['Owner Name']} status={[{ name: ['handleStatus', 'Status'], data: decoration_status }]}
status={[{ name: ["handleStatus", "Status"], data: decoration_status }]} defaultValue={readyData}
defaultValue={readyData} onSubmit={ClickTitleSearch}
onSubmit={ClickTitleSearch} />
/> <Table
<Table loading={loading}
loading={loading} rowKey="id"
rowKey="id" style={{ marginTop: 16 }}
style={{ marginTop: 16 }} dataSource={Data8.data.rows}
dataSource={Data8.data.rows} columns={columns}
columns={columns} pagination={{ defaultCurrent: 1, total: Data8.total }}
pagination={{ defaultCurrent: 1, total: Data8.total }} />
/> </>
</> ) : null}
: null
}
</div> </div>
); );
}; };
function map(state: any) { function map(state: any) {
const { Data8 } = state[module] const { Data8 } = state[module];
return { Data8 } return { Data8 };
} }
export default connect(map)(Renovation); export default connect(map)(Renovation);
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