Commit a0bd3079 authored by jiangzijing's avatar jiangzijing

Merge branch 'feat-20220801' of http://120.77.149.83/root/bkunyun into feat-20220801

parents cba70674 ad039d33
...@@ -7,7 +7,7 @@ main::-webkit-scrollbar { ...@@ -7,7 +7,7 @@ main::-webkit-scrollbar {
div::-webkit-scrollbar-track, div::-webkit-scrollbar-track,
main::-webkit-scrollbar-track { main::-webkit-scrollbar-track {
background-color: #fff; background-color: transparent;
-webkit-border-radius: 3em; -webkit-border-radius: 3em;
-moz-border-radius: 3em; -moz-border-radius: 3em;
border-radius: 3em; border-radius: 3em;
......
...@@ -66,6 +66,7 @@ const MyInput = (props: MyInputProps) => { ...@@ -66,6 +66,7 @@ const MyInput = (props: MyInputProps) => {
styleOverrides: { styleOverrides: {
root: { root: {
top: "-9px", top: "-9px",
fontSize: "14px",
}, },
shrink: { shrink: {
top: 0, top: 0,
......
...@@ -9,6 +9,13 @@ const roleList: any[] = [ ...@@ -9,6 +9,13 @@ const roleList: any[] = [
{ OWNER: 4 } { OWNER: 4 }
] ]
export const roleMap = {
VIEWER: '查看者',
USER: '研究员',
MANAGER: '管理员',
OWNER: '所有者',
}
const usePass = () => { const usePass = () => {
const { permissionStore } = useStores(); const { permissionStore } = useStores();
const { currentProjectStore } = useStores(); const { currentProjectStore } = useStores();
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
z-index: 1002; z-index: 1002;
} }
.productLi { .productLi {
min-width: 142px;
height: 36px; height: 36px;
padding: 7px 50px 7px 16px; padding: 7px 50px 7px 16px;
font-size: 14px; font-size: 14px;
...@@ -109,16 +110,6 @@ ...@@ -109,16 +110,6 @@
color: #8a9099; color: #8a9099;
transform: rotate(180deg); transform: rotate(180deg);
} }
/* .ArrowDropDownIconRoot {
color: #8a9099;
transition: all 0.2s !important;
transform: rotate(0);
}
.ArrowDropDownIconRootOpen {
color: #8a9099;
transform: rotate(180deg);
} */
.menuPaper { .menuPaper {
border: 1px solid #f0f2f5; border: 1px solid #f0f2f5;
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
.taskProgress { .taskProgress {
height: 32px; height: 32px;
margin: 12px 0; margin: 12px 0 16px;
} }
.progressInfo { .progressInfo {
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
margin-right: 8px; margin-right: 8px;
} }
.outputTitle{ .outputTitle {
display: inline-block; display: inline-block;
height: 22px; height: 22px;
line-height: 22px; line-height: 22px;
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin: 0 24px; margin: 0 24px;
padding: 20px 0; padding: 24px 0 20px;
border-bottom: 1px solid #EDEFF2; border-bottom: 1px solid #edeff2;
} }
.basicInformationRight { .basicInformationRight {
...@@ -38,30 +38,30 @@ ...@@ -38,30 +38,30 @@
} }
.informationcolor { .informationcolor {
color: #8A9099; color: #8a9099;
} }
.otherInformationBox { .otherInformationBox {
margin-right: 24px; margin-right: 24px;
color: #565C66; color: #565c66;
} }
.otherInformationBoxRight { .otherInformationBoxRight {
line-height: 22px; line-height: 22px;
margin-bottom: 4px; margin-bottom: 4px;
color: #565C66; color: #565c66;
} }
.numberDisplay { .numberDisplay {
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
color: #1E2633; color: #1e2633;
margin-right: 8px; margin-right: 8px;
} }
.verticalLine { .verticalLine {
height: 32px; height: 32px;
border-right: 1px solid #EBEDF0; border-right: 1px solid #ebedf0;
margin-left: 28px; margin-left: 28px;
margin-right: 28px; margin-right: 28px;
} }
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
margin: 0 24px 20px; margin: 0 24px 20px;
padding-bottom: 16px; padding-bottom: 16px;
overflow: hidden; overflow: hidden;
background: #F7F8FA; background: #f7f8fa;
border-radius: 8px; border-radius: 8px;
min-height: calc(100vh - 291px); min-height: calc(100vh - 291px);
} }
......
import React, { useState, useCallback, useEffect, useMemo } from "react"; import React, { useState, useEffect } from "react";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import _ from "lodash"; import _ from "lodash";
import moment from "moment"; import moment from "moment";
import useMyRequest from "@/hooks/useMyRequest"; import useMyRequest from "@/hooks/useMyRequest";
import { import { getOverviewInfo, getTaskOverview } from "@/api/project_api";
getOverviewInfo,
getTaskOverview,
} from "@/api/project_api";
import { useStores } from "@/store/index"; import { useStores } from "@/store/index";
import NoProject from "@/components/BusinessComponents/NoProject"; import NoProject from "@/components/BusinessComponents/NoProject";
import RadioGroupOfButtonStyle from "@/components/CommonComponents/RadioGroupOfButtonStyle"; import RadioGroupOfButtonStyle from "@/components/CommonComponents/RadioGroupOfButtonStyle";
import Loading from "@/views/Loading"; import Loading from "@/views/Loading";
import SearchInput from "@/components/BusinessComponents/SearchInput"; import SearchInput from "@/components/BusinessComponents/SearchInput";
import TaskCard from './TaskCard' import TaskCard from "./TaskCard";
import projectImg from "@/assets/project/projectIconSmall.svg"; import projectImg from "@/assets/project/projectIconSmall.svg";
import noFile from "@/assets/project/noFile.svg"; import noFile from "@/assets/project/noFile.svg";
import style from "./index.module.css"; import style from "./index.module.css";
const ProjectOverview = observer(() => { const ProjectOverview = observer(() => {
const { currentProjectStore } = useStores(); const { currentProjectStore } = useStores();
// 概览基本信息 // 概览基本信息
const [overviewInfo, setOverviewInfo] = useState<any>({}); const [overviewInfo, setOverviewInfo] = useState<any>({});
// 任务概览列表 // 任务概览列表
const [taskList, setTaskList] = useState([]) const [taskList, setTaskList] = useState([]);
const [jobName, setJobName] = useState('') const [jobName, setJobName] = useState("");
const [page, setPage] = useState(0) const [page, setPage] = useState(0);
const [size, setSize] = useState(999) const [size, setSize] = useState(999);
// 选择近7天or近15天or近30天 // 选择近7天or近15天or近30天
const [day, setDay] = useState("7"); const [day, setDay] = useState("7");
// 获取概览基本信息 // 获取概览基本信息
...@@ -64,29 +60,34 @@ const ProjectOverview = observer(() => { ...@@ -64,29 +60,34 @@ const ProjectOverview = observer(() => {
size: size, size: size,
}); });
} }
}, [currentProjectStore.currentProjectInfo.id, getTaskOverviewList, day, jobName]); }, [
currentProjectStore.currentProjectInfo.id,
getTaskOverviewList,
day,
jobName,
]);
const handleKeyWordChangeKeyUp = (e: any) => { const handleKeyWordChangeKeyUp = (e: any) => {
if (e.keyCode === 13) { if (e.keyCode === 13) {
setJobName(e.target.value); setJobName(e.target.value);
} }
} };
const handleKeyWordChangeBlur = (e: any) => { const handleKeyWordChangeBlur = (e: any) => {
setJobName(e.target.value); setJobName(e.target.value);
} };
const storageUnitFromB = (b: number) => { const storageUnitFromB = (b: number) => {
if (b <= 0) { if (b <= 0) {
return { data: '0.00', unit: 'KB' }; return { data: "0.00", unit: "KB" };
} else if (b < 1024 * 1024) { } else if (b < 1024 * 1024) {
return { data: (b / 1024).toFixed(2), unit: 'KB' }; return { data: (b / 1024).toFixed(2), unit: "KB" };
} else if (b < 1024 * 1024 * 1024) { } else if (b < 1024 * 1024 * 1024) {
return { data: (b / (1024 * 1024)).toFixed(2), unit: 'MB' }; return { data: (b / (1024 * 1024)).toFixed(2), unit: "MB" };
} else if (b < 1024 * 1024 * 1024 * 1024) { } else if (b < 1024 * 1024 * 1024 * 1024) {
return { data: (b / (1024 * 1024 * 1024)).toFixed(2), unit: 'G' }; return { data: (b / (1024 * 1024 * 1024)).toFixed(2), unit: "G" };
} else { } else {
return { data: (b / (1024 * 1024 * 1024 * 1024)).toFixed(2), unit: 'T' }; return { data: (b / (1024 * 1024 * 1024 * 1024)).toFixed(2), unit: "T" };
} }
}; };
...@@ -104,33 +105,77 @@ const ProjectOverview = observer(() => { ...@@ -104,33 +105,77 @@ const ProjectOverview = observer(() => {
<div className={style.basicInformation}> <div className={style.basicInformation}>
<div> <div>
<div className={style.titleBox}> <div className={style.titleBox}>
<img src={projectImg} alt="项目logo" style={{ width: 30, height: 30 }} /> <img
src={projectImg}
alt="项目logo"
style={{ width: 30, height: 30 }}
/>
<span className={style.projectName}> <span className={style.projectName}>
{currentProjectStore.currentProjectInfo.name} {currentProjectStore.currentProjectInfo.name}
</span> </span>
</div> </div>
<div className={style.otherInformation}> <div className={style.otherInformation}>
<div className={style.otherInformationBox}><span>角色:</span><span className={style.informationcolor}>{overviewInfo.projectRoleExhibit}</span></div> <div className={style.otherInformationBox}>
<div className={style.otherInformationBox}><span>计算区:</span><span className={style.informationcolor}>{overviewInfo.zoneIdExhibit}</span></div> <span>角色:</span>
<div className={style.otherInformationBox}><span>创建日期:</span><span className={style.informationcolor}>{moment(overviewInfo.createdAt).format('yyyy-MM-DD')}</span></div> <span className={style.informationcolor}>
{overviewInfo.projectRoleExhibit}
</span>
</div>
<div className={style.otherInformationBox}>
<span>计算区:</span>
<span className={style.informationcolor}>
{overviewInfo.zoneIdExhibit}
</span>
</div>
<div className={style.otherInformationBox}>
<span>创建日期:</span>
<span className={style.informationcolor}>
{moment(overviewInfo.createdAt).format("yyyy-MM-DD")}
</span>
</div>
</div> </div>
</div> </div>
<div className={style.basicInformationRight}> <div className={style.basicInformationRight}>
<div> <div>
<div className={style.otherInformationBoxRight}>项目总消费</div> <div className={style.otherInformationBoxRight}>
<div><span className={style.numberDisplay}>{overviewInfo.projectCost?.toFixed(2)}</span></div> 项目总消费
</div>
<div>
<span className={style.numberDisplay}>
{overviewInfo.projectCost?.toFixed(2)}
</span>
</div>
</div> </div>
<div className={style.verticalLine}></div> <div className={style.verticalLine}></div>
<div> <div>
<div className={style.otherInformationBoxRight}>项目剩余预算</div> <div className={style.otherInformationBoxRight}>
<div><span className={style.numberDisplay}>{overviewInfo.projectRemainingBudget?.toFixed(2)}</span></div> 项目剩余预算
</div>
<div>
<span className={style.numberDisplay}>
{overviewInfo.projectRemainingBudget?.toFixed(2)}
</span>
</div>
</div> </div>
<div className={style.verticalLine}></div> <div className={style.verticalLine}></div>
<div> <div>
<div className={style.otherInformationBoxRight} style={{ marginRight: '20px' }}>项目存储大小</div> <div
className={style.otherInformationBoxRight}
style={{ marginRight: "20px" }}
>
项目存储大小
</div>
<div> <div>
<span className={style.numberDisplay}>{overviewInfo.projectStorage !== undefined ? storageUnitFromB(overviewInfo.projectStorage).data : ''}</span> <span className={style.numberDisplay}>
{overviewInfo.projectStorage !== undefined ? storageUnitFromB(overviewInfo.projectStorage).unit : ''} {overviewInfo.projectStorage !== undefined
? storageUnitFromB(overviewInfo.projectStorage).data
: ""}
</span>
{overviewInfo.projectStorage !== undefined
? storageUnitFromB(overviewInfo.projectStorage).unit
: ""}
</div> </div>
</div> </div>
</div> </div>
...@@ -164,8 +209,10 @@ const ProjectOverview = observer(() => { ...@@ -164,8 +209,10 @@ const ProjectOverview = observer(() => {
</div> </div>
)} )}
{/* 任务列表卡片渲染 */} {/* 任务列表卡片渲染 */}
{taskList.length > 0 && taskList.map((item: any) => { {taskList.length > 0 &&
return <TaskCard taskList.map((item: any) => {
return (
<TaskCard
id={item.id} id={item.id}
name={item.name} name={item.name}
creator={item.creator} creator={item.creator}
...@@ -177,14 +224,14 @@ const ProjectOverview = observer(() => { ...@@ -177,14 +224,14 @@ const ProjectOverview = observer(() => {
outputs={item.outputs} outputs={item.outputs}
key={item.id} key={item.id}
/> />
);
})} })}
</div> </div>
</> </>
); );
} }
} else { } else {
return <NoProject />; return <NoProject />;
} }
}) });
export default ProjectOverview export default ProjectOverview;
\ No newline at end of file
...@@ -2,14 +2,6 @@ ...@@ -2,14 +2,6 @@
width: calc(100vw - 220px); width: calc(100vw - 220px);
height: calc(100vh - 57px); height: calc(100vh - 57px);
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
/* width: 260px;
height: calc(100vh - 57px); */
/* width: 260px;
height: calc(100vh - 57px);
background-color: #fff;
border-right: 1px solid #ebedf0;
display: flex;
flex-direction: column; */
} }
.mainBox { .mainBox {
...@@ -25,10 +17,11 @@ ...@@ -25,10 +17,11 @@
.searchBox { .searchBox {
box-sizing: border-box; box-sizing: border-box;
height: 56px; height: 56px;
padding: 17px; padding: 12px 8px 12px 24px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
align-items: center;
} }
.searchButton { .searchButton {
width: 22px; width: 22px;
...@@ -48,8 +41,11 @@ ...@@ -48,8 +41,11 @@
} }
.add { .add {
padding: 0 15px; padding: 0 15px;
width: 22px; width: 32px;
height: 22px; height: 32px;
}
.add:hover {
border-radius: 4px;
} }
.addIcon { .addIcon {
color: #1e2633; color: #1e2633;
...@@ -96,13 +92,14 @@ ...@@ -96,13 +92,14 @@
overflow: hidden; overflow: hidden;
} }
.projectOwnerTime { .projectOwnerTime {
font-size: 12px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
} }
.projectOwner { .projectOwner {
font-size: 12px;
color: #565c66; color: #565c66;
line-height: 20px; line-height: 20px;
font-size: 14px;
margin-right: 32px; margin-right: 32px;
max-width: 60px; max-width: 60px;
white-space: nowrap; white-space: nowrap;
...@@ -113,5 +110,5 @@ ...@@ -113,5 +110,5 @@
.projectTime { .projectTime {
color: #8a9099; color: #8a9099;
line-height: 20px; line-height: 20px;
font-size: 14px; font-size: 12px;
} }
...@@ -15,7 +15,7 @@ import classNames from "classnames"; ...@@ -15,7 +15,7 @@ import classNames from "classnames";
import { useStores } from "@/store/index"; import { useStores } from "@/store/index";
import moment from "moment"; import moment from "moment";
import React, { useMemo, useState } from "react"; import React, { useMemo, useState } from "react";
import { useClickAway } from 'ahooks'; import { useClickAway } from "ahooks";
import { toJS } from "mobx"; import { toJS } from "mobx";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
...@@ -31,11 +31,33 @@ const ProjectListPopper = observer((props: any) => { ...@@ -31,11 +31,33 @@ const ProjectListPopper = observer((props: any) => {
setName(e.target.value); setName(e.target.value);
}; };
const getPower = (projectRole: string) => {
if (projectRole === "VIEWER") {
return "查看者";
} else if (projectRole === "USER") {
return "研究员";
} else if (projectRole === "MANAGER") {
return "管理员";
} else if (projectRole === "OWNER") {
return "所有者";
} else {
return "";
}
};
const list = useMemo(() => { const list = useMemo(() => {
return projectList.filter((item: any) => { return projectList
.filter((item: any) => {
return item.name?.indexOf(name) !== -1; return item.name?.indexOf(name) !== -1;
})
.map((item) => {
return {
...item,
power: getPower(item.projectRole || ""),
};
}); });
}, [projectList, name]); }, [projectList, name]);
console.log(list);
const handleProjectBox = (e: React.SyntheticEvent) => { const handleProjectBox = (e: React.SyntheticEvent) => {
setProjectListOpen(false); setProjectListOpen(false);
...@@ -45,12 +67,16 @@ const ProjectListPopper = observer((props: any) => { ...@@ -45,12 +67,16 @@ const ProjectListPopper = observer((props: any) => {
() => { () => {
setProjectListOpen(false); setProjectListOpen(false);
}, },
() => document.getElementById('use-click-projectList-mainBox'), () => document.getElementById("use-click-projectList-mainBox")
); );
return ( return (
<div className={style.projectBox} onClick={handleProjectBox}> <div className={style.projectBox} onClick={handleProjectBox}>
<div className={style.mainBox} id="use-click-projectList-mainBox" onClick={(e: any)=>e.stopPropagation()}> <div
className={style.mainBox}
id="use-click-projectList-mainBox"
onClick={(e: any) => e.stopPropagation()}
>
<div className={style.searchBox}> <div className={style.searchBox}>
<IconButton <IconButton
type="submit" type="submit"
...@@ -59,7 +85,7 @@ const ProjectListPopper = observer((props: any) => { ...@@ -59,7 +85,7 @@ const ProjectListPopper = observer((props: any) => {
> >
<SearchIcon <SearchIcon
className={style.searchIcon} className={style.searchIcon}
style={{ color: "rgba(153, 153, 153, 1)" }} style={{ color: "#8A9099", fontSize: "22px" }}
/> />
</IconButton> </IconButton>
<InputBase <InputBase
...@@ -68,6 +94,11 @@ const ProjectListPopper = observer((props: any) => { ...@@ -68,6 +94,11 @@ const ProjectListPopper = observer((props: any) => {
inputProps={{ "aria-label": "请输入项目名称" }} inputProps={{ "aria-label": "请输入项目名称" }}
value={name} value={name}
onChange={nameChange} onChange={nameChange}
sx={{
fontSize: "14px",
// color: "rgba(194, 198, 204, 1)",
height: "22px",
}}
/> />
<IconButton <IconButton
onClick={handleClickOpen} onClick={handleClickOpen}
...@@ -95,7 +126,7 @@ const ProjectListPopper = observer((props: any) => { ...@@ -95,7 +126,7 @@ const ProjectListPopper = observer((props: any) => {
<div className={style.projectName}>{item.name}</div> <div className={style.projectName}>{item.name}</div>
<div className={style.projectOwnerTime}> <div className={style.projectOwnerTime}>
<span className={style.projectOwner} title={item.owner}> <span className={style.projectOwner} title={item.owner}>
{item.owner} {item.power}
</span> </span>
<span className={style.projectTime}> <span className={style.projectTime}>
{moment(item.createdAt).format("YYYY-MM-DD")} {moment(item.createdAt).format("YYYY-MM-DD")}
......
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