<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="平台标识" prop="platformMark" v-model="form.platformMark" :enumData="dict.platformMark" placeholder="请输入平台标识"/>
                           <Field label="用户名称" prop="userName" v-model="form.userName" placeholder="请输入用户名称"/>
                            <Field label="用户登录名" prop="loginName" v-model="form.loginName" placeholder="请输入用户登录名"/>
                            <Field label="请求地址" prop="requestUrl" v-model="form.requestUrl" placeholder="请输入请求地址"/>
                            <Field label="操作IP地址" prop="ip" v-model="form.ip" placeholder="请输入操作IP地址"/>

 <Field label="操作时间" prop="logDate" v-model="form.logDate" type="datetime" />
 <Field :span="24" label="操作内容" v-model="form.content" textareaSize="true"  type="textarea"></Field>
            </el-row>

        </el-form>

    </el-drawer>
</template>

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

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

        methods: {
            /** 编辑 */
            edit(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="operate/log/edit";
                this.getData();
                this.pageInfo.type="edit"
                this.title = "修改平台用户操作日志业务";
            },
            /** 新增 */
            add(row) {
                this.reset()
                this.urls.currUrl = "operate/log/add";
                this.getData();
                this.pageInfo.type="add"
                this.title = "新增平台用户操作日志业务";
            },
            /** 查看*/
            view(row) {
                this.reset()
                this.query = { id: row.id };
                this.urls.currUrl ="operate/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 = {
                    platformMark : "",
                    userId : null,
                    userName : "",
                    loginName : "",
                    requestUrl : "",
                    content : "",
                    ip : "",
                    logDate : null,
                    operType : null,
                };
                this.resetForm("form");
            },
            resetForm(refName) {
                if (this.$refs[refName]) {
                    this.$refs[refName].resetFields();
                }
            },
        },
    };
</script>
