|
@@ -2,6 +2,7 @@ import Authorization from '@/components/Authorization'
|
|
|
import DatePicker from '@/components/DatePicker'
|
|
|
import MoneyInput from '@/components/MoneyInput'
|
|
|
import { contractStore, tenderStore } from '@/store/mobx'
|
|
|
+import { ContractType } from '@/store/mobx/contract'
|
|
|
import { iModalCommonProps } from '@/types/contract'
|
|
|
import { apiContractSection } from '@/utils/common/api'
|
|
|
import { contractTreeBaseId } from '@/utils/common/constStatus'
|
|
@@ -74,15 +75,15 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
|
|
|
cancelText: '取消',
|
|
|
okText: '确认解锁'
|
|
|
},
|
|
|
- return: {
|
|
|
- title: contractType === 'income' ? '添加回款' : '添加支出',
|
|
|
+ add: {
|
|
|
+ title: contractType === ContractType.INCOME ? '添加回款' : '添加支付',
|
|
|
cancelText: '关闭',
|
|
|
okText: '确认'
|
|
|
}
|
|
|
}
|
|
|
|
|
|
const initTreeSection = async () => {
|
|
|
- const { code = -1, sectionTree: data = {} } = await apiContractSection(tenderStore.bid, contractType === 'income' ? consts.CONTRACT_TREE.RETURN : consts.CONTRACT_TREE.PAID)
|
|
|
+ const { code = -1, sectionTree: data = {} } = await apiContractSection(tenderStore.bid, contractType === ContractType.INCOME ? consts.CONTRACT_TREE.RETURN : consts.CONTRACT_TREE.PAID)
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
setContractSection(data.children)
|
|
|
}
|
|
@@ -99,7 +100,7 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
|
|
|
if (type === 'update') {
|
|
|
const { content = '', name = '', price = '', partyA = '', partyB = '', partyASigner = '', partyBSigner = '', signerTime = '', remarks = '' } = contractStore.contract
|
|
|
form.setFieldsValue({ content, name, price, partyA, partyB, partyASigner, partyBSigner, signerTime: signerTime ? dayjs(signerTime) : '', remarks })
|
|
|
- } else if (type === 'return') {
|
|
|
+ } else if (type === 'add') {
|
|
|
apiGetReturnWay().then(({ code = -1, data = [] }) => {
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
const options = data.map((item: string) => (
|
|
@@ -117,7 +118,7 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
|
|
|
}
|
|
|
}, [ visible ])
|
|
|
const autoCode = async () => {
|
|
|
- const ruleArr = await handleAutoCode(tenderStore.tender.bidsectionId, contractType === 'income' ? 'contractReturnRule' : 'contractPaidRule')
|
|
|
+ const ruleArr = await handleAutoCode(tenderStore.tender.bidsectionId, contractType === ContractType.INCOME ? 'contractReturnRule' : 'contractPaidRule')
|
|
|
form.setFieldsValue({ code: ruleArr.join('-') })
|
|
|
}
|
|
|
|
|
@@ -170,7 +171,7 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
|
|
|
if (type === 'del') {
|
|
|
delete values.warningText
|
|
|
}
|
|
|
- if (type === 'return') {
|
|
|
+ if (type === 'add') {
|
|
|
values.time = dayjsFormat(values.time, 'YYYY-MM-DD HH:mm:ss')
|
|
|
}
|
|
|
onConfirm(values, type)
|
|
@@ -299,15 +300,15 @@ const ContractModal: React.FC<iModalCommonProps> = ({ modalObj: { type, visible,
|
|
|
) : (
|
|
|
''
|
|
|
)}
|
|
|
- {type === 'return' ? (
|
|
|
+ {type === 'add' ? (
|
|
|
<>
|
|
|
<Form.Item name="contractsId" hidden>
|
|
|
<Input />
|
|
|
</Form.Item>
|
|
|
- <Form.Item name="time" label="回款日期" rules={[ { required: true, message: '请选择回款日期' } ]}>
|
|
|
+ <Form.Item name="time" label={`${contractType === ContractType.INCOME ? '回款' : '支付'}日期`} rules={[ { required: true, message: '请选择回款日期' } ]}>
|
|
|
<DatePicker allowClear locale={locale} className="pi-width-100P" />
|
|
|
</Form.Item>
|
|
|
- <Form.Item label="回款金额" >
|
|
|
+ <Form.Item label={`${contractType === ContractType.INCOME ? '回款' : '支付'}金额`} >
|
|
|
{/* <Input onChange={handleReturnPrice}/> */}
|
|
|
<MoneyInput size="small" maxPrice={handleMaxPrice()} setValue={(val: string | null) => form.setFieldsValue({ price: val })}/>
|
|
|
</Form.Item>
|