<template>
    <ap-container>
        <ap-main margin="1111">
            <ap-table ref="tSysServerWhitelistRef" :options.sync="tSysServerWhitelistOpt"></ap-table>
        </ap-main>
    </ap-container>
</template>

<script>
    export default {
        name: 'SysServerWhitelist',
        data() {
            let columns = [
                {
                    prop: 'fdName',
                    label: '名称',
                    type: 'input',
                    width: 150
                }, {
                    prop: 'fdIp',
                    label: 'ip地址',
                    type: 'input',
                    width: 200
                }, {
                    prop: 'fdComment',
                    label: '备注',
                    type: 'input',
                    width: 250
                }, {
                    prop: 'fdDisabled',
                    label: '是否有效',
                    type: 'select',
                    align: "center",
                    width: 100,
                    selectOptions: [{label: "有效", value: 0}, {label: "失效", value: 1}],
                    html: function (value, row) {
                        if (value == 1) {
                            return '<div class="ap-tag-danger">禁用</div>'
                        } else if (value == 0) {
                            return '<div class="ap-tag-success">启用</el-tag>';
                        }
                    }
                }
            ];
            let tableOpt = {
                title: "服务器白名单-登录",
                columns: columns,
                editPk: "fdId", //默认fdId
                deletePk: "fdId", // 默认fdId
                dataUrl: "/apm/sys/TSysServerWhitelist/getTSysServerWhitelistGridList",
                saveUrl: "/apm/sys/TSysServerWhitelist/saveTSysServerWhitelistGridData",
                deleteUrl: "/apm/sys/TSysServerWhitelist/deleteTSysServerWhitelistGridData",
                toolbarBtn: [{btnType: "info", text: "帮助", icon: "el-icon-wenhao2", onClick: this.showHelp},
                    "separator", "add", "edit", "del", "refresh", "save"],
                initData: true, // 默认false
                params: {}
            };
            return {
                tSysServerWhitelistOpt: tableOpt,
            }
        },
        methods: {
            showHelp() {
                let html = `白名单服务器：可免密获取用户token`;
                this.$alert(html, '帮助文档', {
                    dangerouslyUseHTMLString: true
                });
            }
        }
    }
</script>

<style scoped>
</style>
