| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 | #!/usr/bin/env python# -*- coding: utf-8 -*-"""    demeter web page    name:origin.py 溯源相关页面    author:rabin"""from __load__ import *class batch_path(Load):	@Web.auth	def get(self):		self.common(			name = u'溯源批次'			,path = '/origin/batch'			,width = '600'			,height = '600'			,add = False			,edit = False			,search = (('farm_id-select-','land_id-select-'), (u'选择农场',u'地块'))			,thead = (u'所属农场', u'产品名称', u'种植时间', u'采收时间', u'地块')			,tbody = ('farm','name', 'zzdate', 'csdate', 'land')			,state = False		)		self.data['common']['search_farm_id-select-'] = Demeter.config['setting']['farmList']		self.data['common']['search_land_id-select-'] = self.service('common').list('farm_work_land')		self.commonList('origin_batch')		if self.data['list']:			for key, value in enumerate(self.data['list']):				farm = self.service('common').one('farm', id=value['farm_id'])				self.data['list'][key]['farm'] = farm['name']				land = self.service('common').one('farm_work_land', id=value['land_id'])				self.data['list'][key]['land'] = land['name']		self.commonView('list')class batch_update_path(Load):	@Web.auth	def get(self):		self.common(			path = '/origin/batch'			,label = (u'所属农场',u'产品名称', u'种植时间',u'采收时间',u'设备网关',u'地块',u'图像记录')			,update = ('farm_id-select-required','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')			,update_land_id = self.service('common').list('farm_work_land')			,update_farm_id = Demeter.config['setting']['farmList']		)		self.commonOne('origin_batch')		self.commonView('update')	@Web.auth	def post(self):		self.commonUpdate('origin_batch')	@Web.auth	def delete(self):		self.commonDelete('origin_batch')
 |