fix:支出合同和收入合同的完善,修复了一些bug
This commit is contained in:
parent
33eb03121d
commit
baef368840
|
@ -50,6 +50,11 @@
|
|||
<a-descriptions-item label="备注">
|
||||
{{ contractDetail.notes }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="合同内容">
|
||||
<a-typography-paragraph :ellipsis="{ rows: 5, expandable: true, collapseText: '收起', suffix: '' }">
|
||||
{{ contractDetail.contractText || '—' }}
|
||||
</a-typography-paragraph>
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</div>
|
||||
<div v-else-if="!loading" class="empty-container">
|
||||
|
|
|
@ -7,16 +7,8 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item field="projectId" label="项目">
|
||||
<a-select v-model="contractData.projectId"
|
||||
:options="projectOptions"
|
||||
:loading="projectLoading"
|
||||
:virtual-list-props="virtualListProps"
|
||||
placeholder="请选择项目"
|
||||
allow-search allow-clear
|
||||
@focus="handleProjectFocus"
|
||||
@dropdown-visible-change="handleProjectDropdown"
|
||||
@search="handleProjectSearch" />
|
||||
<a-form-item field="projectName" label="项目">
|
||||
<a-input v-model="contractData.projectName" placeholder="请输入项目名称" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
|
|
@ -426,7 +426,8 @@ const handleAddSubmit = async () => {
|
|||
paymentDate: newContractData.value.paymentDate || null,
|
||||
performanceDeadline: newContractData.value.performanceDeadline || null,
|
||||
productService: newContractData.value.productService || '',
|
||||
projectId: newContractData.value.projectId || '',
|
||||
// 新建时不传 projectId,而是传项目名称,后续立项再建项目
|
||||
projectName: newContractData.value.projectName || '',
|
||||
salespersonId: (newContractData.value as any).salespersonId || '',
|
||||
signDate: newContractData.value.signDate || null,
|
||||
type: newContractData.value.type || '支出合同',
|
||||
|
@ -525,7 +526,7 @@ const handleEditSubmit = async () => {
|
|||
type: editedContractData.value.type || '',
|
||||
};
|
||||
|
||||
console.log('Edited Contract Data:', requestData); // 打印请求数据以便调试
|
||||
// console.log('Edited Contract Data:', requestData); // 打印请求数据以便调试
|
||||
|
||||
// 修改此处,直接向 /contract 发送 PUT 请求
|
||||
const response = await http.put('/contract', requestData);
|
||||
|
|
|
@ -50,6 +50,11 @@
|
|||
<a-descriptions-item label="备注">
|
||||
{{ contractDetail.notes }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="合同内容">
|
||||
<a-typography-paragraph :ellipsis="{ rows: 5, expandable: true, collapseText: '收起', suffix: '' }">
|
||||
{{ contractDetail.contractText || '—' }}
|
||||
</a-typography-paragraph>
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</div>
|
||||
<div v-else-if="!loading" class="empty-container">
|
||||
|
|
|
@ -7,16 +7,8 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<a-form-item field="projectId" label="项目">
|
||||
<a-select v-model="contractData.projectId"
|
||||
:options="projectOptions"
|
||||
:loading="projectLoading"
|
||||
:virtual-list-props="virtualListProps"
|
||||
placeholder="请选择项目"
|
||||
allow-search allow-clear
|
||||
@focus="handleProjectFocus"
|
||||
@dropdown-visible-change="handleProjectDropdown"
|
||||
@search="handleProjectSearch" />
|
||||
<a-form-item field="projectName" label="项目">
|
||||
<a-input v-model="contractData.projectName" placeholder="请输入项目名称" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
|
|
@ -148,38 +148,18 @@ interface ContractItem {
|
|||
|
||||
// 搜索表单
|
||||
const searchForm = reactive({
|
||||
contractName: '',
|
||||
contractCode: '',
|
||||
client: '',
|
||||
status: '',
|
||||
signDate: '',
|
||||
signDateRange: [] as [string, string] | [],
|
||||
page: 1,
|
||||
size: 10,
|
||||
})
|
||||
|
||||
// 查询条件配置
|
||||
const queryFormColumns = [
|
||||
{
|
||||
field: 'contractName',
|
||||
label: '合同名称',
|
||||
type: 'input' as const,
|
||||
props: {
|
||||
placeholder: '请输入合同名称',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'client',
|
||||
label: '客户',
|
||||
type: 'input' as const,
|
||||
props: {
|
||||
placeholder: '请输入客户名称',
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
label: '合同状态',
|
||||
type: 'select' as const,
|
||||
props: {
|
||||
{ field: 'client', label: '客户', type: 'input' as const, props: { placeholder: '请输入客户名称' } },
|
||||
{ field: 'status', label: '合同状态', type: 'select' as const, props: {
|
||||
placeholder: '请选择合同状态',
|
||||
options: [
|
||||
{ label: '未确认', value: '未确认' },
|
||||
|
@ -191,6 +171,10 @@ const queryFormColumns = [
|
|||
],
|
||||
},
|
||||
},
|
||||
{ field: 'signDateRange', label: '签署时间', type: 'range-picker' as const, props: {
|
||||
placeholder: ['开始时间', '结束时间'], showTime: true, format: 'YYYY-MM-DD HH:mm:ss',
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
// 表格列配置
|
||||
|
@ -222,27 +206,39 @@ const fetchContractList = async () => {
|
|||
const params = {
|
||||
page: searchForm.page,
|
||||
pageSize: searchForm.size,
|
||||
contractName: searchForm.contractName,
|
||||
code: searchForm.contractCode,
|
||||
customer: searchForm.client,
|
||||
contractStatus: searchForm.status,
|
||||
signDate: searchForm.signDate,
|
||||
signDateStart: Array.isArray(searchForm.signDateRange) && searchForm.signDateRange.length === 2 ? searchForm.signDateRange[0] : undefined,
|
||||
signDateEnd: Array.isArray(searchForm.signDateRange) && searchForm.signDateRange.length === 2 ? searchForm.signDateRange[1] : undefined,
|
||||
}
|
||||
|
||||
const response = await http.get('/contract/list', params)
|
||||
|
||||
if (response.code === 200) {
|
||||
// 过滤出类型为"收入合同"的数据
|
||||
const allContracts = response.rows || []
|
||||
const revenueContracts = allContracts.filter((item: ContractItem) => item.type === '收入合同')
|
||||
let revenueContracts = allContracts.filter((item: ContractItem) => item.type === '收入合同')
|
||||
|
||||
// 如果后端未按时间段过滤,则在前端兜底过滤
|
||||
const range = Array.isArray(searchForm.signDateRange) && searchForm.signDateRange.length === 2 ? searchForm.signDateRange : null
|
||||
if (range) {
|
||||
const [start, end] = range
|
||||
const s = new Date(start as any).getTime(), e = new Date(end as any).getTime()
|
||||
if (!Number.isNaN(s) && !Number.isNaN(e)) {
|
||||
revenueContracts = revenueContracts.filter((item: ContractItem) => {
|
||||
if (!item.signDate) return false
|
||||
const t = new Date(item.signDate as any).getTime()
|
||||
return !Number.isNaN(t) && t >= s && t <= e
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 计算未收款金额
|
||||
dataList.value = revenueContracts.map((item: ContractItem) => ({
|
||||
...item,
|
||||
pendingAmount: (item.amount || 0) - (item.receivedAmount || 0),
|
||||
}))
|
||||
|
||||
pagination.total = Number.parseInt(response.total) || 0
|
||||
pagination.total = dataList.value.length
|
||||
} else {
|
||||
Message.error(response.msg || '获取合同列表失败')
|
||||
dataList.value = []
|
||||
|
@ -290,11 +286,10 @@ const search = async () => {
|
|||
|
||||
const reset = () => {
|
||||
Object.assign(searchForm, {
|
||||
contractName: '',
|
||||
contractCode: '',
|
||||
client: '',
|
||||
status: '',
|
||||
signDate: '',
|
||||
signDateRange: [],
|
||||
page: 1,
|
||||
size: 10,
|
||||
})
|
||||
|
@ -362,7 +357,8 @@ const handleAddSubmit = async () => {
|
|||
paymentDate: newContractData.value.paymentDate || null,
|
||||
performanceDeadline: newContractData.value.performanceDeadline || null,
|
||||
productService: newContractData.value.productService || '',
|
||||
projectId: newContractData.value.projectId || '',
|
||||
// 新建时不传 projectId,而是传项目名称
|
||||
projectName: newContractData.value.projectName || '',
|
||||
salespersonId: (newContractData.value as any).salespersonId || '',
|
||||
signDate: newContractData.value.signDate || null,
|
||||
type: newContractData.value.type || '收入合同',
|
||||
|
|
Loading…
Reference in New Issue