瀏覽代碼

fix: 收入合同新增、编辑合同数据刷新问题

lanjianrong 4 年之前
父節點
當前提交
5643448d98

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

@@ -6,6 +6,7 @@ import consts from '@/utils/consts'
 import { dayjsFormat } from '@/utils/util'
 import { Button, Form, Input, Modal, Select } from 'antd'
 import locale from 'antd/es/date-picker/locale/zh_CN'
+import dayjs from 'dayjs'
 import React, { useEffect, useState } from 'react'
 import { apiGetReturnWay } from '../Tabs/Receivable/api'
 import styles from './index.module.scss'
@@ -51,8 +52,8 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
     if (visible) {
       form.setFieldsValue({ treeId: row.id, bidsectionId: row.bidsectionId })
       if (type === "update") {
-        const { content="", name="", price="", partyA="", partyB="", partyASigner="",partyBSigner="" } = contractStore.contract
-        form.setFieldsValue({ content, name, price, partyA, partyB, partyASigner, partyBSigner })
+        const { content="", name="", price="", partyA="", partyB="", partyASigner="",partyBSigner="", signerTime = '', remarks = '' } = contractStore.contract
+        form.setFieldsValue({ content, name, price, partyA, partyB, partyASigner, partyBSigner, signerTime: dayjs(signerTime), remarks })
       } else if (type === 'return') {
         apiGetReturnWay().then(({ code = -1, data = [] }) => {
           if (code === consts.RET_CODE.SUCCESS) {
@@ -88,7 +89,7 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
     <Modal
       getContainer={false}
       visible={visible}
-      title={modalObj[type].title}
+      title={modalObj[type]?.title}
       onCancel={onCancel}
       footer={<div className="pi-justify-end">
         {type === 'update' ? <Button type="primary" key="delete" size="small" danger onClick={() => reload('del')}>删除合同</Button> : ''}

+ 3 - 4
src/pages/Contract/Content/Income/index.tsx

@@ -7,7 +7,6 @@ import { contractStore, tenderStore } from '@/store/mobx'
 import { iIncomeTree, iModalBooleanProps } from '@/types/contract'
 import { contractTreeBaseId } from '@/utils/common/constStatus'
 import consts from '@/utils/consts'
-import { SettingOutlined } from '@ant-design/icons'
 import { Button, message, Tooltip } from 'antd'
 import React, { useMemo, useState } from 'react'
 import { apiResfulContract, apiResfulContractTree } from './api'
@@ -21,7 +20,7 @@ interface iModal {
 
 export default function Income() {
   const [ modalObj, setModalObj ] = useState<iModalBooleanProps>({
-    type: 'create',
+    type: '',
     visible: false,
     confirmLoading: false
   })
@@ -59,9 +58,9 @@ export default function Income() {
       ...modalObj,
       confirmLoading: true
     })
-    const { code = -1 } = await apiResfulContract(type, values)
+    const { code = -1, contract = {} } = await apiResfulContract(type, values)
     if (code === consts.RET_CODE.SUCCESS) {
-      // contractStore.updateContract(section)
+      contractStore.updateContract(contract)
       contractStore.resetTree(tenderStore.bid)
       if (type === 'return') {
         contractStore.changeUpdate('2')