217 lines
7.6 KiB
Vue
217 lines
7.6 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="contract_id" @click="showDialog1 = true">
|
|
<el-input v-model="contract_no" clearable placeholder="请选择合同" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="合同名称" prop="contract_id"
|
|
:rules="[{ required: true, message: '不可为空', trigger: 'blur' }]">
|
|
<el-input v-model="contract_name" clearable disabled placeholder="系统自动填写" />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
<el-form-item label="客户名称" prop="contract_id"
|
|
:rules="[{ required: true, message: '不可为空', trigger: 'blur' }]">
|
|
<el-input v-model="custom_name" clearable disabled placeholder="系统自动填写" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="期次" prop="period"
|
|
:rules="[{ required: true, message: '不可为空', trigger: 'change' }]">
|
|
<el-select class="flex-1" v-model="formData.period" clearable placeholder="请选择期次">
|
|
<el-option v-for="(item, index) in dictData.pay_period" :key="index" :label="item.name"
|
|
:value="parseInt(item.value)" />
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :span="8">
|
|
<el-form-item label="金额" prop="amount"
|
|
:rules="[{ required: true, message: '不可为空', trigger: 'blur' }]">
|
|
<el-input v-model="formData.amount" type="number" clearable placeholder="请输入金额" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="计划回款日期" prop="return_date"
|
|
:rules="[{ required: true, message: '不可为空', trigger: 'change' }]">
|
|
|
|
<el-date-picker class="flex-1 !flex" v-model="formData.return_date" clearable type="date"
|
|
value-format="YYYY-MM-DD" placeholder="选择计划回款日期">
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<!-- <el-col :span="12">
|
|
<el-form-item label="回款状态" prop="return_status">
|
|
<el-radio-group v-model="formData.return_status" placeholder="请选择回款状态">
|
|
<el-radio v-for="(item, index) in dictData.return_status" :key="index"
|
|
:label="parseInt(item.value)">
|
|
{{ item.name }}
|
|
</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-col> -->
|
|
<el-col :span="8">
|
|
<el-form-item label="回款责任人" prop="return_duty_id" @click="userclick">
|
|
<el-input v-model="return_name" readonly clearable placeholder="请输入回款责任人" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="24">
|
|
<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>
|
|
<el-dialog v-model="showDialog1" title="选择合同" width="70%">
|
|
<contractDialog @customEvent="customEvent1"></contractDialog>
|
|
</el-dialog>
|
|
<personnelselector ref="personnel" @confirm="submituser" type="1"></personnelselector>
|
|
</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 contractDialog from '@/components/contract/index.vue'
|
|
import personnelselector from '@/components/personnelselector/index.vue'
|
|
import { apireturnedAdd, apireturnedEdit, apireturnedDetail } from '@/api/remittance'
|
|
import { useDictData } from '@/hooks/useDictOptions'
|
|
|
|
const formDataannex = reactive([])
|
|
const contract_name = ref('')
|
|
const personnel = ref<any>()
|
|
const contract_no = ref('')
|
|
const custom_name = ref('')
|
|
const return_name = ref('')
|
|
|
|
const { dictData } = useDictData('return_status,pay_period,contract_type')
|
|
|
|
const emit = defineEmits(['success', 'close'])
|
|
const formRef = shallowRef<FormInstance>()
|
|
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
|
const mode = ref('add')
|
|
const showDialog = ref(false)
|
|
const showDialog1 = ref(false)
|
|
|
|
|
|
const customEvent1 = (e: any) => {
|
|
formData.contract_id = e.id;
|
|
custom_name.value = e.custom_name;
|
|
contract_name.value = e.contract_name;
|
|
contract_no.value = e.contract_code
|
|
showDialog1.value = false;
|
|
};
|
|
|
|
|
|
// 弹窗标题
|
|
const popupTitle = computed(() => {
|
|
return mode.value == 'edit' ? '编辑项目表' : '新增项目表'
|
|
})
|
|
|
|
// 表单数据
|
|
const formData = reactive({
|
|
id: '',
|
|
contract_id: "",
|
|
return_date: "",
|
|
period: "",
|
|
amount: "",
|
|
return_status: "",
|
|
return_duty_id: '',
|
|
remark: "",
|
|
annex: [],
|
|
})
|
|
|
|
|
|
// 表单验证
|
|
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]
|
|
}
|
|
}
|
|
custom_name.value = data.custom_name
|
|
contract_name.value = data.contract_name;
|
|
contract_no.value = data.contract_code
|
|
return_name.value = data.return_duty
|
|
|
|
}
|
|
const getDetail = async (row: Record<string, any>) => {
|
|
const data = await apireturnedDetail({
|
|
id: row.id
|
|
})
|
|
setFormData(data)
|
|
}
|
|
|
|
|
|
// 提交按钮
|
|
const handleSubmit = async () => {
|
|
await formRef.value?.validate()
|
|
const data = { ...formData }
|
|
mode.value == 'edit'
|
|
? await apireturnedEdit(data)
|
|
: await apireturnedAdd(data)
|
|
popupRef.value?.close()
|
|
emit('success')
|
|
}
|
|
|
|
|
|
|
|
//打开弹窗
|
|
|
|
const userclick = () => {
|
|
personnel.value.open()
|
|
|
|
}
|
|
//确认
|
|
const submituser = (e: any) => {
|
|
formData.return_duty_id = e.id;
|
|
return_name.value = e.name;
|
|
}
|
|
|
|
|
|
//打开弹窗
|
|
const open = (type = 'add') => {
|
|
mode.value = type
|
|
popupRef.value?.open()
|
|
}
|
|
|
|
// 关闭回调
|
|
const handleClose = () => {
|
|
emit('close')
|
|
}
|
|
|
|
|
|
|
|
defineExpose({
|
|
open,
|
|
setFormData,
|
|
getDetail
|
|
})
|
|
</script>
|