<script lang="ts" setup>
import { ref } from 'vue';
import { FormInstance } from 'element-plus';
import { rules } from '@/views/financial/debtCollectionManagement/utils/columns';
import { FormProps } from '@/views/financial/debtCollectionManagement/utils/types';
import { $t } from '@/plugins/i18n';

const props = withDefaults(defineProps<FormProps>(), {
	formInline: () => ({
		// 债务ID
		debtId: undefined,
		// 回收日期
		recoveryDate: undefined,
		// 回收金额
		recoveryAmount: undefined,
		// 回收方式
		recoveryMethod: undefined,
		// 备注
		notes: undefined,
	}),
});

const formRef = ref<FormInstance>();
const form = ref(props.formInline);

defineExpose({ formRef });
</script>

<template>
	<el-form ref="formRef" :model="form" :rules="rules" label-width="auto">
		<!-- 债务ID -->
		<el-form-item :label="$t('debtId')" prop="debtId">
			<el-input v-model="form.debtId" :placeholder="$t('input') + $t('debtId')" autocomplete="off" type="text" />
		</el-form-item>

		<!-- 回收日期 -->
		<el-form-item :label="$t('recoveryDate')" prop="recoveryDate">
			<el-input v-model="form.recoveryDate" :placeholder="$t('input') + $t('recoveryDate')" autocomplete="off" type="text" />
		</el-form-item>

		<!-- 回收金额 -->
		<el-form-item :label="$t('recoveryAmount')" prop="recoveryAmount">
			<el-input v-model="form.recoveryAmount" :placeholder="$t('input') + $t('recoveryAmount')" autocomplete="off" type="text" />
		</el-form-item>

		<!-- 回收方式 -->
		<el-form-item :label="$t('recoveryMethod')" prop="recoveryMethod">
			<el-input v-model="form.recoveryMethod" :placeholder="$t('input') + $t('recoveryMethod')" autocomplete="off" type="text" />
		</el-form-item>

		<!-- 备注 -->
		<el-form-item :label="$t('notes')" prop="notes">
			<el-input v-model="form.notes" :placeholder="$t('input') + $t('notes')" autocomplete="off" type="text" />
		</el-form-item>
	</el-form>
</template>
