diff --git a/src/components/Promenu/index.tsx b/src/components/Promenu/index.tsx index 0d73ea8..0615e2c 100644 --- a/src/components/Promenu/index.tsx +++ b/src/components/Promenu/index.tsx @@ -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([]); @@ -51,6 +51,12 @@ const Promenu: React.FC<{}> = () => { const defId = getDefId(); //项目名称 const [proName, setProName] = useState(""); + //收藏状态 0-已收藏 d-未收藏 + const [subStatus, setSubStatus] = useState(null); + //收藏数据 + const [subData, setSubData] = useState(); + //收藏loading + const [subLoading, setSubLoading] = useState(false); const [anchorEl, setAnchorEl] = React.useState(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") + ? : null, + (randerRole == 'ebtp-supervision' && (subStatus == "d" || subStatus == "")) + ? : null, (randerRole == 'ebtp-agency-project-manager' || randerRole == 'ebtp-purchase' || randerRole == 'ebtp-supervision') ? : null, (randerRole == 'ebtp-agency-project-manager' || randerRole == 'ebtp-purchase' || randerRole == 'ebtp-supervision') && defId != 'inquiry' - ? : null, + setButtonValue(stepButtonClick(data?.[data?.length - 1])) + }}>项目归档 : null, ((randerRole == 'ebtp-agency-project-manager' || randerRole == 'ebtp-purchase' || randerRole == 'ebtp-supervision') && MethodDict != "procurement_mode_7") ? : null, (randerRole == 'ebtp-supplier' && MethodDict != "procurement_mode_7") diff --git a/src/components/Promenu/service/service.ts b/src/components/Promenu/service/service.ts index e938aef..8a31df6 100644 --- a/src/components/Promenu/service/service.ts +++ b/src/components/Promenu/service/service.ts @@ -15,4 +15,26 @@ export async function menuList(params: any) { method: 'GET', params: { ...params } }); +} +/** + * 收藏用-查询收藏信息(项目id或收藏id) + * @param params + * @returns + */ +export async function getReadInfo(params: any) { + return request('/api/biz-service-ebtp-project/v1/notification/getReading', { + method: 'POST', + data: { ...params }, + }); +} +/** + * 收藏用-变更收藏状态(0-已收藏 d-未收藏) + * @param params + * @returns + */ +export async function updateReadStatus(params: any) { + return request('/api/biz-service-ebtp-project/v1/notification/addOrUpdate', { + method: 'POST', + data: { ...params }, + }); } \ No newline at end of file diff --git a/src/pages/Project/ProjectManage/Supervision/components/FavoritesList.tsx b/src/pages/Project/ProjectManage/Supervision/components/FavoritesList.tsx new file mode 100644 index 0000000..7081278 --- /dev/null +++ b/src/pages/Project/ProjectManage/Supervision/components/FavoritesList.tsx @@ -0,0 +1,205 @@ +import { getUrlRelativePath, isEmpty, isNotEmpty, proTableValueEnum } from '@/utils/CommonUtils'; +import { followUpAProjectManager, getDicData, setPurchaseCanOperate } from '@/utils/session'; +import ProTable, { ActionType, ProColumns } from '@ant-design/pro-table'; +import { Button, message, Popconfirm, Spin } from 'antd'; +import React, { useRef, useState } from 'react'; +import { useHistory } from 'umi'; +import { getFavoritesList, updateReadStatus } from '../service'; + +interface FavoritesListProps { + projectName?: string | null, + bidMethodDict?: string | null, + current?: string | null, + tabs: string | null, +} +/** + * 监督项目收藏列表 + * @param props + * @returns + */ +const FavoritesList: React.FC = (props) => { + const { projectName, bidMethodDict, current, tabs } = props + + const [spin, spinSet] = useState(false); + //查询分页数据 + const [pageData, pageDataSet] = useState({ + pageNo: tabs === 'favoritesList' ? isNotEmpty(current) ? Number(current) : 1 : 1, + pageSize: 10 + }); + //项目列表参数 + const [projectParams, setProjectParams] = useState(""); + //获取字典 + const getDict: any = getDicData(); + const dictData = JSON.parse(getDict); + //标的类型 + const procurementTypeEntrust = 'procurement_type=entrust'; + //采购方式 + const procurementModeEntrust = 'procurement_mode=entrust'; + const history = useHistory(); + const ref = useRef(); + const columns: ProColumns[] = [ + { + title: '序号', + valueType: 'index', + width: 50, + }, + { + title: '采购方式', + dataIndex: 'bidMethodDict', + width: '8%', + valueEnum: proTableValueEnum(dictData[procurementModeEntrust]), + initialValue: tabs === 'favoritesList' ? isNotEmpty(bidMethodDict) ? bidMethodDict : null : null, + }, + { + title: '项目名称', + dataIndex: 'projectName', + initialValue: tabs === 'favoritesList' ? isNotEmpty(projectName) ? projectName : null : null, + }, + { + title: '项目编号', + dataIndex: 'ebpProjectNumber', + search: false, + width: '10%', + }, + { + title: '采购人', + dataIndex: 'tendereeOrgName', + search: false, + width: '15%', + }, + { + title: '建档时间', + dataIndex: 'createDate', + search: false, + width: '10%', + }, + { + title: '标的类型', + dataIndex: 'procurementType', + width: '8%', + search: false, + valueEnum: proTableValueEnum(dictData[procurementTypeEntrust]), + }, + { + title: '所属区域', + dataIndex: 'regionDictName', + search: false, + width: '10%', + }, + { + title: '操作', + valueType: 'option', + width: 150, + render: (_: any, record: any) => [ + , + removeFavorites(record)} + okText="确定" + cancelText="取消" + > + + , + ] + }, + ] + + /** + * 项目跟进 + * @param data + */ + const followUpProject = async (data: any) => { + data.returnURL = getReturnURL(); + await followUpAProjectManager(data); + setPurchaseCanOperate(); + history.push('/ProjectLayout/Manager/HomePageSectionList'); + }; + + /** + * 移除收藏 + * @param data + */ + const removeFavorites = async (data: any) => { + const params = { + id: data.notificationId, + projectId: data.id, + status: 'd', + } + spinSet(true); + await updateReadStatus(params).then(res => { + if (res?.code == 200) { + message.success('移除收藏成功'); + ref.current?.reload(); + } + }) + }; + + /** + * 获取返回路径 + * @returns + */ + const getReturnURL = () => { + let projectURLParams = JSON.parse(projectParams); + let params = `${'?current=' + projectURLParams.current}${isEmpty(projectURLParams.projectName) ? '' : '&projectName=' + projectURLParams.projectName}${isEmpty(projectURLParams.bidMethodDict) ? '' : '&bidMethodDict=' + projectURLParams.bidMethodDict}&tabs=favoritesList`; + return getUrlRelativePath() + params; + } + + return ( + +
+ { + setProjectParams(JSON.stringify(params)); + spinSet(true); + return await getFavoritesList({ + ...params, + basePageRequest: { pageNo: pageData.pageNo, pageSize: pageData.pageSize }, + }).then((res) => { + const result = { + data: res.data.records, + total: res.data.total, + success: res.success, + pageSize: res.data.size, + current: res.data.current + } + return result; + }).finally(() => { + spinSet(false); + }) + } + } + pagination={{ + defaultPageSize: 10, + defaultCurrent: tabs === 'favoritesList' ? isNotEmpty(current) ? Number(current) : 1 : 1, + size: "small", + showSizeChanger: false, + onChange: (page, pageSize) => pageDataSet({ pageNo: page, pageSize: pageSize }), + onShowSizeChange: (current, size) => pageDataSet({ pageNo: current, pageSize: size }), + }} + onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }) }} + /> +
+
+ ) +} +export default FavoritesList; \ No newline at end of file diff --git a/src/pages/Project/ProjectManage/Supervision/components/ProjectManage.tsx b/src/pages/Project/ProjectManage/Supervision/components/ProjectManage.tsx new file mode 100644 index 0000000..29ae482 --- /dev/null +++ b/src/pages/Project/ProjectManage/Supervision/components/ProjectManage.tsx @@ -0,0 +1,175 @@ +import { getUrlRelativePath, isEmpty, isNotEmpty, proTableValueEnum } from '@/utils/CommonUtils'; +import { followUpAProjectManager, getDicData, setPurchaseCanOperate } from '@/utils/session'; +import ProTable, { ProColumns } from '@ant-design/pro-table'; +import { Button, Spin } from 'antd'; +import React, { useState } from 'react'; +import { useHistory } from 'umi'; +import { getPage } from '../service'; + +interface ProjectManageProps { + projectName?: string | null, + bidMethodDict?: string | null, + current?: string | null, + tabs: string | null, +} +/** + * 项目管理列表 + * @param props + * @returns + */ +const ProjectManage: React.FC = (props) => { + const { projectName, bidMethodDict, current, tabs } = props + + const [spin, spinSet] = useState(false); + //查询分页数据 + const [pageData, pageDataSet] = useState({ + pageNo: tabs === 'projectList' ? isNotEmpty(current) ? Number(current) : 1 : 1, + pageSize: 10 + }); + //项目列表参数 + const [projectParams, setProjectParams] = useState(""); + //获取字典 + const getDict: any = getDicData(); + const dictData = JSON.parse(getDict); + //标的类型 + const procurementTypeEntrust = 'procurement_type=entrust'; + //采购方式 + const procurementModeEntrust = 'procurement_mode=entrust'; + const history = useHistory(); + + const columns: ProColumns[] = [ + { + title: '序号', + valueType: 'index', + width: 50, + }, + { + title: '采购方式', + dataIndex: 'bidMethodDict', + width: '8%', + valueEnum: proTableValueEnum(dictData[procurementModeEntrust]), + initialValue: tabs === 'projectList' ? isNotEmpty(bidMethodDict) ? bidMethodDict : null : null, + }, + { + title: '项目名称', + dataIndex: 'projectName', + initialValue: tabs === 'projectList' ? isNotEmpty(projectName) ? projectName : null : null, + }, + { + title: '项目编号', + dataIndex: 'ebpProjectNumber', + search: false, + width: '10%', + }, + { + title: '采购人', + dataIndex: 'tendereeOrgName', + search: false, + width: '15%', + }, + { + title: '建档时间', + dataIndex: 'createDate', + search: false, + width: '10%', + }, + { + title: '标的类型', + dataIndex: 'procurementType', + width: '8%', + search: false, + valueEnum: proTableValueEnum(dictData[procurementTypeEntrust]), + }, + { + title: '所属区域', + dataIndex: 'regionDictName', + search: false, + width: '10%', + }, + { + title: '操作', + valueType: 'option', + width: 150, + render: (_: any, record: any) => + ( + <> + + + ) + }, + ] + + /** + * 项目跟进 + * @param data + */ + const followUpProject = async (data: any) => { + data.returnURL = getReturnURL(); + await followUpAProjectManager(data); + setPurchaseCanOperate(); + history.push('/ProjectLayout/Manager/HomePageSectionList'); + }; + + /** + * 获取返回路径 + * @returns + */ + const getReturnURL = () => { + let projectURLParams = JSON.parse(projectParams); + let params = `${'?current=' + projectURLParams.current}${isEmpty(projectURLParams.projectName) ? '' : '&projectName=' + projectURLParams.projectName}${isEmpty(projectURLParams.bidMethodDict) ? '' : '&bidMethodDict=' + projectURLParams.bidMethodDict}&tabs=projectList`; + return getUrlRelativePath() + params; + } + + return ( + +
+ { + setProjectParams(JSON.stringify(params)); + spinSet(true); + return await getPage({ + ...params, + basePageRequest: { pageNo: pageData.pageNo, pageSize: pageData.pageSize }, + }).then((res) => { + const result = { + data: res.data.records, + total: res.data.total, + success: res.success, + pageSize: res.data.size, + current: res.data.current + } + return result; + }).finally(() => { + spinSet(false); + }) + } + } + pagination={{ + defaultPageSize: 10, + defaultCurrent: tabs === 'projectList' ? isNotEmpty(current) ? Number(current) : 1 : 1, + size: "small", + showSizeChanger: false, + onChange: (page, pageSize) => pageDataSet({ pageNo: page, pageSize: pageSize }), + onShowSizeChange: (current, size) => pageDataSet({ pageNo: current, pageSize: size }), + }} + onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }) }} + /> +
+
+ ) +} +export default ProjectManage; \ No newline at end of file diff --git a/src/pages/Project/ProjectManage/Supervision/index.tsx b/src/pages/Project/ProjectManage/Supervision/index.tsx index e24ebbf..26db24d 100644 --- a/src/pages/Project/ProjectManage/Supervision/index.tsx +++ b/src/pages/Project/ProjectManage/Supervision/index.tsx @@ -1,136 +1,42 @@ -import { proTableValueEnum } from '@/utils/CommonUtils'; -import { followUpAProjectManager, getDicData, setPurchaseCanOperate } from '@/utils/session'; -import ProTable, { ProColumns } from '@ant-design/pro-table'; -import { Button, Card, Spin } from 'antd'; -import React, { useEffect, useState } from 'react'; -import { useHistory } from 'umi'; -import { getPage } from './service'; -/**/ +import { getURLInformation, getUrlParam, isNotEmpty } from '@/utils/CommonUtils'; +import { Card, Radio } from 'antd'; +import React, { useState } from 'react'; +import FavoritesList from './components/FavoritesList'; +import ProjectManage from './components/ProjectManage'; +/** + * 监督项目管理 + * @returns + */ const Index: React.FC<{}> = () => { - const [spin, spinSet] = useState(false); - //查询分页数据 - const [pageData, pageDataSet] = useState({ - pageNo: 1, - pageSize: 10 - }); - //获取字典 - const getDict: any = getDicData(); - const dictData = JSON.parse(getDict); - //标的类型 - const procurementTypeEntrust = 'procurement_type=entrust'; - //采购方式 - const procurementModeEntrust = 'procurement_mode=entrust'; - const history = useHistory(); - const columns: ProColumns[] = [ - { - title: '序号', - valueType: 'index', - width: 50, - }, - { - title: '采购方式', - dataIndex: 'bidMethodDict', - width: '8%', - valueEnum: proTableValueEnum(dictData[procurementModeEntrust]), - }, - { - title: '项目名称', - dataIndex: 'projectName', - }, - { - title: '项目编号', - dataIndex: 'ebpProjectNumber', - search: false, - width: '10%', - }, - { - title: '采购人', - dataIndex: 'tendereeOrgName', - search: false, - width: '15%', - }, - { - title: '建档时间', - dataIndex: 'createDate', - search: false, - width: '10%', - }, - { - title: '标的类型', - dataIndex: 'procurementType', - width: '8%', - search: false, - valueEnum: proTableValueEnum(dictData[procurementTypeEntrust]), - }, - { - title: '所属区域', - dataIndex: 'regionDictName', - search: false, - width: '10%', - }, - { - title: '操作', - valueType: 'option', - width: 150, - render: (_: any, record: any) => - ( - <> - - - ) - }, - ] - //================================================================================FUNC - /** - * 项目跟进 - * @param data - */ - const followUpProject = async (data: any) => { - await followUpAProjectManager(data); - setPurchaseCanOperate(); - history.push('/ProjectLayout/Manager/HomePageSectionList'); + //url项目名称 + const projectName = getUrlParam("projectName"); + //url采购方式 + const bidMethodDict = getURLInformation("bidMethodDict"); + //url分页信息 + const current = getURLInformation("current"); + //url标签信息 + const tabs = getURLInformation("tabs"); + //radio value + const [mode, setMode] = useState(isNotEmpty(tabs) ? String(tabs) : 'projectList'); + + const handleModeChange = (e: any) => { + const mode = e.target.value; + setMode(mode); }; + return ( - - - - getPage({ - ...params, - basePageRequest: { pageNo: pageData.pageNo, pageSize: pageData.pageSize }, - }).then((res) => { - const result = { - data: res.data.records, - total: res.data.total, - success: res.success, - pageSize: res.data.size, - current: res.data.current - } - return result; - }) - } - pagination={{ - defaultPageSize: 10, - showSizeChanger: false, - onChange: (page, pageSize) => pageDataSet({ pageNo: page, pageSize: pageSize }), - onShowSizeChange: (current, size) => pageDataSet({ pageNo: current, pageSize: size }), - }} - onReset={() => { pageDataSet({ pageNo: 1, pageSize: 10 }) }} - /> - + + + 项目管理 + 监督项目收藏列表 + + { + mode === 'projectList' ? ( + + ) : ( + + ) + } ) } diff --git a/src/pages/Project/ProjectManage/Supervision/service.ts b/src/pages/Project/ProjectManage/Supervision/service.ts index 329963a..2b3a22f 100644 --- a/src/pages/Project/ProjectManage/Supervision/service.ts +++ b/src/pages/Project/ProjectManage/Supervision/service.ts @@ -4,9 +4,29 @@ import request from '@/utils/request'; * @param params */ export async function getPage(params?: any) { - return request('/api/biz-service-ebtp-project/v1/projectRecord/supervisor/getPage',{ + return request('/api/biz-service-ebtp-project/v1/projectRecord/supervisor/getPage', { method: 'POST', - data:params, - + data: params, + }); +} +/** + * 查询项目监督收藏列表 + * @param params + */ +export async function getFavoritesList(params?: any) { + return request('/api/biz-service-ebtp-project/v1/notification/supervisor/getPage', { + method: 'POST', + data: params, + }); +} +/** + * 收藏用-变更收藏状态(0-已收藏 d-未收藏) + * @param params + * @returns + */ +export async function updateReadStatus(params: any) { + return request('/api/biz-service-ebtp-project/v1/notification/addOrUpdate', { + method: 'POST', + data: { ...params }, }); } \ No newline at end of file