index_2.js 66 KB

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