Commit c8502300 by wufan

feat:联调员工管理

parent cc180c86
/*
* @Author: wufan
* @Date: 2020-12-01 17:21:21
* @LastEditors: wufan
* @LastEditTime: 2020-12-01 18:07:03
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import Service from "@/common/js/service";
export function getUserStore(params: object) {
return Service.Hades("public/store/getUserStore", params);
}
\ No newline at end of file
...@@ -2,14 +2,18 @@ ...@@ -2,14 +2,18 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-11-25 18:25:02 * @Date: 2020-11-25 18:25:02
* @LastEditors: wufan * @LastEditors: wufan
* @LastEditTime: 2020-12-01 15:30:16 * @LastEditTime: 2020-12-01 18:14:38
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import Service from "@/common/js/service"; import Service from "@/common/js/service";
export function getEmployeeList(params: object) { export function getEmployeeList(params: object) {
return Service.postJSON("appolo/public/businessMicroWebsite/getMicroWebsiteCouponList", params); return Service.Hades("public/store/getStoreUserPage", params);
}
export function getStoreRole(params: object) {
return Service.Hades("public/store/getStoreRole", params);
} }
export function getUserList(params: object) { export function getUserList(params: object) {
...@@ -18,4 +22,4 @@ export function getUserList(params: object) { ...@@ -18,4 +22,4 @@ export function getUserList(params: object) {
export function getStoreDecorationList(params: object) { export function getStoreDecorationList(params: object) {
return Service.Apollo("public/businessMicroWebsite/getMicroWebsiteCouponList", params); return Service.Apollo("public/businessMicroWebsite/getMicroWebsiteCouponList", params);
} }
\ No newline at end of file
/*
* @Author: wufan
* @Date: 2020-12-01 17:20:49
* @LastEditors: wufan
* @LastEditTime: 2020-12-01 17:23:45
* @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/
import { getUserStore } from '@/data-source/base/request-apis';
export default class StoreService {
// 获取员工列表
static getUserStore(params: any) {
return getUserStore(params);
}
}
\ No newline at end of file
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-11-25 18:25:02 * @Date: 2020-11-25 18:25:02
* @LastEditors: wufan * @LastEditors: wufan
* @LastEditTime: 2020-11-30 17:17:01 * @LastEditTime: 2020-12-01 18:13:50
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
import { getEmployeeList, getUserList, getStoreDecorationList } from '@/data-source/store/request-apis'; import { getEmployeeList, getUserList, getStoreDecorationList, getStoreRole } from '@/data-source/store/request-apis';
export default class StoreService { export default class StoreService {
// 获取员工列表 // 获取员工列表
...@@ -14,6 +14,11 @@ export default class StoreService { ...@@ -14,6 +14,11 @@ export default class StoreService {
return getEmployeeList(params); return getEmployeeList(params);
} }
// 获取店铺角色
static getStoreRole(params: any) {
return getStoreRole(params);
}
// 删除员工 // 删除员工
static deleteEmployee(params: any) { static deleteEmployee(params: any) {
return getUserList(params); return getUserList(params);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-04-27 20:35:34 * @Date: 2020-04-27 20:35:34
* @LastEditors: wufan * @LastEditors: wufan
* @LastEditTime: 2020-12-01 15:23:22 * @LastEditTime: 2020-12-01 17:17:43
* @Description: * @Description:
*/ */
...@@ -13,12 +13,10 @@ import { ConfigProvider } from 'antd'; ...@@ -13,12 +13,10 @@ import { ConfigProvider } from 'antd';
import { createHashHistory } from 'history'; import { createHashHistory } from 'history';
import zh_CN from 'antd/es/locale/zh_CN'; import zh_CN from 'antd/es/locale/zh_CN';
import _ from 'underscore'; import _ from 'underscore';
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosPromise } from 'axios';
import { RootRouter } from './routes/index'; import { RootRouter } from './routes/index';
import 'antd/dist/antd.less'; import 'antd/dist/antd.less';
import '@/common/less/index.less'; import '@/common/less/index.less';
import '@/core/function'; import '@/core/function';
import User from '@/common/js/user';
import '@/common/less/index.less'; import '@/common/less/index.less';
const history = createHashHistory(); const history = createHashHistory();
...@@ -39,22 +37,8 @@ window.RCHistory = _.extend({}, history, { ...@@ -39,22 +37,8 @@ window.RCHistory = _.extend({}, history, {
history.replace(obj) history.replace(obj)
} }
}); });
export async function mount() {
// useEffect(()=>{
// fetchUserInsts();
// })
// function fetchUserInsts(){
// const userId = User.getUserId();
// axios.post("hades/public/store/getUserStore",{ userId })
// .then((res: any) => {
// const { storeGroupVOS, storeVOS } = res.result;
// })
// }
export async function mount() {
ReactDOM.render( ReactDOM.render(
<RootRouter/>, <RootRouter/>,
document.getElementById('root')); document.getElementById('root'));
......
/* /*
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2019-07-10 10:30:49 * @Date: 2019-07-10 10:30:49
* @LastEditors: wangyixi * @LastEditors: wufan
* @LastEditTime: 2020-11-09 19:21:03 * @LastEditTime: 2020-12-01 17:30:13
* @Description: * @Description:
*/ */
import React from 'react' import React from 'react'
...@@ -13,6 +13,9 @@ import Menu from './Menu' ...@@ -13,6 +13,9 @@ import Menu from './Menu'
import Main from './Main' import Main from './Main'
import { Route, Switch } from 'react-router-dom' import { Route, Switch } from 'react-router-dom'
import zhCN from 'antd/es/locale/zh_CN' import zhCN from 'antd/es/locale/zh_CN'
import User from '@/common/js/user';
import axios from 'axios';
import BaseService from "@/domains/basic-domain/baseService";
class App extends React.Component { class App extends React.Component {
constructor(props) { constructor(props) {
...@@ -22,8 +25,18 @@ class App extends React.Component { ...@@ -22,8 +25,18 @@ class App extends React.Component {
} }
} }
componentDidMount() { componentDidMount() {
this.getUserStore()
} }
getUserStore = () => {
const userId = User.getUserId();
BaseService.getUserStore({ userId }).then((res) => {
console.log(res.result);
const { storeGroupVOS, storeVOS } = res.result;
});
}
render() { render() {
return [ return [
<div id="home"> <div id="home">
......
...@@ -15,6 +15,7 @@ import { QuestionCircleOutlined } from '@ant-design/icons'; ...@@ -15,6 +15,7 @@ import { QuestionCircleOutlined } from '@ant-design/icons';
import { storeRoleEnum } from "@/domains/store-domain/constants"; import { storeRoleEnum } from "@/domains/store-domain/constants";
import StoreService from "@/domains/store-domain/storeService"; import StoreService from "@/domains/store-domain/storeService";
import EmployeeAddOrEditModal from './EmployeeAddOrEditModal'; import EmployeeAddOrEditModal from './EmployeeAddOrEditModal';
import User from '@/common/js/user';
import "./EmployeesManagePage.less"; import "./EmployeesManagePage.less";
const { confirm } = Modal; const { confirm } = Modal;
...@@ -29,13 +30,13 @@ interface RecordTypes { ...@@ -29,13 +30,13 @@ interface RecordTypes {
function EmployeesManagePage() { function EmployeesManagePage() {
const [employeeList, setEmployeeList] = useState([ const [employeeList, setEmployeeList] = useState([
{ {
name: "赵云", nickName: "赵云",
phone: "18767118672", phone: "18767118672",
role: "0", role: "0",
storeUserId: "0" storeUserId: "0"
}, },
{ {
name: "吕布", nickName: "吕布",
phone: "18767118672", phone: "18767118672",
role: "0", role: "0",
storeUserId: "2" storeUserId: "2"
...@@ -44,20 +45,23 @@ function EmployeesManagePage() { ...@@ -44,20 +45,23 @@ function EmployeesManagePage() {
const [query, setQuery] = useState({ const [query, setQuery] = useState({
current: 0, current: 0,
size: 10, size: 10,
name: "", nickName: "",
phone: "", phone: "",
identity: "ALL", roleId: [],
instId: "1837447" || window.currentUserInstInfo.instId, storeId: User.getStoreId(),
}); });
const [total, setTotal] = useState(0); const [total, setTotal] = useState(0);
const [model, setModel] = useState(null); const [model, setModel] = useState(null);
const [isModalOpen, setIsModalOpen] = useState(false); const [isModalOpen, setIsModalOpen] = useState(false);
const [isManager, setIsManager] = useState(true); const [isManager, setIsManager] = useState(true);
const [isNormal, setIsNormal] = useState(true); const [isNormal, setIsNormal] = useState(true);
const [choosedItem, setChooseItem] = useState({}); const [choosedItem, setChooseItem] = useState({});
const [roleIds, setRoleIds] = useState([]);
useEffect(() => { useEffect(() => {
getEmployeeList(); getEmployeeList();
getStoreRole();
}, [query]); }, [query]);
function getEmployeeList() { function getEmployeeList() {
...@@ -70,11 +74,19 @@ function EmployeesManagePage() { ...@@ -70,11 +74,19 @@ function EmployeesManagePage() {
}); });
} }
function getStoreRole() {
const storeId = User.getStoreId();
StoreService.getStoreRole({ storeId }).then((res: any) => {
setRoleIds(res.result);
});
}
function parseColumn() { function parseColumn() {
return [ return [
{ {
title: "员工", title: "员工",
dataIndex: "name", dataIndex: "nickName",
render: (val: string) => { render: (val: string) => {
return ( return (
<div className="coupon-info"> <div className="coupon-info">
...@@ -188,50 +200,34 @@ function EmployeesManagePage() { ...@@ -188,50 +200,34 @@ function EmployeesManagePage() {
onChange={(event) => { onChange={(event) => {
const val = event.target.value; const val = event.target.value;
const _query = { ...query }; const _query = { ...query };
_query.name = val; _query.nickName = val;
setQuery(_query); setQuery(_query);
}} }}
onSearch={() => getEmployeeList()} onSearch={() => getEmployeeList()}
/> />
{/* <Search placeholder="input search text" style={{ width: 200 }} /> */}
</div> </div>
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
身份: 身份:
<CheckBox {_.map(roleIds,((item:any) => {
text="普通讲师" return <CheckBox
text={item.name}
name={item.roleCode}
onChange={(e: any) => { onChange={(e: any) => {
const { checked } = e.target; // const { checked } = e.target;
setIsNormal(checked); // setIsNormal(checked);
const _query = { ...query }; // const _query = { ...query };
_query.identity = checked // if(checked){
? isManager // _query.roleId.push();
? "ALL" // } else {
: "NORMAL" // const index = _query.roleId.indexOf();
: isManager // _query.roleId.slice(index,1);
? "MANAGE" // }
: "NONE"; // setQuery(_query);
setQuery(_query);
}} }}
defaultChecked={isNormal} defaultChecked={isNormal}
/> />
<CheckBox }))}
text="管理员"
onChange={(e: any) => {
const { checked } = e.target;
setIsManager(checked);
const _query = { ...query };
_query.identity = checked
? isNormal
? "ALL"
: "MANAGE"
: isNormal
? "NORMAL"
: "NONE";
setQuery(_query);
}}
defaultChecked={isManager}
/>
</div> </div>
</div> </div>
<Button <Button
......
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