<template>
    <div class="designPage" :style="pageHeight">
        <!-- <el-upload
            class="upload-demo"
            drag
            :action="upload.processurl + upload.url"
            :headers="upload.headers"
            :on-progress="handleFileUploadProgress"
            :on-success="handleFileSuccess"
            :on-error="handleFileError"
            multiple>
            <i class="el-icon-upload"></i>
            <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
            <div class="el-upload__tip" slot="tip">只能上传jpg/png文件，且不超过500kb</div>
        </el-upload> -->
        <iframe src="http://120.46.129.85:8082/" frameborder="0" width="99%" height="98%"></iframe>
    </div>
</template>

<script>
import { getToken } from '@/api/auth'
export default {
    data() {
        return {
            // 用户导入参数
            upload: {
                // 设置上传的请求头部
                headers: { 
                    // Authorization: "Bearer ",
                    token: getToken() 
                },
                // 上传的地址
                processurl: (process.env.NODE_ENV === 'production') ? process.env.PRO_BASE_API : process.env.BASE_API,
                url: '/predict/api/cdc/addZt',
                // 上传模板名称
                urlName: '',
                // 上传文件名称
                proName: ''
            },
        }
    },
    computed: {
        pageHeight() {
            return {
                'height': document.documentElement.clientHeight-70 + 'px'
            }
        },
    },
    methods:{
        // 文件上传中处理
        handleFileUploadProgress(event, file, fileList) {
            this.upload.isUploading = true;
            this.$emit('importLoading', true)
        },
        // 文件上传成功处理
        handleFileSuccess(response, file, fileList) {
            this.upload.open = false;
            this.upload.isUploading = false;
            this.$refs.upload.clearFiles();
            // this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
            if (response.code === 500) {
                if (response.msg.indexOf('运行时异常') !== -1) {
                    this.$message.error('模板数据不匹配,请使用模板导入');
                    this.importTemplate()
                } else {
                    this.$message.error(response.msg);
                }
            } else {
                this.$message({
                    message: response.msg,
                    type: 'success'
                });
            }
            this.$emit('successImport', response)
            // this.getList();
        },
        handleFileError(response, file, fileList) {
            this.$message.error(response.msg);
        }
    }
}
</script>

<style lang="less">
.designPage{
    width: 100%;
}
</style>