4.10 收藏需求
This commit is contained in:
@ -5,7 +5,7 @@ import Tabs from '@material-ui/core/Tabs';
|
||||
import { PageHeader, Button, message, Steps, Space, Card, Dropdown, Menu } from 'antd';
|
||||
import { Link, history } from 'umi';
|
||||
import './index.less';
|
||||
import { menuList } from './service/service';
|
||||
import { getReadInfo, menuList, updateReadStatus } from './service/service';
|
||||
import { getProName, getSessionRoleData, getProTypeCode, getDefId, getPurchaseCanOperate, getReturnURL, getProId, getProMethod } from '@/utils/session';
|
||||
import { Step, StepButton, StepLabel, Stepper, Toolbar, Popover, Typography } from '@material-ui/core';
|
||||
import { isEmpty } from '@/utils/CommonUtils';
|
||||
@ -35,7 +35,7 @@ function getUrlRelativePath() {
|
||||
|
||||
const Promenu: React.FC<{}> = () => {
|
||||
//获取采购方式
|
||||
const MethodDict = getProMethod();
|
||||
const MethodDict = getProMethod();
|
||||
const classes = useStyles();
|
||||
//流程数据
|
||||
const [data, setData] = React.useState<any>([]);
|
||||
@ -51,6 +51,12 @@ const Promenu: React.FC<{}> = () => {
|
||||
const defId = getDefId();
|
||||
//项目名称
|
||||
const [proName, setProName] = useState<string>("");
|
||||
//收藏状态 0-已收藏 d-未收藏
|
||||
const [subStatus, setSubStatus] = useState<string | null>(null);
|
||||
//收藏数据
|
||||
const [subData, setSubData] = useState<any>();
|
||||
//收藏loading
|
||||
const [subLoading, setSubLoading] = useState<boolean>(false);
|
||||
|
||||
const [anchorEl, setAnchorEl] = React.useState<HTMLElement | null>(null);
|
||||
|
||||
@ -68,6 +74,17 @@ const Promenu: React.FC<{}> = () => {
|
||||
setButtonValue(stepButtonClick(findURL(data)));
|
||||
}
|
||||
})
|
||||
getReadInfo({ projectId: projectId }).then(res => {
|
||||
if (res?.code == 200) {
|
||||
const data = res?.data;
|
||||
if (data) {
|
||||
setSubStatus(data.status);
|
||||
setSubData(data);
|
||||
} else {
|
||||
setSubStatus("");
|
||||
}
|
||||
}
|
||||
})
|
||||
setProName(getProName());
|
||||
}, []);
|
||||
/**
|
||||
@ -84,6 +101,27 @@ const Promenu: React.FC<{}> = () => {
|
||||
return num;
|
||||
}
|
||||
|
||||
/**
|
||||
* 变更收藏状态
|
||||
* @param status
|
||||
* @returns
|
||||
*/
|
||||
const changeSubStatus = (data: any, status: string) => {
|
||||
const params = {
|
||||
id: data ? data?.id : null,
|
||||
projectId: projectId,
|
||||
status
|
||||
}
|
||||
setSubLoading(true);
|
||||
updateReadStatus(params).then(res => {
|
||||
if (res?.code == 200) {
|
||||
setSubStatus(status);
|
||||
message.success(status == '0' ? '添加收藏成功' : '移除收藏成功')
|
||||
}
|
||||
}).finally(() => {
|
||||
setSubLoading(false);
|
||||
})
|
||||
}
|
||||
|
||||
const stepButtonClick = (data: any) => {
|
||||
if (isEmpty(data) || isEmpty(data.funcList)) {
|
||||
@ -163,12 +201,17 @@ const Promenu: React.FC<{}> = () => {
|
||||
title="项目名称"
|
||||
subTitle={proName}
|
||||
extra={[
|
||||
(randerRole == 'ebtp-supervision' && subStatus == "0")
|
||||
? <Button key="qxdy" disabled={subLoading} onClick={() => changeSubStatus(subData, "d")}>移除收藏</Button> : null,
|
||||
(randerRole == 'ebtp-supervision' && (subStatus == "d" || subStatus == ""))
|
||||
? <Button key="daiyue" disabled={subLoading} onClick={() => changeSubStatus(subData, "0")}>添加收藏</Button> : null,
|
||||
(randerRole == 'ebtp-agency-project-manager' || randerRole == 'ebtp-purchase' || randerRole == 'ebtp-supervision')
|
||||
? <Button key="jiandang" onClick={() => history.push("/Project/ProjectManage/ProjectManager/ProjectInformationManagement")}>项目建档</Button> : null,
|
||||
(randerRole == 'ebtp-agency-project-manager' || randerRole == 'ebtp-purchase' || randerRole == 'ebtp-supervision') && defId != 'inquiry'
|
||||
? <Button key="guidang" onClick={() =>{
|
||||
? <Button key="guidang" onClick={() => {
|
||||
history.push("/ProjectLayout/Archive/projectArchive")
|
||||
setButtonValue(stepButtonClick(data?.[data?.length - 1]))}}>项目归档</Button> : null,
|
||||
setButtonValue(stepButtonClick(data?.[data?.length - 1]))
|
||||
}}>项目归档</Button> : null,
|
||||
((randerRole == 'ebtp-agency-project-manager' || randerRole == 'ebtp-purchase' || randerRole == 'ebtp-supervision') && MethodDict != "procurement_mode_7")
|
||||
? <Button key="manageyiyi" onClick={() => history.push("/Project/ProjectManage/ProjectManager/ObjectionComplaint")}>异议投诉</Button> : null,
|
||||
(randerRole == 'ebtp-supplier' && MethodDict != "procurement_mode_7")
|
||||
|
Reference in New Issue
Block a user