Ext.define('ZYMLZiYuanModel', {
extend: 'Ext.data.Model',
fields: [
'resourceid', 'title', 'mulu', 'resourceclass', 'pubunitid', 'createuserid', 'pubdate'
],
idProperty: 'resourceid'
});
var ZYMLZiYuanStore = new Ext.data.Store({
autoDestroy: true,
pageSize: 25,
model: 'ZYMLZiYuanModel',
proxy: {
type: 'ajax',
url: 'selectResMainInfojoinCatalog',
reader: {
root: 'topics',
totalProperty: 'totalCount'
},
simpleSortMode: true
},
remoteSort: true
});
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',
// height: 800,
layout: 'fit',
autoScroll: false,
store: ZYMLZiYuanStore,
stateful: false,
stateId: 'ZYMLZiYuan-Grid',
viewConfig: {
forceFit: true,
enableTextSelection: true //列表数据可复制
},
columns: [
{xtype: 'rownumberer', text: "序号", width: '5%', align: 'center'},
{
text: "资源名称",
dataIndex: 'title',
width: '15%',
flex: 1,
sortable: true,
align: 'left',
filter: {type: 'string'},
renderer: function (value, p, record) {
var ziYuanId = record.getData()["resourceid"];
var tit = htmlEncodeByRegExp(value);
return Ext.String.format(
'{2}',
ziYuanId, value, tit
);
}
},
{
text: "所属目录", dataIndex: 'mulu', width: '16%', sortable: false, filter: {type: 'string'}, align: 'left',
renderer: function (value, p, record) {
return Ext.String.format('{0}', value);
}
},
{
text: "资源类型",
dataIndex: 'resourceclass',
width: '14%',
sortable: true,
align: 'center',
filter: {type: 'string'},
renderer: function (value, p, record) {
var color = "";
if (value == "基础底图" || value == "三维影像") {
color = "label-success";
} else if (value == "业务图层" || value == "接口服务") {
color = "label-danger";
} else if (value == "空间分析") {
color = "label-warning";
} else if (value == "专题地图" || value == "三维地形") {
color = "label-pink";
} else if (value == "专题应用程序" || value == "数据文件") {
color = "label-default";
} else if (value == "业务集成") {
color = "label-info";
} else if (value == "文档数据" || value == "数据库表" || value == "三维模型") {
color = "label-primary";
}
return Ext.String.format(
'{1}',
color, value
);
}
},
{
text: "发布单位",
dataIndex: 'pubunitid',
width: '14%',
sortable: true,
align: 'center',
filter: {type: 'string'},
renderer: function (value, p, record) {
if (value == null || value == "null") {
return "";
} else {
return value;
}
}
},
{
text: "发布人",
dataIndex: 'createuserid',
width: '14%',
sortable: true,
align: 'center',
filter: {type: 'string'}
}
],
bbar: Ext.create('Ext.ux.PagingToolbar', {
id: "Page",
name: "Page",
store: ZYMLZiYuanStore,
displayInfo: true,
firstText: "首页",
prevText: "上一页",
nextText: "下一页",
lastText: "尾页",
refreshText: '刷新',
beforePageText: '第',
afterPageText: '页,共 {0} 页',
displayMsg: '显示 {0} - {1} 条,共 {2} 条',
emptyMsg: "没有数据显示",
items: [
{
xtype: 'label',
text: ''
}
]
})
});
ZYMLZiYuanStore.on('beforeload', function () {
GetSearchWhere("SearchForm");
ZYMLZiYuanStore.proxy.extraParams = [];
if($("#catalogName").val() != undefined){
formdata["catalogName"] = $("#catalogName").val().trim();
}
Ext.apply(ZYMLZiYuanStore.proxy.extraParams, formdata);
});
ZYMLZiYuanStore.on('load', function (store, records, successful, eOpts) {
var totalCount = store.totalCount;
if (totalCount == "") totalCount = "0";
document.getElementById("ZiYuanCount").innerHTML = totalCount;
});
//添加resize监听防止切换tab或者收起左栏导致grid不自适应宽度
$(window).resize(function () {
Ext.getCmp('gridexample').doLayout();//panel重新布局
});
if (Message != null) {
document.getElementById("tab2").click();
}
});
//获取查询条件
function GetSearchWhere(formId) {
var form = document.forms[formId];
for (var i = 0; i < form.elements.length; i++) {
var strID = form.elements[i].id;
if (strID == "thisYear") {
break;
}
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 + "");
}
if(isDiTuwu == "1" && formdata.resourceclass == "") { //用户没有选择资源类型且是地图服务搜索
formdata.resourceclass = "KJ_";
}
formdata.spcStatus=undefined;
if(Flag===3)
{
formdata.spcStatus=1;
}
}
//加载统计图
function LoadChart() {
GetSearchWhere("SearchFormChar");
Ext.Ajax.request({
url: '../../XMGL/XMGL/XMGLTongJi',
params: eval(formdata),
success: function (response) {
if (response.responseText != "") {
var mychart = new FusionCharts({
type: 'mscolumn3d',
renderAt: 'chartContainer1',
width: '100%',
height: '400',
dataFormat: 'json',
dataSource: response.responseText
});
mychart.render();
}
}
});
}
//导出
function Export() {
GetSearchWhere("SearchForm");
Ext.MessageBox.wait("正在进行导出,请稍后...", "操作提示", {
interval: 100
});
Ext.Ajax.request({
url: 'excel',
params: eval(formdata),
success: function (response) {
Ext.MessageBox.hide();
//加载
window.open(response.responseText);
},
error: function (e) {
}
});
}