<?php /*a:2:{s:69:"D:\phpEnv\www\Gong-Ying-Lian-API\app\admin\view\auth\group\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";
import {inArray} from "http://yun.cn/assets/js/util.js";
const doCheck=function (tree,checkKey){
    tree.forEach(res=>{
        checkKey.push(res.id);
        if(res.children && res.children.length>0){
            doCheck(res.children,checkKey);
        }
    });
}
export default{
    components:{'YunTable':table},
    data:{
        auth:{
            add:Yunqi.auth.check('app\\admin\\controller\\auth\\Group','add'),
            edit:Yunqi.auth.check('app\\admin\\controller\\auth\\Group','edit'),
            del:Yunqi.auth.check('app\\admin\\controller\\auth\\Group','del'),
            multi:Yunqi.auth.check('app\\admin\\controller\\auth\\Group','multi'),
        },
        extend:{
            index_url: 'auth/group/index',
            add_url: 'auth/group/add',
            edit_url: 'auth/group/edit',
            del_url: 'auth/group/del',
            multi_url: 'auth/group/multi'
        },
        columns:[
            {checkbox: true,selectable:function (row,index){
                if(inArray(Yunqi.data.groupids,row.id)){
                    return false;
                }
                return true;
            }},
            {field: 'id',title: __('ID'),width:80},
            {field: 'name', title: __('名称'),align:'left'},
            {field: 'status', title: __('状态'),searchList: {'normal': __('正常'),'hidden': __('隐藏')},formatter:function(data,row){
                let sw=Yunqi.formatter.switch;
                sw.activeValue='normal';
                sw.inactiveValue='hidden';
                sw.value=row.status;
                if(inArray(Yunqi.data.groupids,row.id)){
                    sw.disabled=true;
                }else{
                    sw.disabled=false;
                }
                return sw;
            }},
            {treeExpand: true},
            {
                field: 'operate',
                title: __('操作'),
                width:150,
                action:{
                    edit:function(row){
                        return !inArray(Yunqi.data.groupids,row.id);
                    },
                    del:function(row){
                        return !inArray(Yunqi.data.groupids,row.id);
                    }
                }
            }
        ]
    },
    methods: {

    }
}
