/**
* 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('UnitmodelVer',{
extend: 'Ext.data.Model',
fields: [
{name:'UQ_UNIT_MODEL_ID', type:'string'},
{name:'I_ORDER_IDX', type:'int'},
{name:'V_UNIT_MODEL', type:'string'},
{name:'UQ_PROTOCOL_ID', type:'string'},
{name:'UQ_COMPANY_ID', type:'string'},
{name:'D_STORETIME', type:'string'},
{name:'E_STATUS', type:'string'},
{name:'V_COMMENT', type:'string'},
{name:'UQ_ADMIN_ID', type:'string'},
{name:'I_VERSION', type:'int'},
]
});
var baseUrl="";
var sm = Ext.create('Ext.selection.CheckboxModel');
Ext.onReady(function(){
var baseUrl = document.getElementById('basePath').value;
var unitmodelId = document.getElementById('unitmodelId').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: 'UnitmodelVer',
pageSize: countPerPage,
proxy: {
type: 'ajax',
url: baseUrl+'/iot/unitmodel/getVerList',
reader: {
type: 'json',
root: 'RESULT',
totalProperty: 'totalCount'
},
actionMethods: {
read: 'POST'
},
extraParams : {
queryJson : '{"UQ_UNIT_MODEL_ID" : "'+unitmodelId+'"}'
}
},
remoteSort: true
});
var clear_filter_form = function(){
Ext.getCmp('fb_V_UNIT_MODEL').setValue("");
Ext.getCmp('fb_UQ_PROTOCOL_ID').setValue("");
Ext.getCmp('fb_UQ_COMPANY_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: 'UnitmodelVerFilterForm',
labelWidth: 55,
defaultType: 'textfield',
bodyPadding: 15,
items: [{
fieldLabel:'监控单元型号',
id: 'fb_V_UNIT_MODEL',
name:'V_UNIT_MODEL',
maxLength:20,
maxLengthText:'长度不得超出{0}',
value : document.getElementById('unitModel').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_PROTOCOL_ID',
name:'UQ_PROTOCOL_ID',
maxLength:20,
maxLengthText:'长度不得超出{0}',
value : document.getElementById('protocolId').value,
anchor:'75%'
},{
fieldLabel:'生成商OD',
id: 'fb_UQ_COMPANY_ID',
name:'UQ_COMPANY_ID',
maxLength:20,
maxLengthText:'长度不得超出{0}',
value : document.getElementById('companyId').value,
anchor:'75%'
},{
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_MODEL').getValue().length>0)
query.V_UNIT_MODEL = Ext.getCmp('fb_V_UNIT_MODEL').getValue();
if(Ext.getCmp('fb_UQ_PROTOCOL_ID').getValue().length>0)
query.UQ_PROTOCOL_ID = Ext.getCmp('fb_UQ_PROTOCOL_ID').getValue();
if(Ext.getCmp('fb_UQ_COMPANY_ID').getValue().length>0)
query.UQ_COMPANY_ID = Ext.getCmp('fb_UQ_COMPANY_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_MODEL_ID = unitmodelId;
var jsonstr = Ext.JSON.encode(query);
myVerStore.getProxy().extraParams = {
queryJson : jsonstr,
};
Ext.getCmp('UnitmodelListPageToolbar').moveFirst();
Ext.getCmp('unitModel').setValue(query.V_UNIT_MODEL);
Ext.getCmp('protocolId').setValue(query.UQ_PROTOCOL_ID);
Ext.getCmp('companyId').setValue(query.UQ_COMPANY_ID);
//Ext.getCmp('eStatus').setValue(query.E_STATUS);
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: 'UnitmodelVerFilterWin',
title: '筛选',
height: 250,
width: 350,
layout: 'fit',
items: FilterForm,
closeAction: 'hide'
}).show();
}
Ext.create('Ext.grid.Panel', {
title: '监控单元型号管理记录',
id: 'UnitmodelVerListPanel',
store: myVerStore,
// selModel: sm,
columns: [
//{name:'E_STATUS', type:'string'},
{ header: '记录版本', dataIndex: 'I_VERSION', width:70, align:'center', menuDisabled:true },
{ header: '监控单元型号', dataIndex: 'V_UNIT_MODEL', width:120,align:'center', menuDisabled:true },
{ header: '通信协议ID', dataIndex: 'UQ_PROTOCOL_ID', width:120,align:'center', menuDisabled:true },
{ header: '生成商OD', dataIndex: 'UQ_COMPANY_ID', width:120,align:'center', menuDisabled:true },
{ header: '当前状态', dataIndex: 'E_STATUS', 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:'UnitmodelListPageToolbar',
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('UnitmodelVerListPanel').setHeight(maxHeight);
});