<template>
    <ele-modal :visible.sync="visible" title="发布" width="800px" append-to-body>

        <el-form ref="form" :model="form" :rules="rules" label-width="80px">
            <el-row>
                <el-col :span="20">
                    <el-form-item label="附件:" prop="bomArtFiles">
                        <fileUpload v-model="form.bomArtFiles" module="main" :showLib="false" :limit="5" />
                        <div v-if="form.bomArtFiles && form.bomArtFiles?.length">
                            <el-link v-for="link in form.bomArtFiles" :key="link.id" type="primary" :underline="false"
                                @click="downloadFile(link)">
                                {{ link.name }}</el-link>
                        </div>
                    </el-form-item>
                </el-col>


                <el-col :span="20">
                    <el-form-item label="分批到货:" prop="">
                        <el-link type="primary" :underline="false" @click.native="handleMethod(row)">
                            设置分批时间
                        </el-link>
                    </el-form-item>
                </el-col>


            </el-row>





        </el-form>


        <template v-slot:footer>
            <el-button @click="close">取消</el-button>
            <el-button type="primary" :loading="loading" @click="save">
                保存
            </el-button>
        </template>

        <timeDialog ref="timeDialogRef" @chooseTime="chooseTime"></timeDialog>
    </ele-modal>
</template>

<script>
import fileUpload from '@/components/upload/fileUpload';
import { getFile } from "@/api/system/file";
import timeDialog from './timeDialog'
export default {
    components: {
        fileUpload,
        timeDialog
    },
    data() {
        return {
            visible: false,

            form: {},

            rules: {},

            loading: false
        }
    },

    methods: {

        downloadFile(file) {
            getFile({ objectName: file.storePath }, file.name);
        },
        open() {
            this.visible = true
        },

        close() {
            this.visible = false
        },


        handleMethod() {
         
            this.$refs.timeDialogRef.open()
        },

        chooseTime(timeList) {
            console.log(timeList)
        },

        save() { },

    }
}
</script>

<style></style>