<template>
    <HcCard>
        <template #header>
            <div class="hc-expense-total-title">车量：1520</div>
        </template>
        <div class="hac-expense-record-body">
            <div class="record-form-box">
                <el-scrollbar>
                    <el-form ref="formRef" :model="formModel" :rules="formRules" label-position="top" size="large">
                        <el-form-item label="用车事由：">
                            <el-input type="textarea" v-model="formModel.key1" :autosize="{ minRows: 2, maxRows: 3 }"/>
                        </el-form-item>
                        <div class="hc-form-item">
                            <el-form-item label="始发地点：">
                                <el-input v-model="formModel.key2"/>
                            </el-form-item>
                            <el-form-item label="返回地点：" prop="key3">
                                <el-input v-model="formModel.key3"/>
                            </el-form-item>
                        </div>
                        <div class="hc-form-item">
                            <el-form-item label="用车日期：" prop="key4">
                                <el-date-picker type="date" class="block" v-model="formModel.key4" format="YYYY-MM-DD" value-format="YYYY-MM-DD"/>
                            </el-form-item>
                            <el-form-item label="返回日期：" prop="key5">
                                <el-date-picker type="date" class="block" v-model="formModel.key5" format="YYYY-MM-DD" value-format="YYYY-MM-DD"/>
                            </el-form-item>
                        </div>
                    </el-form>

                    <HcCardItem title="车辆明细1" ui="hac-bg-grey" class="mt-6">
                        <el-form ref="formRef" :model="formModel" :rules="formRules" label-position="top" size="large">
                            <div class="hc-form-item">
                                <el-form-item label="车辆类型：">
                                    <el-input v-model="formModel.key2"/>
                                </el-form-item>
                                <el-form-item label="数量：" prop="key2">
                                    <el-input v-model="formModel.key2">
                                        <template slot="append">辆</template>
                                    </el-input>
                                </el-form-item>
                                <el-form-item label="其它要求：" prop="key3">
                                    <el-input v-model="formModel.key2"/>
                                </el-form-item>
                            </div>
                        </el-form>
                    </HcCardItem>
                    <div class="text-gray text-sm mt-6">如需多种车型，请点击增加车辆</div>
                    <div class="record-form-action-box mt-8">
                        <el-divider content-position="right" border-style="dashed">
                            <el-button type="primary" hc-btn>
                                <HcIcon name="add"/>
                                <span>增加车辆</span>
                            </el-button>
                        </el-divider>
                        <el-form ref="formRef" :model="formModel" :rules="formRules" label-position="top" size="large">
                            <el-form-item label="备注：">
                                <el-input type="textarea" v-model="formInline.key1" :autosize="{ minRows: 3, maxRows: 5 }"/>
                            </el-form-item>
                            <el-form-item label="图片：">
                                <HcFormUpload :src="formModel.key6" @item="formFileClick"/>
                            </el-form-item>
                        </el-form>
                    </div>
                </el-scrollbar>
            </div>
            <div class="record-flow-box">
                <div class="title">流程</div>
                <div class="content">
                    <el-scrollbar>
                        <el-timeline>
                            <el-timeline-item v-for="(item, index) in timeLineData" :key="index">
                                <div class="timeline-title">{{item.title}}</div>
                                <div class="timeline-section">{{item.section}}</div>
                            </el-timeline-item>
                        </el-timeline>
                    </el-scrollbar>
                </div>
                <div class="action">
                    <el-button type="warning" hc-btn>
                        <HcIcon name="draft"/>
                        <span>暂存草稿</span>
                    </el-button>
                    <el-button type="primary" hc-btn>
                        <HcIcon name="check-double"/>
                        <span>提交报销申请</span>
                    </el-button>
                </div>
            </div>
        </div>

        <!--上传控件-->
        <HcUploadFile ref="HcUploadFileRef" :options="uploadFileOptions" :echoParams="uploadEchoParams" @success="HcUploadFileSuccess"/>
    </HcCard>
</template>

<script setup>
import {ref} from "vue";
import {useRouter} from 'vue-router'
import {getTokenHeader} from "~src/api/request/header";

const router = useRouter()

//上传配置
const HcUploadFileRef = ref(null)
const uploadEchoParams = ref({})
const uploadFileOptions = {
    headers: getTokenHeader(),
}

//明细表单
const formRef = ref(null)
const formModel = ref({
    key1: '', key2: '', key3: '', key4: '', key5: '',
})
const formRules = {}

//附件
const formFileClick = () => {
    HcUploadFileRef.value?.selectFile();
}

//上传完成
const HcUploadFileSuccess = (res) => {

}

const formInline = ref({})
const timeLineData = ref([
    {title: '审批人', section: '部门负责人'},
    {title: '财务审核', section: '财务'},
    {title: '最终确认付款人', section: '总经理'},
    {title: '出纳付款', section: '出纳'},
    {title: '抄送人', section: '总经理、财务、申请人'},
])
</script>

<style scoped lang="scss">
@import "~src/styles/expense/expense.scoped.scss";
.record-form-action-box {
    position: relative;
}
</style>

<style lang="scss">
@import "~src/styles/expense/expense.scss";
</style>
