Commit 7213e1ef authored by 张烨's avatar 张烨
parents d23620ce 0639e6ec
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Spin, Button, Empty } from 'antd'; import { Spin, Checkbox, Button, Empty } from 'antd';
import _ from 'lodash'; import _ from 'lodash';
import ListCardItem from './ItemCard'; import ListCardItem from './ItemCard';
import styles from './ItemCard.less'; import styles from './ItemCard.less';
...@@ -60,6 +60,32 @@ const ListCard = props => { ...@@ -60,6 +60,32 @@ const ListCard = props => {
// console.timeEnd('updateValueList:'); // console.timeEnd('updateValueList:');
}; };
const checkAll = e => {
if (e.target.checked) {
const result = dataList.map(item => getAllID(item)).flat(Infinity);
setValueList(result);
// eslint-disable-next-line no-unused-expressions
onChange && onChange(result);
} else {
setValueList([]);
// eslint-disable-next-line no-unused-expressions
onChange && onChange([]);
}
};
const getAllID = item => {
let result = [];
const haveChildren =
Array.isArray(item.children) && item.children.length > 0;
// 统一使用 getId
result.push(getId(item));
if (haveChildren) {
// 每次递归result被置空,所以要另外保存
result = [...item.children.map(i => getAllID(i)), ...result];
}
return result;
};
return ( return (
<div> <div>
{loading ? ( {loading ? (
...@@ -77,6 +103,7 @@ const ListCard = props => { ...@@ -77,6 +103,7 @@ const ListCard = props => {
/> />
) : ( ) : (
<> <>
<Checkbox onChange={checkAll}>全选/全不选</Checkbox>
{dataList && dataList.length > 0 ? ( {dataList && dataList.length > 0 ? (
dataList dataList
.filter(d => d.type === 'widgetGroup' || 'widget') .filter(d => d.type === 'widgetGroup' || 'widget')
......
...@@ -59,10 +59,13 @@ const Login = props => { ...@@ -59,10 +59,13 @@ const Login = props => {
} }
} }
if (userMode === USER_MODE.COMMON) { if (userMode === USER_MODE.COMMON) {
const authority = [AUTHORITY.LOGIN, AUTHORITY.COMMON]; // const authority = [AUTHORITY.LOGIN, AUTHORITY.COMMON];
setAuthority(authority); // setAuthority(authority);
setAuth(authority); // setAuth(authority);
history.push(`/userCenter/UserManage`); // history.push(`/userCenter/UserManage`);
notification.warning({
message: msg || '没有权限!',
});
} }
} else { } else {
notification.warning({ notification.warning({
......
...@@ -496,7 +496,7 @@ const UserManage = () => { ...@@ -496,7 +496,7 @@ const UserManage = () => {
const changePassword = record => { const changePassword = record => {
setPasswordVisible(true); setPasswordVisible(true);
passwordForm.setFieldsValue({ passwordForm.setFieldsValue({
oldpassword: record.password, oldPassword: record.password,
newPassword: '', newPassword: '',
passwordConfirm: '', passwordConfirm: '',
}); });
...@@ -867,7 +867,7 @@ const UserManage = () => { ...@@ -867,7 +867,7 @@ const UserManage = () => {
}); });
// 提交-修改密码 // 提交-修改密码
const submitChangePassword = () => { const submitChangePassword = () => {
const password = passwordForm.getFieldValue('password'); const oldPassword = passwordForm.getFieldValue('oldPassword');
const newPassword = passwordForm.getFieldValue('newPassword'); const newPassword = passwordForm.getFieldValue('newPassword');
const passwordConfirm = passwordForm.getFieldValue('passwordConfirm'); const passwordConfirm = passwordForm.getFieldValue('passwordConfirm');
if ( if (
...@@ -877,14 +877,13 @@ const UserManage = () => { ...@@ -877,14 +877,13 @@ const UserManage = () => {
newPassword.length >= 6 && newPassword.length >= 6 &&
newPassword === passwordConfirm newPassword === passwordConfirm
) { ) {
updateUserPassword( updateUserPassword({
currentUser.userID, UserId: +currentUser.userID,
password, OldPassWord: oldPassword,
newPassword, NewPassWord: newPassword,
passwordConfirm, })
)
.then(res => { .then(res => {
if (res.success) { if (res.code === 0) {
setPasswordVisible(false); setPasswordVisible(false);
notification.success({ notification.success({
message: '提交成功', message: '提交成功',
...@@ -1404,7 +1403,7 @@ const UserManage = () => { ...@@ -1404,7 +1403,7 @@ const UserManage = () => {
cancelText="取消" cancelText="取消"
> >
<Form form={passwordForm} labelCol={{ span: 4 }}> <Form form={passwordForm} labelCol={{ span: 4 }}>
<Form.Item name="oldpassword" label="原始密码"> <Form.Item name="oldPassword" label="原始密码">
<Input disabled /> <Input disabled />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
......
...@@ -185,6 +185,7 @@ ...@@ -185,6 +185,7 @@
.ant-tree-switcher{ .ant-tree-switcher{
line-height: 1; line-height: 1;
color:#1890FF; color:#1890FF;
margin-right: 0px !important;
} }
.ant-checkbox-group .ant-checkbox-group-item { .ant-checkbox-group .ant-checkbox-group-item {
margin-right: 0px !important; margin-right: 0px !important;
......
...@@ -110,20 +110,8 @@ export const addToOrgs = (userIDs, orgIDs, newOrgID) => ...@@ -110,20 +110,8 @@ export const addToOrgs = (userIDs, orgIDs, newOrgID) =>
newGroupId: newOrgID, newGroupId: newOrgID,
}); });
export const updateUserPassword = ( export const updateUserPassword = params =>
userID, post(`${PUBLISH_SERVICE}/UserCenter/UpdateUserPassword`, params);
oldpassword,
newPassword,
passwordConfirm,
) =>
get(`/Cityinterface/rest/services/OMS.svc/U_UpdatePassword`, {
_version: 9999,
_dc: Date.now(),
userID,
oldpassword,
newPassword,
passwordConfirm,
});
export const editUser = (userID, loginName, userName, phone, email) => export const editUser = (userID, loginName, userName, phone, email) =>
get(`/Cityinterface/rest/services/OMS.svc/U_EditUser`, { get(`/Cityinterface/rest/services/OMS.svc/U_EditUser`, {
......
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