//var userid = "2a7cbdee-9391-cd8b-cd8d-7cc78e88e9bf";
//var username = "潘明";
//var oatoken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyYTdjYmRlZS05MzkxLWNkOGItY2Q4ZC03Y2M3OGU4OGU5YmYiLCJjbGllbnRpZCI6ImFuZHJvaWRjbGllbnQiLCJncmFudF90eXBlIjoicGFzc3dvcmQiLCJzY29wZSI6Im9wZW5pZCBwcm9maWxlIGVtYWlsIFJlZmluZUFQSSIsImV4cCI6MTY5MzcwMDg3MCwiY29uZmlnIjoiMjAyMC0yMDk5In0.y676CAVOX2P1EmwxXGN8QW7ihfZUsNXfxpNRVmCT-P0";
//var avatar = "http://10.233.22.205:8088/fs/avatar/show/2a7cbdee-9391-cd8b-cd8d-7cc78e88e9bf";
//var maintoken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI4YTY5OTY2NDg3NDllMzRiMDE4N2IwYzk1YmU2NzNiYyIsImFwcE5hbWUiOiLlubPlj7Dpl6jmiLflkI7lj7DnrqHnkIYiLCJhcHBDb2RlIjoiemh6ZnpscHQiLCJ0eXBlIjoiVVNFUl9QQVNTV09SRCIsInVzZXJOYW1lIjoi5r2Y5piOIiwidXNlcklkIjoiOGE2OTk2NjQ4NzQ5ZTM0YjAxODdiMGM5NWJlNjczYmMiLCJzZWNyZXRMZXZlbCI6MCwicmFuZG9tIjoiTEMwMmlBIiwibG9naW5OYW1lIjoicGFubWluZyIsImFwcElkIjoiOGE2OTk2NjQ4NmU0ODQ3ODAxODZlZDI4YWUxNTA0NzYiLCJEc3BUb2tlbiI6ImNhNDM4OGI3NTU5OTQ1NGNlYjU2NjM4OGVkNDU4M2ZhZDExZmY3MzY4ODhhNmMwMmNmZWI1YjdkYmM0ZDJkZWM4Mzk2ZWRkM2JhNmE5Yzk2IiwiZXhwIjoxNjkwMTA0Mzg4LCJpYXQiOjE2OTAxMDA3ODh9.As_kz7yCOVprvHtG0FwyipyVX2ojisToy59DVgRey9c"
////发布的时候,全部置为空
//var userid = "10876168-b21d-481e-9a02-1edb5af9853f";
//var username = "蔺雪峰";
//var oatoken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDg3NjE2OC1iMjFkLTQ4MWUtOWEwMi0xZWRiNWFmOTg1M2YiLCJjbGllbnRpZCI6ImFuZHJvaWRjbGllbnQiLCJncmFudF90eXBlIjoicGFzc3dvcmQiLCJzY29wZSI6Im9wZW5pZCBwcm9maWxlIGVtYWlsIFJlZmluZUFQSSIsImV4cCI6MTY5NDEzMjczMSwiY29uZmlnIjoiMjAyMC0yMDk5In0._CEHQyBKxN2ddn2iEAB-95JShVt5lqNCMxML_1sVJuM";
//var avatar = "http://10.233.22.205:8088/fs/avatar/show/2a7cbdee-9391-cd8b-cd8d-7cc78e88e9bf";
//var maintoken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI4YTY5OTY2NDg3NDllMzRiMDE4N2IwYzk1YmU2NzNiYyIsImFwcE5hbWUiOiLlubPlj7Dpl6jmiLflkI7lj7DnrqHnkIYiLCJhcHBDb2RlIjoiemh6ZnpscHQiLCJ0eXBlIjoiVVNFUl9QQVNTV09SRCIsInVzZXJOYW1lIjoi5r2Y5piOIiwidXNlcklkIjoiOGE2OTk2NjQ4NzQ5ZTM0YjAxODdiMGM5NWJlNjczYmMiLCJzZWNyZXRMZXZlbCI6MCwicmFuZG9tIjoiTEMwMmlBIiwibG9naW5OYW1lIjoicGFubWluZyIsImFwcElkIjoiOGE2OTk2NjQ4NmU0ODQ3ODAxODZlZDI4YWUxNTA0NzYiLCJEc3BUb2tlbiI6ImNhNDM4OGI3NTU5OTQ1NGNlYjU2NjM4OGVkNDU4M2ZhZDExZmY3MzY4ODhhNmMwMmNmZWI1YjdkYmM0ZDJkZWM4Mzk2ZWRkM2JhNmE5Yzk2IiwiZXhwIjoxNjkwMTA0Mzg4LCJpYXQiOjE2OTAxMDA3ODh9.As_kz7yCOVprvHtG0FwyipyVX2ojisToy59DVgRey9c"
//window.addEventListener("flutterInAppWebViewPlatformReady", function () {
// window.flutter_inappwebview
// .callHandler("getuserinfo", "")
// .then(function (res) {
// userid = res.username;
// username = res.name;
// oatoken = res.oatoken;
// avatar = res.avatar;
// //console.log(JSON.stringify(res));
// })
//});
//function jumpPageParent(id, title, src) {
// window.top.jumpPageParent_2(id, title, src);
//}
var app = angular.module('app', [
]);
var postCfg = {};
app.controller("appCtrl", ["$http", "$compile", "$scope", "$timeout", function ($http, $compile, $scope, $timeout) {
var self = this;
var s4 = new SM4Util();
//$timeout(function () {
// //alert(9999);
// //console.log(userid);
// self.userId = userid;
// self.userCName = username;
// self.get_AccessToken = oatoken;
// self.outToken = maintoken;
// postCfg = {
// headers: {
// 'Content-Type': 'application/json',
// 'Authorization': "Bearer " + self.get_AccessToken
// }
// };
// $.cookie("GlWorkPlatform-userid", userid, { path: '/', expires: 1 });
// $.cookie("GlWorkPlatform-chineseName", username, { path: '/', expires: 1 });
// localStorage.setItem("GlWorkPlatform-AccessToken", oatoken);
// localStorage.setItem("main-token", maintoken);
//}, 500);
$timeout(function () {
self.getReloadUserData();
self.get_allMenu_init();
},600);
self.userId = $.cookie("GlWorkPlatform-userid");
self.userCName = $.cookie("GlWorkPlatform-chineseName");
self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
self.outToken = localStorage.getItem("main-token");
postCfg = {
headers: {
'Content-Type': 'application/json',
'Authorization': "Bearer " + self.get_AccessToken
}
};
var base64 = new Base64(); //声明base解码和编码类
self.CrossPage = window.parent.CrossPage;
self.loading = true;
//////设置背景图片*************************************************************--zyg--20230424
self.getReloadUserData = function () {
var postData = {};
//console.log(postData);
//console.log(postData); s4.encryptData_CBC(JSON.stringify(postData))
$http.post(apiurljs.login + "api/User/UserInfo", JSON.stringify(postData), postCfg)
.success(function (obj) {
var res1 = strToJson(s4.decryptData_CBC(obj.data));
self.get_userInfoJsonStr = res1.data;
////加载背景图片*******************************************************************************************
if (apiurljs.login.indexOf("http://139.129.27.3:85") != -1) {
self.set_imgurl = "http://139.129.27.3:8511/web/UploadAttach";
} else {
self.set_imgurl = apiurljs.login.split("glwork")[0] + "glworkweb/UploadAttach";
}
$("body").css("background-image", "url(" + self.set_imgurl + self.get_userInfoJsonStr.bkimageurl + ")");
})
.error(function (XMLHttpRequest, textStatus, errorThrown) {
if (textStatus != 200) {
//self.loading = false;
}
})
}
//////设置背景图片*************************************************************--zyg--20230424
////监听框架页面发送的打开桌面设置的时机---zyg---20230426
//window.addEventListener('message', function (event) {
// //通过origin属性判断消息来源地址
// if (event.data.name == "openLayerSetting") {
// //jzsetLat(event.data.arg);
// var getJson = event.data.arg;
// self.btnSeting();
// }
//}, false);
self.colorArray = [
"#d2f4e0", "#fcdce1", "#d5e7f5", "#feedcf", "#e0f2f2", "#eae9f7", "#e5f6ff", "#fff0f0", "#f8f7c7", "#ffe4d4", "#e6fafc", "#e6fafc", "#edfad5", "#dbffd8", "#e9f4f9", "#e8e2d9", "#ffdbf1", "#f8eec7", "#d8f7f5", "#e6e2e2",
"#d2f4e0", "#fcdce1", "#d5e7f5", "#feedcf", "#e0f2f2", "#eae9f7", "#e5f6ff", "#fff0f0", "#f8f7c7", "#ffe4d4", "#e6fafc", "#e6fafc", "#edfad5", "#dbffd8", "#e9f4f9", "#e8e2d9", "#ffdbf1", "#f8eec7", "#d8f7f5", "#e6e2e2",
"#d2f4e0", "#fcdce1", "#d5e7f5", "#feedcf", "#e0f2f2", "#eae9f7", "#e5f6ff", "#fff0f0", "#f8f7c7", "#ffe4d4", "#e6fafc", "#e6fafc", "#edfad5", "#dbffd8", "#e9f4f9", "#e8e2d9", "#ffdbf1", "#f8eec7", "#d8f7f5", "#e6e2e2",
"#d2f4e0", "#fcdce1", "#d5e7f5", "#feedcf", "#e0f2f2", "#eae9f7", "#e5f6ff", "#fff0f0", "#f8f7c7", "#ffe4d4", "#e6fafc", "#e6fafc", "#edfad5", "#dbffd8", "#e9f4f9", "#e8e2d9", "#ffdbf1", "#f8eec7", "#d8f7f5", "#e6e2e2",
"#d2f4e0", "#fcdce1", "#d5e7f5", "#feedcf", "#e0f2f2", "#eae9f7", "#e5f6ff", "#fff0f0", "#f8f7c7", "#ffe4d4", "#e6fafc", "#e6fafc", "#edfad5", "#dbffd8", "#e9f4f9", "#e8e2d9", "#ffdbf1", "#f8eec7", "#d8f7f5", "#e6e2e2"
]
////打开设置弹出层
//self.btnSeting = function () {
// ////////初始化----拼接 自定义桌面-设置弹出层--左侧的初始化---zyg---start--20230505
// self.init_layerLeftSortArea(self.querySetArray);
// ////////初始化----拼接 自定义桌面-设置弹出层--左侧的初始化---zyg---end--20230505
// self.get_allMenu();///右侧应用功能重新加载
// self.getPluginData();///右侧插件,重新加载
// sp.layer("#layer_setting", 1);
//};
/////左侧--清空 设置层
self.leftBtnClear = function () {
$("#layerLeftSortArea").html("");
///右侧菜单,全部显示--start
$("#layerRight_ApplayParts").html("");
var set_rhtModule_all = "";
angular.forEach(self.allMenu, function (item4, index4) {
item4.hasUse = false;
var set_rhtModule = '
' +
//'
'+
'
' +
'
' + item4.CNAME + '
' +
'
' +
'
'
//console.log(set_rhtModule);
set_rhtModule_all += set_rhtModule;
});
//console.log(set_rhtModule_all);
var append_rgh = '' + set_rhtModule_all + '
';
$("#layerRight_ApplayParts").append($compile(append_rgh)($scope));
///右侧菜单,全部显示--end
///右侧插件,全部显示--start
$("#layerRight_PlginParts").html("");
var set_rhtModule_all = "";
angular.forEach(self.pluginArray, function (item4, index4) {
item4.hasUse = false;
var set_rhtModule = '' +
'
' +
'
' + item4.CNAME + '
' +
'
' + item4.CTYPEMODEL_NAME + '
' +
'
' +
'
';
//console.log(set_rhtModule);
set_rhtModule_all += set_rhtModule;
});
var append_rgh = '' + set_rhtModule_all + '
';
$("#layerRight_PlginParts").append($compile(append_rgh)($scope));
///右侧插件,全部显示--end
};
/////左侧添加行列按钮
self.leftBtnAddCol = function (num) {
if (num == 1) {
var appendHtml = '' +
'
应用组
' +
'
' +
'
' +
'
删除
' +
'
';
$("#layerLeftSortArea").append($compile(appendHtml)($scope));
} else if (num == 2) {
var appendHtml = '' +
'
应用组
' +
'
' +
'
' +
'
删除
' +
'
' +
'
' +
'
应用组
' +
'
' +
'
' +
'
删除
' +
'
';
$("#layerLeftSortArea").append($compile(appendHtml)($scope));
} else if (num == 4) {
var appendHtml = '' +
'
应用组
' +
'
' +
'
' +
'
删除
' +
'
' +
'
' +
'
应用组
' +
'
' +
'
' +
'
删除
' +
'
' +
'
' +
'
应用组
' +
'
' +
'
' +
'
删除
' +
'
' +
'
' +
'
应用组
' +
'
' +
'
' +
'
删除
' +
'
';
$("#layerLeftSortArea").append($compile(appendHtml)($scope));
} else { return; }
};
////删除区域---zyg--20230506
self.btnDeleteCol = function () {
//console.log(event.target);
//console.log($(event.target).parent().parent().find(".layer-col-part").length);
//console.log($(event.target).parent().find(".module-box").find(".main-module").length);
if (confirm("您确定要删除当前区域吗?")) {
var get_layerColPart_length = $(event.target).parent().parent().find(".layer-col-part").length;
$(event.target).parent().find(".module-box").find(".main-module").each(function () {
var get_modeuletype = $(this).attr("data-modeuletype");
if (get_modeuletype == "0") {
var get_pkid = $(this).attr("data-pkid");
//console.log(get_pkid);
self.allMenu.forEach(function (item) {
if (item.PKID == get_pkid) {
item.hasUse = false;
}
});
} else {
var get_pgcode = $(this).attr("data-pgcode");
self.pluginArray.forEach(function (item) {
if (item.PGCODE == get_pgcode) {
item.hasUse = false;
}
});
}
});
if (get_layerColPart_length == 1) {
$(event.target).parent().parent().remove();
} else {
$(event.target).parent().remove();
}
///右侧菜单,重新显示--start
$("#layerRight_ApplayParts").html("");
var set_rhtModule_all = "";
angular.forEach(self.allMenu, function (item4, index4) {
if (!item4.hasUse) {
var set_rhtModule = '' +
//'
'+
'
' +
'
' + item4.CNAME + '
' +
'
' +
'
'
//console.log(set_rhtModule);
set_rhtModule_all += set_rhtModule;
}
});
//console.log(set_rhtModule_all);
var append_rgh = '' + set_rhtModule_all + '
';
$("#layerRight_ApplayParts").append($compile(append_rgh)($scope));
///右侧菜单,全部显示--end
///右侧插件,重新显示--start
$("#layerRight_PlginParts").html("");
var set_rhtModule_all = "";
angular.forEach(self.pluginArray, function (item4, index4) {
if (!item4.hasUse) {
var set_rhtModule = '' +
'
' +
'
' + item4.CNAME + '
' +
'
' + item4.CTYPEMODEL_NAME + '
' +
'
' +
'
';
//console.log(set_rhtModule);
set_rhtModule_all += set_rhtModule;
}
});
var append_rgh = '' + set_rhtModule_all + '
';
$("#layerRight_PlginParts").append($compile(append_rgh)($scope));
///右侧插件,重新显示--end
//console.log($(obj).parent().attr("data-col"));
}
};
///删除单个元素
self.btnDelSingle = function () {
if (confirm("您确定要删除吗?")) {
var parentElem = $(event.target).parent().parent();
//console.log($(event.target));
//console.log(parentElem);
var get_modeuletype = parentElem.attr("data-modeuletype");
//console.log(get_modeuletype);
if (get_modeuletype == "0") {
var get_pkid = parentElem.attr("data-pkid");
//console.log(get_pkid);
self.allMenu.forEach(function (item) {
if (item.PKID == get_pkid) {
item.hasUse = false;
}
});
parentElem.remove();
///右侧菜单,重新显示--start
$("#layerRight_ApplayParts").html("");
var set_rhtModule_all = "";
angular.forEach(self.allMenu, function (item4, index4) {
if (!item4.hasUse) {
var set_rhtModule = '' +
//'
'+
'
' +
'
' + item4.CNAME + '
' +
'
' +
'
'
//console.log(set_rhtModule);
set_rhtModule_all += set_rhtModule;
}
});
//console.log(set_rhtModule_all);
var append_rgh = '' + set_rhtModule_all + '
';
$("#layerRight_ApplayParts").append($compile(append_rgh)($scope));
///右侧菜单,全部显示--end
} else {
var get_pgcode = parentElem.attr("data-pgcode");
self.pluginArray.forEach(function (item) {
if (item.PGCODE == get_pgcode) {
item.hasUse = false;
}
});
parentElem.remove();
///右侧插件,重新显示--start
$("#layerRight_PlginParts").html("");
var set_rhtModule_all = "";
angular.forEach(self.pluginArray, function (item4, index4) {
if (!item4.hasUse) {
var set_rhtModule = '' +
'
' +
'
' + item4.CNAME + '
' +
'
' + item4.CTYPEMODEL_NAME + '
' +
'
' +
'
';
//console.log(set_rhtModule);
set_rhtModule_all += set_rhtModule;
}
});
var append_rgh = '' + set_rhtModule_all + '
';
$("#layerRight_PlginParts").append($compile(append_rgh)($scope));
///右侧插件,重新显示--end
}
}
};
////右侧--选项卡切换
self.rightActiveTab = 0;
self.rightBtnClick = function (num) {
self.rightActiveTab = num;
};
// 将所有菜单的最后一代obj提取出来
function extractObj(arr, toArr) {
$.each(arr, function (index, item) {
if (typeof item.C_H_I_L_D == "undefined" || item.C_H_I_L_D.length < 1) {
toArr.push(item);
return toArr;
} else {
return extractObj(item.C_H_I_L_D, toArr);
}
});
}
//原始数据
self.rows = []; //declare an empty array
// 所有菜单
self.allMenu = [];
self.get_allMenu = function () {
self.allMenu = [];
var data = {
userid: self.userId
};
$http.post(apiurljs.login + "UserPower/Permissions", { data: s4.encryptData_CBC("") }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
//console.log(JSON.stringify(res));
if (sp.isval(res.data.rows)) {
self.noDataTip = 1;
self.rows = res.data.rows;
// 所有菜单保存到 self.allMenu 中
extractObj(res.data.rows, self.allMenu);
angular.forEach(self.allMenu, function (item4, index4) {
item4.hasUse = false;
});
//console.log(JSON.stringify(self.allMenu));
///将已选中的应用功能过滤掉
if (sp.isval(self.querySetArray)) {
var set_hasUseArray = [];
angular.forEach(self.querySetArray, function (item) {
angular.forEach(item.row, function (item2) {
angular.forEach(item2.data, function (item3) {
if (item3.moduleType == "0") {
set_hasUseArray.push(item3);
}
});
});
});
angular.forEach(self.allMenu, function (item4, index4) {
angular.forEach(set_hasUseArray, function (item2, index2) {
if (item4.PKID == item2.PKID) {
//$("#layerRight_ApplayParts")
item4.hasUse = true;
}
});
});
}
$("#layerRight_ApplayParts").html("");
var set_rhtModule_all = "";
angular.forEach(self.allMenu, function (item4, index4) {
if (!item4.hasUse) {
var set_rhtModule = '' +
//'
'+
'
' +
'
' + item4.CNAME + '
' +
'
' +
'
'
//console.log(set_rhtModule);
set_rhtModule_all += set_rhtModule;
}
});
//console.log(set_rhtModule_all);
var append_rgh = '' + set_rhtModule_all + '
';
$("#layerRight_ApplayParts").append($compile(append_rgh)($scope));
//console.log(JSON.stringify(self.allMenu))
} else {
self.noDataTip = 0;
}
})
};
////第一次进入页面,初始化数据时,获取菜单数据
self.get_allMenu_init = function () {
//alert("第一次进入页面,初始化数据时,获取菜单数据");
self.rows = [];
self.allMenu = [];
var data = {
userid: self.userId
};
$http.post(apiurljs.login + "UserPower/Permissions", { data: s4.encryptData_CBC("") }, postCfg)
.success(function (obj) {
var res = strToJson(s4.decryptData_CBC(obj.data));
//console.log(JSON.stringify(res));
if (sp.isval(res.data.rows)) {
self.noDataTip = 1;
self.rows = res.data.rows;
// 所有菜单保存到 self.allMenu 中
extractObj(res.data.rows, self.allMenu);
angular.forEach(self.allMenu, function (item4, index4) {
item4.hasUse = false;
});
//console.log(JSON.stringify(self.allMenu));
self.querySettingByUserid();////检索自定义桌面配置数据
} else {
self.noDataTip = 0;
}
})
}
////检索保存的设置--zyg--20230426---检索自定义桌面配置数据
self.querySetArray = [];
self.querySetArray_lengthArray = [];
self.querySettingByUserid = function () {
self.querySetArray = [];
self.querySetArray_lengthArray = [];
self.loading = true;
var postData = {
"userid": self.userId
}
$http.post(apiurljs.login + "g2work/desktop/queryDataUserDefaultData", JSON.stringify(postData), postCfg)
.success(function (obj) {
//var res = strToJson(s4.decryptData_CBC(obj.data));
var res = obj;
//console.log(JSON.stringify(res));
if (res.success) {
if (sp.isval(res.data)) {
self.querySetArray = strToJson(s4.decryptData_CBC(res.data));
//console.log(JSON.stringify(self.querySetArray));
for (var i = 0; i < self.querySetArray.length; i++) {
self.querySetArray_lengthArray.push(i);
}
//console.log(JSON.stringify(self.querySetArray));
//console.log(self.querySetArray.length);
var set_hasUseArray = [];///声明已有菜单数组
angular.forEach(self.querySetArray, function (item) {
angular.forEach(item.row, function (item2) {
angular.forEach(item2.data, function (item3) {
//item3.CONTENT_TOTAL = 0;
if (item3.moduleType == "1") {
///插件类型,重新赋值缩略图base64
var postData_2 = {
"id": item3.ID
}
$http.post(apiurljs.login + "g2app/plugin/queryData", JSON.stringify(postData_2), postCfg)
.success(function (obj2) {
//console.log(item3.ID);
//console.log(JSON.stringify(obj2.data));
//console.log(obj2.data.CTYPEMODEL);
item3.CTYPEMODEL = obj2.data.CTYPEMODEL;
item3.IMAGESMALL = obj2.data.IMAGESMALL;
//console.log(obj2.data.IMAGESMALL);
item3.URL = obj2.data.URL;
if (item3.URL.indexOf("tpl/") != -1 || item3.URL.indexOf("tpk/") != -1) {
item3.URL_set = "../../" + item3.URL;
} else {
item3.URL_set = item3.URL + "?token=" + self.outToken;
}
if (item3.CTYPEMODEL == "C01") {
item3.CTYPEMODEL_NAME = "满宽适应";
} else if (item3.CTYPEMODEL == "C02") {
item3.CTYPEMODEL_NAME = "二分之一";
} else {
item3.CTYPEMODEL_NAME = "四分之一";
}
if (sp.isval(item3.IMAGESMALL) && item3.IMAGESMALL != "XXXXX") {
item3.IMAGESMALL_set = item3.IMAGESMALL;
} else {
item3.IMAGESMALL_set = "image/upimg.jpg";
}
$timeout(function () {
///设置iframe高度
self.setIframeHgt("iframe_" + item3.PGCODE);
}, 1000);
});
} else {
////已有菜单,重新赋值文件路径、图标
angular.forEach(self.allMenu, function (item4, index4) {
if (item3.PKID == item4.PKID) {
item3.CNAME = item4.CNAME;
item3.FILEN = item4.FILEN;
item3.SRCIMG = item4.SRCIMG;
item3.SRCIMG32 = item4.SRCIMG32;
}
});
set_hasUseArray.push(item3);
}
});
});
});
angular.forEach(self.allMenu, function (item4, index4) {
angular.forEach(set_hasUseArray, function (item2, index2) {
if (item4.PKID == item2.PKID) {
//$("#layerRight_ApplayParts")
item4.hasUse = true;
}
});
});
$("#layerRight_ApplayParts").html("");
var set_rhtModule_all = "";
angular.forEach(self.allMenu, function (item4, index4) {
if (!item4.hasUse) {
var set_rhtModule = '' +
//'
'+
'
' +
'
' + item4.CNAME + '
' +
'
' +
'
'
//console.log(set_rhtModule);
set_rhtModule_all += set_rhtModule;
}
});
//console.log(set_rhtModule_all);
var append_rgh = '' + set_rhtModule_all + '
';
$("#layerRight_ApplayParts").append($compile(append_rgh)($scope));
$timeout(function () {
self.loading = false;
}, 1000);
self.getPluginData();///加载插件列表
} else {
self.querySetArray = [];
self.loading = false;
self.getPluginData();///加载插件列表
}
} else {
self.querySetArray = [];
self.loading = false;
sp.dialog(res.message);
self.getPluginData();///加载插件列表
}
});
};
////设置iframe自适应子页面高度
self.setIframeHgt = function (idstr) {
//console.log(idstr);
var Iframe = document.getElementById(idstr);
try {
// 声明变量取值
var bHeight = Iframe.contentWindow.document.body.scrollHeight;
var dHeight = Iframe.contentWindow.document.documentElement.scrollHeight;
//if (idstr == "iframe_PGCOMP20") {
// console.log(bHeight);
// console.log(dHeight);
//}
var height = Math.max(bHeight, dHeight); // 取最大值
Iframe.height = height;
} catch (ex) { }
$timeout(function () {
self.setIframeHgt(idstr);
}, 1000);
};
////////初始化----拼接 自定义桌面-设置弹出层--左侧的初始化---zyg---start--20230505
self.init_layerLeftSortArea = function (arrayData) {
$("#layerLeftSortArea").html("");
var set_row_all = "";
angular.forEach(arrayData, function (item1, index1) {
var set_layerColPart_all = "";
angular.forEach(item1.row, function (item2, index2) {
var set_mainModule_all = "";
angular.forEach(item2.data, function (item3, index3) {
if (item3.moduleType == 0) {
var set_bgcolror = self.colorArray[index3];
var set_mainModule = '' +
//'
'+
'
' +
'
' + item3.CNAME + '
' +
'
' +
'
';
set_mainModule_all += set_mainModule;
//console.log(set_mainModule);
} else {
if (item3.URL.indexOf("tpl/") != -1 || item3.URL.indexOf("tpk/") != -1) {
item3.URL_set = "../../" + item3.URL;
} else {
item3.URL_set = item3.URL + "?token=" + self.outToken;
}
if (item3.CTYPEMODEL == "C01") {
item3.CTYPEMODEL_NAME = "满宽适应";
} else if (item3.CTYPEMODEL == "C02") {
item3.CTYPEMODEL_NAME = "二分之一";
} else {
item3.CTYPEMODEL_NAME = "四分之一";
}
if (sp.isval(item3.IMAGESMALL) && item3.IMAGESMALL != "XXXXX") {
item3.IMAGESMALL_set = item3.IMAGESMALL;
} else {
item3.IMAGESMALL_set = "image/upimg.jpg";
}
//console.log(item3.IMAGESMALL_set);
var set_mainModule = '' +
'
' +
'
' + item3.CNAME + '
' +
'
' + item3.CTYPEMODEL_NAME + '
' +
'
' +
'
';
set_mainModule_all += set_mainModule;
}
});
var set_class = item2.colClass;
var set_layerColPart = '' +
'
' + item2.colName + '
' +
'
' +
'' + set_mainModule_all + '' +
'
' +
'
删除
' +
'
';
//console.log(set_layerColPart);
set_layerColPart_all += set_layerColPart;
});
var set_row = '' + set_layerColPart_all + '
';
//console.log(set_row);
set_row_all += set_row;
});
$("#layerLeftSortArea").append($compile(set_row_all)($scope));
}
////////初始化----拼接 自定义桌面-设置弹出层--左侧的初始化---zyg---end--20230505
////加载插件列表*****************************************************************************************
self.pluginArray_all = [];///全部
self.pluginArray = [];///经过过滤
self.getPluginData = function () {
self.pluginArray_all = [];///全部
self.pluginArray = [];///经过过滤
var postData = {
"dtype": "",
"kinds": "",
"imagemark": false
};
///为了演示
$http.post(apiurljs.login + "g2app/plugin/queryDataListWithCtypemodel", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
.success(function (obj) {
//var res = strToJson(s4.decryptData_CBC(obj.data));
var res = obj.data;
if (sp.isval(res)) {
if (sp.isval(res["满宽适应"])) {
angular.forEach(res["满宽适应"], function (item) {
item.CTYPEMODEL_NAME = "满宽适应";
self.pluginArray.push(item);
});
}
if (sp.isval(res["二分之一"])) {
angular.forEach(res["二分之一"], function (item) {
item.CTYPEMODEL_NAME = "二分之一";
self.pluginArray.push(item);
});
}
if (sp.isval(res["四分之一"])) {
angular.forEach(res["四分之一"], function (item) {
item.CTYPEMODEL_NAME = "四分之一";
self.pluginArray.push(item);
});
}
angular.forEach(self.pluginArray, function (item, index) {
item.indexnum = index;
item.hasUse = false;
if (sp.isval(item.IMAGESMALL) && item.IMAGESMALL != "XXXXX") {
item.IMAGESMALL_set = item.IMAGESMALL;
} else {
item.IMAGESMALL_set = "image/upimg.jpg";
}
});
self.pluginArray_all = self.pluginArray;///全部
///将已选中的插件过滤掉
if (sp.isval(self.querySetArray)) {
var set_hasUseArray = [];
angular.forEach(self.querySetArray, function (item) {
angular.forEach(item.row, function (item2) {
angular.forEach(item2.data, function (item3) {
if (item3.moduleType == "1") {
set_hasUseArray.push(item3);
}
});
});
});
angular.forEach(self.pluginArray, function (item4, index4) {
angular.forEach(set_hasUseArray, function (item2, index2) {
if (item4.PGCODE == item2.PGCODE) {
//$("#layerRight_ApplayParts")
item4.hasUse = true;
}
});
});
}
//console.log(JSON.stringify(self.pluginArray));
$("#layerRight_PlginParts").html("");
var set_rhtModule_all = "";
angular.forEach(self.pluginArray, function (item4, index4) {
if (!item4.hasUse) {
var set_rhtModule = '' +
'
' +
'
' + item4.CNAME + '
' +
'
' + item4.CTYPEMODEL_NAME + '
' +
'
' +
'
';
//console.log(set_rhtModule);
set_rhtModule_all += set_rhtModule;
}
});
var append_rgh = '' + set_rhtModule_all + '
';
$("#layerRight_PlginParts").append($compile(append_rgh)($scope));
//$scope.$apply(self.pluginArray);
} else {
self.pluginArray = [];
}
});
};
////保存设置---
self.btnSaveSetting_title = "保 存";
self.btnSaveSetting = function () {
if ($("#layerLeftSortArea").find(".row").length > 0) {
self.btnSaveSetting_title = "请稍等,正在保存中..";
var row_array = [];
$("#layerLeftSortArea").find(".row").each(function () {
var total_json = [];
$(this).find(".layer-col-part").each(function () {
var colClass = $(this).attr("data-col");
var colName = $(this).find(".main-title").text();
var set_data_json = [];
$(this).find(".main-module").each(function () {
var get_modeuletype = $(this).attr("data-modeuletype");
//console.log(get_modeuletype);
if (get_modeuletype == "0") {
var get_pkid = $(this).attr("data-pkid");
angular.forEach(self.allMenu, function (item2) {
if (item2.PKID == get_pkid) {
var boxjson = {
"moduleType": get_modeuletype,
"PKID": get_pkid,
"CNAME": item2.CNAME,
"FILEN": item2.FILEN,
"SRCIMG": item2.SRCIMG,
"SRCIMG32": item2.SRCIMG32
}
set_data_json.push(boxjson);
}
})
} else {
var get_pgcode = $(this).attr("data-pgcode");
angular.forEach(self.pluginArray_all, function (item2) {
//console.log(item2.PGCODE);
if (item2.PGCODE == get_pgcode) {
var boxjson = {
"ID": item2.ID,
"moduleType": get_modeuletype,
"CTYPEMODEL": item2.CTYPEMODEL,
"CNAME": item2.CNAME,
"IMAGESMALL": "",
"URL": item2.URL,
"PGCODE": item2.PGCODE
}
set_data_json.push(boxjson);
}
})
}
})
//console.log(JSON.stringify(set_data_json));
var set_part_json = {
"colClass": colClass,
"colName": colName,
"data": set_data_json
}
total_json.push(set_part_json);
});
var set_total_json = {
"row": total_json
}
row_array.push(set_total_json);
});
//console.log(JSON.stringify(row_array));
$timeout(function () {
var postData = {
"userid": self.userId,
"data": s4.encryptData_CBC(JSON.stringify(row_array))
}
///console.log(JSON.stringify(postData));
$http.post(apiurljs.login + "g2work/desktop/saveDataUserDefaultData", JSON.stringify(postData), postCfg)
.success(function (obj) {
//var res = strToJson(s4.decryptData_CBC(obj.data));
///{"message":"数据检索成功。","code":0,"data":1,"success":true}
//console.log(JSON.stringify(obj));
var res = obj;
if (res.success) {
self.querySettingByUserid();
sp.closeCenter("#layer_setting");
} else {
alert(res.message);
}
self.btnSaveSetting_title = "保 存";
});
}, 100);
} else {
alert("您好,布局不能为空!");
}
};
////关闭设置
self.btnCloseSetting = function () {
self.btnSaveSetting_title = "保 存";
sp.closeCenter("#layer_setting");
};
////
self.btnClickPkModule = function (itemdata) {
//console.log(itemdata.FILEN);
if (itemdata.FILEN == "") {
sp.dialog("功能开发中!");
return
}
//window.location.href = "../../"+itemdata.FILEN;
window.parent.jumpPageParent(itemdata.PKID, itemdata.CNAME, itemdata.FILEN);
};
////恢复缺省设置
self.leftBtnRestoreInit = function () {
if (confirm("您确定要恢复缺省设置吗?")) {
var postData = {
"userid": self.userId
}
$http.post(apiurljs.login + "g2work/desktop/createDataUserDefaultData", JSON.stringify(postData), postCfg)
.success(function (obj) {
var res = obj;
//console.log(JSON.stringify(obj))
if (res.success) {
var defaultData = strToJson(s4.decryptData_CBC(res.data));
//console.log(JSON.stringify(defaultData));
///////
var set_hasUseArray = [];
angular.forEach(defaultData, function (item) {
angular.forEach(item.row, function (item2) {
angular.forEach(item2.data, function (item3) {
set_hasUseArray.push(item3);
if (item3.moduleType == "1") {
var postData_2 = {
"id": item3.ID
}
$http.post(apiurljs.login + "g2app/plugin/queryData", JSON.stringify(postData_2), postCfg)
.success(function (obj2) {
item3.IMAGESMALL = obj2.data.IMAGESMALL;
if (sp.isval(item3.IMAGESMALL) && item3.IMAGESMALL != "XXXXX") {
item3.IMAGESMALL_set = item3.IMAGESMALL;
} else {
item3.IMAGESMALL_set = "image/upimg.jpg";
}
});
}
});
});
});
$timeout(function () {
////////初始化----拼接 自定义桌面-设置弹出层--左侧的初始化---zyg---start--20230505
self.init_layerLeftSortArea(defaultData);
}, 1000);
///右侧--应用功能---start
angular.forEach(self.allMenu, function (item4, index4) {
item4.hasUse = false;
angular.forEach(set_hasUseArray, function (item2, index2) {
if (item4.PKID == item2.PKID) {
//$("#layerRight_ApplayParts")
item4.hasUse = true;
}
});
});
$("#layerRight_ApplayParts").html("");
var set_rhtModule_all = "";
angular.forEach(self.allMenu, function (item4, index4) {
if (!item4.hasUse) {
var set_rhtModule = '' +
//'
'+
'
' +
'
' + item4.CNAME + '
' +
'
' +
'
'
//console.log(set_rhtModule);
set_rhtModule_all += set_rhtModule;
}
});
//console.log(set_rhtModule_all);
var append_rgh = '' + set_rhtModule_all + '
';
$("#layerRight_ApplayParts").append($compile(append_rgh)($scope));
///右侧--应用功能---end
///右侧--插件--start--zyg
angular.forEach(self.pluginArray, function (item4, index4) {
item4.hasUse = false;
angular.forEach(set_hasUseArray, function (item2, index2) {
if (item4.PGCODE == item2.PGCODE) {
//$("#layerRight_ApplayParts")
item4.hasUse = true;
}
});
});
$("#layerRight_PlginParts").html("");
var set_rhtModule_all = "";
angular.forEach(self.pluginArray, function (item4, index4) {
if (!item4.hasUse) {
var set_rhtModule = '' +
'
' +
'
' + item4.CNAME + '
' +
'
' + item4.CTYPEMODEL_NAME + '
' +
'
' +
'
';
//console.log(set_rhtModule);
set_rhtModule_all += set_rhtModule;
}
});
var append_rgh = '' + set_rhtModule_all + '
';
$("#layerRight_PlginParts").append($compile(append_rgh)($scope));
///右侧--插件--end--zyg
}
});
}
}
}]);
///拖拽范围
app.directive('ngSort', function () {
return {
link: function (scope, element, attrs) {
$(element).sortable({
containment: ".sp-layer2-body", //约束排序动作只能在一个指定的范围内发生。
connectWith: ".module-box",////允许sortable对象连接另一个sortable对象,可将item元素拖拽到另一个中
cursor: "move",
placeholder: 'ui-sort-placeholder',
beforeStop: function (event, ui) {
//console.log(ui);
//console.log(ui.item);
///这是当前拖放子元素
var get_ui_modeuletype = ui.item.context.dataset.modeuletype;
///这是当前拖放子元素
var get_ui_item_parent = $(ui.item).parent();
var get_classCol = get_ui_item_parent.parent().attr("data-col");
//console.log(get_classCol);
if (get_ui_modeuletype == 0) {
///判断应用功能属性
var set_siblingModuleType = -1;
get_ui_item_parent.find(".main-module").each(function () {
if ($(this).attr('data-modeuletype') == 1) {
set_siblingModuleType = 1;
}
});
if (set_siblingModuleType == 1) {
alert("您好,应用功能、桌面插件,不能占用同一个区域");
return false;
}
////判断 区域和 插件、功能对应关系--20230502--zyg--srart
if (get_classCol == "col-sm-12") {
alert('你好,“应用功能”只能拖放在“二分之一”区域中');
return false;
}
if (get_classCol == "col-sm-3") {
alert('你好,“应用功能”只能拖放在“二分之一”区域中');
return false;
}
////判断 区域和 插件、功能对应关系--20230502--zyg--end
}
if (get_ui_modeuletype == 1) {
///判断桌面插件属性
var set_siblingModuleType = -1;
get_ui_item_parent.find(".main-module").each(function () {
if ($(this).attr('data-modeuletype') == 0) {
set_siblingModuleType = 0;
}
});
if (set_siblingModuleType == 0) {
alert("您好,桌面插件、应用功能,不能占用同一个区域");
return false;
}
////判断 区域和 插件、功能对应关系--20230502--zyg--srart
var get_widthratio = ui.item.context.dataset.widthratio;
//console.log(get_widthratio);
if (get_widthratio == "满宽适应") {
if (get_classCol != "col-sm-12") {
alert('你好,“桌面插件-满宽适应”只能拖放在“满宽适应”区域中');
return false;
}
}
if (get_widthratio == "二分之一") {
if (get_classCol != "col-sm-6") {
alert('你好,“桌面插件-二分之一”只能拖放在“二分之一”区域中');
return false;
}
}
if (get_widthratio == "四分之一") {
if (get_classCol != "col-sm-3") {
alert('你好,“桌面插件-四分之一”只能拖放在“四分之一”区域中');
return false;
}
}
////判断 区域和 插件、功能对应关系--20230502--zyg--end
}
//console.log(scope.ctl.allMenu);
scope.ctl.allMenu.forEach(function (item) {
item.hasUse = false;
});
scope.ctl.pluginArray.forEach(function (item) {
item.hasUse = false;
});
$("#layerLeftSortArea").find(".main-module").each(function () {
if ($(this).attr("data-modeuletype") == "0") {
var get_pkid = $(this).attr("data-pkid");
//console.log(get_pkid);
scope.ctl.allMenu.forEach(function (item) {
if (item.PKID == get_pkid) {
item.hasUse = true;
}
});
} else {
var get_pgcode = $(this).attr("data-pgcode");
//console.log(get_pkid);
scope.ctl.pluginArray.forEach(function (item) {
if (item.PGCODE == get_pgcode) {
item.hasUse = true;
}
});
}
});
scope.$apply();
//console.log(JSON.stringify(scope.ctl.allMenu));
//console.log(JSON.stringify(scope.ctl.pluginArray));
}
}).disableSelection(); //禁用选择拖拽目标里的内容
}
}
})
// 点击编辑标题 ng-title
app.directive('ngTitle', function () {
return {
link: function (scope, element, attrs) {
$(element).click(function () {
if ($(element).children('input').length != 0) {
return false;
}
var str = $(element).html();
str = '';
$(element).html(str);
$(element).children('input').select();
var input = $(element).children('input');
var submit = function () {
var val = $(element).children('input').val();
$(element).html(val);
}
input.blur(submit).keydown(function (event) {
if (event.keyCode == 13) {
submit();
}
});
});
}
}
});
app.filter('trustAsResourceUrl', ['$sce', function ($sce) {
return function (val) {
return $sce.trustAsResourceUrl(val);
};
}])