setFlow.js 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. 'use strict';
  2. var app = angular.module('app', ["angularUtils.directives.dirPagination"]);
  3. app.controller("appCtrl", ["$scope", "$http", "$compile", "$timeout", function ($scope, $http, $compile, $timeout) {
  4. var self = this;
  5. var s4 = new SM4Util();
  6. self.userId = $.cookie("GlWorkPlatform-userid");
  7. self.ushowname = $.cookie("GlWorkPlatform-username");
  8. self.userCName = $.cookie("GlWorkPlatform-chineseName");
  9. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  10. self.userTypeEng = $.cookie("GlWorkPlatform-userTypeEng");
  11. var postCfg = {
  12. headers: {
  13. 'Content-Type': 'application/json',
  14. 'Authorization': "Bearer " + self.get_AccessToken
  15. }
  16. };
  17. self.loading = false;
  18. $(".windowHeight1").css("max-height", window.innerHeight - 60)
  19. $(".windowHeight2").css("max-height", window.innerHeight - 99)
  20. //获取传阅人员组织结构
  21. self.getChuanYueUser = function () {
  22. var data = {
  23. code: "AA"
  24. }
  25. $http.post(apiurljs.login + "g2app/calendar/querySect", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  26. .success(function (obj) {
  27. var res = strToJson(s4.decryptData_CBC(obj.data));
  28. $.each(res.data[0].C_H_I_L_D, function (index, item) {
  29. item.isChecked = false;
  30. item.showFlag = true;
  31. $.each(item.C_H_I_L_D_DATA, function (index2, item2) {
  32. item2.isChecked = false;
  33. })
  34. $.each(item.C_H_I_L_D, function (index3, item3) {
  35. item3.isChecked = false;
  36. item3.showFlag = true;
  37. $.each(item3.C_H_I_L_D_DATA, function (index4, item4) {
  38. item4.isChecked = false;
  39. })
  40. $.each(item3.C_H_I_L_D, function (index5, item5) {
  41. item5.isChecked = false;
  42. item5.showFlag = true;
  43. $.each(item5.C_H_I_L_D_DATA, function (index6, item6) {
  44. item6.isChecked = false;
  45. })
  46. })
  47. })
  48. })
  49. self.personList = res.data[0].C_H_I_L_D;
  50. self.getFlowData()
  51. })
  52. }
  53. self.getChuanYueUser()
  54. self.thisItem = null;
  55. self.itemClicked = function ($item) {
  56. self.thisItem = $item;
  57. self.getFlowData();
  58. };
  59. self.getFlowData = function () {
  60. self.list = [];
  61. self.loading = true;
  62. if (!self.thisItem) {
  63. self.loading = false;
  64. self.noDataTip = 0;
  65. return;
  66. }
  67. var data = {
  68. tablename: "DESK_CUSTOM",
  69. sqlwhere: {
  70. USERID: self.thisItem.userid
  71. },
  72. sqlorwhere: {},
  73. sqlinwhere: {},
  74. sqllikewhere: {},
  75. colums: "*",
  76. order: "SORTID"
  77. }
  78. $http.post(apiurljs.login + "g2app/DangJian/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  79. .success(function (obj) {
  80. var res = strToJson(s4.decryptData_CBC(obj.data));
  81. self.loading = false;
  82. if (res.success) {
  83. if (sp.isval(res.data)) {
  84. self.list = res.data;
  85. self.noDataTip = 1;
  86. } else {
  87. self.list = [];
  88. self.noDataTip = 0;
  89. }
  90. } else {
  91. sp.dialog(res.message);
  92. }
  93. })
  94. .error(function (XMLHttpRequest, textStatus, errorThrown) {
  95. if (textStatus != 200) {
  96. self.loading = false;
  97. }
  98. })
  99. };
  100. self.btnShowMark = function (item, mark) {
  101. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  102. var dialogBody = "<div class=\"sp-dialog-body\">确定要" + (mark == 0 ? "隐藏" : "显示") + "吗?</div>";
  103. var dialogFoot = "<div class=\"sp-dialog-foot\"><input id='btnDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
  104. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  105. sp.openCenter(".sp-dialog");
  106. ///取消按钮
  107. $('.sp-closeDialog').click(function (event) {
  108. sp.closeCenter(".sp-dialog");
  109. event.preventDefault(); event.stopPropagation();
  110. });
  111. //post消息的id
  112. $("#btnDataTrue").click(function () {
  113. var data = {
  114. id: item.ID,
  115. tablename: "DESK_CUSTOM",
  116. data: {
  117. SHOWMARK: mark
  118. }
  119. }
  120. $http.post(apiurljs.login + "g2app/DangJian/upFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  121. .success(function (obj) {
  122. var res = strToJson(s4.decryptData_CBC(obj.data));
  123. if (res.success) {
  124. self.getFlowData();
  125. sp.dialoghide();
  126. } else {
  127. sp.dialog(res.message);
  128. }
  129. })
  130. })
  131. }
  132. ////排序
  133. self.btnSort1 = function ($index, tip) {
  134. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  135. var dialogBody = "<div class=\"sp-dialog-body\">确定要" + tip + "吗?</div>";
  136. var dialogFoot = "<div class=\"sp-dialog-foot\"><input id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
  137. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  138. sp.openCenter(".sp-dialog");
  139. ///取消按钮
  140. $('.sp-closeDialog').click(function (event) {
  141. sp.closeCenter(".sp-dialog");
  142. event.preventDefault(); event.stopPropagation();
  143. });
  144. //post消息的id
  145. $("#delDataTrue").click(function () {
  146. if (tip == "上移") {
  147. var data = {
  148. moveid: self.list[$index].ID,
  149. movedata: { SORTID: self.list[$index].SORTID },
  150. otherid: self.list[$index - 1].ID,
  151. otherdata: { SORTID: self.list[$index - 1].SORTID },
  152. tablename: "DESK_CUSTOM"
  153. }
  154. } else {
  155. var data = {
  156. moveid: self.list[$index].ID,
  157. movedata: { SORTID: self.list[$index].SORTID },
  158. otherid: self.list[$index + 1].ID,
  159. otherdata: { SORTID: self.list[$index + 1].SORTID },
  160. tablename: "DESK_CUSTOM"
  161. }
  162. }
  163. $http.post(apiurljs.login + "g2app/JiXiao/MoveSort", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  164. .success(function (obj) {
  165. var res = strToJson(s4.decryptData_CBC(obj.data));
  166. if (res.success) {
  167. self.getFlowData();
  168. sp.dialoghide();
  169. } else {
  170. sp.dialog(res.message);
  171. }
  172. });
  173. });
  174. }
  175. self.btnSort2 = function (item, n) {
  176. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  177. var dialogBody = "<div class=\"sp-dialog-body\">确定要移至" + (n == 0 ? "首位" : "末位") + "吗?</div>";
  178. var dialogFoot = "<div class=\"sp-dialog-foot\"><input id='delDataTrue' type='button' value='确 认' class='sp-dialog-btnTrue' /><input type='button' value='取 消' class='sp-dialog-btnCancle sp-closeDialog' /></div>";
  179. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  180. sp.openCenter(".sp-dialog");
  181. ///取消按钮
  182. $('.sp-closeDialog').click(function (event) {
  183. sp.closeCenter(".sp-dialog");
  184. event.preventDefault(); event.stopPropagation();
  185. });
  186. //post消息的id
  187. $("#delDataTrue").click(function () {
  188. var data = {
  189. id: item.ID,
  190. tablename: "DESK_CUSTOM",
  191. movesortid: item.SORTID,
  192. userid: item.USERID,
  193. mark: n
  194. }
  195. $http.post(apiurljs.login + "g2work/deskcustom/MoveSW", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  196. .success(function (obj) {
  197. var res = strToJson(s4.decryptData_CBC(obj.data));
  198. if (res.success) {
  199. self.getFlowData();
  200. sp.dialoghide();
  201. } else {
  202. sp.dialog(res.message);
  203. }
  204. });
  205. });
  206. }
  207. }])