/**
* 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('Areaver',{
extend: 'Ext.data.Model',
fields: [
{ name:'I_AREAVER_ID', type:'int' },
{ name:'V_AREA_ID', type:'string' },
{ name:'V_AREA_NAME', type:'string' },
{ name:'V_PARENT_ID', type:'string' },
{ name:'E_LEVEL', type:'string' },
{ name:'V_CITYCODE', type:'string' },
{ name:'V_ZIPCODE', type:'string' },
{ name:'V_MERGERNAME', type:'string' },
{ name:'V_PINYIN', type:'string' },
{ name:'I_VERSION', type:'int' },
{ name:'D_STORETIME', type:'string' },
{ name: 'V_COMMENT', type:'string' },
{ name: 'UQ_ADMIN_ID', type:'string' },
]
});
var baseUrl="";
var sm = Ext.create('Ext.selection.CheckboxModel');
Ext.onReady(function(){
var baseUrl = document.getElementById('basePath').value;
var areaId = document.getElementById('areaId').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: 'Areaver',
pageSize: countPerPage,
proxy: {
type: 'ajax',
url: baseUrl+'/iot/area/getverList',
reader: {
type: 'json',
root: 'RESULT',
totalProperty: 'totalCount'
},
actionMethods: {
read: 'POST'
},
extraParams : {
queryJson : '{"V_AREA_ID" : "'+areaId+'"}'
}
},
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_AREA_NAME').setValue("");
Ext.getCmp('ff_V_PARENT_ID').setValue("");
Ext.getCmp('ff_V_ZIPCODE').setValue("");
Ext.getCmp('ff_V_MERGERNAME').setValue("");
Ext.getCmp('ff_E_LEVEL').setValue("");
}
var FilterForm = Ext.create('Ext.form.Panel', {
id: 'AreaFilterForm',
labelWidth: 55,
defaultType: 'textfield',
bodyPadding: 15,
items: [{
fieldLabel:'行政区域名称',
id: 'ff_V_AREA_NAME',
name:'V_AREA_NAME',
maxLength:20,
maxLengthText:'长度不得超出{0}',
anchor:'75%',
value:document.getElementById('version').value
},{
fieldLabel:'上级区域ID',
id: 'ff_V_PARENT_ID',
name: 'V_PARENT_ID',
maxLength: 7,
maxLengthText:'长度不得超出{0}',
anchor:'75%',
value:document.getElementById('parentId').value
},{
fieldLabel:'邮政编码',
id: 'ff_V_ZIPCODE',
name: 'V_ZIPCODE',
maxLength: 7,
maxLengthText:'长度不得超出{0}',
anchor:'75%',
value:document.getElementById('zipCode').value
},{
fieldLabel:'联合名称',
id: 'ff_V_MERGERNAME',
name: 'V_MERGERNAME',
maxLength: 7,
maxLengthText:'长度不得超出{0}',
anchor:'75%',
value:document.getElementById('mergerName').value
},{
fieldLabel:'行政区域级别',
id:'ff_E_LEVEL',
name:'E_LEVEL',
xtype:'combo',
store:states3,
displayField : 'name',
valueField : 'status',
editable : false,
maxLength: 30,
maxLengthText:'长度不得超出{0}',
anchor:'75%',
value:document.getElementById('level').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_AREA_NAME').getValue().length>0)
query.V_AREA_NAME = Ext.getCmp('ff_V_AREA_NAME').getValue();
if(Ext.getCmp('ff_V_PARENT_ID').getValue().length>0)
query.V_PARENT_ID = Ext.getCmp('ff_V_PARENT_ID').getValue();
if(Ext.getCmp('ff_V_ZIPCODE').getValue().length>0)
query.V_ZIPCODE = Ext.getCmp('ff_V_ZIPCODE').getValue();
if(Ext.getCmp('ff_V_MERGERNAME').getValue().length>0)
query.V_MERGERNAME = Ext.getCmp('ff_V_MERGERNAME').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_AREA_ID = areaId;
var jsonstr = Ext.JSON.encode(query);
myVerStore.getProxy().extraParams = {
queryJson : jsonstr
};
Ext.getCmp('AreaListPageToolbar').moveFirst();
Ext.getCmp('version').setValue(query.V_AREA_NAME);
Ext.getCmp('parentId').setValue(query.V_PARENT_ID);
Ext.getCmp('zipCode').setValue(query.V_ZIPCODE);
Ext.getCmp('mergerName').setValue(query.V_MERGERNAME);
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: 'AreaFilterWin',
title: '修改版本筛选',
height: 300,
width: 400,
layout: 'fit',
items: FilterForm,
closeAction: 'hide'
}).show();
}
Ext.create('Ext.grid.Panel', {
title: '行政区域信息修改记录',
id: 'AreaverListPanel',
store: myVerStore,
selModel: sm,
columns: [
{ header: '行政区域名称', dataIndex: 'V_AREA_NAME', width:100,align:'center', menuDisabled:true },
{ header: '上级区域ID', dataIndex: 'V_PARENT_ID', width:100, align:'center',menuDisabled:true },
{ header: '邮政编号', dataIndex: 'V_ZIPCODE', width:100, align:'center', menuDisabled:true },
{ header: '组合名称', dataIndex: 'V_MERGERNAME', width:100, align:'center', menuDisabled:true },
{ header: '拼音', dataIndex: 'V_PINYIN', 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:'AreaListPageToolbar',
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('AreaverListPanel').setHeight(maxHeight);
});