Пример #1
0
    def post(self):

        phase = Phase()
        args = parser.parse_args()
        attachments = args.get('attachments')

        if attachments:
            aids = attachments.split(',')

            for aid in aids:
                a = Attachment.query.get(int(aid))
                if a:
                    db.session.expunge(a)
                    pa = PhaseAttachment()
                    pa.attachment = a
                    phase.attachments.append(pa)

            with safe_session(db):
                db.session.add(phase)

        merge(phase, args, ignore=('attachments', ))

        with safe_session(db):
            db.session.add(phase)

        return {Const.MESSAGE_KEY: '创建项目阶段成功'}, Const.STATUS_OK
Пример #2
0
 def post(self):
     args = user_service_item_parser.parse_args()
     us = UserServiceItem()
     merge(us, args)
     with safe_session(db):
         db.session.add(us)
     return {Const.MESSAGE_KEY: '用户服务申请创建成功'}, Const.STATUS_OK
Пример #3
0
 def put(self, csiid):
     csi = CustomServiceItem.query.get_or_404(csiid)
     args = custom_service_item_parser.parse_args()
     merge(usi, args)
     with safe_session(db):
         db.session.add(csi)
     return {Const.MESSAGE_KEY: '用户服务申请修改成功'}, Const.STATUS_OK
Пример #4
0
    def post(self):

        role = Role()
        args = parser.parse_args()
        ps = args.get('permissions')

        if ps:
            ps = ps.split(',')

            for p in ps:
                permission = Permission.query.get(int(p))

                if permission:
                    db.session.expunge(permission)
                    rp = RolePermission()
                    rp.permission = permission
                    role.permissions.append(rp)

            with safe_session(db):
                db.session.add(role)

        merge(role, args, ignore=('permissions', ))

        with safe_session(db):
            db.session.add(role)

        return {Const.MESSAGE_KEY: '角色创建成功'}, Const.STATUS_OK
Пример #5
0
    def post(self, sid):
        schedule = Schedule.query.get_or_404(sid)
        args = parser.parse_args()
        merge(schedule, args, ignore=('from_id', 'to_id', 'project_id'))

        with safe_session(db):
            db.session.add(schedule)
        return {Const.MESSAGE_KEY: '修改约谈表成功'}, Const.STATUS_OK
Пример #6
0
    def put(self, usiid):
        usi = UserServiceItem.query.get_or_404(usiid)
        args = parser.parse_args()
        merge(usi, args, ignore=('ppid', 'service_id'))
        with safe_session(db):
            db.session.add(usi)

        return {Const.MESSAGE_KEY: '用户服务申请修改成功'}, Const.STATUS_OK
Пример #7
0
    def post(self, cid):
        comment = Comment.query.get_or_404(cid)
        args = parser.parse_args()
        merge(comment, args)

        with safe_session(db):
            db.session.add(comment)

        return {Const.MESSAGE_KEY: '点评修改成功'}, Const.STATUS_OK
Пример #8
0
    def post(self, tid):
        ticket = Ticket.query.get_or_404(tid)
        args = parser.parse_args()
        merge(ticket, args, ignore=('author_id', ))

        with safe_session(db):
            db.session.add(ticket)

        return {Const.MESSAGE_KEY: '工单表修改成功'}, Const.STATUS_OK
Пример #9
0
    def post(self):
        bp = BusinessPlan()
        args = parser.parse_args()
        merge(bp, args)

        with safe_session(db):
            db.session.add(bp)

        return {Const.MESSAGE_KEY: '创建成功'}, Const.STATUS_OK
Пример #10
0
    def post(self, aid):
        attachment = Attachment.query.get_or_404(aid)
        args = parser.parse_args()
        merge(attachment, args)

        with safe_session(db):
            db.session.add(attachment)

        return {Const.MESSAGE_KEY: '修改交付物表成功'}, Const.STATUS_OK
Пример #11
0
    def post(self):
        pa = PhaseAttachment()
        args = parser.parse_args()
        merge(pa, args)

        with safe_session(db):
            db.session.add(pa)

        return {Const.MESSAGE_KEY: '创建成功'}, Const.STATUS_OK
Пример #12
0
    def post(self, did):
        department = Department.query.get_or_404(did)
        args = parser.parse_args()
        merge(department, args)

        with safe_session(db):
            db.session.add(department)

        return {Const.MESSAGE_KEY: '修改成功'}, Const.STATUS_OK
Пример #13
0
    def post(self, sid):
        item = ServiceItem.query.get_or_404(sid)
        args = parser.parse_args()
        merge(item, args, ignore=('category_id', ))

        with safe_session(db):
            db.session.add(item)

        return {Const.MESSAGE_KEY: '服务项修改成功'}, Const.STATUS_OK
Пример #14
0
    def post(self):
        pp = ProjectPhase()
        args = parser.parse_args()
        merge(pp, args)

        with safe_session(db):
            db.session.add(pp)

        return {Const.MESSAGE_KEY: '创建成功'}, Const.STATUS_OK
Пример #15
0
    def post(self, ppid):
        pp = ProjectPhase.query.get_or_404(ppid)
        args = parser.parse_args()
        merge(pp, args, ignore=('project_id', 'phase_id'))

        with safe_session(db):
            db.session.add(pp)

        return {Const.MESSAGE_KEY: '修改成功'}, Const.STATUS_OK
Пример #16
0
    def post(self):
        pad = PhaseAttachmentDetail()
        args = parser.parse_args()
        merge(pad, args)

        with safe_session(db):
            db.session.add(pad)

        return {Const.MESSAGE_KEY: '新增附件信息成功'}, Const.STATUS_OK
Пример #17
0
    def post(self, usiid):
        item = CustomServiceItem.query.get_or_404(usiid)
        args = parser.parse_args()
        merge(item, args, ignore=('ppid', 'category_id'))

        with safe_session(db):
            db.session.add(item)

        return {Const.MESSAGE_KEY: '定制订单修改成功'}, Const.STATUS_OK
Пример #18
0
    def post(self):
        department = Department()
        args = parser.parse_args()
        merge(department, args)

        with safe_session(db):
            db.session.add(department)

        return {Const.MESSAGE_KEY: '部门创建成功'}, Const.STATUS_OK
Пример #19
0
    def post(self, paid):
        pa = PhaseAttachment.query.get_or_404(paid)
        args = parser.parse_args()
        merge(pa, args)

        with safe_session(db):
            db.session.add(pa)

        return {Const.MESSAGE_KEY: '修改成功'}, Const.STATUS_OK
Пример #20
0
    def post(self, pid):
        permission = Permission.query.get_or_404(pid)
        args = parser.parse_args()
        merge(permission, args)

        with safe_session(db):
            db.session.add(permission)

        return {Const.MESSAGE_KEY: '权限修改成功'}, Const.STATUS_OK
Пример #21
0
    def post(self, bid):
        bp = BusinessPlan.query.get_or_404(bid)
        args = parser.parse_args()
        merge(bp, args)

        with safe_session(db):
            db.session.add(bp)

        return {Const.MESSAGE_KEY: '修改成功'}, Const.STATUS_OK
Пример #22
0
    def put(self, pid):
        phase = Phase.query.get_or_404(pid)
        args = phase_parser.parse_args()
        merge(phase, args, ignore=('attachments', ))

        with safe_session(db):
            db.session.add(phase)

        return {Const.MESSAGE_KEY: '项目阶段修改成功'}, Const.STATUS_OK
Пример #23
0
    def post(self):
        sc = ServiceItemCategory()
        args = parser.parse_args()
        merge(sc, args)

        with safe_session(db):
            db.session.add(sc)

        return {Const.MESSAGE_KEY: '服务包类别创建成功'}, Const.STATUS_OK
Пример #24
0
    def post(self, uaid):
        attachment = UserAttachment.query.get_or_404(uaid)
        args = parser.parse_args()
        merge(attachment, args, ignore=('ppid', 'attachment_id'))

        with safe_session(db):
            db.session.add(attachment)

        return {Const.MESSAGE_KEY: '交付物修改成功'}, Const.STATUS_OK
Пример #25
0
    def post(self, usiid):
        usi = UserServiceItem.query.get_or_404(usiid)
        args = parser.parse_args()
        merge(usi, args)

        with safe_session(db):
            db.session.add(usi)

        return {Const.MESSAGE_KEY: '用户订单修改成功'}, Const.STATUS_OK
Пример #26
0
    def post(self, sid):

        sc = ServiceItemCategory.query.get_or_404(sid)
        args = parser.parse_args()
        merge(sc, args)

        with safe_session(db):
            db.session.add(sc)

        return {Const.MESSAGE_KEY: '服务包类别修改成功'}, Const.STATUS_OK
Пример #27
0
    def post(self):
        schedule = Schedule()

        args = parser.parse_args()
        merge(schedule, args)

        with safe_session(db):
            db.session.add(schedule)

        return {Const.MESSAGE_KEY: '约谈记录成功'}, Const.STATUS_OK
Пример #28
0
    def post(self, pid):

        phase = Phase.query.get_or_404(pid)
        args = parser.parse_args()
        merge(phase, args)

        with safe_session(db):
            db.session.add(phase)

        return {Const.MESSAGE_KEY: '项目阶段修改成功'}, Const.STATUS_OK
Пример #29
0
    def post(self):

        ticket = Ticket()
        args = parser.parse_args()
        merge(ticket, args)

        with safe_session(db):
            db.session.add(ticket)

        return {Const.MESSAGE_KEY: '工单表创建成功'}, Const.STATUS_OK
Пример #30
0
    def post(self):

        attachment = UserAttachment()
        args = parser.parse_args()
        merge(attachment, args)

        with safe_session(db):
            db.session.add(attachment)

        return {Const.MESSAGE_KEY: '交付物发布成功'}, Const.STATUS_OK