修改事后支付表格支持最多选择两个

master
linyongLynn 3 months ago
parent 9909acbb71
commit 8386826a16

@ -128,9 +128,37 @@
<span>{{ scope.row.prePaymentForm || '-' }}</span>
</template>
</el-table-column>
<el-table-column prop="postPaymentForm" label="事后支付表格" width="120">
<el-table-column prop="postPaymentForm" label="事后支付表格" width="200">
<template #default="scope">
<span>{{ scope.row.postPaymentForm || '-' }}</span>
<div v-if="scope.row.postPaymentForm && scope.row.postPaymentForm !== '-'">
<el-tooltip
v-if="scope.row.postPaymentForm.split(',').length > 1"
:content="scope.row.postPaymentForm"
placement="top"
>
<div>
<el-tag
v-for="(form, index) in scope.row.postPaymentForm.split(',')"
:key="index"
size="small"
type="info"
style="margin-right: 4px; margin-bottom: 4px;"
>
{{ form.trim() }}
</el-tag>
</div>
</el-tooltip>
<div v-else>
<el-tag
size="small"
type="info"
style="margin-right: 4px; margin-bottom: 4px;"
>
{{ scope.row.postPaymentForm.trim() }}
</el-tag>
</div>
</div>
<span v-else>-</span>
</template>
</el-table-column>
</el-table-column>
@ -394,7 +422,15 @@
</el-form-item>
<el-form-item label="事后支付表格" prop="postPaymentForm" class="form-section">
<el-select v-model="form.postPaymentForm" placeholder="请选择事后支付表格" class="form-input" clearable>
<el-select
v-model="form.postPaymentForm"
placeholder="请选择事后支付表格最多选择2个"
class="form-input"
multiple
:multiple-limit="2"
collapse-tags
clearable
>
<el-option
v-for="item in paymentFormOptions"
:key="item.id"
@ -402,6 +438,9 @@
:value="item.id"
/>
</el-select>
<div style="font-size: 12px; color: #909399; margin-top: 4px;">
最多可选择2个事后支付表格第一个为contract_template_id第二个为contract_template_id2
</div>
</el-form-item>
<!-- 合同配置选项 -->
@ -586,7 +625,7 @@ export default {
tenderReview: false,
contractSign: false,
prePaymentForm: '', //
postPaymentForm: '', //
postPaymentForm: [], //
is_simple: 0,
has_charge: 0,
isBudget: 0,
@ -651,11 +690,12 @@ export default {
//
async initData() {
try {
//
await this.getTableData()
//
await this.getCategoryOptions()
//
//
await this.getPaymentFormOptions()
//
await this.getTableData()
} catch (error) {
console.error('初始化数据失败:', error)
this.$message.error('初始化数据失败')
@ -664,6 +704,11 @@ export default {
//
async getTableData() {
try {
//
if (this.paymentFormOptions.length === 0) {
await this.getPaymentFormOptions()
}
//
const params = {
page: this.currentPage,
@ -705,9 +750,10 @@ export default {
tenderReview: item.flow_invite || false,
contractSign: item.flow_join || false,
prePaymentForm: item.before_contract_template?.name || '-',
postPaymentForm: item.contract_template?.name || '-',
postPaymentForm: this.formatPostPaymentForms(item.contract_template_id, item.contract_template_id2, item.contract_template),
before_contract_template_id: item.before_contract_template_id,
contract_template_id: item.contract_template_id,
contract_template_id2: item.contract_template_id2,
is_simple_default: item.is_simple_default || 0,
has_charge_default: item.has_charge_default || 0,
is_plan_default: item.is_plan_default || 0,
@ -926,13 +972,9 @@ export default {
this.purchaseFormOptions = []
this.purchaseMethodOptions = []
//
try {
//
if (this.paymentFormOptions.length === 0) {
await this.getPaymentFormOptions()
} catch (error) {
console.error('获取支付表格选项失败:', error)
this.$message.error('获取支付表格选项失败')
return
}
//
@ -953,7 +995,7 @@ export default {
tenderReview: false,
contractSign: false,
prePaymentForm: '',
postPaymentForm: '',
postPaymentForm: [],
is_simple: 0,
has_charge: 0,
isBudget: 0,
@ -997,8 +1039,10 @@ export default {
this.purchaseFormOptions = []
try {
//
await this.getPaymentFormOptions()
//
if (this.paymentFormOptions.length === 0) {
await this.getPaymentFormOptions()
}
console.log('编辑行数据:', row) //
@ -1021,7 +1065,7 @@ export default {
tenderReview: row.tenderReview === true || row.tenderReview === 1,
contractSign: row.contractSign === true || row.contractSign === 1,
prePaymentForm: row.before_contract_template_id || '',
postPaymentForm: row.contract_template_id || '',
postPaymentForm: this.getPostPaymentFormArray(row.contract_template_id, row.contract_template_id2),
//
is_simple_editable: row.edit_is_simple === 1,
has_charge_editable: row.edit_has_charge === 1,
@ -1054,10 +1098,10 @@ export default {
//
this.originalPrePaymentForm = row.before_contract_template_id
this.originalPostPaymentForm = row.contract_template_id
this.originalPostPaymentForm = this.getPostPaymentFormArray(row.contract_template_id, row.contract_template_id2)
//
this.loadEditOptions(row)
await this.loadEditOptions(row)
//
this.$nextTick(() => {
@ -1081,6 +1125,11 @@ export default {
await this.getCategoryOptions()
}
//
if (this.paymentFormOptions.length === 0) {
await this.getPaymentFormOptions()
}
//
if (row.category_id) {
const category = this.categoryOptions.find(item => item.id === row.category_id)
@ -1160,6 +1209,11 @@ export default {
async handleSubmit() {
this.$refs.formRef.validate(async(valid) => {
if (valid) {
//
if (this.form.postPaymentForm && this.form.postPaymentForm.length > 2) {
this.$message.error('事后支付表格最多只能选择2个')
return
}
try {
// API
const submitData = {
@ -1224,16 +1278,20 @@ export default {
}
//
if (this.form.postPaymentForm === '') {
//
if (this.form.postPaymentForm.length === 0) {
submitData.contract_template_id = ''
} else if (this.form.postPaymentForm && this.form.postPaymentForm !== this.originalPostPaymentForm) {
submitData.contract_template_id = this.form.postPaymentForm
submitData.contract_template_id2 = ''
} else if (this.form.postPaymentForm.length > 0 && JSON.stringify(this.form.postPaymentForm) !== JSON.stringify(this.originalPostPaymentForm)) {
submitData.contract_template_id = this.form.postPaymentForm[0] || ''
submitData.contract_template_id2 = this.form.postPaymentForm[1] || ''
}
} else {
//
submitData.before_contract_template_id = this.form.prePaymentForm || ''
if (this.form.postPaymentForm) {
submitData.contract_template_id = this.form.postPaymentForm
if (this.form.postPaymentForm && this.form.postPaymentForm.length > 0) {
submitData.contract_template_id = this.form.postPaymentForm[0] || ''
submitData.contract_template_id2 = this.form.postPaymentForm[1] || ''
}
}
@ -1275,6 +1333,26 @@ export default {
//
this.getTableData()
},
//
getPostPaymentFormArray(templateId1, templateId2) {
const array = []
if (templateId1) array.push(templateId1)
if (templateId2) array.push(templateId2)
return array
},
//
formatPostPaymentForms(templateId1, templateId2, template) {
const array = this.getPostPaymentFormArray(templateId1, templateId2)
if (array.length === 0) return '-'
// ID
const formNames = array.map(id => {
const formOption = this.paymentFormOptions.find(option => option.id == id)
return formOption ? formOption.label : `表格${id}`
})
return formNames.join(', ')
},
//
async getPaymentFormOptions() {
try {
@ -1405,6 +1483,18 @@ export default {
font-size: 16px;
}
//
:deep(.el-table) {
.el-tag {
margin: 2px 4px 2px 0;
max-width: 100px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 12px;
}
}
:deep(.el-table) {
margin-top: 20px;
}
@ -1593,6 +1683,22 @@ export default {
border-radius: 4px;
border-color: #dee2e6;
}
//
:deep(.el-select--multiple) {
.el-select__tags {
max-width: calc(100% - 30px);
}
.el-tag {
margin: 2px 4px 2px 0;
max-width: 120px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 12px;
}
}
}
.drawer-footer {

@ -2234,6 +2234,12 @@ export default {
return
}
//
if (!this.form.contract_carry_department || this.form.contract_carry_department.length === 0) {
this.$Message.warning('请选择执行科室')
return
}
if (missingFields.length > 0) {
//
const fieldNames = {

Loading…
Cancel
Save