Commit e1a94760 by wufan

feat:修复员工和用户管理问题

parent db9068cd
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-11-27 16:21:49 * @Date: 2020-11-27 16:21:49
* @LastEditors: wufan * @LastEditors: wufan
* @LastEditTime: 2020-12-07 16:24:51 * @LastEditTime: 2020-12-08 10:38:21
* @Description: Description * @Description: Description
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -20,10 +20,8 @@ import { ...@@ -20,10 +20,8 @@ import {
} from "antd"; } from "antd";
import _, { values } from "underscore"; import _, { values } from "underscore";
import "./EmployeeAddOrEditModal.less"; import "./EmployeeAddOrEditModal.less";
import baseImg from "@/common/images/xiaomai-IMG.png";
import { CropperModal } from "@/components/"; import { CropperModal } from "@/components/";
import StoreService from "@/domains/store-domain/storeService"; import StoreService from "@/domains/store-domain/storeService";
import UpLoad from "../common/UpLoad";
import $ from "jquery"; import $ from "jquery";
import User from "@/common/js/user"; import User from "@/common/js/user";
...@@ -46,9 +44,9 @@ function AddEmployeeModal(props: AddEmployeeModalProps) { ...@@ -46,9 +44,9 @@ function AddEmployeeModal(props: AddEmployeeModalProps) {
const [nickName, setName] = useState(""); const [nickName, setName] = useState("");
const [phone, setPhone] = useState(""); const [phone, setPhone] = useState("");
const [role, setRole] = useState("CloudLecturer"); const [role, setRole] = useState("CloudLecturer");
const [avatar, setAvatar] = useState(baseImg); const [avatar, setAvatar] = useState("https://image.xiaomaiketang.com/xm/rJeQaZxtc7.png");
const storeUserId = props.choosedItem.storeUserId; const storeUserId = props.choosedItem.storeUserId;
const [imgUrl, setImgUrl] = useState(avatar); const [imgUrl, setImgUrl] = useState(avatar || 'https://image.xiaomaiketang.com/xm/rJeQaZxtc7.png');
const [nameErrorMsg, setNameErrorMsg] = useState(""); const [nameErrorMsg, setNameErrorMsg] = useState("");
const [nameStatus, setNameStatus] = useState< const [nameStatus, setNameStatus] = useState<
"" | "error" | "success" | "warning" | "validating" | undefined "" | "error" | "success" | "warning" | "validating" | undefined
...@@ -66,7 +64,7 @@ function AddEmployeeModal(props: AddEmployeeModalProps) { ...@@ -66,7 +64,7 @@ function AddEmployeeModal(props: AddEmployeeModalProps) {
setName(props.choosedItem.nickName); setName(props.choosedItem.nickName);
props.choosedItem.phone && setPhone(props.choosedItem.phone); props.choosedItem.phone && setPhone(props.choosedItem.phone);
props.choosedItem.role && setRole(props.choosedItem.role[0]); props.choosedItem.role && setRole(props.choosedItem.role[0]);
props.choosedItem.avatar && setAvatar(props.choosedItem.avatar || baseImg); props.choosedItem.avatar && setAvatar(props.choosedItem.avatar);
const _role = props.choosedItem.role[0] === "讲师" ? "CloudLecturer" : "CloudManager"; const _role = props.choosedItem.role[0] === "讲师" ? "CloudLecturer" : "CloudManager";
form.setFieldsValue({ form.setFieldsValue({
nickName: props.choosedItem.nickName, nickName: props.choosedItem.nickName,
......
...@@ -64,7 +64,7 @@ function EmployeesManagePage() { ...@@ -64,7 +64,7 @@ function EmployeesManagePage() {
size: 10, size: 10,
nickName: "", nickName: "",
phone: "", phone: "",
roleCodes: ["StoreManager"], roleCodes: [],
storeId: User.getStoreId(), storeId: User.getStoreId(),
}); });
...@@ -98,7 +98,6 @@ function EmployeesManagePage() { ...@@ -98,7 +98,6 @@ function EmployeesManagePage() {
async function getListInfo() { async function getListInfo() {
await getStoreRole(); await getStoreRole();
await getEmployeeList();
} }
function getEmployeeList() { function getEmployeeList() {
...@@ -119,14 +118,14 @@ function EmployeesManagePage() { ...@@ -119,14 +118,14 @@ function EmployeesManagePage() {
return _item.roleCode !== "StoreManager"; return _item.roleCode !== "StoreManager";
}); });
_data = _.map(_data, (item: any) => { // _data = _.map(_data, (item: any) => {
item.isChecked = true; // item.isChecked = true;
_query.roleCodes.push(item.roleCode); // _query.roleCodes.push(item.roleCode);
return item; // return item;
}); // });
setQuery(_query); // setQuery(_query);
setRoleIds(_data); setRoleIds(_data);
}); });
} }
...@@ -262,35 +261,21 @@ function EmployeesManagePage() { ...@@ -262,35 +261,21 @@ function EmployeesManagePage() {
marginRight: 40, marginRight: 40,
}} }}
placeholder="搜索员工姓名/手机号" placeholder="搜索员工姓名/手机号"
onChange={(event) => { onSearch={(value) => {
const val = event.target.value;
const _query = { ...query };
_query.nickName = val;
setQuery(_query);
}}
onSearch={() => getEmployeeList()}
/>
{/* <SearchBar
label="搜索用户"
placeholder="搜索用户姓名/手机号"
style={{
width: 300,
marginRight: 40,
}}
value={valueLike}
onSearch={(value: any) => {
const _query = { ...query }; const _query = { ...query };
if (valu const isPhone = (value || "").match(/^\d+$/); if (value) {
const nameLike = isPhone ? "phone" : "nickName"; const isPhone = (value || "").match(/^\d+$/);
setValueLike(value); const name = isPhone ? "phone" : "nickName";
_query[nameLike] = value; const otherName = isPhone ? "nickName" : "phone";
_query[name] = value;
_query[otherName] = '';
} else { } else {
_query.nickName = ""; _query.nickName = "";
_query.phone = ""; _query.phone = "";
} }
setQuery(_query); setQuery(_query);
}} }}
/> */} />
</div> </div>
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: wufan * @Author: wufan
* @Date: 2020-11-30 10:47:38 * @Date: 2020-11-30 10:47:38
* @LastEditors: wufan * @LastEditors: wufan
* @LastEditTime: 2020-12-03 11:37:42 * @LastEditTime: 2020-12-08 10:42:20
* @Description: 用户管理页面 * @Description: 用户管理页面
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -11,7 +11,7 @@ import React, { useEffect, useState } from "react"; ...@@ -11,7 +11,7 @@ import React, { useEffect, useState } from "react";
import { withRouter } from "react-router-dom"; import { withRouter } from "react-router-dom";
import _ from "underscore"; import _ from "underscore";
import { PageControl } from "@/components"; import { PageControl } from "@/components";
import { Table, Modal, message, Row, Col, Input, DatePicker } from "antd"; import { Table, Input, DatePicker } from "antd";
import StoreService from "@/domains/store-domain/storeService"; import StoreService from "@/domains/store-domain/storeService";
import User from "@/common/js/user"; import User from "@/common/js/user";
...@@ -34,13 +34,6 @@ function UserManagePage() { ...@@ -34,13 +34,6 @@ function UserManagePage() {
registerEnd: null, registerEnd: null,
}); });
const [total, setTotal] = useState(0); const [total, setTotal] = useState(0);
const [model, setModel] = useState(null);
const [isModalOpen, setIsModalOpen] = useState(false);
const [isManager, setIsManager] = useState(true);
const [isNormal, setIsNormal] = useState(true);
const [choosedItem, setChooseItem] = useState({});
const [nickName, setNickName] = useState("");
const [phone, setPhone] = useState("");
useEffect(() => { useEffect(() => {
getUserList(); getUserList();
...@@ -115,10 +108,6 @@ function UserManagePage() { ...@@ -115,10 +108,6 @@ function UserManagePage() {
marginRight: 40, marginRight: 40,
}} }}
placeholder="搜索用户姓名/手机号" placeholder="搜索用户姓名/手机号"
// onChange={(event) => {
// const val = event.target.value;
// }}
onSearch={(value) => { onSearch={(value) => {
const _query = { ...query }; const _query = { ...query };
if (value) { if (value) {
...@@ -158,9 +147,8 @@ function UserManagePage() { ...@@ -158,9 +147,8 @@ function UserManagePage() {
_query.registerBegin = dates ? dates[0].valueOf() : null; _query.registerBegin = dates ? dates[0].valueOf() : null;
_query.registerEnd = dates ? dates[1].valueOf() : null; _query.registerEnd = dates ? dates[1].valueOf() : null;
setQuery({ setQuery({
..._query, ..._query
current: 1, });
});
}} }}
/> />
</div> </div>
......
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