|
@@ -7,144 +7,6 @@
|
|
|
"""
|
|
|
from __load__ import *
|
|
|
|
|
|
-class page_path(Load):
|
|
|
- @Web.auth
|
|
|
- def get(self):
|
|
|
- self.common(
|
|
|
- name = u'页面' #中文名
|
|
|
- ,path = 'page' #路径
|
|
|
- ,width = '600' # 新增页面的宽度
|
|
|
- ,height = '200' # 新增页面的高度
|
|
|
- ,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'页面名称')) #搜索
|
|
|
- ,thead = (u'页面名称', '子页面', u'更新时间') #表头
|
|
|
- ,tbody = ('name', 'group', 'cdate') #表内容
|
|
|
- ,state = True #启用回收站
|
|
|
- )
|
|
|
- self.commonList('device_page')
|
|
|
- if self.data['list']:
|
|
|
- for key, value in enumerate(self.data['list']):
|
|
|
- self.data['list'][key]['group'] = '<a href="/device/group?search_page_id-select-='+value['id']+'">分组</a>'
|
|
|
- self.commonView('list')
|
|
|
-
|
|
|
-class page_update_path(Load):
|
|
|
- @Web.auth
|
|
|
- def get(self):
|
|
|
- self.common(
|
|
|
- path = 'page'
|
|
|
- ,label = (u'标题',)
|
|
|
- ,update = ('name-input-required',)
|
|
|
- )
|
|
|
- self.commonOne('device_page')
|
|
|
- self.commonView('update')
|
|
|
- @Web.auth
|
|
|
- def post(self):
|
|
|
- self.commonUpdate('device_page')
|
|
|
- @Web.auth
|
|
|
- def delete(self):
|
|
|
- self.commonDelete('device_page')
|
|
|
-
|
|
|
-class group_path(Load):
|
|
|
- @Web.auth
|
|
|
- def get(self):
|
|
|
- self.common(
|
|
|
- name = u'分组'
|
|
|
- ,path = 'group'
|
|
|
- ,width = '600'
|
|
|
- ,height = '250'
|
|
|
- ,full = True
|
|
|
- ,search = (('label-1','cdate-time-start','cdate-time-end','page_id-select-','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'选择页面',u'分组名称'))
|
|
|
- ,thead = (u'页面名称', u'分组名称', '设备', u'更新时间')
|
|
|
- ,tbody = ('page', 'name', 'device', 'cdate')
|
|
|
- ,state = True
|
|
|
- )
|
|
|
- self.data['common']['search_page_id-select-'] = self.service('common').list('device_page')
|
|
|
- self.commonList('device_group')
|
|
|
- if self.data['list']:
|
|
|
- for key, value in enumerate(self.data['list']):
|
|
|
- page = self.service('common').one('device_page', id=value['page_id'])
|
|
|
- self.data['list'][key]['page'] = page['name']
|
|
|
- if value['devices']:
|
|
|
- #self.data['list'][key]['device'] = '<a href="/device/info?search_id-input-ins='+value['devices']+'">查看设备</a>'
|
|
|
- self.data['list'][key]['device'] = '<a>查看设备</a>'
|
|
|
- else:
|
|
|
- self.data['list'][key]['device'] = '暂无设备'
|
|
|
- self.commonView('list')
|
|
|
-
|
|
|
-class group_update_path(Load):
|
|
|
- @Web.auth
|
|
|
- def get(self):
|
|
|
- self.common(
|
|
|
- path = 'group'
|
|
|
- ,label = (u'所属页面', u'标题', u'选择设备')
|
|
|
- ,update = ('page_id-select-required','name-input-required', 'devices-checkboxs-')
|
|
|
- ,update_page_id = self.service('common').list('device_page')
|
|
|
- ,update_devices = self.getDevice()
|
|
|
- )
|
|
|
- self.commonOne('device_group')
|
|
|
- self.commonView('update')
|
|
|
- @Web.auth
|
|
|
- def post(self):
|
|
|
- self.commonUpdate('device_group')
|
|
|
- @Web.auth
|
|
|
- def delete(self):
|
|
|
- self.commonDelete('device_group')
|
|
|
-
|
|
|
- def getDevice(self):
|
|
|
- gateway = self.service('common').list('device_gateway')
|
|
|
- if gateway:
|
|
|
- for key, value in enumerate(gateway):
|
|
|
- gateway[key]['child'] = self.service('common').list('device_info', True, {'gateway_id-input-':value['id']})
|
|
|
- return gateway
|
|
|
-
|
|
|
-class mul_path(Load):
|
|
|
- @Web.auth
|
|
|
- def get(self):
|
|
|
- self.common(
|
|
|
- name = u'批量控制'
|
|
|
- ,path = 'mul'
|
|
|
- ,width = '600'
|
|
|
- ,height = '250'
|
|
|
- ,full = True
|
|
|
- ,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'分组名称'))
|
|
|
- ,thead = (u'分组名称', '设备', u'更新时间')
|
|
|
- ,tbody = ('name', 'device', 'cdate')
|
|
|
- ,state = True
|
|
|
- )
|
|
|
- self.commonList('device_mul')
|
|
|
- if self.data['list']:
|
|
|
- for key, value in enumerate(self.data['list']):
|
|
|
- if value['devices']:
|
|
|
- #self.data['list'][key]['device'] = '<a href="/device/info?search_id-input-ins='+value['devices']+'">设备</a>'
|
|
|
- self.data['list'][key]['device'] = '<a>查看设备</a>'
|
|
|
- else:
|
|
|
- self.data['list'][key]['device'] = '暂无设备'
|
|
|
- self.commonView('list')
|
|
|
-
|
|
|
-class mul_update_path(Load):
|
|
|
- @Web.auth
|
|
|
- def get(self):
|
|
|
- self.common(
|
|
|
- path = 'mul'
|
|
|
- ,label = (u'标题', u'选择设备')
|
|
|
- ,update = ('name-input-required', 'devices-checkboxs-')
|
|
|
- ,update_devices = self.getDevice()
|
|
|
- )
|
|
|
- self.commonOne('device_mul')
|
|
|
- self.commonView('update')
|
|
|
- @Web.auth
|
|
|
- def post(self):
|
|
|
- self.commonUpdate('device_mul')
|
|
|
- @Web.auth
|
|
|
- def delete(self):
|
|
|
- self.commonDelete('device_mul')
|
|
|
-
|
|
|
- def getDevice(self):
|
|
|
- gateway = self.service('common').list('device_gateway')
|
|
|
- if gateway:
|
|
|
- for key, value in enumerate(gateway):
|
|
|
- gateway[key]['child'] = self.service('common').list('device_info', True, {'gateway_id-input-':value['id']})
|
|
|
- return gateway
|
|
|
-
|
|
|
class gateway_path(Load):
|
|
|
@Web.auth
|
|
|
def get(self):
|
|
@@ -152,7 +14,7 @@ class gateway_path(Load):
|
|
|
name = u'网关'
|
|
|
,path = 'gateway'
|
|
|
,width = '600'
|
|
|
- ,height = '300'
|
|
|
+ ,height = '500'
|
|
|
#,add = False
|
|
|
#,edit = False
|
|
|
,search = (('label-1','cdate-time-start','cdate-time-end','farm_id-select-','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'选择农场',u'网关名称'))
|
|
@@ -166,26 +28,33 @@ class gateway_path(Load):
|
|
|
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']
|
|
|
- if value['status']:
|
|
|
- self.data['list'][key]['status'] = '开启'
|
|
|
- else:
|
|
|
- self.data['list'][key]['status'] = '关闭'
|
|
|
-
|
|
|
- if value['power_status']:
|
|
|
- self.data['list'][key]['power_status'] = '连接'
|
|
|
- else:
|
|
|
- self.data['list'][key]['power_status'] = '断开'
|
|
|
+ device = self.service('common').list('device_info', search={'hardware_id':value['hardware_id']})
|
|
|
+ self.data['list'][key]['status'] = '断开'
|
|
|
+ self.data['list'][key]['power_status'] = '断开'
|
|
|
+ self.data['list'][key]['power_num'] = 0
|
|
|
+ if device:
|
|
|
+ for v in device:
|
|
|
+ if v['value']:
|
|
|
+ v['value'] = float(v['value'])
|
|
|
+ if v['hardware_type'] == 5 and v['value'] == 1:
|
|
|
+ self.data['list'][key]['status'] = '连接'
|
|
|
+ elif v['hardware_type'] == 4 and v['value']:
|
|
|
+ self.data['list'][key]['power_status'] = '连接'
|
|
|
+ self.data['list'][key]['power_num'] = v['value']
|
|
|
self.commonView('list')
|
|
|
|
|
|
class gateway_update_path(Load):
|
|
|
@Web.auth
|
|
|
def get(self):
|
|
|
+ id = self.input('id')
|
|
|
+ if id:
|
|
|
+ hardware_id = 'hardware_id-show-required'
|
|
|
+ else:
|
|
|
+ hardware_id = 'hardware_id-input-required'
|
|
|
self.common(
|
|
|
path = 'gateway'
|
|
|
- #,label = (u'网关名称', u'设备id',u'网关连接状态',u'电源数值',u'电源连接状态')
|
|
|
- ,label = (u'所属农场', u'网关名称', u'设备id')
|
|
|
- ,update = ('farm_id-select-required', 'name-input-required','hardware_id-input-required')
|
|
|
- #,update = ('name-input-required','hardware_id-input-required','status-switch--开启|关闭','power_num-input-','power_status-switch--连接|断开')
|
|
|
+ ,label = (u'所属农场', u'网关名称', u'设备id', u'设备分布图纸')
|
|
|
+ ,update = ('farm_id-select-required', 'name-input-required',hardware_id, 'pic-pic-')
|
|
|
,update_farm_id = Demeter.config['setting']['farmList']
|
|
|
)
|
|
|
self.commonOne('device_gateway')
|
|
@@ -193,26 +62,18 @@ class gateway_update_path(Load):
|
|
|
@Web.auth
|
|
|
def post(self):
|
|
|
id = self.commonUpdate('device_gateway')
|
|
|
- self.hardware(id)
|
|
|
+ self.device(id)
|
|
|
|
|
|
@Web.auth
|
|
|
def delete(self):
|
|
|
self.commonDelete('device_gateway')
|
|
|
|
|
|
@Web.auth
|
|
|
- def hardware(self, id):
|
|
|
- hardware_id = self.data['update']['hardware_id']
|
|
|
- if hardware_id and id > 0:
|
|
|
- info = self.service('common').one('hardware', hardware_id=hardware_id)
|
|
|
- if not info:
|
|
|
- insert = {}
|
|
|
- insert['farm_id'] = self.data['update']['farm_id']
|
|
|
- insert['hardware_id'] = hardware_id
|
|
|
- insert['gateway_id'] = id
|
|
|
- insert['hardware_type'] = 1
|
|
|
- self.service('common').update('hardware', None, insert)
|
|
|
-
|
|
|
-
|
|
|
+ def device(self, id):
|
|
|
+ info = self.service('common').one('device_gateway', id=id)
|
|
|
+ hardware_id = info['hardware_id']
|
|
|
+ self.service('device').upGatewayStatus(self.data['update']['farm_id'], id, hardware_id)
|
|
|
+
|
|
|
class info_path(Load):
|
|
|
@Web.auth
|
|
|
def get(self):
|
|
@@ -220,43 +81,69 @@ class info_path(Load):
|
|
|
name = u'设备'
|
|
|
,path = 'info'
|
|
|
,width = '600'
|
|
|
- ,height = '300'
|
|
|
+ ,height = '400'
|
|
|
+ #,button = ({'name':'添加摄像机','link':'/device/camera_update'},{'name':'添加摄像头','link':'/device/camera_pic_update'})
|
|
|
+ ,button = ({'name':'添加摄像头','link':'/device/camera_pic_update'},)
|
|
|
,add = False
|
|
|
#,edit = False
|
|
|
- ,search = (('farm_id-select-','type_id-select-', 'gateway_id-select-', 'hardware_type-select-'), (u'选择农场',u'设备类型',u'网关',u'硬件类型'))
|
|
|
- ,thead = (u'所属农场', u'设备名称', u'设备id', u'连接状态', u'值', u'设备类型', u'网关',u'硬件类型')
|
|
|
- ,tbody = ('farm','name', 'hardware_id', 'status', 'show', 'type', 'gateway', 'hardware_type')
|
|
|
+ ,search = (('farm_id-select--gateway_id', 'hardware_type-select-','type_id-select-', 'status-hidden-'), (u'选择农场',u'硬件类型',u'设备类型', '设备状态'))
|
|
|
+ ,thead = (u'所属农场', u'设备名称', u'设备id', u'当前值', u'设备类型', u'网关',u'硬件类型')
|
|
|
+ ,tbody = ('farm','name', 'hardware_id', 'value', 'type', 'gateway', 'hardware_type')
|
|
|
,state = False
|
|
|
)
|
|
|
- self.data['common']['search_farm_id-select-'] = Demeter.config['setting']['farmList']
|
|
|
+ self.data['common']['search_farm_id-select--gateway_id'] = Demeter.config['setting']['farmList']
|
|
|
self.data['common']['search_type_id-select-'] = self.service('common').list('device_type')
|
|
|
- self.data['common']['search_gateway_id-select-'] = self.service('common').list('device_gateway')
|
|
|
+ self.data['common']['search_gateway_id-select---farm_id'] = self.service('common').list('device_gateway')
|
|
|
self.data['common']['search_hardware_type-select-'] = self.service('common').list('hardware_type')
|
|
|
- del self.data['common']['search_hardware_type-select-'][0]
|
|
|
- self.commonList('device_info')
|
|
|
+ """
|
|
|
+ if self.data['common']['search_hardware_type-select-']:
|
|
|
+ del self.data['common']['search_hardware_type-select-'][0]
|
|
|
+ """
|
|
|
+ status = self.input('search_status-hidden-', False)
|
|
|
+ if status:
|
|
|
+ self.data['search']['status-hidden-'] = False
|
|
|
+
|
|
|
+ self.commonList('device_info', order='id desc')
|
|
|
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']
|
|
|
self.data['list'][key]['type'] = '无'
|
|
|
- if value['type_id']:
|
|
|
- info = self.service('common').one('device_type', id=value['type_id'])
|
|
|
- if info:
|
|
|
- self.data['list'][key]['type'] = info['name']
|
|
|
+ if value['type_id'] > 0:
|
|
|
+ type_info = self.service('common').one('device_type', id=value['type_id'])
|
|
|
+ if type_info:
|
|
|
+ self.data['list'][key]['type'] = type_info['name']
|
|
|
info = self.service('common').one('device_gateway', id=value['gateway_id'])
|
|
|
self.data['list'][key]['gateway'] = info['name']
|
|
|
if value['status']:
|
|
|
- self.data['list'][key]['status'] = '连接'
|
|
|
+ self.data['list'][key]['status'] = '已连接'
|
|
|
else:
|
|
|
- self.data['list'][key]['status'] = '断开'
|
|
|
- if value['num'] and value['show']:
|
|
|
- value['show'] = str(value['show'])
|
|
|
- # 根据设备类型type_id得到单位和计算公式
|
|
|
- self.data['list'][key]['show'] = '<a href="/device/stat?id='+value['id']+'&search_date-select-=1&method=list">'+value['show'] + '</a><br />更新时间:' + Demeter.date(value['cdate']) + '<br /><a href="/device/stat?id='+value['id']+'&search_date-select-=1&method=avg">[平均值统计]</a> <a href="/device/stat?id='+value['id']+'&search_date-select-=1&method=maxmin">[高低值统计]</a>'
|
|
|
- elif value['show']:
|
|
|
- self.data['list'][key]['show'] = '<a href="/device/pic?id='+value['id']+'"><img src="'+value['show']+'" width="200px"/></a><br />更新时间:' + Demeter.date(value['cdate'])
|
|
|
- else:
|
|
|
- self.data['list'][key]['show'] = ''
|
|
|
+ self.data['list'][key]['status'] = '已断开'
|
|
|
+
|
|
|
+ if not value['value']:
|
|
|
+ value['value'] = ''
|
|
|
+ if value['hardware_type'] == 2 or value['hardware_type'] == 4:
|
|
|
+ if value['type_id'] > 0 and type_info:
|
|
|
+ value['value'] = value['value'] + ' ' + type_info['unit']
|
|
|
+ self.data['list'][key]['value'] = '<a href="/device/stat?id='+value['id']+'&search_date-select-=1&method=list">'+value['value'] + '</a><br />更新时间:' + Demeter.date(value['cdate']) + '<br /><a href="/device/stat?id='+value['id']+'&search_date-select-=1&method=avg">[平均值统计]</a> <a href="/device/stat?id='+value['id']+'&search_date-select-=1&method=maxmin">[高低值统计]</a>'
|
|
|
+ elif value['hardware_type'] == 6:
|
|
|
+ self.data['list'][key]['value'] = '<a href="/device/pic?id='+value['id']+'"><img src="'+value['value']+'" width="200px"/></a><br />更新时间:' + Demeter.date(value['cdate'])
|
|
|
+ elif value['hardware_type'] == 3:
|
|
|
+ if value['status']:
|
|
|
+ status = ''
|
|
|
+ else:
|
|
|
+ status = 'disabled'
|
|
|
+ url = '/device/info'
|
|
|
+ if value['value'] == '1':
|
|
|
+ #disabled
|
|
|
+ self.data['list'][key]['value'] = '<input type="checkbox" name="switch" lay-filter="switch" lay-skin="switch" checked '+status+' value="1" data-value="0" data-id="'+value['id']+'" data-url="'+url+'">'
|
|
|
+ else:
|
|
|
+ self.data['list'][key]['value'] = '<input type="checkbox" lay-filter="switch" name="switch" lay-skin="switch" '+status+' value="0" data-value="1" data-id="'+value['id']+'" data-url="'+url+'">'
|
|
|
+ elif value['hardware_type'] == 5:
|
|
|
+ if value['value'] == '1':
|
|
|
+ self.data['list'][key]['value'] = '已连接'
|
|
|
+ else:
|
|
|
+ self.data['list'][key]['value'] = '已断开'
|
|
|
|
|
|
hardware_type = self.service('common').one('hardware_type', id=value['hardware_type'])
|
|
|
self.data['list'][key]['hardware_type'] = hardware_type['name']
|
|
@@ -264,21 +151,105 @@ class info_path(Load):
|
|
|
|
|
|
self.commonView('list')
|
|
|
|
|
|
+ @Web.auth
|
|
|
+ def post(self):
|
|
|
+ id = self.input('id')
|
|
|
+ value = self.input('value')
|
|
|
+ if id:
|
|
|
+ Demeter.service('device').switch(id, value)
|
|
|
+ self.out('yes', {'state':id})
|
|
|
+ else:
|
|
|
+ self.out('no')
|
|
|
+
|
|
|
class info_update_path(Load):
|
|
|
+ @Web.auth
|
|
|
+ def get(self):
|
|
|
+ self.commonOne('device_info')
|
|
|
+ if self.data['info']['hardware_type'] == 7:
|
|
|
+ self.common(
|
|
|
+ path = 'camera'
|
|
|
+ #,label = (u'摄像机名称', u'摄像机id', u'所属农场', u'选择网关', u'选择硬件类型', u'摄像机地址')
|
|
|
+ #,update = ('name-input-required','hardware_id-show-','farm_id-select-required','gateway_id-select-required','hardware_type-select-required','value-text-required')
|
|
|
+ ,label = (u'摄像机名称', u'摄像机id', u'所属农场', u'选择网关', u'摄像机地址')
|
|
|
+ ,update = ('name-input-required','hardware_id-show-','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required')
|
|
|
+ ,update_farm_id = Demeter.config['setting']['farmList']
|
|
|
+ ,update_gateway_id = self.service('common').list('device_gateway')
|
|
|
+ #,update_hardware_type = self.service('common').list('hardware_type')
|
|
|
+ )
|
|
|
+ elif self.data['info']['hardware_type'] == 6:
|
|
|
+ self.common(
|
|
|
+ path = 'camera_pic'
|
|
|
+ ,label = (u'摄像头名称', u'摄像头id', u'所属农场', u'选择网关', u'摄像头地址')
|
|
|
+ ,update = ('name-input-required','hardware_id-show-','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required')
|
|
|
+ ,update_farm_id = Demeter.config['setting']['farmList']
|
|
|
+ ,update_gateway_id = self.service('common').list('device_gateway')
|
|
|
+ )
|
|
|
+ else:
|
|
|
+ self.common(
|
|
|
+ path = 'info'
|
|
|
+ ,label = (u'设备名称', u'设备id')
|
|
|
+ ,update = ('name-input-required','hardware_id-show-')
|
|
|
+ )
|
|
|
+ self.commonView('update')
|
|
|
+ @Web.auth
|
|
|
+ def post(self):
|
|
|
+ self.commonUpdate('device_info')
|
|
|
+ @Web.auth
|
|
|
+ def delete(self):
|
|
|
+ self.commonOne('device_info')
|
|
|
+ if self.input('state') == 'True' or (self.data['info'] and 'hardware_type' in self.data['info'] and self.data['info']['hardware_type'] == 7):
|
|
|
+ self.commonDelete('device_info')
|
|
|
+ else:
|
|
|
+ #除摄像机之外,其余设备不允许删除
|
|
|
+ self.out('no')
|
|
|
+
|
|
|
+class camera_path(Load):
|
|
|
+ @Web.auth
|
|
|
+ def get(self):
|
|
|
+ self.redirect('/device/info?search_hardware_type=7')
|
|
|
+
|
|
|
+class camera_update_path(Load):
|
|
|
+ @Web.auth
|
|
|
+ def get(self):
|
|
|
+ self.common(
|
|
|
+ path = 'camera'
|
|
|
+ ,label = (u'摄像机名称', u'摄像机id', u'所属农场', u'选择网关', u'摄像机地址')
|
|
|
+ ,update = ('name-input-required','hardware_id-input-required','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required')
|
|
|
+ ,update_farm_id = Demeter.config['setting']['farmList']
|
|
|
+ ,update_gateway_id = self.service('common').list('device_gateway')
|
|
|
+ )
|
|
|
+ self.commonOne('device_info')
|
|
|
+ self.commonView('update')
|
|
|
+ @Web.auth
|
|
|
+ def post(self):
|
|
|
+ self.data['update']['hardware_type'] = 7
|
|
|
+ self.data['update']['type_id'] = 0
|
|
|
+ self.commonUpdate('device_info')
|
|
|
+ @Web.auth
|
|
|
+ def delete(self):
|
|
|
+ self.commonDelete('device_info')
|
|
|
+
|
|
|
+class camera_pic_path(Load):
|
|
|
+ @Web.auth
|
|
|
+ def get(self):
|
|
|
+ self.redirect('/device/info?search_hardware_type=6')
|
|
|
+
|
|
|
+class camera_pic_update_path(Load):
|
|
|
@Web.auth
|
|
|
def get(self):
|
|
|
self.common(
|
|
|
- path = 'info'
|
|
|
- #,label = (u'网关名称', u'设备id',u'网关连接状态',u'电源数值',u'电源连接状态')
|
|
|
- ,label = (u'设备名称', u'设备id')
|
|
|
- ,update = ('name-input-required','hardware_id-show-')
|
|
|
- #,update = ('name-input-required','hardware_id-input-required','status-switch--开启|关闭','power_num-input-','power_status-switch--连接|断开')
|
|
|
+ path = 'camera_pic'
|
|
|
+ ,label = (u'摄像头名称', u'摄像头id', u'所属农场', u'选择网关', u'摄像头地址')
|
|
|
+ ,update = ('name-input-required','hardware_id-input-required','farm_id-select-required-gateway_id','gateway_id-select-required--farm_id','value-text-required')
|
|
|
,update_farm_id = Demeter.config['setting']['farmList']
|
|
|
+ ,update_gateway_id = self.service('common').list('device_gateway')
|
|
|
)
|
|
|
self.commonOne('device_info')
|
|
|
self.commonView('update')
|
|
|
@Web.auth
|
|
|
def post(self):
|
|
|
+ self.data['update']['hardware_type'] = 6
|
|
|
+ self.data['update']['type_id'] = 0
|
|
|
self.commonUpdate('device_info')
|
|
|
@Web.auth
|
|
|
def delete(self):
|
|
@@ -292,15 +263,15 @@ class pic_path(Load):
|
|
|
,path = 'pic'
|
|
|
,width = '600'
|
|
|
,height = '300'
|
|
|
- #,add = False
|
|
|
- #,edit = False
|
|
|
- ,search = (('label-1','cdate-time-start','cdate-time-end'), (u'日期范围',u'开始时间',u'截止时间'))
|
|
|
+ ,add = False
|
|
|
+ ,edit = False
|
|
|
+ ,search = (('label-1','sdate-time-start','sdate-time-end'), (u'日期范围',u'开始时间',u'截止时间'))
|
|
|
,thead = (u'图片地址', u'更新时间')
|
|
|
- ,tbody = ('pic', 'cdate')
|
|
|
+ ,tbody = ('pic', 'sdate')
|
|
|
,state = False
|
|
|
)
|
|
|
|
|
|
- self.commonList('device_pic')
|
|
|
+ self.commonList('device_pic', order='sdate desc')
|
|
|
if self.data['list']:
|
|
|
for key, value in enumerate(self.data['list']):
|
|
|
self.data['list'][key]['pic'] = '<img src="'+value['pic']+'" width="200px" />'
|
|
@@ -347,8 +318,8 @@ class type_path(Load):
|
|
|
,width = '600'
|
|
|
,height = '400'
|
|
|
,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'类型名称'))
|
|
|
- ,thead = (u'类型名称', u'类型标识', u'类型单位', u'表达式', u'更新时间')
|
|
|
- ,tbody = ('name', 'key', 'unit', 'exp', 'cdate')
|
|
|
+ ,thead = (u'类型ID', u'类型名称', u'类型标识', u'类型单位', u'更新时间')
|
|
|
+ ,tbody = ('id', 'name', 'key', 'unit', 'cdate')
|
|
|
,state = True
|
|
|
)
|
|
|
self.commonList('device_type')
|