/** * 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('PointVer',{ extend: 'Ext.data.Model', fields: [ {name:'I_POINTVER_ID', type:'int'}, {name:'UQ_POINT_ID', type:'string'}, {name:'I_ORDER_IDX', type:'int'}, {name:'V_POINT_ADDRESS', type:'string'}, {name:'I_FLOOR', type:'int'}, {name:'F_HEIGHT', type:'string'}, {name:'V_COMMENT', type:'string'}, {name:'UQ_ADMIN_ID', type:'string'}, {name:'I_VERSION', type:'int'}, {name:'D_STORETIME', type:'string'} ] }); var baseUrl=""; var sm = Ext.create('Ext.selection.CheckboxModel'); Ext.onReady(function(){ var baseUrl = document.getElementById('basePath').value; var pointId = document.getElementById('pointId').value; var chkIcon = '' var unchkIcon = '' 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: 'PointVer', pageSize: countPerPage, proxy: { type: 'ajax', url: baseUrl+'/iot/point/getVerList', reader: { type: 'json', root: 'RESULT', totalProperty: 'totalCount' }, actionMethods: { read: 'POST' }, extraParams : { queryJson : '{"UQ_POINT_ID" : "'+pointId+'"}' } }, remoteSort: true }); var clear_filter_form = function(){ Ext.getCmp('fb_V_POINT_ADDRESS').setValue(""); Ext.getCmp('fb_I_FLOOR').setValue(""); // Ext.getCmp('fb_F_HEIGHT').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: 'PointVerFilterForm', labelWidth: 55, defaultType: 'textfield', bodyPadding: 15, items: [{ fieldLabel:'点位名称', id: 'fb_V_POINT_ADDRESS', name:'V_POINT_ADDRESS', maxLength:20, maxLengthText:'长度不得超出{0}', value : document.getElementById('adderss').value, anchor:'75%' },{ fieldLabel:'楼层', id:'fb_I_FLOOR', name:'I_FLOOR', maxLength: 250, maxLengthText:'长度不得超出{0}', value : document.getElementById('floor').value, editable : false },{ 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_POINT_ADDRESS').getValue().length>0) query.V_POINT_ADDRESS = Ext.getCmp('fb_V_POINT_ADDRESS').getValue(); if(Ext.getCmp('fb_I_FLOOR').getValue().length>0) query.I_FLOOR = Ext.getCmp('fb_I_FLOOR').getValue(); // if(Ext.getCmp('fb_F_HEIGHT').getValue().length>0) // query.F_HEIGHT = Ext.getCmp('fb_F_HEIGHT').getValue(); if(Ext.getCmp('fb_UQ_ADMIN_ID').getValue().length>0) query.UQ_ADMIN_ID = Ext.getCmp('fb_UQ_ADMIN_ID').getValue(); query.UQ_POINT_ID = pointId; var jsonstr = Ext.JSON.encode(query); myVerStore.getProxy().extraParams = { queryJson : jsonstr, }; Ext.getCmp('PointListPageToolbar').moveFirst(); Ext.getCmp('adderss').setValue(query.V_POINT_ADDRESS); Ext.getCmp('floor').setValue(query.I_FLOOR); //Ext.getCmp('height').setValue(query.F_HEIGHT); 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: 'PointVerFilterWin', title: '筛选', height: 250, width: 350, layout: 'fit', items: FilterForm, closeAction: 'hide' }).show(); } Ext.create('Ext.grid.Panel', { title: '点位管理记录', id: 'PointVerListPanel', store: myVerStore, // selModel: sm, columns: [ //{name:'E_STATUS', type:'string'}, { header: '记录版本', dataIndex: 'I_VERSION', width:70, align:'center', menuDisabled:true }, { header: '点位名称', dataIndex: 'V_POINT_ADDRESS', width:120,align:'center', menuDisabled:true }, { header: '楼层', dataIndex: 'I_FLOOR', width:120,align:'center', menuDisabled:true }, { header: '点位部署垂直高度', dataIndex: 'F_HEIGHT', width:120,align:'center', menuDisabled:true }, { header: '录入人ID', dataIndex: 'UQ_ADMIN_ID', width:120, align:'center', menuDisabled:true }, { header: '新增/修改/注销说明', dataIndex: 'V_COMMENT', width:160, menuDisabled:true }, { header: '保存时间', dataIndex: 'D_STORETIME',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:'PointListPageToolbar', 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('PointVerListPanel').setHeight(maxHeight); });