Commit 8e27beb5 authored by maple's avatar maple

[fixed]业主模块

parent 28f9a4cf
......@@ -15,7 +15,7 @@ const BackButton = (props:any) => {
const url = props.url;
const goToReturn = () => {
// history.back()
URL(history.location.pathname, module2, dispatch)
URL({ pathname: history.location.pathname ,status:0}, module2, dispatch)
console.log("这里的地址为")
console.log(history.location.pathname)
history.go(-1)
......
......@@ -5,6 +5,7 @@ const { TabPane } = Tabs
import { objectColumns} from '@/utils/string';
import { size } from 'lodash';
import Toast from '../Toast/Toast';
......@@ -69,7 +70,7 @@ const TableShow = (props:any) => {
<Row gutter={32}><Col>Unit No:</Col><Col>{unit.living}</Col></Row>
</div>
<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>
)
......
......@@ -16,14 +16,6 @@ const TitleSearch= (props:any) => {
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 name = props.list;
const single = props.single
......@@ -35,6 +27,27 @@ const TitleSearch= (props:any) => {
const [selectOptions, setSelectOptions] = useState(true)
const [communitys, setCommunitys] = useState(CommunityList)
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 => {
......
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 {
//链接
*URL({ playload }, { put }) {
let history_url = playload;
console.log("保存地址");
console.log("保存地址"+JSON.stringify(playload));
yield put({ type: 'returnURL', history_url});
},
*URLCLEAR({ }, { put }) {
......
......@@ -19,7 +19,8 @@ export default {
communityInfo: null,
pageDate: null,
returnValue:null,
returnValue: null,
memberResult:null,
},
reducers: {
......@@ -53,7 +54,9 @@ export default {
ReturnValue(state, { returnValue }) {
return{...state,returnValue}
},
returnMemberResult(state, { memberResult }) {
return{...state,memberResult}
}
},
effects: {
......@@ -72,15 +75,12 @@ export default {
let returnValue = null;
yield put({ type: 'DataSaveDetail', DataSaveDetail,returnValue });
} break;
case 16: {
console.log("等待删除完成")
var returnValue = {test:"yes"};
yield put({ type: 'ReturnValue', returnValue });
} break;
}
const resp = yield call(service.RA, playload);
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';
}
if (resp.error_code != "0000") {
......@@ -92,40 +92,49 @@ export default {
case 11: {
Data3Error = { msg: "Information Wrong!" };
yield put({ type: 'returnData3Error', Data3Error });
} break;
case 16:{
Result = resp;
yield put({ type: 'returnResult', Result });
} break;
case 13: {
//
history.push("/UserManagement/LIFEUserManagement")
} break;
// 删除失败的案例
// case 16:{
// Result = resp;
// yield put({ type: 'returnResult', Result });
// } break;
}
}
else {
switch (playload.index) {
case 12:
{
let Data = resp.data;
yield put({ type: 'returnPage', Data});
} break;
case 12:{
let Data = resp.data;
yield put({ type: 'returnPage', Data});
} break;
case 18:
case 14:{
message.success("Success Operation!",3)
// window.location.href = '/CommunityManagement/FacilityBookings';
// window.location.href = '/CommunityManagement/FacilityBookings';
history.push("/UserManagement/LIFEUserManagement")
} break;
case 13: {
let DataSaveDetail = resp.data;
yield put({ type: 'DataSaveDetail', DataSaveDetail });
} break;
// case 16: {
// console.log("等待删除完成")
// var returnValue = resp;
// yield put({ type: 'ReturnValue', returnValue });
// } break;
case 16: {
console.log("等待删除完成")
var returnValue = resp;
yield put({ type: 'ReturnValue', returnValue });
} break;
case 32: {
let communityInfo = resp;
yield put({ type: 'returnCommunityInfo', communityInfo });
} break;
case 39: {
let memberResult = resp;
yield put({ type: 'returnMemberResult', memberResult });
} break;
}
}
......@@ -170,7 +179,10 @@ export default {
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';
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';
const module = "User"
......@@ -105,14 +105,26 @@ const Users = (props:any) => {
useEffect(() => {
if (pageStart == false) {
if (history_url != null && history.location.pathname != history_url) {
console.log(location.pathname)
if(history_url!=null){ console.log(history_url.pathname)}
if (history_url != null && location.pathname != history_url.pathname) {
console.log("来自上层数据")
var tmp = Data
tmp.defaultCurrent = pageData.defaultCurrent
var tmp2 = curString; tmp2.defaultCurrent = pageData.defaultCurrent;setCurString(tmp2)
setTestData(tmp)
if (history_url.status == 0) {
console.log("更新数据源")
var tmp = Data
tmp.defaultCurrent = pageData.defaultCurrent
var tmp2 = curString; tmp2.defaultCurrent = pageData.defaultCurrent; setCurString(tmp2)
setTestData(tmp)
} else {
console.log("异变数据源")
console.log(history_url)
RA(12, {
ownerName:null,
communityArray: CommunityList
}, module, dispatch);
changeValue("loading",true)
}
// URLCLEAR(module2, dispatch)
}else {
var tmp={rows:[], total:0,defaultCurrent:1}
......@@ -140,11 +152,13 @@ const Users = (props:any) => {
}
const goToEdit = (values: any, e: any) => {
SA(values)
PAGE(curString,module3,dispatch)
PAGE(curString, module3, dispatch)
URL({ pathname: location.pathname+'/Edit', status: 1 }, module2, dispatch)
history.push(location.pathname+'/Edit')
}
const goToAdd = () => {
URL({ pathname: location.pathname+'/Add', status: 1 }, module2, dispatch)
history.push(location.pathname+'/Add')
}
......
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;
import { ExclamationCircleOutlined } from '@ant-design/icons';
import { Link, useIntl, connect, Dispatch } from 'umi';
import styles from './UsersAdd.less';
import Line from '../../../components/Line/Line';
......@@ -15,11 +18,12 @@ import { validateMessages } from '@/utils/params';
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 ResultClear = () => { dispatch({ type: 'User/ResultClear' }) };
const MemberResultClear = () => { dispatch({ type: 'User/MemberResultClear' }) };
const [memberDetail, setMemberDetail] = useState(false);
const [memberData, setMemberData] = useState(null);
const [editFlag, setEditFlag] = useState(false)
......@@ -28,7 +32,8 @@ const UsersDetail = (props:any) => {
const user_type_status = ["Unregistered", "registered", "Deregistered"]
const [DataSaveLoading, setDataSaveLoading] = useState(false);
const [visible, setVisible] = useState(false)
const formRef = useRef(null);
const onFinish=(values:any) => {
if (DataSave != null) {
......@@ -67,10 +72,11 @@ const UsersDetail = (props:any) => {
enable:DataSave.enable,
})
}
},[returnValue])
}, [returnValue])
useEffect(() => {
if (DataSave != null) {
console.log("页面数据")
console.log("给予页面数据")
console.log(DataSave)
var tmp = {
owerName: DataSave.owerName,
......@@ -111,25 +117,55 @@ const UsersDetail = (props:any) => {
setMemberData(values)
setMemberDetail(true)
}
const deleteUnit = (values:any) => {
// 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) {
//console.log(DataSave)
var tmp = {
owerName: DataSave.owerName,
communityName: DataSave.communityName,
unit: values
}
RA(16, tmp);
}
},
});
}
const DeleteMember = (values: any, e: any) => {
console.log(values)
RA(39, { id: values.id, ownerId: values.owner_id })
}
const titleBackCallBack = () => {
setMemberDetail(false)
}
const deleteUnit = (values:any) => {
console.log(values)
if (DataSave != null) {
//console.log(DataSave)
var tmp = {
useEffect(()=>{
if (memberResult != null) {
setMemberDetail(false)
RA(13, {
id:DataSave.id,
owerName: DataSave.owerName,
communityName: DataSave.communityName,
unit: values
}
RA(16, tmp);
enable:DataSave.enable,
})
MemberResultClear()
}
}
const DeleteMember = () => {
}
return (
},[memberResult])
return (
<div className={styles.base}>
{
......@@ -142,12 +178,18 @@ const UsersDetail = (props:any) => {
<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>
<div className={styles.box4}>
<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.box4item2}><Form.Item name="owerEmail" rules={[{required:true,type:"email"}]} ><Input disabled={!editFlag} placeholder="Email" /></Form.Item></div>
</div>
{
DataSave.enable == 1 ?
<>
<div className={styles.box4}>
<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.box4item2}><Form.Item name="owerEmail" rules={[{required:true,type:"email"}]} ><Input disabled={!editFlag} placeholder="Email" /></Form.Item></div>
</div>
</>
: null
}
<Line />
<Spin spinning={DataSaveLoading} tip="Loading Detial">
{
......@@ -160,7 +202,8 @@ const UsersDetail = (props:any) => {
</>:null
}
</Spin>
</Form>
</Form>
</>:null
}
......@@ -182,7 +225,7 @@ const UsersDetail = (props:any) => {
<Col span={4}>{memberData.ower_email}</Col>
</Row>
<Line></Line>
<Button type="danger" onClick={DeleteMember}>Delete</Button>
<Button type="danger" onClick={DeleteMember.bind(this,memberData)}>Delete</Button>
</div>
</>
......@@ -192,13 +235,14 @@ const UsersDetail = (props:any) => {
};
function mapStateToProps(state:any) {
const { DataSave,DataSaveDetail,Result,returnValue} = state.User;
const { DataSave,DataSaveDetail,Result,returnValue,memberResult} = state.User;
return {
DataSave,
DataSaveDetail,
Result,
returnValue,
memberResult,
};
}
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