Commit 1e4738fa authored by maple's avatar maple Committed by MrShi

[fixed]业主模块

(cherry picked from commit 8e27beb5)
parent 6199bd32
...@@ -15,7 +15,7 @@ const BackButton = (props:any) => { ...@@ -15,7 +15,7 @@ const BackButton = (props:any) => {
const url = props.url; const url = props.url;
const goToReturn = () => { const goToReturn = () => {
// history.back() // history.back()
URL(history.location.pathname, module2, dispatch) URL({ pathname: history.location.pathname ,status:0}, module2, dispatch)
console.log("这里的地址为") console.log("这里的地址为")
console.log(history.location.pathname) console.log(history.location.pathname)
history.go(-1) history.go(-1)
......
...@@ -5,6 +5,7 @@ const { TabPane } = Tabs ...@@ -5,6 +5,7 @@ const { TabPane } = Tabs
import { objectColumns} from '@/utils/string'; import { objectColumns} from '@/utils/string';
import { size } from 'lodash'; import { size } from 'lodash';
import Toast from '../Toast/Toast';
...@@ -69,7 +70,7 @@ const TableShow = (props:any) => { ...@@ -69,7 +70,7 @@ const TableShow = (props:any) => {
<Row gutter={32}><Col>Unit No:</Col><Col>{unit.living}</Col></Row> <Row gutter={32}><Col>Unit No:</Col><Col>{unit.living}</Col></Row>
</div> </div>
<div style={{ position: "absolute", right: 0,bottom:16 }}> <div style={{ position: "absolute", right: 0,bottom:16 }}>
{props.deleteDisable ? <Button type="danger" onClick={deleteUnit.bind(this, unit.living)}>Delete</Button> : null} {props.deleteDisable ?<Button type="danger" onClick={deleteUnit.bind(this, unit.living)}>Delete</Button> : null}
</div> </div>
</div> </div>
) )
......
...@@ -16,14 +16,6 @@ const TitleSearch= (props:any) => { ...@@ -16,14 +16,6 @@ const TitleSearch= (props:any) => {
const {dispatch, CommunityList } = props; const {dispatch, CommunityList } = props;
const tosCommunityget = (values:any) => {dispatch({type: 'Init/tosCommunityget',playload:values})};
useEffect(() => {
if (CommunityList == null) {
tosCommunityget(null)
}
}, []);
const key = props.listkey const key = props.listkey
const name = props.list; const name = props.list;
const single = props.single const single = props.single
...@@ -36,6 +28,27 @@ const TitleSearch= (props:any) => { ...@@ -36,6 +28,27 @@ const TitleSearch= (props:any) => {
const [communitys, setCommunitys] = useState(CommunityList) const [communitys, setCommunitys] = useState(CommunityList)
const [datePicker, setDate] = useState(null) const [datePicker, setDate] = useState(null)
const tosCommunityget = (values:any) => {dispatch({type: 'Init/tosCommunityget',playload:values})};
useEffect(() => {
// console.log("标题搜寻组件初始化") OK
if (CommunityList == null) {
// console.log("小区数量初始化") OK
tosCommunityget(null)
}
}, []);
useEffect(()=>{
if (CommunityList != null) {
// console.log("小区数量初始化完毕") OK
var tmp = {}
tmp[community] = CommunityList
// props.onSubmit(tmp) 禁用 改用组件初始化
setCommunitys(CommunityList)
}
},[CommunityList])
const onFinish = values => { const onFinish = values => {
if (datePicker) { if (datePicker) {
......
import React, { useState, useEffect } from 'react';
import { message, Button,Modal,} from 'antd';
const Toast = (props:any) => {
const {value,onChange}=props
const [visible,setVisible]=useState(false)
const showModal = () => {
setVisible(true)
}
const handleOk = () => {
setVisible(false)
onChange()
};
const handleCancel = () => {
setVisible(false)
};
return (
<>
<Button type="primary" onClick={showModal}>
Open Modal
</Button>
<Modal title="Basic Modal" visible={visible} onOk={handleOk} onCancel={handleCancel}>
<p>Some contents...</p>
<p>Some contents...</p>
<p>Some contents...</p>
</Modal>
</>
);
};
export default Toast;
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
//链接 //链接
*URL({ playload }, { put }) { *URL({ playload }, { put }) {
let history_url = playload; let history_url = playload;
console.log("保存地址"); console.log("保存地址"+JSON.stringify(playload));
yield put({ type: 'returnURL', history_url}); yield put({ type: 'returnURL', history_url});
}, },
*URLCLEAR({ }, { put }) { *URLCLEAR({ }, { put }) {
......
...@@ -19,7 +19,8 @@ export default { ...@@ -19,7 +19,8 @@ export default {
communityInfo: null, communityInfo: null,
pageDate: null, pageDate: null,
returnValue:null, returnValue: null,
memberResult:null,
}, },
reducers: { reducers: {
...@@ -53,7 +54,9 @@ export default { ...@@ -53,7 +54,9 @@ export default {
ReturnValue(state, { returnValue }) { ReturnValue(state, { returnValue }) {
return{...state,returnValue} return{...state,returnValue}
}, },
returnMemberResult(state, { memberResult }) {
return{...state,memberResult}
}
}, },
effects: { effects: {
...@@ -72,15 +75,12 @@ export default { ...@@ -72,15 +75,12 @@ export default {
let returnValue = null; let returnValue = null;
yield put({ type: 'DataSaveDetail', DataSaveDetail,returnValue }); yield put({ type: 'DataSaveDetail', DataSaveDetail,returnValue });
} break; } break;
case 16: {
console.log("等待删除完成")
var returnValue = {test:"yes"};
yield put({ type: 'ReturnValue', returnValue });
} break;
} }
const resp = yield call(service.RA, playload); const resp = yield call(service.RA, playload);
console.log(resp) console.log(resp)
if (resp.code == 500||resp.error_code!="0000") { if (resp.code == 500 || resp.error_code != "0000") {
// message.error("Server Error,try again,error code:500",3)
// window.location.href = '/500'; // window.location.href = '/500';
} }
if (resp.error_code != "0000") { if (resp.error_code != "0000") {
...@@ -93,17 +93,22 @@ export default { ...@@ -93,17 +93,22 @@ export default {
Data3Error = { msg: "Information Wrong!" }; Data3Error = { msg: "Information Wrong!" };
yield put({ type: 'returnData3Error', Data3Error }); yield put({ type: 'returnData3Error', Data3Error });
} break; } break;
case 16:{ case 13: {
Result = resp; //
yield put({ type: 'returnResult', Result }); history.push("/UserManagement/LIFEUserManagement")
} break; } break;
// 删除失败的案例
// case 16:{
// Result = resp;
// yield put({ type: 'returnResult', Result });
// } break;
} }
} }
else { else {
switch (playload.index) { switch (playload.index) {
case 12: case 12:{
{
let Data = resp.data; let Data = resp.data;
yield put({ type: 'returnPage', Data}); yield put({ type: 'returnPage', Data});
} break; } break;
...@@ -117,15 +122,19 @@ export default { ...@@ -117,15 +122,19 @@ export default {
let DataSaveDetail = resp.data; let DataSaveDetail = resp.data;
yield put({ type: 'DataSaveDetail', DataSaveDetail }); yield put({ type: 'DataSaveDetail', DataSaveDetail });
} break; } break;
// case 16: { case 16: {
// console.log("等待删除完成") console.log("等待删除完成")
// var returnValue = resp; var returnValue = resp;
// yield put({ type: 'ReturnValue', returnValue }); yield put({ type: 'ReturnValue', returnValue });
// } break; } break;
case 32: { case 32: {
let communityInfo = resp; let communityInfo = resp;
yield put({ type: 'returnCommunityInfo', communityInfo }); yield put({ type: 'returnCommunityInfo', communityInfo });
} break; } break;
case 39: {
let memberResult = resp;
yield put({ type: 'returnMemberResult', memberResult });
} break;
} }
} }
...@@ -170,7 +179,10 @@ export default { ...@@ -170,7 +179,10 @@ export default {
yield put({type: 'returnPage',pageDate}) yield put({type: 'returnPage',pageDate})
}, },
*MemberResultClear({ }, { put }) {
let memberResult = null;
yield put({ type: 'returnMemberResult', memberResult });
},
}, },
}; };
...@@ -10,7 +10,7 @@ import TitleSearch from '../../../components/TitleSearch/TitleSearch'; ...@@ -10,7 +10,7 @@ import TitleSearch from '../../../components/TitleSearch/TitleSearch';
import { timestampToTime } from '../../../utils/time'; import { timestampToTime } from '../../../utils/time';
import { PAGE, RA, URLCLEAR, getCookie, DataClear } from '@/utils/method'; import { PAGE, RA, URLCLEAR, getCookie, DataClear,URL } from '@/utils/method';
import PageData from '@/models/Common/PageData'; import PageData from '@/models/Common/PageData';
const module = "User" const module = "User"
...@@ -105,14 +105,26 @@ const Users = (props:any) => { ...@@ -105,14 +105,26 @@ const Users = (props:any) => {
useEffect(() => { useEffect(() => {
if (pageStart == false) { if (pageStart == false) {
if (history_url != null && history.location.pathname != history_url) { console.log(location.pathname)
console.log("来自上层数据") if(history_url!=null){ console.log(history_url.pathname)}
if (history_url != null && location.pathname != history_url.pathname) {
console.log("来自上层数据")
if (history_url.status == 0) {
console.log("更新数据源")
var tmp = Data var tmp = Data
tmp.defaultCurrent = pageData.defaultCurrent tmp.defaultCurrent = pageData.defaultCurrent
var tmp2 = curString; tmp2.defaultCurrent = pageData.defaultCurrent;setCurString(tmp2) var tmp2 = curString; tmp2.defaultCurrent = pageData.defaultCurrent; setCurString(tmp2)
setTestData(tmp) setTestData(tmp)
} else {
console.log("异变数据源")
console.log(history_url)
RA(12, {
ownerName:null,
communityArray: CommunityList
}, module, dispatch);
changeValue("loading",true)
}
// URLCLEAR(module2, dispatch) // URLCLEAR(module2, dispatch)
}else { }else {
var tmp={rows:[], total:0,defaultCurrent:1} var tmp={rows:[], total:0,defaultCurrent:1}
...@@ -140,11 +152,13 @@ const Users = (props:any) => { ...@@ -140,11 +152,13 @@ const Users = (props:any) => {
} }
const goToEdit = (values: any, e: any) => { const goToEdit = (values: any, e: any) => {
SA(values) SA(values)
PAGE(curString,module3,dispatch) PAGE(curString, module3, dispatch)
URL({ pathname: location.pathname+'/Edit', status: 1 }, module2, dispatch)
history.push(location.pathname+'/Edit') history.push(location.pathname+'/Edit')
} }
const goToAdd = () => { const goToAdd = () => {
URL({ pathname: location.pathname+'/Add', status: 1 }, module2, dispatch)
history.push(location.pathname+'/Add') history.push(location.pathname+'/Add')
} }
......
import React, { useState, useEffect,useRef } from 'react'; import React, { useState, useEffect,useRef } from 'react';
import { Input ,Tabs,Table,Space,Pagination,Tooltip, Button,Form,Row,Col, message,Spin} from 'antd'; import { Input, Tabs, Modal, Space, Pagination, Tooltip, Button, Form, Row, Col, message, Spin } from 'antd';
const { confirm } = Modal;
const { TabPane } = Tabs; const { TabPane } = Tabs;
import { ExclamationCircleOutlined } from '@ant-design/icons';
import { Link, useIntl, connect, Dispatch } from 'umi'; import { Link, useIntl, connect, Dispatch } from 'umi';
import styles from './UsersAdd.less'; import styles from './UsersAdd.less';
import Line from '../../../components/Line/Line'; import Line from '../../../components/Line/Line';
...@@ -15,10 +18,11 @@ import { validateMessages } from '@/utils/params'; ...@@ -15,10 +18,11 @@ import { validateMessages } from '@/utils/params';
const UsersDetail = (props:any) => { const UsersDetail = (props:any) => {
const { dispatch,DataSave,DataSaveDetail,Result,returnValue} = props; const { dispatch,DataSave,DataSaveDetail,Result,returnValue,memberResult} = props;
const RA = (index: any, values: any) => { dispatch({ type: 'User/RA', playload: { index: index, body: values } }) }; const RA = (index: any, values: any) => { dispatch({ type: 'User/RA', playload: { index: index, body: values } }) };
const ResultClear = () => { dispatch({ type: 'User/ResultClear' }) }; const ResultClear = () => { dispatch({ type: 'User/ResultClear' }) };
const MemberResultClear = () => { dispatch({ type: 'User/MemberResultClear' }) };
const [memberDetail, setMemberDetail] = useState(false); const [memberDetail, setMemberDetail] = useState(false);
const [memberData, setMemberData] = useState(null); const [memberData, setMemberData] = useState(null);
...@@ -28,6 +32,7 @@ const UsersDetail = (props:any) => { ...@@ -28,6 +32,7 @@ const UsersDetail = (props:any) => {
const user_type_status = ["Unregistered", "registered", "Deregistered"] const user_type_status = ["Unregistered", "registered", "Deregistered"]
const [DataSaveLoading, setDataSaveLoading] = useState(false); const [DataSaveLoading, setDataSaveLoading] = useState(false);
const [visible, setVisible] = useState(false)
const formRef = useRef(null); const formRef = useRef(null);
const onFinish=(values:any) => { const onFinish=(values:any) => {
...@@ -67,10 +72,11 @@ const UsersDetail = (props:any) => { ...@@ -67,10 +72,11 @@ const UsersDetail = (props:any) => {
enable:DataSave.enable, enable:DataSave.enable,
}) })
} }
},[returnValue]) }, [returnValue])
useEffect(() => { useEffect(() => {
if (DataSave != null) { if (DataSave != null) {
console.log("页面数据") console.log("给予页面数据")
console.log(DataSave) console.log(DataSave)
var tmp = { var tmp = {
owerName: DataSave.owerName, owerName: DataSave.owerName,
...@@ -111,11 +117,19 @@ const UsersDetail = (props:any) => { ...@@ -111,11 +117,19 @@ const UsersDetail = (props:any) => {
setMemberData(values) setMemberData(values)
setMemberDetail(true) setMemberDetail(true)
} }
const titleBackCallBack = () => {
setMemberDetail(false)
}
const deleteUnit = (values:any) => { const deleteUnit = (values:any) => {
console.log(values) // console.log(values)
confirm({
title: 'Are you sure delete this infomation?',
icon: <ExclamationCircleOutlined />,
content: 'Please click confirm to delete',
okText: 'Confirm',
okType: 'danger',
cancelText: 'Cancel',
onCancel() {},
onOk() {
if (DataSave != null) { if (DataSave != null) {
//console.log(DataSave) //console.log(DataSave)
var tmp = { var tmp = {
...@@ -125,10 +139,32 @@ const UsersDetail = (props:any) => { ...@@ -125,10 +139,32 @@ const UsersDetail = (props:any) => {
} }
RA(16, tmp); RA(16, tmp);
} }
} },
const DeleteMember = () => {
});
}
const DeleteMember = (values: any, e: any) => {
console.log(values)
RA(39, { id: values.id, ownerId: values.owner_id })
}
const titleBackCallBack = () => {
setMemberDetail(false)
} }
useEffect(()=>{
if (memberResult != null) {
setMemberDetail(false)
RA(13, {
id:DataSave.id,
owerName: DataSave.owerName,
enable:DataSave.enable,
})
MemberResultClear()
}
},[memberResult])
return ( return (
<div className={styles.base}> <div className={styles.base}>
...@@ -142,12 +178,18 @@ const UsersDetail = (props:any) => { ...@@ -142,12 +178,18 @@ const UsersDetail = (props:any) => {
<div className={styles.box1item1}>Owner's Name</div> <div className={styles.box1item1}>Owner's Name</div>
<div className={styles.box1item2}><Form.Item name="owerName" rules={[{ required: true, min: 2, max: 30 }]} ><Input disabled={!editFlag} placeholder="Ower Name" /></Form.Item></div> <div className={styles.box1item2}><Form.Item name="owerName" rules={[{ required: true, min: 2, max: 30 }]} ><Input disabled={!editFlag} placeholder="Ower Name" /></Form.Item></div>
</div> </div>
{
DataSave.enable == 1 ?
<>
<div className={styles.box4}> <div className={styles.box4}>
<div className={styles.box4item0}>Contact Details</div> <div className={styles.box4item0}>Contact Details</div>
<div className={styles.box4item1}><Form.Item name="owerPhone" ><Input disabled={!editFlag} placeholder="Phone Number" /></Form.Item></div> <div className={styles.box4item1}><Form.Item name="owerPhone" ><Input disabled={!editFlag} placeholder="Phone Number" /></Form.Item></div>
<div className={styles.box4item2}><Form.Item name="owerEmail" rules={[{required:true,type:"email"}]} ><Input disabled={!editFlag} placeholder="Email" /></Form.Item></div> <div className={styles.box4item2}><Form.Item name="owerEmail" rules={[{required:true,type:"email"}]} ><Input disabled={!editFlag} placeholder="Email" /></Form.Item></div>
</div> </div>
</>
: null
}
<Line /> <Line />
<Spin spinning={DataSaveLoading} tip="Loading Detial"> <Spin spinning={DataSaveLoading} tip="Loading Detial">
{ {
...@@ -161,6 +203,7 @@ const UsersDetail = (props:any) => { ...@@ -161,6 +203,7 @@ const UsersDetail = (props:any) => {
} }
</Spin> </Spin>
</Form> </Form>
</>:null </>:null
} }
...@@ -182,7 +225,7 @@ const UsersDetail = (props:any) => { ...@@ -182,7 +225,7 @@ const UsersDetail = (props:any) => {
<Col span={4}>{memberData.ower_email}</Col> <Col span={4}>{memberData.ower_email}</Col>
</Row> </Row>
<Line></Line> <Line></Line>
<Button type="danger" onClick={DeleteMember}>Delete</Button> <Button type="danger" onClick={DeleteMember.bind(this,memberData)}>Delete</Button>
</div> </div>
</> </>
...@@ -192,13 +235,14 @@ const UsersDetail = (props:any) => { ...@@ -192,13 +235,14 @@ const UsersDetail = (props:any) => {
}; };
function mapStateToProps(state:any) { function mapStateToProps(state:any) {
const { DataSave,DataSaveDetail,Result,returnValue} = state.User; const { DataSave,DataSaveDetail,Result,returnValue,memberResult} = state.User;
return { return {
DataSave, DataSave,
DataSaveDetail, DataSaveDetail,
Result, Result,
returnValue, returnValue,
memberResult,
}; };
} }
export default connect(mapStateToProps)(UsersDetail); export default connect(mapStateToProps)(UsersDetail);
......
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