Commit 5a2b2050 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫

feat: 采购计划管理接口接入

parent 207b3338
......@@ -39,6 +39,14 @@ export const purchasePlanRoute = [
component: '@/pages/transaction/purchaseAbility/purchasePlan/purchasePlanSearch'
},
{
/** 采购计划查询 - 详情 */
path: '/memberCenter/procurementAbility/purchasePlan/purchasePlanSearch/preview',
name: '采购计划查询',
component: '@/pages/transaction/purchaseAbility/purchasePlan/detail',
hideInMenu: true,
noMargin: true,
},
{
/** 待提交审核采购计划 */
path: '/memberCenter/procurementAbility/purchasePlan/purchasePlanSubmit',
name: '待提交审核采购计划',
......
/** 详情通用 - 流转进度 */
import React, { useContext, useEffect, useState } from 'react';
import React, { useContext, useState } from 'react';
import { Radio, Steps } from 'antd';
import { Context } from '../context';
import Card from '../../../card';
......@@ -14,17 +14,15 @@ const LOGSTATESTYPE = {
EXMAINEINERIORSTATES: 3
}
export interface ProgressProps { }
export interface ProgressProps {
/** 选中哪个radio */
logstate?: number,
}
const ProgressLayout: React.FC<ProgressProps> = () => {
const ProgressLayout: React.FC<ProgressProps> = (props: any) => {
const { logstate } = props;
const context = useContext(Context);
const [logStatesStatus, setLogStatesStatus] = useState<number>(LOGSTATESTYPE.EXTERNALSTATES);
useEffect(() => {
if (!context.externalLogStates) {
setLogStatesStatus(LOGSTATESTYPE.INTERIORSTATES)
}
}, [context])
const [logStatesStatus, setLogStatesStatus] = useState<number>( logstate || LOGSTATESTYPE.EXTERNALSTATES);
return (
<Card
......@@ -33,7 +31,7 @@ const ProgressLayout: React.FC<ProgressProps> = () => {
extra={
<Radio.Group
onChange={(e) => setLogStatesStatus(e.target.value)}
defaultValue={context.externalLogStates ? LOGSTATESTYPE.EXTERNALSTATES : LOGSTATESTYPE.INTERIORSTATES}
defaultValue={logStatesStatus}
>
{context.externalLogStates && <Radio.Button value={LOGSTATESTYPE.EXTERNALSTATES}>外部流转</Radio.Button>}
{context.interiorLogStates && <Radio.Button value={LOGSTATESTYPE.INTERIORSTATES}>内部流转</Radio.Button>}
......
/** 详情通用 - 流转进度 */
import React, { useContext, useEffect, useState } from 'react';
import React, { useContext, useState } from 'react';
import { Radio, Table } from 'antd';
import { Context } from '../context';
import Card from '../../../card';
......@@ -15,17 +15,15 @@ const LOGSTATESTYPE = {
INTERIORSTATES: 2
}
export interface ProgressProps {}
export interface ProgressProps {
/** 选中哪个radio */
logstate?: number,
}
const RecordLayout: React.FC<ProgressProps> = () => {
const RecordLayout: React.FC<ProgressProps> = (props: any) => {
const { logstate } = props;
const context = useContext(Context);
const [logStatus, setLogStatus] = useState<number>(LOGSTATESTYPE.EXTERNALSTATES);
useEffect(() => {
if (!context.externalLogs) {
setLogStatus(LOGSTATESTYPE.INTERIORSTATES)
}
}, [context])
const [logStatus, setLogStatus] = useState<number>(logstate || LOGSTATESTYPE.EXTERNALSTATES);
return (
<Card
......@@ -34,7 +32,7 @@ const RecordLayout: React.FC<ProgressProps> = () => {
extra={
<Radio.Group
onChange={(e) => setLogStatus(e.target.value)}
defaultValue={context.externalLogs ? LOGSTATESTYPE.EXTERNALSTATES : LOGSTATESTYPE.INTERIORSTATES}
defaultValue={logStatus}
>
{context.externalLogs && <Radio.Button value={LOGSTATESTYPE.EXTERNALSTATES}>外部流转</Radio.Button>}
{context.interiorLogs && <Radio.Button value={LOGSTATESTYPE.INTERIORSTATES}>内部流转</Radio.Button>}
......
......@@ -148,13 +148,13 @@ const DemandDetailed = () => {
}
components={
<Fragment>
<ProgressLayout />
<ProgressLayout logstate={2} />
<BasicLayout effect={basicEffect} />
<DemandPlanMaterialLayout
id={id}
fetch={PublicApi.getPurchaseNeedPlanNeedPlanDetail}
/>
<RecordLyout />
<RecordLyout logstate={2} />
</Fragment>
}
/>
......
......@@ -30,15 +30,25 @@ const TABLINK1 = [
{ id: 'recordLyout', title: '流转记录' },
]
const TABLINK2 = [
{ id: 'progressLayout', title: '流转进度' },
{ id: 'basicLayout', title: '基本信息' },
{ id: 'bidLayout', title: '中标通知' },
{ id: 'bidResultLayout', title: '授标结果' },
{ id: 'contrastLyout', title: '报价信息' },
{ id: 'otherLyout', title: '其他说明' },
{ id: 'recordLyout', title: '流转记录' },
]
const TABLINK2 = {
0: [
{ id: 'progressLayout', title: '流转进度' },
{ id: 'basicLayout', title: '基本信息' },
{ id: 'bidLayout', title: '授标结果' },
{ id: 'bidInfoLayout', title: '报价信息' },
{ id: 'otherLyout', title: '其他说明' },
{ id: 'recordLyout', title: '流转记录' },
],
1: [
{ id: 'progressLayout', title: '流转进度' },
{ id: 'basicLayout', title: '基本信息' },
{ id: 'bidLayout', title: '中标通知' },
{ id: 'bidResultLayout', title: '授标结果' },
{ id: 'bidInfoLayout', title: '报价信息' },
{ id: 'otherLyout', title: '其他说明' },
{ id: 'recordLyout', title: '流转记录' },
]
}
const QuoteDetails = () => {
const format = (text) => {
......@@ -151,7 +161,7 @@ const QuoteDetails = () => {
<PeripheralLayout
no={dataSource.quotedPriceNo}
detail={dataSource.quotedDetails}
tabLink={(pathPci === 'offter' && dataSource.externalState === 99) ? TABLINK2 : TABLINK1}
tabLink={(pathPci === 'offter' && dataSource.externalState === 99) ? TABLINK2[dataSource.isPrize] : TABLINK1}
effect={
<>
{path === 'detail'
......
import React, { Fragment, useEffect, useState } from 'react';
import { Badge, Button } from 'antd';
import { history } from 'umi';
import { PublicApi } from '@/services/api';
import { Context } from '../../components/detail/components/context';
import PeripheralLayout from '../../components/detail';
import ProgressLayout from '../../components/detail/components/progressLayout';
import BasicLayout from '../../components/detail/components/basicLayout';
import RecordLyout from '../../components/detail/components/recordLyout';
import moment from 'moment';
import {
OFFTER_INTERNALSTATE_COLOR
} from '../../constants';
import { MinusCircleOutlined } from '@ant-design/icons';
import ModalOperate from '../../components/modalOperate';
import DemandPlanMaterialLayout from '../../components/detail/components/demandPlanMaterialLayout';
const TABLINK = [
{ id: 'progressLayout', title: '流转进度' },
{ id: 'basicLayout', title: '基本信息' },
{ id: 'materialLayout', title: '采购物料' },
{ id: 'recordLyout', title: '流转记录' },
]
const PurchasePlanDetailed = () => {
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD HH:mm:ss")}</>
}
const {
query: {
id
},
pathname,
} = history.location;
const [path] = useState(pathname.split('/')[pathname.split('/').length - 1]);
const [visible, setVisible] = useState<boolean>(false);
const [dataSource, setDataSource] = useState<any>({});
const [basicEffect, setBasicEffect] = useState<any>([]);
const handleBasicEffect = (data: any) => {
setBasicEffect([
{
col: [
{ label: '需求计划编号', extra: data.needPlanNo },
{ label: '需求计划摘要', extra: data.summary },
{ label: '内部状态', extra: <Badge status={OFFTER_INTERNALSTATE_COLOR[data.innerStatus]} text={data.innerStatusName} /> },
]
},
{
col: [
{ label: '需求计划开始', extra: format(data.startTime) },
{ label: '需求计划截止', extra: format(data.endTime) },
]
},
{
col: [
{ label: '编制部门', extra: data.department },
{ label: '编制人', extra: data.userName },
{ label: '编制时间', extra: format(data.createTime) },
]
},
])
}
const fetchDataSource = async () => {
const params = {
id,
}
await PublicApi.getPurchasePurchasePlanDetails({ ...params }).then(res => {
if (res.code !== 1000) {
history.goBack();
return;
}
let { data } = res;
let interiorLogs: any = []
let interiorLogStates: any = []
data.innerTaskList.forEach((item: any) => {
interiorLogStates.push({
state: item.step,
stateName: null,
isExecute: item.isExecute,
operationalProcess: item.taskName,
roleName: item.roleName,
})
})
data.innerRecords.forEach((item: any) => {
interiorLogs.push({
auditOpinion: item.opinion,
createMemberId: item.memberId,
createRoleId: item.needPlanId,
createTime: item.operateTime,
department: item.department,
id: item.id,
memberId: null,
memberRoleId: null,
operation: item.operate,
position: '',
purchaseInquiryId: null,
roleName: item.operator,
state: item.step + 1,
step: item.step,
})
})
data.interiorLogs = interiorLogs;
data.interiorLogStates = interiorLogStates;
setDataSource(data);
handleBasicEffect(data);
})
}
useEffect(() => {
fetchDataSource();
}, [])
return (
<Context.Provider value={dataSource}>
<PeripheralLayout
no={dataSource.purchasePlanNo}
detail={dataSource.summary}
tabLink={TABLINK}
effect={
<>
{path === 'detail'
&& (
<Button
onClick={() => setVisible(true)}
type='primary'
>
<MinusCircleOutlined />
单据退回
</Button>
)}
</>
}
components={
<Fragment>
<ProgressLayout />
<BasicLayout effect={basicEffect} />
<DemandPlanMaterialLayout
id={id}
fetch={PublicApi.getPurchaseNeedPlanNeedPlanDetail}
/>
<RecordLyout />
</Fragment>
}
/>
<ModalOperate
id={id}
title="单据退回"
modalType="billBack"
visible={visible}
fetch={PublicApi.postPurchaseNeedPlanSendBack}
onCancel={() => setVisible(false)}
onOk={() => history.goBack()}
/>
</Context.Provider>
)
}
export default PurchasePlanDetailed;
......@@ -22,7 +22,7 @@ const PurchasePlanSearch = () => {
dataIndex: 'purchasePlanNo',
render: (text: any, record: any) => (
<Space direction='vertical'>
<EyePreview url={`/memberCenter/procurementAbility/offter/auditOffterOne/view?id=${record.id}&number=${record.quotedPriceNo}&turn=${record.turn}`}>{text}</EyePreview>
<EyePreview url={`/memberCenter/procurementAbility/purchasePlan/purchasePlanSearch/preview?id=${record.id}`}>{text}</EyePreview>
<Text>{record.summary}</Text>
</Space>
)
......
import React from 'react';
import React, { useRef } from 'react';
import Table from '../../components/table'
import { ColumnType } from 'antd/lib/table/interface';
import EyePreview from '@/components/EyePreview';
......@@ -13,6 +13,7 @@ import { PlayCircleOutlined, PoweroffOutlined } from '@ant-design/icons';
const { Text } = Typography;
const PurchasePlanSubmit = () => {
const ref = useRef<any>({});
const format = (text) => {
return <>{moment(text).format("YYYY-MM-DD")}</>
}
......@@ -67,7 +68,7 @@ const PurchasePlanSubmit = () => {
</Button>
</Popconfirm>
)}
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否">
<Popconfirm title="确定要删除吗?" okText="是" cancelText="否" onConfirm={() => handleDelect(record.id)}>
<Button type='link'>
删除
</Button>
......@@ -75,7 +76,14 @@ const PurchasePlanSubmit = () => {
</>
)
}];
const handleDelect = async (id: number) => {
await PublicApi.postPurchasePurchasePlanDelete({ id }).then(res => {
if (res.code !== 1000) {
return
}
ref.current.reload();
})
}
return (
<Table
schemaType="PURCHASEPLAN_SECHEMA"
......
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