<!--
    上传文件的弹窗
-->

<template>
    <el-dialog
        title="上传文件"
        :visible.sync="dialog.uploadFiles"
        width="500px">
        <div class='max-height: 500px; overflow-y: auto;'>
            <upload-files
                :readOnly="read"
                :keysArr="keysArr"
                :firmDataType="firmDataType"
                @change="changeItem"
                max="2"
            />
        </div>
    </el-dialog>
</template>
<script>
    import uploadFiles from "@/components/ledger/lib/uploadFiles";

    export default {
        components: {
            uploadFiles
        },
        props: {
            dialog: {
                type: Object,
                default: function () {
                    return {
                        uploadFiles: false
                    };
                }
            },
            keysArr: {
                type: Array,
                default: function () {
                    return []
                }
            },
            read: {
                type: Boolean,
                default: false
            },
            firmDataType: {
                type: String
            },
            infoType: {
                type: String
            },
            information: {
                type: Object
            }
        },
        data() {
            return {};
        },
        created() {
        },
        computed: {

        },
        mounted() {
        },
        methods: {
            changeItem(file) {
                if (this.firmDataType === 'dialog') {
                    let info = this.infoType;
                    switch (info) {
                        case 'archive':
                            this.information.archive.Archive = file
                            this.$emit("changeFile", this.information, this.firmDataType)
                            break
                        case 'checkReport':
                            this.information.checkReport.CheckReport = file
                            this.$emit("changeFile", this.information, this.firmDataType)
                            break
                        case 'insuranceFile':
                            this.information.insuranceFile.InsuranceFile = file
                            this.$emit("changeFile", this.information, this.firmDataType)
                            break
                    }
                } else {
                    this.$emit("changeFile", file, this.firmDataType)

                }
            },
            deepCopy(obj) {
                return JSON.parse((JSON.stringify(obj)))
            }
        },
    };
</script>
<style>
</style>
