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