123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302 |
-
- //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 = '<div class="main-module" data-modeuletype="0" data-pkid="' + item4.PKID + '" style="background:' + self.colorArray[index4] + '">' +
- //'<span class="gmt-number" ng-show="!!item.CONTENT_TOTAL" ng-bind="item.CONTENT_TOTAL || 0"></span>'+
- '<img src="../../js/indexTwo/img/' + item4.SRCIMG + '.png" alt="' + item4.CNAME + '">' +
- '<p class="sp-text-ellipsis">' + item4.CNAME + '</p>' +
- '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
- '</div>'
- //console.log(set_rhtModule);
- set_rhtModule_all += set_rhtModule;
- });
- //console.log(set_rhtModule_all);
- var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
- $("#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 = '<div class="main-module rgh-plugin-col" data-modeuletype="1" data-pgcode="' + item4.PGCODE + '" data-widthratio="' + item4.CTYPEMODEL_NAME + '">' +
- '<img src="' + item4.IMAGESMALL_set + '" />' +
- '<div class="sp-page sp-color-white" style="margin-top: -40px; background: rgba(176, 15, 15,0.6);">' + item4.CNAME + '</div>' +
- '<div class="sp-page" style="color: #ddd; margin-top: -20px; background: rgba(176, 15, 15,0.6); ">' + item4.CTYPEMODEL_NAME + '</div>' +
- '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
- '</div>';
- //console.log(set_rhtModule);
- set_rhtModule_all += set_rhtModule;
- });
- var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
- $("#layerRight_PlginParts").append($compile(append_rgh)($scope));
- ///右侧插件,全部显示--end
- };
- /////左侧添加行列按钮
- self.leftBtnAddCol = function (num) {
- if (num == 1) {
- var appendHtml = '<div class="row"><div class="col-sm-12 sp-pl-15 sp-pr-15 layer-col-part" data-col="col-sm-12">' +
- '<div class="main-title" ng-title>应用组</div>' +
- '<div class="module-box module-box-left ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
- '</div>' +
- '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
- '</div></div>';
- $("#layerLeftSortArea").append($compile(appendHtml)($scope));
- } else if (num == 2) {
- var appendHtml = '<div class="row"><div class="col-sm-6 sp-pl-15 sp-pr-15 layer-col-part" data-col="col-sm-6">' +
- '<div class="main-title" ng-title>应用组</div>' +
- '<div class="module-box module-box-left ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
- '</div>' +
- '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
- '</div>' +
- '<div class="col-sm-6 sp-pl-15 sp-pr-15 layer-col-part" data-col="col-sm-6">' +
- '<div class="main-title" ng-title>应用组</div>' +
- '<div class="module-box module-box-left ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
- '</div>' +
- '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
- '</div></div>';
- $("#layerLeftSortArea").append($compile(appendHtml)($scope));
- } else if (num == 4) {
- var appendHtml = '<div class="row"><div class="col-sm-3 sp-pl-15 sp-pr-15 layer-col-part" data-col="col-sm-3">' +
- '<div class="main-title" ng-title>应用组</div>' +
- '<div class="module-box module-box-left module-box-4 ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
- '</div>' +
- '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
- '</div>' +
- '<div class="col-sm-3 sp-pl-15 sp-pr-15 layer-col-part" data-col="col-sm-3">' +
- '<div class="main-title" ng-title>应用组</div>' +
- '<div class="module-box module-box-left module-box-4 ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
- '</div>' +
- '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
- '</div>' +
- '<div class="col-sm-3 sp-pl-15 sp-pr-15 layer-col-part" data-col="col-sm-3">' +
- '<div class="main-title" ng-title>应用组</div>' +
- '<div class="module-box module-box-left module-box-4 ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
- '</div>' +
- '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
- '</div>' +
- '<div class="col-sm-3 sp-pl-15 sp-pr-15 layer-col-part" data-col="col-sm-3">' +
- '<div class="main-title" ng-title>应用组</div>' +
- '<div class="module-box module-box-left module-box-4 ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
- '</div>' +
- '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
- '</div></div>';
- $("#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 = '<div class="main-module" data-modeuletype="0" data-pkid="' + item4.PKID + '" style="background:' + self.colorArray[index4] + '">' +
- //'<span class="gmt-number" ng-show="!!item.CONTENT_TOTAL" ng-bind="item.CONTENT_TOTAL || 0"></span>'+
- '<img src="../../js/indexTwo/img/' + item4.SRCIMG + '.png" alt="' + item4.CNAME + '">' +
- '<p class="sp-text-ellipsis">' + item4.CNAME + '</p>' +
- '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
- '</div>'
- //console.log(set_rhtModule);
- set_rhtModule_all += set_rhtModule;
- }
- });
- //console.log(set_rhtModule_all);
- var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
- $("#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 = '<div class="main-module rgh-plugin-col" data-modeuletype="1" data-pgcode="' + item4.PGCODE + '" data-widthratio="' + item4.CTYPEMODEL_NAME + '">' +
- '<img src="' + item4.IMAGESMALL_set + '" />' +
- '<div class="sp-page sp-color-white" style="margin-top: -40px; background: rgba(176, 15, 15,0.6);">' + item4.CNAME + '</div>' +
- '<div class="sp-page" style="color: #ddd; margin-top: -20px; background: rgba(176, 15, 15,0.6); ">' + item4.CTYPEMODEL_NAME + '</div>' +
- '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
- '</div>';
- //console.log(set_rhtModule);
- set_rhtModule_all += set_rhtModule;
- }
- });
- var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
- $("#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 = '<div class="main-module" data-modeuletype="0" data-pkid="' + item4.PKID + '" style="background:' + self.colorArray[index4] + '">' +
- //'<span class="gmt-number" ng-show="!!item.CONTENT_TOTAL" ng-bind="item.CONTENT_TOTAL || 0"></span>'+
- '<img src="../../js/indexTwo/img/' + item4.SRCIMG + '.png" alt="' + item4.CNAME + '">' +
- '<p class="sp-text-ellipsis">' + item4.CNAME + '</p>' +
- '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
- '</div>'
- //console.log(set_rhtModule);
- set_rhtModule_all += set_rhtModule;
- }
- });
- //console.log(set_rhtModule_all);
- var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
- $("#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 = '<div class="main-module rgh-plugin-col" data-modeuletype="1" data-pgcode="' + item4.PGCODE + '" data-widthratio="' + item4.CTYPEMODEL_NAME + '">' +
- '<img src="' + item4.IMAGESMALL_set + '" />' +
- '<div class="sp-page sp-color-white" style="margin-top: -40px; background: rgba(176, 15, 15,0.6);">' + item4.CNAME + '</div>' +
- '<div class="sp-page" style="color: #ddd; margin-top: -20px; background: rgba(176, 15, 15,0.6); ">' + item4.CTYPEMODEL_NAME + '</div>' +
- '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
- '</div>';
- //console.log(set_rhtModule);
- set_rhtModule_all += set_rhtModule;
- }
- });
- var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
- $("#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 = '<div class="main-module" data-modeuletype="0" data-pkid="' + item4.PKID + '" style="background:' + self.colorArray[index4] + '">' +
- //'<span class="gmt-number" ng-show="!!item.CONTENT_TOTAL" ng-bind="item.CONTENT_TOTAL || 0"></span>'+
- '<img src="../../js/indexTwo/img/' + item4.SRCIMG + '.png" alt="' + item4.CNAME + '">' +
- '<p class="sp-text-ellipsis">' + item4.CNAME + '</p>' +
- '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
- '</div>'
- //console.log(set_rhtModule);
- set_rhtModule_all += set_rhtModule;
- }
- });
- //console.log(set_rhtModule_all);
- var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
- $("#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 = '<div class="main-module" data-modeuletype="0" data-pkid="' + item4.PKID + '" style="background:' + self.colorArray[index4] + '">' +
- //'<span class="gmt-number" ng-show="!!item.CONTENT_TOTAL" ng-bind="item.CONTENT_TOTAL || 0"></span>'+
- '<img src="../../js/indexTwo/img/' + item4.SRCIMG + '.png" alt="' + item4.CNAME + '">' +
- '<p class="sp-text-ellipsis">' + item4.CNAME + '</p>' +
- '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
- '</div>'
- //console.log(set_rhtModule);
- set_rhtModule_all += set_rhtModule;
- }
- });
- //console.log(set_rhtModule_all);
- var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
- $("#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 = '<div class="main-module" style="background:' + set_bgcolror + '" data-pkid="' + item3.PKID + '" data-modeuletype="0">' +
- //'<span class="gmt-number" ng-show="!!item3.CONTENT_TOTAL" ng-bind="item3.CONTENT_TOTAL || 0"></span>'+
- '<img src="../../js/indexTwo/img/' + item3.SRCIMG + '.png" alt="' + item3.SRCIMG + '">' +
- '<p class="sp-text-ellipsis">' + item3.CNAME + '</p>' +
- '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
- '</div>';
- 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 = '<div class="main-module rgh-plugin-col" data-modeuletype="1" data-pgcode="' + item3.PGCODE + '" data-widthratio="' + item3.CTYPEMODEL_NAME + '">' +
- '<img src="' + item3.IMAGESMALL_set + '" />' +
- '<div class="sp-page sp-color-white" style="margin-top: -40px; background: rgba(176, 15, 15,0.6);">' + item3.CNAME + '</div>' +
- '<div class="sp-page" style="color: #ddd; margin-top: -20px; background: rgba(176, 15, 15,0.6); ">' + item3.CTYPEMODEL_NAME + '</div>' +
- '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
- '</div>';
- set_mainModule_all += set_mainModule;
- }
- });
- var set_class = item2.colClass;
- var set_layerColPart = '<div class="sp-pl-15 sp-pr-15 layer-col-part ' + set_class + '" data-col="' + set_class + '">' +
- '<div class="main-title" ng-title >' + item2.colName + '</div>' +
- '<div class="module-box module-box-left ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
- '' + set_mainModule_all + '' +
- '</div>' +
- '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
- '</div>';
- //console.log(set_layerColPart);
- set_layerColPart_all += set_layerColPart;
- });
- var set_row = '<div class="row">' + set_layerColPart_all + '</div>';
- //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 = '<div class="main-module rgh-plugin-col" data-modeuletype="1" data-pgcode="' + item4.PGCODE + '" data-widthratio="' + item4.CTYPEMODEL_NAME + '">' +
- '<img src="' + item4.IMAGESMALL_set + '" />' +
- '<div class="sp-page sp-color-white" style="margin-top: -40px; background: rgba(176, 15, 15,0.6);">' + item4.CNAME + '</div>' +
- '<div class="sp-page" style="color: #ddd; margin-top: -20px; background: rgba(176, 15, 15,0.6); ">' + item4.CTYPEMODEL_NAME + '</div>' +
- '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
- '</div>';
- //console.log(set_rhtModule);
- set_rhtModule_all += set_rhtModule;
- }
- });
- var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
- $("#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 = '<div class="main-module" data-modeuletype="0" data-pkid="' + item4.PKID + '" style="background:' + self.colorArray[index4] + '">' +
- //'<span class="gmt-number" ng-show="!!item.CONTENT_TOTAL" ng-bind="item.CONTENT_TOTAL || 0"></span>'+
- '<img src="../../js/indexTwo/img/' + item4.SRCIMG + '.png" alt="' + item4.CNAME + '">' +
- '<p class="sp-text-ellipsis">' + item4.CNAME + '</p>' +
- '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
- '</div>'
- //console.log(set_rhtModule);
- set_rhtModule_all += set_rhtModule;
- }
- });
- //console.log(set_rhtModule_all);
- var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
- $("#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 = '<div class="main-module rgh-plugin-col" data-modeuletype="1" data-pgcode="' + item4.PGCODE + '" data-widthratio="' + item4.CTYPEMODEL_NAME + '">' +
- '<img src="' + item4.IMAGESMALL_set + '" />' +
- '<div class="sp-page sp-color-white" style="margin-top: -40px; background: rgba(176, 15, 15,0.6);">' + item4.CNAME + '</div>' +
- '<div class="sp-page" style="color: #ddd; margin-top: -20px; background: rgba(176, 15, 15,0.6); ">' + item4.CTYPEMODEL_NAME + '</div>' +
- '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
- '</div>';
- //console.log(set_rhtModule);
- set_rhtModule_all += set_rhtModule;
- }
- });
- var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
- $("#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 = '<input type="text" value="' + 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);
- };
- }])
|