<?php /*a:2:{s:68:"D:\phpEnv\www\Gong-Ying-Lian-API\app\admin\view\auth\rule\index.html";i:1751866917;s:63:"D:\phpEnv\www\Gong-Ying-Lian-API\app\admin\view\layout\vue.html";i:1751866917;}*/ ?>

    import table from "http://yun.cn/assets/js/components/Table.js";
    export default{
        components:{'YunTable':table},
        data:{
            auth:{
                add:Yunqi.auth.check('app\\admin\\controller\\auth\\Rule','add'),
                edit:Yunqi.auth.check('app\\admin\\controller\\auth\\Rule','edit'),
                del:Yunqi.auth.check('app\\admin\\controller\\auth\\Rule','del'),
                multi:Yunqi.auth.check('app\\admin\\controller\\auth\\Rule','multi'),
                download:Yunqi.auth.check('app\\admin\\controller\\auth\\Rule','download'),
            },
            extend:{
                index_url: 'auth/rule/index',
                add_url: 'auth/rule/add',
                edit_url: 'auth/rule/edit',
                del_url: 'auth/rule/del',
                multi_url: 'auth/rule/multi',
                download_url: 'auth/rule/download',
            },
            indexColumns:[
                {checkbox: true,selectable:function (row,index){
                    if(!row.ismenu){
                        return false;
                    }
                    return true;
                }},
                {field: 'id',title: __('ID'),width:80},
                {field: 'title',expand:true,title: __('标题'),align:'left',formatter:function (data,row){
                    if(row.ismenu){
                        return data;
                    }else{
                        data=JSON.parse(data);
                        return data.join(',');
                    }
                }},
                {field: 'controller', title: __('控制器'),align:'left',formatter:function (data,row){
                    if(!data){
                        return '';
                    }
                    return data;
                }},
                {field: 'action', title: __('方法'),align:'left',formatter:function (data,row){
                    if(!data){
                        return '';
                    }
                    if(row.ismenu){
                        return data;
                    }else{
                        data=JSON.parse(data);
                        return data.join(',');
                    }
                }},
                {field: 'icon',width:80, title: __('图标'),formatter:Yunqi.formatter.slot},
                {field: 'ismenu',width:80, title: __('菜单'),formatter:function(data){
                    if(data==1){
                        return __('是');
                    }
                    return __('否');
                }},
                {field: 'isplatform', title: __('平台'),width:80,formatter: function(data,row){
                    if(row.pid===0 && row.ismenu){
                        let t=Yunqi.formatter.switch;
                        t.value=data;
                        return t;
                    }
                }},
                {field: 'weigh', title: __('权重'),width:80},
                {field: 'status', title: __('状态'),width:80,searchList: {'normal': __('正常'),'hidden': __('隐藏')},formatter: Yunqi.formatter.switch},
                {treeExpand: true},
                {
                    field: 'operate',
                    title: __('操作'),
                    width:150,
                    action:{sort:true,edit:true, del:true}
                }
            ]
        },
        methods: {
            onRender:function (data){
                if(Yunqi.config.action=='edit'){
                    if(parseInt(data.ismenu)===0){
                        let title=JSON.parse(data.title);
                        let action=JSON.parse(data.action);
                        let actions={};
                        for(let i=0;i<title.length;i++){
                            actions[action[i]]=title[i];
                        }
                        data.actions=actions;
                        this.changeMenu(0);
                    }
                }
            }
        }
    }
