/** * version.js * 用户信息管理界面 * emial: hanzhengyi@chinausky.com * create: 2018-12-12 */ 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('Buildingver',{ extend: 'Ext.data.Model', fields: [ { name:'I_BUILDINGVER_ID', type:'int' }, { name:'I_ORDER_IDX', type:'int' }, { name:'UQ_BUILDING_ID', type:'string' }, { name:'V_BUILDING_NAME', type:'string' }, { name:'UQ_POINT_ID', type:'string' }, { name:'UQ_COMPANY_ID', type:'string' }, { name:'V_AREA_ID', type:'string' }, { name:'V_ADDR_0', type:'string' }, { name:'V_ADDR_1', type:'string' }, { name:'V_ADDR_2', type:'string' }, { name:'I_MIN_FLOOR', type:'int' }, { name:'I_MAX_FLOOR', type:'int' }, { name:'F_FLOOR_SPACE', type:'string' }, { name:'F_TOTAL_SPACE', type:'string' }, { name:'F_BUILDING_HEIGHT', type:'string' }, { name:'I_VERSION', type:'int' }, { name:'V_COMMENT', type:'string' }, { name:'D_STORETIME', type:'string' } ] }); var baseUrl=""; var sm = Ext.create('Ext.selection.CheckboxModel'); Ext.onReady(function(){ var baseUrl = document.getElementById('basePath').value; var buildingId = document.getElementById('buildingId').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: 'Buildingver', pageSize: countPerPage, proxy: { type: 'ajax', url: baseUrl+'/iot/building/getverList', reader: { type: 'json', root: 'RESULT', totalProperty: 'totalCount' }, actionMethods: { read: 'POST' }, extraParams : { queryJson : '{"UQ_BUILDING_ID" : "'+buildingId+'"}' } }, remoteSort: true }); // var states3 = Ext.create('Ext.data.Store', { // fields: ['status', 'name'], // data : [ // {"status": "8", "name":"不选"}, // {"status": "国家", "name":"国家"}, // {"status": "省、直辖市、自治区、特别行政区", "name":"省、直辖市、自治区、特别行政区"}, // {"status": "地区、市、自治州、盟", "name":"地区、市、自治州、盟"}, // {"status": "县、市辖区、县级市、旗", "name":"县、市辖区、县级市、旗"}, // ] // }); var clear_filter_form = function(){ Ext.getCmp('ff_V_BUILDING_NAME').setValue(""); Ext.getCmp('ff_UQ_COMPANY_ID').setValue(""); Ext.getCmp('ff_V_AREA_ID').setValue(""); Ext.getCmp('ff_V_ADDR_0').setValue(""); } var FilterForm = Ext.create('Ext.form.Panel', { id: 'BuildingFilterForm', labelWidth: 55, defaultType: 'textfield', bodyPadding: 15, items: [{ fieldLabel:'建筑物名称', id: 'ff_V_BUILDING_NAME', name:'V_BUILDING_NAME', maxLength:20, maxLengthText:'长度不得超出{0}', anchor:'75%', value:document.getElementById('buildingName').value },{ fieldLabel:'物业管理公司ID', id: 'ff_UQ_COMPANY_ID', name: 'UQ_COMPANY_ID', maxLength: 7, maxLengthText:'长度不得超出{0}', anchor:'75%', value:document.getElementById('companyId').value },{ fieldLabel:'行政区域ID', id: 'ff_V_AREA_ID', name: 'V_AREA_ID', maxLength: 30, maxLengthText:'长度不得超出{0}', anchor:'75%', value:document.getElementById('areaId').value },{ fieldLabel:'详细地址', id: 'ff_V_ADDR_0', name: 'V_ADDR_0', maxLength: 30, maxLengthText:'长度不得超出{0}', anchor:'75%', value:document.getElementById('addr0').value },{ 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_V_BUILDING_NAME').getValue().length>0) query.V_BUILDING_NAME = Ext.getCmp('ff_V_BUILDING_NAME').getValue(); if(Ext.getCmp('ff_UQ_COMPANY_ID').getValue().length>0) query.UQ_COMPANY_ID = Ext.getCmp('ff_UQ_COMPANY_ID').getValue(); if(Ext.getCmp('ff_V_AREA_ID').getValue().length>0) query.V_AREA_ID = Ext.getCmp('ff_V_AREA_ID').getValue(); if(Ext.getCmp('ff_V_ADDR_0').getValue().length>0) query.V_ADDR_0 = Ext.getCmp('ff_V_ADDR_0').getValue(); // if(Ext.getCmp('ff_E_LEVEL').getValue().length>0) // if(Ext.getCmp('ff_E_LEVEL').getValue()=='国家'){ // query.E_LEVEL=0; // } // if(Ext.getCmp('ff_E_LEVEL').getValue()=='省、直辖市、自治区、特别行政区'){ // query.E_LEVEL=1; // } // if(Ext.getCmp('ff_E_LEVEL').getValue()=='地区、市、自治州、盟'){ // query.E_LEVEL=2; // } // if(Ext.getCmp('ff_E_LEVEL').getValue()=='县、市辖区、县级市、旗'){ // query.E_LEVEL=3; // } query.V_Building_ID = buildingId; var jsonstr = Ext.JSON.encode(query); myVerStore.getProxy().extraParams = { queryJson : jsonstr }; Ext.getCmp('BuildingListPageToolbar').moveFirst(); Ext.getCmp('buildingName').setValue(query.V_BUILDING_NAME); Ext.getCmp('companyId').setValue(query.UQ_COMPANY_ID); Ext.getCmp('areaId').setValue(query.V_AREA_ID); Ext.getCmp('addr0').setValue(query.V_ADDR_0); // Ext.getCmp('level').setValue(Ext.getCmp('ff_E_LEVEL').getValue()); 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: 'BuildingFilterWin', title: '修改版本筛选', height: 300, width: 400, layout: 'fit', items: FilterForm, closeAction: 'hide' }).show(); } Ext.create('Ext.grid.Panel', { title: '建筑信息修改记录', id: 'BuildingverListPanel', store: myVerStore, selModel: sm, columns: [ { header: '建筑物名称', dataIndex: 'V_BUILDING_NAME', width:100,align:'center', menuDisabled:true }, { header: '物业管理公司ID', dataIndex: 'UQ_COMPANY_ID', width:100, align:'center', menuDisabled:true }, { header: '行政区域ID', dataIndex: 'V_AREA_ID', width:100,align:'center', menuDisabled:true }, { header: '最低楼层', dataIndex: 'I_MIN_FLOOR', width:100,align:'center', menuDisabled:true }, { header: '最高楼层', dataIndex: 'I_MAX_FLOOR', width:100, align:'center', menuDisabled:true }, { header: '详细地址', dataIndex: 'V_ADDR_0', width:100,align:'center', menuDisabled:true }, { header: '记录版本', dataIndex: 'I_VERSION', width:100, align:'center', menuDisabled:true }, { header: '版本说明', dataIndex: 'V_COMMENT', width:150,align:'center', menuDisabled:true }, { header: '保存时间', dataIndex: 'D_STORETIME',width:150, 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({ store: myVerStore, id:'BuildingListPageToolbar', 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() }); myVerStore.load(); maxHeight = document.documentElement.clientHeight; Ext.getCmp('BuildingverListPanel').setHeight(maxHeight); });