<!--
授权管理日志
@Author: linqian
@Date: 2021-05-27 11:29
-->
<template>
    <div>
        <!-- 搜索项 -->
        <el-form ref="ruleForm" inline :model="form">
            <el-form-item label="授权管理类型">
                <dg-select v-model="form.authorizeType.value" placeholder="请选择授权管理类型" enum="AuthorizeTypeEnum" clearable>
                </dg-select>
            </el-form-item>
            <el-form-item label="处理时间">
                <dg-date-picker
                    v-model="form.createTime.value"
                    type="daterange"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                    clearable
                    value-format="yyyyMMddHHmmss"
                    :unlink-panels="true"
                >
                </dg-date-picker>
            </el-form-item>
            <el-form-item label="权限处理者">
                <el-input v-model="form.authorizeHandlerNames.value" placeholder="请输入权限处理者" clearable></el-input>
            </el-form-item>
            <el-form-item>
                <dg-button type="primary" @click="handleSearch" icon="el-icon-search">查询</dg-button>
                <dg-button type="primary" @click="handleReset" icon="el-icon-refresh-right">重置</dg-button>
            </el-form-item>
        </el-form>
        <!-- 表格 -->
        <Table ref="myTable" :url="authManageLogTableUrl" :headerData="authManageLogTableHeader" :condition="form">
            <dg-table-column label="操作" align="center">
                <template slot-scope="scope">
                    <div class="u-table__operation">
                        <el-tooltip content="详情" effect="dark" placement="top-end">
                            <i class="el-icon-document" @click="handleViewDetail(scope.row)"></i>
                        </el-tooltip>
                    </div>
                </template>
            </dg-table-column>
        </Table>
    </div>
</template>

<script>
import Table from "@/pages/common/table";
import detail from "./log-detail/auth-manage";
import { authManageLogTableHeader } from "./DataConfig";
import { authManageLogTableUrl } from "@/api/permiss-log-manage";
export default {
    components: {
        Table
    },
    data() {
        return {
            authManageLogTableUrl,
            authManageLogTableHeader,
            form: {
                authorizeType: {
                    value: "",
                    op: "="
                },
                authorizeHandlerNames: {
                    value: "",
                    op: "like"
                },
                createTime: {
                    value: "",
                    op: "between",
                    type: "DATE",
                    format: "yyyyMMddHHmmss"
                }
            }
        };
    },
    computed: {},
    methods: {
        /**
         *  详情
         */
        handleViewDetail(row) {
            const layer = this.$dgLayer({
                title: `详情`,
                shade: [0.4, "#FFF"],
                content: detail,
                props: {
                    id: row.id
                },
                on: {
                    success() {
                        layer.close(layer.dialogIndex);
                    }
                },
                area: ["900px", "800px"]
            });
        },
        /**
         * 查询
         */
        handleSearch() {
            this.$refs.myTable.handleSearchClick();
        },
        /**
         * 重置
         */
        handleReset() {
            for (const key in this.form) {
                this.form[key].value = "";
            }
        }
    },
    created() {
        const startTime = this.$moment().subtract("1", "year").format("YYYYMMDDHHmmss");
        const endTime = this.$moment().format("YYYYMMDDHHmmss");
        this.form.createTime.value = [startTime, endTime];
    },
    mounted() {}
};
</script>

<style lang='scss'>
</style>