diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue
index 1ed6736..8ab21fc 100644
--- a/src/views/contract/contractList.vue
+++ b/src/views/contract/contractList.vue
@@ -431,12 +431,12 @@
-
+
-
@@ -910,9 +911,7 @@ export default {
width: 320,
align: "left",
customFn: (row) => {
- return row.money_way_detail.map(item => {
- return `
${item.value}
`
- }).join('')
+ return row.money_way_detail.map(item => item.value).join(',')
}
},
{
@@ -920,9 +919,7 @@ export default {
width: 320,
align: "left",
customFn: (row) => {
- return row.plans.map(item => {
- return `
[${item.year}] - ${item.name}
`
- }).join('')
+ return row.plans.map(item => `[${item.year}] - ${item.name}`).join(',')
}
},
{
@@ -948,7 +945,7 @@ export default {
width: 140,
customFn: (row) => {
let per = ((((row.fund_log_total) / row.money) || 0) * 100)?.toFixed(2) || 0
- return `
${per}%
`
+ return `${per}%`
}
},
{
@@ -1041,9 +1038,7 @@ export default {
minWidth: 200,
prop: "contract_carry_department",
customFn: row => {
- return row.contract_carry_department.map(i => {
- return `
${i.carry_department.name}`
- }).join('')
+ return row.contract_carry_department.map(i => i.carry_department.name).join(',')
}
}
],
@@ -1754,48 +1749,53 @@ export default {
},
//提交新建
async submit() {
- try {
- // 获取分类配置
- const res = await getContractCategoryTemplateBaseConfig()
- if (res.errcode !== undefined) {
- this.$message.error(res.errmsg || '获取分类配置失败')
- return
- }
-
- // 保存采购方式映射
- this.purchaseMethodsMap = res.purchase_methods || {}
-
- // 设置分类选项 - 从第二级开始(合同类、报销类、其他支出类)
- this.categoryOptions = res.map?.[0]?.children || []
-
- // 递归处理每一层的 children,确保所有层级都被正确解析
- const processChildren = (items) => {
- if (!items) return
- items.forEach(item => {
- if (item.children) {
- // 确保每个子项都有正确的 id 和 name
- item.children = item.children.map(child => ({
- id: child.id,
- name: child.name || child.value, // 添加对 value 字段的支持
- children: child.children || []
- }))
- processChildren(item.children)
- }
- })
- }
+ addContrant({
+ // 第一步的数据
+ category: this.form.category,
+ work_type: this.form.affairType,
+ contract_type: this.form.contractType,
+ purchase_form: this.form.purchaseForm,
+ purchase_sub_form: this.form.purchaseSubForm,
+ purchase_method: this.form.purchaseMethod,
- // 处理所有层级的 children
- processChildren(this.categoryOptions)
+ // 第二步的数据
+ type: this.form.type,
+ is_plan: this.form.isBudget ? 1 : 0,
+ purchase_type_id: this.form.methods,
+ purchase_way_id: this.form.modality,
+ money_way_id: `${this.form.moneyWay.toString()}`,
+ plan_price: this.form.price,
+ name: this.form.name,
+ contract_plan_links: this.form.plan.map(item => {
+ return item.value
+ }),
+ is_substitute: this.form.is_substitute,
+ is_simple: this.form.is_simple,
+ has_charge: this.form.has_charge,
+ supply: this.form.supply,
+ money: this.form.money,
+ status: this.form.is_simple ? 2 : 1,
+ gov_plane_id: this.form.gov_plane_id,
+ contract_carry_department: this.form.contract_carry_department?.map(i => ({carry_department_id: i})) || [],
- // 重置表单
+ // 第三步的数据
+ before_contract_template: this.form.before_contract_template,
+ contract_template: this.form.contract_template
+ }).then(res => {
+ this.isShowAdd = false
+ Message({
+ type: 'success',
+ message: '操作成功'
+ })
this.resetForm()
-
- // 打开模态框
- this.isShowAdd = true
- } catch (error) {
- console.error('获取分类配置失败:', error)
- this.$message.error('获取分类配置失败')
- }
+ this.$refs.planTable?.clearSelection()
+ this.getContracts()
+ }).catch(error => {
+ Message({
+ type: 'error',
+ message: error.message || '提交失败'
+ })
+ })
},
//删除合同
@@ -1891,7 +1891,16 @@ export default {
nextStep() {
// 验证当前步骤的表单
- if (this.currentStep === 2) {
+ if (this.currentStep === 1) {
+ // 验证第一步的必填项
+ if (!this.form.category || !this.form.affairType || !this.form.contractType ||
+ !this.form.purchaseForm || !this.form.purchaseMethod) {
+ this.$Message.warning('请填写所有必填项')
+ return
+ }
+ // 获取模版配置
+ this.getTemplateConfig()
+ } else if (this.currentStep === 2) {
this.$refs.basicInfoForm.validate((valid) => {
if (valid) {
// 如果显示预算计划字段,需要验证是否选择了预算计划
@@ -1911,7 +1920,13 @@ export default {
},
prevStep() {
- this.currentStep--
+ if (this.currentStep === 3 && this.form.showAfterPayment && this.form.before_contract_template) {
+ // 如果在事后支付表格且有事前支付表格,则返回事前支付表格
+ this.form.showAfterPayment = false
+ } else {
+ // 其他情况正常返回上一步
+ this.currentStep--
+ }
},
validateCurrentStep() {
@@ -1949,7 +1964,10 @@ export default {
purchase_form: this.form.purchaseForm
}
+ console.log('请求模版配置参数:', params)
const res = await getContractCategoryTemplateConfigParams(params)
+ console.log('模版配置返回数据:', res)
+
if (res.errcode !== undefined) {
this.$message.error(res.errmsg || '获取模版配置失败')
return
@@ -2042,7 +2060,8 @@ export default {
ratio: '',
payee: ''
}
- ]
+ ],
+ showAfterPayment: false // 是否显示事后支付表格
}
this.affairTypeOptions = []
@@ -2206,6 +2225,10 @@ export default {
// 更新显示文本
this.form.plan_display = this.plan.map(p => p.label).join(', ')
},
+ // 切换到事后支付表格
+ nextPaymentStep() {
+ this.form.showAfterPayment = true
+ },
},
mounted() {
this.window.width = screen.availWidth * 0.95