Commit 1c6ae294 authored by cellee's avatar cellee

修改admin的密码信息、小区排版修复

Signed-off-by: cellee's avatarcellee <893264950@qq.com>
parent 13579cda
/*
* @Author: your name
* @Date: 2020-12-01 18:40:06
* @LastEditTime: 2021-02-03 15:41:15
* @LastEditTime: 2021-02-23 09:51:06
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\config\config.ts
......@@ -372,6 +372,7 @@ export default defineConfig({
{ path: './Add', component: './AccountManagement/account/AccountAdds' },
{ path: './Detail', component: './AccountManagement/account/AccountDetail' },
{ path: './reset', component: './AccountManagement/account/AccountReset' },
{ path: './editAdmin', component: './AccountManagement/account/editAdmin' },
{ path: '*', component: '@/pages/404' },
],
},
......
/*
* @Author: your name
* @Date: 2021-02-01 14:54:48
* @LastEditTime: 2021-02-22 17:14:12
* @LastEditTime: 2021-02-23 10:42:27
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\components\Form\PdfUpload.tsx
......@@ -93,7 +93,7 @@ const PdfUpload: React.FC<PriceInputProps> = ({
v.descriptionId == detailvalue[i].descriptionId
);
});
console.log(filterValue);
// console.log(filterValue);
if (filterValue.length > 0) {
obj.forEach((n: any) => {
if (
......
......@@ -64,17 +64,16 @@ export default {
*RA({ playload }, { call, put }) {
const resp = yield call(service.RA, playload);
if (resp.code == 500 || resp.error_code != '0000') {
}
if (resp.error_code != '0000') {
printf(playload, resp);
message.error(`${resp.error_code}:${resp.error_msg}`);
} else {
switch (playload.index) {
case 41:
case 67: // 编辑admin
{
// let Data = resp.data;
// yield put({ type: 'returnPage', Data });
let Data = null;
yield put({ type: 'returnPage', Data });
history.push('/AccountManagement/account');
}
break;
case 38:
......
/*
* @Author: your name
* @Date: 2020-11-19 16:54:53
* @LastEditTime: 2021-02-20 18:41:17
* @LastEditTime: 2021-02-23 10:33:29
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\pages\AccountManagement\CompanyInformation\CompanyInformation.tsx
......@@ -15,7 +15,7 @@ import { connect } from 'umi';
import styles from './index.less';
const CompanyInformation = (props: any) => {
const { dispatch, Means, loading } = props;
const { dispatch, Means, loading, user } = props;
const [ModelExcel, setModelExcel] = useState(false); //编辑状态
......@@ -62,7 +62,7 @@ const CompanyInformation = (props: any) => {
<div className={styles.box}>
<div className={styles.item1}>Company Information</div>
{ModelExcel ? (
{ModelExcel && user.currentUser.userModel.tosUserName == 'admin' ? (
<Button onClick={goToReturn}>
<LeftOutlined />
Back
......@@ -141,11 +141,13 @@ const CompanyInformation = (props: any) => {
};
const Company = (styte: any) => {
const { user } = styte;
const { Means } = styte.Account;
const loading = styte.loading.models.Account || false;
return {
Means,
loading,
user,
};
};
export default connect(Company)(CompanyInformation);
......@@ -68,3 +68,9 @@ hr {
// transform: translateY(-50%);
}
}
.editadmin {
.ant-form-item-label {
width: 160px;
}
}
import React, { useState, useEffect } from 'react';
import { Form, Input, Button, Pagination, message, Modal, Tag } from 'antd';
import { Form, Input, Button, Pagination, message, Tag } from 'antd';
import { connect, history } from 'umi';
import { SearchOutlined, ClearOutlined, PlusOutlined } from '@ant-design/icons';
import { SearchOutlined, PlusOutlined } from '@ant-design/icons';
import ProTable from '@ant-design/pro-table';
import './Account.less';
......@@ -9,16 +9,15 @@ import './Account.less';
import moment from 'moment';
const Account = (props: any) => {
const { dispatch, Data, DataSave, DataSaveDetail, Result, loading } = props;
const { user, dispatch, Data, Result, loading } = props;
const RA = (index: any, values: any) => {
dispatch({ type: 'Account/RA', playload: { index: index, body: values } });
};
const [term, setTerm] = useState({} as any); // 拉取数据的条件存储
const [over, setOver] = useState(false); // 关闭账号确认弹窗
const [accountName, setaccountName] = useState(null as any); // 弹窗账号信息
// 数据
useEffect(() => {
console.log(Data);
if (Data == null) {
Refresh();
}
......@@ -27,13 +26,6 @@ const Account = (props: any) => {
// 监听改变状态提交结果
useEffect(() => {
if (Result != null) {
// console.log('改变取消弹窗重新加载,在清空结果');
// let obj = {
// userStatus: accountName.userStatus == 0 ? 1 : 0,
// userID: accountName.tosUserId,
// };
// RA(52, obj);
setOver(false);
// 清除结果
dispatch({ type: 'Account/ResultClear' });
dispatch({ type: 'Account/ReData' });
......@@ -56,11 +48,6 @@ const Account = (props: any) => {
RA(51, obj);
};
// 列表刷新加载
const Refresh2 = () => {
RA(51, term);
};
// 表头
const columns = [
{
......@@ -94,13 +81,6 @@ const Account = (props: any) => {
);
},
},
// {
// title: 'Created By',
// dataIndex: 'tosUserServiceCell',
// key: 'createAccount',
// width: 280,
// ellipsis: true,
// },
{
title: 'Creator',
dataIndex: 'creatorName',
......@@ -127,7 +107,7 @@ const Account = (props: any) => {
onClick={() => {
edit(record);
}}
disabled={record.tosUserLevel == 1 ? true : false}
disabled={record.tosUserLevel == 1 && user.tosUserLevel !== 1 ? true : false}
>
Edit
</Button>
......@@ -140,19 +120,6 @@ const Account = (props: any) => {
>
Detail
</Button>
{/* <Button
type="link"
onClick={() => {
lockS(record);
}}
>
{record.userStatus != 1 ? 'Close' : 'Open'}
</Button> */}
{/*{record.userID == 1||record.userID == this.props.currentUser.userid?'':
<Button style={{background: 'transparent', border: 0, color: '#1890FF'}}
onClick={() => this.changeStatus(record)}>
{record.userStatus == 1 ? "lock" : "unlock"}</Button>}*/}
</span>
),
},
......@@ -160,11 +127,16 @@ const Account = (props: any) => {
// 编辑- 新增
const edit = (item: any) => {
// console.log(item);
console.log(item);
// 无论编辑还是新增都清掉二级账户选择
dispatch({ type: 'Account/InfoClear' });
if (item == 1) {
history.push('/AccountManagement/account/Add');
} else if (item.tosUserName == 'admin') {
// console.log('跳到编辑Admin');
let DataSave = item;
dispatch({ type: 'Account/SA', DataSave });
history.push('/AccountManagement/account/editAdmin');
} else {
let DataSave = item;
dispatch({ type: 'Account/SA', DataSave });
......@@ -179,13 +151,6 @@ const Account = (props: any) => {
history.push('/AccountManagement/account/Detail');
};
// 停用账号弹窗
const lockS = (item: any) => {
setOver(true);
setaccountName(item);
console.log(item);
};
// 表头单搜索
const onFinishContract = (value: any) => {
if (value.tosAccountName || value.creatorName) {
......@@ -211,21 +176,6 @@ const Account = (props: any) => {
RA(51, t);
};
// 弹窗 提交确认账号打开关闭
const handleOk = (e: any) => {
//
let obj = {
userStatus: accountName.userStatus == 0 ? 1 : 0,
userID: accountName.tosUserId,
};
RA(52, obj);
// setOver(false);
};
// 关闭弹窗
const handleCancel = (e: any) => {
setOver(false);
};
return (
<>
<div className="contop" style={{ display: 'flex', justifyContent: 'space-between' }}>
......@@ -246,16 +196,6 @@ const Account = (props: any) => {
<Button type="primary" htmlType="submit" icon={<SearchOutlined />} loading={loading}>
Search{' '}
</Button>
{/* <Button
htmlType="button"
onClick={Refresh}
style={{ marginLeft: '15px' }}
icon={<ClearOutlined />}
loading={loading}
>
{' '}
Reset
</Button> */}
</Form.Item>
</Form>
......@@ -281,18 +221,6 @@ const Account = (props: any) => {
search={false}
loading={loading}
toolBarRender={false}
// toolBarRender={() => [
// <Button
// type="primary"
// loading={loading}
// icon={<PlusOutlined />}
// onClick={() => {
// edit(1);
// }}
// >
// Add Account
// </Button>,
// ]}
options={{
density: false,
fullScreen: false,
......@@ -300,7 +228,6 @@ const Account = (props: any) => {
setting: false,
}}
headerTitle="Account list"
// pagination={{ defaultCurrent: 1, total: Data.totalRow }}
/>
<div className="pages">
......@@ -319,9 +246,11 @@ const Account = (props: any) => {
};
const AccountProps = (styte: any) => {
const user = styte.user.currentUser.userModel;
const { Data, DataSave, DataSaveDetail, Result } = styte.Account;
const loading = styte.loading.models.Account || false;
return {
user,
Data,
DataSave,
DataSaveDetail,
......
import React, { useState, useEffect, useRef } from 'react';
import { Form, Button, Spin, Input } from 'antd';
import { connect, history } from 'umi';
import { EditOutlined, LeftOutlined } from '@ant-design/icons';
import './Account.less';
const Account = (props: any) => {
const module = 'Account';
const { dispatch, SubResult, user, DataSave, load } = props;
const RA = (index: any, values: any) => {
dispatch({ type: 'Account/RA', playload: { index: index, body: values } });
};
const [pass, setPass] = useState(false); // 是否修改密码
const [tips, setTips] = useState({
start: false,
mag: '',
}); // 表单提示
// 表单标识
const [form] = Form.useForm();
const formRef = useRef(null);
// 当前编辑账户的数据
useEffect(() => {
if (DataSave != null && user != null) {
// 赋值
form.setFieldsValue({
tosUserName: DataSave.tosUserName,
tosUserPhone: DataSave.tosUserPhone,
tosAccountName: DataSave.tosAccountName,
});
} else {
history.push('/AccountManagement/account');
}
}, [DataSave, user]);
//提交信息结果
useEffect(() => {
if (SubResult != null) {
if (SubResult.statr == 0 && SubResult.desc == 0) {
// 保存成功, 清掉原来数据 并且跳转
// message.success('Submitted Successfully !');
dispatch({ type: module + '/ReData' });
dispatch({ type: module + '/AccountClear' });
history.go(-1);
}
}
}, [SubResult]);
// 保存提交
const onFinishContract = async (value: any) => {
// 提交判断
if (pass && (!value.oldPassword || !value.tosUserPwd)) {
setTips({ start: true, mag: 'Please enter everything' });
} else if (pass && value.tosUserPwd && value.tosUserPwd.legth < 5) {
setTips({ start: true, mag: 'The password is too simple (Must be greater than 6 digits)' });
} else if (pass && value.tosUserPwd != value.tosUserPwd1) {
setTips({ start: true, mag: 'The two passwords are inconsistent' });
} else {
setTips({ start: false, mag: '' });
RA(67, value);
}
// RA(67, value);
};
//goToReturn
const goToReturn = () => {
history.go(-1);
};
//输入密码
const goPass = () => {
setTips({
start: false,
mag: '',
});
setPass(!pass);
};
return (
<Spin spinning={load}>
<div className="contop editadmin" style={{ padding: '12px 20px' }}>
<h3 className="capi">
<EditOutlined />
&nbsp; Edit Admin
<div className="back">
<Button onClick={goToReturn}>
<LeftOutlined />
Back
</Button>
</div>
</h3>
<hr></hr>
{/* 表单内容 */}
<Form
ref={formRef}
form={form}
autoComplete="off"
layout="inline"
name="contract"
onFinish={onFinishContract}
>
<div style={{ width: '100%', marginBottom: 20 }}>
<Form.Item name="tosUserName" label="Account" style={{ display: 'inline-block' }}>
<Input value="admin" disabled />
</Form.Item>
</div>
<div style={{ width: '100%', marginBottom: 20 }}>
<Form.Item
name="tosAccountName"
label="Administrator Name"
rules={[{ required: true }]}
style={{ display: 'inline-block' }}
>
<Input maxLength={24} minLength={2} placeholder="Please enter Administrator Name" />
</Form.Item>
<Form.Item
name="tosUserPhone"
label="Contact Information"
rules={[{ required: true }]}
style={{ display: 'inline-block', margin: '0 8px' }}
>
<Input maxLength={11} minLength={8} placeholder="Please enter Contact Information" />
</Form.Item>
</div>
{pass ? (
// 点击输入密码
<div style={{ width: '100%', marginBottom: 5 }}>
<Form.Item label="Change Password">
<Form.Item name="oldPassword" style={{ marginBottom: 15 }}>
<Input
type="password"
maxLength={24}
placeholder="Old password"
style={{ width: 240 }}
/>
</Form.Item>
<Form.Item name="tosUserPwd" style={{ marginBottom: 15 }}>
<Input
type="password"
maxLength={24}
placeholder="New password"
style={{ width: 240 }}
/>
</Form.Item>
<Form.Item name="tosUserPwd1" style={{ marginBottom: 15 }}>
<Input
type="password"
maxLength={24}
placeholder="New password again"
style={{ width: 240 }}
/>
</Form.Item>
</Form.Item>
{/* 表单错误提示 */}
{tips.start ? (
<li style={{ marginLeft: 160, color: '#f00', marginBottom: 15 }}>{tips.mag}</li>
) : (
''
)}
</div>
) : (
// 没点击输入密码
<div style={{ width: '100%', marginBottom: 25 }}>
<Form.Item label="Login password">
<Button type="link" onClick={goPass}>
Change Password
</Button>
</Form.Item>
</div>
)}
<Form.Item style={{ marginLeft: 160 }}>
<Button type="primary" htmlType="submit" loading={load}>
Submit
</Button>
{pass ? (
//本次不修改
<Button type="link" onClick={goPass}>
Next change password
</Button>
) : (
''
)}
</Form.Item>
</Form>
</div>
</Spin>
);
};
const AccountProps = (state: any) => {
const { Data, DataSave, DataSaveDetail, Result, SubResult } = state.Account;
const { user } = state;
const load = state.loading.global;
return {
Data,
DataSave,
DataSaveDetail,
Result,
user, // 获取当前账户信息
SubResult,
load,
};
};
export default connect(AccountProps)(Account);
......@@ -424,6 +424,7 @@ const Adds = (props: any) => {
name={'mainPdfList'}
label="Maintenance Schedule:"
colon={false}
wrapperCol={{ span: 24 }}
style={{
marginBottom: tips[0] ? 4 : 14,
}}
......@@ -454,6 +455,7 @@ const Adds = (props: any) => {
name={'essentialPdfList'}
label="Essential Information:"
colon={false}
wrapperCol={{ span: 24 }}
style={{
marginBottom: tips[1] ? 4 : 14,
}}
......
/*
* @Author: your name
* @Date: 2020-11-19 20:34:18
* @LastEditTime: 2021-02-20 18:14:15
* @LastEditTime: 2021-02-23 17:12:49
* @LastEditors: Please set LastEditors
* @Description: In User Settings Edit
* @FilePath: \tostumi\src\utils\params.ts
......@@ -99,4 +99,5 @@ export const requestList = [
['/tos/tosCommunity/get/detail2', '64 获取小区详情(新增)', {}],
['/tos/tosCompany/edit', '65 修改公司信息', {}],
['/tos/tosCompany/get', '66 获取公司信息', {}],
['/tos/users/edit', '67 修改admin信息', {}],
];
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