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

<script>
export default {
    name: 'SysConfigDify',
    data() {
        let columns = [
            {
                prop: 'fdName',
                label: '名称',
                type: 'input',
                width: '120px'
            }, {
                prop: 'fdCode',
                label: '编码',
                type: 'input',
                width: '120px'
            }, {
                prop: 'fdApiKey',
                label: 'API密钥',
                type: 'input'
            }, {
                prop: 'fdUrl',
                label: '路径',
                type: 'input'
            }, {
                prop: 'fdComment',
                label: '备注',
                type: 'input'
            }, {
                prop: 'fdSort',
                label: '排序',
                type: 'input',
                width: '60px'
            },
        ];
        let tableOpt = {
            title: "Dify集成配置",
            columns: columns,
            editPk: "fdId", //默认fdId
            deletePk: "fdId", // 默认fdId
            dataUrl: "/apm/sys/TSysConfigDify/getTSysConfigDifyGridList",
            saveUrl: "/apm/sys/TSysConfigDify/saveTSysConfigDifyGridData",
            deleteUrl: "/apm/sys/TSysConfigDify/deleteTSysConfigDifyGridData",
            toolbarBtn: [{
                btnType: "primary",
                text: "刷新缓存",
                icon: "el-icon-magic-stick",
                onClick: this.refreshCache
            }, "separator", "add", "edit", "del", "refresh", "save"],
            initData: true, // 默认false
            params: {}
        };
        return {
            tSysConfigDifyOpt: tableOpt,
        }
    },
    methods: {
        refreshCache(){
            this.$request({
                url: '/apm/sys/TSysConfigDify/refreshDifyConfigCache',
                method: 'post',
            }).then(response => {
                this.$message.success(`缓存刷新成功！`)
            })
        }
    }
}
</script>

<style scoped>
</style>
