/* jshint esversion: 6 */
//兼容部分安卓机型globalthis报错
!(function(t){
	function e(){
		var e = this || self;
		(e.globalThis = e), delete t.prototype._T_;
	}
	"object" != typeof globalThis && (this ? e() : (t.defineProperty(t.prototype, "_T_", {
		configurable: !0,
		get: e,
	}), _T_))
})(Object);

    var app = new Vue({
        el: '#app',  
        data: {  
            searchQuery12: '',  
            organizations: [  
                {  
                    name: 'ISG测试工作圈',  
                    memberCount: 10,  
                    isExpanded: false,  
                    subOrgs: [  
                        { name: '长沙分公司', memberCount: 5, members: ['张三', '李四', '王五', '赵六', '孙七'] },  
                        // 其他分公司...  
                    ],  
                    members: []  
                },  
                {  
                    name: '产品营销伙伴',  
                    memberCount: 20,  
                    isExpanded: false,  
                    subOrgs: [  
                        { name: '东莞分公司', memberCount: 10, members: ['...'] },  
                        // 其他分公司...  
                    ],  
                    members: []  
                }  
                // 其他组织...  
            ],  
            selectedOrg: null,  
            tooltipVisible: false,  
            tooltipOrg: null,  
            tooltipTop: 0,  
            tooltipLeft: 0  
        },  
        computed: {  
            // filteredOrganizations() {  
            //     const query = this.searchQuery.toLowerCase();  
            //     return this.organizations.filter(org =>   
            //         org.name.toLowerCase().includes(query) ||   
            //         this.getFlatMembers(org).some(member => member.toLowerCase().includes(query))  
            //     );  
            // }  
        },  
        methods: {  
            toggleOrg(org) {  
                org.isExpanded = !org.isExpanded;  
            },  
            showSubOrgs(org) {  
                this.selectedOrg = null; // 隐藏当前选中的成员列表  
                this.tooltipOrg = org;  
                this.tooltipVisible = true;  
                const rect = org.getBoundingClientRect();  
                this.tooltipTop = rect.bottom + 10;  
                this.tooltipLeft = rect.left;  
            },  
            hideTooltip() {  
                this.tooltipVisible = false;  
            },  
            showMembers(org) {  
                this.selectedOrg = org;  
                this.tooltipVisible = false;  
            },  
            getFlatMembers(org) {  
                return org.members.concat(...org.subOrgs.map(subOrg => this.getFlatMembers(subOrg)));  
            }  
        }  
    });
    
 




