Commit cba29509 authored by 陈智峰's avatar 陈智峰

feat: 合同协同

parent 3c12f58a
...@@ -140,6 +140,32 @@ const router = { ...@@ -140,6 +140,32 @@ const router = {
hideInMenu: true, hideInMenu: true,
component: '@/pages/systemManage/contractManagementProcess/view', component: '@/pages/systemManage/contractManagementProcess/view',
}, },
// 合同协同流程
{
path: '/system/ruleSettingManager/contractCoordinationProcess',
name: '合同协同流程规则配置',
component: '@/pages/systemManage/contractCoordinationProcess',
},
{
path: '/system/ruleSettingManager/contractCoordinationProcess/add',
name: '新增合同协同流程规则',
hideInMenu: true,
component: '@/pages/systemManage/contractCoordinationProcess/add',
},
{
path: '/system/ruleSettingManager/contractCoordinationProcess/edit',
name: '编辑合同协同流程规则',
hideInMenu: true,
component: '@/pages/systemManage/contractCoordinationProcess/edit',
},
{
path: '/system/ruleSettingManager/contractCoordinationProcess/view',
name: '合同管理协同规则详情',
hideInMenu: true,
component: '@/pages/systemManage/contractCoordinationProcess/view',
},
{ {
path: '/system/ruleSettingManager/payStrategyList', path: '/system/ruleSettingManager/payStrategyList',
......
/**
* 系统管理 - 平台规则 - 新增合同管理流程规则
* @author: Crayon
*/
import React from 'react'
import AddEditContent from './components/AddEditContent'
const Add: React.FC = () => {
return (
<AddEditContent
type='add'
title='新增合同管理流程规则'
/>
)
}
export default Add
import React, { useRef, useEffect, useState } from 'react';
import { Form } from 'antd';
import { history } from 'umi';
import ContentLayout from '@/components/ContentLayout';
import ProcessEngLayout from '@/pages/systemManage/components/ProcessEng';
import ProcessSelectLayout from '@/pages/systemManage/components/ProcessSelect';
import ApplyMemberLayout from '@/pages/systemManage/components/ApplyMember';
import { getMemberManageAllProviderPage } from '@/services/MemberV2Api';
import { } from '@/services/ContractV2Api';
import { VISIT_TYPE } from '@/constants';
import {getContractCoordinationPlatformProcessMemberPage, postContractCoordinationPlatformProcessSave, postContractCoordinationPlatformProcessUpdate ,getContractCoordinationPlatformProcessGet,getContractCoordinationPlatformProcessBaseList, postContractCoordinationPlatformProcessSaveDefault } from '@/services/ContractV2Api';
type PropsType = {
type: 'add' | 'edit' | 'view'
id?: string;
btnCode?: string;
title?: string | React.ReactNode
}
const AddEditContent: React.FC<PropsType> = ({ id: processId, title, type }) => {
const [form] = Form.useForm();
// 流程规则是否为默认,以默认的情况初始化
const [isDefault, setIsDefault] = useState<boolean>(true)
// 编辑情况下且流程规则为默认才视为修改默认
const isEditDefault = !!(type === VISIT_TYPE.EDIT && isDefault)
const ref = useRef<any>()
const processSelectRef = useRef<any>()
const handleSubmit = (setLoading: Function, handleLeave: Function) => {
form.validateFields().then(values => {
setLoading?.(true)
if (isEditDefault) {
const params = {
processId: values.baseProcessId,
}
postContractCoordinationPlatformProcessSaveDefault(params).then(res => {
if (res.code !== 1000) {
setLoading?.(false)
return
}
handleLeave?.(false)
history.goBack()
})
} else {
const params = {
processId,
...values,
allMembers: values.allMembers === 1 ? true : false,
members: values.allMembers === 2 ? values.members?.map(_item => {
return {
memberId: _item.memberId,
roleId: _item.roleId,
}
})
: undefined
}
const fetchApi = processId ? postContractCoordinationPlatformProcessUpdate : postContractCoordinationPlatformProcessSave
fetchApi({ ...params }).then(res => {
if (res.code !== 1000) {
setLoading?.(false)
return
}
handleLeave?.(false)
history.goBack()
})
}
})
}
const getDetail = async () => {
if (processId) {
Promise.all([getContractCoordinationPlatformProcessMemberPage({ processId } as any), getContractCoordinationPlatformProcessGet({ processId })]).then(resArr => {
if (resArr.every(item => item && item.code === 1000)) {
const members = resArr[0]?.data?.map(_item => ({ ..._item, mrId: `${_item.memberId}_${_item.roleId}` }))
const detail = resArr[1]?.data
form.setFieldsValue({
name: detail?.name,
baseProcessId: detail?.baseProcessId,
allMembers: detail?.allMembers ? 1 : 2,
members,
})
console.log('resArr[1]', resArr[1])
setIsDefault(detail?.isDefault === 1)
processSelectRef.current?.getDataSource(detail?.isDefault === 1 ? { processType: detail?.baseProcess?.processType } : {})
ref?.current?.setProgress()
}
})
} else {
processSelectRef.current?.getDataSource()
}
}
useEffect(() => {
getDetail()
}, [])
return (
<ContentLayout
ref={ref}
form={form}
title={title}
type={type}
onSubmit={handleSubmit}
>
<ProcessEngLayout disabled={type === VISIT_TYPE.VIEW || isEditDefault}/>
<ProcessSelectLayout
ref={processSelectRef}
disabled={type === VISIT_TYPE.VIEW}
fetchApi={getContractCoordinationPlatformProcessBaseList}
/>
<ApplyMemberLayout
disabled={type === VISIT_TYPE.VIEW || isEditDefault}
fetchMemberApi={getMemberManageAllProviderPage}
/>
</ContentLayout>
)
}
export default AddEditContent
/**
* 系统管理 - 平台规则 - 修改合同管理流程规则
* @author: Crayon
*/
import React from 'react'
import { useLocation } from 'umi'
import AddEditContent from './components/AddEditContent'
const Edit: React.FC = () => {
const location: any = useLocation()
const { id } = location.query
return (
<AddEditContent
type='edit'
id={id}
title='修改合同管理流程规则'
/>
)
}
export default Edit
import React, { useRef } from 'react';
import { history } from 'umi';
import { Space } from 'antd';
import TableLayout from '@/components/TableLayout';
import PopconfirmBtn from '@/components/PopconfirmBtn';
import { ColumnType } from 'antd/lib/table/interface';
import { _createTime, _id, _isDefault, _name, _operation, _processName, _status } from '../constant/columns';
import { schema } from '../constant/schema';
import { controllerBtns } from '../constant/utils';
import { getContractCoordinationPlatformProcessDelete,getContractCoordinationPlatformProcessPage, postContractCoordinationPlatformProcessStatusUpdate } from '@/services/ContractV2Api';
const ProcessList: React.FC<{}> = () => {
const ref = useRef<any>()
const columns: ColumnType<any>[] = [
_id,
_name(`/system/ruleSettingManager/contractCoordinationProcess/view?id=`),
_processName,
_createTime(),
_isDefault,
_status(({ processId }, status: number) => {
postContractCoordinationPlatformProcessStatusUpdate({ processId, status }).then(res => {
if (res.code === 1000) {
ref.current.reload()
}
})
}),
{
..._operation,
render: (_text, record) => (
<Space size={16}>
<a onClick={() => { history.push(`/system/ruleSettingManager/contractCoordinationProcess/view?id=${record.processId}`) }}>查看</a>
{!!(!record.status || record.isDefault === 1) && (
<>
<a onClick={() => { history.push(`/system/ruleSettingManager/contractCoordinationProcess/edit?id=${record.processId}`) }}>修改</a>
{
record.isDefault !== 1 && (
<PopconfirmBtn
onConfirm={() => {
getContractCoordinationPlatformProcessDelete({ processId: record.processId }).then(res => {
if (res.code === 1000) {
ref.current.reload()
}
})
}}
>
删除
</PopconfirmBtn>
)
}
</>
)}
</Space>
)
}
]
return (
<TableLayout
reload={ref}
columns={columns}
fetch={getContractCoordinationPlatformProcessPage}
schema={schema}
controllerBtns={controllerBtns('/system/ruleSettingManager/contractCoordinationProcess/add')}
/>
)
}
export default ProcessList;
/**
* 系统管理 - 平台规则 - 查看合同管理流程规则
* @author: Crayon
*/
import React from 'react'
import { useLocation } from 'umi'
import AddEditContent from './components/AddEditContent'
const View: React.FC = () => {
const location: any = useLocation()
const { id } = location.query
return (
<AddEditContent
type='view'
id={id}
title='查看合同管理流程规则'
/>
)
}
export default View
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