From d10f390ffff4fd182aae9af42d7f5f62e039216f Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 8 Sep 2023 12:32:21 +0800 Subject: [PATCH] org manage user page --- src/pages/ManageOrgUserPage/index.js | 56 ++++++++++++++++++---------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/src/pages/ManageOrgUserPage/index.js b/src/pages/ManageOrgUserPage/index.js index 51417b3..1af130b 100644 --- a/src/pages/ManageOrgUserPage/index.js +++ b/src/pages/ManageOrgUserPage/index.js @@ -1,16 +1,15 @@ // material-ui import { DataGrid, - GridActionsCellItem + //GridActionsCellItem } from "@mui/x-data-grid"; import { - Typography + Typography, Button }from '@mui/material'; import MainCard from "../../components/MainCard"; import * as React from "react"; -import * as Icon from '../../utils/IconUtils'; import * as HttpUtils from "../../utils/HttpUtils"; import * as UrlUtils from "../../utils/ApiPathConst"; import * as DateUtils from "../../utils/DateUtils"; @@ -29,7 +28,7 @@ const ManageOrgUserPage = () => { }, []); - const loadData = ()=>{ + function loadData(){ HttpUtils.get( { url: UrlUtils.GET_PUBLIC_ORG_USER_LIST, @@ -38,16 +37,45 @@ const ManageOrgUserPage = () => { } } ); - }; - - const onActiveClick=()=>{ + } + function onActiveClick(params){ + HttpUtils.get({ + url: UrlUtils.GET_USER_UNLOCK+"/"+params.row.id, + onSuccess:()=>{ + loadData(); + } + }); } - const getHeader=(headerStr)=>{ + function getHeader(headerStr){ return {headerStr}; } + function getStatus(params){ + if(params.row.locked){ + return ( + <> + {getStatusTag({color:"#525150", text: "鎖定"})} + + + ) + }else if(!params.row.verifiedBy){ + return getStatusTag({color:"#fca503", text: "待批核"}) + }else if(params.row.status == "active"){ + return getStatusTag({color:"#73AD21", text: "生效中"}) + } + return getStatusTag({text: params.row.status}) + } + + function getStatusTag({color="#000", textColor="#FFF",text=""}){ + return ( +
{text}
+ ) + } + + + const columns = [ { id: 'username', @@ -104,21 +132,11 @@ const ManageOrgUserPage = () => { flex: 1, cellClassName: 'actions', getActions: (params) => { - return [ - } - label="Download" - className="textPrimary" - onClick={onActiveClick(params)} - color="primary" - />] + return [getStatus(params)] }, } ]; - - return (