Exemple #1
0
def index():
    if current_user.is_authenticated:
        flag = utils.information_completion(current_user)
        if flag:
            temps = DocTemplates.templates_index()
            return render_template('main/index.html',
                                   title="首页",
                                   DocTemplates=temps)
        else:
            flash('请首先完善个人信息,实名认证,绑定部门', 'danger')
            return redirect(url_for('User.setting'))
    else:
        temps = DocTemplates.templates_index()
        return render_template('main/index.html',
                               title="首页",
                               DocTemplates=temps)
Exemple #2
0
def qplan():
    if current_user.is_authenticated:
        flag = utils.information_completion(current_user)
        check_flag = current_user.flag
        if flag and check_flag:
            temps = DocTemplates.templates_index()
            quarter = utils.quarter_calc()
            templates = DocTemplates.templates_vkreport()
            if current_user.role == 1:
                querydata = Project.query.filter_by(
                    manager=current_user.username,
                    quarter=utils.quarter_calc()).first()
                if (querydata) != None:
                    data = querydata.to_dict()
                    return render_template('QuarterPlan/proManager.html',
                                           templates=templates,
                                           msg=data)
                else:
                    flash("请确认用户名是否正确,或部门总监暂未创建项目", 'info')
                    return redirect(url_for('main.index'))
            elif current_user.role == 2:
                return render_template('QuarterPlan/departDirector.html',
                                       templates=templates,
                                       quarter=quarter)
            elif current_user.role == 3 or current_user.role == 4:
                return render_template('QuarterPlan/headManager.html',
                                       templates=templates)
            elif current_user.role == 5:
                return render_template('QuarterPlan/techDirector.html',
                                       templates=templates,
                                       quarter=quarter)
            else:
                abort(404)
        elif flag:
            flash('请等待或者联系管理员进行信息审核', 'info')
            return redirect(url_for('main.index'))
        else:
            flash('请首先完善个人信息,实名认证,绑定部门', 'danger')
            return redirect(url_for('User.setting'))
    else:
        flash("权限管理模块,请登录后访问!", 'info')
        return redirect(url_for('User.login'))