/********************************************
|
* *
|
*******************************************/
|
|
//控制器:ResSubscriptionsController
|
|
//------------------------------------------
|
//F1.定义Ext列表实体字段
|
//F2.获取Ext列表数据
|
//F3.Ext加载后创建建列表
|
//F4.获取查询条件
|
//------------------------------------------
|
|
//F1.定义Ext列表实体字段
|
Ext.define('ResModel', {
|
extend: 'Ext.data.Model',
|
fields:[
|
'appid','appfullname','count'
|
],
|
idProperty: 'appid'
|
});
|
|
//F2.获取Ext列表数据
|
var ResStore = new Ext.data.Store({
|
autoDestroy: true,
|
pageSize: 10,
|
model: 'ResModel',
|
proxy: {
|
type: 'ajax',
|
url: '/res/manage/actionrecord/selectAppTotalCount',
|
reader: {
|
root: 'topics',
|
totalProperty: 'totalCount'
|
},
|
simpleSortMode: true
|
},
|
// remoteSort: true
|
});
|
|
//F3.Ext加载后创建建列表
|
var formdata = {};
|
Ext.onReady(function () {
|
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
|
Ext.tip.QuickTipManager.init();
|
Ext.Ajax.timeout = 900000;
|
Ext.require([
|
'Ext.ux.PagingToolbar'
|
]);
|
Ext.create('Ext.grid.Panel', {
|
id: 'gridexample',
|
renderTo: 'grid',
|
// width: 2400,
|
// height: 420,
|
layout: 'fit',
|
autoScroll: false,
|
//bodyStyle: 'width:100%',
|
store: ResStore,
|
stateful: false,
|
stateId: 'Grid',
|
viewConfig: {
|
forceFit: true,
|
enableTextSelection: true //列表数据可复制
|
},
|
columns: [
|
{ xtype: 'rownumberer', text: "序号", width: '10%', align: 'center' },
|
{ text: "应用程序名称", dataIndex: 'appfullname', width: '7%', flex: 1, sortable: true, align: 'center', filter: { type: 'string' }},
|
{ text: "调用资源次数", dataIndex: 'count', width: '20%', sortable: false, align: 'center', filter: { type: 'string' },
|
renderer: function (value, p, record) {
|
var id = record.getData()["appid"];
|
return Ext.String.format(
|
'<span style="text-decoration : underline;cursor:pointer;" onclick="CheckResource(\'{1}\')" >{0}</span>',
|
value, id
|
);
|
}
|
}
|
],
|
bbar: Ext.create('Ext.ux.PagingToolbar', {
|
id: "Page",
|
name: "Page",
|
store: ResStore,
|
displayInfo: true,
|
firstText: "首页",
|
prevText: "上一页",
|
nextText: "下一页",
|
lastText: "尾页",
|
refreshText: '刷新',
|
beforePageText: '第',
|
afterPageText: '页,共 {0} 页',
|
displayMsg: '显示 {0} - {1} 条,共 {2} 条',
|
emptyMsg: "没有数据显示",
|
items: [
|
{
|
xtype: 'label',
|
text: ''
|
}
|
]
|
})
|
});
|
ResStore.on('beforeload', function () {
|
// GetSearchWhere("SearchForm");
|
ResStore.proxy.extraParams = [];
|
Ext.apply(ResStore.proxy.extraParams, formdata);
|
});
|
ResStore.on('load', function (store, records, successful, eOpts) {
|
var totalCount = store.totalCount;
|
if (totalCount == "") totalCount = "0";
|
});
|
ResStore.load();
|
//添加resize监听防止切换tab或者收起左栏导致grid不自适应宽度
|
$(window).resize(function () {
|
Ext.getCmp('gridexample').doLayout();//panel重新布局
|
});
|
});
|
|
//F4.获取查询条件
|
function GetSearchWhere(formId) {
|
var form = document.forms[formId];
|
for (var i = 0; i < form.elements.length; i++) {
|
var strID = form.elements[i].id;
|
var value = form.elements[i].value;
|
if (form.elements[i].type == "checkbox") {
|
if (form.elements[i].checked == true)
|
value = "on";
|
else
|
value = "";
|
}
|
if (form.elements[i].type == "radio") {
|
if (form.elements[i].checked == true) {
|
strID = form.elements[i].name;
|
value = form.elements[i].value;
|
}
|
}
|
formdata[strID] = (value == "全部" || value == "None" ? "" : value + "");
|
}
|
}
|
|
function CheckResource(appid) {
|
layer.open({
|
type: 2,
|
title: "调用资源",
|
shadeClose: true,
|
area: ["700px", "400px"],
|
content: '/res/manage/actionrecord/appresource?appid='+appid
|
});
|
}
|