| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 | /** *  */Ext.Loader.setConfig({    enabled: true});Ext.Loader.setPath('Ext.ux', '../../res/extjs/examples/ux');Ext.require([    'Ext.grid.*',    'Ext.data.*',    'Ext.ux.RowExpander',    'Ext.selection.CheckboxModel']);var sm = Ext.create('Ext.selection.CheckboxModel');var company_code = null;var myStore;Ext.define('VRtuAlarm',{	extend: 'Ext.data.Model',	fields: [		{ name:'id', type:'int'},		{ name:'device_code',	type:'string' },		{ name:'company_code',	type:'string' },		{ name:'company_name',	type:'string' },		{ name:'fullname', type:'string' },		{ name:'time', type:'string' },		{ name:'data', type:'string' },		{ name:'clzt', type:'string' },		{ name:'clr_name', type:'string' },		{ name:'clsj', type:'string' }	]});var change_company = function(id){	var maxHeight = 10000;	maxHeight =  document.documentElement.clientHeight;	if(id.length>0){		company_code = id;		var query = new Object();		if((company_code!=null)&&(company_code!='null')&&(company_code.length>0))			query.company_code = company_code;		myStore.getProxy().extraParams = {queryJson:Ext.JSON.encode(query)};		myStore.reload();		$("#company_code").val(company_code);	}else{		company_code = null;		var query = new Object();		if((company_code!=null)&&(company_code!='null')&&(company_code.length>0))			query.company_code = company_code;		myStore.getProxy().extraParams = {queryJson:Ext.JSON.encode(query)};		myStore.reload();		$("#company_code").val('');	}	Ext.getCmp('VWaterAlarmListPanel').setHeight(maxHeight);}Ext.onReady(function(){  	var baseUrl = document.getElementById('basePath').value;	var theme = document.getElementById('theme').value;	var chkIcon = '<img src="'+baseUrl+'res/img/common/check.gif"/>'	var unchkIcon = '<img src="'+baseUrl+'res/img/common/uncheck.gif"/>'	var countPerPage = 20;	var maxHeight = 10000;	company_code = document.getElementById('company_code').value;	maxHeight =  document.documentElement.clientHeight;		var chkBoolean = function(flag) {		if(flag)			return chkIcon;		return unchkIcon;	}	var query = new Object();	if((company_code!=null)&&(company_code!='null')&&(company_code.length>0))		query.company_code = company_code;	myStore = Ext.create('Ext.data.Store', {	    model: 'VRtuAlarm',	    pageSize: countPerPage, 	    proxy: {	        type: 'ajax',	        url: baseUrl+'iot/alarm/view/getRTUList',	        extraParams:{	        	queryJson:Ext.JSON.encode(query)	        },	        reader: {	            type: 'json',	            root: 'RESULT',	            totalProperty: 'totalCount'	        }	    },	    sorters:[{	    	property:'time',	    	direction:'DESC'	    }],	    remoteSort: true	});	var storeReload=function(){		var query = new Object();		if((company_code!=null)&&(company_code!='null')&&(company_code.length>0))			query.company_code = company_code;		myStore.getProxy().extraParams = {queryJson:Ext.JSON.encode(query)};		myStore.reload();		setTimeout(storeReload,30000);	}	var FilterForm = Ext.create('Ext.form.Panel', {		id: 'VRtuAlarmFilterForm',		labelWidth: 55,		defaultType: 'textfield',		bodyPadding: 15	});	var filterwin = function() {		Ext.create('Ext.window.Window',{			id: 'VRtuAlarmFilterWin',			title: '火警报告筛选',			height: 300,			width: 400,			layout: 'fit',			items: FilterForm,			closeAction: 'hide'		}).show();	}	Ext.create('Ext.grid.Panel', {	    title: 'RTU报告列表',	    id: 'VRtuAlarmListPanel',	    cellTip:true,	    store: myStore,	    selModel: sm,	    columns: [	    	{ header: 'id', dataIndex:'id',hidden:true, menuDisabled:true},	        { header: '单位名称',  dataIndex: 'company_name',width:240, menuDisabled:true,renderer:function (value, metaData, record, rowIdx, colIdx, store){	        	metaData.tdAttr = 'data-qtip="' + Ext.String.htmlEncode(value) + '"';	        	return value;	        }},	        { header: '报告时间', dataIndex: 'time', width:160, menuDisabled:true,renderer:function (value, metaData, record, rowIdx, colIdx, store){	        	metaData.tdAttr = 'data-qtip="' + Ext.String.htmlEncode(value) + '"';	        	return value;	        }},	        { header: '报告数据', dataIndex: 'data', width:140, menuDisabled:true,renderer:function (value, metaData, record, rowIdx, colIdx, store){	        	metaData.tdAttr = 'data-qtip="' + Ext.String.htmlEncode(value) + '"';	        	return value;	        }},	        { header: '报告内容',  dataIndex: 'fullname', width:480, menuDisabled:true,renderer:function (value, metaData, record, rowIdx, colIdx, store){	        	metaData.tdAttr = 'data-qtip="' + Ext.String.htmlEncode(value) + '"';	        	return value;	        }},	        { header: '处理状态', dataIndex: 'clzt', width:100,  menuDisabled:true,renderer:function (value, metaData, record, rowIdx, colIdx, store){	        	metaData.tdAttr = 'data-qtip="' + Ext.String.htmlEncode(value) + '"';	        	return value;	        }},	        { header: '处理人', dataIndex: 'clr_name',width:150, menuDisabled:true,renderer:function (value, metaData, record, rowIdx, colIdx, store){	        	metaData.tdAttr = 'data-qtip="' + Ext.String.htmlEncode(value) + '"';	        	return value;	        }},	        { header: '处理时间', dataIndex: 'clsj', width:160, menuDisabled:true,renderer:function (value, metaData, record, rowIdx, colIdx, store){	        	metaData.tdAttr = 'data-qtip="' + Ext.String.htmlEncode(value) + '"';	        	return value;	        }}	    ],	    columnLines: true,    	height: maxHeight,	    width: '100%',	    bbar: new Ext.PagingToolbar({              store: myStore,              id:'VRtuAlarmListPageToolbar',            displayInfo: true,              pageSize: countPerPage,              prependButtons: true,              displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',                 emptyMsg : "没有记录",              firstText: '第一页',            prevText: '前一页',            nextText: '后一页',            lastText: '最后一页'        }),        frame: true,          border:false,          iconCls: 'icon-grid',	    renderTo: Ext.getBody()	});	storeReload();	Ext.getCmp('VRtuAlarmListPanel').setHeight(maxHeight);});
 |