<template>
    <div class="page">
        <LayoutTable :data="tableData" notAdd notDel :config="tableConfig">
                    </LayoutTable>


        <drawer-show ref="drawerform" @ok="getData" />
    </div>
</template>

<script>
    /** 表单弹出框模式需引入 */

    import drawerShow from "./drawershow";
    import table from "@/assets/mixins/table";
    export default {
        name: "AccessLogList",
        components: {
            drawerShow
},
        mixins: [table],
        created() {
        },
        methods: {
            /** 重写新增方法 */
            toAdd(row) {
                this.$refs.drawerform.add(row);
            },
            /** 重写编辑方法 */
            toEdit(row) {
                this.$refs.drawerform.edit(row);
            },
            /** 重写查看方法 */
            toView(row) {
                this.$refs.drawerform.view(row);
            },

        },
        data() {
            return {
                config: {
                    search: [
                        {
                            name: "traceID",
                            type: "text",
                            label: "追踪Id",
                            fuzzy: true
                        },
                        {
                            name: "targetServer",
                            type: "text",
                            label: "应用名称",
                            fuzzy: true
                        },
                        {
                            name: "method",
                            type: "text",
                            label: "请求方式",
                            fuzzy: true
                        },
                           {
                            name: "durationStart",
                            type: "text",
                            label: "耗时阈值"
                        },
                      {
                        name: "createTimeStart",
                        type: "date",
                        label: "开始时间"
                      },
                      {
                        name: "createTimeEnd",
                        type: "date",
                        label: "结束时间"
                      },
                    ],
                    columns: [

                        {type: "index",label: "序号",width: 50,align:"center"},

                        {label: "TraceID", prop: "traceID"},

    /*                     {label: "spanId", prop: "spanId",width: 70},

                           {label: "pspanId", prop: "pspanId",width: 70},*/
                             {label: "请求方式", prop: "method",width: 70},

                         {label: "当前服务", prop: "appName"},
                        {label: "应用名称", prop: "targetServer"},



                        {label: "请求URI", prop: "uri"},

                        {label: "请求参数", prop: "requestData",tooltip:"true"},

                        {label: "日志时间", prop: "logTime", formatter: this.formatterDate},


                        {label: "持续时间", prop: "duration",width:70, formatter: row => {
                                return (
                                    <span>{row.duration}ms</span>
                            )}},
                        {
                            label: "操作",
                            width: 120,
                            formatter: row => {
                                return (
                                    <table-buttons noAdd noEdit noDel row={row} onEdit={this.toEdit} onView={this.toView} onDel={this.toDel} />
                            );
                            }
                        }
                    ]
                }
            };
        }
    };
</script>
