完成合同新增创建

master
lynn 8 months ago
parent fbddbf82cd
commit d591f28b36

@ -431,12 +431,12 @@
<!-- Step 3: Attachment Information -->
<div v-show="currentStep === 3" class="step-content">
<!-- 事前支付表格 -->
<div v-if="form.before_contract_template" class="form-section">
<div v-if="form.before_contract_template && !form.showAfterPayment" class="form-section">
<div class="section-title">事前支付表格</div>
<div v-html="form.before_contract_template.template"></div>
</div>
<!-- 事后支付表格 -->
<div v-else-if="form.contract_template" class="form-section">
<div v-else-if="form.contract_template && form.showAfterPayment" class="form-section">
<div class="section-title">事后支付表格</div>
<div v-html="form.contract_template.template"></div>
</div>
@ -447,7 +447,8 @@
<div class="modal-footer">
<Button v-if="currentStep > 1" @click="prevStep" class="action-button"></Button>
<Button v-if="currentStep < 3" type="primary" @click="nextStep" class="action-button"></Button>
<Button v-if="currentStep === 3" type="primary" @click="submit" class="action-button"></Button>
<Button v-if="currentStep === 3 && form.before_contract_template && !form.showAfterPayment" type="primary" @click="nextPaymentStep" class="action-button"></Button>
<Button v-if="currentStep === 3 && form.contract_template && form.showAfterPayment" type="primary" @click="submit" class="action-button"></Button>
<Button @click="cancel" class="action-button">取消</Button>
</div>
</div>
@ -910,9 +911,7 @@ export default {
width: 320,
align: "left",
customFn: (row) => {
return row.money_way_detail.map(item => {
return `<div>${item.value}</div>`
}).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 `<div>[${item.year}] - ${item.name}</div>`
}).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 `<div style="color: ${per > 100 ? 'red' : 'green'}">${per}%</div>`
return `${per}%`
}
},
{
@ -1041,9 +1038,7 @@ export default {
minWidth: 200,
prop: "contract_carry_department",
customFn: row => {
return row.contract_carry_department.map(i => {
return `<Tag color="primary">${i.carry_department.name}</Tag>`
}).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

Loading…
Cancel
Save