Commit accc62a9 authored by Sixiang_Zzb's avatar Sixiang_Zzb

用户管理详情提示优化

parent 35276b15
...@@ -52,6 +52,7 @@ const TableShow = (props: any) => { ...@@ -52,6 +52,7 @@ const TableShow = (props: any) => {
[ [
'status', 'status',
'status', 'status',
(text: number, record: any) => <Space size="middle">{user_type_status[text]}</Space>, (text: number, record: any) => <Space size="middle">{user_type_status[text]}</Space>,
], ],
[ [
...@@ -71,7 +72,7 @@ const TableShow = (props: any) => { ...@@ -71,7 +72,7 @@ const TableShow = (props: any) => {
<Tabs defaultActiveKey="0"> <Tabs defaultActiveKey="0">
{dataRow.map((item: any, index: number) => { {dataRow.map((item: any, index: number) => {
return ( return (
<TabPane tab={item.name} key={item.id}> <TabPane tab={item.name} key={index}>
<Row gutter={16} style={{ marginLeft: 9 }}> <Row gutter={16} style={{ marginLeft: 9 }}>
<Col>Address:</Col> <Col>Address:</Col>
<Col> <Col>
...@@ -86,7 +87,7 @@ const TableShow = (props: any) => { ...@@ -86,7 +87,7 @@ const TableShow = (props: any) => {
</Row> </Row>
{item.unit.map((unit: any, uindex: any) => { {item.unit.map((unit: any, uindex: any) => {
return ( return (
<div key={unit.living}> <div key={uindex}>
<Row gutter={32}> <Row gutter={32}>
<Col span={20}> <Col span={20}>
<Table <Table
...@@ -114,7 +115,7 @@ const TableShow = (props: any) => { ...@@ -114,7 +115,7 @@ const TableShow = (props: any) => {
); );
}} }}
footer={() => ''} footer={() => ''}
rowKey={'ower_name'} rowKey={'id'}
dataSource={unit.member} dataSource={unit.member}
columns={key} columns={key}
pagination={false} pagination={false}
......
...@@ -50,6 +50,8 @@ const UsersDetail = (props: any) => { ...@@ -50,6 +50,8 @@ const UsersDetail = (props: any) => {
const formRef = useRef(null as any); const formRef = useRef(null as any);
const [loadding, setLoadding] = useState(false);
// 提交 // 提交
const onFinish = (values: any) => { const onFinish = (values: any) => {
if (DataSave != null) { if (DataSave != null) {
...@@ -71,6 +73,7 @@ const UsersDetail = (props: any) => { ...@@ -71,6 +73,7 @@ const UsersDetail = (props: any) => {
} }
}; };
// 监听删除结果
useEffect(() => { useEffect(() => {
if (Result != null) { if (Result != null) {
console.log(Result); console.log(Result);
...@@ -82,6 +85,7 @@ const UsersDetail = (props: any) => { ...@@ -82,6 +85,7 @@ const UsersDetail = (props: any) => {
} }
}, [Result]); }, [Result]);
// 监听返回内容
useEffect(() => { useEffect(() => {
console.log(returnValue); console.log(returnValue);
if (returnValue != null) { if (returnValue != null) {
...@@ -101,6 +105,7 @@ const UsersDetail = (props: any) => { ...@@ -101,6 +105,7 @@ const UsersDetail = (props: any) => {
} }
}, [returnValue]); }, [returnValue]);
// 监听数据返回
useEffect(() => { useEffect(() => {
if (DataSave != null) { if (DataSave != null) {
console.log('给予页面数据'); console.log('给予页面数据');
...@@ -124,6 +129,7 @@ const UsersDetail = (props: any) => { ...@@ -124,6 +129,7 @@ const UsersDetail = (props: any) => {
} }
}, [DataSave]); }, [DataSave]);
// 监听数据返回
useEffect(() => { useEffect(() => {
if (DataSaveDetail != null) { if (DataSaveDetail != null) {
console.log('页面数据副歌'); console.log('页面数据副歌');
...@@ -132,15 +138,18 @@ const UsersDetail = (props: any) => { ...@@ -132,15 +138,18 @@ const UsersDetail = (props: any) => {
} }
}, [DataSaveDetail]); }, [DataSaveDetail]);
// 存储住户详情页的数据
useEffect(() => { useEffect(() => {
console.log(memberDetail); console.log(memberDetail);
if (!memberDetail) { if (DataSave) {
var tmp = { if (!memberDetail) {
owerName: DataSave.owerName, var tmp = {
owerPhone: DataSave.owerPhone, owerName: DataSave.owerName,
owerEmail: DataSave.owerEmail, owerPhone: DataSave.owerPhone,
}; owerEmail: DataSave.owerEmail,
formRef.current.setFieldsValue(tmp); };
formRef.current.setFieldsValue(tmp);
}
} }
}, [memberDetail]); }, [memberDetail]);
...@@ -151,6 +160,7 @@ const UsersDetail = (props: any) => { ...@@ -151,6 +160,7 @@ const UsersDetail = (props: any) => {
setDataSaveLoading(true); setDataSaveLoading(true);
}, []); }, []);
// 住户详情页
const tableShowCallback = (values: any) => { const tableShowCallback = (values: any) => {
console.log('成员信息'); console.log('成员信息');
console.log(values); console.log(values);
...@@ -159,6 +169,7 @@ const UsersDetail = (props: any) => { ...@@ -159,6 +169,7 @@ const UsersDetail = (props: any) => {
setMemberDetail(true); setMemberDetail(true);
}; };
// 删除单元
const deleteUnit = (values: any) => { const deleteUnit = (values: any) => {
if (permissionArr.indexOf('5') < 0) { if (permissionArr.indexOf('5') < 0) {
message.error('No Permissions!!!', 3); message.error('No Permissions!!!', 3);
...@@ -186,6 +197,7 @@ const UsersDetail = (props: any) => { ...@@ -186,6 +197,7 @@ const UsersDetail = (props: any) => {
}); });
}; };
// 删除住户
const DeleteMember = (values: any, e: any) => { const DeleteMember = (values: any, e: any) => {
console.log(values); console.log(values);
if (permissionArr.indexOf('7') < 0) { if (permissionArr.indexOf('7') < 0) {
...@@ -201,18 +213,22 @@ const UsersDetail = (props: any) => { ...@@ -201,18 +213,22 @@ const UsersDetail = (props: any) => {
cancelText: 'Cancel', cancelText: 'Cancel',
onCancel() {}, onCancel() {},
onOk() { onOk() {
setLoadding(true);
RA(39, { id: values.id, ownerId: values.owner_id }); RA(39, { id: values.id, ownerId: values.owner_id });
}, },
}); });
}; };
// 返回
const titleBackCallBack = () => { const titleBackCallBack = () => {
setMemberDetail(false); setMemberDetail(false);
}; };
// 监听删除住户返回的结果
useEffect(() => { useEffect(() => {
if (memberResult != null) { if (memberResult != null) {
setMemberDetail(false); setMemberDetail(false);
setLoadding(false);
message.success('Successfully delete!!!'); message.success('Successfully delete!!!');
RA(13, { RA(13, {
id: DataSave.id, id: DataSave.id,
...@@ -226,6 +242,7 @@ const UsersDetail = (props: any) => { ...@@ -226,6 +242,7 @@ const UsersDetail = (props: any) => {
} }
}, [memberResult]); }, [memberResult]);
// 编辑手机号码验证
const checkData = (rule: any, value: any, callback: any) => { const checkData = (rule: any, value: any, callback: any) => {
if (value) { if (value) {
if (/^\d{8}$|^1[3|5|7|8]\d{9}$/.test(value)) { if (/^\d{8}$|^1[3|5|7|8]\d{9}$/.test(value)) {
...@@ -237,9 +254,6 @@ const UsersDetail = (props: any) => { ...@@ -237,9 +254,6 @@ const UsersDetail = (props: any) => {
callback('*it is required!'); callback('*it is required!');
}; };
console.log(memberDetail);
console.log(DataSave);
return ( return (
<div className={styles.base}> <div className={styles.base}>
<Spin spinning={visible} tip="Loading Submit"> <Spin spinning={visible} tip="Loading Submit">
...@@ -329,35 +343,37 @@ const UsersDetail = (props: any) => { ...@@ -329,35 +343,37 @@ const UsersDetail = (props: any) => {
</> </>
) : ( ) : (
<> <>
<div> <Spin spinning={loadding}>
<TitleBack <div>
title={'Family/Tenant Details'} <TitleBack
url="none" title={'Family/Tenant Details'}
titleBack={titleBackCallBack} url="none"
></TitleBack> titleBack={titleBackCallBack}
<Row> ></TitleBack>
<Col span={4}>User Type:</Col> <Row>
<Col span={4}> <Col span={4}>User Type:</Col>
{memberData.owner_relationship != null <Col span={4}>
? user_status[memberData.owner_relationship - 1][1] {memberData.owner_relationship != null
: null} ? user_status[memberData.owner_relationship - 1][1]
</Col> : null}
</Row> </Col>
<Row gutter={16}> </Row>
<Col span={4}>User Name:</Col> <Row gutter={16}>
<Col span={4}>{memberData.owner_family_name}</Col> <Col span={4}>User Name:</Col>
</Row> <Col span={4}>{memberData.owner_family_name}</Col>
<Row gutter={16}> </Row>
<Col span={4}>Contact Detail:</Col> <Row gutter={16}>
<Col span={4}>{memberData.owner_family_phone}</Col> <Col span={4}>Contact Detail:</Col>
<Col span={4}>{memberData.owner_family_email}</Col> <Col span={4}>{memberData.owner_family_phone}</Col>
</Row> <Col span={4}>{memberData.owner_family_email}</Col>
<Line></Line> </Row>
<Line></Line>
<Button danger onClick={DeleteMember.bind(this, memberData)}> <Button danger onClick={DeleteMember.bind(this, memberData)}>
Delete Delete
</Button> </Button>
</div> </div>
</Spin>
</> </>
)} )}
</Spin> </Spin>
......
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