fix:支出合同和收入合同的完善
This commit is contained in:
parent
80353e44bf
commit
e4141a05cc
|
@ -88,6 +88,21 @@
|
||||||
/>
|
/>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
</GiPageLayout>
|
</GiPageLayout>
|
||||||
|
|
||||||
|
<!-- 新建合同弹窗 -->
|
||||||
|
<a-modal
|
||||||
|
v-model:visible="showAddModal"
|
||||||
|
title="新建合同"
|
||||||
|
:width="800"
|
||||||
|
@cancel="closeAddModal"
|
||||||
|
@before-ok="handleAddSubmit"
|
||||||
|
>
|
||||||
|
<ContractEdit
|
||||||
|
v-if="showAddModal"
|
||||||
|
:contract-data="newContractData"
|
||||||
|
@update:contract-data="handleNewContractDataUpdate"
|
||||||
|
/>
|
||||||
|
</a-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
@ -303,13 +318,70 @@ const onPageSizeChange = (size: number) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 操作方法
|
// 操作方法
|
||||||
|
const showAddModal = ref(false)
|
||||||
|
const newContractData = ref<ContractItem>({
|
||||||
|
contractId: '', customer: '', code: '', projectId: '', type: '收入合同',
|
||||||
|
productService: '', paymentDate: null, performanceDeadline: null,
|
||||||
|
paymentAddress: '', amount: 0, accountNumber: '', notes: '',
|
||||||
|
contractStatus: '未确认', contractText: '', projectName: '',
|
||||||
|
salespersonName: null, salespersonDeptName: '', settlementAmount: null,
|
||||||
|
receivedAmount: null, contractStatusLabel: null, createBy: null, updateBy: null,
|
||||||
|
createTime: '', updateTime: '', page: 1, pageSize: 10, signDate: '', duration: '',
|
||||||
|
} as any)
|
||||||
|
|
||||||
const openAddModal = () => {
|
const openAddModal = () => {
|
||||||
Message.info('新建合同功能开发中...')
|
Object.assign(newContractData.value, {
|
||||||
|
contractId: '', customer: '', code: '', projectId: '', type: '收入合同',
|
||||||
|
productService: '', paymentDate: null, performanceDeadline: null,
|
||||||
|
paymentAddress: '', amount: 0, accountNumber: '', notes: '',
|
||||||
|
contractStatus: '未确认', contractText: '', projectName: '',
|
||||||
|
salespersonName: null, salespersonDeptName: '', settlementAmount: null,
|
||||||
|
receivedAmount: null, contractStatusLabel: null, createBy: null, updateBy: null,
|
||||||
|
createTime: '', updateTime: '', page: 1, pageSize: 10, signDate: '', duration: '',
|
||||||
|
})
|
||||||
|
showAddModal.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const exportContract = () => {
|
const closeAddModal = () => { showAddModal.value = false }
|
||||||
Message.info('导出合同功能开发中...')
|
|
||||||
|
const handleNewContractDataUpdate = (data: ContractItem) => { Object.assign(newContractData.value, data) }
|
||||||
|
|
||||||
|
const handleAddSubmit = async () => {
|
||||||
|
try {
|
||||||
|
const payload: any = {
|
||||||
|
accountNumber: newContractData.value.accountNumber || '',
|
||||||
|
amount: newContractData.value.amount || 0,
|
||||||
|
code: newContractData.value.code || '',
|
||||||
|
contractStatus: newContractData.value.contractStatus || '',
|
||||||
|
contractText: newContractData.value.contractText || '',
|
||||||
|
customer: newContractData.value.customer || '',
|
||||||
|
departmentId: (newContractData.value as any).departmentId || '',
|
||||||
|
duration: newContractData.value.duration || '',
|
||||||
|
notes: newContractData.value.notes || '',
|
||||||
|
paymentAddress: newContractData.value.paymentAddress || '',
|
||||||
|
paymentDate: newContractData.value.paymentDate || null,
|
||||||
|
performanceDeadline: newContractData.value.performanceDeadline || null,
|
||||||
|
productService: newContractData.value.productService || '',
|
||||||
|
projectId: newContractData.value.projectId || '',
|
||||||
|
salespersonId: (newContractData.value as any).salespersonId || '',
|
||||||
|
signDate: newContractData.value.signDate || null,
|
||||||
|
type: newContractData.value.type || '收入合同',
|
||||||
}
|
}
|
||||||
|
if (!newContractData.value.contractId) delete payload.contractId
|
||||||
|
const response = await http.post('/contract', payload)
|
||||||
|
if ((response as any).status === 200 && response.code === 200) {
|
||||||
|
Message.success('新建合同成功'); closeAddModal(); search(); return true
|
||||||
|
}
|
||||||
|
if (response.code === 200) { Message.success('新建合同成功'); closeAddModal(); search(); return true }
|
||||||
|
Message.error(response.msg || '新建合同失败'); return false
|
||||||
|
} catch (error: any) {
|
||||||
|
console.error('新建合同失败:', error)
|
||||||
|
Message.error('新建合同失败: ' + (error?.message || '请稍后再试'))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const exportContract = () => { Message.info('导出合同功能开发中...') }
|
||||||
|
|
||||||
// 显示合同编辑弹窗
|
// 显示合同编辑弹窗
|
||||||
const showEditModal = ref(false)
|
const showEditModal = ref(false)
|
||||||
|
|
Loading…
Reference in New Issue