You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

158 lines
7.3 KiB
JavaScript

11 months ago
(function (window, undefined) {
var nodesArr = new Array();
var id = UrlParm.parm("id");
var cid = UrlParm.parm("cid");
var tid = UrlParm.parm("tid");
var gid = new Array();
var templetid = new Array();
var width = 0;
var height = 0;
LayShow = function () { return new LayShow.fn.init(); }
LayShow.fn = LayShow.prototype = {
init: function () {
LayShow.fn.Construction();
setInterval(function () {
LayShow.fn.Count();
}, 120000) //每1000毫秒(即1秒) 执行一次本段代码
},
OpenURL: function (url) {
var MainCenter = window.parent.parent.panelEdit.MainCenter;
var children = MainCenter.items;
var mod = "";
var title = "";
var finded = false;
//得到mod的name
var _store = Ext.create('DsExt.ux.RefTableStore', {
fields: [
{ name: 'ModuleName', type: 'string' },
{ name: 'ModuleDescription', type: 'string' }
],
proxy: { url: '/MvcShipping/MsTemplet/GetModuleName' },
scope: this
});
_store.load({ params: { url: url} });
_store.on("load", function (_store) {
mod = _store.getAt(0).get("ModuleName");
title = _store.getAt(0).get("ModuleDescription");
for (var i = 0; i < children.length; i++) {
if (children.items[i].id) {
if (children.items[i].id == 'pnl' + mod) {
MainCenter.setActiveTab(i);
finded = true;
}
}
}
if (!finded) {
var paneltabitems = new Ext.Panel({
id: 'pnl' + mod,
layout: "fit",
region: "center",
autoScroll: true,
frame: false,
closable: true,
bodyStyle: {},
title: title,
html: ' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + url + '"> </iframe>'
});
MainCenter.add(paneltabitems);
MainCenter.setActiveTab(paneltabitems);
MainCenter.doLayout();
}
});
},
Construction: function () {
//构建页面元素
var strConstruction = "";
var strChildConstruction = "";
var strContain = "";
gid.length = 0;
templetid.length = 0;
Ext.Ajax.request({
async: false,
url: '/MvcShipping/MsTemplet/ReadPageStructure',
params: { url: "LayShow2", id: ".", param: "1" },
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
var data = result.data;
for (var iCount = 0; iCount < data.length; iCount++) {
height = parseInt(document.documentElement.clientHeight / 3.9);
strConstruction += "<li class=\"containLI\" id=\"contain\">";
strConstruction += "<div class=\"imgICO\" id=\"imgICO\"><img id=\"img\" src=\"" + data[iCount].IMGURL + "\" width=\"" + height + "\" height=\"" + height + "\" /></div>";
strConstruction += "<div class=\"title\">" + data[iCount].ITEMNAME + "</div>";
strConstruction += "<ul class=\"navUL\">";
//查询子元素
Ext.Ajax.request({
async: false,
url: '/MvcShipping/MsTemplet/ReadPageStructure',
params: { url: "LayShow2", id: data[iCount].ITEMNAME, param: "2" },
callback: function (options2, success2, response2) {
if (success2) {
var result2 = Ext.JSON.decode(response2.responseText);
var data2 = result2.data;
for (var jCount = 0; jCount < data2.length; jCount++) {
gid.push(data2[jCount].GID);
templetid.push(data2[jCount].TEMPLETID);
Ext.Ajax.request({
async: false,
url: '/MvcShipping/MsTemplet/GetCount',
params: { id: data2[jCount].GID, templetid: data2[jCount].TEMPLETID },
callback: function (option3, success3, response3) {
if (success3) {
var result3 = Ext.JSON.decode(response3.responseText);
var data3 = result3.data;
var strURL = data2[jCount].LINKURL.toString();
strConstruction += "<li class=\"navLI\"><a href=\"javascript:LayShow.fn.OpenURL('" + strURL + "');\" class=\"itemLinkContent\">" + data2[jCount].ITEMNAME + "&nbsp;&nbsp;&nbsp;&nbsp;<span id='" + data2[jCount].GID + "'>" + data3 + "</span></a></li>";
}
},
scope: this
});
}
}
},
scope: this
});
//
strConstruction += "</ul>";
strConstruction += "</li>";
}
}
},
scope: this
});
document.getElementById("containUL").innerHTML = strConstruction;
},
Count: function () {
for (var iCount = 0; iCount < gid.length; iCount++) {
Ext.Ajax.request({
async: false,
url: '/MvcShipping/MsTemplet/GetCount',
params: { id: gid[iCount], templetid: templetid[iCount] }, //data[iCount].GID gid templetid
callback: function (option, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
var data = result.data;
document.getElementById(gid[iCount]).innerText = data;
}
},
scope: this
});
}
}
}
LayShow.fn.init.prototype = LayShow.fn;
LayShow.fn.init.prototype = LayShow.fn;
var rootjLayShow = LayShow(document);
} (window));