|  | @@ -1,7 +1,7 @@
 | 
	
		
			
				|  |  |  import { ZhSubmitButton } from '@/components/Button'
 | 
	
		
			
				|  |  |  import OssUploadModal from '@/components/OssUpload'
 | 
	
		
			
				|  |  | -import { contractStore, tenderStore } from '@/store/mobx'
 | 
	
		
			
				|  |  | -import { iIncomeTree } from '@/types/contract'
 | 
	
		
			
				|  |  | +import { contractPaidStore, tenderStore } from '@/store/mobx'
 | 
	
		
			
				|  |  | +import { iIncomeTree, iShowTemplateState, iTemplateState } from '@/types/contract'
 | 
	
		
			
				|  |  |  import { iFile } from '@/types/file'
 | 
	
		
			
				|  |  |  import { apiSaveFileInfo } from '@/utils/common/api'
 | 
	
		
			
				|  |  |  import { contractConsts } from '@/utils/common/constStatus'
 | 
	
	
		
			
				|  | @@ -12,8 +12,9 @@ import { RadioChangeEvent } from 'antd/lib/radio'
 | 
	
		
			
				|  |  |  import { ColumnsType } from 'antd/lib/table'
 | 
	
		
			
				|  |  |  import { observer } from 'mobx-react'
 | 
	
		
			
				|  |  |  import React, { KeyboardEvent, useEffect, useRef, useState } from 'react'
 | 
	
		
			
				|  |  | -import { apiGetIncome, apiResfulContractTree, apiUpdateName, apiUpdateSerial } from '../../api'
 | 
	
		
			
				|  |  | -import { apiContractIncome, apiSetTemplate } from '../Modal/api'
 | 
	
		
			
				|  |  | +import { apiSetTemplate } from '../../../Income/components/Modal/api'
 | 
	
		
			
				|  |  | +import { apiGetExpenditure, apiResfulContractTree, apiUpdateName, apiUpdateSerial } from '../../api'
 | 
	
		
			
				|  |  | +import { apiContractExpenditure } from '../Modal/api'
 | 
	
		
			
				|  |  |  import Detail from '../Tabs/Detail'
 | 
	
		
			
				|  |  |  import File from '../Tabs/File'
 | 
	
		
			
				|  |  |  import Receivable from '../Tabs/Receivable'
 | 
	
	
		
			
				|  | @@ -23,22 +24,7 @@ interface iTableContentPorps {
 | 
	
		
			
				|  |  |    row: iIncomeTree
 | 
	
		
			
				|  |  |    setRow: (record: iIncomeTree) => void
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | -interface iTemplateState {
 | 
	
		
			
				|  |  | -  attribution: string
 | 
	
		
			
				|  |  | -  children: iTemplateState[] | undefined
 | 
	
		
			
				|  |  | -  depth: number
 | 
	
		
			
				|  |  | -  id: number
 | 
	
		
			
				|  |  | -  isEnd: boolean
 | 
	
		
			
				|  |  | -  leaf: boolean
 | 
	
		
			
				|  |  | -  name: string
 | 
	
		
			
				|  |  | -  parentId: number
 | 
	
		
			
				|  |  | -  serial: string
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  | -interface iShowTemplateState {
 | 
	
		
			
				|  |  | -  isShow: boolean
 | 
	
		
			
				|  |  | -  template: string
 | 
	
		
			
				|  |  | -  loading: boolean
 | 
	
		
			
				|  |  | -}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const GCsheet: React.FC<iTableContentPorps> = ({ modalHandler, row, setRow }) => {
 | 
	
		
			
				|  |  |    const [ sectionTemplate, setSectionTemplate ] = useState<iShowTemplateState>({
 | 
	
	
		
			
				|  | @@ -80,7 +66,7 @@ const GCsheet: React.FC<iTableContentPorps> = ({ modalHandler, row, setRow }) =>
 | 
	
		
			
				|  |  |      initHandler()
 | 
	
		
			
				|  |  |    }, [])
 | 
	
		
			
				|  |  |    const initHandler = async () => {
 | 
	
		
			
				|  |  | -    const data  = await apiContractIncome(tenderStore.bid)
 | 
	
		
			
				|  |  | +    const data  = await apiContractExpenditure(tenderStore.bid)
 | 
	
		
			
				|  |  |      if (data.code === consts.RET_CODE.SUCCESS) {
 | 
	
		
			
				|  |  |        if (data.isTemplate && data.isTemplate === 1) {
 | 
	
		
			
				|  |  |          setSectionTemplate({
 | 
	
	
		
			
				|  | @@ -93,7 +79,7 @@ const GCsheet: React.FC<iTableContentPorps> = ({ modalHandler, row, setRow }) =>
 | 
	
		
			
				|  |  |            template2: data.sectionTemplate2
 | 
	
		
			
				|  |  |          })
 | 
	
		
			
				|  |  |        } else {
 | 
	
		
			
				|  |  | -        contractStore.updateTree(data.sectionTree.children)
 | 
	
		
			
				|  |  | +        contractPaidStore.updateTree(data.sectionTree.children)
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
	
		
			
				|  | @@ -116,7 +102,7 @@ const GCsheet: React.FC<iTableContentPorps> = ({ modalHandler, row, setRow }) =>
 | 
	
		
			
				|  |  |        RET_CODE = code
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      if (RET_CODE === consts.RET_CODE.SUCCESS) {
 | 
	
		
			
				|  |  | -      contractStore.resetTree(tenderStore.tender.bidsectionId)
 | 
	
		
			
				|  |  | +      contractPaidStore.resetTree(tenderStore.tender.bidsectionId)
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -203,8 +189,8 @@ const GCsheet: React.FC<iTableContentPorps> = ({ modalHandler, row, setRow }) =>
 | 
	
		
			
				|  |  |        render: (text:any, record: iIncomeTree) => record.contractCode ? <span>{text}</span> : ''
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  | -      title: '回款金额',
 | 
	
		
			
				|  |  | -      dataIndex: 'contractReturned',
 | 
	
		
			
				|  |  | +      title: '支出金额',
 | 
	
		
			
				|  |  | +      dataIndex: 'contractPaid',
 | 
	
		
			
				|  |  |        align: 'right',
 | 
	
		
			
				|  |  |        // eslint-disable-next-line react/display-name
 | 
	
		
			
				|  |  |        render: (text:any, record: iIncomeTree) => record.contractCode ? <span>{text}</span> : ''
 | 
	
	
		
			
				|  | @@ -231,7 +217,7 @@ const GCsheet: React.FC<iTableContentPorps> = ({ modalHandler, row, setRow }) =>
 | 
	
		
			
				|  |  |        })
 | 
	
		
			
				|  |  |        return message.error('请选择项目节模板!')
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -    const { code = -1 } = await apiSetTemplate(sectionTemplate.template, tenderStore.tender.bidsectionId)
 | 
	
		
			
				|  |  | +    const { code = -1 } = await apiSetTemplate(sectionTemplate.template, tenderStore.tender.bidsectionId, 1)
 | 
	
		
			
				|  |  |      if (code === consts.RET_CODE.SUCCESS) {
 | 
	
		
			
				|  |  |        await initHandler()
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -257,7 +243,7 @@ const GCsheet: React.FC<iTableContentPorps> = ({ modalHandler, row, setRow }) =>
 | 
	
		
			
				|  |  |          rowClickHandler(record.id, record.bidsectionId, record.isEdit, record.isNew)
 | 
	
		
			
				|  |  |        },
 | 
	
		
			
				|  |  |        onDoubleClick() {
 | 
	
		
			
				|  |  | -        contractStore.rowChange(row.id)
 | 
	
		
			
				|  |  | +        contractPaidStore.rowChange(row.id)
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
	
		
			
				|  | @@ -265,10 +251,10 @@ const GCsheet: React.FC<iTableContentPorps> = ({ modalHandler, row, setRow }) =>
 | 
	
		
			
				|  |  |    // 行点击回调
 | 
	
		
			
				|  |  |    const rowClickHandler = async (id: string, bid: string, isEdit?: boolean, isNew?: boolean) => {
 | 
	
		
			
				|  |  |      if (!isEdit && !isNew) {
 | 
	
		
			
				|  |  | -      const { code = -1, section = {}, contract: newContract = {} } = await apiGetIncome(id, bid)
 | 
	
		
			
				|  |  | +      const { code = -1, section = {}, contract: newContract = {} } = await apiGetExpenditure(id, bid)
 | 
	
		
			
				|  |  |        if (code === consts.RET_CODE.SUCCESS) {
 | 
	
		
			
				|  |  |          setRow(section)
 | 
	
		
			
				|  |  | -        contractStore.updateContract(newContract)
 | 
	
		
			
				|  |  | +        contractPaidStore.updateContract(newContract)
 | 
	
		
			
				|  |  |        }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
	
		
			
				|  | @@ -276,7 +262,7 @@ const GCsheet: React.FC<iTableContentPorps> = ({ modalHandler, row, setRow }) =>
 | 
	
		
			
				|  |  |      return record.id === row.id ? 'ant-table-row-selected' : ''
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |    const tabOnClick = (key: string) => {
 | 
	
		
			
				|  |  | -    contractStore.changeUpdate(key)
 | 
	
		
			
				|  |  | +    contractPaidStore.changeUpdate(key)
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    // 阿里oss上传弹窗
 | 
	
	
		
			
				|  | @@ -285,7 +271,7 @@ const GCsheet: React.FC<iTableContentPorps> = ({ modalHandler, row, setRow }) =>
 | 
	
		
			
				|  |  |      const { code = -1 } = await apiSaveFileInfo(fileList, consts.DATA_TYPE.CONTRACT, row.contractId)
 | 
	
		
			
				|  |  |      if (code === consts.RET_CODE.SUCCESS) {
 | 
	
		
			
				|  |  |        setVisible(false)
 | 
	
		
			
				|  |  | -      contractStore.changeUpdate('3')
 | 
	
		
			
				|  |  | +      contractPaidStore.changeUpdate('3')
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |    }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -352,9 +338,9 @@ const GCsheet: React.FC<iTableContentPorps> = ({ modalHandler, row, setRow }) =>
 | 
	
		
			
				|  |  |    <div className={styles.spreadContent}>
 | 
	
		
			
				|  |  |      <div className={styles.spreadSheets}>
 | 
	
		
			
				|  |  |        {
 | 
	
		
			
				|  |  | -        contractStore.showTable ?
 | 
	
		
			
				|  |  | +        contractPaidStore.showTable ?
 | 
	
		
			
				|  |  |            <Table<iIncomeTree>
 | 
	
		
			
				|  |  | -            dataSource={contractStore.tree}
 | 
	
		
			
				|  |  | +            dataSource={contractPaidStore.tree}
 | 
	
		
			
				|  |  |              columns={TableColumns}
 | 
	
		
			
				|  |  |              bordered
 | 
	
		
			
				|  |  |              pagination={false}
 | 
	
	
		
			
				|  | @@ -376,30 +362,30 @@ const GCsheet: React.FC<iTableContentPorps> = ({ modalHandler, row, setRow }) =>
 | 
	
		
			
				|  |  |          tabBarExtraContent={{ right:
 | 
	
		
			
				|  |  |            <div className="pi-mg-right-5 pi-flex-row">
 | 
	
		
			
				|  |  |              {
 | 
	
		
			
				|  |  | -              contractStore.contract.id && contractStore.contract.status === contractConsts.status.checking ?
 | 
	
		
			
				|  |  | +              contractPaidStore.contract.id && contractPaidStore.contract.status === contractConsts.status.checking ?
 | 
	
		
			
				|  |  |                <>
 | 
	
		
			
				|  |  |                  <Button type="primary" size="small" onClick={() => modalHandler('update')} className="pi-mg-right-5">编辑合同</Button>
 | 
	
		
			
				|  |  | -                <Button type="primary" size="small" onClick={() => modalHandler('return')} className="pi-mg-right-5">添加回款</Button>
 | 
	
		
			
				|  |  | +                <Button type="primary" size="small" onClick={() => modalHandler('return')} className="pi-mg-right-5">添加支出</Button>
 | 
	
		
			
				|  |  |                  <Button type="primary" size="small" onClick={() => setVisible(true)}>上传文件</Button>
 | 
	
		
			
				|  |  |                </>
 | 
	
		
			
				|  |  |                : ''
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              {
 | 
	
		
			
				|  |  | -              contractStore.contract.id && contractStore.contract.status === contractConsts.status.willClose ?
 | 
	
		
			
				|  |  | +              contractPaidStore.contract.id && contractPaidStore.contract.status === contractConsts.status.willClose ?
 | 
	
		
			
				|  |  |                <Button type="primary" size="small" danger className="pi-mg-right-3" onClick={() => modalHandler('close')}>关闭合同</Button>
 | 
	
		
			
				|  |  |                : ''
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              {
 | 
	
		
			
				|  |  | -              contractStore.contract.id && contractStore.contract.status === contractConsts.status.closed ?
 | 
	
		
			
				|  |  | +              contractPaidStore.contract.id && contractPaidStore.contract.status === contractConsts.status.closed ?
 | 
	
		
			
				|  |  |                <ZhSubmitButton type="primary" size="small" danger className="pi-mg-right-3" onClick={() => modalHandler('unlock')}>解锁合同</ZhSubmitButton>
 | 
	
		
			
				|  |  |                : ''
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |            </div>
 | 
	
		
			
				|  |  |          }}>
 | 
	
		
			
				|  |  |          <TabPane key="1" tab="合同详情">
 | 
	
		
			
				|  |  | -          <Detail {...contractStore.contract}></Detail>
 | 
	
		
			
				|  |  | +          <Detail {...contractPaidStore.contract}></Detail>
 | 
	
		
			
				|  |  |          </TabPane>
 | 
	
		
			
				|  |  | -        <TabPane key="2" tab="合同回款">
 | 
	
		
			
				|  |  | +        <TabPane key="2" tab="合同支出">
 | 
	
		
			
				|  |  |            <Receivable></Receivable>
 | 
	
		
			
				|  |  |          </TabPane>
 | 
	
		
			
				|  |  |          <TabPane key="3" tab="合同文件">
 |