| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 | 
							- /**
 
-  * version.js
 
-  * 监控单元版本管理界面
 
-  * emial: yaoqiang@chinausky.com
 
-  * create: 2018-12-08
 
-  */
 
- 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'
 
- ]);
 
- Ext.define('UnitVer',{
 
- 	extend: 'Ext.data.Model',
 
- 	fields: [
 
- 		{name:'UQ_UNIT_ID',  type:'string'},
 
- 		{name:'I_ORDER_IDX',  type:'int'},
 
- 		{name:'V_UNIT_CODE',  type:'string'},
 
- 		{name:'UQ_IOTCARD_ID',  type:'string'},
 
- 		{name:'UQ_COMPANY_ID',  type:'string'},
 
- 		{name:'UQ_UNIT_MODEL_ID',  type:'string'},
 
- 		{name:'V_UNIT_NAME',  type:'string'},
 
- 		{name:'V_POSITION',  type:'string'},
 
- 		{name:'UQ_EMPLOYEE_ID',  type:'string'},
 
- 		{name:'E_STATUS',  type:'string'},
 
- 		{name:'UQ_ADMIN_ID',  type:'string'},
 
- 		{name:'I_VERSION',  type:'int'},
 
- 		{name:'D_INSTALLTIME',  type:'string'},
 
- 		{ name: 'V_COMMENT', type:'string'}
 
- 	]
 
- });
 
- var baseUrl="";
 
- var sm = Ext.create('Ext.selection.CheckboxModel');
 
- Ext.onReady(function(){  
 
- 	var baseUrl = document.getElementById('basePath').value;
 
- 	var unitId = document.getElementById('unitId').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;
 
- 	
 
- 	var chkBoolean = function(flag) {
 
- 		if(flag)
 
- 			return chkIcon;
 
- 		return unchkIcon;
 
- 	}
 
- 	
 
- 	var backurl = function() {
 
- 		history.back();
 
- 	}
 
- 	
 
- 	
 
- 	
 
- 	var myVerStore = Ext.create('Ext.data.Store', {
 
- 	    model: 'UnitVer',
 
- 	    pageSize: countPerPage, 
 
- 	    proxy: {
 
- 	        type: 'ajax',
 
- 	        url: baseUrl+'/iot/unit/getVerList',
 
- 	        reader: {
 
- 	            type: 'json',
 
- 	            root: 'RESULT',
 
- 	            totalProperty: 'totalCount'
 
- 	        },
 
-             actionMethods: {
 
-                 read: 'POST'
 
-             },
 
-             extraParams : {
 
-             	queryJson : '{"UQ_UNIT_ID" : "'+unitId+'"}'
 
-             }
 
- 	    },
 
- 	    remoteSort: true
 
- 	});
 
- 	
 
- 	
 
- 	
 
- 	
 
- 	var clear_filter_form = function(){
 
- 		Ext.getCmp('fb_V_UNIT_NAME').setValue("");
 
- 		Ext.getCmp('fb_UQ_EMPLOYEE_ID').setValue("");
 
- 		Ext.getCmp('fb_E_STATUS').setValue("");
 
- 		Ext.getCmp('fb_UQ_ADMIN_ID').setValue("");
 
- 	}
 
- 	
 
- 	
 
- 	var states2 = Ext.create('Ext.data.Store', {
 
- 	    fields: ['status', 'name'],
 
- 	    data : [
 
- 	    	{"status":10, "name":"全选"},
 
- 	        {"status":0, "name":"待开通"},
 
- 	        {"status":1, "name":"已开通"},
 
- 	        {"status":2, "name":"已锁定"},
 
- 	        {"status":3, "name":"注销"},
 
- 	    ]
 
- 	});
 
- 	var FilterForm = Ext.create('Ext.form.Panel', {
 
- 		id: 'UnitVerFilterForm',
 
- 		labelWidth: 55,
 
- 		defaultType: 'textfield',
 
- 		bodyPadding: 15,
 
- 		items: [{
 
- 			fieldLabel:'监控单元名称',
 
- 			id: 'fb_V_UNIT_NAME',
 
- 			name:'V_UNIT_NAME',
 
- 			maxLength:20,
 
- 			maxLengthText:'长度不得超出{0}',
 
- 			value : document.getElementById('unitName').value,
 
- 			anchor:'75%'
 
- 		},
 
- 		{
 
- 			fieldLabel:'当前状态',
 
- 			id:'fb_E_STATUS',
 
- 			name:'E_STATUS',
 
- 			xtype:'combo',
 
- 			store:states2,
 
- 			displayField : 'name',  
 
- 	        valueField : 'status',
 
- 	        value : 10,
 
- 	        editable : false
 
- 		},
 
- 		{
 
- 			fieldLabel:'安装人ID',
 
- 			id: 'fb_UQ_EMPLOYEE_ID',
 
- 			name: 'UQ_EMPLOYEE_ID',
 
- 			maxLength: 250,
 
- 			maxLengthText:'长度不得超出{0}',
 
- 			value : document.getElementById('employeeId').value,
 
- 			anchor:'95%'
 
- 		},{
 
- 			fieldLabel:'录入人ID',
 
- 			id: 'fb_UQ_ADMIN_ID',
 
- 			name: 'UQ_ADMIN_ID',
 
- 			maxLength: 250,
 
- 			maxLengthText:'长度不得超出{0}',
 
- 			value : document.getElementById('adminId').value,
 
- 			anchor:'95%'
 
- 		},{
 
- 			id:'fb_queryJson',
 
- 			name:'queryJson',
 
- 			hidden:true
 
- 		}],
 
- 		buttons: [{
 
- 	        text: '提交',
 
- 	        iconCls:'ok_btn',
 
- 		    handler: function() {
 
- 		        var form = this.up('form').getForm();
 
- 		        if (form.isValid()) {
 
- 		        	var query = new Object();
 
- 		        	if(Ext.getCmp('fb_V_UNIT_NAME').getValue().length>0)
 
- 		        		query.V_UNIT_NAME = Ext.getCmp('fb_V_UNIT_NAME').getValue();
 
- 		        	if(Ext.getCmp('fb_UQ_EMPLOYEE_ID').getValue().length>0)
 
- 		        		query.UQ_EMPLOYEE_ID = Ext.getCmp('fb_UQ_EMPLOYEE_ID').getValue();
 
- 		        		query.E_STATUS = Ext.getCmp('fb_E_STATUS').getValue();
 
- 		        	if(Ext.getCmp('fb_UQ_ADMIN_ID').getValue().length>0)
 
- 		        		query.UQ_ADMIN_ID = Ext.getCmp('fb_UQ_ADMIN_ID').getValue();
 
- 		        	query.UQ_UNIT_ID = unitId;
 
- 		        	var jsonstr = Ext.JSON.encode(query);
 
- 		        	myVerStore.getProxy().extraParams = {
 
- 		        		queryJson : jsonstr,
 
- 		        	};
 
- 		        	Ext.getCmp('UnitListPageToolbar').moveFirst();
 
- 		        	Ext.getCmp('unitName').setValue(query.V_UNIT_NAME);
 
- 		        	Ext.getCmp('employeeId').setValue(query.UQ_EMPLOYEE_ID);
 
- 		        	Ext.getCmp('adminId').setValue(query.UQ_ADMIN_ID);
 
- 		        	//myStore.reload();
 
- 		        	clear_filter_form();
 
- 		        	this.up('window').hide();
 
- 		        }
 
- 		    }
 
- 		},{
 
- 			text: '关闭',
 
- 			iconCls: 'cancel_btn',
 
- 			handler: function() {
 
- 				this.up('window').hide();
 
- 			}
 
- 		}]
 
- 	});
 
- 	
 
- 	
 
- 	
 
- 	
 
- 	var filterwin = function() {
 
- 		Ext.create('Ext.window.Window',{
 
- 			id: 'UnitVerFilterWin',
 
- 			title: '筛选',
 
- 			height: 250,
 
- 			width: 350,
 
- 			layout: 'fit',
 
- 			items: FilterForm,
 
- 			closeAction: 'hide'
 
- 		}).show();
 
- 	}
 
- 	
 
- 	Ext.create('Ext.grid.Panel', {
 
- 	    title: '监控单元管理记录',
 
- 	    id: 'UnitVerListPanel',
 
- 	    store: myVerStore,
 
- 	  //  selModel: sm,
 
- 	    columns: [
 
- 			//{name:'E_STATUS',  type:'string'},
 
- 	    	{ header: '记录版本', dataIndex: 'I_VERSION', width:70, align:'center', menuDisabled:true },
 
- 	        { header: '监控单元名称', dataIndex: 'V_UNIT_NAME', width:120,align:'center', menuDisabled:true },
 
- 	        { header: '监控单元编号', dataIndex: 'V_UNIT_CODE', width:120,align:'center', menuDisabled:true },
 
- 	        { header: '单位/部门ID', dataIndex: 'UQ_COMPANY_ID', width:120,align:'center', menuDisabled:true },
 
- 	        { header: '当前状态', dataIndex: 'E_STATUS', width:120,  align:'center', menuDisabled:true },
 
- 	        { header: '安装人ID', dataIndex: 'UQ_EMPLOYEE_ID', width:120,  align:'center', menuDisabled:true },
 
- 	        { header: '录入人ID', dataIndex: 'UQ_ADMIN_ID', width:120,  align:'center', menuDisabled:true },
 
- 	        { header: '监控单元安装位置', dataIndex: 'V_POSITION', width:160,align:'center', menuDisabled:true },
 
- 	        { header: '新增/修改/注销说明', dataIndex: 'V_COMMENT', width:160, menuDisabled:true },
 
- 	        { header: '保存时间', dataIndex: 'D_INSTALLTIME',width:160, align:'center', menuDisabled:true }
 
- 	        
 
- 	    ],
 
- 	    columnLines: true,
 
- 	    tbar: [{
 
- 	    		xtype: 'button',
 
- 	    		iconCls:'back_btn',
 
- 	    		text: '返回',
 
- 	    		listeners : {
 
- 	    			click : backurl
 
- 	    		}
 
- 	    	},'-',{
 
- 				  xtype: 'button', 
 
- 				  iconCls:'filter_btn',  
 
- 				  text: '筛选',
 
- 				  listeners: {
 
- 				        click: filterwin
 
- 				  }
 
- 	    	}
 
-     	],
 
- 	    height: maxHeight,
 
- 	    width: '100%',
 
- 	    bbar: new Ext.PagingToolbar({  
 
- 	    	id:'UnitListPageToolbar',
 
-             store: myVerStore,  
 
-             displayInfo: true,  
 
-             pageSize: countPerPage,  
 
-             prependButtons: true,  
 
-             displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',     
 
-             emptyMsg : "没有记录",  
 
-             doLoad:function(start){  
 
-                 relushDataFunction(start); // 调用函数刷新数据  
 
-                 this.cursor = start; // 更新页签  
 
-             }  
 
-         }),
 
-         frame: true,  
 
-         border:false,  
 
-         iconCls: 'icon-grid',
 
- 	    renderTo: Ext.getBody()
 
- 	});
 
- 	myVerStore.load();
 
- 	maxHeight =  document.documentElement.clientHeight;
 
- 	Ext.getCmp('UnitVerListPanel').setHeight(maxHeight);
 
- 	
 
- });
 
 
  |