<template>
    <!-- 弹出框表单 -->
    <el-drawer
            :title="title"
            :visible.sync="open"
            :direction="direction"
            size="70%">
        <el-form ref="form" :model="form" :rules="rules" label-width="120px">
            <el-row>
                            <Field label="TraceId" prop="traceID" v-model="form.traceID" />
                            <Field label="应用名称" prop="appName" v-model="form.appName" />
                            <Field label="实例IP" prop="hostName" v-model="form.hostName" />
                            <Field label="日志等级" prop="logLevel" v-model="form.logLevel" />
                            <Field label="用户唯一标识" prop="userCode" v-model="form.userCode" />
                            <Field label="设备唯一标识" prop="deviceCode" v-model="form.deviceCode" />
                            <Field label="事件主题" prop="eventTopic" v-model="form.eventTopic" />
                            <Field label="时间主题名称" prop="eventTopicName" v-model="form.eventTopicName" />
                            <Field label="日志产生时间" prop="logTime" v-model="form.logTime" type="datetime" />
                            <Field :span="24" label="事件参数" prop="msg" v-model="form.msg" textareaSize="true"  type="textarea" />
                       

            </el-row>

        </el-form>

    </el-drawer>
</template>

<script>
    import form from "@/assets/mixins/formdialog";
    export default {
        name: "BizLogDetail",
        mixins: [form],
        components: {

        },
        created() {
            this.changePath("biz/log")
        },
        data() {
            return {
                // 遮罩层
                loading: true,
                // 弹出层标题
                title: "业务日志",
                // 是否显示弹出层
                open: false,
                direction:"rtl",
                toString:[
                ],
                toDate:[
                    "logTime",
                ],
                // 表单校验
                rules: {
                    logTime: [
                        {required: true,message: "请选择日志产生时间" },
                    ],
                    createTime: [
                        {required: true,message: "请选择创建时间" },
                    ],
                }
            };
        },

        methods: {
            /** 编辑 */
            edit(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="biz/log/edit";
                this.getData();
                this.pageInfo.type="edit"
                this.title = "修改业务日志";
            },
            /** 新增 */
            add(row) {
                this.reset()
                this.urls.currUrl = "biz/log/add";
                this.getData();
                this.pageInfo.type="add"
                this.title = "新增业务日志";
            },
            /** 查看*/
            view(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="biz/log/view";
                this.getData();
                this.pageInfo.type="view"
                this.title = "业务日志详细";
            },
            /**取消按钮 */
            cancel() {
                this.open = false;
            },
            /**获取数据后弹框 */
            afterRender(data) {
                this.open = true;
            },

            afterSubmit(data) {
                this.open = false;
                this.$emit("ok");
            },

            // 表单重置
            reset() {
                this.form = {
                    traceID : "",
                    appName : "",
                    hostName : "",
                    logLevel : "",
                    userCode : "",
                    deviceCode : "",
                    eventTopic : "",
                    eventTopicName : "",
                    msg : "",
                    logTime : null,
                };
                this.resetForm("form");
            },
            resetForm(refName) {
                if (this.$refs[refName]) {
                    this.$refs[refName].resetFields();
                }
            },
        },
    };
</script>
