# -*- coding: utf-8 -*- """ demeter web page name:origin.py 溯源相关页面 author:rabin """ from .__load__ import * class batch_path(Load): @Web.auth @Web.setting def get(self): self.set( name = u'溯源批次' ,path = '/origin/batch' ,width = '600' ,height = '600' ,add = False ,edit = False ,search = (('land_id-select-'), (u'地块')) ,thead = (u'产品名称', u'种植时间', u'采收时间', u'地块') ,tbody = ('name', 'zzdate', 'csdate', 'land') ,state = False ) self.data['common']['search_land_id-select-'] = self.service('common').list('farm_work_land') self.list('origin_batch') if self.data['list']: for key, value in enumerate(self.data['list']): land = self.service('common').one('farm_work_land', id=value['land_id']) self.data['list'][key]['land'] = land['name'] self.show('list') class batch_update_path(Load): @Web.auth @Web.setting def get(self): self.set( path = '/origin/batch' ,label = (u'产品名称', u'种植时间',u'采收时间',u'设备网关',u'地块',u'图像记录') ,update = ('name-input-required', 'zzdate-date-required', 'csdate-date-required','gateway_id-select-required','land_id-select-required','pic-pic-required') ,update_gateway_id = self.service('common').list('device_gateway', order='hardware_id asc') ,update_land_id = self.service('common').list('farm_work_land') ) self.one('origin_batch') self.show('update') @Web.auth @Web.setting def post(self): self.update('origin_batch') @Web.auth @Web.setting def delete(self): self.drop('origin_batch')