index_2.js 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302
  1. 
  2. //var userid = "2a7cbdee-9391-cd8b-cd8d-7cc78e88e9bf";
  3. //var username = "潘明";
  4. //var oatoken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyYTdjYmRlZS05MzkxLWNkOGItY2Q4ZC03Y2M3OGU4OGU5YmYiLCJjbGllbnRpZCI6ImFuZHJvaWRjbGllbnQiLCJncmFudF90eXBlIjoicGFzc3dvcmQiLCJzY29wZSI6Im9wZW5pZCBwcm9maWxlIGVtYWlsIFJlZmluZUFQSSIsImV4cCI6MTY5MzcwMDg3MCwiY29uZmlnIjoiMjAyMC0yMDk5In0.y676CAVOX2P1EmwxXGN8QW7ihfZUsNXfxpNRVmCT-P0";
  5. //var avatar = "http://10.233.22.205:8088/fs/avatar/show/2a7cbdee-9391-cd8b-cd8d-7cc78e88e9bf";
  6. //var maintoken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI4YTY5OTY2NDg3NDllMzRiMDE4N2IwYzk1YmU2NzNiYyIsImFwcE5hbWUiOiLlubPlj7Dpl6jmiLflkI7lj7DnrqHnkIYiLCJhcHBDb2RlIjoiemh6ZnpscHQiLCJ0eXBlIjoiVVNFUl9QQVNTV09SRCIsInVzZXJOYW1lIjoi5r2Y5piOIiwidXNlcklkIjoiOGE2OTk2NjQ4NzQ5ZTM0YjAxODdiMGM5NWJlNjczYmMiLCJzZWNyZXRMZXZlbCI6MCwicmFuZG9tIjoiTEMwMmlBIiwibG9naW5OYW1lIjoicGFubWluZyIsImFwcElkIjoiOGE2OTk2NjQ4NmU0ODQ3ODAxODZlZDI4YWUxNTA0NzYiLCJEc3BUb2tlbiI6ImNhNDM4OGI3NTU5OTQ1NGNlYjU2NjM4OGVkNDU4M2ZhZDExZmY3MzY4ODhhNmMwMmNmZWI1YjdkYmM0ZDJkZWM4Mzk2ZWRkM2JhNmE5Yzk2IiwiZXhwIjoxNjkwMTA0Mzg4LCJpYXQiOjE2OTAxMDA3ODh9.As_kz7yCOVprvHtG0FwyipyVX2ojisToy59DVgRey9c"
  7. ////发布的时候,全部置为空
  8. //var userid = "10876168-b21d-481e-9a02-1edb5af9853f";
  9. //var username = "蔺雪峰";
  10. //var oatoken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDg3NjE2OC1iMjFkLTQ4MWUtOWEwMi0xZWRiNWFmOTg1M2YiLCJjbGllbnRpZCI6ImFuZHJvaWRjbGllbnQiLCJncmFudF90eXBlIjoicGFzc3dvcmQiLCJzY29wZSI6Im9wZW5pZCBwcm9maWxlIGVtYWlsIFJlZmluZUFQSSIsImV4cCI6MTY5NDEzMjczMSwiY29uZmlnIjoiMjAyMC0yMDk5In0._CEHQyBKxN2ddn2iEAB-95JShVt5lqNCMxML_1sVJuM";
  11. //var avatar = "http://10.233.22.205:8088/fs/avatar/show/2a7cbdee-9391-cd8b-cd8d-7cc78e88e9bf";
  12. //var maintoken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI4YTY5OTY2NDg3NDllMzRiMDE4N2IwYzk1YmU2NzNiYyIsImFwcE5hbWUiOiLlubPlj7Dpl6jmiLflkI7lj7DnrqHnkIYiLCJhcHBDb2RlIjoiemh6ZnpscHQiLCJ0eXBlIjoiVVNFUl9QQVNTV09SRCIsInVzZXJOYW1lIjoi5r2Y5piOIiwidXNlcklkIjoiOGE2OTk2NjQ4NzQ5ZTM0YjAxODdiMGM5NWJlNjczYmMiLCJzZWNyZXRMZXZlbCI6MCwicmFuZG9tIjoiTEMwMmlBIiwibG9naW5OYW1lIjoicGFubWluZyIsImFwcElkIjoiOGE2OTk2NjQ4NmU0ODQ3ODAxODZlZDI4YWUxNTA0NzYiLCJEc3BUb2tlbiI6ImNhNDM4OGI3NTU5OTQ1NGNlYjU2NjM4OGVkNDU4M2ZhZDExZmY3MzY4ODhhNmMwMmNmZWI1YjdkYmM0ZDJkZWM4Mzk2ZWRkM2JhNmE5Yzk2IiwiZXhwIjoxNjkwMTA0Mzg4LCJpYXQiOjE2OTAxMDA3ODh9.As_kz7yCOVprvHtG0FwyipyVX2ojisToy59DVgRey9c"
  13. //window.addEventListener("flutterInAppWebViewPlatformReady", function () {
  14. // window.flutter_inappwebview
  15. // .callHandler("getuserinfo", "")
  16. // .then(function (res) {
  17. // userid = res.username;
  18. // username = res.name;
  19. // oatoken = res.oatoken;
  20. // avatar = res.avatar;
  21. // //console.log(JSON.stringify(res));
  22. // })
  23. //});
  24. //function jumpPageParent(id, title, src) {
  25. // window.top.jumpPageParent_2(id, title, src);
  26. //}
  27. var app = angular.module('app', [
  28. ]);
  29. var postCfg = {};
  30. app.controller("appCtrl", ["$http", "$compile", "$scope", "$timeout", function ($http, $compile, $scope, $timeout) {
  31. var self = this;
  32. var s4 = new SM4Util();
  33. //$timeout(function () {
  34. // //alert(9999);
  35. // //console.log(userid);
  36. // self.userId = userid;
  37. // self.userCName = username;
  38. // self.get_AccessToken = oatoken;
  39. // self.outToken = maintoken;
  40. // postCfg = {
  41. // headers: {
  42. // 'Content-Type': 'application/json',
  43. // 'Authorization': "Bearer " + self.get_AccessToken
  44. // }
  45. // };
  46. // $.cookie("GlWorkPlatform-userid", userid, { path: '/', expires: 1 });
  47. // $.cookie("GlWorkPlatform-chineseName", username, { path: '/', expires: 1 });
  48. // localStorage.setItem("GlWorkPlatform-AccessToken", oatoken);
  49. // localStorage.setItem("main-token", maintoken);
  50. //}, 500);
  51. $timeout(function () {
  52. self.getReloadUserData();
  53. self.get_allMenu_init();
  54. },600);
  55. self.userId = $.cookie("GlWorkPlatform-userid");
  56. self.userCName = $.cookie("GlWorkPlatform-chineseName");
  57. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  58. self.outToken = localStorage.getItem("main-token");
  59. postCfg = {
  60. headers: {
  61. 'Content-Type': 'application/json',
  62. 'Authorization': "Bearer " + self.get_AccessToken
  63. }
  64. };
  65. var base64 = new Base64(); //声明base解码和编码类
  66. self.CrossPage = window.parent.CrossPage;
  67. self.loading = true;
  68. //////设置背景图片*************************************************************--zyg--20230424
  69. self.getReloadUserData = function () {
  70. var postData = {};
  71. //console.log(postData);
  72. //console.log(postData); s4.encryptData_CBC(JSON.stringify(postData))
  73. $http.post(apiurljs.login + "api/User/UserInfo", JSON.stringify(postData), postCfg)
  74. .success(function (obj) {
  75. var res1 = strToJson(s4.decryptData_CBC(obj.data));
  76. self.get_userInfoJsonStr = res1.data;
  77. ////加载背景图片*******************************************************************************************
  78. if (apiurljs.login.indexOf("http://139.129.27.3:85") != -1) {
  79. self.set_imgurl = "http://139.129.27.3:8511/web/UploadAttach";
  80. } else {
  81. self.set_imgurl = apiurljs.login.split("glwork")[0] + "glworkweb/UploadAttach";
  82. }
  83. $("body").css("background-image", "url(" + self.set_imgurl + self.get_userInfoJsonStr.bkimageurl + ")");
  84. })
  85. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  86. if (textStatus != 200) {
  87. //self.loading = false;
  88. }
  89. })
  90. }
  91. //////设置背景图片*************************************************************--zyg--20230424
  92. ////监听框架页面发送的打开桌面设置的时机---zyg---20230426
  93. //window.addEventListener('message', function (event) {
  94. // //通过origin属性判断消息来源地址
  95. // if (event.data.name == "openLayerSetting") {
  96. // //jzsetLat(event.data.arg);
  97. // var getJson = event.data.arg;
  98. // self.btnSeting();
  99. // }
  100. //}, false);
  101. self.colorArray = [
  102. "#d2f4e0", "#fcdce1", "#d5e7f5", "#feedcf", "#e0f2f2", "#eae9f7", "#e5f6ff", "#fff0f0", "#f8f7c7", "#ffe4d4", "#e6fafc", "#e6fafc", "#edfad5", "#dbffd8", "#e9f4f9", "#e8e2d9", "#ffdbf1", "#f8eec7", "#d8f7f5", "#e6e2e2",
  103. "#d2f4e0", "#fcdce1", "#d5e7f5", "#feedcf", "#e0f2f2", "#eae9f7", "#e5f6ff", "#fff0f0", "#f8f7c7", "#ffe4d4", "#e6fafc", "#e6fafc", "#edfad5", "#dbffd8", "#e9f4f9", "#e8e2d9", "#ffdbf1", "#f8eec7", "#d8f7f5", "#e6e2e2",
  104. "#d2f4e0", "#fcdce1", "#d5e7f5", "#feedcf", "#e0f2f2", "#eae9f7", "#e5f6ff", "#fff0f0", "#f8f7c7", "#ffe4d4", "#e6fafc", "#e6fafc", "#edfad5", "#dbffd8", "#e9f4f9", "#e8e2d9", "#ffdbf1", "#f8eec7", "#d8f7f5", "#e6e2e2",
  105. "#d2f4e0", "#fcdce1", "#d5e7f5", "#feedcf", "#e0f2f2", "#eae9f7", "#e5f6ff", "#fff0f0", "#f8f7c7", "#ffe4d4", "#e6fafc", "#e6fafc", "#edfad5", "#dbffd8", "#e9f4f9", "#e8e2d9", "#ffdbf1", "#f8eec7", "#d8f7f5", "#e6e2e2",
  106. "#d2f4e0", "#fcdce1", "#d5e7f5", "#feedcf", "#e0f2f2", "#eae9f7", "#e5f6ff", "#fff0f0", "#f8f7c7", "#ffe4d4", "#e6fafc", "#e6fafc", "#edfad5", "#dbffd8", "#e9f4f9", "#e8e2d9", "#ffdbf1", "#f8eec7", "#d8f7f5", "#e6e2e2"
  107. ]
  108. ////打开设置弹出层
  109. //self.btnSeting = function () {
  110. // ////////初始化----拼接 自定义桌面-设置弹出层--左侧的初始化---zyg---start--20230505
  111. // self.init_layerLeftSortArea(self.querySetArray);
  112. // ////////初始化----拼接 自定义桌面-设置弹出层--左侧的初始化---zyg---end--20230505
  113. // self.get_allMenu();///右侧应用功能重新加载
  114. // self.getPluginData();///右侧插件,重新加载
  115. // sp.layer("#layer_setting", 1);
  116. //};
  117. /////左侧--清空 设置层
  118. self.leftBtnClear = function () {
  119. $("#layerLeftSortArea").html("");
  120. ///右侧菜单,全部显示--start
  121. $("#layerRight_ApplayParts").html("");
  122. var set_rhtModule_all = "";
  123. angular.forEach(self.allMenu, function (item4, index4) {
  124. item4.hasUse = false;
  125. var set_rhtModule = '<div class="main-module" data-modeuletype="0" data-pkid="' + item4.PKID + '" style="background:' + self.colorArray[index4] + '">' +
  126. //'<span class="gmt-number" ng-show="!!item.CONTENT_TOTAL" ng-bind="item.CONTENT_TOTAL || 0"></span>'+
  127. '<img src="../../js/indexTwo/img/' + item4.SRCIMG + '.png" alt="' + item4.CNAME + '">' +
  128. '<p class="sp-text-ellipsis">' + item4.CNAME + '</p>' +
  129. '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
  130. '</div>'
  131. //console.log(set_rhtModule);
  132. set_rhtModule_all += set_rhtModule;
  133. });
  134. //console.log(set_rhtModule_all);
  135. var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
  136. $("#layerRight_ApplayParts").append($compile(append_rgh)($scope));
  137. ///右侧菜单,全部显示--end
  138. ///右侧插件,全部显示--start
  139. $("#layerRight_PlginParts").html("");
  140. var set_rhtModule_all = "";
  141. angular.forEach(self.pluginArray, function (item4, index4) {
  142. item4.hasUse = false;
  143. var set_rhtModule = '<div class="main-module rgh-plugin-col" data-modeuletype="1" data-pgcode="' + item4.PGCODE + '" data-widthratio="' + item4.CTYPEMODEL_NAME + '">' +
  144. '<img src="' + item4.IMAGESMALL_set + '" />' +
  145. '<div class="sp-page sp-color-white" style="margin-top: -40px; background: rgba(176, 15, 15,0.6);">' + item4.CNAME + '</div>' +
  146. '<div class="sp-page" style="color: #ddd; margin-top: -20px; background: rgba(176, 15, 15,0.6); ">' + item4.CTYPEMODEL_NAME + '</div>' +
  147. '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
  148. '</div>';
  149. //console.log(set_rhtModule);
  150. set_rhtModule_all += set_rhtModule;
  151. });
  152. var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
  153. $("#layerRight_PlginParts").append($compile(append_rgh)($scope));
  154. ///右侧插件,全部显示--end
  155. };
  156. /////左侧添加行列按钮
  157. self.leftBtnAddCol = function (num) {
  158. if (num == 1) {
  159. var appendHtml = '<div class="row"><div class="col-sm-12 sp-pl-15 sp-pr-15 layer-col-part" data-col="col-sm-12">' +
  160. '<div class="main-title" ng-title>应用组</div>' +
  161. '<div class="module-box module-box-left ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
  162. '</div>' +
  163. '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
  164. '</div></div>';
  165. $("#layerLeftSortArea").append($compile(appendHtml)($scope));
  166. } else if (num == 2) {
  167. var appendHtml = '<div class="row"><div class="col-sm-6 sp-pl-15 sp-pr-15 layer-col-part" data-col="col-sm-6">' +
  168. '<div class="main-title" ng-title>应用组</div>' +
  169. '<div class="module-box module-box-left ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
  170. '</div>' +
  171. '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
  172. '</div>' +
  173. '<div class="col-sm-6 sp-pl-15 sp-pr-15 layer-col-part" data-col="col-sm-6">' +
  174. '<div class="main-title" ng-title>应用组</div>' +
  175. '<div class="module-box module-box-left ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
  176. '</div>' +
  177. '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
  178. '</div></div>';
  179. $("#layerLeftSortArea").append($compile(appendHtml)($scope));
  180. } else if (num == 4) {
  181. var appendHtml = '<div class="row"><div class="col-sm-3 sp-pl-15 sp-pr-15 layer-col-part" data-col="col-sm-3">' +
  182. '<div class="main-title" ng-title>应用组</div>' +
  183. '<div class="module-box module-box-left module-box-4 ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
  184. '</div>' +
  185. '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
  186. '</div>' +
  187. '<div class="col-sm-3 sp-pl-15 sp-pr-15 layer-col-part" data-col="col-sm-3">' +
  188. '<div class="main-title" ng-title>应用组</div>' +
  189. '<div class="module-box module-box-left module-box-4 ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
  190. '</div>' +
  191. '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
  192. '</div>' +
  193. '<div class="col-sm-3 sp-pl-15 sp-pr-15 layer-col-part" data-col="col-sm-3">' +
  194. '<div class="main-title" ng-title>应用组</div>' +
  195. '<div class="module-box module-box-left module-box-4 ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
  196. '</div>' +
  197. '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
  198. '</div>' +
  199. '<div class="col-sm-3 sp-pl-15 sp-pr-15 layer-col-part" data-col="col-sm-3">' +
  200. '<div class="main-title" ng-title>应用组</div>' +
  201. '<div class="module-box module-box-left module-box-4 ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
  202. '</div>' +
  203. '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
  204. '</div></div>';
  205. $("#layerLeftSortArea").append($compile(appendHtml)($scope));
  206. } else { return; }
  207. };
  208. ////删除区域---zyg--20230506
  209. self.btnDeleteCol = function () {
  210. //console.log(event.target);
  211. //console.log($(event.target).parent().parent().find(".layer-col-part").length);
  212. //console.log($(event.target).parent().find(".module-box").find(".main-module").length);
  213. if (confirm("您确定要删除当前区域吗?")) {
  214. var get_layerColPart_length = $(event.target).parent().parent().find(".layer-col-part").length;
  215. $(event.target).parent().find(".module-box").find(".main-module").each(function () {
  216. var get_modeuletype = $(this).attr("data-modeuletype");
  217. if (get_modeuletype == "0") {
  218. var get_pkid = $(this).attr("data-pkid");
  219. //console.log(get_pkid);
  220. self.allMenu.forEach(function (item) {
  221. if (item.PKID == get_pkid) {
  222. item.hasUse = false;
  223. }
  224. });
  225. } else {
  226. var get_pgcode = $(this).attr("data-pgcode");
  227. self.pluginArray.forEach(function (item) {
  228. if (item.PGCODE == get_pgcode) {
  229. item.hasUse = false;
  230. }
  231. });
  232. }
  233. });
  234. if (get_layerColPart_length == 1) {
  235. $(event.target).parent().parent().remove();
  236. } else {
  237. $(event.target).parent().remove();
  238. }
  239. ///右侧菜单,重新显示--start
  240. $("#layerRight_ApplayParts").html("");
  241. var set_rhtModule_all = "";
  242. angular.forEach(self.allMenu, function (item4, index4) {
  243. if (!item4.hasUse) {
  244. var set_rhtModule = '<div class="main-module" data-modeuletype="0" data-pkid="' + item4.PKID + '" style="background:' + self.colorArray[index4] + '">' +
  245. //'<span class="gmt-number" ng-show="!!item.CONTENT_TOTAL" ng-bind="item.CONTENT_TOTAL || 0"></span>'+
  246. '<img src="../../js/indexTwo/img/' + item4.SRCIMG + '.png" alt="' + item4.CNAME + '">' +
  247. '<p class="sp-text-ellipsis">' + item4.CNAME + '</p>' +
  248. '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
  249. '</div>'
  250. //console.log(set_rhtModule);
  251. set_rhtModule_all += set_rhtModule;
  252. }
  253. });
  254. //console.log(set_rhtModule_all);
  255. var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
  256. $("#layerRight_ApplayParts").append($compile(append_rgh)($scope));
  257. ///右侧菜单,全部显示--end
  258. ///右侧插件,重新显示--start
  259. $("#layerRight_PlginParts").html("");
  260. var set_rhtModule_all = "";
  261. angular.forEach(self.pluginArray, function (item4, index4) {
  262. if (!item4.hasUse) {
  263. var set_rhtModule = '<div class="main-module rgh-plugin-col" data-modeuletype="1" data-pgcode="' + item4.PGCODE + '" data-widthratio="' + item4.CTYPEMODEL_NAME + '">' +
  264. '<img src="' + item4.IMAGESMALL_set + '" />' +
  265. '<div class="sp-page sp-color-white" style="margin-top: -40px; background: rgba(176, 15, 15,0.6);">' + item4.CNAME + '</div>' +
  266. '<div class="sp-page" style="color: #ddd; margin-top: -20px; background: rgba(176, 15, 15,0.6); ">' + item4.CTYPEMODEL_NAME + '</div>' +
  267. '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
  268. '</div>';
  269. //console.log(set_rhtModule);
  270. set_rhtModule_all += set_rhtModule;
  271. }
  272. });
  273. var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
  274. $("#layerRight_PlginParts").append($compile(append_rgh)($scope));
  275. ///右侧插件,重新显示--end
  276. //console.log($(obj).parent().attr("data-col"));
  277. }
  278. };
  279. ///删除单个元素
  280. self.btnDelSingle = function () {
  281. if (confirm("您确定要删除吗?")) {
  282. var parentElem = $(event.target).parent().parent();
  283. //console.log($(event.target));
  284. //console.log(parentElem);
  285. var get_modeuletype = parentElem.attr("data-modeuletype");
  286. //console.log(get_modeuletype);
  287. if (get_modeuletype == "0") {
  288. var get_pkid = parentElem.attr("data-pkid");
  289. //console.log(get_pkid);
  290. self.allMenu.forEach(function (item) {
  291. if (item.PKID == get_pkid) {
  292. item.hasUse = false;
  293. }
  294. });
  295. parentElem.remove();
  296. ///右侧菜单,重新显示--start
  297. $("#layerRight_ApplayParts").html("");
  298. var set_rhtModule_all = "";
  299. angular.forEach(self.allMenu, function (item4, index4) {
  300. if (!item4.hasUse) {
  301. var set_rhtModule = '<div class="main-module" data-modeuletype="0" data-pkid="' + item4.PKID + '" style="background:' + self.colorArray[index4] + '">' +
  302. //'<span class="gmt-number" ng-show="!!item.CONTENT_TOTAL" ng-bind="item.CONTENT_TOTAL || 0"></span>'+
  303. '<img src="../../js/indexTwo/img/' + item4.SRCIMG + '.png" alt="' + item4.CNAME + '">' +
  304. '<p class="sp-text-ellipsis">' + item4.CNAME + '</p>' +
  305. '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
  306. '</div>'
  307. //console.log(set_rhtModule);
  308. set_rhtModule_all += set_rhtModule;
  309. }
  310. });
  311. //console.log(set_rhtModule_all);
  312. var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
  313. $("#layerRight_ApplayParts").append($compile(append_rgh)($scope));
  314. ///右侧菜单,全部显示--end
  315. } else {
  316. var get_pgcode = parentElem.attr("data-pgcode");
  317. self.pluginArray.forEach(function (item) {
  318. if (item.PGCODE == get_pgcode) {
  319. item.hasUse = false;
  320. }
  321. });
  322. parentElem.remove();
  323. ///右侧插件,重新显示--start
  324. $("#layerRight_PlginParts").html("");
  325. var set_rhtModule_all = "";
  326. angular.forEach(self.pluginArray, function (item4, index4) {
  327. if (!item4.hasUse) {
  328. var set_rhtModule = '<div class="main-module rgh-plugin-col" data-modeuletype="1" data-pgcode="' + item4.PGCODE + '" data-widthratio="' + item4.CTYPEMODEL_NAME + '">' +
  329. '<img src="' + item4.IMAGESMALL_set + '" />' +
  330. '<div class="sp-page sp-color-white" style="margin-top: -40px; background: rgba(176, 15, 15,0.6);">' + item4.CNAME + '</div>' +
  331. '<div class="sp-page" style="color: #ddd; margin-top: -20px; background: rgba(176, 15, 15,0.6); ">' + item4.CTYPEMODEL_NAME + '</div>' +
  332. '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
  333. '</div>';
  334. //console.log(set_rhtModule);
  335. set_rhtModule_all += set_rhtModule;
  336. }
  337. });
  338. var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
  339. $("#layerRight_PlginParts").append($compile(append_rgh)($scope));
  340. ///右侧插件,重新显示--end
  341. }
  342. }
  343. };
  344. ////右侧--选项卡切换
  345. self.rightActiveTab = 0;
  346. self.rightBtnClick = function (num) {
  347. self.rightActiveTab = num;
  348. };
  349. // 将所有菜单的最后一代obj提取出来
  350. function extractObj(arr, toArr) {
  351. $.each(arr, function (index, item) {
  352. if (typeof item.C_H_I_L_D == "undefined" || item.C_H_I_L_D.length < 1) {
  353. toArr.push(item);
  354. return toArr;
  355. } else {
  356. return extractObj(item.C_H_I_L_D, toArr);
  357. }
  358. });
  359. }
  360. //原始数据
  361. self.rows = []; //declare an empty array
  362. // 所有菜单
  363. self.allMenu = [];
  364. self.get_allMenu = function () {
  365. self.allMenu = [];
  366. var data = {
  367. userid: self.userId
  368. };
  369. $http.post(apiurljs.login + "UserPower/Permissions", { data: s4.encryptData_CBC("") }, postCfg)
  370. .success(function (obj) {
  371. var res = strToJson(s4.decryptData_CBC(obj.data));
  372. //console.log(JSON.stringify(res));
  373. if (sp.isval(res.data.rows)) {
  374. self.noDataTip = 1;
  375. self.rows = res.data.rows;
  376. // 所有菜单保存到 self.allMenu 中
  377. extractObj(res.data.rows, self.allMenu);
  378. angular.forEach(self.allMenu, function (item4, index4) {
  379. item4.hasUse = false;
  380. });
  381. //console.log(JSON.stringify(self.allMenu));
  382. ///将已选中的应用功能过滤掉
  383. if (sp.isval(self.querySetArray)) {
  384. var set_hasUseArray = [];
  385. angular.forEach(self.querySetArray, function (item) {
  386. angular.forEach(item.row, function (item2) {
  387. angular.forEach(item2.data, function (item3) {
  388. if (item3.moduleType == "0") {
  389. set_hasUseArray.push(item3);
  390. }
  391. });
  392. });
  393. });
  394. angular.forEach(self.allMenu, function (item4, index4) {
  395. angular.forEach(set_hasUseArray, function (item2, index2) {
  396. if (item4.PKID == item2.PKID) {
  397. //$("#layerRight_ApplayParts")
  398. item4.hasUse = true;
  399. }
  400. });
  401. });
  402. }
  403. $("#layerRight_ApplayParts").html("");
  404. var set_rhtModule_all = "";
  405. angular.forEach(self.allMenu, function (item4, index4) {
  406. if (!item4.hasUse) {
  407. var set_rhtModule = '<div class="main-module" data-modeuletype="0" data-pkid="' + item4.PKID + '" style="background:' + self.colorArray[index4] + '">' +
  408. //'<span class="gmt-number" ng-show="!!item.CONTENT_TOTAL" ng-bind="item.CONTENT_TOTAL || 0"></span>'+
  409. '<img src="../../js/indexTwo/img/' + item4.SRCIMG + '.png" alt="' + item4.CNAME + '">' +
  410. '<p class="sp-text-ellipsis">' + item4.CNAME + '</p>' +
  411. '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
  412. '</div>'
  413. //console.log(set_rhtModule);
  414. set_rhtModule_all += set_rhtModule;
  415. }
  416. });
  417. //console.log(set_rhtModule_all);
  418. var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
  419. $("#layerRight_ApplayParts").append($compile(append_rgh)($scope));
  420. //console.log(JSON.stringify(self.allMenu))
  421. } else {
  422. self.noDataTip = 0;
  423. }
  424. })
  425. };
  426. ////第一次进入页面,初始化数据时,获取菜单数据
  427. self.get_allMenu_init = function () {
  428. //alert("第一次进入页面,初始化数据时,获取菜单数据");
  429. self.rows = [];
  430. self.allMenu = [];
  431. var data = {
  432. userid: self.userId
  433. };
  434. $http.post(apiurljs.login + "UserPower/Permissions", { data: s4.encryptData_CBC("") }, postCfg)
  435. .success(function (obj) {
  436. var res = strToJson(s4.decryptData_CBC(obj.data));
  437. //console.log(JSON.stringify(res));
  438. if (sp.isval(res.data.rows)) {
  439. self.noDataTip = 1;
  440. self.rows = res.data.rows;
  441. // 所有菜单保存到 self.allMenu 中
  442. extractObj(res.data.rows, self.allMenu);
  443. angular.forEach(self.allMenu, function (item4, index4) {
  444. item4.hasUse = false;
  445. });
  446. //console.log(JSON.stringify(self.allMenu));
  447. self.querySettingByUserid();////检索自定义桌面配置数据
  448. } else {
  449. self.noDataTip = 0;
  450. }
  451. })
  452. }
  453. ////检索保存的设置--zyg--20230426---检索自定义桌面配置数据
  454. self.querySetArray = [];
  455. self.querySetArray_lengthArray = [];
  456. self.querySettingByUserid = function () {
  457. self.querySetArray = [];
  458. self.querySetArray_lengthArray = [];
  459. self.loading = true;
  460. var postData = {
  461. "userid": self.userId
  462. }
  463. $http.post(apiurljs.login + "g2work/desktop/queryDataUserDefaultData", JSON.stringify(postData), postCfg)
  464. .success(function (obj) {
  465. //var res = strToJson(s4.decryptData_CBC(obj.data));
  466. var res = obj;
  467. //console.log(JSON.stringify(res));
  468. if (res.success) {
  469. if (sp.isval(res.data)) {
  470. self.querySetArray = strToJson(s4.decryptData_CBC(res.data));
  471. //console.log(JSON.stringify(self.querySetArray));
  472. for (var i = 0; i < self.querySetArray.length; i++) {
  473. self.querySetArray_lengthArray.push(i);
  474. }
  475. //console.log(JSON.stringify(self.querySetArray));
  476. //console.log(self.querySetArray.length);
  477. var set_hasUseArray = [];///声明已有菜单数组
  478. angular.forEach(self.querySetArray, function (item) {
  479. angular.forEach(item.row, function (item2) {
  480. angular.forEach(item2.data, function (item3) {
  481. //item3.CONTENT_TOTAL = 0;
  482. if (item3.moduleType == "1") {
  483. ///插件类型,重新赋值缩略图base64
  484. var postData_2 = {
  485. "id": item3.ID
  486. }
  487. $http.post(apiurljs.login + "g2app/plugin/queryData", JSON.stringify(postData_2), postCfg)
  488. .success(function (obj2) {
  489. //console.log(item3.ID);
  490. //console.log(JSON.stringify(obj2.data));
  491. //console.log(obj2.data.CTYPEMODEL);
  492. item3.CTYPEMODEL = obj2.data.CTYPEMODEL;
  493. item3.IMAGESMALL = obj2.data.IMAGESMALL;
  494. //console.log(obj2.data.IMAGESMALL);
  495. item3.URL = obj2.data.URL;
  496. if (item3.URL.indexOf("tpl/") != -1 || item3.URL.indexOf("tpk/") != -1) {
  497. item3.URL_set = "../../" + item3.URL;
  498. } else {
  499. item3.URL_set = item3.URL + "?token=" + self.outToken;
  500. }
  501. if (item3.CTYPEMODEL == "C01") {
  502. item3.CTYPEMODEL_NAME = "满宽适应";
  503. } else if (item3.CTYPEMODEL == "C02") {
  504. item3.CTYPEMODEL_NAME = "二分之一";
  505. } else {
  506. item3.CTYPEMODEL_NAME = "四分之一";
  507. }
  508. if (sp.isval(item3.IMAGESMALL) && item3.IMAGESMALL != "XXXXX") {
  509. item3.IMAGESMALL_set = item3.IMAGESMALL;
  510. } else {
  511. item3.IMAGESMALL_set = "image/upimg.jpg";
  512. }
  513. $timeout(function () {
  514. ///设置iframe高度
  515. self.setIframeHgt("iframe_" + item3.PGCODE);
  516. }, 1000);
  517. });
  518. } else {
  519. ////已有菜单,重新赋值文件路径、图标
  520. angular.forEach(self.allMenu, function (item4, index4) {
  521. if (item3.PKID == item4.PKID) {
  522. item3.CNAME = item4.CNAME;
  523. item3.FILEN = item4.FILEN;
  524. item3.SRCIMG = item4.SRCIMG;
  525. item3.SRCIMG32 = item4.SRCIMG32;
  526. }
  527. });
  528. set_hasUseArray.push(item3);
  529. }
  530. });
  531. });
  532. });
  533. angular.forEach(self.allMenu, function (item4, index4) {
  534. angular.forEach(set_hasUseArray, function (item2, index2) {
  535. if (item4.PKID == item2.PKID) {
  536. //$("#layerRight_ApplayParts")
  537. item4.hasUse = true;
  538. }
  539. });
  540. });
  541. $("#layerRight_ApplayParts").html("");
  542. var set_rhtModule_all = "";
  543. angular.forEach(self.allMenu, function (item4, index4) {
  544. if (!item4.hasUse) {
  545. var set_rhtModule = '<div class="main-module" data-modeuletype="0" data-pkid="' + item4.PKID + '" style="background:' + self.colorArray[index4] + '">' +
  546. //'<span class="gmt-number" ng-show="!!item.CONTENT_TOTAL" ng-bind="item.CONTENT_TOTAL || 0"></span>'+
  547. '<img src="../../js/indexTwo/img/' + item4.SRCIMG + '.png" alt="' + item4.CNAME + '">' +
  548. '<p class="sp-text-ellipsis">' + item4.CNAME + '</p>' +
  549. '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
  550. '</div>'
  551. //console.log(set_rhtModule);
  552. set_rhtModule_all += set_rhtModule;
  553. }
  554. });
  555. //console.log(set_rhtModule_all);
  556. var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
  557. $("#layerRight_ApplayParts").append($compile(append_rgh)($scope));
  558. $timeout(function () {
  559. self.loading = false;
  560. }, 1000);
  561. self.getPluginData();///加载插件列表
  562. } else {
  563. self.querySetArray = [];
  564. self.loading = false;
  565. self.getPluginData();///加载插件列表
  566. }
  567. } else {
  568. self.querySetArray = [];
  569. self.loading = false;
  570. sp.dialog(res.message);
  571. self.getPluginData();///加载插件列表
  572. }
  573. });
  574. };
  575. ////设置iframe自适应子页面高度
  576. self.setIframeHgt = function (idstr) {
  577. //console.log(idstr);
  578. var Iframe = document.getElementById(idstr);
  579. try {
  580. // 声明变量取值
  581. var bHeight = Iframe.contentWindow.document.body.scrollHeight;
  582. var dHeight = Iframe.contentWindow.document.documentElement.scrollHeight;
  583. //if (idstr == "iframe_PGCOMP20") {
  584. // console.log(bHeight);
  585. // console.log(dHeight);
  586. //}
  587. var height = Math.max(bHeight, dHeight); // 取最大值
  588. Iframe.height = height;
  589. } catch (ex) { }
  590. $timeout(function () {
  591. self.setIframeHgt(idstr);
  592. }, 1000);
  593. };
  594. ////////初始化----拼接 自定义桌面-设置弹出层--左侧的初始化---zyg---start--20230505
  595. self.init_layerLeftSortArea = function (arrayData) {
  596. $("#layerLeftSortArea").html("");
  597. var set_row_all = "";
  598. angular.forEach(arrayData, function (item1, index1) {
  599. var set_layerColPart_all = "";
  600. angular.forEach(item1.row, function (item2, index2) {
  601. var set_mainModule_all = "";
  602. angular.forEach(item2.data, function (item3, index3) {
  603. if (item3.moduleType == 0) {
  604. var set_bgcolror = self.colorArray[index3];
  605. var set_mainModule = '<div class="main-module" style="background:' + set_bgcolror + '" data-pkid="' + item3.PKID + '" data-modeuletype="0">' +
  606. //'<span class="gmt-number" ng-show="!!item3.CONTENT_TOTAL" ng-bind="item3.CONTENT_TOTAL || 0"></span>'+
  607. '<img src="../../js/indexTwo/img/' + item3.SRCIMG + '.png" alt="' + item3.SRCIMG + '">' +
  608. '<p class="sp-text-ellipsis">' + item3.CNAME + '</p>' +
  609. '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
  610. '</div>';
  611. set_mainModule_all += set_mainModule;
  612. //console.log(set_mainModule);
  613. } else {
  614. if (item3.URL.indexOf("tpl/") != -1 || item3.URL.indexOf("tpk/") != -1) {
  615. item3.URL_set = "../../" + item3.URL;
  616. } else {
  617. item3.URL_set = item3.URL + "?token=" + self.outToken;
  618. }
  619. if (item3.CTYPEMODEL == "C01") {
  620. item3.CTYPEMODEL_NAME = "满宽适应";
  621. } else if (item3.CTYPEMODEL == "C02") {
  622. item3.CTYPEMODEL_NAME = "二分之一";
  623. } else {
  624. item3.CTYPEMODEL_NAME = "四分之一";
  625. }
  626. if (sp.isval(item3.IMAGESMALL) && item3.IMAGESMALL != "XXXXX") {
  627. item3.IMAGESMALL_set = item3.IMAGESMALL;
  628. } else {
  629. item3.IMAGESMALL_set = "image/upimg.jpg";
  630. }
  631. //console.log(item3.IMAGESMALL_set);
  632. var set_mainModule = '<div class="main-module rgh-plugin-col" data-modeuletype="1" data-pgcode="' + item3.PGCODE + '" data-widthratio="' + item3.CTYPEMODEL_NAME + '">' +
  633. '<img src="' + item3.IMAGESMALL_set + '" />' +
  634. '<div class="sp-page sp-color-white" style="margin-top: -40px; background: rgba(176, 15, 15,0.6);">' + item3.CNAME + '</div>' +
  635. '<div class="sp-page" style="color: #ddd; margin-top: -20px; background: rgba(176, 15, 15,0.6); ">' + item3.CTYPEMODEL_NAME + '</div>' +
  636. '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
  637. '</div>';
  638. set_mainModule_all += set_mainModule;
  639. }
  640. });
  641. var set_class = item2.colClass;
  642. var set_layerColPart = '<div class="sp-pl-15 sp-pr-15 layer-col-part ' + set_class + '" data-col="' + set_class + '">' +
  643. '<div class="main-title" ng-title >' + item2.colName + '</div>' +
  644. '<div class="module-box module-box-left ui-sortable" style="border:1px solid #ddd; min-height:222px;" ng-sort>' +
  645. '' + set_mainModule_all + '' +
  646. '</div>' +
  647. '<div class="module-box-delete" ng-click="ctl.btnDeleteCol()"><i class="fa fa-trash"> </i> 删除</div>' +
  648. '</div>';
  649. //console.log(set_layerColPart);
  650. set_layerColPart_all += set_layerColPart;
  651. });
  652. var set_row = '<div class="row">' + set_layerColPart_all + '</div>';
  653. //console.log(set_row);
  654. set_row_all += set_row;
  655. });
  656. $("#layerLeftSortArea").append($compile(set_row_all)($scope));
  657. }
  658. ////////初始化----拼接 自定义桌面-设置弹出层--左侧的初始化---zyg---end--20230505
  659. ////加载插件列表*****************************************************************************************
  660. self.pluginArray_all = [];///全部
  661. self.pluginArray = [];///经过过滤
  662. self.getPluginData = function () {
  663. self.pluginArray_all = [];///全部
  664. self.pluginArray = [];///经过过滤
  665. var postData = {
  666. "dtype": "",
  667. "kinds": "",
  668. "imagemark": false
  669. };
  670. ///为了演示
  671. $http.post(apiurljs.login + "g2app/plugin/queryDataListWithCtypemodel", { data: s4.encryptData_CBC(JSON.stringify(postData)) }, postCfg)
  672. .success(function (obj) {
  673. //var res = strToJson(s4.decryptData_CBC(obj.data));
  674. var res = obj.data;
  675. if (sp.isval(res)) {
  676. if (sp.isval(res["满宽适应"])) {
  677. angular.forEach(res["满宽适应"], function (item) {
  678. item.CTYPEMODEL_NAME = "满宽适应";
  679. self.pluginArray.push(item);
  680. });
  681. }
  682. if (sp.isval(res["二分之一"])) {
  683. angular.forEach(res["二分之一"], function (item) {
  684. item.CTYPEMODEL_NAME = "二分之一";
  685. self.pluginArray.push(item);
  686. });
  687. }
  688. if (sp.isval(res["四分之一"])) {
  689. angular.forEach(res["四分之一"], function (item) {
  690. item.CTYPEMODEL_NAME = "四分之一";
  691. self.pluginArray.push(item);
  692. });
  693. }
  694. angular.forEach(self.pluginArray, function (item, index) {
  695. item.indexnum = index;
  696. item.hasUse = false;
  697. if (sp.isval(item.IMAGESMALL) && item.IMAGESMALL != "XXXXX") {
  698. item.IMAGESMALL_set = item.IMAGESMALL;
  699. } else {
  700. item.IMAGESMALL_set = "image/upimg.jpg";
  701. }
  702. });
  703. self.pluginArray_all = self.pluginArray;///全部
  704. ///将已选中的插件过滤掉
  705. if (sp.isval(self.querySetArray)) {
  706. var set_hasUseArray = [];
  707. angular.forEach(self.querySetArray, function (item) {
  708. angular.forEach(item.row, function (item2) {
  709. angular.forEach(item2.data, function (item3) {
  710. if (item3.moduleType == "1") {
  711. set_hasUseArray.push(item3);
  712. }
  713. });
  714. });
  715. });
  716. angular.forEach(self.pluginArray, function (item4, index4) {
  717. angular.forEach(set_hasUseArray, function (item2, index2) {
  718. if (item4.PGCODE == item2.PGCODE) {
  719. //$("#layerRight_ApplayParts")
  720. item4.hasUse = true;
  721. }
  722. });
  723. });
  724. }
  725. //console.log(JSON.stringify(self.pluginArray));
  726. $("#layerRight_PlginParts").html("");
  727. var set_rhtModule_all = "";
  728. angular.forEach(self.pluginArray, function (item4, index4) {
  729. if (!item4.hasUse) {
  730. var set_rhtModule = '<div class="main-module rgh-plugin-col" data-modeuletype="1" data-pgcode="' + item4.PGCODE + '" data-widthratio="' + item4.CTYPEMODEL_NAME + '">' +
  731. '<img src="' + item4.IMAGESMALL_set + '" />' +
  732. '<div class="sp-page sp-color-white" style="margin-top: -40px; background: rgba(176, 15, 15,0.6);">' + item4.CNAME + '</div>' +
  733. '<div class="sp-page" style="color: #ddd; margin-top: -20px; background: rgba(176, 15, 15,0.6); ">' + item4.CTYPEMODEL_NAME + '</div>' +
  734. '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
  735. '</div>';
  736. //console.log(set_rhtModule);
  737. set_rhtModule_all += set_rhtModule;
  738. }
  739. });
  740. var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
  741. $("#layerRight_PlginParts").append($compile(append_rgh)($scope));
  742. //$scope.$apply(self.pluginArray);
  743. } else {
  744. self.pluginArray = [];
  745. }
  746. });
  747. };
  748. ////保存设置---
  749. self.btnSaveSetting_title = "保 存";
  750. self.btnSaveSetting = function () {
  751. if ($("#layerLeftSortArea").find(".row").length > 0) {
  752. self.btnSaveSetting_title = "请稍等,正在保存中..";
  753. var row_array = [];
  754. $("#layerLeftSortArea").find(".row").each(function () {
  755. var total_json = [];
  756. $(this).find(".layer-col-part").each(function () {
  757. var colClass = $(this).attr("data-col");
  758. var colName = $(this).find(".main-title").text();
  759. var set_data_json = [];
  760. $(this).find(".main-module").each(function () {
  761. var get_modeuletype = $(this).attr("data-modeuletype");
  762. //console.log(get_modeuletype);
  763. if (get_modeuletype == "0") {
  764. var get_pkid = $(this).attr("data-pkid");
  765. angular.forEach(self.allMenu, function (item2) {
  766. if (item2.PKID == get_pkid) {
  767. var boxjson = {
  768. "moduleType": get_modeuletype,
  769. "PKID": get_pkid,
  770. "CNAME": item2.CNAME,
  771. "FILEN": item2.FILEN,
  772. "SRCIMG": item2.SRCIMG,
  773. "SRCIMG32": item2.SRCIMG32
  774. }
  775. set_data_json.push(boxjson);
  776. }
  777. })
  778. } else {
  779. var get_pgcode = $(this).attr("data-pgcode");
  780. angular.forEach(self.pluginArray_all, function (item2) {
  781. //console.log(item2.PGCODE);
  782. if (item2.PGCODE == get_pgcode) {
  783. var boxjson = {
  784. "ID": item2.ID,
  785. "moduleType": get_modeuletype,
  786. "CTYPEMODEL": item2.CTYPEMODEL,
  787. "CNAME": item2.CNAME,
  788. "IMAGESMALL": "",
  789. "URL": item2.URL,
  790. "PGCODE": item2.PGCODE
  791. }
  792. set_data_json.push(boxjson);
  793. }
  794. })
  795. }
  796. })
  797. //console.log(JSON.stringify(set_data_json));
  798. var set_part_json = {
  799. "colClass": colClass,
  800. "colName": colName,
  801. "data": set_data_json
  802. }
  803. total_json.push(set_part_json);
  804. });
  805. var set_total_json = {
  806. "row": total_json
  807. }
  808. row_array.push(set_total_json);
  809. });
  810. //console.log(JSON.stringify(row_array));
  811. $timeout(function () {
  812. var postData = {
  813. "userid": self.userId,
  814. "data": s4.encryptData_CBC(JSON.stringify(row_array))
  815. }
  816. ///console.log(JSON.stringify(postData));
  817. $http.post(apiurljs.login + "g2work/desktop/saveDataUserDefaultData", JSON.stringify(postData), postCfg)
  818. .success(function (obj) {
  819. //var res = strToJson(s4.decryptData_CBC(obj.data));
  820. ///{"message":"数据检索成功。","code":0,"data":1,"success":true}
  821. //console.log(JSON.stringify(obj));
  822. var res = obj;
  823. if (res.success) {
  824. self.querySettingByUserid();
  825. sp.closeCenter("#layer_setting");
  826. } else {
  827. alert(res.message);
  828. }
  829. self.btnSaveSetting_title = "保 存";
  830. });
  831. }, 100);
  832. } else {
  833. alert("您好,布局不能为空!");
  834. }
  835. };
  836. ////关闭设置
  837. self.btnCloseSetting = function () {
  838. self.btnSaveSetting_title = "保 存";
  839. sp.closeCenter("#layer_setting");
  840. };
  841. ////
  842. self.btnClickPkModule = function (itemdata) {
  843. //console.log(itemdata.FILEN);
  844. if (itemdata.FILEN == "") {
  845. sp.dialog("功能开发中!");
  846. return
  847. }
  848. //window.location.href = "../../"+itemdata.FILEN;
  849. window.parent.jumpPageParent(itemdata.PKID, itemdata.CNAME, itemdata.FILEN);
  850. };
  851. ////恢复缺省设置
  852. self.leftBtnRestoreInit = function () {
  853. if (confirm("您确定要恢复缺省设置吗?")) {
  854. var postData = {
  855. "userid": self.userId
  856. }
  857. $http.post(apiurljs.login + "g2work/desktop/createDataUserDefaultData", JSON.stringify(postData), postCfg)
  858. .success(function (obj) {
  859. var res = obj;
  860. //console.log(JSON.stringify(obj))
  861. if (res.success) {
  862. var defaultData = strToJson(s4.decryptData_CBC(res.data));
  863. //console.log(JSON.stringify(defaultData));
  864. ///////
  865. var set_hasUseArray = [];
  866. angular.forEach(defaultData, function (item) {
  867. angular.forEach(item.row, function (item2) {
  868. angular.forEach(item2.data, function (item3) {
  869. set_hasUseArray.push(item3);
  870. if (item3.moduleType == "1") {
  871. var postData_2 = {
  872. "id": item3.ID
  873. }
  874. $http.post(apiurljs.login + "g2app/plugin/queryData", JSON.stringify(postData_2), postCfg)
  875. .success(function (obj2) {
  876. item3.IMAGESMALL = obj2.data.IMAGESMALL;
  877. if (sp.isval(item3.IMAGESMALL) && item3.IMAGESMALL != "XXXXX") {
  878. item3.IMAGESMALL_set = item3.IMAGESMALL;
  879. } else {
  880. item3.IMAGESMALL_set = "image/upimg.jpg";
  881. }
  882. });
  883. }
  884. });
  885. });
  886. });
  887. $timeout(function () {
  888. ////////初始化----拼接 自定义桌面-设置弹出层--左侧的初始化---zyg---start--20230505
  889. self.init_layerLeftSortArea(defaultData);
  890. }, 1000);
  891. ///右侧--应用功能---start
  892. angular.forEach(self.allMenu, function (item4, index4) {
  893. item4.hasUse = false;
  894. angular.forEach(set_hasUseArray, function (item2, index2) {
  895. if (item4.PKID == item2.PKID) {
  896. //$("#layerRight_ApplayParts")
  897. item4.hasUse = true;
  898. }
  899. });
  900. });
  901. $("#layerRight_ApplayParts").html("");
  902. var set_rhtModule_all = "";
  903. angular.forEach(self.allMenu, function (item4, index4) {
  904. if (!item4.hasUse) {
  905. var set_rhtModule = '<div class="main-module" data-modeuletype="0" data-pkid="' + item4.PKID + '" style="background:' + self.colorArray[index4] + '">' +
  906. //'<span class="gmt-number" ng-show="!!item.CONTENT_TOTAL" ng-bind="item.CONTENT_TOTAL || 0"></span>'+
  907. '<img src="../../js/indexTwo/img/' + item4.SRCIMG + '.png" alt="' + item4.CNAME + '">' +
  908. '<p class="sp-text-ellipsis">' + item4.CNAME + '</p>' +
  909. '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
  910. '</div>'
  911. //console.log(set_rhtModule);
  912. set_rhtModule_all += set_rhtModule;
  913. }
  914. });
  915. //console.log(set_rhtModule_all);
  916. var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
  917. $("#layerRight_ApplayParts").append($compile(append_rgh)($scope));
  918. ///右侧--应用功能---end
  919. ///右侧--插件--start--zyg
  920. angular.forEach(self.pluginArray, function (item4, index4) {
  921. item4.hasUse = false;
  922. angular.forEach(set_hasUseArray, function (item2, index2) {
  923. if (item4.PGCODE == item2.PGCODE) {
  924. //$("#layerRight_ApplayParts")
  925. item4.hasUse = true;
  926. }
  927. });
  928. });
  929. $("#layerRight_PlginParts").html("");
  930. var set_rhtModule_all = "";
  931. angular.forEach(self.pluginArray, function (item4, index4) {
  932. if (!item4.hasUse) {
  933. var set_rhtModule = '<div class="main-module rgh-plugin-col" data-modeuletype="1" data-pgcode="' + item4.PGCODE + '" data-widthratio="' + item4.CTYPEMODEL_NAME + '">' +
  934. '<img src="' + item4.IMAGESMALL_set + '" />' +
  935. '<div class="sp-page sp-color-white" style="margin-top: -40px; background: rgba(176, 15, 15,0.6);">' + item4.CNAME + '</div>' +
  936. '<div class="sp-page" style="color: #ddd; margin-top: -20px; background: rgba(176, 15, 15,0.6); ">' + item4.CTYPEMODEL_NAME + '</div>' +
  937. '<div class="logo-del" title="删除" ng-click="ctl.btnDelSingle()"><i class="fa fa-trash"></i></div>' +
  938. '</div>';
  939. //console.log(set_rhtModule);
  940. set_rhtModule_all += set_rhtModule;
  941. }
  942. });
  943. var append_rgh = '<div class="module-box module-box-right ui-sortable" ng-sort>' + set_rhtModule_all + '</div>';
  944. $("#layerRight_PlginParts").append($compile(append_rgh)($scope));
  945. ///右侧--插件--end--zyg
  946. }
  947. });
  948. }
  949. }
  950. }]);
  951. ///拖拽范围
  952. app.directive('ngSort', function () {
  953. return {
  954. link: function (scope, element, attrs) {
  955. $(element).sortable({
  956. containment: ".sp-layer2-body", //约束排序动作只能在一个指定的范围内发生。
  957. connectWith: ".module-box",////允许sortable对象连接另一个sortable对象,可将item元素拖拽到另一个中
  958. cursor: "move",
  959. placeholder: 'ui-sort-placeholder',
  960. beforeStop: function (event, ui) {
  961. //console.log(ui);
  962. //console.log(ui.item);
  963. ///这是当前拖放子元素
  964. var get_ui_modeuletype = ui.item.context.dataset.modeuletype;
  965. ///这是当前拖放子元素
  966. var get_ui_item_parent = $(ui.item).parent();
  967. var get_classCol = get_ui_item_parent.parent().attr("data-col");
  968. //console.log(get_classCol);
  969. if (get_ui_modeuletype == 0) {
  970. ///判断应用功能属性
  971. var set_siblingModuleType = -1;
  972. get_ui_item_parent.find(".main-module").each(function () {
  973. if ($(this).attr('data-modeuletype') == 1) {
  974. set_siblingModuleType = 1;
  975. }
  976. });
  977. if (set_siblingModuleType == 1) {
  978. alert("您好,应用功能、桌面插件,不能占用同一个区域");
  979. return false;
  980. }
  981. ////判断 区域和 插件、功能对应关系--20230502--zyg--srart
  982. if (get_classCol == "col-sm-12") {
  983. alert('你好,“应用功能”只能拖放在“二分之一”区域中');
  984. return false;
  985. }
  986. if (get_classCol == "col-sm-3") {
  987. alert('你好,“应用功能”只能拖放在“二分之一”区域中');
  988. return false;
  989. }
  990. ////判断 区域和 插件、功能对应关系--20230502--zyg--end
  991. }
  992. if (get_ui_modeuletype == 1) {
  993. ///判断桌面插件属性
  994. var set_siblingModuleType = -1;
  995. get_ui_item_parent.find(".main-module").each(function () {
  996. if ($(this).attr('data-modeuletype') == 0) {
  997. set_siblingModuleType = 0;
  998. }
  999. });
  1000. if (set_siblingModuleType == 0) {
  1001. alert("您好,桌面插件、应用功能,不能占用同一个区域");
  1002. return false;
  1003. }
  1004. ////判断 区域和 插件、功能对应关系--20230502--zyg--srart
  1005. var get_widthratio = ui.item.context.dataset.widthratio;
  1006. //console.log(get_widthratio);
  1007. if (get_widthratio == "满宽适应") {
  1008. if (get_classCol != "col-sm-12") {
  1009. alert('你好,“桌面插件-满宽适应”只能拖放在“满宽适应”区域中');
  1010. return false;
  1011. }
  1012. }
  1013. if (get_widthratio == "二分之一") {
  1014. if (get_classCol != "col-sm-6") {
  1015. alert('你好,“桌面插件-二分之一”只能拖放在“二分之一”区域中');
  1016. return false;
  1017. }
  1018. }
  1019. if (get_widthratio == "四分之一") {
  1020. if (get_classCol != "col-sm-3") {
  1021. alert('你好,“桌面插件-四分之一”只能拖放在“四分之一”区域中');
  1022. return false;
  1023. }
  1024. }
  1025. ////判断 区域和 插件、功能对应关系--20230502--zyg--end
  1026. }
  1027. //console.log(scope.ctl.allMenu);
  1028. scope.ctl.allMenu.forEach(function (item) {
  1029. item.hasUse = false;
  1030. });
  1031. scope.ctl.pluginArray.forEach(function (item) {
  1032. item.hasUse = false;
  1033. });
  1034. $("#layerLeftSortArea").find(".main-module").each(function () {
  1035. if ($(this).attr("data-modeuletype") == "0") {
  1036. var get_pkid = $(this).attr("data-pkid");
  1037. //console.log(get_pkid);
  1038. scope.ctl.allMenu.forEach(function (item) {
  1039. if (item.PKID == get_pkid) {
  1040. item.hasUse = true;
  1041. }
  1042. });
  1043. } else {
  1044. var get_pgcode = $(this).attr("data-pgcode");
  1045. //console.log(get_pkid);
  1046. scope.ctl.pluginArray.forEach(function (item) {
  1047. if (item.PGCODE == get_pgcode) {
  1048. item.hasUse = true;
  1049. }
  1050. });
  1051. }
  1052. });
  1053. scope.$apply();
  1054. //console.log(JSON.stringify(scope.ctl.allMenu));
  1055. //console.log(JSON.stringify(scope.ctl.pluginArray));
  1056. }
  1057. }).disableSelection(); //禁用选择拖拽目标里的内容
  1058. }
  1059. }
  1060. })
  1061. // 点击编辑标题 ng-title
  1062. app.directive('ngTitle', function () {
  1063. return {
  1064. link: function (scope, element, attrs) {
  1065. $(element).click(function () {
  1066. if ($(element).children('input').length != 0) {
  1067. return false;
  1068. }
  1069. var str = $(element).html();
  1070. str = '<input type="text" value="' + str + '">';
  1071. $(element).html(str);
  1072. $(element).children('input').select();
  1073. var input = $(element).children('input');
  1074. var submit = function () {
  1075. var val = $(element).children('input').val();
  1076. $(element).html(val);
  1077. }
  1078. input.blur(submit).keydown(function (event) {
  1079. if (event.keyCode == 13) {
  1080. submit();
  1081. }
  1082. });
  1083. });
  1084. }
  1085. }
  1086. });
  1087. app.filter('trustAsResourceUrl', ['$sce', function ($sce) {
  1088. return function (val) {
  1089. return $sce.trustAsResourceUrl(val);
  1090. };
  1091. }])