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.
DS7/DSWeb/Areas/MvcShipping/Viewsjs/MsTemplet/LayShow2.js

221 lines
11 KiB
JavaScript

2 years 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;
var _Quiry = window.Quiry,
_$ = window.$;
var Quiry = window.Quiry = window.$ = function () { return new Quiry.fn.init(); }
Quiry.fn = Quiry.prototype = {
init: function () {
Quiry.fn.Construction();
setInterval(function () {
Quiry.fn.Count();
}, 120000) //每1000毫秒(即1秒) 执行一次本段代码
},
OpenURL: function (url) {
var MainCenter = window.parent.parent.panelEdit.MainCenter;
var children = MainCenter.items;
var gid = "";
var mod = "";
var title = "";
var finded = false;
//得到mod的name
var _store = Ext.create('DsExt.ux.RefTableStore', {
fields: [
{ name: 'Gid', type: 'string' },
{ 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) {
gid = _store.getAt(0).get("Gid");
mod = _store.getAt(0).get("ModuleName");
if (gid == "31833C72-0CFD-4CDA-B5BA-14E9328BC28C") {
title = "海运出口-" + _store.getAt(0).get("ModuleDescription");
}
else if (gid == "26D132A3-9AE2-4E75-8FA1-E6B04529C2DA") {
title = "海运进口-" + _store.getAt(0).get("ModuleDescription");
}
else {
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 = "";
var dataCount = 0;
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++) {
strConstruction += "<div class=\"ulTitle\">" + data[iCount].ITEMNAME + "</div>";
strConstruction += "<ul class=\"listUL\" id=\"listUL" + data[iCount].ITEMID + "\">";
//查询子元素
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;
dataCount = data2.length;
if (dataCount % 2 == 0) isDouble = true;
else isDouble = false;
for (var jCount = 0; jCount < data2.length; jCount++) {
gid.push(data2[jCount].GID);
templetid.push(data2[jCount].TEMPLETID);
strConstruction += "<li class=\"listLI\">";
//变换文件夹样式
if (jCount == 0) {
strConstruction += "<div class=\"iconContainBlue\">";
}
else if (!isDouble && data2.length > 1 && jCount == parseInt(data2.length / 2)) {
strConstruction += "<div class=\"iconContainOrange\">";
}
else if (isDouble && data2.length > 1 && jCount == (parseInt(data2.length / 2) - 1)) {
strConstruction += "<div class=\"iconContainOrange\">";
}
else if (isDouble && data2.length > 1 && jCount == parseInt(data2.length / 2)) {
strConstruction += "<div class=\"iconContainCyan\">";
}
else {
strConstruction += "<div class=\"iconContainBlue\">";
}
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 += "<div class=\"num\" id=\"" + data2[jCount].GID + "\">" + data3 + "</div>";
}
},
scope: this
});
strConstruction += "<a href=\"javascript:Quiry.fn.OpenURL('" + data2[jCount].LINKURL.toString() + "');\"><img src=\"../../../../images/setting/" + data2[jCount].ICONNAME.toString() + "\" width=\"55\" height=\"55\" border=\"0\" /></a>";
strConstruction += "</div>";
strConstruction += "<div class=\"title\"><a href=\"javascript:Quiry.fn.OpenURL('" + data2[jCount].LINKURL.toString() + "');\" class=\"icoTitleLinkContent\">" + data2[jCount].ITEMNAME + "</a></div>";
strConstruction += "</li>";
}
}
},
scope: this
});
//
strConstruction += "</ul>";
}
}
},
scope: this
});
document.getElementById("listContain").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;
if (document.getElementById(gid[iCount])) {
document.getElementById(gid[iCount]).innerText = data.toString();
}
}
},
scope: this
});
}
},
CountImmediately: function () {
for (var iCount = 0; iCount < gid.length; iCount++) {
Ext.Ajax.request({
async: false,
url: '/MvcShipping/MsTemplet/GetCountImmediately',
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;
if (document.getElementById(gid[iCount])) {
document.getElementById(gid[iCount]).innerText = data.toString();
}
}
},
scope: this
});
}
}
}
//Quiry.fn.init.prototype = Quiry.fn;
Quiry.fn.init.prototype = Quiry.fn;
var rootjQuiry = Quiry(document);
} (window));