| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468 | 
							- /**
 
-  * qrcodeanalysis.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'
 
- ]);
 
- var company_code;
 
- var myStore=null;
 
- var V_LOGINNAME='',V_PASSWORD='';
 
- var sm = Ext.create('Ext.selection.CheckboxModel');
 
- Ext.define('QrcodeAnalysis',{
 
- 	extend: 'Ext.data.Model',
 
- 	fields: [
 
- 		{name:'id',  type:'string'},
 
- 		{name:'analysis_content',  type:'string'},
 
- 		{name:'company_code',  type:'string'},
 
- 	]
 
- });
 
- function exportbtn_click(){
 
- 	baseUrl = document.getElementById('basePath').value;
 
- 	V_LOGINNAME = $("#V_LOGINNAME").val();
 
- 	V_PASSWORD = $("#V_PASSWORD").val();
 
- 	var fields = '';
 
- 	var array = ['id','analysis_content'];
 
- 	var excelname = ['编号','二维码解析'];
 
- 	for(var i=0;i<2;i++){
 
- 		if(i>0)
 
- 			fields += ',';
 
- 	    fields += '{id:"'+array[i]+'",title:"'+excelname[i]+'",shown:"'+true+'"}';
 
- 	}
 
- 			var query = new Object();
 
- 			// query.V_LOGINNAME = V_LOGINNAME;
 
- 			// query.V_PASSWORD = V_PASSWORD;
 
- 			query.EXPORT_FILE = '二维码标签列表';
 
- 			query.fields = '['+fields+']';
 
- 			$.ajax({
 
- 		        type:'POST',
 
- 		        url: baseUrl+"iot/excel/view/qrcodeanalysisExcel",
 
- 		        data: {
 
- 		        	queryJson : Ext.JSON.encode(query)
 
- 		    	 },
 
- 		    	 success: function(result){
 
- 		    		
 
- 			            var json = eval('(' + result + ')');
 
- 			            if(json.action=='dormExport'){
 
- 			                ConfirmStore = json.RESULT;
 
- 			               
 
- 			                var elemIF = document.createElement("iframe");
 
- 							elemIF.src = baseUrl+json.filename;
 
- 							elemIF.style.display = "none"; 
 
- 							document.body.appendChild(elemIF);
 
- 			            }
 
- 			    
 
- 			        }
 
- 		    });
 
- 			
 
- }
 
- 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;
 
- 	$("#V_LOGINNAME").val(sessionStorage.getItem('V_LOGINNAME'));
 
- 	$("#V_PASSWORD").val(sessionStorage.getItem('V_PASSWORD'));
 
- 	V_LOGINNAME = $("#V_LOGINNAME").val();
 
-     V_PASSWORD = $("#V_PASSWORD").val();
 
- 	
 
- 	var chkBoolean = function(flag) {
 
- 		if(flag)
 
- 			return chkIcon;
 
- 		return unchkIcon;
 
- 	}
 
- 	
 
- 	var queryJson = new Object();
 
- 	// queryJson.V_LOGINNAME = V_LOGINNAME;
 
- 	// queryJson.V_PASSWORD =  V_PASSWORD;
 
- //	queryJson.COMMSTATUS = 'NO';
 
- 	if((company_code!=null)&&(company_code!='null')&&(company_code.length>0))
 
- 		queryJson.company_code = company_code;
 
- 	var clear_append_form = function (){
 
- 		Ext.getCmp('fa_analysis_content').setValue("");
 
- 		Ext.getCmp('QrcodeAnalysisListPanel').getStore().reload();
 
- 	}
 
- 	myStore = Ext.create('Ext.data.Store', {
 
- 	    model: 'QrcodeAnalysis',
 
- 	    pageSize: countPerPage, 
 
- 	    proxy: {
 
- 	        type: 'ajax',
 
- 	        actionMethods: {
 
-                 create : 'POST',
 
-                 read   : 'POST', // by default GET
 
-                 update : 'POST',
 
-                 destroy: 'POST'
 
- 	        },
 
- 	        url: baseUrl+'iot/qrcodeanalysis/getList1',
 
- 	        reader: {
 
- 	            type: 'json',
 
- 	            root: 'RESULT',
 
- 	            totalProperty: 'totalCount'
 
- 	        },
 
- 	        extraParams:{
 
- 	        	queryJson:Ext.JSON.encode(queryJson)
 
- 	        }
 
- 	    },
 
- //	    sorters:[{
 
- //	    	property:'data_time',
 
- //	    	direction:'DESC'
 
- //	    }],
 
- 	    remoteSort: true
 
- 	});
 
- 		
 
- 	
 
- 	var AppendForm = Ext.create('Ext.form.Panel', {
 
- 		id: 'QrcodeAnalysisAppendForm',
 
- 		labelWidth: 55,
 
- 		url: baseUrl+'iot/qrcodeanalysis/append1',
 
- 		defaultType: 'textfield',
 
- 		bodyPadding: 15,
 
- 		items: [{
 
- 			fieldLabel:'二维码解析',
 
- 			id: 'fa_analysis_content',
 
- 			name:'analysis_content',
 
- 			maxLength:20,
 
- 			maxLengthText:'长度不得超出{0}',
 
- 			anchor:'75%'
 
- 		},{
 
- 			id:'fa_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();
 
- 		        	// query.V_LOGINNAME = V_LOGINNAME;
 
- 		        	query.analysis_content = Ext.getCmp('fa_analysis_content').getValue();
 
- 		        	var jsonstr = Ext.JSON.encode(query);
 
- 		        	Ext.getCmp('fa_queryJson').setValue(jsonstr);
 
- 		            form.submit({
 
- 		            	method:'post',
 
- 		                success: function(form, action) {
 
- 		                   Ext.Msg.alert('操作成功', '已保存', function(btn,txt){
 
- 		                	   clear_append_form();
 
- 		                   });
 
- 		                },
 
- 		                failure: function(form, action) {
 
- 		                   Ext.Msg.alert('操作失败', action.Msg , function(btn,txt){
 
- 		                	   clear_append_form();
 
- 		                   });
 
- 		                }
 
- 		            });
 
- 		        }
 
- 		    }
 
- 		},{
 
- 			text: '关闭',
 
- 			iconCls: 'cancel_btn',
 
- 			handler: function() {
 
- 				this.up('window').hide();
 
- 			}
 
- 		}]
 
- 	});
 
- 	
 
- 	var appendwin = function(){
 
- 		Ext.create('Ext.window.Window', {
 
- 		    title: '新增',
 
- 		    height: 350,
 
- 		    width: 400,
 
- 		    layout: 'fit',
 
- 		    items:  AppendForm,
 
- 		    closeAction: 'hide'
 
- 		}).show();
 
- 	}
 
- 	
 
- 	//筛选
 
- //	var clear_filter_form = function(){
 
- //		Ext.getCmp('ff_analysis_content').setValue("");		
 
- //	}
 
- 	
 
- //	var FilterWin = Ext.create('Ext.form.Panel', {
 
- //		id: 'QrcodeAnalysisFilterForm',
 
- //		labelWidth: 55,
 
- //		defaultType: 'textfield',
 
- //		bodyPadding: 15,
 
- //		items: [{
 
- //			fieldLabel:'二维码解析',
 
- //			id: 'ff_analysis_content',
 
- //			name:'analysis_content',
 
- //			maxLength:20,
 
- //			maxLengthText:'长度不得超出{0}',
 
- //			value : document.getElementById('analysis_content').value,
 
- //			anchor:'75%'
 
- //		},{
 
- //			id:'ff_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('ff_qrcode_analysis').getValue().length>0)
 
- //		        		query.qrcode_analysis = Ext.getCmp('ff_qrcode_analysis').getValue();
 
- //		        	
 
- //		        	var jsonstr = Ext.JSON.encode(query);
 
- //		        	myStore.getProxy().extraParams = {
 
- //		        		queryJson : jsonstr
 
- //		        	};	
 
- //		        	Ext.getCmp('QrcodeAnalysisListPageToolbar').moveFirst();
 
- //		        	Ext.getCmp('analysis_content').setValue(query.analysis_content);
 
- ////		        	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',{
 
- //			title: '筛选',
 
- //			height: 300,
 
- //			width: 350,
 
- //			layout: 'fit',
 
- //			items: FilterWin,
 
- //			closeAction: 'hide'
 
- //		}).show();
 
- //	}
 
- 	
 
- 	var clear_modify_form = function (){
 
- 		Ext.getCmp('fm_id').setValue("");
 
- 		Ext.getCmp('fm_analysis_content').setValue("");	
 
- 		Ext.getCmp('QrcodeAnalysisListPanel').getStore().reload();
 
- 	}
 
- 	
 
- 	
 
- 	
 
- 	var ModifyForm = Ext.create('Ext.form.Panel', {
 
- 		id: 'QrcodeAnalysisEditForm',
 
- 		labelWidth: 55,
 
- 		url: baseUrl+'iot/qrcodeanalysis/update1',
 
- 		defaultType: 'textfield',
 
- 		bodyPadding: 15,
 
- 		items: [{
 
- 				fieldLabel:'二维码解析',
 
- 				id: 'fm_analysis_content',
 
- 				name:'analysis_content',
 
- 				maxLength:20,
 
- 				maxLengthText:'长度不得超出{0}',
 
- 				anchor:'75%'
 
- 			},{
 
- 				id: 'fm_company_code',
 
- 				name:'company_code',
 
- 				hidden:true
 
- 			},{
 
- 			id: 'fm_id',
 
- 			name:'id',
 
- 			hidden:true
 
- 		},{
 
- 			id:'fm_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();
 
- 		        	query.id = Ext.getCmp('fm_id').getValue();
 
- 		        	query.company_code = Ext.getCmp('fm_company_code').getValue();
 
- 		        	query.analysis_content = Ext.getCmp('fm_analysis_content').getValue();
 
- 		        	var jsonstr = Ext.JSON.encode(query);
 
- 		        	Ext.getCmp('fm_queryJson').setValue(jsonstr);
 
- 		            form.submit({
 
- 		            	method:'post',
 
- 		                success: function(form, action) {
 
- 		                   Ext.Msg.alert('操作成功', '已修改', function(btn,txt){
 
- 		                	   clear_modify_form();
 
- 		                   });
 
- 		                },
 
- 		                failure: function(form, action) {
 
- 		                   Ext.Msg.alert('操作失败', action.Msg , function(btn,txt){
 
- 		                	   clear_modify_form();
 
- 		                   });
 
- 		                }
 
- 		            });
 
- 		            this.up('window').hide();
 
- 		        }
 
- 		    }
 
- 		},{
 
- 			text: '关闭',
 
- 			iconCls: 'cancel_btn',
 
- 			handler: function() {
 
- 				this.up('window').hide();
 
- 			}
 
- 		}]
 
- 	});
 
- 	
 
- 	var modifywin = function(){
 
- 		Ext.create('Ext.window.Window', {
 
- 		    title: '修改',
 
- 		    height: 350,
 
- 		    width: 400,
 
- 		    layout: 'fit',
 
- 		    items:  ModifyForm,
 
- 		    closeAction: 'hide'
 
- 		}).show();
 
- 	}
 
- 		
 
- 	var chk_sm = function() {
 
- 		if(sm.getCount()==1){
 
- 			modifywin();
 
- 			var selected = sm.getSelection( );
 
- 			Ext.getCmp('fm_id').setValue(selected[0].raw.id);
 
- 			Ext.getCmp('fm_analysis_content').setValue(selected[0].raw.analysis_content);
 
- 			Ext.getCmp('fm_company_code').setValue(selected[0].raw.company_code);
 
- 		}else{
 
- 			Ext.Msg.alert('请先选择','请先选择一条记录,再点击修改');
 
- 		}
 
- 	}
 
- 	
 
- //	
 
- //	var deletewin = function() {
 
- //		window.alert("无此功能");
 
- //		
 
- //	}
 
- 	
 
- 	Ext.create('Ext.grid.Panel', {
 
- 	    title: '二维码解析管理',
 
- 	    id: 'QrcodeAnalysisListPanel',
 
- 	    store: myStore,
 
- 	    selModel: sm,
 
- 	    columns: [
 
- 	    	 { header: '单位编号',  dataIndex: 'company_code',hidden:true, menuDisabled:true },
 
- 		     { header: 'ID',  dataIndex: 'id', width:40, menuDisabled:true },
 
- 		     { header: '二维码解析', dataIndex: 'analysis_content', width:1397,menuDisabled:true },
 
- //		     { header: '记录版本', dataIndex: 'I_VERSION', width:120, align:'center', menuDisabled:true },
 
- //		     { 
 
- //	        	xtype : 'actioncolumn',
 
- //	        	width:20,
 
- //	        	sortable:false,
 
- //	        	
 
- //	        	
 
- //	        	//这里
 
- //	        	align:'center',
 
- //	        	menuDisabled:true,
 
- //	        	items:[{
 
- //	        		icon: '../../res/img/common/forum.gif',
 
- //	        		tooltip: '版本记录',
 
- //	        		handler: function(grid, rowIndex, colIndex) {
 
- //	                    var rec = grid.getStore().getAt(rowIndex);
 
- //	        			window.location = 'version.jsp?theme='+theme+'&pointId='+rec.get('UQ_POINT_ID');
 
- //	                }
 
- //	        	}]
 
- //    		}
 
- 	    ],
 
- 	    columnLines: true,
 
- 	    tbar: [
 
- //	    	{
 
- //				  xtype: 'button', 
 
- //				  iconCls:'filter_btn',  
 
- //				  text: '筛选',
 
- //				  listeners: {
 
- //				        click: filterwin
 
- //				  }
 
- //	    	},'-',
 
- 	    	{xtype: 'tbfill'},'-',
 
- 			{ 
 
- 				  xtype: 'button', 
 
- 				  iconCls:'append_btn',  
 
- 				  text: '新增',
 
- 				  listeners: {
 
- 				        click: appendwin
 
- 				  }
 
- 			},
 
- 			{ 
 
- 				xtype: 'button', 
 
- 				iconCls:'modify_btn', 
 
- 				text: '修改',
 
- 				listeners: {
 
- 					click: chk_sm
 
- 				}
 
- 			},
 
- //			{ 
 
- //				xtype: 'button',
 
- //				iconCls:'delete_btn',
 
- //				text: '注销',
 
- //				listeners: {
 
- //					click: deletewin
 
- //				}
 
- //			}
 
- 			{ 
 
- 				xtype: 'button',
 
- 				iconCls:'export_btn',
 
- 				text: '导出',
 
- 				listeners: {
 
- 					click: exportbtn_click
 
- 				}
 
- 			}
 
- 			
 
-     	],
 
- 	    height: maxHeight,
 
- 	    width: '100%',
 
- 	    bbar: new Ext.PagingToolbar({  
 
-             store: myStore,  
 
-             id:'QrcodeAnalysisListPageToolbar',
 
-             displayInfo: true,  
 
-             pageSize: countPerPage,  
 
-             prependButtons: true,  
 
-             displayMsg : '显示第 {0}条到 {1}条记录,总共 {2}条',     
 
-             emptyMsg : "没有记录",  
 
-             firstText: '第一页',
 
-             prevText: '前一页',
 
-             nextText: '后一页',
 
-             lastText: '最后一页',
 
-             refreshText: '刷新',
 
- //            doRefresh:function(start){  
 
- //            	alert(start);
 
- //                relushDataFunction(start); // 调用函数刷新数据  
 
- //                this.cursor = start; // 更新页签  
 
- //            }
 
-         }),
 
-         frame: true,  
 
-         border:false,  
 
-         iconCls: 'icon-grid',
 
- 	    renderTo: Ext.getBody()
 
- 	});
 
- 	myStore.reload();
 
- 	maxHeight =  document.documentElement.clientHeight;
 
- 	Ext.getCmp('QrcodeAnalysisListPanel').setHeight(maxHeight);
 
- 	
 
- });
 
 
  |