|
@@ -14,6 +14,7 @@ import {
|
|
|
InputNumber,
|
|
|
Upload,
|
|
|
Space,
|
|
|
+ Radio,
|
|
|
} from 'antd';
|
|
|
import ModuleTitle from '../../../components/ModuleTitle/moduleTitle';
|
|
|
import { useEffect, useMemo, useState } from 'react';
|
|
@@ -22,6 +23,7 @@ import { useModel, useRequest } from '@umijs/max';
|
|
|
import { CloudUploadOutlined } from '@ant-design/icons';
|
|
|
import styles from '../index.less';
|
|
|
import dayjs from 'dayjs';
|
|
|
+import InputSelect from '../../../components/InputSelect';
|
|
|
export const Type = {
|
|
|
add: 0, //新增
|
|
|
detail: 1, //详情
|
|
@@ -72,9 +74,13 @@ const ContractModal = (props) => {
|
|
|
//项目名称选择后,自动填入对应的项目编号
|
|
|
const project_name = Form.useWatch('project_name', form);
|
|
|
|
|
|
+ //是否补充协议,是的话需要填合同编号
|
|
|
+ const is_supplement = Form.useWatch('is_supplement', form);
|
|
|
+
|
|
|
const [isPass, setIsPass] = useState(1);
|
|
|
|
|
|
const [fileList, setFileList] = useState([]);
|
|
|
+ const [fileExtendList, setFileExtendList] = useState([]);
|
|
|
|
|
|
useEffect(() => {
|
|
|
userListRun();
|
|
@@ -107,7 +113,7 @@ const ContractModal = (props) => {
|
|
|
return false;
|
|
|
}, [user]);
|
|
|
|
|
|
- console.log('======================', data);
|
|
|
+ console.log('======================', data, is_supplement);
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (company == 135) {
|
|
@@ -126,6 +132,10 @@ const ContractModal = (props) => {
|
|
|
if (project_code) form.setFieldsValue({ project_code });
|
|
|
}, [project_name]);
|
|
|
|
|
|
+ // useEffect(() => {
|
|
|
+ // console.log('==================', is_supplement);
|
|
|
+ // }, [is_supplement]);
|
|
|
+
|
|
|
const supplyList = useMemo(() => {
|
|
|
return depList ? [...depList, ...supplierList] : supplierList;
|
|
|
}, [depList, supplierList]);
|
|
@@ -133,6 +143,7 @@ const ContractModal = (props) => {
|
|
|
const disableds = useMemo(() => {
|
|
|
if (!visible) {
|
|
|
setFileList([]);
|
|
|
+ setFileExtendList([]);
|
|
|
setIsPass(1);
|
|
|
setDepDisable(false);
|
|
|
setDealDisable(false);
|
|
@@ -159,6 +170,18 @@ const ContractModal = (props) => {
|
|
|
}
|
|
|
},
|
|
|
};
|
|
|
+ const UploadPropsExtend = {
|
|
|
+ action: `/api/contract/v1/attach`,
|
|
|
+ headers: {
|
|
|
+ 'JWT-TOKEN': localStorage.getItem('JWT-TOKEN'),
|
|
|
+ },
|
|
|
+ onChange({ file, fileList }) {
|
|
|
+ if (file.status !== 'uploading') {
|
|
|
+ console.log(file, fileList);
|
|
|
+ setFileExtendList(fileList.map((item) => item.response?.data?.attach));
|
|
|
+ }
|
|
|
+ },
|
|
|
+ };
|
|
|
|
|
|
const handleSubmit = () => {
|
|
|
form.validateFields().then((values) => {
|
|
@@ -244,15 +267,22 @@ const ContractModal = (props) => {
|
|
|
destroyOnClose
|
|
|
>
|
|
|
<Divider />
|
|
|
- <ModuleTitle title="合同信息" />
|
|
|
<Form
|
|
|
form={form}
|
|
|
// initialValues={data}
|
|
|
labelCol={{ span: 7 }}
|
|
|
wrapperCol={{ span: 17 }}
|
|
|
>
|
|
|
+ <ModuleTitle title="创建人信息" />
|
|
|
<Row>
|
|
|
<Col span={10} offset={1}>
|
|
|
+ <Form.Item
|
|
|
+ name="created_name"
|
|
|
+ initialValue={data?.created_name || user?.CName}
|
|
|
+ label="创建人:"
|
|
|
+ >
|
|
|
+ <Input disabled />
|
|
|
+ </Form.Item>
|
|
|
<Form.Item
|
|
|
name="company_id"
|
|
|
label="所属公司:"
|
|
@@ -281,6 +311,121 @@ const ContractModal = (props) => {
|
|
|
disabled={disableds.contract}
|
|
|
/>
|
|
|
</Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={10}>
|
|
|
+ <Form.Item
|
|
|
+ name="created_on"
|
|
|
+ initialValue={data?.created_on || dayjs().format(FORMAT)}
|
|
|
+ label="创建时间:"
|
|
|
+ >
|
|
|
+ <Input disabled />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ name="dep_id"
|
|
|
+ label="所属部门:"
|
|
|
+ initialValue={data?.dep_id}
|
|
|
+ >
|
|
|
+ <TreeSelect
|
|
|
+ style={{ width: '100%' }}
|
|
|
+ placeholder="请选择"
|
|
|
+ showSearch
|
|
|
+ allowClear
|
|
|
+ treeDefaultExpandAll
|
|
|
+ fieldNames={{
|
|
|
+ label: 'Name',
|
|
|
+ value: 'ID',
|
|
|
+ children: 'children',
|
|
|
+ }}
|
|
|
+ disabled={disableds.contract || depDisable}
|
|
|
+ dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
|
+ treeData={depList?.find((item) => item.Code == 'GT')?.children}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ <ModuleTitle title="经办人信息" />
|
|
|
+ <Row>
|
|
|
+ <Col span={10} offset={1}>
|
|
|
+ <Form.Item
|
|
|
+ name="deal_by"
|
|
|
+ label="经办人:"
|
|
|
+ initialValue={data?.deal_by || user?.CName}
|
|
|
+ rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请选择经办人',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ <Select
|
|
|
+ showSearch
|
|
|
+ style={{ width: '100%' }}
|
|
|
+ placeholder="请选择"
|
|
|
+ disabled
|
|
|
+ filterOption={(input, option) =>
|
|
|
+ (option?.label ?? '')
|
|
|
+ .toLowerCase()
|
|
|
+ .includes(input.toLowerCase())
|
|
|
+ }
|
|
|
+ options={userList?.map((item) => {
|
|
|
+ return {
|
|
|
+ value: item.CName,
|
|
|
+ label: item.CName,
|
|
|
+ };
|
|
|
+ })}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ <Col span={10}>
|
|
|
+ <Form.Item
|
|
|
+ name="created_dep"
|
|
|
+ label="签约承办部门:"
|
|
|
+ initialValue={data?.created_dep}
|
|
|
+ rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请选择签约承办部门',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ <TreeSelect
|
|
|
+ style={{ width: '100%' }}
|
|
|
+ placeholder="请选择"
|
|
|
+ showSearch
|
|
|
+ allowClear
|
|
|
+ disabled={disableds.contract}
|
|
|
+ fieldNames={{
|
|
|
+ label: 'Name',
|
|
|
+ value: 'Name',
|
|
|
+ children: 'children',
|
|
|
+ }}
|
|
|
+ dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
|
+ treeData={depList?.find((item) => item.Code == 'GT')?.children}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ <ModuleTitle title="合同信息" />
|
|
|
+
|
|
|
+ <Row>
|
|
|
+ <Col span={10} offset={1}>
|
|
|
+ <Form.Item
|
|
|
+ name="is_supplement"
|
|
|
+ label="是否补充协议:"
|
|
|
+ tooltip="合同名称"
|
|
|
+ initialValue={data?.name}
|
|
|
+ rules={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请填写合同名称',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ >
|
|
|
+ <Radio.Group>
|
|
|
+ <Radio value={1}>是</Radio>
|
|
|
+ <Radio value={0}>否</Radio>
|
|
|
+ </Radio.Group>
|
|
|
+ </Form.Item>
|
|
|
<Form.Item
|
|
|
name="name"
|
|
|
label="合同名称:"
|
|
@@ -297,7 +442,7 @@ const ContractModal = (props) => {
|
|
|
</Form.Item>
|
|
|
<Form.Item
|
|
|
name="effect_on"
|
|
|
- label="合同生效日期:"
|
|
|
+ label="合同签订日期:"
|
|
|
initialValue={data?.effect_on}
|
|
|
rules={[
|
|
|
{
|
|
@@ -326,7 +471,15 @@ const ContractModal = (props) => {
|
|
|
},
|
|
|
]}
|
|
|
>
|
|
|
- <Select
|
|
|
+ <InputSelect
|
|
|
+ list={projectList?.map((item) => {
|
|
|
+ return {
|
|
|
+ key: item.id,
|
|
|
+ value: item.project_name,
|
|
|
+ };
|
|
|
+ })}
|
|
|
+ />
|
|
|
+ {/* <Select
|
|
|
style={{ width: '100%' }}
|
|
|
placeholder="请选择"
|
|
|
options={projectList?.map((item) => {
|
|
@@ -336,7 +489,7 @@ const ContractModal = (props) => {
|
|
|
};
|
|
|
})}
|
|
|
disabled={disableds.contract}
|
|
|
- />
|
|
|
+ /> */}
|
|
|
</Form.Item>
|
|
|
<Form.Item
|
|
|
name="party_a"
|
|
@@ -364,88 +517,29 @@ const ContractModal = (props) => {
|
|
|
disabled={disableds.contract}
|
|
|
/>
|
|
|
</Form.Item>
|
|
|
- <Form.Item
|
|
|
- name="party_c"
|
|
|
- label="丙方(及其他):"
|
|
|
- initialValue={data?.party_c ? data?.party_c.split(',') : []}
|
|
|
- rules={[
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请选择(支持多选)',
|
|
|
- },
|
|
|
- ]}
|
|
|
- >
|
|
|
- <TreeSelect
|
|
|
- style={{ width: '100%' }}
|
|
|
- placeholder="请选择"
|
|
|
- showSearch
|
|
|
- multiple
|
|
|
- allowClear
|
|
|
- fieldNames={{
|
|
|
- label: 'Name',
|
|
|
- value: 'Name',
|
|
|
- children: 'children',
|
|
|
- }}
|
|
|
- dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
|
- treeData={supplyList}
|
|
|
- disabled={disableds.contract}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- <Form.Item
|
|
|
- name="created_dep"
|
|
|
- label="签约承办部门:"
|
|
|
- initialValue={data?.created_dep}
|
|
|
- rules={[
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请选择签约承办部门',
|
|
|
- },
|
|
|
- ]}
|
|
|
- >
|
|
|
- <TreeSelect
|
|
|
- style={{ width: '100%' }}
|
|
|
- placeholder="请选择"
|
|
|
- showSearch
|
|
|
- allowClear
|
|
|
- disabled={disableds.contract}
|
|
|
- fieldNames={{
|
|
|
- label: 'Name',
|
|
|
- value: 'Name',
|
|
|
- children: 'children',
|
|
|
- }}
|
|
|
- dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
|
- treeData={depList?.find((item) => item.Code == 'GT')?.children}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
</Col>
|
|
|
<Col span={10}>
|
|
|
<Form.Item
|
|
|
- name="dep_id"
|
|
|
- label="所属部门:"
|
|
|
- initialValue={data?.dep_id}
|
|
|
+ style={{ opacity: is_supplement ? 1 : 0 }}
|
|
|
+ name="parent_code"
|
|
|
+ initialValue={data?.parent_code}
|
|
|
+ label="原合同编号:"
|
|
|
+ rules={
|
|
|
+ is_supplement
|
|
|
+ ? [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请填写原合同编号',
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ : []
|
|
|
+ }
|
|
|
>
|
|
|
- <TreeSelect
|
|
|
- style={{ width: '100%' }}
|
|
|
- placeholder="请选择"
|
|
|
- showSearch
|
|
|
- allowClear
|
|
|
- treeDefaultExpandAll
|
|
|
- fieldNames={{
|
|
|
- label: 'Name',
|
|
|
- value: 'ID',
|
|
|
- children: 'children',
|
|
|
- }}
|
|
|
- disabled={disableds.contract || depDisable}
|
|
|
- dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
|
- treeData={depList?.find((item) => item.Code == 'GT')?.children}
|
|
|
- />
|
|
|
+ <Input placeholder="请填写" />
|
|
|
</Form.Item>
|
|
|
- {/* {type != Type.add && ( */}
|
|
|
<Form.Item name="code" initialValue={data?.code} label="合同编号:">
|
|
|
- <Input placeholder="提交后自动生成" disabled />
|
|
|
+ <Input placeholder="请填写" />
|
|
|
</Form.Item>
|
|
|
- {/* )} */}
|
|
|
-
|
|
|
<Form.Item
|
|
|
label="合同总价款:"
|
|
|
name="amount"
|
|
@@ -498,37 +592,30 @@ const ContractModal = (props) => {
|
|
|
treeData={supplyList}
|
|
|
/>
|
|
|
</Form.Item>
|
|
|
- <Form.Item
|
|
|
- name="deal_by"
|
|
|
- label="经办人:"
|
|
|
- initialValue={data?.deal_by || user?.CName}
|
|
|
- rules={[
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请选择经办人',
|
|
|
- },
|
|
|
- ]}
|
|
|
- >
|
|
|
- <Select
|
|
|
- showSearch
|
|
|
- style={{ width: '100%' }}
|
|
|
- placeholder="请选择"
|
|
|
- disabled
|
|
|
- filterOption={(input, option) =>
|
|
|
- (option?.label ?? '')
|
|
|
- .toLowerCase()
|
|
|
- .includes(input.toLowerCase())
|
|
|
- }
|
|
|
- options={userList?.map((item) => {
|
|
|
- return {
|
|
|
- value: item.CName,
|
|
|
- label: item.CName,
|
|
|
- };
|
|
|
- })}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
</Col>
|
|
|
</Row>
|
|
|
+ <Form.Item
|
|
|
+ name="party_c"
|
|
|
+ label="丙方(及其他):"
|
|
|
+ initialValue={data?.party_c ? data?.party_c.split(',') : []}
|
|
|
+ labelCol={{ span: 4 }}
|
|
|
+ >
|
|
|
+ <TreeSelect
|
|
|
+ style={{ width: '100%' }}
|
|
|
+ placeholder="请选择"
|
|
|
+ showSearch
|
|
|
+ multiple
|
|
|
+ allowClear
|
|
|
+ fieldNames={{
|
|
|
+ label: 'Name',
|
|
|
+ value: 'Name',
|
|
|
+ children: 'children',
|
|
|
+ }}
|
|
|
+ dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
|
|
+ treeData={supplyList}
|
|
|
+ disabled={disableds.contract}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
<Form.Item
|
|
|
name="perform"
|
|
|
initialValue={data?.perform}
|
|
@@ -537,41 +624,71 @@ const ContractModal = (props) => {
|
|
|
>
|
|
|
<Input.TextArea disabled={disableds.contract} />
|
|
|
</Form.Item>
|
|
|
- <Form.Item label="合同上传:" labelCol={{ span: 4 }}>
|
|
|
- {type == Type.add ? (
|
|
|
- <Upload {...UploadProps}>
|
|
|
- <Button icon={<CloudUploadOutlined />}>Upload</Button>
|
|
|
- </Upload>
|
|
|
- ) : (
|
|
|
- <ul>
|
|
|
- {data?.attach &&
|
|
|
- JSON.parse(data?.attach)?.map((item, idx) => (
|
|
|
- <li key={`${idx}_${item.name}`}>
|
|
|
- <Space>
|
|
|
- {item.name} <span>预览</span> <a href={item.url}>下载</a>
|
|
|
- </Space>
|
|
|
- </li>
|
|
|
- ))}
|
|
|
- </ul>
|
|
|
- )}
|
|
|
- </Form.Item>
|
|
|
<Row>
|
|
|
<Col span={10} offset={1}>
|
|
|
+ <Form.Item label="合同及合同附件上传:">
|
|
|
+ {type == Type.add ? (
|
|
|
+ <Upload {...UploadProps}>
|
|
|
+ <Button icon={<CloudUploadOutlined />}>Upload</Button>
|
|
|
+ </Upload>
|
|
|
+ ) : (
|
|
|
+ <ul>
|
|
|
+ {data?.attach &&
|
|
|
+ JSON.parse(data?.attach)?.map((item, idx) => (
|
|
|
+ <li key={`${idx}_${item.name}`}>
|
|
|
+ {item.name}
|
|
|
+ {/* <Space>
|
|
|
+ {item.name} <span>预览</span>{' '}
|
|
|
+ <a href={item.url}>下载</a>
|
|
|
+ </Space> */}
|
|
|
+ </li>
|
|
|
+ ))}
|
|
|
+ </ul>
|
|
|
+ )}
|
|
|
+ </Form.Item>
|
|
|
<Form.Item
|
|
|
- name="created_name"
|
|
|
- initialValue={data?.created_name || user?.CName}
|
|
|
- label="创建人:"
|
|
|
+ name="archives_dep"
|
|
|
+ initialValue={data?.archives_dep}
|
|
|
+ label="合同原件存档部门:"
|
|
|
>
|
|
|
- <Input disabled />
|
|
|
+ {company == 135 ? (
|
|
|
+ <Select
|
|
|
+ style={{ width: '100%' }}
|
|
|
+ options={[
|
|
|
+ {
|
|
|
+ value: '财务部',
|
|
|
+ label: '财务部',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: '行政部',
|
|
|
+ label: '行政部',
|
|
|
+ },
|
|
|
+ ]}
|
|
|
+ />
|
|
|
+ ) : (
|
|
|
+ <Input value={'综合管理部'} disabled={disableds.contract} />
|
|
|
+ )}
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
|
<Col span={10}>
|
|
|
- <Form.Item
|
|
|
- name="created_on"
|
|
|
- initialValue={data?.created_on || dayjs().format(FORMAT)}
|
|
|
- label="创建时间:"
|
|
|
- >
|
|
|
- <Input disabled />
|
|
|
+ <Form.Item label="合同相关资料上传:">
|
|
|
+ {type == Type.add ? (
|
|
|
+ <Upload {...UploadPropsExtend}>
|
|
|
+ <Button icon={<CloudUploadOutlined />}>Upload</Button>
|
|
|
+ </Upload>
|
|
|
+ ) : (
|
|
|
+ <ul>
|
|
|
+ {data?.attach_extend &&
|
|
|
+ JSON.parse(data?.attach_extend)?.map((item, idx) => (
|
|
|
+ <li key={`${idx}_${item.name}`}>
|
|
|
+ <Space>
|
|
|
+ {item.name} <span>预览</span>{' '}
|
|
|
+ <a href={item.url}>下载</a>
|
|
|
+ </Space>
|
|
|
+ </li>
|
|
|
+ ))}
|
|
|
+ </ul>
|
|
|
+ )}
|
|
|
</Form.Item>
|
|
|
</Col>
|
|
|
</Row>
|