Pārlūkot izejas kodu

fix: 修复合同中树选择组件报错的bug

lanjianrong 4 gadi atpakaļ
vecāks
revīzija
98bcd78d8c

+ 6 - 4
src/pages/Contract/Content/Income/components/Modal/index.tsx

@@ -12,7 +12,6 @@ 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;
@@ -90,9 +89,12 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
 
   useEffect(() => {
     if (visible) {
-      initTreeSection()
-      form.setFieldsValue({ treeId: row.contractId !== contractTreeBaseId ? row.id : '', bidsectionId: row.bidsectionId })
+      form.setFieldsValue({ treeId: row.id, bidsectionId: row.bidsectionId })
 
+      if (type === 'create') {
+        initTreeSection()
+        form.setFieldsValue({ treeId: row.contractId === contractTreeBaseId ? row.id : row.parentId })
+      }
       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 })
@@ -177,7 +179,7 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
         <Form.Item name="bidsectionId" hidden>
           <Input />
         </Form.Item>
-        <Form.Item name="treeId" label="合同劳务">
+        <Form.Item name="treeId" label="合同劳务" hidden={type === 'create' ? false : true}>
           <TreeSelect treeData={contractSection} />
         </Form.Item>
         {/* <Form.Item name="treeId" label="合同劳务" hidden>

+ 2 - 2
src/pages/Contract/Content/Income/components/TableContent/index.tsx

@@ -160,7 +160,7 @@ const GCsheet: React.FC<iTableContentPorps> = ({ changeModalType, row, setRow, h
     {
       title: '项目名称',
       dataIndex: 'name',
-      width: '30%',
+      width: '25%',
       render: (text: any, record: iIncomeTree) => {
         if (record.isEdit || record.isNew) {
           const type = record.isEdit ? 'edit' : 'create'
@@ -186,7 +186,7 @@ const GCsheet: React.FC<iTableContentPorps> = ({ changeModalType, row, setRow, h
     {
       title: '合同编号',
       dataIndex: 'contractCode',
-      width: '10%'
+      width: '15%'
     },
     {
       title: '合同金额',

+ 0 - 1
src/pages/Contract/Content/Income/index.tsx

@@ -65,7 +65,6 @@ const Income: React.FC<RouteComponentProps> = ({ history }) => {
     })
     const { code = -1, contract = {} } = await apiResfulContract(type, values)
     if (code === consts.RET_CODE.SUCCESS) {
-      console.log(contract)
 
       contractReturnStore.updateContract(contract)
       contractReturnStore.resetTree(tenderStore.bid)

+ 2 - 2
src/pages/Contract/Content/Spending/components/TableContent/index.tsx

@@ -159,7 +159,7 @@ const GCsheet: React.FC<iTableContentPorps> = ({ changeModalType, row, setRow, h
     {
       title: '项目名称',
       dataIndex: 'name',
-      width: '30%',
+      width: '25%',
       render: (text: any, record: iIncomeTree) => {
         if (record.isEdit || record.isNew) {
           const type = record.isEdit ? 'edit' : 'create'
@@ -185,7 +185,7 @@ const GCsheet: React.FC<iTableContentPorps> = ({ changeModalType, row, setRow, h
     {
       title: '合同编号',
       dataIndex: 'contractCode',
-      width: '10%'
+      width: '15%'
     },
     {
       title: '合同金额',