Commit 9af2fac8 authored by chenshouchao's avatar chenshouchao

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

parents 754128e9 6d5033b9
...@@ -12,16 +12,20 @@ import AddIcon from "@mui/icons-material/Add"; ...@@ -12,16 +12,20 @@ import AddIcon from "@mui/icons-material/Add";
import AddProject from "@/views/Project/components/AddProject"; import AddProject from "@/views/Project/components/AddProject";
import React, { useState } from "react"; import React, { useState } from "react";
import MyButton from "@/components/mui/MyButton"; import MyButton from "@/components/mui/MyButton";
import { toJS } from "mobx";
import { observer } from "mobx-react-lite";
import { useStores } from "@/store/index";
const NoProject = () => { const NoProject = observer((props: any) => {
// 新建弹窗显示控制 // 新建弹窗显示控制
const [addOpen, setAddOpen] = useState(false); const [addOpen, setAddOpen] = useState(false);
const { currentProjectStore } = useStores();
let projectList = toJS(currentProjectStore.projectList)
return ( return (
<div className={style.noProject}> <div className={style.noProject}>
<img src={noData} alt="" className={style.noDataImg} /> <img src={noData} alt="" className={style.noDataImg} />
<div className={style.text1}>当前产品暂无项目</div> <div className={style.text1}>{projectList.length > 0 ? "当前未选中任何项目" : "当前产品暂无项目"}</div>
<div className={style.text2}>请先创建项目</div> <div className={style.text2}>{projectList.length > 0 ? "或创建新项目" : "请先创建项目"}</div>
<MyButton <MyButton
text='创建项目' text='创建项目'
variant="contained" variant="contained"
...@@ -30,11 +34,11 @@ const NoProject = () => { ...@@ -30,11 +34,11 @@ const NoProject = () => {
onClick={() => setAddOpen(true)} onClick={() => setAddOpen(true)}
style={{ backgroundColor: "#1370ff", color: "#fff" }} style={{ backgroundColor: "#1370ff", color: "#fff" }}
/> />
<AddProject addOpen={addOpen} setAddOpen={setAddOpen} /> <AddProject addOpen={addOpen} setAddOpen={setAddOpen} />
</div> </div>
); );
}; });
export default NoProject; export default NoProject;
...@@ -11,7 +11,8 @@ import Switch, { SwitchProps } from "@mui/material/Switch"; ...@@ -11,7 +11,8 @@ import Switch, { SwitchProps } from "@mui/material/Switch";
import { ThemeProvider, createTheme } from "@mui/material/styles"; import { ThemeProvider, createTheme } from "@mui/material/styles";
interface IMySwitchProps extends SwitchProps { interface IMySwitchProps extends SwitchProps {
value: boolean; value?: boolean;
defaultChecked?: boolean;
onChange?: any; onChange?: any;
disabled?: boolean; disabled?: boolean;
} }
...@@ -52,23 +53,24 @@ const theme = createTheme({ ...@@ -52,23 +53,24 @@ const theme = createTheme({
}); });
const MySwitch = (props: IMySwitchProps) => { const MySwitch = (props: IMySwitchProps) => {
const { value, onChange, disabled = false, size, ...other } = props; const { value, defaultChecked, onChange, disabled = false, size, ...other } = props;
return ( return (
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<Switch <Switch
checked={value} checked={value}
disabled={disabled} disabled={disabled}
defaultChecked={defaultChecked}
onChange={onChange} onChange={onChange}
sx={ sx={
size === "medium" size === "medium"
? { ? {
width: 44, width: 44,
height: 24, height: 24,
} }
: { : {
width: 40, width: 40,
height: 22, height: 22,
} }
} }
{...other} {...other}
/> />
......
...@@ -41,7 +41,9 @@ const MenuLayout = observer(() => { ...@@ -41,7 +41,9 @@ const MenuLayout = observer(() => {
return ( return (
<Box className={style.container}> <Box className={style.container}>
<Box className={style.aside}> <Box className={style.aside}>
<CurrentProject /> {
pathname.indexOf('userCenter') < 0 && <CurrentProject />
}
<List <List
sx={{ sx={{
paddingTop: 0, paddingTop: 0,
......
...@@ -60,7 +60,9 @@ const AddFolder = (props: IAddFolderProps) => { ...@@ -60,7 +60,9 @@ const AddFolder = (props: IAddFolderProps) => {
const handleFileNameChange = (e: any) => { const handleFileNameChange = (e: any) => {
const fileName = e.target.value; const fileName = e.target.value;
setFileName(fileName); if (fileName.length <= 30) {
setFileName(fileName);
}
if (!fileName) { if (!fileName) {
setFileNameCheck({ setFileNameCheck({
error: true, error: true,
...@@ -123,7 +125,7 @@ const AddFolder = (props: IAddFolderProps) => { ...@@ -123,7 +125,7 @@ const AddFolder = (props: IAddFolderProps) => {
helperText={fileNameCheck.help} helperText={fileNameCheck.help}
InputProps={{ InputProps={{
endAdornment: ( endAdornment: (
<InputAdornment position="end"> <InputAdornment position="end" style={{ color: fileName.length >= 30 ? "#d32f2f" : "#C2C6CC" }}>
{fileName.length}/30 {fileName.length}/30
</InputAdornment> </InputAdornment>
), ),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
position: relative; position: relative;
} }
.projectDataStickyTop { .projectDataStickyTop {
padding: 28px 24px; padding: 28px 24px 64px;
position: relative; position: relative;
} }
.projectDataTitle { .projectDataTitle {
...@@ -56,8 +56,9 @@ ...@@ -56,8 +56,9 @@
.projectDataStickyBox { .projectDataStickyBox {
height: 64px; height: 64px;
position: sticky; width: calc(100vw - 220px);
bottom: -1px; position: fixed;
bottom: 0px;
border: 1px solid #ebedf0; border: 1px solid #ebedf0;
z-index: 100; z-index: 100;
background-color: #fff; background-color: #fff;
......
...@@ -36,12 +36,17 @@ ...@@ -36,12 +36,17 @@
} }
.taskName { .taskName {
min-width: 100px;
font-size: 14px; font-size: 14px;
line-height: 22px; line-height: 22px;
font-weight: 500; font-weight: 500;
cursor: pointer; cursor: pointer;
} }
.taskName:hover{
color: #1370FF;
}
.taskStatus { .taskStatus {
display: flex; display: flex;
align-items: center; align-items: center;
......
...@@ -43,6 +43,7 @@ const ProjectOverview = observer(() => { ...@@ -43,6 +43,7 @@ const ProjectOverview = observer(() => {
setTaskList(result.data.content); setTaskList(result.data.content);
}, },
}); });
useEffect(() => { useEffect(() => {
if (currentProjectStore.currentProjectInfo.id) { if (currentProjectStore.currentProjectInfo.id) {
getOverview({ getOverview({
...@@ -69,6 +70,10 @@ const ProjectOverview = observer(() => { ...@@ -69,6 +70,10 @@ const ProjectOverview = observer(() => {
} }
} }
const handleKeyWordChangeBlur=(e:any)=>{
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' };
...@@ -142,6 +147,7 @@ const ProjectOverview = observer(() => { ...@@ -142,6 +147,7 @@ const ProjectOverview = observer(() => {
</div> </div>
<SearchInput <SearchInput
onKeyUp={handleKeyWordChangeKeyUp} onKeyUp={handleKeyWordChangeKeyUp}
onBlur={handleKeyWordChangeBlur}
sx={{ width: 340 }} sx={{ width: 340 }}
/> />
</div> </div>
......
...@@ -276,20 +276,20 @@ const BaseInfo = observer(() => { ...@@ -276,20 +276,20 @@ const BaseInfo = observer(() => {
const projectList = await getProjectList(); const projectList = await getProjectList();
currentProjectStore.setProjectList(projectList); currentProjectStore.setProjectList(projectList);
// 项目删完了 // 项目删完了
if (projectList.length === 0) { // if (projectList.length === 0) {
currentProjectStore.changeProject({}); currentProjectStore.changeProject({});
localStorage.setItem("fileServerEndPoint", ""); localStorage.setItem("fileServerEndPoint", "");
setProjectInfo({}); setProjectInfo({});
} else { // } else {
projectList[0].filetoken = getFiletokenAccordingToId(projectList[0].id); // projectList[0].filetoken = getFiletokenAccordingToId(projectList[0].id);
currentProjectStore.changeProject(projectList[0]); // currentProjectStore.changeProject(projectList[0]);
setFileServerEndPointLocalStorage(projectList[0].zoneId); // setFileServerEndPointLocalStorage(projectList[0].zoneId);
getFiletokenAccordingToId(projectList[0].id).then((res) => { // getFiletokenAccordingToId(projectList[0].id).then((res) => {
projectList[0].filetoken = res; // projectList[0].filetoken = res;
currentProjectStore.changeProject(projectList[0]); // currentProjectStore.changeProject(projectList[0]);
}); // });
setProjectInfo(projectList[0]); // setProjectInfo(projectList[0]);
} // }
}, },
}); });
...@@ -349,8 +349,8 @@ const BaseInfo = observer(() => { ...@@ -349,8 +349,8 @@ const BaseInfo = observer(() => {
[style.projectInfoTextarea]: true, [style.projectInfoTextarea]: true,
})} })}
onChange={descChange} onChange={descChange}
placeholder="项目描述限制100字以内" placeholder="项目描述限制300字以内"
maxLength={100} maxLength={300}
></textarea> ></textarea>
{/* <MyInput {/* <MyInput
value={projectInfo.desc} value={projectInfo.desc}
......
...@@ -100,7 +100,7 @@ const ConfigForm = (props: ConfigFormProps) => { ...@@ -100,7 +100,7 @@ const ConfigForm = (props: ConfigFormProps) => {
}; };
const checkName = (name: string = "") => { const checkName = (name: string = "") => {
const reg = new RegExp(/^[a-zA-Z0-9\u4e00-\u9fa5-_]{3,30}$/); const reg = new RegExp(/^[a-zA-Z0-9\u4e00-\u9fa5-_]{3,50}$/);
if (!name) { if (!name) {
setNameHelp({ setNameHelp({
error: true, error: true,
...@@ -117,7 +117,7 @@ const ConfigForm = (props: ConfigFormProps) => { ...@@ -117,7 +117,7 @@ const ConfigForm = (props: ConfigFormProps) => {
setNameHelp({ setNameHelp({
error: true, error: true,
helperText: helperText:
"请输入正确任务名称(3~30字符,可包含大小写字母、数字、中文、特殊符号“-”、“_”)", "请输入正确任务名称(3~50字符,可包含大小写字母、数字、中文、特殊符号“-”、“_”)",
}); });
return true; return true;
} }
......
...@@ -38,6 +38,7 @@ import { observer } from "mobx-react-lite"; ...@@ -38,6 +38,7 @@ import { observer } from "mobx-react-lite";
import usePass from "@/hooks/usePass"; import usePass from "@/hooks/usePass";
import MyProgress from "@/components/mui/MyProgress"; import MyProgress from "@/components/mui/MyProgress";
import SearchInput from "@/components/BusinessComponents/SearchInput"; import SearchInput from "@/components/BusinessComponents/SearchInput";
import MyCircularProgress from "@/components/mui/MyCircularProgress";
import moment from "moment"; import moment from "moment";
import styles from "./index.module.css"; import styles from "./index.module.css";
...@@ -68,6 +69,7 @@ const currencies = [ ...@@ -68,6 +69,7 @@ const currencies = [
let timer: string | number | NodeJS.Timeout | null | undefined = null; let timer: string | number | NodeJS.Timeout | null | undefined = null;
const ProjectMembers = observer(() => { const ProjectMembers = observer(() => {
const { currentProjectStore } = useStores(); const { currentProjectStore } = useStores();
const projectId = toJS(currentProjectStore.currentProjectInfo.id); const projectId = toJS(currentProjectStore.currentProjectInfo.id);
const isPass = usePass(); const isPass = usePass();
const [jobName, setJobName] = useState(""); const [jobName, setJobName] = useState("");
...@@ -77,6 +79,7 @@ const ProjectMembers = observer(() => { ...@@ -77,6 +79,7 @@ const ProjectMembers = observer(() => {
const [size, setSize] = useState(10); const [size, setSize] = useState(10);
const [rowsPerPage, setRowsPerPage] = useState(10); const [rowsPerPage, setRowsPerPage] = useState(10);
const [count, setCount] = useState(0); const [count, setCount] = useState(0);
const [loading,setLoading]=useState(false)
/** 简单弹窗 */ /** 简单弹窗 */
const [jobData, setJobData] = useState(""); const [jobData, setJobData] = useState("");
const [openDialog, setOpenDialog] = useState(false); const [openDialog, setOpenDialog] = useState(false);
...@@ -86,6 +89,7 @@ const ProjectMembers = observer(() => { ...@@ -86,6 +89,7 @@ const ProjectMembers = observer(() => {
onSuccess: (result: any) => { onSuccess: (result: any) => {
setJobList(result.data.content); setJobList(result.data.content);
setCount(result.data.totalElements); setCount(result.data.totalElements);
setLoading(false);
timer && clearTimeout(timer as number); timer && clearTimeout(timer as number);
timer = null; timer = null;
timer = setTimeout(() => { timer = setTimeout(() => {
...@@ -122,7 +126,7 @@ const ProjectMembers = observer(() => { ...@@ -122,7 +126,7 @@ const ProjectMembers = observer(() => {
}, },
}); });
// 删除作业 // 中止作业
const { run: cancelWorkflowJobInfo } = useMyRequest(cancelWorkflowJob, { const { run: cancelWorkflowJobInfo } = useMyRequest(cancelWorkflowJob, {
onSuccess: (result: any) => { onSuccess: (result: any) => {
setOpenDialog(false); setOpenDialog(false);
...@@ -347,13 +351,15 @@ const ProjectMembers = observer(() => { ...@@ -347,13 +351,15 @@ const ProjectMembers = observer(() => {
name: jobName, name: jobName,
state: currency === "ALL" ? "" : currency, state: currency === "ALL" ? "" : currency,
}); });
setLoading(true)
}} }}
> >
<img alt="" src={onload} /> <img alt="" src={onload} />
</Box> </Box>
</Box> </Box>
<Box className={styles.body}> <Box className={styles.body} style={{ position: "relative" }}>
<MyCircularProgress loading={loading} />
{jobList.length === 0 && ( {jobList.length === 0 && (
<Box <Box
sx={{ sx={{
...@@ -423,21 +429,22 @@ const ProjectMembers = observer(() => { ...@@ -423,21 +429,22 @@ const ProjectMembers = observer(() => {
{item.state === "RUNNING" && {item.state === "RUNNING" &&
isPass("PROJECT_WORKBENCH_JOBS_STOP", "USER") && ( isPass("PROJECT_WORKBENCH_JOBS_STOP", "USER") && (
<Box className={styles.tabBoxJobOperate}> <Box className={styles.tabBoxJobOperate}>
<img {
alt="" currentProjectStore.currentProjectInfo.projectRole === "USER" && (item.creator !== JSON.parse(localStorage.getItem("userInfo") || "{}")?.name) ? "" : <img
src={jobStop} alt=""
style={{ cursor: "pointer" }} src={jobStop}
onClick={(event) => { style={{ cursor: "pointer" }}
event.stopPropagation(); onClick={(event) => {
event.nativeEvent.stopImmediatePropagation(); event.stopPropagation();
setJobData(item.id); event.nativeEvent.stopImmediatePropagation();
setOpenDialog(true); setJobData(item.id);
setDialogType("stop"); setOpenDialog(true);
}} setDialogType("stop");
/> }}
/>
}
</Box> </Box>
)} )}
{item.state !== "RUNNING" && {item.state !== "RUNNING" &&
isPass("PROJECT_WORKBENCH_JOBS_DELETE", "MANAGER") && ( isPass("PROJECT_WORKBENCH_JOBS_DELETE", "MANAGER") && (
<Box className={styles.tabBoxJobOperate}> <Box className={styles.tabBoxJobOperate}>
......
...@@ -2,21 +2,36 @@ ...@@ -2,21 +2,36 @@
flex: 1; flex: 1;
background-color: #fff; background-color: #fff;
border-radius: 16px 0 0 0; border-radius: 16px 0 0 0;
padding: 24px 32px; padding-top: 24px;
box-sizing: border-box; box-sizing: border-box;
}
.headerBox {
padding: 0 32px;
}
.headerBoxShadow {
box-shadow: 0 5px 4px -4px rgb(0, 0, 0, .15);
}
.templateBox {
padding: 0 32px;
height: calc(100vh - 168px);
overflow: auto; overflow: auto;
} }
.templateList { .templateList {
/* height: 2000px; */ /* height: 2000px; */
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
} }
.templateLi { .templateLi {
height: 146px; height: 170px;
box-sizing: border-box; box-sizing: border-box;
padding: 16px 20px; padding: 16px 20px;
cursor: pointer; /* cursor: pointer; */
border: 1px solid rgba(235, 237, 240, 1); border: 1px solid rgba(235, 237, 240, 1);
border-radius: 4px; border-radius: 4px;
min-width: 20%; min-width: 20%;
...@@ -24,37 +39,45 @@ ...@@ -24,37 +39,45 @@
margin-right: 16px; margin-right: 16px;
margin-bottom: 16px; margin-bottom: 16px;
} }
.templateLiCustom { .templateLiCustom {
height: 194px; height: 170px;
} }
.templateLiHidden { .templateLiHidden {
visibility: hidden; visibility: hidden;
} }
.addCustomTemplate { .addCustomTemplate {
height: 194px; height: 170px;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
} }
.addCustomTemplateText { .addCustomTemplateText {
margin-top: 12px; margin-top: 12px;
line-height: 22px; line-height: 22px;
font-size: 14px; font-size: 14px;
color: rgba(138, 144, 153, 1); color: rgba(138, 144, 153, 1);
} }
.templateLi:hover { .templateLi:hover {
box-shadow: 6px 8px 22px 0px rgba(0, 24, 57, 0.08); box-shadow: 6px 8px 22px 0px rgba(0, 24, 57, 0.08);
} }
.templateLi:nth-child(4n) { .templateLi:nth-child(4n) {
margin-right: 0; margin-right: 0;
} }
.templateLiTop { .templateLiTop {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
} }
.templateTitle { .templateTitle {
font-size: 14px; font-size: 14px;
font-weight: 600; font-weight: 600;
...@@ -64,14 +87,17 @@ ...@@ -64,14 +87,17 @@
text-overflow: ellipsis; text-overflow: ellipsis;
line-height: 22px; line-height: 22px;
} }
.templateLiInfo { .templateLiInfo {
margin-bottom: 8px; margin-bottom: 8px;
} }
.templateLiInfoText { .templateLiInfoText {
line-height: 20px; line-height: 20px;
font-size: 12px; font-size: 12px;
color: rgba(19, 112, 255, 1); color: rgba(19, 112, 255, 1);
} }
.templateLiDesc { .templateLiDesc {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
...@@ -82,8 +108,9 @@ ...@@ -82,8 +108,9 @@
font-size: 12px; font-size: 12px;
color: rgba(138, 144, 153, 1); color: rgba(138, 144, 153, 1);
} }
.templateLiEditBox { .templateLiEditBox {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
margin-top: 16px; /* margin-top: 16px; */
} }
...@@ -6,6 +6,7 @@ import RadioGroupOfButtonStyle from "@/components/CommonComponents/RadioGroupOfB ...@@ -6,6 +6,7 @@ import RadioGroupOfButtonStyle from "@/components/CommonComponents/RadioGroupOfB
import SearchIcon from "@mui/icons-material/Search"; import SearchIcon from "@mui/icons-material/Search";
import MyButton from "@/components/mui/MyButton"; import MyButton from "@/components/mui/MyButton";
import OutlinedInput from "@mui/material/OutlinedInput"; import OutlinedInput from "@mui/material/OutlinedInput";
import MySwitch from "@/components/mui/MySwitch";
import FullScreenDrawer from "@/components/CommonComponents/FullScreenDrawer"; import FullScreenDrawer from "@/components/CommonComponents/FullScreenDrawer";
import Checkbox from "@mui/material/Checkbox"; import Checkbox from "@mui/material/Checkbox";
import useMyRequest from "@/hooks/useMyRequest"; import useMyRequest from "@/hooks/useMyRequest";
...@@ -17,6 +18,7 @@ import { useMessage } from "@/components/MySnackbar"; ...@@ -17,6 +18,7 @@ import { useMessage } from "@/components/MySnackbar";
import { import {
getAddWorkbenchTemplate, getAddWorkbenchTemplate,
addWorkbenchTemplate, addWorkbenchTemplate,
deleteWorkbenchTemplate,
} from "@/api/workbench_api"; } from "@/api/workbench_api";
type IAddTemplateProps = { type IAddTemplateProps = {
...@@ -50,6 +52,18 @@ const AddTemplate = (props: IAddTemplateProps) => { ...@@ -50,6 +52,18 @@ const AddTemplate = (props: IAddTemplateProps) => {
const [templateType, setTemplateType] = useState("public"); const [templateType, setTemplateType] = useState("public");
// 滚轮是否到顶,判断是否显示阴影
const [isTop, setIsTop] = useState(true)
// 滚动滚轮时监听是否到顶
const onscroll = (e: any) => {
if (e.target.scrollTop <= 0) {
setIsTop(true)
} else {
setIsTop(false)
}
}
const handleRadio = (value: string) => { const handleRadio = (value: string) => {
setTemplateType(value); setTemplateType(value);
}; };
...@@ -68,25 +82,36 @@ const AddTemplate = (props: IAddTemplateProps) => { ...@@ -68,25 +82,36 @@ const AddTemplate = (props: IAddTemplateProps) => {
// 项目管理员-添加工作流模板-提交 // 项目管理员-添加工作流模板-提交
const { run: addTemplate } = useMyRequest(addWorkbenchTemplate, { const { run: addTemplate } = useMyRequest(addWorkbenchTemplate, {
onSuccess: (result: any) => { onSuccess: (result: any) => {
Message.success("添加成功"); // Message.success("添加成功");
setSelectTemplateData([]); // setSelectTemplateData([]);
setShowAddTemplate(); // setShowAddTemplate();
getTemplateInfo({ // getTemplateInfo({
projectId: projectId as string, // projectId: projectId as string,
}); // });
}, },
}); });
const handleAddTemplate = () => { // 删除模板
if (selectTemplateData.length === 0) { const { run: delTemplate } = useMyRequest(deleteWorkbenchTemplate, {
Message.error("请选择要添加的模板"); onSuccess: (result: any) => {
} else { // setOpenDialog(false);
addTemplate({ // getTemplateInfo({
projectId: projectId as string, // projectId: currentProjectStore.currentProjectInfo.id as string,
workflowSpecIds: selectTemplateData, // title: templateName,
}); // });
} },
}; });
// const handleAddTemplate = () => {
// if (selectTemplateData.length === 0) {
// Message.error("请选择要添加的模板");
// } else {
// addTemplate({
// projectId: projectId as string,
// workflowSpecIds: selectTemplateData,
// });
// }
// };
// 添加工作流模板-获取模板列表 // 添加工作流模板-获取模板列表
const { run: getAddTemplateList } = useMyRequest(getAddWorkbenchTemplate, { const { run: getAddTemplateList } = useMyRequest(getAddWorkbenchTemplate, {
...@@ -147,6 +172,23 @@ const AddTemplate = (props: IAddTemplateProps) => { ...@@ -147,6 +172,23 @@ const AddTemplate = (props: IAddTemplateProps) => {
title, title,
]); ]);
//模板启用切换
const templateSwitch = (e: any, id: string) => {
if (e.target.checked) {
let arr = []
arr.push(id)
addTemplate({
projectId: projectId as string,
workflowSpecIds: arr,
});
} else {
delTemplate({
projectId: projectId as string,
workflowSpecId: id,
});
}
}
useEffect(() => { useEffect(() => {
getAddTemplateListFun(); getAddTemplateListFun();
}, [getAddTemplateListFun]); }, [getAddTemplateListFun]);
...@@ -164,42 +206,49 @@ const AddTemplate = (props: IAddTemplateProps) => { ...@@ -164,42 +206,49 @@ const AddTemplate = (props: IAddTemplateProps) => {
return ( return (
<FullScreenDrawer handleClose={setShowAddTemplate}> <FullScreenDrawer handleClose={setShowAddTemplate}>
<div className={style.content}> <div className={style.content}>
<Typography <div
sx={{ fontSize: "18px", fontWeight: "600", color: "#1E2633" }} className={classNames({
> [style.headerBox]: true,
添加工作流模版 [style.headerBoxShadow]: !isTop,
</Typography> })}
<Box
sx={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
marginBottom: "20px",
}}
> >
<OutlinedInput <Typography
value={title} sx={{ fontSize: "18px", fontWeight: "600", color: "#1E2633" }}
onChange={(e: any) => { >
setTitle(e.target.value); 添加工作流模版
}} </Typography>
placeholder="输入关键词搜索"
size="small"
sx={{ width: 340, height: 32, marginTop: "20px" }}
endAdornment={<SearchIcon style={{ color: "#8A9099" }} />}
/>
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
justifyContent: "flex-end", justifyContent: "space-between",
alignItems: "center", alignItems: "center",
paddingBottom: "20px",
paddingTop: "20px",
}} }}
> >
<RadioGroupOfButtonStyle <OutlinedInput
value={templateType} value={title}
radioOptions={radioOptions} onChange={(e: any) => {
handleRadio={handleRadio} setTitle(e.target.value);
></RadioGroupOfButtonStyle> }}
<MyButton placeholder="输入关键词搜索"
size="small"
sx={{ width: 340, height: 32 }}
endAdornment={<SearchIcon style={{ color: "#8A9099" }} />}
/>
<Box
sx={{
display: "flex",
justifyContent: "flex-end",
alignItems: "center",
}}
>
<RadioGroupOfButtonStyle
value={templateType}
radioOptions={radioOptions}
handleRadio={handleRadio}
></RadioGroupOfButtonStyle>
{/* <MyButton
onClick={handleAddTemplate} onClick={handleAddTemplate}
size={"small"} size={"small"}
style={{ style={{
...@@ -211,76 +260,87 @@ const AddTemplate = (props: IAddTemplateProps) => { ...@@ -211,76 +260,87 @@ const AddTemplate = (props: IAddTemplateProps) => {
? "" ? ""
: `(${selectTemplateData.length})`) : `(${selectTemplateData.length})`)
} }
/> /> */}
</Box> </Box>
</Box>
{templateType === "public" && addTemplateList.length === 0 && (
<Box
sx={{
display: "flex",
alignItems: "center",
flexDirection: "column",
minHeight: "calc(100vh - 376px)",
justifyContent: "center",
}}
>
<img alt="" src={noData} />
<Typography
sx={{ fontSize: "12px", fontWeight: "400", color: "#8A9099" }}
>
暂无相关模版
</Typography>
</Box> </Box>
)} </div>
<div className={style.templateList}> <div className={style.templateBox} onScroll={onscroll} >
{templateType !== "public" && ( {templateType === "public" && addTemplateList.length === 0 && (
<div <Box
className={classNames({ sx={{
[style.templateLi]: true, display: "flex",
[style.addCustomTemplate]: true, alignItems: "center",
})} flexDirection: "column",
onClick={handleAddCustomTemplate} minHeight: "calc(100vh - 376px)",
justifyContent: "center",
}}
> >
<AddIcon /> <img alt="" src={noData} />
<span className={style.addCustomTemplateText}> <Typography
创建自定义模板 sx={{ fontSize: "12px", fontWeight: "400", color: "#8A9099" }}
</span> >
</div> 暂无相关模版
</Typography>
</Box>
)} )}
{addTemplateList.map((item: any, index) => { <div className={style.templateList}>
return ( {templateType !== "public" && (
<div <div
className={classNames({ className={classNames({
[style.templateLi]: true, [style.templateLi]: true,
[style.templateLiCustom]: templateType !== "public", [style.addCustomTemplate]: true,
})} })}
key={index} onClick={handleAddCustomTemplate}
onClick={() => {
handleSelectTemplate(item.id);
}}
> >
<div className={style.templateLiTop}> <AddIcon />
<span className={style.templateTitle}>{item.title}</span> <span className={style.addCustomTemplateText}>
<Checkbox 创建自定义模板
</span>
</div>
)}
{addTemplateList.map((item: any, index) => {
return (
<div
className={classNames({
[style.templateLi]: true,
[style.templateLiCustom]: templateType !== "public",
})}
key={index}
onClick={() => {
handleSelectTemplate(item.id);
}}
>
<div className={style.templateLiTop}>
<span className={style.templateTitle}>{item.title}</span>
{/* <Checkbox
size="small" size="small"
sx={{ padding: "0px" }} sx={{ padding: "0px" }}
checked={selectTemplateData.includes(item.id)} checked={selectTemplateData.includes(item.id)}
/> /> */}
</div> </div>
<div className={style.templateLiInfo}> <div className={style.templateLiInfo}>
<span <span
className={style.templateLiInfoText} className={style.templateLiInfoText}
style={{ marginRight: "24px" }} style={{ marginRight: "24px" }}
> >
版本:{item.version} 版本:{item.version}
</span> </span>
<span className={style.templateLiInfoText}> <span className={style.templateLiInfoText}>
更新时间:{item.updatedTime} 更新时间:{item.updatedTime}
</span> </span>
</div> </div>
<div className={style.templateLiDesc}>{item.description}</div> <div className={style.templateLiDesc}>{item.description}</div>
{templateType !== "public" && (
<div className={style.templateLiEditBox}> <div className={style.templateLiEditBox}>
<MySwitch
defaultChecked={item.favorited}
onChange={(e: any) =>
templateSwitch(e, item.id)
}
></MySwitch>
</div>
{/* {templateType !== "public" && (
<MyButton <MyButton
onClick={() => handleEditTemplate(item)} onClick={() => handleEditTemplate(item)}
size={"small"} size={"small"}
...@@ -291,23 +351,24 @@ const AddTemplate = (props: IAddTemplateProps) => { ...@@ -291,23 +351,24 @@ const AddTemplate = (props: IAddTemplateProps) => {
text="编辑模板" text="编辑模板"
/> />
</div> </div>
)} )} */}
</div> </div>
);
})}
{hiddenBoxArr.length !== 4 &&
hiddenBoxArr.map((item, index) => {
return (
<div
key={`-${index}`}
className={classNames({
[style.templateLi]: true,
[style.templateLiHidden]: true,
})}
/>
); );
})} })}
{hiddenBoxArr.length !== 4 &&
hiddenBoxArr.map((item, index) => {
return (
<div
key={`-${index}`}
className={classNames({
[style.templateLi]: true,
[style.templateLiHidden]: true,
})}
/>
);
})}
</div>
</div> </div>
</div> </div>
{customTemplateInfo?.show ? ( {customTemplateInfo?.show ? (
......
...@@ -81,7 +81,7 @@ const TemplateBox = (props: any) => { ...@@ -81,7 +81,7 @@ const TemplateBox = (props: any) => {
</Typography> </Typography>
</Box> </Box>
<Typography className={styles.templateDescText}> <Typography className={styles.templateDescText}>
{info.description} {info.description ? info.description : "此模板暂无描述。"}
</Typography> </Typography>
</Box> </Box>
<Box <Box
......
...@@ -182,7 +182,15 @@ const ProjectMembers = observer(() => { ...@@ -182,7 +182,15 @@ const ProjectMembers = observer(() => {
{showAddTemplate && ( {showAddTemplate && (
<AddTemplate <AddTemplate
setShowAddTemplate={() => setShowAddTemplate(false)} setShowAddTemplate={
() => {
setShowAddTemplate(false)
getTemplateInfo({
projectId: projectIdData as string,
title: templateName,
});
}
}
getTemplateInfo={getTemplateInfo} getTemplateInfo={getTemplateInfo}
productId={productId as string} productId={productId as string}
projectId={projectIdData as string} projectId={projectIdData as string}
......
import { MenuItem } from "@mui/material"; import { MenuItem } from "@mui/material";
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import MyInput from "@/components/mui/MyInput"; import MyInput from "@/components/mui/MyInput";
import MyDialog from "@/components/mui/MyDialog"; import MyDialog from "@/components/mui/MyDialog";
...@@ -29,6 +30,7 @@ type IAddProjectProps = { ...@@ -29,6 +30,7 @@ type IAddProjectProps = {
const AddProject = (props: IAddProjectProps) => { const AddProject = (props: IAddProjectProps) => {
const { addOpen, setAddOpen } = props; const { addOpen, setAddOpen } = props;
const { currentProjectStore } = useStores(); const { currentProjectStore } = useStores();
const navigate = useNavigate();
const message = useMessage(); const message = useMessage();
const [name, setName] = useState(""); const [name, setName] = useState("");
const [nameCheck, setNameCheck] = useState({ const [nameCheck, setNameCheck] = useState({
...@@ -74,6 +76,7 @@ const AddProject = (props: IAddProjectProps) => { ...@@ -74,6 +76,7 @@ const AddProject = (props: IAddProjectProps) => {
project.filetoken = res; project.filetoken = res;
currentProjectStore.changeProject(project); currentProjectStore.changeProject(project);
}); });
navigate(`/product/cadd/projectOverview`)
} }
}, },
onError: () => { onError: () => {
...@@ -134,11 +137,11 @@ const AddProject = (props: IAddProjectProps) => { ...@@ -134,11 +137,11 @@ const AddProject = (props: IAddProjectProps) => {
const handleDescChange = (e: any) => { const handleDescChange = (e: any) => {
const desc = e.target.value; const desc = e.target.value;
setDesc(desc.slice(0,100)); setDesc(desc.slice(0,300));
// if (desc.length > 100) { // if (desc.length > 300) {
// setDescCheck({ // setDescCheck({
// error: true, // error: true,
// help: "格式不正确,必须在100字符以内", // help: "格式不正确,必须在300字符以内",
// }); // });
// } else { // } else {
// setDescCheck({ // setDescCheck({
...@@ -211,7 +214,7 @@ const AddProject = (props: IAddProjectProps) => { ...@@ -211,7 +214,7 @@ const AddProject = (props: IAddProjectProps) => {
id="desc" id="desc"
label="项目描述" label="项目描述"
multiline multiline
rows={5} rows={4}
placeholder="请输入项目描述" placeholder="请输入项目描述"
onChange={handleDescChange} onChange={handleDescChange}
helperText={descCheck.help} helperText={descCheck.help}
...@@ -221,10 +224,10 @@ const AddProject = (props: IAddProjectProps) => { ...@@ -221,10 +224,10 @@ const AddProject = (props: IAddProjectProps) => {
position: "absolute", position: "absolute",
bottom: "7px", bottom: "7px",
right: "12px", right: "12px",
color: "rgba(194, 198, 204, 1)", color: desc.length >= 300 ? "#d32f2f" : "#C2C6CC"
}} }}
> >
{desc.length}/100 {desc.length}/300
</span> </span>
</div> </div>
</div> </div>
......
...@@ -478,7 +478,7 @@ const ParameterSetting = (props: IParameterSettingProps) => { ...@@ -478,7 +478,7 @@ const ParameterSetting = (props: IParameterSettingProps) => {
onChange={(e: any) => onChange={(e: any) =>
handleParameterChange(e, parameter.name || "") handleParameterChange(e, parameter.name || "")
} }
placeholder="请输入" placeholder="可输入默认值"
error={parameter.error || false} error={parameter.error || false}
helperText={parameter.helperText} helperText={parameter.helperText}
disabled={parameter.parameterGroup === "out"} disabled={parameter.parameterGroup === "out"}
......
...@@ -240,14 +240,27 @@ const SaveCustomTemplate = (props: IProps) => { ...@@ -240,14 +240,27 @@ const SaveCustomTemplate = (props: IProps) => {
helperText={versionHelper.helperText} helperText={versionHelper.helperText}
style={{ marginBottom: "20px" }} style={{ marginBottom: "20px" }}
></MyInput> ></MyInput>
<MyInput <div style={{ position: "relative" }}>
value={description} <MyInput
label="模板描述" value={description}
placeholder="模板描述" id="desc"
onChange={handleDescriptionChange} label="模板描述"
multiline placeholder="模板描述"
rows={4} onChange={handleDescriptionChange}
></MyInput> multiline
rows={4}
/>
<span
style={{
position: "absolute",
bottom: "7px",
right: "12px",
color: description.length >= 300 ? "#d32f2f" : "#C2C6CC"
}}
>
{description.length}/300
</span>
</div>
</div> </div>
</MyDialog> </MyDialog>
); );
......
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