12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310 |
-
- var app = angular.module('app', [
- ]);
- app.controller("appCtrl", ["$http", "$compile", "$scope", "$timeout", function ($http, $compile, $scope, $timeout) {
- var self = this;
- var s4 = new SM4Util();
- self.userId = $.cookie("GlWorkPlatform-userid");
- self.userName = $.cookie("GlWorkPlatform-username");
- self.userCName = $.cookie("GlWorkPlatform-chineseName");
- self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
- self.userTypeEng = $.cookie("GlWorkPlatform-userTypeEng");
- self.outToken = localStorage.getItem("main-token");
- var base64 = new Base64(); //声明base解码和编码类
- var postCfg = {
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': "Bearer " + self.get_AccessToken
- }
- };
- self.CrossPage = window.parent.CrossPage;
- self.loading = false;
-
- //////设置背景图片*************************************************************--zyg--20230424
- self.set_imgurl = "";
- 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";
- }
- var get_userInfoJsonStr_1 = localStorage.getItem("GlWorkPlatform-userInfoJsonStr");
- self.get_userInfoJsonStr = strToJson(s4.decryptData_CBC(get_userInfoJsonStr_1))
- //console.log(JSON.stringify(self.get_userInfoJsonStr));
- //console.log(self.get_userInfoJsonStr.bkimageurl);
- $("body").css("background-image", "url(" + self.set_imgurl + self.get_userInfoJsonStr.bkimageurl + ")");
- //////设置背景图片*************************************************************--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 = [
- // ["#c23915", "#c23915", "#2e8ccc", "#be213e", "#91009b", "#94c849", "#462c02", "#b00f0f", "#547f17"],
- // ["#94c849", "#2e8ccc", "#91009b", "#be213e", "#c23915", "#2e8ccc", "#f09709", "#1a8fc2", "#be213e"],
- // ["#1f4ba0", "#b00f0f", "#d91236", "#1a8fc2", "#547f17", "#ab21a5", "#c40000", "#0057bd", "#1f53a0"]
- //]
- 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/PermissionsDecrypt", { data: s4.encryptData_CBC("") }, postCfg)
- .success(function (obj) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- var res = obj;
- //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 () {
- self.rows = [];
- self.allMenu = [];
- var data = {
- userid: self.userId
- };
- $http.post(apiurljs.login + "UserPower/PermissionsDecrypt", { data: s4.encryptData_CBC("") }, postCfg)
- .success(function (obj) {
- //var res = strToJson(s4.decryptData_CBC(obj.data));
- var res = obj;
- //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;
- }
- })
- }
- self.get_allMenu_init();
- ////检索保存的设置--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(self.querySetArray)
- //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, index) {
- angular.forEach(item.row, function (item2) {
- angular.forEach(item2.data, function (item3) {
- //item3.CONTENT_TOTAL = 0;
- if (item3.moduleType == "1") {
- ///插件类型,重新赋值缩略图base64
- if (index <= 2) {
- 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.IMAGEURL;
- //console.log(obj2.data.IMAGEURL);
- 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);
- }, 500);
- });
- } else {
- $timeout(function () {
- 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.IMAGEURL;
- //console.log(obj2.data.IMAGEURL);
- 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);
- }, 3000);
- });
- },2000)
- }
- } 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;
- item3.OPENTYPE = item4.OPENTYPE;///增加打开类型字段,1为新窗口;0为框架内打开
- }
- });
- if (item3.FILEN.indexOf("code") > -1) {
- var postData_2 = {
- userid: self.userId,
- param: {
- lm: item3.FILEN.split("?")[1].split("&")[0].split("=")[1],
- readstatus: 0,
- }
- }
- $http.post(apiurljs.login + "g2app/filepublishing/queryReadStatusWithfpRedis", JSON.stringify(postData_2), postCfg)
- .success(function (obj2) {
- item3.COUNT = obj2.data.TOTALCOUNT;//1000;
- set_hasUseArray.push(item3);
- console.log(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;
- }, 3000);
- 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) {
- if (ex.stack.indexOf(" from accessing a cross-origin frame") != -1) {
- Iframe.height = 300;
- }
- }
- $timeout(function () {
- self.setIframeHgt(idstr);
- },3000);
- };
- ////////初始化----拼接 自定义桌面-设置弹出层--左侧的初始化---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);
- //alert(itemdata.OPENTYPE);
- if (itemdata.FILEN == "") {
- sp.dialog("功能开发中!");
- return
- }
- if (itemdata.FILEN.indexOf("@token") > -1) {
- ///判断moduleType字段,当其为1时打开新窗口;0时在框架内打开
- if (itemdata.OPENTYPE == "1") {
- window.open("../../" + itemdata.FILEN.replace("@token", self.outToken));
- } else {
- window.parent.sp.addTabNav(itemdata.PKID, itemdata.CNAME, itemdata.FILEN.replace("@token", self.outToken));
- }
- } else {
- ///判断moduleType字段,当其为1时打开新窗口;0时在框架内打开
- if (itemdata.OPENTYPE == "1") {
- window.open("../../"+itemdata.FILEN);
- } else {
- window.parent.sp.addTabNav(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.IMAGEURL;
- 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);
- };
- }])
|