Commit 1f8983fd by chenshu

feat:完善各页面

parent 96acdb00
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-07-09 14:03:09 * @Date: 2020-07-09 14:03:09
* @Last Modified by: chenshu * @Last Modified by: chenshu
* @Last Modified time: 2021-04-10 13:56:06 * @Last Modified time: 2021-04-10 14:36:43
* 学院管理-员工管理 * 学院管理-员工管理
*/ */
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
...@@ -155,7 +155,7 @@ function EmployeeManage() { ...@@ -155,7 +155,7 @@ function EmployeeManage() {
dataIndex: "phone", dataIndex: "phone",
key: "phone", key: "phone",
render: (val: string) => { render: (val: string) => {
return <div>{val}</div>; return <div>{val || '-'}</div>;
}, },
}, },
{ {
...@@ -356,15 +356,17 @@ function EmployeeManage() { ...@@ -356,15 +356,17 @@ function EmployeeManage() {
})} })}
</div> </div>
</div> </div>
<Button {(User.getUserRole() === 'CloudManager' || User.getUserRole() === 'StoreManager') &&
onClick={() => { <Button
handleToAddEmployee(); onClick={() => {
}} handleToAddEmployee();
type="primary" }}
className="add-show-btn" type="primary"
> className="add-show-btn"
添加员工 >
</Button> 添加员工
</Button>
}
</div> </div>
<div className="box-body"> <div className="box-body">
<Table <Table
......
...@@ -13,4 +13,9 @@ ...@@ -13,4 +13,9 @@
} }
} }
} }
.coupon-info {
.tag {
margin-left: 4px;
}
}
} }
\ No newline at end of file
...@@ -62,10 +62,14 @@ function UserManagePage() { ...@@ -62,10 +62,14 @@ function UserManagePage() {
{ {
title: "用户姓名", title: "用户姓名",
dataIndex: "nickName", dataIndex: "nickName",
render: (val: string) => { render: (val: string, item: any) => {
return ( return (
<div className="coupon-info"> <div className="coupon-info">
<span className="title">{val}</span> <span className="title">{val}</span>
<span
className="tag"
style={{ color: item.sourceEnum === 'WORK_WE_CHAT' ? '#FFB714' : '#1DCC65'}}
>{item.sourceEnum === 'WORK_WE_CHAT' ? '@企业微信' : '@微信'}</span>
</div> </div>
); );
}, },
...@@ -75,7 +79,7 @@ function UserManagePage() { ...@@ -75,7 +79,7 @@ function UserManagePage() {
dataIndex: "phone", dataIndex: "phone",
key: "phone", key: "phone",
render: (val: string) => { render: (val: string) => {
return <div>{val}</div>; return <div>{val || '-'}</div>;
}, },
}, },
{ {
...@@ -179,13 +183,15 @@ function UserManagePage() { ...@@ -179,13 +183,15 @@ function UserManagePage() {
/> />
</div> </div>
</div> </div>
<Button {(User.getUserRole() === 'CloudManager' || User.getUserRole() ==='StoreManager') &&
type="primary" <Button
style={{ marginBottom: 12 }} type="primary"
onClick={() => { style={{ marginBottom: 12 }}
handleToAddEmployee(); onClick={() => {
}} handleToAddEmployee();
>添加用户</Button> }}
>添加用户</Button>
}
<div className="box-body"> <div className="box-body">
<Table <Table
size={"middle"} size={"middle"}
......
...@@ -20,6 +20,7 @@ export default class CollegeManagePage extends React.Component { ...@@ -20,6 +20,7 @@ export default class CollegeManagePage extends React.Component {
name: '', name: '',
list: [], list: [],
enterpriseId: User.getEnterpriseId(), enterpriseId: User.getEnterpriseId(),
isAdmin: false,
}; };
} }
...@@ -35,8 +36,8 @@ export default class CollegeManagePage extends React.Component { ...@@ -35,8 +36,8 @@ export default class CollegeManagePage extends React.Component {
userId: User.getUserId(), userId: User.getUserId(),
} }
BaseService.getEnterpriseUser(params).then((res) => { BaseService.getEnterpriseUser(params).then((res) => {
const { name, avatar } = res.result; const { name, avatar, isAdmin } = res.result;
this.setState({ name, avatar }) this.setState({ name, avatar, isAdmin })
}); });
} }
...@@ -70,6 +71,7 @@ export default class CollegeManagePage extends React.Component { ...@@ -70,6 +71,7 @@ export default class CollegeManagePage extends React.Component {
name, name,
avatar, avatar,
list, list,
isAdmin,
} = this.state; } = this.state;
return ( return (
<div className="college-manage-page"> <div className="college-manage-page">
...@@ -106,7 +108,10 @@ export default class CollegeManagePage extends React.Component { ...@@ -106,7 +108,10 @@ export default class CollegeManagePage extends React.Component {
key={item.id} key={item.id}
className={`college-item${item.state === 'VALID' ? '' : ' disabled'}`} className={`college-item${item.state === 'VALID' ? '' : ' disabled'}`}
onClick={() => { onClick={() => {
if (item.state !== 'VALID') return null; if (item.state !== 'VALID') {
message.warning('学院已停用,请启用后使用或联系学院管理员');
return null;
};
User.setStoreId(item.id); User.setStoreId(item.id);
window.RCHistory.push('/home') window.RCHistory.push('/home')
}} }}
...@@ -118,7 +123,7 @@ export default class CollegeManagePage extends React.Component { ...@@ -118,7 +123,7 @@ export default class CollegeManagePage extends React.Component {
<div className="title">{item.storeName}</div> <div className="title">{item.storeName}</div>
<div className="time">{moment(item.createTime).format('YYYY-MM-DD HH:mm')}</div> <div className="time">{moment(item.createTime).format('YYYY-MM-DD HH:mm')}</div>
<div className="control-box"> <div className="control-box">
{item.state === 'VALID' && {item.userRole === 'StoreManager' && item.state === 'VALID' &&
<span <span
className="control-button" className="control-button"
onClick={(e) => { onClick={(e) => {
...@@ -129,24 +134,26 @@ export default class CollegeManagePage extends React.Component { ...@@ -129,24 +134,26 @@ export default class CollegeManagePage extends React.Component {
}} }}
>编辑</span> >编辑</span>
} }
<span {(item.userRole === 'StoreManager' || item.state === 'VALID') &&
className="control-button" <span
onClick={(e) => { className="control-button"
if (item.state !== 'VALID') return null; onClick={(e) => {
e.preventDefault(); if (item.state !== 'VALID') return null;
e.stopPropagation(); e.preventDefault();
Modal.confirm({ e.stopPropagation();
title: '确定停用吗?', Modal.confirm({
content: '禁用学院,所有学院相关信息不可使用,用户无法继续学习,请谨慎操作!', title: '确定停用吗?',
icon: <span className="icon iconfont default-confirm-icon">&#xe6f4;</span>, content: '禁用学院,所有学院相关信息不可使用,用户无法继续学习,请谨慎操作!',
onOk: () => { icon: <span className="icon iconfont default-confirm-icon">&#xe6f4;</span>,
this.changeCollege(item, false); onOk: () => {
}, this.changeCollege(item, false);
okText: '停用', },
cancelText: '取消', okText: '停用',
}) cancelText: '取消',
}} })
>{item.state === 'VALID' ? '停用' : '已停用'}</span> }}
>{item.state === 'VALID' ? '停用' : '已停用'}</span>
}
<span <span
className="control-button disable-button" className="control-button disable-button"
onClick={(e) => { onClick={(e) => {
...@@ -158,14 +165,16 @@ export default class CollegeManagePage extends React.Component { ...@@ -158,14 +165,16 @@ export default class CollegeManagePage extends React.Component {
</div> </div>
</div> </div>
))} ))}
<div {list.length < 10 && isAdmin &&
className="college-create" <div
onClick={() => { className="college-create"
window.RCHistory.push('/college-manage/create') onClick={() => {
}} window.RCHistory.push('/college-manage/create')
> }}
<span className="create-word">+ 创建企学院</span> >
</div> <span className="create-word">+ 创建企学院</span>
</div>
}
</div> </div>
</div> </div>
</div> </div>
......
...@@ -30,7 +30,12 @@ export default class CreateCollege extends React.Component { ...@@ -30,7 +30,12 @@ export default class CreateCollege extends React.Component {
userId: User.getUserId(), userId: User.getUserId(),
} }
BaseService.getEnterpriseUser(params).then((res) => { BaseService.getEnterpriseUser(params).then((res) => {
const { name, avatar } = res.result; const { name, avatar, isAdmin } = res.result;
if (!isAdmin) {
message.error('你没有该权限');
window.RCHistory.replace('/college-manage')
return null;
}
this.setState({ name, avatar }) this.setState({ name, avatar })
}); });
} }
......
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