Commit ed277d69 authored by jiangzijing's avatar jiangzijing

feat:概览搜索+设置预算字段

parent aa9b7a11
...@@ -94,28 +94,56 @@ ...@@ -94,28 +94,56 @@
.noResult { .noResult {
position: absolute; position: absolute;
top:50%; top: 50%;
left:50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
font-size: 14px; font-size: 14px;
color: #8A9099; color: #8A9099;
} }
.resultBox{ .resultBox {
padding: 16px 24px 16px 42px; padding: 16px 24px 16px 42px;
width: 100%; width: 100%;
display: flex;
flex-wrap: wrap;
align-content: flex-start;
} }
.result{ .result {
box-sizing: border-box;
font-size: 12px; font-size: 12px;
color: #1E2633; color: #1E2633;
cursor: pointer; cursor: pointer;
height: 30px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
padding-right: 8px;
}
@media screen and (max-width:1220px) {
.result {
width: 100%;
}
}
@media screen and (min-width:1220px) and (max-width:1600px) {
.result {
width: 50%;
}
}
@media screen and (min-width:1600px) {
.result {
width: 33.33%;
}
} }
.result:hover{
.result:hover {
color: #1370FF; color: #1370FF;
} }
.outputLeftImg{ .outputLeftImg {
vertical-align:middle; vertical-align: middle;
margin-right: 8px; margin-right: 8px;
} }
\ No newline at end of file
import { useMemo, useCallback, useEffect, useState } from "react"; import { useMemo, useCallback, useEffect, useState } from "react";
import LinearProgress, { linearProgressClasses } from '@mui/material/LinearProgress'; import { useNavigate } from "react-router-dom";
import MyProgress from "@/components/mui/MyProgress"; import MyProgress from "@/components/mui/MyProgress";
import style from "./index.module.css"; import style from "./index.module.css";
...@@ -9,10 +9,6 @@ import jobSue from '../../../../assets/project/jobSue.svg' ...@@ -9,10 +9,6 @@ import jobSue from '../../../../assets/project/jobSue.svg'
import jobFail from '../../../../assets/project/jobFail.svg' import jobFail from '../../../../assets/project/jobFail.svg'
import jobRun from '../../../../assets/project/jobRun.svg' import jobRun from '../../../../assets/project/jobRun.svg'
import jobCadence from '../../../../assets/project/jobCadence.svg' import jobCadence from '../../../../assets/project/jobCadence.svg'
import jobStop from '../../../../assets/project/jobStop.svg'
import jobDel from '../../../../assets/project/jobDel.svg'
import noData from '../../../../assets/project/noTemplate.svg'
import onload from '../../../../assets/project/onload.svg'
import fileIcon from "@/assets/project/fileIcon.svg"; import fileIcon from "@/assets/project/fileIcon.svg";
import dataSetIcon from "@/assets/project/dataSetIcon.svg"; import dataSetIcon from "@/assets/project/dataSetIcon.svg";
...@@ -29,6 +25,7 @@ type TaskCardProps = { ...@@ -29,6 +25,7 @@ type TaskCardProps = {
const TaskCard = (props: TaskCardProps) => { const TaskCard = (props: TaskCardProps) => {
const { name, creator, state, completeNum, totalNum, costTime, jobCost, outputs } = props; const { name, creator, state, completeNum, totalNum, costTime, jobCost, outputs } = props;
const navigate = useNavigate();
const randerOutputs = useMemo(() => { const randerOutputs = useMemo(() => {
if (outputs) { if (outputs) {
let result = Object.keys(outputs); let result = Object.keys(outputs);
...@@ -48,7 +45,23 @@ const TaskCard = (props: TaskCardProps) => { ...@@ -48,7 +45,23 @@ const TaskCard = (props: TaskCardProps) => {
return []; return [];
} }
}, [outputs]) }, [outputs])
console.log(randerOutputs) // 结果跳转
const goToProjectData = (path: string) => {
const lastIndex = path.lastIndexOf("/");
if (lastIndex !== -1) {
path = path.slice(0, lastIndex + 1);
}
path = path.slice(12);
if (path) {
navigate(`/product/cadd/projectData`, {
state: { pathName: path },
});
} else {
navigate(`/product/cadd/projectData`, {
state: { pathName: "/" },
});
}
}
// 渲染状态图标 // 渲染状态图标
const renderStatusIcon = (data: string) => { const renderStatusIcon = (data: string) => {
switch (data) { switch (data) {
...@@ -139,14 +152,8 @@ const TaskCard = (props: TaskCardProps) => { ...@@ -139,14 +152,8 @@ const TaskCard = (props: TaskCardProps) => {
<div>Progress</div> <div>Progress</div>
<div style={{ color: renderTextColor(state) }}>{completeNum + "/" + totalNum}</div> <div style={{ color: renderTextColor(state) }}>{completeNum + "/" + totalNum}</div>
</div> </div>
{/* <MyProgress color={renderProgressColor(state)} value={(completeNum / totalNum) * 100}/> */} <MyProgress color={renderProgressColor(state)} value={(completeNum / totalNum) * 100}/>
<LinearProgress variant="determinate" value={(completeNum / totalNum) * 100} {/* <MyProgress color="info" value={80}/> */}
sx={{
borderRadius: '3px',
height: "6px",
backgroundColor: "#F0F2F5",
}}
/>
</div> </div>
<div className={style.bottomLine}> <div className={style.bottomLine}>
<img alt="" src={runTime} /> <img alt="" src={runTime} />
...@@ -162,7 +169,7 @@ const TaskCard = (props: TaskCardProps) => { ...@@ -162,7 +169,7 @@ const TaskCard = (props: TaskCardProps) => {
{randerOutputs.length === 0 ? <div className={style.noResult}>暂无结果文件</div> : {randerOutputs.length === 0 ? <div className={style.noResult}>暂无结果文件</div> :
<div className={style.resultBox}> <div className={style.resultBox}>
{randerOutputs.map((item, index) => { {randerOutputs.map((item, index) => {
return <div key={index} className={style.result}> return <div key={index} className={style.result} onClick={() => goToProjectData(item.path)}>
<img <img
className={style.outputLeftImg} className={style.outputLeftImg}
src={ src={
......
...@@ -79,10 +79,11 @@ ...@@ -79,10 +79,11 @@
.taskDisplay { .taskDisplay {
position: relative; position: relative;
margin: 20px 24px; margin: 20px 24px;
padding-bottom: 16px;
overflow: hidden; overflow: hidden;
background: #F7F8FA; background: #F7F8FA;
border-radius: 8px; border-radius: 8px;
min-height: calc(100vh - 275px); min-height: calc(100vh - 291px);
} }
.noDataBox{ .noDataBox{
......
import React, { useState, useCallback, useEffect, useMemo } from "react"; import React, { useState, useCallback, useEffect, useMemo } from "react";
import { observer } from "mobx-react-lite"; import { observer } from "mobx-react-lite";
import _ from "lodash";
import moment from "moment";
import useMyRequest from "@/hooks/useMyRequest"; import useMyRequest from "@/hooks/useMyRequest";
import { import {
...@@ -7,13 +9,13 @@ import { ...@@ -7,13 +9,13 @@ import {
getTaskOverview, getTaskOverview,
} from "@/api/project_api"; } from "@/api/project_api";
import { useStores } from "@/store/index"; import { useStores } from "@/store/index";
import { InputBase, IconButton } from "@mui/material"; import OutlinedInput from "@mui/material/OutlinedInput";
import SearchIcon from "@mui/icons-material/Search"; import SearchIcon from "@mui/icons-material/Search";
import NoProject from "@/components/BusinessComponents/NoProject"; import NoProject from "@/components/BusinessComponents/NoProject";
import projectImg from "@/assets/project/projectIconSmall.svg";
import RadioGroupOfButtonStyle from "@/components/CommonComponents/RadioGroupOfButtonStyle"; import RadioGroupOfButtonStyle from "@/components/CommonComponents/RadioGroupOfButtonStyle";
import TaskCard from './TaskCard' import TaskCard from './TaskCard'
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";
...@@ -56,21 +58,6 @@ const ProjectOverview = observer(() => { ...@@ -56,21 +58,6 @@ const ProjectOverview = observer(() => {
}); });
}, [currentProjectStore.currentProjectInfo.id, getTaskOverviewList, day, jobName]); }, [currentProjectStore.currentProjectInfo.id, getTaskOverviewList, day, jobName]);
// 搜索值改变
const handleJobNameChange = (e: any) => {
if (e.target.value.length > 30) {
return;
}
setJobName(e.target.value);
};
// 按回车搜索
const handleJobNameChangeKeyUp = (e: any) => {
if (e.keyCode === 13) {
}
};
if (currentProjectStore.currentProjectInfo.name) { if (currentProjectStore.currentProjectInfo.name) {
return ( return (
<> <>
...@@ -83,9 +70,9 @@ const ProjectOverview = observer(() => { ...@@ -83,9 +70,9 @@ const ProjectOverview = observer(() => {
</span> </span>
</div> </div>
<div className={style.otherInformation}> <div className={style.otherInformation}>
<div className={style.otherInformationBox}><span>角色:</span><span className={style.informationcolor}>管理员</span></div> <div className={style.otherInformationBox}><span>角色:</span><span className={style.informationcolor}>{overviewInfo.projectRoleExhibit}</span></div>
<div className={style.otherInformationBox}><span>计算区:</span><span className={style.informationcolor}>通用计算区</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}>2022-07-07</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}>
...@@ -118,27 +105,17 @@ const ProjectOverview = observer(() => { ...@@ -118,27 +105,17 @@ const ProjectOverview = observer(() => {
handleRadio={setDay} handleRadio={setDay}
></RadioGroupOfButtonStyle> ></RadioGroupOfButtonStyle>
</div> </div>
<div className={style.projectDataSearch}> <OutlinedInput
<InputBase onChange={(e: any) => {
placeholder="输入关键词搜索" _.debounce(() => {
inputProps={{ "aria-label": "输入关键词搜索" }} setJobName(e.target.value);
value={jobName} }, 1000)();
onChange={handleJobNameChange} }}
style={{ width: "280px", fontSize: "14px" }} placeholder="输入关键词搜索"
onKeyUp={handleJobNameChangeKeyUp} size="small"
/> sx={{ width: 340, height: 32, fontSize: "14px" }}
<IconButton endAdornment={<SearchIcon style={{ color: "#999" }} />}
type="submit" />
aria-label="search"
size="small"
style={{ padding: "4px" }}
// onClick={handleRefresh}
>
<SearchIcon
style={{ color: "#999" }}
/>
</IconButton>
</div>
</div> </div>
<div className={style.taskDisplay}> <div className={style.taskDisplay}>
{/* 任务列表为空展示 */} {/* 任务列表为空展示 */}
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
line-height: 22px; line-height: 22px;
height: 82px; height: 82px;
padding: 7px 12px; padding: 7px 12px;
resize: none;
} }
.projectInfoSelect { .projectInfoSelect {
width: 560px; width: 560px;
......
...@@ -33,6 +33,7 @@ import { ...@@ -33,6 +33,7 @@ import {
setFileServerEndPointLocalStorage, setFileServerEndPointLocalStorage,
getFiletokenAccordingToId, getFiletokenAccordingToId,
} from "@/views/Project/project"; } from "@/views/Project/project";
import MyInput from "@/components/mui/MyInput"
type zoneIdOption = { type zoneIdOption = {
id: string; id: string;
...@@ -48,6 +49,10 @@ const BaseInfo = observer(() => { ...@@ -48,6 +49,10 @@ const BaseInfo = observer(() => {
error: false, error: false,
help: "", help: "",
}); });
const [budgetCheck, setBudgetCheck] = useState({
error: false,
help: "",
});
const currentUserName = JSON.parse( const currentUserName = JSON.parse(
localStorage.getItem("userInfo") || "{}" localStorage.getItem("userInfo") || "{}"
).name; ).name;
...@@ -69,7 +74,7 @@ const BaseInfo = observer(() => { ...@@ -69,7 +74,7 @@ const BaseInfo = observer(() => {
}, [currentUserName, projectInfo]); }, [currentUserName, projectInfo]);
const { run, loading } = useMyRequest(getProject, { const { run, loading } = useMyRequest(getProject, {
onSuccess: (result: any) => { onSuccess: (result: any) => {
setProjectInfo(result.data); setProjectInfo({ ...result.data, projectBudget: result.data.projectBudget.toFixed(2) });
}, },
}); });
useEffect(() => { useEffect(() => {
...@@ -169,7 +174,6 @@ const BaseInfo = observer(() => { ...@@ -169,7 +174,6 @@ const BaseInfo = observer(() => {
name: e.target.value, name: e.target.value,
}); });
checkName(e.target.value); checkName(e.target.value);
// setNameCheck
}; };
const descChange = (e: any) => { const descChange = (e: any) => {
...@@ -180,10 +184,40 @@ const BaseInfo = observer(() => { ...@@ -180,10 +184,40 @@ const BaseInfo = observer(() => {
}; };
const budgetChange = (e: any) => { const budgetChange = (e: any) => {
// console.log(e.target.value) let inputValue = e.target.value.replace('.', '')
if (inputValue.indexOf('.') !== -1) {
setBudgetCheck({
error: true,
help: "格式错误,请输入正确的金额,可精确至分(两位小数)",
});
return
}
if (isNaN(Number(inputValue))) {
setBudgetCheck({
error: true,
help: "格式错误,请输入正确的金额,可精确至分(两位小数)",
});
return
} else {
setProjectInfo({
...projectInfo,
projectBudget: e.target.value
})
setBudgetCheck({
error: false,
help: "",
});
}
} }
const budgetBlur = (e: any) => { const budgetBlur = (e: any) => {
// console.log(e.target.value) setProjectInfo({
...projectInfo,
projectBudget: Number(e.target.value).toFixed(2)
})
setBudgetCheck({
error: false,
help: "",
});
} }
const { run: updateProjectRun, loading: updateLoading } = useMyRequest( const { run: updateProjectRun, loading: updateLoading } = useMyRequest(
...@@ -277,6 +311,9 @@ const BaseInfo = observer(() => { ...@@ -277,6 +311,9 @@ const BaseInfo = observer(() => {
size="small" size="small"
sx={{ sx={{
width: "560px", width: "560px",
'& .MuiOutlinedInput-root':{
height:'36px'
}
}} }}
/> />
{/* <input {/* <input
...@@ -333,16 +370,20 @@ const BaseInfo = observer(() => { ...@@ -333,16 +370,20 @@ const BaseInfo = observer(() => {
<div className={style.projectInfoListLiLabel}>项目预算</div> <div className={style.projectInfoListLiLabel}>项目预算</div>
<TextField <TextField
required required
// error={nameCheck.error} error={budgetCheck.error}
disabled={currentUserName !== projectInfo.tenantUser}
id="projectBudget" id="projectBudget"
variant="outlined" variant="outlined"
value={projectInfo.projectBudget} value={projectInfo.projectBudget}
onChange={budgetChange} onChange={budgetChange}
onBlur={budgetBlur} onBlur={budgetBlur}
// helperText={nameCheck.help} helperText={budgetCheck.help}
size="small" size="small"
sx={{ sx={{
width: "560px", width: "560px",
'& .MuiOutlinedInput-root':{
height:'36px'
}
}} }}
InputProps={{ InputProps={{
startAdornment: <InputAdornment position="start">¥</InputAdornment>, startAdornment: <InputAdornment position="start">¥</InputAdornment>,
......
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