287 lines
10 KiB
Vue
287 lines
10 KiB
Vue
<template>
|
|
<div class="edit-popup">
|
|
|
|
<popup ref="popupRef" :title="popupTitle" :async="true" width="80%" @confirm="handleSubmit" @close="handleClose">
|
|
|
|
<el-form ref="formRef" :model="formData" label-width="auto" :rules="formRules">
|
|
<el-row :gutter="10">
|
|
<el-col :span="8">
|
|
<el-form-item label="投标编号" prop="bid_security_apply_id" @click="showDialog = true"
|
|
:rules="[{ required: true, message: '不可为空', trigger: 'blur' }]">
|
|
<el-input v-model="bidding_code" clearable placeholder="请选择投标编号" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="客户名称">
|
|
<el-input v-model="custom_name" clearable disabled placeholder="系统自动填写" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="8">
|
|
<el-form-item label="项目名称" prop="contract_id">
|
|
<el-input v-model="project_name" clearable disabled placeholder="系统自动填写" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="项目编码" prop="contract_id">
|
|
<el-input v-model="project_code" clearable disabled placeholder="系统自动填写" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="投标时间" prop="bidding_time">
|
|
<el-date-picker class="flex-1 !flex" v-model="bidding_time" clearable type="date"
|
|
value-format="YYYY-MM-DD" disabled placeholder="系统自动填写">
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
<el-form-item label="退款日期" prop="refund_date" :rules="{
|
|
validator: chekcDate,
|
|
trigger: ['blur']
|
|
}">
|
|
<el-date-picker class="flex-1 !flex" v-model="formData.refund_date" clearable type="date"
|
|
value-format="YYYY-MM-DD" placeholder="请选择退款日期">
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="8">
|
|
<el-form-item label="退款金额" prop="refund_amount">
|
|
<el-input v-model="formData.refund_amount" clearable placeholder="请输入退款金额"
|
|
@input="amountinput" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="金额大写" prop="refund_amount_daxie">
|
|
<el-input v-model="refund_amount_daxie" clearable disabled placeholder="系统自动填写" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
|
|
|
|
<el-col :span="12">
|
|
<el-form-item label="备注" prop="remark">
|
|
<el-input v-model="formData.remark" type="textarea" clearable placeholder="请输入备注" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="24">
|
|
<el-form-item label="附件">
|
|
<uploadAnnex :formData="formData"></uploadAnnex>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<div style="margin: 20px 0;">付款银行信息</div>
|
|
<el-row :gutter="10">
|
|
<el-col :span="8">
|
|
<el-form-item label="账户编码" prop="bank_account_info"
|
|
:rules="[{ required: true, message: '不可为空', trigger: 'blur' }]">
|
|
<el-input v-model="formData.bank_account_info.account_sn" @click="showDialog1 = true" readonly
|
|
clearable placeholder="请输入收款账号" />
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
<el-form-item label="开户银行" prop="collection_bank">
|
|
<el-input v-model="formData.bank_account_info.deposit_bank" clearable readonly
|
|
placeholder="请输入收款银行" />
|
|
</el-form-item>
|
|
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="开户名称" prop="collection_bank">
|
|
<el-input v-model="formData.bank_account_info.account_name" clearable readonly
|
|
placeholder="请输入收款银行" />
|
|
</el-form-item>
|
|
</el-col> <el-col :span="8">
|
|
<el-form-item label="开户账号" prop="collection_bank">
|
|
<el-input v-model="formData.bank_account_info.account" clearable readonly
|
|
placeholder="请输入收款银行" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
|
|
<el-dialog v-model="showDialog" title="选择投标保证金" width="70%">
|
|
<bidbondDialog @customEvent="customEvent" :project_id="project?.id || ''"></bidbondDialog>
|
|
</el-dialog>
|
|
|
|
|
|
<el-dialog v-model="showDialog1" title="选择银行账户" width="70%">
|
|
<bankaccountDialog @customEvent="customEvent1"></bankaccountDialog>
|
|
</el-dialog>
|
|
</el-form>
|
|
</popup>
|
|
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup name="projectEdit">
|
|
import type { FormInstance } from 'element-plus'
|
|
import Popup from '@/components/popup/index.vue'
|
|
import bidbondDialog from '@/components/bidbond/index.vue'
|
|
import bankaccountDialog from '@/components/bankaccount/index.vue'
|
|
import { bidrefundAdd, bidrefundEdit, bidrefundDetail } from '@/api/refundbidDeposit'
|
|
import { toChinesNum } from "@/utils/util";
|
|
import { getAllProjectTypes } from '@/api/projecttype'
|
|
import { useDictData } from '@/hooks/useDictOptions'
|
|
import configs from "@/config"
|
|
import useUserStore from "@/stores/modules/user";
|
|
const protype = reactive([])
|
|
const formDataannex = reactive([])
|
|
const bidding_code = ref('')
|
|
const project_name = ref('')
|
|
const project_code = ref('')
|
|
const bidding_time = ref('')
|
|
const custom_name = ref('')
|
|
|
|
|
|
|
|
const emit = defineEmits(['success', 'close'])
|
|
const formRef = shallowRef<FormInstance>()
|
|
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
|
const mode = ref('add')
|
|
const refund_amount_daxie = ref('')
|
|
const showDialog = ref(false)
|
|
const showDialog1 = ref(false)
|
|
|
|
const customEvent = (e: any) => {
|
|
formData.bid_security_apply_id = e.id;
|
|
project_name.value = e.project_name
|
|
bidding_time.value = e.bidding_time
|
|
custom_name.value = e.custom_name
|
|
bidding_code.value = e.security_apply_code
|
|
project_code.value = e.project_code
|
|
showDialog.value = false;
|
|
};
|
|
const customEvent1 = (e: any) => {
|
|
formData.bank_account_id = e.id;
|
|
formData.bank_account_info.account_sn = e.account_sn
|
|
formData.bank_account_info.deposit_bank = e.deposit_bank
|
|
formData.bank_account_info.account_name = e.account_name
|
|
formData.bank_account_info.account = e.account
|
|
showDialog1.value = false
|
|
};
|
|
|
|
const props = defineProps({
|
|
project: Object
|
|
})
|
|
|
|
|
|
if (props.project) {
|
|
project_name.value = props.project.name
|
|
project_code.value = props.project.project_code
|
|
custom_name.value = props.project.custom_name
|
|
|
|
}
|
|
|
|
|
|
//监听输入
|
|
const amountinput = (e) => {
|
|
if (e && e > 0) {
|
|
refund_amount_daxie.value = toChinesNum(e)
|
|
}
|
|
}
|
|
// 弹窗标题
|
|
const popupTitle = computed(() => {
|
|
return mode.value == 'edit' ? '编辑退投标保证金表' : '新增退投标保证金表'
|
|
})
|
|
|
|
// 表单数据
|
|
const formData = reactive({
|
|
id: '',
|
|
bid_security_apply_id: "",
|
|
refund_amount: "",
|
|
refund_date: "",
|
|
remark: "",
|
|
annex: [],
|
|
bank_account_id: '',
|
|
"bank_account_info": {
|
|
"account_sn": "",
|
|
"deposit_bank": "",
|
|
"account_name": "",
|
|
"account": ""
|
|
},
|
|
approve_detail: {}
|
|
|
|
})
|
|
|
|
const chekcDate = (rule: any, value: any, callback: any) => {
|
|
if (new Date(formData.refund_date) < new Date(bidding_time.value)) {
|
|
callback(new Error('退款日期不能早于投标时间'))
|
|
} else {
|
|
callback()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 表单验证
|
|
const formRules = reactive<any>({
|
|
|
|
})
|
|
|
|
|
|
// 获取详情
|
|
const setFormData = async (data: Record<any, any>) => {
|
|
for (const key in formData) {
|
|
if (data[key] != null && data[key] != undefined) {
|
|
//@ts-ignore
|
|
formData[key] = data[key]
|
|
}
|
|
}
|
|
project_name.value = data.project_name
|
|
project_code.value = data.project_code
|
|
custom_name.value = data.custom_name
|
|
bidding_time.value = data.bidding_time
|
|
bidding_code.value = data.bidding_decision_code
|
|
amountinput(data.refund_amount)
|
|
|
|
}
|
|
const getDetail = async (row: Record<string, any>) => {
|
|
const data = await bidrefundDetail({
|
|
id: row.id
|
|
})
|
|
setFormData(data)
|
|
}
|
|
|
|
|
|
// 提交按钮
|
|
const handleSubmit = async () => {
|
|
await formRef.value?.validate()
|
|
const data = { ...formData }
|
|
mode.value == 'edit'
|
|
? await bidrefundEdit(data)
|
|
: await bidrefundAdd(data)
|
|
popupRef.value?.close()
|
|
emit('success')
|
|
}
|
|
|
|
//打开弹窗
|
|
const open = (type = 'add') => {
|
|
mode.value = type
|
|
popupRef.value?.open()
|
|
|
|
getAllProjectTypes().then((res) => {
|
|
|
|
protype.splice(0, protype.length, ...res);
|
|
})
|
|
}
|
|
|
|
// 关闭回调
|
|
const handleClose = () => {
|
|
emit('close')
|
|
}
|
|
|
|
|
|
|
|
defineExpose({
|
|
open,
|
|
setFormData,
|
|
getDetail
|
|
})
|
|
</script>
|