<template>
	<request-form
		title="拨款申请"
		subtitle="填写拨款信息，支持手机端快速提交"
		biz-type="appropriation"
		:request-api="submitApply"
		:initial-form="initialForm"
		:sections="sections"
		:flow-fields="flowFields"
	/>
</template>

<script>
import RequestForm from '@/components/hrm/RequestForm.vue'
import { addAppropriationReq } from '@/api/hrm/appropriation'

export default {
	components: { RequestForm },
	data() {
		return {
			initialForm: { appropriationType: '', amount: '', reason: '', remark: '' },
			sections: [
				{ key: 'basic', title: '基础信息', fields: [
					{ key: 'appropriationType', label: '拨款类型', type: 'select', required: true, placeholder: '请选择拨款类型', options: ['项目拨款', '部门拨款', '专项拨款', '备用金拨款', '其他'] },
					{ key: 'amount', label: '拨款金额', type: 'input', inputType: 'digit', required: true, placeholder: '请输入金额' }
				]},
				{ key: 'desc', title: '说明', fields: [
					{ key: 'reason', label: '用途说明', type: 'textarea', required: true, placeholder: '请说明拨款用途与依据' },
					{ key: 'remark', label: '备注', type: 'textarea', required: false, placeholder: '可选' }
				]}
			],
			flowFields: [
				{ key: 'appropriationType', label: '拨款类型', required: true },
				{ key: 'amount', label: '拨款金额', required: true },
				{ key: 'reason', label: '用途说明', required: true }
			]
		}
	},
	methods: { submitApply(payload) { return addAppropriationReq(payload) } }
}
</script>

<style scoped></style>