Esempio n. 1
0
def doc_tree(id):
    orgs = OA_Org.query.filter_by(id=id).order_by("id").all()
    orgs_list = []
    if orgs:
        for obj in orgs:
            sql = "FIND_IN_SET(id ,getChildOrgLst('"+str(obj.id)+"'))"
            orgs_list += OA_Org.query.filter(sql).order_by("id").all()
    
    orgs_json = helpers.show_result_content(list(set(orgs_list)))
    orgs_json_obj = json.loads(orgs_json)
    
    for json_obj in orgs_json_obj:
        json_obj['type'] = "OA_Org"
        json_obj['icon'] = "/static/css/zTreeStyle/img/diy/1_open.png"
        projects = OA_Project.query.filter("p_org_id="+str(json_obj["id"])+" and treeType<>2").all()
        if projects:
            for pro_obj in projects:
                sql = "FIND_IN_SET(id ,getChildProjectLst('"+str(pro_obj.id)+"'))"
                projects_list = OA_Project.query.filter(sql).order_by("id").all()
                for objP in projects_list:
                    objP.name = objP.project_name
                    objP.type = "OA_Project"
                    objP.icon = "/static/css/zTreeStyle/img/diy/2.png"
                    
            json_obj['children'] = json.loads(helpers.show_result_content(projects))
    return json.dumps(orgs_json_obj)# 返回json
Esempio n. 2
0
def fytj_tree():
    user = '';
    #财务能看到所有报销
    if str(current_user.id) =='49':
        user = '******'
    else:
        user = current_user.id
    orgs = OA_Org.query.filter("manager="+str(user)+" and version='2015'").all()
    orgs_list = []
    if orgs:
        for obj in orgs:
            sql = "FIND_IN_SET(id ,getChildOrgLst('"+str(obj.id)+"'))"
            orgs_list += OA_Org.query.filter(sql).all()
    
    orgs_json = helpers.show_result_content(list(set(orgs_list)))
    orgs_json_obj = json.loads(orgs_json)
    
    for json_obj in orgs_json_obj:
        json_obj['type'] = "OA_Org"
        json_obj['icon'] = "/static/css/zTreeStyle/img/diy/1_open.png"
        projects = OA_Project.query.filter_by(p_org_id=json_obj["id"]).all()
        if projects:
            for pro_obj in projects:
                sql = "FIND_IN_SET(id ,getChildProjectLst('"+str(pro_obj.id)+"'))"
                projects_list = OA_Project.query.filter(sql).all()
                for objP in projects_list:
                    objP.name = objP.project_name
                    objP.type = "OA_Project"
                    objP.icon = "/static/css/zTreeStyle/img/diy/2.png"
                    
            json_obj['children'] = json.loads(helpers.show_result_content(projects))
        
    return json.dumps(orgs_json_obj)# 返回json
Esempio n. 3
0
def init_access_tree(id):
    # 加载所有
    if id == 0:
        tree = OA_Menu.query.order_by("id").all()
    else:
        tree = OA_Menu.query.filter_by(pid=id).order_by("id").all()

    return helpers.show_result_content(tree)  # 返回json
Esempio n. 4
0
def init_org_tree(id):
	# 加载所有
	if id == 0:
		tree = OA_Org.query.filter_by(version='2015').order_by("id").all()

	# 加载对应id的子节点
	else:
		tree = OA_Org.query.filter("pId=id and version='2015'").order_by("id").all()

	return helpers.show_result_content(tree) # 返回json
Esempio n. 5
0
def init_project_tree(pid):
    tree = []
    roots = OA_Project.query.filter_by(p_org_id=pid).all()
    if roots:
        for obj in roots:
            sql = "FIND_IN_SET(id ,getChildProjectLst('"+str(obj.id)+"'))"
            tree += OA_Project.query.filter(sql).all()
    else:
        tree = None
        
    return helpers.show_result_content(list(set(tree))) # 返回json
Esempio n. 6
0
def get_user(type,p_id):
    docs = OA_ProjectGroup.query.filter_by(type=type,project_id=p_id).all()
    users= OA_User.query.order_by("id").all()
    for user in users:
        ifequal = 'false'
        for dos in docs:
            if dos.user_id==user.id:
                ifequal ='true'
        if ifequal=='true':
            user.checked = 'checked'
        else:
            user.checked = 'unchecked'
    return helpers.show_result_content(users) # 返回json
Esempio n. 7
0
def information(type,p_id,page):
    page_count = str((page-1)*PER_PAGE)+","+str(page*PER_PAGE)
    docs = ""
    if type == "OA_Org":
        docs = OA_View_Doc_Privilege.query.filter("org_id="+str(p_id)+" and (privilege_master_id="+str(current_user.id)+") LIMIT "+page_count).all()
        lenth = len(OA_View_Doc_Privilege.query.filter("org_id="+str(p_id)+" and (privilege_master_id="+str(current_user.id)+")").all())
        if int(lenth%10)==0:
            pages = lenth/10
        else:
            pages = lenth/10+1
    else:
        docs = OA_View_Doc_Privilege.query.filter("project_id="+str(p_id)+" and (privilege_master_id="+str(current_user.id)+") LIMIT "+page_count).all()
        lenth = len(OA_View_Doc_Privilege.query.filter("project_id="+str(p_id)+" and (privilege_master_id="+str(current_user.id)+")").all())
        if int(lenth%10)==0:
            pages = lenth/10
        else:
            pages = lenth/10+1
    for doc in docs:
        doc.pages =pages
        doc.page = page
    return helpers.show_result_content(docs)
Esempio n. 8
0
File: jggl.py Progetto: JohnCny/xhsc
def init_org_tree():
    # 加载所有
    tree = SC_Org.query.order_by("id").all()
    return helpers.show_result_content(tree) # 返回json
Esempio n. 9
0
def get_doc_version(id):
    doc = OA_Doc.query.filter_by(id=id).first()
    doc_version = OA_Doc_Version.query.filter_by(doc_id=id).order_by("version").all()
    for obj in doc_version:
        obj.create_user = doc.create_user
    return helpers.show_result_content(doc_version) # 返回json
Esempio n. 10
0
def get_project_docs(type,p_id):
    if type == "OA_Org":
        docs = OA_View_Doc_Privilege.query.filter("org_id="+str(p_id)+" and privilege_master_id="+str(current_user.id)+" LIMIT 0,10").all()
    else:
        docs = OA_View_Doc_Privilege.query.filter("project_id="+str(p_id)+" and privilege_master_id="+str(current_user.id)+" LIMIT 0,10").all()
    return helpers.show_result_content(docs) # 返回json
Esempio n. 11
0
def get_project_group(type,p_id):
    docs = OA_ProjectGroup.query.filter_by(type=type,project_id=p_id).all()
    for dos in docs:
        dos.real_name=dos.oa_project_group_ibfk_1.real_name
    return helpers.show_result_content(docs) # 返回json