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.
773 lines
34 KiB
JavaScript
773 lines
34 KiB
JavaScript
var alowSetting = "0"; //是否允许设置大小和位置
|
|
var isShow = false;
|
|
var z = 1, i = 1, left = 10
|
|
var isIE = (document.all) ? true : false;
|
|
var islocation = false;
|
|
|
|
var layControl;
|
|
var isMix = false;
|
|
|
|
var $ = function (id) {
|
|
return document.getElementById(id);
|
|
};
|
|
|
|
var Extend = function (destination, source) {
|
|
for (var property in source) {
|
|
destination[property] = source[property];
|
|
}
|
|
}
|
|
|
|
var Bind = function (object, fun, args) {
|
|
return function () {
|
|
return fun.apply(object, args || []);
|
|
}
|
|
}
|
|
|
|
var BindAsEventListener = function (object, fun) {
|
|
var args = Array.prototype.slice.call(arguments).slice(2);
|
|
return function (event) {
|
|
return fun.apply(object, [event || window.event].concat(args));
|
|
}
|
|
}
|
|
|
|
var CurrentStyle = function (element) {
|
|
return element.currentStyle || document.defaultView.getComputedStyle(element, null);
|
|
}
|
|
|
|
function create(elm, parent, fn) { var element = document.createElement(elm); fn && fn(element); parent && parent.appendChild(element); return element };
|
|
function addListener(element, e, fn) { element.addEventListener ? element.addEventListener(e, fn, false) : element.attachEvent("on" + e, fn) };
|
|
function removeListener(element, e, fn) { element.removeEventListener ? element.removeEventListener(e, fn, false) : element.detachEvent("on" + e, fn) };
|
|
|
|
var Class = function (properties) {
|
|
var _class = function () { return (arguments[0] !== null && this.initialize && typeof (this.initialize) == 'function') ? this.initialize.apply(this, arguments) : this; };
|
|
_class.prototype = properties;
|
|
return _class;
|
|
};
|
|
|
|
var Dialog = new Class({
|
|
options: {
|
|
Width: 400,
|
|
Height: 400,
|
|
Left: 100,
|
|
Top: 100,
|
|
Titleheight: 26,
|
|
Minwidth: 200,
|
|
Minheight: 200,
|
|
CancelIco: true,
|
|
ResizeIco: false,
|
|
Info: "",
|
|
Module: "",
|
|
Content: "",
|
|
Zindex: 2
|
|
},
|
|
initialize: function (options) {
|
|
this._dragobj = null;
|
|
this._resize = null;
|
|
this._cancel = null;
|
|
this._body = null;
|
|
this._x = 0;
|
|
this._y = 0;
|
|
this._fM = BindAsEventListener(this, this.Move);
|
|
this._fS = Bind(this, this.Stop);
|
|
this._isdrag = null;
|
|
this._Css = null;
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
this.Width = this.options.Width;
|
|
this.Height = this.options.Height;
|
|
this.Left = this.options.Left;
|
|
this.Top = this.options.Top;
|
|
this.CancelIco = this.options.CancelIco;
|
|
this.Info = this.options.Info;
|
|
this.Module = this.options.Module;
|
|
this.Content = this.options.Content;
|
|
this.Minwidth = this.options.Minwidth;
|
|
this.Minheight = this.options.Minheight;
|
|
this.Titleheight = this.options.Titleheight;
|
|
this.Zindex = this.options.Zindex;
|
|
Extend(this, options);
|
|
Dialog.Zindex = this.Zindex;
|
|
|
|
//////////////////////////////////////////////////////////////////////////////// 构造dialog
|
|
var obj = ['dialogcontainter', 'dialogtitle', 'dialogtitleinfo', 'dialogtitleico', 'dialogbody', 'dialogbottom'];
|
|
for (var i = 0; i < obj.length; i++)
|
|
{ obj[i] = create('div', null, function (elm) { elm.className = obj[i]; }); }
|
|
obj[2].innerHTML = this.Info;
|
|
obj[4].innerHTML = this.Content;
|
|
obj[1].appendChild(obj[2]);
|
|
//obj[1].appendChild(obj[3]);
|
|
obj[0].id = this.Module;
|
|
obj[0].appendChild(obj[1]);
|
|
obj[0].appendChild(obj[4]);
|
|
obj[0].appendChild(obj[5]);
|
|
//document.body.appendChild(obj[0]);
|
|
document.getElementById("main").appendChild(obj[0]);
|
|
this._dragobj = obj[0];
|
|
this._resize = obj[5];
|
|
this._cancel = obj[3];
|
|
this._body = obj[4];
|
|
|
|
////////////////////////////////////////////////////////////////////////////////o,x1,x2
|
|
////设置Dialog的长 宽 ,left ,top
|
|
with (this._dragobj.style) {
|
|
height = this.Height + "px"; top = this.Top + "px"; width = this.Width + "px"; left = this.Left + "px"; zIndex = this.Zindex;
|
|
}
|
|
this._body.style.height = this.Height - this.Titleheight - parseInt(CurrentStyle(this._body).paddingLeft) * 2 + 'px';
|
|
|
|
/////////////////////////////////////////////////////////////////////////////// 添加事件
|
|
addListener(this._dragobj, 'mousedown', BindAsEventListener(this, this.Start, true));
|
|
addListener(this._cancel, 'mouseover', Bind(this, this.Changebg, [this._cancel, '0px 0px', '-21px 0px']));
|
|
addListener(this._cancel, 'mouseout', Bind(this, this.Changebg, [this._cancel, '0px 0px', '-21px 0px']));
|
|
addListener(this._cancel, 'mousedown', BindAsEventListener(this, this.Disappear));
|
|
addListener(this._body, 'mousedown', BindAsEventListener(this, this.Cancelbubble));
|
|
addListener(this._resize, 'mousedown', BindAsEventListener(this, this.Start, false));
|
|
},
|
|
Disappear: function (e) {
|
|
this.Cancelbubble(e);
|
|
//document.body.removeChild(this._dragobj);
|
|
document.getElementById("main").removeChild(this._dragobj);
|
|
},
|
|
Cancelbubble: function (e) {
|
|
this._dragobj.style.zIndex = ++Dialog.Zindex;
|
|
document.all ? (e.cancelBubble = true) : (e.stopPropagation())
|
|
},
|
|
Changebg: function (o, x1, x2) {
|
|
o.style.backgroundPosition = (o.style.backgroundPosition == x1) ? x2 : x1;
|
|
},
|
|
Start: function (e, isdrag) {
|
|
alowSetting = document.getElementById("hidAlowSetting").value;
|
|
if (alowSetting != "0") {
|
|
if (!isdrag) {
|
|
this.Cancelbubble(e);
|
|
islocation = false;
|
|
}
|
|
else {
|
|
islocation = true;
|
|
}
|
|
this._Css = isdrag ? { x: "left", y: "top"} : { x: "width", y: "height" }
|
|
this._dragobj.style.zIndex = ++Dialog.Zindex;
|
|
this._isdrag = isdrag;
|
|
this._x = isdrag ? (e.clientX - this._dragobj.offsetLeft || 0) : (this._dragobj.offsetLeft || 0);
|
|
|
|
|
|
this._y = isdrag ? (e.clientY - this._dragobj.offsetTop || 0) : (this._dragobj.offsetTop || 0);
|
|
|
|
|
|
if (islocation) {
|
|
jsSelectItemByValue(document.getElementById("selView"), this._dragobj.id);
|
|
jsSelectItemByValue(document.getElementById("selViewMin"), this._dragobj.id);
|
|
}
|
|
if (isIE) {
|
|
addListener(this._dragobj, "losecapture", this._fS);
|
|
this._dragobj.setCapture();
|
|
}
|
|
else {
|
|
e.preventDefault();
|
|
addListener(window, "blur", this._fS);
|
|
}
|
|
addListener(document, 'mousemove', this._fM)
|
|
addListener(document, 'mouseup', this._fS)
|
|
}
|
|
else {
|
|
if (!isShow) {
|
|
fnShowMsg("当前状态下不允许调整视口大小及位置,请单击“设置视口”进行修改");
|
|
isShow = true;
|
|
}
|
|
else {
|
|
isShow = false;
|
|
}
|
|
}
|
|
},
|
|
Move: function (e) {
|
|
alowSetting = document.getElementById("hidAlowSetting").value;
|
|
if (alowSetting != "0") {
|
|
window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();
|
|
var i_x = e.clientX - this._x, i_y = e.clientY - this._y;
|
|
this._dragobj.style[this._Css.x] = (this._isdrag ? Math.max(i_x, 0) : Math.max(i_x, this.Minwidth)) + 'px';
|
|
moveWidth = this._dragobj.style[this._Css.x];
|
|
this._dragobj.style[this._Css.y] = (this._isdrag ? Math.max(i_y, 0) : Math.max(i_y, this.Minheight)) + 'px'
|
|
moveHeight = this._dragobj.style[this._Css.y];
|
|
if (!islocation) {
|
|
jsSelectItemByValue(document.getElementById("selView"), this._dragobj.id);
|
|
jsSelectItemByValue(document.getElementById("selViewMin"), this._dragobj.id);
|
|
}
|
|
if (!this._isdrag)
|
|
this._body.style.height = Math.max(i_y - this.Titleheight, this.Minheight - this.Titleheight) - 2 * parseInt(CurrentStyle(this._body).paddingLeft) + 'px';
|
|
document.getElementById("txtLocationX").value = this._dragobj.offsetLeft;
|
|
document.getElementById("txtLocationY").value = this._dragobj.offsetTop;
|
|
document.getElementById("txtSizeWidth").value = this._dragobj.offsetWidth;
|
|
document.getElementById("txtSizeHeight").value = this._dragobj.offsetHeight;
|
|
document.getElementById("txtLocationXMin").value = this._dragobj.offsetLeft;
|
|
document.getElementById("txtLocationYMin").value = this._dragobj.offsetTop;
|
|
document.getElementById("txtSizeWidthMin").value = this._dragobj.offsetWidth;
|
|
document.getElementById("txtSizeHeightMin").value = this._dragobj.offsetHeight;
|
|
document.getElementById("fram" + this.Module).style.width = this._dragobj.offsetWidth - 15 + "px";
|
|
document.getElementById("fram" + this.Module).style.height = this._dragobj.offsetHeight - 50 + "px";
|
|
if ((this._dragobj.offsetLeft + this._dragobj.offsetWidth) > document.documentElement.clientWidth) {
|
|
this._dragobj.style.left = document.documentElement.clientWidth - this._dragobj.offsetWidth - 26 + "px";
|
|
}
|
|
else {
|
|
this._dragobj.style.left = this._dragobj.style.offsetLeft + "px";
|
|
}
|
|
if ((this._dragobj.offsetTop + this._dragobj.offsetHeight) > document.documentElement.clientHeight - 3) {
|
|
this._dragobj.style.top = document.documentElement.clientHeight - this._dragobj.offsetHeight - 3 + "px";
|
|
}
|
|
else {
|
|
this._dragobj.style.top = this._dragobj.style.offsetTop + "px";
|
|
}
|
|
}
|
|
else {
|
|
fnShowMsg("当前状态下不允许调整视口大小及位置,请单击“设置视口”进行修改");
|
|
}
|
|
},
|
|
Stop: function () {
|
|
removeListener(document, 'mousemove', this._fM);
|
|
removeListener(document, 'mouseup', this._fS);
|
|
document.getElementById("txtLocationX").value = this._dragobj.offsetLeft;
|
|
document.getElementById("txtLocationY").value = this._dragobj.offsetTop;
|
|
document.getElementById("txtSizeWidth").value = this._dragobj.offsetWidth;
|
|
document.getElementById("txtSizeHeight").value = this._dragobj.offsetHeight;
|
|
document.getElementById("txtLocationXMin").value = this._dragobj.offsetLeft;
|
|
document.getElementById("txtLocationYMin").value = this._dragobj.offsetTop;
|
|
document.getElementById("txtSizeWidthMin").value = this._dragobj.offsetWidth;
|
|
document.getElementById("txtSizeHeightMin").value = this._dragobj.offsetHeight;
|
|
if ((this._dragobj.offsetLeft + this._dragobj.offsetWidth) > document.documentElement.clientWidth) {
|
|
this._dragobj.style.left = document.documentElement.clientWidth - this._dragobj.offsetWidth - 26 + "px";
|
|
}
|
|
else {
|
|
this._dragobj.style.left = this._dragobj.style.offsetLeft + "px";
|
|
}
|
|
if (isIE) {
|
|
removeListener(this._dragobj, "losecapture", this._fS);
|
|
this._dragobj.releaseCapture();
|
|
}
|
|
else {
|
|
removeListener(window, "blur", this._fS);
|
|
};
|
|
}
|
|
})
|
|
|
|
|
|
function creat() {
|
|
new Dialog({ Info: title = "标题" + i, Left: 300 + left, Top: 300 + left, Content: '内容' + i, Zindex: (++Dialog.Zindex) });
|
|
i++; left += 10;
|
|
}
|
|
|
|
Ext.onReady(function () {
|
|
var _winWidth = document.documentElement.clientWidth;
|
|
var _winHeight = document.documentElement.clientHeight;
|
|
|
|
document.getElementById("txtLocationX").readOnly = true;
|
|
document.getElementById("txtLocationY").readOnly = true;
|
|
document.getElementById("txtSizeWidth").readOnly = true;
|
|
document.getElementById("txtSizeHeight").readOnly = true;
|
|
|
|
document.getElementById("main").style.width = _winWidth - 26 + "px";
|
|
|
|
fnSetColourStyle();
|
|
|
|
});
|
|
|
|
function fnSetColourStyle() {
|
|
var file = "";
|
|
var _store = Ext.create('DsExt.ux.RefTableStore', {
|
|
fields: [
|
|
{ name: 'COLOURSTYLE', type: 'int' }
|
|
],
|
|
proxy: { url: '/MvcShipping/MsHome/GetColourStyle' },
|
|
scope: this
|
|
});
|
|
_store.load();
|
|
|
|
_store.on("load", function (_store) {
|
|
for (var i = 0; i < _store.getCount(); i++) {
|
|
colourStyle = parseInt(_store.getAt(i).get("COLOURSTYLE"));
|
|
file = "../../../../Css/childView" + colourStyle.toString() + ".css";
|
|
document.getElementById("linkCss").href = file;
|
|
fnGetModule();
|
|
}
|
|
});
|
|
}
|
|
|
|
function fnSelViewMinChange() {
|
|
var val = document.getElementById("selViewMin").options[document.getElementById("selViewMin").selectedIndex].value;
|
|
for (var iCount = 0; iCount < document.getElementById("selView").options.length; iCount++) {
|
|
if (document.getElementById("selView").options[iCount].value == val) {
|
|
document.getElementById("selView").options[iCount].selected = true;
|
|
}
|
|
}
|
|
document.getElementById("txtLocationX").value = "";
|
|
document.getElementById("txtLocationY").value = "";
|
|
document.getElementById("txtSizeWidth").value = "";
|
|
document.getElementById("txtSizeHeight").value = "";
|
|
document.getElementById("txtLocationXMin").value = "";
|
|
document.getElementById("txtLocationYMin").value = "";
|
|
document.getElementById("txtSizeWidthMin").value = "";
|
|
document.getElementById("txtSizeHeightMin").value = "";
|
|
}
|
|
function fnSelViewChange() {
|
|
var val = document.getElementById("selView").options[document.getElementById("selView").selectedIndex].value;
|
|
for (var iCount = 0; iCount < document.getElementById("selViewMin").options.length; iCount++) {
|
|
if (document.getElementById("selViewMin").options[iCount].value == val) {
|
|
document.getElementById("selViewMin").options[iCount].selected = true;
|
|
}
|
|
}
|
|
document.getElementById("txtLocationX").value = "";
|
|
document.getElementById("txtLocationY").value = "";
|
|
document.getElementById("txtSizeWidth").value = "";
|
|
document.getElementById("txtSizeHeight").value = "";
|
|
document.getElementById("txtLocationXMin").value = "";
|
|
document.getElementById("txtLocationYMin").value = "";
|
|
document.getElementById("txtSizeWidthMin").value = "";
|
|
document.getElementById("txtSizeHeightMin").value = "";
|
|
}
|
|
|
|
function fnGetModule() {
|
|
var defaultWidth = 0;
|
|
var defaultHeight = 0;
|
|
var width = 0;
|
|
var height = 0;
|
|
var top = 0;
|
|
var left = 0;
|
|
var colourStyle = -1;
|
|
var _store = Ext.create('DsExt.ux.RefTableStore', {
|
|
fields: [
|
|
{ name: 'GID', type: 'string' },
|
|
{ name: 'ITEMID', type: 'string' },
|
|
{ name: 'MODULENAME', type: 'string' },
|
|
{ name: 'MODULETITLE', type: 'string' },
|
|
{ name: 'COLOURSTYLE', type: 'int' },
|
|
{ name: 'MODULEURL', type: 'string' },
|
|
{ name: 'USERTEMPLETID', type: 'string' },
|
|
{ name: 'DEFAULTMODULEWIDTH', type: 'int' },
|
|
{ name: 'DEFAULTMODULEHEIGHT', type: 'int' },
|
|
{ name: 'MODULEWIDTH', type: 'int' },
|
|
{ name: 'MODULEHEIGHT', type: 'int' },
|
|
{ name: 'MODULETOP', type: 'int' },
|
|
{ name: 'MODULELEFT', type: 'int' },
|
|
{ name: 'ISVISIABLE', type: 'bool' }
|
|
],
|
|
proxy: { url: '/MvcShipping/MsHome/GetModuleList' },
|
|
scope: this
|
|
});
|
|
_store.load();
|
|
|
|
_store.on("load", function (_store) {
|
|
for (var i = 0; i < _store.getCount(); i++) {
|
|
if ((_store.getAt(i).get("MODULETOP") != "" && _store.getAt(i).get("MODULETOP") != -1) || _store.getAt(i).get("MODULETOP") >= "0") {
|
|
top = parseInt(_store.getAt(i).get("MODULETOP"));
|
|
}
|
|
else {
|
|
top = top + 20;
|
|
}
|
|
var isdf = _store.getAt(i).get("MODULELEFT");
|
|
if ((_store.getAt(i).get("MODULELEFT") != "" && _store.getAt(i).get("MODULELEFT") != -1) || _store.getAt(i).get("MODULELEFT") >= "0") {
|
|
left = parseInt(_store.getAt(i).get("MODULELEFT"));
|
|
}
|
|
else {
|
|
left = left + 20;
|
|
}
|
|
if ((_store.getAt(i).get("MODULEWIDTH") != "" && parseInt(_store.getAt(i).get("MODULEWIDTH")) != -1) || _store.getAt(i).get("MODULEWIDTH") >= "0") {
|
|
width = parseInt(_store.getAt(i).get("MODULEWIDTH"));
|
|
}
|
|
else {
|
|
width = parseInt(_store.getAt(i).get("DEFAULTMODULEWIDTH"));
|
|
}
|
|
if ((_store.getAt(i).get("MODULEHEIGHT") != "" && parseInt(_store.getAt(i).get("MODULEHEIGHT")) != -1) || _store.getAt(i).get("MODULEHEIGHT") >= "0") {
|
|
height = parseInt(_store.getAt(i).get("MODULEHEIGHT"));
|
|
}
|
|
else {
|
|
height = parseInt(_store.getAt(i).get("DEFAULTMODULEHEIGHT"));
|
|
}
|
|
var module = _store.getAt(i).get("GID");
|
|
jsAddItemToSelect(document.getElementById("selView"), _store.getAt(i).get("MODULETITLE"), _store.getAt(i).get("GID"));
|
|
jsAddItemToSelect(document.getElementById("selViewMin"), _store.getAt(i).get("MODULETITLE"), _store.getAt(i).get("GID"));
|
|
fnInsertChkBoxItem(_store.getAt(i).get("MODULETITLE"), _store.getAt(i).get("GID"), _store.getAt(i).get("ISVISIABLE"));
|
|
var titlePersonal = "";
|
|
if (_store.getAt(i).get("ISVISIABLE")) {
|
|
if (_store.getAt(i).get("MODULETITLE") == "业务比例图表分析") titlePersonal = "(个人)";
|
|
else if (_store.getAt(i).get("MODULETITLE") == "业务走势对比图表分析") titlePersonal = "(个人)";
|
|
else titlePersonal = "";
|
|
|
|
new Dialog({ Module: _store.getAt(i).get("GID"), Width: width, Height: height, Info: _store.getAt(i).get("MODULETITLE")+titlePersonal, Left: left, Top: top, Content: "<iframe name='frame' id='fram" + _store.getAt(i).get("GID") + "' scrolling='auto' frameborder='0' width='" + (width - 20) + "' height='" + (height - 52) + "' src='../../" + _store.getAt(i).get("MODULEURL") + "?gid=" + _store.getAt(i).get("USERTEMPLETID") + "&mid=" + _store.getAt(i).get("ITEMID") + "'> </iframe>", Zindex: (++Dialog.Zindex) }); //++Dialog.Zindex
|
|
}
|
|
}
|
|
});
|
|
}
|
|
// 1.判断select选项中 是否存在Value="paraValue"的Item
|
|
function jsSelectIsExitItem(objSelect, objItemValue) {
|
|
var isExit = false;
|
|
for (var i = 0; i < objSelect.options.length; i++) {
|
|
if (objSelect.options[i].value == objItemValue) {
|
|
isExit = true;
|
|
break;
|
|
}
|
|
}
|
|
return isExit;
|
|
}
|
|
// 2.向select选项中 加入一个Item
|
|
function jsAddItemToSelect(objSelect, objItemText, objItemValue) {
|
|
//判断是否存在
|
|
if (!jsSelectIsExitItem(objSelect, objItemValue)) {
|
|
//alert("该Item的Value值已经存在");
|
|
//} else {
|
|
var varItem = new Option(objItemText, objItemValue);
|
|
objSelect.options.add(varItem);
|
|
//alert("成功加入");
|
|
}
|
|
}
|
|
// 3.从select选项中 删除一个Item
|
|
function jsRemoveItemFromSelect(objSelect, objItemValue) {
|
|
//判断是否存在
|
|
if (jsSelectIsExitItem(objSelect, objItemValue)) {
|
|
for (var i = 0; i < objSelect.options.length; i++) {
|
|
if (objSelect.options[i].value == objItemValue) {
|
|
objSelect.options.remove(i);
|
|
break;
|
|
}
|
|
}
|
|
//alert("成功删除");
|
|
} else {
|
|
//alert("该select中 不存在该项");
|
|
}
|
|
}
|
|
// 4.删除select中选中的项
|
|
function jsRemoveSelectedItemFromSelect(objSelect) {
|
|
var length = objSelect.options.length - 1;
|
|
for (var i = length; i >= 0; i--) {
|
|
if (objSelect[i].selected == true) {
|
|
objSelect.options[i] = null;
|
|
}
|
|
}
|
|
}
|
|
// 5.修改select选项中 value="paraValue"的text为"paraText"
|
|
function jsUpdateItemToSelect(objSelect, objItemText, objItemValue) {
|
|
//判断是否存在
|
|
if (jsSelectIsExitItem(objSelect, objItemValue)) {
|
|
for (var i = 0; i < objSelect.options.length; i++) {
|
|
if (objSelect.options[i].value == objItemValue) {
|
|
objSelect.options[i].text = objItemText;
|
|
break;
|
|
}
|
|
}
|
|
//alert("成功修改");
|
|
} else {
|
|
//alert("该select中 不存在该项");
|
|
}
|
|
}
|
|
// 6.设置select中text="paraText"的第一个Item为选中
|
|
function jsSelectItemByText(objSelect, objItemText) {
|
|
//判断是否存在
|
|
var isExit = false;
|
|
for (var i = 0; i < objSelect.options.length; i++) {
|
|
if (objSelect.options[i].text == objItemText) {
|
|
objSelect.options[i].selected = true;
|
|
isExit = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
// 7.设置select中value="paraText"的第一个Item为选中
|
|
function jsSelectItemByValue(objSelect, objItemValue) {
|
|
//判断是否存在
|
|
var isExit = false;
|
|
for (var i = 0; i < objSelect.options.length; i++) {
|
|
if (objSelect.options[i].value == objItemValue) {
|
|
objSelect.options[i].selected = true;
|
|
isExit = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// 添加桌面项目的checkbox
|
|
function fnInsertChkBoxItem(title, value, isvisiable) {
|
|
var liParent = document.createElement("li");
|
|
liParent.setAttribute("class", "desktopLI");
|
|
document.getElementById("desktopUL").appendChild(liParent);
|
|
|
|
var ulChild = document.createElement("ul");
|
|
ulChild.setAttribute("class", "desktopChildUL");
|
|
liParent.appendChild(ulChild);
|
|
|
|
var liCheckBox = document.createElement("li");
|
|
liCheckBox.setAttribute("class", "desktopChildCheckboxLI");
|
|
ulChild.appendChild(liCheckBox);
|
|
|
|
var checkBox = document.createElement("input");
|
|
checkBox.setAttribute("type", "checkbox");
|
|
checkBox.id = "chk" + value;
|
|
checkBox.setAttribute("class", "checkboxComponent");
|
|
checkBox.setAttribute("name", "chkDialog");
|
|
checkBox.onclick = function () {
|
|
var chk = document.getElementById(checkBox.id); //
|
|
var itemid = "";
|
|
document.getElementById("main").innerHTML = "";
|
|
Ext.Ajax.request({
|
|
async: false,
|
|
url: "/MvcShipping/MsHome/SetDialogVisible",
|
|
params: { id: value },
|
|
scope: this,
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
fnGetModuleChild();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
checkBox.checked=isvisiable;
|
|
liCheckBox.appendChild(checkBox);
|
|
|
|
var liTitle = document.createElement("li");
|
|
liTitle.setAttribute("class", "desktopChildComponent");
|
|
liTitle.innerText = title;
|
|
ulChild.appendChild(liTitle);
|
|
}
|
|
function fnGetModuleChild() {
|
|
var defaultWidth = 0;
|
|
var defaultHeight = 0;
|
|
var width = 0;
|
|
var height = 0;
|
|
var top = 0;
|
|
var left = 0;
|
|
var colourStyle = -1;
|
|
var _store = Ext.create('DsExt.ux.RefTableStore', {
|
|
fields: [
|
|
{ name: 'GID', type: 'string' },
|
|
{ name: 'ITEMID', type: 'string' },
|
|
{ name: 'MODULENAME', type: 'string' },
|
|
{ name: 'MODULETITLE', type: 'string' },
|
|
{ name: 'COLOURSTYLE', type: 'int' },
|
|
{ name: 'MODULEURL', type: 'string' },
|
|
{ name: 'USERTEMPLETID', type: 'string' },
|
|
{ name: 'DEFAULTMODULEWIDTH', type: 'int' },
|
|
{ name: 'DEFAULTMODULEHEIGHT', type: 'int' },
|
|
{ name: 'MODULEWIDTH', type: 'int' },
|
|
{ name: 'MODULEHEIGHT', type: 'int' },
|
|
{ name: 'MODULETOP', type: 'int' },
|
|
{ name: 'MODULELEFT', type: 'int' },
|
|
{ name: 'ISVISIABLE', type: 'bool' }
|
|
],
|
|
proxy: { url: '/MvcShipping/MsHome/GetModuleList' },
|
|
scope: this
|
|
});
|
|
_store.load();
|
|
|
|
_store.on("load", function (_store) {
|
|
for (var i = 0; i < _store.getCount(); i++) {
|
|
if ((_store.getAt(i).get("MODULETOP") != "" && _store.getAt(i).get("MODULETOP") != -1) || _store.getAt(i).get("MODULETOP") >= "0") {
|
|
top = parseInt(_store.getAt(i).get("MODULETOP"));
|
|
}
|
|
else {
|
|
top = top + 20;
|
|
}
|
|
if ((_store.getAt(i).get("MODULELEFT") != "" && _store.getAt(i).get("MODULELEFT") != -1) || _store.getAt(i).get("MODULELEFT") >= "0") {
|
|
left = parseInt(_store.getAt(i).get("MODULELEFT"));
|
|
}
|
|
else {
|
|
left = left + 20;
|
|
}
|
|
if ((_store.getAt(i).get("MODULEWIDTH") != "" && parseInt(_store.getAt(i).get("MODULEWIDTH")) != -1) || _store.getAt(i).get("MODULEWIDTH") >= "0") {
|
|
width = parseInt(_store.getAt(i).get("MODULEWIDTH"));
|
|
}
|
|
else {
|
|
width = parseInt(_store.getAt(i).get("DEFAULTMODULEWIDTH"));
|
|
}
|
|
if ((_store.getAt(i).get("MODULEHEIGHT") != "" && parseInt(_store.getAt(i).get("MODULEHEIGHT")) != -1) || _store.getAt(i).get("MODULEHEIGHT") >= "0") {
|
|
height = parseInt(_store.getAt(i).get("MODULEHEIGHT"));
|
|
}
|
|
else {
|
|
height = parseInt(_store.getAt(i).get("DEFAULTMODULEHEIGHT"));
|
|
}
|
|
var module = _store.getAt(i).get("GID");
|
|
|
|
if (_store.getAt(i).get("ISVISIABLE")) {
|
|
if (_store.getAt(i).get("MODULETITLE") == "业务比例图表分析") titlePersonal = "(个人)";
|
|
else if (_store.getAt(i).get("MODULETITLE") == "业务走势对比图表分析") titlePersonal = "(个人)";
|
|
else titlePersonal = "";
|
|
|
|
new Dialog({ Module: _store.getAt(i).get("GID"), Width: width, Height: height, Info: _store.getAt(i).get("MODULETITLE") + titlePersonal, Left: left, Top: top, Content: "<iframe name='frame' id='fram" + _store.getAt(i).get("GID") + "' scrolling='auto' frameborder='0' width='" + (width - 20) + "' height='" + (height - 52) + "' src='../../" + _store.getAt(i).get("MODULEURL") + "?gid=" + _store.getAt(i).get("USERTEMPLETID") + "&mid=" + _store.getAt(i).get("ITEMID") + "'> </iframe>", Zindex: (++Dialog.Zindex) }); //++Dialog.Zindex
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function fnShowMsg(msg) {
|
|
var _winWidth = document.documentElement.clientWidth;
|
|
var _winHeight = document.documentElement.clientHeight;
|
|
|
|
document.getElementById("alertMask").style.width = _winWidth + "px";
|
|
document.getElementById("alertMask").style.height = _winHeight + "px";
|
|
document.getElementById("alertBg").style.top = (_winHeight - 180) / 2 + "px";
|
|
document.getElementById("alertBg").style.left = (_winWidth - 420 - 26) / 2 + "px";
|
|
document.getElementById("alertContent").innerText = msg;
|
|
document.getElementById("alertMask").style.display = "block";
|
|
document.getElementById("alertBg").style.display = "block";
|
|
}
|
|
function fnHideMsg() {
|
|
document.getElementById("alertMask").style.display = "none";
|
|
document.getElementById("alertBg").style.display = "none";
|
|
}
|
|
function fnShowSetting() {
|
|
drag("cmdBoard");
|
|
if (isMix) {
|
|
document.getElementById("cmdBoardMin").style.display = "none";
|
|
}
|
|
document.getElementById("cmdBoard").style.display = "block";
|
|
fnSetting();
|
|
var iframe = document.getElementsByName("frame");
|
|
for (var iCount = 0; iCount < iframe.length; iCount++) {
|
|
document.getElementById(iframe[iCount].id).style.display = "none";
|
|
}
|
|
var chkBox = document.getElementsByName("chkDialog");
|
|
for (var iCount = 0; iCount < chkBox.length; iCount++) {
|
|
document.getElementById(chkBox[iCount].id).style.display = "none";
|
|
}
|
|
}
|
|
function fnHideSetting() {
|
|
document.getElementById("cmdBoard").style.display = "none";
|
|
var iframe = document.getElementsByName("frame");
|
|
for (var iCount = 0; iCount < iframe.length; iCount++) {
|
|
document.getElementById(iframe[iCount].id).style.width = "100%";
|
|
document.getElementById(iframe[iCount].id).style.height = "100%";
|
|
document.getElementById(iframe[iCount].id).style.display = "block";
|
|
}
|
|
var chkBox = document.getElementsByName("chkDialog");
|
|
for (var iCount = 0; iCount < chkBox.length; iCount++) {
|
|
document.getElementById(chkBox[iCount].id).style.display = "block";
|
|
}
|
|
}
|
|
function fnMixSetting() {
|
|
drag("cmdBoardMin");
|
|
isMix = true;
|
|
document.getElementById("cmdBoardMin").style.height = "180px";
|
|
document.getElementById("viewSettingContainMin").style.cssText = "border:none;";
|
|
document.getElementById("cmdBoardMin").style.border = "1px solid #99bce8";
|
|
document.getElementById("cmdBoard").style.display = "none";
|
|
document.getElementById("cmdBoardMin").style.display = "block";
|
|
}
|
|
function fnMaxSetting() {
|
|
drag("cmdBoard");
|
|
isMix = false;
|
|
document.getElementById("cmdBoardMin").style.display = "none";
|
|
document.getElementById("cmdBoard").style.display = "block";
|
|
}
|
|
function fnSetting() {
|
|
document.getElementById("txtLocationX").readOnly = false;
|
|
document.getElementById("txtLocationY").readOnly = false;
|
|
document.getElementById("txtSizeWidth").readOnly = false;
|
|
document.getElementById("txtSizeHeight").readOnly = false;
|
|
|
|
document.getElementById("hidAlowSetting").value = "1";
|
|
removeClass(document.getElementById("btnCloseSetting"),"winSettingHover");
|
|
addClass(document.getElementById("btnCloseSetting"), "winSettingNormal");
|
|
removeClass(document.getElementById("btnSetting"),"winSettingNormal");
|
|
addClass(document.getElementById("btnSetting"),"winSettingHover");
|
|
var iframe = document.getElementsByName("frame");
|
|
for (var iCount = 0; iCount < iframe.length; iCount++) {
|
|
document.getElementById(iframe[iCount].id).style.display = "none";
|
|
}
|
|
var chkBox = document.getElementsByName("chkDialog");
|
|
for (var iCount = 0; iCount < chkBox.length; iCount++) {
|
|
document.getElementById(chkBox[iCount].id).style.display = "none";
|
|
}
|
|
}
|
|
function fnCloseSetting() {
|
|
var _childDiv;
|
|
var _left = 0;
|
|
var _top = 0;
|
|
var _width = 0;
|
|
var _height = 0;
|
|
|
|
var main = document.getElementById("main");
|
|
|
|
document.getElementById("txtLocationX").readOnly = true;
|
|
document.getElementById("txtLocationY").readOnly = true;
|
|
document.getElementById("txtSizeWidth").readOnly = true;
|
|
document.getElementById("txtSizeHeight").readOnly = true;
|
|
|
|
document.getElementById("hidAlowSetting").value = "0";
|
|
removeClass(document.getElementById("btnSetting"),"winSettingHover");
|
|
addClass(document.getElementById("btnSetting"), "winSettingNormal");
|
|
removeClass(document.getElementById("btnCloseSetting"),"winSettingNormal");
|
|
addClass(document.getElementById("btnCloseSetting"), "winSettingHover");
|
|
|
|
for (var iCount = 0; iCount < main.children.length; iCount++) {
|
|
_width = document.getElementById(main.children[iCount].id).offsetWidth;
|
|
_height = document.getElementById(main.children[iCount].id).offsetHeight;
|
|
_top = document.getElementById(main.children[iCount].id).offsetTop;
|
|
_left = document.getElementById(main.children[iCount].id).offsetLeft;
|
|
Ext.Ajax.request({
|
|
async: false,
|
|
url: '/MvcShipping/MsHome/SetLocation',
|
|
params: { gid: main.children[iCount].id, x: _left, y: _top, width: _width, height: _height },
|
|
scope: this
|
|
});
|
|
}
|
|
var iframe = document.getElementsByName("frame");
|
|
for (var iCount = 0; iCount < iframe.length; iCount++) {
|
|
document.getElementById(iframe[iCount].id).style.width = "100%";
|
|
document.getElementById(iframe[iCount].id).style.height = "100%";
|
|
document.getElementById(iframe[iCount].id).style.display = "block";
|
|
}
|
|
var chkBox = document.getElementsByName("chkDialog");
|
|
for (var iCount = 0; iCount < chkBox.length; iCount++) {
|
|
document.getElementById(chkBox[iCount].id).style.display = "block";
|
|
}
|
|
}
|
|
function fnLocationXBlur(obj) {
|
|
document.getElementById(document.getElementById("selView").value).style.left = parseInt(obj.value) + "px";
|
|
}
|
|
function fnLocationXKeyDown(obj, event) {
|
|
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
|
|
|
|
if (keyCode == 13) {
|
|
document.getElementById(document.getElementById("selView").value).style.left = parseInt(obj.value) + "px";
|
|
}
|
|
}
|
|
function fnLocationYBlur(obj) {
|
|
document.getElementById(document.getElementById("selView").value).style.top = parseInt(obj.value) + "px";
|
|
}
|
|
function fnLocationYKeyDown(obj, event) {
|
|
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
|
|
|
|
if (keyCode == 13) {
|
|
document.getElementById(document.getElementById("selView").value).style.top = parseInt(obj.value) + "px";
|
|
}
|
|
}
|
|
function fnSizeWidthBlur(obj) {
|
|
document.getElementById(document.getElementById("selView").value).style.width = parseInt(obj.value) + "px";
|
|
document.getElementById("fram" + document.getElementById("selView").value).style.width = parseInt(obj.value) - 15 + "px";
|
|
}
|
|
function fnSizeWidthKeyDown(obj, event) {
|
|
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
|
|
|
|
if (keyCode == 13) {
|
|
document.getElementById(document.getElementById("selView").value).style.width = parseInt(obj.value) + "px";
|
|
document.getElementById("fram" + document.getElementById("selView").value).style.width = parseInt(obj.value) - 15 + "px";
|
|
}
|
|
}
|
|
function fnSizeHeightBlur(obj) {
|
|
document.getElementById(document.getElementById("selView").value).style.height = parseInt(obj.value) + "px";
|
|
document.getElementById("fram" + document.getElementById("selView").value).style.height = parseInt(obj.value) - 50 + "px";
|
|
}
|
|
function fnSizeHeightKeyDown(obj, event) {
|
|
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
|
|
|
|
if (keyCode == 13) {
|
|
document.getElementById(document.getElementById("selView").value).style.height = parseInt(obj.value) + "px";
|
|
document.getElementById("fram" + document.getElementById("selView").value).style.height = parseInt(obj.value) - 50 + "px";
|
|
}
|
|
}
|
|
function hasClass(obj, cls) {
|
|
return obj.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
|
|
}
|
|
function addClass(obj, cls) {
|
|
if (!this.hasClass(obj, cls)) obj.className += " " + cls;
|
|
}
|
|
function removeClass(obj, cls) {
|
|
if (hasClass(obj, cls)) {
|
|
var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
|
|
obj.className = obj.className.replace(reg, ' ');
|
|
}
|
|
} |