Commit 82fc811c authored by maple's avatar maple

[fix]小区服务

parent b9d84879
...@@ -78,8 +78,8 @@ const PictureOptionsRow = (props:any) => { ...@@ -78,8 +78,8 @@ const PictureOptionsRow = (props:any) => {
return ( return (
<div> <div>
<Upload <Upload
accept=".png,.jpg,.jpeg" accept=".png,.jpg,.jpeg"
action="/tos/image/upload" action={props.action != null ? props.action : "/tos/image/upload"}
listType="picture-card" listType="picture-card"
data={props.data} data={props.data}
fileList={fileList} fileList={fileList}
......
import * as service from '../services/tos'; import * as service from '@/services/tos';
import { message } from 'antd'; import { message } from 'antd';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import { routerRedux } from 'dva/router' import { routerRedux } from 'dva/router'
import { timestampToTime } from '../utils/time'; import { timestampToTime } from '@/utils/time';
import { picFromate } from '@/utils/method';
export default { export default {
namespace: 'CommunityService', namespace: 'CommunityService',
state: { state: {
...@@ -51,32 +54,83 @@ export default { ...@@ -51,32 +54,83 @@ export default {
//window.location.href = '/CommercialService/OwnerComplaints'; //window.location.href = '/CommercialService/OwnerComplaints';
} }
}, },
//预订设施查询
*RA({ playload }, { call, put }) {
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") {
console.log("请求错误码:"+"("+playload.index+")" + resp.error_code)
console.log(playload)
}
else {
switch (playload.index) {
case 21:
{
var tmp = resp.data.rows[0].tosOwerModel;
var tmp2 = resp.data.rows[0];
console.log(tmp2.imgUrl)
// TODO:还差图片
var CurDataDetail = {
community: tmp.communityName,
address: tmp.addressAndpostalCode,
home: tmp.buildingNumber+"#"+tmp.floorNumber+"-"+tmp.roomNumber,
name: tmp.owerName,
phone: tmp.owerPhone,
email: tmp.owerEmail,
content: resp.data.rows[0].serviceContent,
status: tmp2.handleStatus,
pictrues:picFromate(tmp2.imgUrl),
time:timestampToTime(tmp2.createTime.time)
};
console.log("查看值")
console.log(CurDataDetail)
yield put({ type: 'returnCurDataDetail', CurDataDetail, });
} break;
case 22: {
message.success("Success Operation!", 3)
// history.push("/CommercialService/CommunityMaintenance")
} break;
case 23: {
let Data = resp.data.rows;
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,
home: tmp.buildingNumber+"#"+tmp.floorNumber+"-"+tmp.roomNumber, // home: tmp.buildingNumber+"#"+tmp.floorNumber+"-"+tmp.roomNumber,
name: tmp.owerName, // name: tmp.owerName,
phone: tmp.owerPhone, // phone: tmp.owerPhone,
email: tmp.owerEmail, // email: tmp.owerEmail,
content: resp.data.rows[0].serviceContent, // content: resp.data.rows[0].serviceContent,
status: tmp2.handleStatus, // status: tmp2.handleStatus,
time:timestampToTime(tmp2.createTime.time) // time:timestampToTime(tmp2.createTime.time)
}; // };
yield put({ type: 'returnCurDataDetail', CurDataDetail, }); // yield put({ type: 'returnCurDataDetail', CurDataDetail, });
} // }
}, // },
*setCurData({ playload }, { call, put }) { *setCurData({ playload }, { call, put }) {
var CurData = playload; var CurData = playload;
......
...@@ -10,7 +10,8 @@ export default { ...@@ -10,7 +10,8 @@ export default {
Data: { data: [], total: 0 }, Data: { data: [], total: 0 },
curString:{}, curString:{},
Result: null, Result: null,
DataSave:null DataSave: null,
DataSaveDetail:null,
}, },
reducers: { reducers: {
...@@ -22,7 +23,10 @@ export default { ...@@ -22,7 +23,10 @@ export default {
}, },
returnDataSave(state, { DataSave }) { returnDataSave(state, { DataSave }) {
return {...state,DataSave} return {...state,DataSave}
} },
returnDataSaveDetail(state, { DataSaveDetail }) {
return {...state,DataSaveDetail}
},
}, },
effects: { effects: {
...@@ -48,6 +52,12 @@ export default { ...@@ -48,6 +52,12 @@ export default {
let Data = resp.data; let Data = resp.data;
yield put({ type: 'returnPage', Data}); yield put({ type: 'returnPage', Data});
} break; } break;
case 20:
{
let DataSaveDetail = resp.data;
yield put({ type: 'returnDataSaveDetail', DataSaveDetail});
}break;
case 18: case 18:
case 14:{ case 14:{
message.success("Success Operation!",3) message.success("Success Operation!",3)
......
...@@ -107,8 +107,9 @@ export default { ...@@ -107,8 +107,9 @@ export default {
case 6: case 6:
case 17:{ case 17:{
message.success("Success Operation!", 3) message.success("Success Operation!", 3)
var Result=resp // var Result=resp
yield put({ type: 'returnResult', Result }) // yield put({ type: 'returnResult', Result })
history.push("/CommunityManagement/FacilityBookings")
} break; } break;
case 7: { case 7: {
let tmp = resp.data; let tmp = resp.data;
......
...@@ -16,18 +16,26 @@ const Detail = (props:any) => { ...@@ -16,18 +16,26 @@ const Detail = (props:any) => {
const [editorFlag, setEditorFlag] = useState(true); const [editorFlag, setEditorFlag] = useState(true);
const { dispatch, location, CurData,CurDataDetail } = props; const { dispatch, location, CurData,CurDataDetail } = props;
const TosCommunityServiceGetDetail = (values: any) => { dispatch({ type: 'CommunityService/TosCommunityServiceGetDetail', playload: values }) };
const TosCommuntiyServiceReply = (values: any) => { dispatch({ type: 'CommunityService/TosCommuntiyServiceReply', playload: values }) }; const RA = (index:any,values: any) => { dispatch({ type: 'CommunityService/RA', playload: { index: index, body: values } }) };
const setCurDataDetail = () => { dispatch({ type: 'CommunityService/setCurDataDetail' }) }; const setCurDataDetail = () => { dispatch({ type: 'CommunityService/setCurDataDetail' }) };
const [headTitle, setHeadTitle] = useState(""); const [headTitle, setHeadTitle] = useState("");
const headTitles = ["Reply To Community maintenance", "Reply", "Reply", "Reply", "Reply"] const headTitles = [
"Reply To Community maintenance",
"Reply To Shelf life Service",
"Reply To Owner Complaints",
"Reply To Report Online",
"Reply To Problem Feedback"]
const [fileList, setfileList] = useState([]);
useEffect(() => { useEffect(() => {
setCurDataDetail() setCurDataDetail()
if (CurData != null) { if (CurData != null) {
TosCommunityServiceGetDetail({ RA(21,{
serviceType: CurData.service_type, serviceType: CurData.service_type,
id: CurData.id id: CurData.id
}) })
...@@ -46,12 +54,13 @@ const Detail = (props:any) => { ...@@ -46,12 +54,13 @@ const Detail = (props:any) => {
const onFinish = (values:any) => { const onFinish = (values:any) => {
var val = values var val = values
val.type =CurData.service_type val.type =""+CurData.service_type
val.id =CurData.id val.id =CurData.id
val.userId = CurData.user_id val.userId = CurData.user_id
val.handleStatus = "1" val.handleStatus = "1"
val.file=[] val.file=fileList
console.log('Success:', val) console.log('Success:', val)
RA(22,val);
//TosCommuntiyServiceReply(val) //TosCommuntiyServiceReply(val)
}; };
...@@ -61,6 +70,7 @@ const Detail = (props:any) => { ...@@ -61,6 +70,7 @@ const Detail = (props:any) => {
const PictureOptionsRowRef = (values:any) => { const PictureOptionsRowRef = (values:any) => {
console.log(values) console.log(values)
setfileList(values)
} }
return ( return (
<div className={styles.base}> <div className={styles.base}>
...@@ -83,14 +93,19 @@ const Detail = (props:any) => { ...@@ -83,14 +93,19 @@ const Detail = (props:any) => {
</Row> </Row>
<Row gutter={16} style={{marginTop:20}}> <Row gutter={16} style={{marginTop:20}}>
<Col>Picture:</Col> <Col>Picture:</Col>
<Col><PictureOptionsRow <Col>{
disabled={true} putSubmit={PictureOptionsRowRef} data={{ CurDataDetail!=null?
userToken: "token", <PictureOptionsRow
imageType: 'tosCommunityImageReply', action="/tos/communtiy/service/reply/img"
extend: "", disabled={true} putSubmit={PictureOptionsRowRef}
}} data={{
defultValue={[{ url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" }]} userToken: "token",
/></Col> imageType: 'tosCommunityImageReply',
extend: "",
}}
defultValue={CurDataDetail.pictrues}
/>:null
}</Col>
</Row> </Row>
<Line /> <Line />
...@@ -110,6 +125,7 @@ const Detail = (props:any) => { ...@@ -110,6 +125,7 @@ const Detail = (props:any) => {
<Col>Resolved Complaint:</Col> <Col>Resolved Complaint:</Col>
<Col> <Col>
<PictureOptionsRow <PictureOptionsRow
action="/tos/communtiy/service/reply/img"
disabled={!editorFlag} disabled={!editorFlag}
putSubmit={PictureOptionsRowRef} data={{ putSubmit={PictureOptionsRowRef} data={{
userToken: "token", userToken: "token",
......
...@@ -12,6 +12,8 @@ const PropertyServices = (props: any) => { ...@@ -12,6 +12,8 @@ const PropertyServices = (props: any) => {
const { dispatch, location, Data } = props; const { dispatch, location, Data } = props;
const TosCommunityServiceGet = (values: any) => { dispatch({ type: 'CommunityService/TosCommunityServiceGet', playload: values }) }; const TosCommunityServiceGet = (values: any) => { dispatch({ type: 'CommunityService/TosCommunityServiceGet', playload: values }) };
const RA = (index: any, values: any) => { dispatch({ type: 'CommunityService/RA', playload: { index: index, body: values } }) };
const setCurData = (values: any) => { dispatch({ type: 'CommunityService/setCurData', playload: values }) }; const setCurData = (values: any) => { dispatch({ type: 'CommunityService/setCurData', playload: values }) };
const pagination = { defaultCurrent: 1, total: Data!=null?Data.length:0 } const pagination = { defaultCurrent: 1, total: Data!=null?Data.length:0 }
...@@ -50,19 +52,48 @@ const PropertyServices = (props: any) => { ...@@ -50,19 +52,48 @@ const PropertyServices = (props: any) => {
]; ];
useEffect(() => { useEffect(() => {
var init="1" var init = "1"
if (location.pathname == "/CommercialService/CommunityMaintenance") { init = "1"} switch (location.pathname) {
else if(location.pathname == "/CommercialService/ShelfLifeService") {init = "2"} case "/CommercialService/CommunityMaintenance": init = "1"
else if (location.pathname == "/CommercialService/OwnerComplaints") { init = "3" } {
else if (location.pathname == "/CommercialService/ReportOnline") { init = "4" } TosCommunityServiceGet({serviceType:init})
else if(location.pathname == "/CommercialService/ProblemFeedback") {init = "5"} } break;
case "/CommercialService/ShelfLifeService": init = "2"
{
TosCommunityServiceGet({serviceType:init})
} break;
case "/CommercialService/OwnerComplaints": init = "3"
{
TosCommunityServiceGet({serviceType:init})
} break;
case "/CommercialService/ReportOnline": init = "4"
{
TosCommunityServiceGet({serviceType:init})
} break;
case "/CommercialService/ProblemFeedback":init = "5"
{
TosCommunityServiceGet({serviceType:init})
} break;
case "/CommercialService/RenovationApplication": init = "6"
{
RA(23, { serviceType: init ,id:""})
} break;
}
// if (location.pathname == "/CommercialService/CommunityMaintenance") { init = "1"}
// else if(location.pathname == "/CommercialService/ShelfLifeService") {init = "2" , TosCommunityServiceGet({serviceType:init})}
// else if (location.pathname == "/CommercialService/OwnerComplaints") { init = "3" , TosCommunityServiceGet({serviceType:init})}
// else if (location.pathname == "/CommercialService/ReportOnline") { init = "4" , TosCommunityServiceGet({serviceType:init})}
// else if (location.pathname == "/CommercialService/ProblemFeedback") { init = "5", TosCommunityServiceGet({serviceType:init}) }
// else if(location.pathname == "/CommercialService/RenovationApplication") {init = "6",RA(22,{serviceType:init})}
setLoading(true) setLoading(true)
TosCommunityServiceGet({serviceType:init})
},[]); },[]);
useEffect(() => { useEffect(() => {
setLoading(false) setLoading(false)
},[Data]); }, [Data]);
const TitleSearchContent = (comment: any)=>{ const TitleSearchContent = (comment: any)=>{
console.log(comment) console.log(comment)
} }
......
...@@ -11,10 +11,7 @@ import { RA } from '@/services/tos'; ...@@ -11,10 +11,7 @@ import { RA } from '@/services/tos';
const Contract = (props:any) => { const Contract = (props:any) => {
const { formatMessage } = useIntl(); const { formatMessage } = useIntl();
const { location } = props; const { dispatch,location,Data,Result } = props;
const { dispatch,Data,Result } = props;
const RA = (index: any, values: any) => { dispatch({ type: 'Contract/RA', playload: { index: index, body: values } }) }; const RA = (index: any, values: any) => { dispatch({ type: 'Contract/RA', playload: { index: index, body: values } }) };
const SA = (values: any) => { dispatch({ type: 'Contract/SA', playload: values }) }; const SA = (values: any) => { dispatch({ type: 'Contract/SA', playload: values }) };
......
...@@ -20,10 +20,12 @@ const uploadProps = { ...@@ -20,10 +20,12 @@ const uploadProps = {
}, },
}; };
const ContractContent = (props: { location: any; }) => { const ContractContent = (props: any) => {
const { location } = props; const {dispatch,location,DataSave,DataSaveDetail } = props;
const RA = (index: any, values: any) => { dispatch({ type: 'Contract/RA', playload: { index: index, body: values } }) };
const [ editFlag, setEditFlag ] = useState(false); const [ editFlag, setEditFlag ] = useState(false);
useEffect(() => { useEffect(() => {
if ((location.pathname).indexOf("/Edit")>-1) { if ((location.pathname).indexOf("/Edit")>-1) {
...@@ -33,10 +35,40 @@ const ContractContent = (props: { location: any; }) => { ...@@ -33,10 +35,40 @@ const ContractContent = (props: { location: any; }) => {
} }
}, [location.pathname]); }, [location.pathname]);
useEffect(() => {
if (DataSave!=null) {
console.log(DataSave)
RA(20, {
contractId: DataSave.id
})
}
}, [DataSave])
useEffect(() => {
if (DataSaveDetail != null) {
console.log(DataSaveDetail)
}
}, [DataSaveDetail])
const goToReturn = () => { const goToReturn = () => {
history.back() history.back()
} }
// communityName: "A7"
// contractFileName: "cleanFiles"
// contractNumber: "456"
// contractPartyA: "国企A"
// contractPartyB: "民企B"
// contractTitle: "清洁服务协议"
// contractValidEndDate: "2020-09-21"
// contractValidStartDate: "2020-08-28"
// count: 0
// createTime: "Aug 1, 2020 4:15:47 PM"
// deleted: 0
// extend: ""
// fileUrls: Array(1)
// 0: "http://acc-huahu
return ( return (
<div className={styles.base}> <div className={styles.base}>
...@@ -48,27 +80,27 @@ const ContractContent = (props: { location: any; }) => { ...@@ -48,27 +80,27 @@ const ContractContent = (props: { location: any; }) => {
<div className={styles.box1}> <div className={styles.box1}>
<div className={styles.box1item1}>Contract Code</div> <div className={styles.box1item1}>Contract Code</div>
<div className = { styles.box1item2 } > {editFlag?(<Input style={{width:200}} placeholder="ABC123456777" />):("ABC123456777")}</div> <div className = { styles.box1item2 } > {editFlag?(<Input style={{width:200}} placeholder="Contract Code" />):(DataSaveDetail!=null?DataSaveDetail.contractNumber:null)}</div>
<div className={styles.box1item3}>Contract Party A</div> <div className={styles.box1item3}>Contract Party A</div>
<div className={styles.box1item4}>{editFlag?(<Input style={{width:200}} placeholder="Corporate Name" />):("Pearl Co., Ltd")}</div> <div className={styles.box1item4}>{editFlag?(<Input style={{width:200}} placeholder="Corporate Name" />):(DataSaveDetail!=null?DataSaveDetail.contractPartyA:null)}</div>
<div className={styles.box1item5}>Contract Party B</div> <div className={styles.box1item5}>Contract Party B</div>
<div className={styles.box1item6}>{editFlag?(<Input style={{width:200}} placeholder="Corporate Name" />):("Pearl Co., Ltd")}</div> <div className={styles.box1item6}>{editFlag?(<Input style={{width:200}} placeholder="Corporate Name" />):(DataSaveDetail!=null?DataSaveDetail.contractPartyB:null)}</div>
</div> </div>
<div className={styles.box5}> <div className={styles.box5}>
<div className={styles.box5item1}>Project</div> <div className={styles.box5item1}>Project</div>
<div className={styles.box5item2}>{editFlag?(<Input style={{width:200}} placeholder="Project Name" />):("Zhongda community")}</div> <div className={styles.box5item2}>{editFlag?(<Input style={{width:200}} placeholder="Project Name" />):(DataSaveDetail!=null?DataSaveDetail.communityName:null)}</div>
</div> </div>
<div className={styles.box4}> <div className={styles.box4}>
<div className={styles.box4item1}>Contract Title</div> <div className={styles.box4item1}>Contract Title</div>
<div className={styles.box4item2}>{editFlag?(<Input style={{width:200}} placeholder="XXXX Labor Contract" />):("Zhongda community")}</div> <div className={styles.box4item2}>{editFlag?(<Input style={{width:200}} placeholder="XXXX Labor Contract" />):(DataSaveDetail!=null?DataSaveDetail.contractTitle:null)}</div>
</div> </div>
<div className={styles.box6}> <div className={styles.box6}>
<div className={styles.box6item1}>Effective Date</div> <div className={styles.box6item1}>Effective Date</div>
<div className={styles.box6item2}>{editFlag ? (<DatePicker style={{width:140}}/>) : (<div className={styles.box6item2x1}>25-03-2020</div>)}</div> <div className={styles.box6item2}>{editFlag ? (<DatePicker style={{width:140}}/>) : (<div className={styles.box6item2x1}>{DataSaveDetail!=null?DataSaveDetail.contractValidEndDate:null}</div>)}</div>
<div className={styles.box6item3}>{editFlag ? (<DatePicker style={{width:140}}/>) : (<div className={styles.box6item2x1}>25-03-2021</div>)}</div> <div className={styles.box6item3}>{editFlag ? (<DatePicker style={{width:140}}/>) : (<div className={styles.box6item2x1}>{DataSaveDetail!=null?DataSaveDetail.contractValidStartDate:null}</div>)}</div>
</div> </div>
{ {
editFlag ? ( editFlag ? (
...@@ -85,8 +117,8 @@ const ContractContent = (props: { location: any; }) => { ...@@ -85,8 +117,8 @@ const ContractContent = (props: { location: any; }) => {
) : ( ) : (
<div className={styles.box7}> <div className={styles.box7}>
<div className={styles.box7item1}>Contract</div> <div className={styles.box7item1}>Contract</div>
<div className={styles.box7item2}>2020 Contract.PDF</div> <div className={styles.box7item2}>.PDF</div>
<div className={styles.box7item3}><a>Preview</a></div> <div className={styles.box7item3}><a href={DataSaveDetail!=null?DataSaveDetail.fileUrls:null}>Preview</a></div>
</div> </div>
) )
} }
...@@ -116,5 +148,11 @@ const ContractContent = (props: { location: any; }) => { ...@@ -116,5 +148,11 @@ const ContractContent = (props: { location: any; }) => {
); );
}; };
function mapStateToProps(state:any) {
export default ContractContent; const { DataSave,Result,DataSaveDetail } = state.Contract;
return {
DataSave,
DataSaveDetail
};
}
export default connect(mapStateToProps)(ContractContent);
...@@ -43,9 +43,9 @@ export function TosTosServiceProviderSave(values: any) { ...@@ -43,9 +43,9 @@ export function TosTosServiceProviderSave(values: any) {
export function TosCommunityServiceGet(values: any) { export function TosCommunityServiceGet(values: any) {
return request('/tos/community/service/get',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) return request('/tos/community/service/get',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}})
} }
export function TosCommunityServiceGetDetail(values: any) { // export function TosCommunityServiceGetDetail(values: any) {
return request('/tos/community/service/get/detail',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) // return request('/tos/community/service/get/detail',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}})
} // }
export function TosCommuntiyServiceReply(values: any) { export function TosCommuntiyServiceReply(values: any) {
return request('/tos/communtiy/service/reply',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}}) return request('/tos/communtiy/service/reply',{method: 'POST',body: JSON.stringify(values),headers:{ 'Content-Type': 'application/json'}})
} }
...@@ -82,7 +82,11 @@ const requestList = [ ...@@ -82,7 +82,11 @@ const requestList = [
["/tos/bookingService/edit", "17 编辑小区设施"], ["/tos/bookingService/edit", "17 编辑小区设施"],
["/tos/tosOwner/info/update", "18 编辑业主信息"], ["/tos/tosOwner/info/update", "18 编辑业主信息"],
["/tos/contract/list","19 获取合同列表"] ["/tos/contract/list", "19 获取合同列表"],
["/tos/contract/detail/query", "20 获取合同列表详情"],
["/tos/community/service/get/detail", "21 小区服务获取详情"],
["/tos/communtiy/service/reply", "22 小区回复"],
["/tos/property/decorate/record/get","23 装修列表获取"],
] ]
function requestAuto(url:string,values:any) { function requestAuto(url:string,values:any) {
return request(url, Body(values)) return request(url, Body(values))
......
...@@ -21,4 +21,15 @@ export const checkInput = (e: any) => { ...@@ -21,4 +21,15 @@ export const checkInput = (e: any) => {
message.error("User Name Should be limit 2~30!", 3) message.error("User Name Should be limit 2~30!", 3)
e.target.value=null e.target.value=null
} }
}
export const picFromate = (values: any) => {
var result=new Array()
if (values != null) {
values.map((item:any, index:any) => {
result.push({ url: item })
})
}
return result
} }
\ No newline at end of file
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