Commit 3bfc14e6 authored by Sixiang_Zzb's avatar Sixiang_Zzb

登录和用户模块提示删除

parent e31991a0
import * as service from '../../services/tos';
import { history } from 'umi';
import { message } from 'antd';
import { Link, useIntl, connect, Dispatch, history } from 'umi';
import { routerRedux } from 'dva/router';
import * as service from '../../services/tos';
export default {
namespace: 'User',
......@@ -24,7 +22,7 @@ export default {
DataServices: null,
Data4Error: null,
Data4Error: false,
},
reducers: {
......@@ -74,186 +72,175 @@ export default {
switch (playload.index) {
case 12:
{
let Data = null;
const Data = null;
yield put({ type: 'returnPage', Data });
}
break;
case 13:
{
let DataSaveDetail = null;
let returnValue = null;
const DataSaveDetail = null;
const returnValue = null;
yield put({ type: 'DataSaveDetail', DataSaveDetail, returnValue });
}
break;
case 43:
{
let DataServices = null;
const DataServices = null;
yield put({ type: 'returnDataServices', DataServices });
}
break;
default:
break;
}
const resp = yield call(service.RA, playload);
console.log('resp', resp);
if (resp.code == 500 || resp.error_code != '0000') {
// message.error('Server Error,try again,error code:500', 3);
// window.location.href = '/500';
// message.error(resp.msg);
}
if (resp.error_code != '0000') {
if (resp.error_code !== '0000') {
if (playload.index !== 53) {
message.error(`${resp.error_code}:${resp.error_msg}`);
message.error(`${resp.error_msg}`);
}
var Data3Error = null;
var Result = null;
let Data4Error = null;
let Data3Error = null;
let Result = null;
switch (playload.index) {
case 11:
{
Data3Error = { msg: 'Information Wrong!' };
yield put({ type: 'returnData3Error', Data3Error });
}
Data3Error = { msg: 'Information Wrong!' };
yield put({ type: 'returnData3Error', Data3Error });
break;
case 13:
{
// message.error('Request exception please retry!!!');
history.push('/UserManagement/LIFEUserManagement');
}
// message.error('Request exception please retry!!!');
history.push('/UserManagement/LIFEUserManagement');
break;
// 删除失败的案例
case 16:
{
Result = resp;
yield put({ type: 'returnResult', Result });
}
Result = resp;
yield put({ type: 'returnResult', Result });
break;
case 14:
{
Data4Error = { msg: 'The community or unit is already registered!' };
const Data4Error = true;
yield put({ type: 'returnData4Error', Data4Error });
}
yield put({ type: 'returnData4Error', Data4Error });
break;
case 18:
case 53:
{
Result = resp;
yield put({ type: 'returnResult', Result });
}
Result = resp;
yield put({ type: 'returnResult', Result });
break;
default:
break;
}
} else {
switch (playload.index) {
case 12:
{
let Data = resp;
const Data = resp;
yield put({ type: 'returnPage', Data });
}
break;
case 18:
case 14:
{
message.success('Success Operation!');
// window.location.href = '/CommunityManagement/FacilityBookings';
history.push('/UserManagement/LIFEUserManagement');
}
// window.location.href = '/CommunityManagement/FacilityBookings';
history.push('/UserManagement/LIFEUserManagement');
break;
case 13:
{
let DataSaveDetail = resp.data;
const DataSaveDetail = resp.data;
yield put({ type: 'DataSaveDetail', DataSaveDetail });
}
break;
case 16:
{
console.log('等待删除完成');
var returnValue = resp;
const returnValue = resp;
yield put({ type: 'ReturnValue', returnValue });
}
break;
case 32:
{
let communityInfo = resp;
const communityInfo = resp;
yield put({ type: 'returnCommunityInfo', communityInfo });
}
break;
case 39:
{
let memberResult = resp;
const memberResult = resp;
yield put({ type: 'returnMemberResult', memberResult });
}
break;
case 43:
{
let DataServices = resp;
const DataServices = resp;
yield put({ type: 'returnDataServices', DataServices });
}
break;
case 44: {
let Result = resp;
yield put({ type: 'returnResult', Result });
}
case 44:
{
const Result = resp;
yield put({ type: 'returnResult', Result });
}
break;
default:
break;
}
}
},
*IA({ }, { put }: any) {
var Data3 = null;
*IA({ }, { call, put }: any) {
const Data3 = null;
yield put({ type: 'returnPage3', Data3 });
},
*IA2({ }, { put }: any) {
var Data3Error = null;
*IA2({ }, { call, put }: any) {
const Data3Error = null;
yield put({ type: 'returnData3Error', Data3Error });
},
*SA({ playload }: any, { put }: any) {
var DataSave = playload;
*SA({ playload }: any, { call, put }: any) {
const DataSave = playload;
yield put({ type: 'returnDataSave', DataSave });
},
*CA({ playload }: any, { put }: any) {
var sourceData = playload;
*CA({ playload }: any, { call, put }: any) {
const sourceData = playload;
yield put({ type: 'returnSource', sourceData });
},
*QA({ playload }: any, { put }: any) {
var curString = playload;
*QA({ playload }: any, { call, put }: any) {
const curString = playload;
yield put({ type: 'returnCurString', curString });
},
*ResultClear({ }, { put }: any) {
var tmp = null;
*ResultClear({ }: any, { call, put }: any) {
const tmp = null;
yield put({ type: 'returnResult', tmp });
},
*PAGE({ playload }: any, { put }: any) {
var pageDate = playload;
*PAGE({ playload }: any, { call, put }: any) {
const pageDate = playload;
yield put({ type: 'PageDate', pageDate });
},
*DataClear({ }, { put }: any) {
var pageDate = null;
*DataClear({ }: any, { call, put }: any) {
const pageDate = null;
yield put({ type: 'returnPage', pageDate });
},
*MemberResultClear({ }, { put }: any) {
let memberResult = null;
*MemberResultClear({ }: any, { call, put }: any) {
const memberResult = null;
yield put({ type: 'returnMemberResult', memberResult });
},
*Data4ErrorClear({ }, { put }: any) {
let Data4Error = null;
*Data4ErrorClear({ }: any, { call, put }: any) {
const Data4Error = false;
yield put({ type: 'returnData4Error', Data4Error });
},
*ClearResult({ }, { put }: any) {
let Result = null;
*ClearResult({ }: any, { call, put }: any) {
const Result = null;
yield put({ type: 'returnResult', Result });
},
*ClearReturnValue({ }, { put }: any) {
let returnValue = null;
*ClearReturnValue({ }: any, { call, put }: any) {
const returnValue = null;
yield put({ type: "ReturnValue", returnValue })
}
},
......
......@@ -109,9 +109,7 @@ const Model: LoginModelType = {
setCookie("remenberUserName", "", -1)
setCookie("remenberPwd", "", -1)
}
// Login successfully response.status === 'ok'
message.success('Login Successfully!', 3);
const userMessage = yield call(AccountCheckLogin, payload.values); //请求时间网络
const userMessage = yield call(AccountCheckLogin, payload.values); // 请求时间网络
setCookie('token', userMessage.token);
setCookie('id', userMessage.userModel.id);
......@@ -199,7 +197,7 @@ const Model: LoginModelType = {
}
},
*goResetPwd({ payload }, { call, put }) {
*goResetPwd({ payload }, { put }) {
yield put({
type: 'resetPwd',
result: true,
......@@ -209,7 +207,7 @@ const Model: LoginModelType = {
history.push('login2');
},
*setResult({ payload }, { call, put }) {
*setResult({ payload }, { put }) {
yield put({
type: "setResultLogin",
resultLogin: payload.resultLogin || false,
......
......@@ -37,8 +37,7 @@ const UserModel: UserModelType = {
},
effects: {
*fetch(_, { call, put }) {
console.log(call);
*fetch() {
// const response = yield call(queryUsers);
// console.error(response)
// yield put({
......@@ -49,11 +48,10 @@ const UserModel: UserModelType = {
*fetchCurrent({ playload }, { call, put }) {
// console.log("response")
const userInfo = JSON.parse(localStorage.getItem('userInfo') || 'null');
console.log('存储用户信息');
console.log(userInfo);
if (!userInfo) {
const response = yield call(queryCurrent, playload);
console.log(response);
localStorage.setItem('userInfo', JSON.stringify(response));
yield put({
type: 'saveCurrentUser',
......@@ -67,7 +65,7 @@ const UserModel: UserModelType = {
}
},
*deleteCurrent({ playload }, { call, put }) {
*deleteCurrent({ put }) {
yield put({
type: 'deleteCurrentUser',
});
......@@ -81,7 +79,7 @@ const UserModel: UserModelType = {
currentUser: action.payload || {},
};
},
deleteCurrentUser(state, action) {
deleteCurrentUser(state) {
return {
...state,
currentUser: {},
......
import React, { useState, useEffect, useRef } from 'react';
import { Input, Spin, Button, Form, message } from 'antd';
import { connect } from 'umi';
import { validateMessages } from '@/utils/params';
import styles from './UsersAdd.less';
import Line from '../../../components/Line/Line';
import TitleBack from '../../../components/TitleBack/TitleBack';
import SearchOptionsCommnity from '../../../components/SearchOptions/SearchOptionsCommnity';
import { checkParam, RA, Clear } from '../../../utils/method';
import { validateMessages } from '@/utils/params';
import { checkParam, RA } from '../../../utils/method';
const module = 'User';
const UsersAdd = (props: any) => {
......@@ -21,11 +19,11 @@ const UsersAdd = (props: any) => {
useEffect(() => {
if (Data4Error) {
if (Data4Error.msg) {
setLoading(false);
message.error(Data4Error.msg, 3);
Clear(module + '/Data4ErrorClear', dispatch);
}
setLoading(false);
dispatch({
type: `${module}/Data4ErrorClear`,
payload: {},
});
}
}, [Data4Error]);
......@@ -39,17 +37,16 @@ const UsersAdd = (props: any) => {
values.owerPhone = null;
values.owerEmail = null;
values.buildingNumber = 'BLK ' + values.buildingNumber;
console.log(values);
RA(14, values, module, dispatch);
setLoading(true);
} else {
setLoading(false);
message.error('Error,Please finish it,not empty!', 3);
message.error('Error,Please finish it,not empty!');
}
};
const extendName = (values: any) => {
var tmp = postman;
const tmp = postman;
tmp.extend = values;
RA(32, { communityName: values }, module, dispatch);
setPostman(tmp);
......@@ -82,7 +79,7 @@ const UsersAdd = (props: any) => {
return (
<div className={styles.base}>
{/* 头部组件 */}
<TitleBack title={'Create New Owner'} />
<TitleBack title="Create New Owner" />
<Spin spinning={loading}>
<Form ref={formRef} name="basic" onFinish={onFinish} validateMessages={validateMessages}>
<div className={styles.box1}>
......
import React, { useState, useEffect, useRef } from 'react';
import { Input, Modal, Button, Form, Row, Col, message, Spin } from 'antd';
const { confirm } = Modal;
import { ExclamationCircleOutlined } from '@ant-design/icons';
import { connect } from 'umi';
import styles from './UsersAdd.less';
import Line from '../../../components/Line/Line';
import TitleBack from '../../../components/TitleBack/TitleBack';
import { checkParam } from '../../../utils/method';
import TableShow from '@/components/TableShow/TableShow';
import { connect, history } from 'umi';
import { timestampToTime } from '@/utils/time';
import { validateMessages } from '@/utils/params';
import TableShow from '@/components/TableShow/TableShow';
import { ExclamationCircleOutlined } from '@ant-design/icons';
import { checkParam } from '../../../utils/method';
import TitleBack from '../../../components/TitleBack/TitleBack';
import Line from '../../../components/Line/Line';
import styles from './UsersAdd.less';
const { confirm } = Modal;
const UsersDetail = (props: any) => {
const { dispatch, DataSave, DataSaveDetail, Result, returnValue, memberResult } = props;
const { dispatch, DataSave, DataSaveDetail, Result, returnValue, memberResult, location } = props;
const RA = (index: any, values: any) => {
dispatch({
type: 'User/RA',
playload: {
index: index,
index,
body: values,
},
});
......@@ -61,11 +60,6 @@ const UsersDetail = (props: any) => {
} else {
values.id = null;
}
var tmp = Object.keys(values);
console.log('添加业主提交的参数:' + tmp.length);
console.log(values);
if (checkParam(values)) {
setVisible(true);
RA(18, values);
......@@ -77,30 +71,18 @@ const UsersDetail = (props: any) => {
// 监听删除结果
useEffect(() => {
if (Result != null) {
console.log(Result);
if (Result.error_code !== '0000') {
message.error(Result.error_msg);
ResultClear();
history.go(0);
history.back();
}
}
}, [Result]);
// 监听返回内容
useEffect(() => {
console.log(returnValue);
if (returnValue != null) {
if (returnValue.error_code !== '0001') {
message.success('Delete Successfully!', 3);
// RA(13, {
// id: DataSave.id,
// owerName: DataSave.owerName,
// enable: DataSave.enable,
// buildingNumber: DataSave.buildingNumber,
// floorNumber: DataSave.floorNumber,
// roomNumber: DataSave.roomNumber,
// });
dispatch({
type: 'User/ClearReturnValue',
playload: {},
......@@ -116,9 +98,7 @@ const UsersDetail = (props: any) => {
// 监听数据返回
useEffect(() => {
if (DataSave != null) {
console.log('给予页面数据');
console.log(DataSave);
var tmp = {
const tmp = {
owerName: DataSave.owerName,
owerPhone: DataSave.owerPhone,
owerEmail: DataSave.owerEmail,
......@@ -133,25 +113,22 @@ const UsersDetail = (props: any) => {
roomNumber: DataSave.roomNumber,
});
} else {
history.go(-1);
history.back();
}
}, [DataSave]);
// 监听数据返回
useEffect(() => {
if (DataSaveDetail != null) {
console.log('页面数据副歌');
console.log(DataSaveDetail);
setDataSaveLoading(false);
}
}, [DataSaveDetail]);
// 存储住户详情页的数据
useEffect(() => {
console.log(memberDetail);
if (DataSave) {
if (!memberDetail) {
var tmp = {
const tmp = {
owerName: DataSave.owerName,
owerPhone: DataSave.owerPhone,
owerEmail: DataSave.owerEmail,
......@@ -170,8 +147,6 @@ const UsersDetail = (props: any) => {
// 住户详情页
const tableShowCallback = (values: any) => {
console.log('成员信息');
console.log(values);
setMemberData(values);
setMemberDetail(true);
......@@ -193,8 +168,7 @@ const UsersDetail = (props: any) => {
onCancel() {},
onOk() {
if (DataSave != null) {
// console.log(DataSave);
var tmp = {
const tmp = {
owerName: DataSave.owerName,
communityName: DataSave.communityName,
unit: values,
......@@ -206,8 +180,7 @@ const UsersDetail = (props: any) => {
};
// 删除住户
const DeleteMember = (values: any, e: any) => {
console.log(values);
const DeleteMember = (values: any) => {
if (permissionArr.indexOf('7') < 0) {
message.error('No Permissions!!!', 3);
return;
......@@ -237,7 +210,6 @@ const UsersDetail = (props: any) => {
if (memberResult != null) {
setMemberDetail(false);
setLoadding(false);
message.success('Successfully delete!!!');
RA(13, {
id: DataSave.id,
owerName: DataSave.owerName,
......@@ -265,7 +237,7 @@ const UsersDetail = (props: any) => {
return (
<div className={styles.base}>
<Spin spinning={visible} tip="Loading Submit">
{memberDetail == false ? (
{memberDetail === false ? (
<>
{DataSave != null ? (
<>
......@@ -290,7 +262,7 @@ const UsersDetail = (props: any) => {
</Form.Item>
</div>
</div>
{DataSave.enable == 1 ? (
{DataSave.enable === 1 ? (
<>
<div className={styles.box4}>
<div className={styles.box4item0}>Contact Details</div>
......@@ -353,11 +325,7 @@ const UsersDetail = (props: any) => {
<>
<Spin spinning={loadding}>
<div>
<TitleBack
title={'Family/Tenant Details'}
url="none"
titleBack={titleBackCallBack}
></TitleBack>
<TitleBack title="Family/Tenant Details" url="none" titleBack={titleBackCallBack} />
<Row>
<Col span={4}>User Type:</Col>
<Col span={4}>
......@@ -375,7 +343,7 @@ const UsersDetail = (props: any) => {
<Col span={4}>{memberData.owner_family_phone}</Col>
<Col span={4}>{memberData.owner_family_email}</Col>
</Row>
<Line></Line>
<Line />
<Button danger onClick={DeleteMember.bind(this, memberData)}>
Delete
......
......@@ -24,14 +24,12 @@ const Services = (props: any) => {
useEffect(() => {
if (DataServices != null) {
console.log(DataServices);
setDataList(DataServices.data.rows);
let tmp = DataServices.data.rows.map(
(v: { serviceName: string; deleted: number }, i: number) => {
return v.deleted !== 1 && v.serviceName;
},
);
console.log(tmp);
formRef.current['setFieldsValue']({ serviceName: tmp });
}
}, [DataServices]);
......@@ -66,12 +64,9 @@ const Services = (props: any) => {
};
useEffect(() => {
console.log(Result);
if (Result) {
if (Result.error_code !== '0000') {
message.error('Failed: binding service provider!!!');
} else {
message.success('Operate Success!!!');
}
Clear(module + '/ClearResult', dispatch);
RA(43, {}, module, dispatch);
......
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