# -*- coding: utf-8 -*- """ demeter web page name:record.py 统计记录相关 author:rabin """ from .__load__ import * class record_path(Load): @Web.auth @Web.setting def get(self): self.set( name = u'记录点类型管理' ,path = '/record/record' ,width = '600' ,height = '600' ,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'类型名称')) ,thead = (u'类型ID', u'类型名称', u'操作类型', u'更新时间') ,tbody = ('id','name','type', 'cdate') ,state = True ) self.list('record_type') if self.data['list']: for key, value in enumerate(self.data['list']): id = str(value['id']) param = '?search_site_id-select-=' + id if value['type'] == 1: self.data['list'][key]['type'] = '浏览' else: self.data['list'][key]['type'] = '操作' self.show('list') class record_update_path(Load): @Web.auth @Web.setting def get(self): typeValue = [{'id':1, 'name':'浏览'}, {'id':2, 'name':'操作'}] self.set( path = '/record/record' ,label = (u'类型名称',u'操作类型') ,update = ('name-input-required','type-select-required') ,update_type = typeValue ) self.one('record_type') self.show('update') @Web.auth @Web.setting def post(self): self.update('record_type') @Web.auth @Web.setting def delete(self): self.drop('record_type') class data_path(Load): @Web.auth @Web.setting def get(self): self.set( name = u'记录数据' ,path = '/record/data' ,width = '600' ,height = '600' ,edit = False ,add = False ,search = (('label-1','cdate-time-start','cdate-time-end','record_type_id-select-'), (u'日期范围',u'开始时间',u'截止时间',u'选择类型')) ,thead = (u'操作名', u'记录类型', u'用户', u'更新时间') ,tbody = ('name', 'type', 'uid', 'cdate') ,state = False ) self.data['common']['search_record_type_id-select-'] = self.service('common').list('record_type') self.list('record') if self.data['list']: for key, value in enumerate(self.data['list']): typeData = self.service('common').one('record_type', id=value['record_type_id']) self.data['list'][key]['type'] = typeData['name'] self.show('list')