|
|
|
|
@ -26,6 +26,10 @@
|
|
|
|
|
<el-icon><Refresh /></el-icon>
|
|
|
|
|
重置
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button type="primary" @click="openCreateForm">
|
|
|
|
|
<el-icon><Document /></el-icon>
|
|
|
|
|
新增合同
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button type="success" @click="openImportDialog">
|
|
|
|
|
<el-icon><Upload /></el-icon>
|
|
|
|
|
历史合同导入
|
|
|
|
|
@ -148,7 +152,7 @@
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="fund_source" label="计划资金来源" width="200" show-overflow-tooltip>
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
{{ row.fund_source_budget_data?.name || row.fund_source || '-' }}
|
|
|
|
|
{{ row.fund_source_display || row.fund_source_budget_data?.name || '-' }}
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column prop="actual_fund_sources" label="实际资金来源" width="300" show-overflow-tooltip>
|
|
|
|
|
@ -217,7 +221,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
|
|
<el-drawer v-model="drawerVisible" title="合同" size="75%">
|
|
|
|
|
<el-drawer v-model="drawerVisible" :title="drawerTitle" size="75%">
|
|
|
|
|
<el-form :model="form" :rules="rules" ref="formRef" label-width="140px">
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
@ -512,7 +516,7 @@
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button type="primary" :loading="saving" @click="handleSubmit">保存</el-button>
|
|
|
|
|
<el-button type="primary" :loading="saving" @click="handleSubmit">{{ submitButtonText }}</el-button>
|
|
|
|
|
<el-button @click="drawerVisible = false">取消</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
@ -543,7 +547,7 @@
|
|
|
|
|
{{ viewData.fund_source_year?.year ? viewData.fund_source_year.year + '年' : (viewData.fund_source_budget_data?.budget_year?.year ? viewData.fund_source_budget_data.budget_year.year + '年' : '-') }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="计划资金来源" :span="2">
|
|
|
|
|
{{ viewData.fund_source_budget_data?.name || viewData.fund_source || '-' }}
|
|
|
|
|
{{ viewData.fund_source_display || viewData.fund_source_budget_data?.name || '-' }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="实际资金来源" :span="2">
|
|
|
|
|
<span v-if="viewData.actual_fund_sources && viewData.actual_fund_sources.length > 0">
|
|
|
|
|
@ -1249,6 +1253,9 @@ const viewData = ref(null)
|
|
|
|
|
const formRef = ref(null)
|
|
|
|
|
const form = reactive(getEmptyForm())
|
|
|
|
|
const payPlanDeleteIds = ref([])
|
|
|
|
|
const isCreateMode = computed(() => !form.id)
|
|
|
|
|
const drawerTitle = computed(() => (isCreateMode.value ? '新增合同' : '编辑合同'))
|
|
|
|
|
const submitButtonText = computed(() => (isCreateMode.value ? '创建' : '保存'))
|
|
|
|
|
|
|
|
|
|
// 采购类别维护相关
|
|
|
|
|
// 类型维护相关状态
|
|
|
|
|
@ -1720,6 +1727,24 @@ function getEmptyForm() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function resetContractForm({ withDefaultPayPlan = false } = {}) {
|
|
|
|
|
Object.assign(form, getEmptyForm())
|
|
|
|
|
payPlanDeleteIds.value = []
|
|
|
|
|
attachmentFileList.value = []
|
|
|
|
|
inferredAttachmentInfo.value = null
|
|
|
|
|
fundSourceOptions.value = []
|
|
|
|
|
|
|
|
|
|
if (withDefaultPayPlan) {
|
|
|
|
|
form.pay_plans = [
|
|
|
|
|
{
|
|
|
|
|
phase_no: 1,
|
|
|
|
|
due_date: '',
|
|
|
|
|
amount_plan: 0
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function fetchList() {
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
|
|
|
|
@ -2220,13 +2245,18 @@ function openForm(row) {
|
|
|
|
|
ElMessage.warning('请选择要编辑的合同')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
Object.assign(form, getEmptyForm())
|
|
|
|
|
payPlanDeleteIds.value = []
|
|
|
|
|
attachmentFileList.value = []
|
|
|
|
|
inferredAttachmentInfo.value = null
|
|
|
|
|
resetContractForm()
|
|
|
|
|
loadDetail(row.id)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function openCreateForm() {
|
|
|
|
|
resetContractForm({ withDefaultPayPlan: true })
|
|
|
|
|
drawerVisible.value = true
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
formRef.value?.clearValidate()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function loadDetail(id) {
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
|
|
|
|
@ -2324,6 +2354,9 @@ async function loadDetail(id) {
|
|
|
|
|
|
|
|
|
|
Object.assign(form, data, { pay_plans: data.pay_plans || [] })
|
|
|
|
|
drawerVisible.value = true
|
|
|
|
|
nextTick(() => {
|
|
|
|
|
formRef.value?.clearValidate()
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
ElMessage.error(response?.msg || '获取详情失败')
|
|
|
|
|
}
|
|
|
|
|
@ -2449,13 +2482,11 @@ function handleSubmit() {
|
|
|
|
|
saving.value = true
|
|
|
|
|
try {
|
|
|
|
|
const payload = collectPayload()
|
|
|
|
|
if (!form.id) {
|
|
|
|
|
ElMessage.error('不支持新建合同,请选择已有合同编辑')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
const response = await request.put(`/budget/contracts/${form.id}`, payload)
|
|
|
|
|
const response = form.id
|
|
|
|
|
? await contractAPI.update(form.id, payload)
|
|
|
|
|
: await contractAPI.create(payload)
|
|
|
|
|
if (response && response.code === 0) {
|
|
|
|
|
ElMessage.success('更新成功')
|
|
|
|
|
ElMessage.success(form.id ? '更新成功' : '创建成功')
|
|
|
|
|
drawerVisible.value = false
|
|
|
|
|
fetchList()
|
|
|
|
|
} else {
|
|
|
|
|
|