Commit 937e607d authored by alwayOnlie's avatar alwayOnlie

修改合同模板文件上传必填

parent 3508b2cf
// import React, { useEffect, useState, useRef } from 'react';
// import { Anchor, Radio, Steps, Row, Table, Space, Typography, Button } from 'antd';
// import { ArrowLeftOutlined } from '@ant-design/icons';
// import { PublicApi } from '@/services/api';
// import { history } from 'umi'
// import Basic from '../../components/detailCard/basic'
// import style from './index.less';
...@@ -110,7 +100,7 @@ const Details = (props: any) => { ...@@ -110,7 +100,7 @@ const Details = (props: any) => {
setouterTaskStepList(outerTaskStepList) setouterTaskStepList(outerTaskStepList)
setinnerTaskStepList(innerTaskStepList) setinnerTaskStepList(innerTaskStepList)
setpayPlanList(payPlanList) setpayPlanList(payPlanList)
setcontractText(contractText) setcontractText(contractText ? contractText : {})
setcontractAbstract(contractAbstract) setcontractAbstract(contractAbstract)
setcontractNo(basics.contractNo) setcontractNo(basics.contractNo)
} }
......
...@@ -10,7 +10,8 @@ import { ...@@ -10,7 +10,8 @@ import {
} from '@ant-design/icons' } from '@ant-design/icons'
const ContractText = (props: any) => { const ContractText = (props: any) => {
const { currentRef, ctText } = props; const { currentRef, ctText, memberId } = props;
console.log(ctText, '拉拉')
const [TemplatePage, setTemplatePage] = useState<any>([]); const [TemplatePage, setTemplatePage] = useState<any>([]);
const [Templatel, setTemplatel] = useState<any>({}); const [Templatel, setTemplatel] = useState<any>({});
const [checkNick, setCheckNick] = useState(true); const [checkNick, setCheckNick] = useState(true);
...@@ -34,9 +35,7 @@ const ContractText = (props: any) => { ...@@ -34,9 +35,7 @@ const ContractText = (props: any) => {
let list = []; let list = [];
res.data.data.find((item: any) => { res.data.data.find((item: any) => {
item.version != null ? item.version : ''; item.version != null ? item.version : '';
console.log(item.version)
if (item.state == 1) { if (item.state == 1) {
console.log(item,)
list.push({ list.push({
label: item.name + item.version, label: item.name + item.version,
value: item.id, value: item.id,
...@@ -44,7 +43,6 @@ const ContractText = (props: any) => { ...@@ -44,7 +43,6 @@ const ContractText = (props: any) => {
}) })
} }
}) })
// console.log(list, res.data.data);
setTemplatePage(list) setTemplatePage(list)
}) })
...@@ -69,7 +67,11 @@ const ContractText = (props: any) => { ...@@ -69,7 +67,11 @@ const ContractText = (props: any) => {
useEffect(() => { useEffect(() => {
if (ctText != null) { if (ctText != null) {
ctText.name = ctText.contractName; ctText.name = ctText.contractName;
ctText.T_emplateId = ctText.id;
ctText.id = ctText.templateId;
setTemplatel(ctText) setTemplatel(ctText)
console.log(ctText, 1313131)
} }
}, [ctText]) }, [ctText])
...@@ -91,6 +93,29 @@ const ContractText = (props: any) => { ...@@ -91,6 +93,29 @@ const ContractText = (props: any) => {
} }
} }
} }
/* 生成电子合同 */
const generate = () => {
if (!Templatel.id) {
message.info('请先选择合同模版')
} else {
const param = {
contractTemplateId: Templatel.id,
memberId,
}
PublicApi.postContractSignatureContractCreate(param).then(res => {
console.log(res);
if (res.code == 1000) {
const Temp = Templatel;
Temp.contractName = res.data.contractName
Temp.name = res.data.contractName
Temp.fileUrl = res.data.contractUrl
setTemplatel(Temp)
console.log(Temp)
}
})
}
}
return ( return (
<div <div
style={{ style={{
...@@ -99,14 +124,16 @@ const ContractText = (props: any) => { ...@@ -99,14 +124,16 @@ const ContractText = (props: any) => {
> >
<Form.Item label="合同模板" labelAlign="left" labelCol={{ span: 2 }}> <Form.Item label="合同模板" labelAlign="left" labelCol={{ span: 2 }}>
<Select <Select
value={Templatel.id}
style={{ width: 600 }} style={{ width: 600 }}
options={TemplatePage} options={TemplatePage}
placeholder="请选择合同模板" placeholder="请选择合同模板"
onChange={(e) => getTemplate(e)} onChange={(e) => getTemplate(e)}
value={Templatel.templateId}
> >
</Select> </Select>
<Button type='link' >生成合同</Button> {
checkNick && <Button type='link' onClick={() => generate()}>生成合同</Button>
}
</Form.Item> </Form.Item>
{ {
Object.keys(Templatel).length != 0 && Object.keys(Templatel).length != 0 &&
......
...@@ -114,10 +114,11 @@ const Editing: React.FC<{}> = (props: any) => { ...@@ -114,10 +114,11 @@ const Editing: React.FC<{}> = (props: any) => {
<ContractText <ContractText
currentRef={contractText} currentRef={contractText}
ctText={ctText} ctText={ctText}
memberId={basic.partyBMemberId}
/> />
}, },
] ]
console.log(oldContractId ? '合同变更' : '编辑合同')
return ( return (
<PageHeaderWrapper <PageHeaderWrapper
title={oldContractId ? '合同变更' : '编辑合同'} title={oldContractId ? '合同变更' : '编辑合同'}
......
...@@ -16,6 +16,7 @@ export interface parmas { ...@@ -16,6 +16,7 @@ export interface parmas {
const AddContract: React.FC<parmas> = (props) => { const AddContract: React.FC<parmas> = (props) => {
const { page_type, id } = props; const { page_type, id } = props;
const { TextArea } = Input; const { TextArea } = Input;
const [form] = Form.useForm(); const [form] = Form.useForm();
const [fileExampleUrl, setFileExampleUrl] = useState<any>({}); const [fileExampleUrl, setFileExampleUrl] = useState<any>({});
...@@ -81,17 +82,24 @@ const AddContract: React.FC<parmas> = (props) => { ...@@ -81,17 +82,24 @@ const AddContract: React.FC<parmas> = (props) => {
/**提交数据 */ /**提交数据 */
const onSubmit = async () => { const onSubmit = async () => {
await form.validateFields().then(res => { await form.validateFields().then(res => {
const parmas = { console.log(uploadFile.name)
name: res.name, if (uploadFile.name) {
version: res.version, const parmas = {
description: res.description, name: res.name,
fileExampleUrl: fileExampleUrl.contractUrl, version: res.version,
fileExampleName: fileExampleUrl.contractName, description: res.description,
fileUrl, fileExampleUrl: fileExampleUrl.contractUrl,
fileName: uploadFile.name fileExampleName: fileExampleUrl.contractName,
fileUrl,
fileName: uploadFile.name
}
sharedFn(parmas)
console.log(parmas)
} else {
message.warning('请先上传合同文件')
} }
sharedFn(parmas)
console.log(parmas)
}) })
} }
...@@ -111,13 +119,16 @@ const AddContract: React.FC<parmas> = (props) => { ...@@ -111,13 +119,16 @@ const AddContract: React.FC<parmas> = (props) => {
/**班级查看数据 */ /**班级查看数据 */
useEffect(() => { useEffect(() => {
if (id) { if (id) {
PublicApi.getContractContractTemplateGet({ id }).then(res => { PublicApi.getContractContractTemplateGet({ id }).then(res => {
setData(res.data); setData(res.data);
setUploadFile({ let files = res.data.fileName ? {
name: res.data.fileName, name: res.data.fileName,
file: res.data.fileUrl file: res.data.fileUrl
}) } : {}
setUploadFile(files)
if (page_type === 'edit') { if (page_type === 'edit') {
form.setFieldsValue(res.data) form.setFieldsValue(res.data)
} }
}) })
...@@ -175,7 +186,8 @@ const AddContract: React.FC<parmas> = (props) => { ...@@ -175,7 +186,8 @@ const AddContract: React.FC<parmas> = (props) => {
</div> </div>
</div> </div>
</Form.Item> </Form.Item>
<Form.Item label={<div>合同文件模板&nbsp;<Tooltip placement="top" title='制作完成的合同模板,需要上传至平台,才能在后续的订单中签订电子合同'><QuestionCircleOutlined /></Tooltip></div>} colon={false}> <Form.Item name="uploadFile" label={<div>合同文件模板&nbsp;<Tooltip placement="top" title='制作完成的合同模板,需要上传至平台,才能在后续的订单中签订电子合同'><QuestionCircleOutlined /></Tooltip></div>} colon={false}
>
<div className={styles.upload_data}> <div className={styles.upload_data}>
{Object.keys(uploadFile).length > 0 && {Object.keys(uploadFile).length > 0 &&
<div className={styles.upload_item}> <div className={styles.upload_item}>
......
...@@ -70,7 +70,7 @@ const Template: React.FC<{}> = () => { ...@@ -70,7 +70,7 @@ const Template: React.FC<{}> = () => {
<> <>
{record.state === 0 && {record.state === 0 &&
<> <>
<Button disabled={record.state === 1} style={{ padding: '0px', marginRight: '24px' }} type='link'><Link to={`/memberCenter/tranactionAbility/electronicContracts/template/edit?id=${record.id}`}>编辑</Link></Button> <Button disabled={record.state === 1} style={{ padding: '0px', marginRight: '24px' }} type='link'><Link to={`/memberCenter/contract/template/edit?id=${record.id}`}>编辑</Link></Button>
<Popconfirm <Popconfirm
title="确定要执行这个操作?" title="确定要执行这个操作?"
onConfirm={() => confirmDel(record)} onConfirm={() => confirmDel(record)}
......
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