|
@@ -2,17 +2,51 @@ import Authorization from '@/components/Authorization'
|
|
|
import DatePicker from '@/components/DatePicker'
|
|
|
import { contractReturnStore, tenderStore } from '@/store/mobx'
|
|
|
import { iModalCommonProps } from '@/types/contract'
|
|
|
+import { apiContractSection } from '@/utils/common/api'
|
|
|
+import { contractTreeBaseId } from '@/utils/common/constStatus'
|
|
|
import consts from '@/utils/consts'
|
|
|
import { dayjsFormat, handleAutoCode } from '@/utils/util'
|
|
|
-import { Button, Form, Input, Modal, Select, Tree } from 'antd'
|
|
|
+import { Button, Form, Input, Modal, Select, Tree, TreeSelect } from 'antd'
|
|
|
import locale from 'antd/es/date-picker/locale/zh_CN'
|
|
|
import dayjs from 'dayjs'
|
|
|
import React, { ChangeEvent, useEffect, useState } from 'react'
|
|
|
import { apiGetReturnWay } from '../Tabs/Receivable/api'
|
|
|
import styles from './index.module.scss'
|
|
|
+
|
|
|
+interface ContractSection {
|
|
|
+ id: string;
|
|
|
+ treeType: number;
|
|
|
+ parentId: string;
|
|
|
+ name: string;
|
|
|
+ depth: number;
|
|
|
+ serial: number;
|
|
|
+ attribution: string;
|
|
|
+ code: string;
|
|
|
+ projectId: string;
|
|
|
+ bidsectionId: string;
|
|
|
+ contractId: string;
|
|
|
+ contractName: string;
|
|
|
+ contractCode: string;
|
|
|
+ contractPrice: string;
|
|
|
+ contractReturned: string;
|
|
|
+ contractsPaid: string;
|
|
|
+ contractStatus: number;
|
|
|
+ contractLocking: number;
|
|
|
+ createTime: string;
|
|
|
+ children?: any;
|
|
|
+ templateNumber: number;
|
|
|
+ operation: string;
|
|
|
+ elderBrother: boolean;
|
|
|
+ isEnd: boolean;
|
|
|
+ key: string;
|
|
|
+ title: string;
|
|
|
+}
|
|
|
+
|
|
|
const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible, confirmLoading, contractType }, onConfirm, onCancel, reload, row }) => {
|
|
|
const { Option } = Select
|
|
|
+ const [ contractSection, setContractSection ] = useState<ContractSection[]>([])
|
|
|
const [ form ] = Form.useForm()
|
|
|
+
|
|
|
const [ options, setOptions ] = useState<string[]>([])
|
|
|
const modalObj = {
|
|
|
create: {
|
|
@@ -47,9 +81,18 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ const initTreeSection = async () => {
|
|
|
+ const { code = -1, sectionTree: data = {} } = await apiContractSection(tenderStore.bid, consts.CONTRACT_TREE.RETURN)
|
|
|
+ if (code === consts.RET_CODE.SUCCESS) {
|
|
|
+ setContractSection(data.children)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
if (visible) {
|
|
|
- form.setFieldsValue({ treeId: row.id, bidsectionId: row.bidsectionId })
|
|
|
+ initTreeSection()
|
|
|
+ form.setFieldsValue({ treeId: row.contractId !== contractTreeBaseId ? row.id : '', bidsectionId: row.bidsectionId })
|
|
|
+
|
|
|
if (type === 'update') {
|
|
|
const { content = '', name = '', price = '', partyA = '', partyB = '', partyASigner = '', partyBSigner = '', signerTime = '', remarks = '' } = contractReturnStore.contract
|
|
|
form.setFieldsValue({ content, name, price, partyA, partyB, partyASigner, partyBSigner, signerTime: signerTime ? dayjs(signerTime) : '', remarks })
|
|
@@ -134,12 +177,12 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
|
|
|
<Form.Item name="bidsectionId" hidden>
|
|
|
<Input />
|
|
|
</Form.Item>
|
|
|
+ <Form.Item name="treeId" label="合同劳务">
|
|
|
+ <TreeSelect treeData={contractSection} />
|
|
|
+ </Form.Item>
|
|
|
{/* <Form.Item name="treeId" label="合同劳务" hidden>
|
|
|
- <Tree showLine={true} treeData={contractReturnStore.tree} />
|
|
|
- </Form.Item> */}
|
|
|
- <Form.Item name="treeId" label="合同劳务" hidden>
|
|
|
<Input />
|
|
|
- </Form.Item>
|
|
|
+ </Form.Item> */}
|
|
|
{type === 'create' ? (
|
|
|
<>
|
|
|
<Form.Item name="code" label="合同编号" rules={[ { required: true, message: '请输入合同编号' } ]} className={styles.contractFormItem}>
|