<template>
    <layout-view>
        <el-descriptions  :title="title" :column="column" :size="size" :colon="false" border>
            <template slot="title">
                <i class="el-icon-tickets"></i>
                基本详细信息
            </template>
            <template slot="extra">
                <el-button type="primary" @click="$router.go(-1)" size="small">返回</el-button>
            </template>
            <#list columns as column>
                <#if column.isPrimaryKey != 1 && !column.isSuperColumn(column.javaField)&& column.isEdit==1>
                    <#assign javaField=column.javaField />
                    <#assign comment=column.subComment(column.columnComment) />
                    <#if column.htmlType == 1 ||column.htmlType == 2&& !column.columnType?contains("tinyint")>
                        <el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
                            {{form.${column.javaField}}}
                        </el-descriptions-item>
                    <#elseif column.htmlType == 3||column.htmlType == 4||column.htmlType == 5>
                        <el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
                            {{ util_formatters("${column.javaField}", form.${column.javaField}) }}
                        </el-descriptions-item>
                    <#elseif column.htmlType == 6>
                        <el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
                            {{ util_formatterDate(form.${column.javaField})}}
                        </el-descriptions-item>
                    <#elseif column.htmlType == 7>
                        <el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
                            <imageUpload v-model="form.${column.javaField}" prePath="/file/preview"/>
                        </el-descriptions-item>
                    <#elseif column.htmlType == 8>
                        <el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
                            <fileUpload v-model="form.${column.javaField}"  prePath="/file/fileupload"/>
                        </el-descriptions-item>
                    <#elseif column.htmlType == 9>
                        <el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
                            <editor v-model="form.${column.javaField}" :min-height="256"/>
                        </el-descriptions-item>
                    <#else >
                        <el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
                            {{form.${column.javaField}}}
                        </el-descriptions-item>
                    </#if>
                </#if>
            </#list>
        </el-descriptions>

        <#if table.tplCategory=="subone">
        <el-descriptions  :title="title" :column="column" :size="size" :colon="false" border>
            <template slot="title">
                <i class="el-icon-tickets"></i>
                扩展信息
            </template>
                <#list subTable.columns as column >
                    <#if column.isPrimaryKey != 1 && !column.isSuperColumn(column.javaField)&& column.isEdit==1>
                        <#assign javaField=column.javaField />
                        <#assign comment=column.subComment(column.columnComment) />
                        <#if column.htmlType == 1 ||column.htmlType == 2&& !column.columnType?contains("tinyint")>
                            <el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
                                {{form.${column.javaField}}}
                            </el-descriptions-item>
                        <#elseif column.htmlType == 3||column.htmlType == 4||column.htmlType == 5>
                            <el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
                                {{ util_formatters("${column.javaField}", form.${subclassName}Entity.${column.javaField}) }}
                            </el-descriptions-item>
                        <#elseif column.htmlType == 6>
                            <el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
                                {{ util_formatterDate(form.${subclassName}Entity.${column.javaField})}}
                            </el-descriptions-item>
                        <#elseif column.htmlType == 7>
                            <el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
                                <imageUpload v-model="form.${subclassName}Entity.${column.javaField}" prePath="/file/preview"/>
                            </el-descriptions-item>
                        <#elseif column.htmlType == 8>
                            <el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
                                <fileUpload v-model="form.${subclassName}Entity.${column.javaField}"  prePath="/file/uploadfile"/>
                            </el-descriptions-item>
                        <#elseif column.htmlType == 9>
                            <el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
                                <editor v-model="form.${subclassName}Entity.${column.javaField}" :min-height="256"/>
                            </el-descriptions-item>
                        <#else >
                            <el-descriptions-item label="${comment}" label-class-name="labelClass" content-class-name="contentClass">
                                {{form.${subclassName}Entity.${column.javaField}}}
                            </el-descriptions-item>
                        </#if>
                    </#if>
                </#list>
            </el-descriptions>
        </#if>
    </layout-view>
</template>

<script>
    import view from "@/assets/mixins/view";
    <#list columns as column>
    <#if column.isInsert==1 && !column.isSuperColumn(column.javaField) && column.isPrimaryKey!=1 && column.htmlType == 7>
    import ImageUpload from '@/components/ImageUpload';
    <#break>
    </#if>
    </#list>
    <#list columns as column>
    <#if column.isInsert==1 && !column.isSuperColumn(column.javaField) && column.isPrimaryKey!=1 && column.htmlType == 8>
    import FileUpload from '@/components/FileUpload';
        <#break>
        </#if>
        </#list>
    <#list columns as column>
        <#if column.isInsert==1 && !column.isSuperColumn(column.javaField) && column.isPrimaryKey!=1 && column.htmlType == 9>
    import Editor from '@/components/Editor';
        <#break>
    </#if>
    </#list>
    export default {
        mixins: [view],
        components: {
        <#list columns as column>
            <#if column.isInsert==1 && !column.isSuperColumn(column.javaField) && column.isPrimaryKey!=1 && column.htmlType == 7>
            ImageUpload,
            <#break>
            </#if>
        </#list>
        <#list columns as column>
            <#if column.isInsert==1 && !column.isSuperColumn(column.javaField) && column.isPrimaryKey!=1 && column.htmlType == 8>
            FileUpload,
            <#break>
            </#if>
        </#list>
        <#list columns as column>
            <#if column.isInsert==1 && !column.isSuperColumn(column.javaField) && column.isPrimaryKey!=1 && column.htmlType == 9>
            Editor,
            <#break>
            </#if>
        </#list>
        },
        methods: {

        },
        data() {
            return {
                size:"small",
                column:2,
                toString:[
                    <#list columns as column>
                    <#if column.columnType?contains("tinyint")>
                    "${column.javaField}",
                    </#if>
                    </#list>
                ],
                toArrays: [

                ],
                toDate: [

                ]
            }
        }
    }
</script>
<style lang="less">
    .labelClass{
        width: 200px;
    }
    .el-descriptions__body{
        margin-left: 5px;
        margin-right: 5px;
        color: #606266;
        background-color: #FFF;
    }
    .contentClass{
        width: 600px;
    }
</style>