detail.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. 'use strict';
  2. var app = angular.module('app', [
  3. ]);
  4. app.controller("formeditCtrl", ["$scope", "$http", "$timeout", "$sce", function ($scope, $http, $timeout, $sce) {
  5. var self = this;
  6. var s4 = new SM4Util();
  7. self.userId = $.cookie("GlWorkPlatform-userid");
  8. self.userName = $.cookie("GlWorkPlatform-chineseName");
  9. self.get_AccessToken = localStorage.getItem("GlWorkPlatform-AccessToken");
  10. self.routeinfoid = sp.getUrlName("routeinfoid");
  11. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  12. var postCfg = {
  13. headers: {
  14. 'Content-Type': 'application/json',
  15. 'Authorization': "Bearer " + self.get_AccessToken
  16. }
  17. };
  18. self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
  19. self.downLoad = function (item) {
  20. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  21. }
  22. self.goAttach = function (obj) {
  23. if (obj) {
  24. if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
  25. sp.dialog("文件暂不支持在线预览,请点击下载查看!")
  26. return
  27. }
  28. $("#attachlist")[0].contentWindow.openFile(obj)
  29. if ($(".fa-chevron-down").is(":hidden") == true) {
  30. showToggle(document.getElementById("toggleButton"))
  31. }
  32. } else {
  33. $("#attachlist").attr("src", "PHD/attachlist.html?page=formedit&routeinfoid=" + self.routeinfoid)
  34. }
  35. }
  36. self.getJJQK = function () {
  37. var data = {
  38. tablename: "CODE_EMERGENCY"
  39. }
  40. $http.post(apiurljs.login + "g2app/dataabase/queryCodeData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  41. .success(function (obj) {
  42. var res = strToJson(s4.decryptData_CBC(obj.data));
  43. self.JJCD = res.data;
  44. self.getData()
  45. })
  46. }
  47. self.getJJQK()
  48. //获取数据
  49. self.getData = function () {
  50. var data = {
  51. tablename: "SX_PHD",
  52. colums: "*",
  53. order: "ID",
  54. sqlwhere: {
  55. ROUTEINFOID: self.routeinfoid
  56. },
  57. sqlinwhere: "",
  58. sqllikewhere: ""
  59. }
  60. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  61. .success(function (obj) {
  62. var res = strToJson(s4.decryptData_CBC(obj.data));
  63. self.data = {
  64. ID: res.data[0].ID,
  65. APPCODE: res.data[0].APPCODE,
  66. JJCD: res.data[0].JJCD,
  67. BH: res.data[0].BH,
  68. HYZZDW: res.data[0].HYZZDW,
  69. HYRQ: sp.datefmt("yyyy-MM-dd HH:mm", res.data[0].HYRQ),
  70. ZCR: res.data[0].ZCR,
  71. CHLD: res.data[0].CHLD,
  72. HYMC: res.data[0].HYMC,
  73. HYDD: res.data[0].HYDD,
  74. BZ: res.data[0].BZ,
  75. }
  76. self.getOpinion("BGSNCHYJ")
  77. self.getOpinion("WLDYJ")
  78. self.getOpinion("CSCHYJ")
  79. self.getOpinion1()
  80. self.getOther()
  81. self.getGCG()
  82. })
  83. }
  84. //获取附件和插件
  85. self.getOther = function () {
  86. var data = {
  87. tablename: "FILE_ATTACH",
  88. colums: "*",
  89. order: "ID desc",
  90. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  91. sqlinwhere: "",
  92. sqllikewhere: ""
  93. }
  94. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  95. .success(function (obj) {
  96. var res = strToJson(s4.decryptData_CBC(obj.data));
  97. self.arrayFile1 = [];
  98. if (res.data.length > 0) {
  99. res.data.forEach(function (item) {
  100. if (item.ATTACHTYPE.indexOf("-正文") == -1) {
  101. self.arrayFile1.push(item)
  102. }
  103. })
  104. self.goAttach()
  105. }
  106. })
  107. }
  108. //发文打开过程稿在线编辑
  109. self.getGCG = function () {
  110. var data = {
  111. dockind: "D01",
  112. routeinfoid: self.routeinfoid
  113. }
  114. $http.post(apiurljs.login + "g2app/fawenfiles/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  115. .success(function (obj) {
  116. var res = strToJson(s4.decryptData_CBC(obj.data));
  117. self.gaoTypeArrayFirst = res.data;
  118. })
  119. }
  120. self.YJ = {
  121. BGSNCHYJ: [],
  122. WLDYJ: [],
  123. CSCHYJ: [],
  124. nulla: []
  125. }
  126. //获取意见
  127. self.getOpinion = function (str) {
  128. var data = {
  129. cmanid: self.userId,
  130. routeinfoid: self.routeinfoid,
  131. routeid: "",
  132. tableid: "SX_PHD",
  133. colid: str,
  134. opiniontype: 0,
  135. orderbycol: "CDATE desc"
  136. }
  137. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  138. .success(function (obj) {
  139. var res = strToJson(s4.decryptData_CBC(obj.data));
  140. if (res.success == true) {
  141. self.YJ[str] = res.data;
  142. self.YJ[str + "STATUS"] = false;
  143. self.YJ[str].forEach(function (item) {
  144. item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
  145. })
  146. } else {
  147. sp.dialog(res.message)
  148. }
  149. })
  150. }
  151. //获取意见(不上表)
  152. self.opiniontype = 99;
  153. self.getOpinion1 = function () {
  154. var data = {
  155. cmanid: self.userId,
  156. routeinfoid: self.routeinfoid,
  157. routeid: "",
  158. tableid: "SX_PHD",
  159. colid: "",
  160. opiniontype: self.opiniontype,
  161. orderbycol: "CDATE desc"
  162. }
  163. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { 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 == true) {
  167. self.YJ.nulla = res.data;
  168. self.YJ.nullaSTATUS = false;
  169. self.YJ.nulla.forEach(function (item) {
  170. item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
  171. })
  172. } else {
  173. sp.dialog(res.message)
  174. }
  175. })
  176. }
  177. self.reSizeRow = function () {
  178. var bodybox = document.getElementById("bodyDiv");
  179. var topbox = document.getElementById("topDiv");
  180. var bottombox = document.getElementById("bottomDiv");
  181. var line = document.getElementById("lineDiv");
  182. document.getElementById("lineDiv").addEventListener("mousedown", function (event) {
  183. $(".mousemove").show()
  184. var bodyboxH = bodybox.clientHeight;
  185. var topboxH = topbox.clientHeight;
  186. var bottomboxH = bottombox.clientHeight;
  187. //var y = event.pageY - line.offsetTop;
  188. var y = event.pageY - line.clientHeight;
  189. document.addEventListener("mousemove", boxMove)
  190. function boxMove(event) {
  191. if (topboxH * 1 + (event.pageY - y) * 1 - 36 <= 45) {
  192. //
  193. } else if (bottomboxH * 1 - (event.pageY - y) * 1 - 36 <= 45) {
  194. //
  195. } else {
  196. topbox.style.height = topboxH * 1 + (event.pageY - y) * 1 - 36 + "px";
  197. //topbox.getElementsByTagName("iframe")[0].style.height = topboxH * 1 + (event.pageY - y) * 1 - 45 + "px";
  198. bottombox.style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 + "px";
  199. bottombox.getElementsByTagName("iframe")[0].style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 - 25 + "px";
  200. }
  201. }
  202. document.addEventListener("mouseup", function () {
  203. $(".mousemove").hide()
  204. document.removeEventListener("mousemove", boxMove)
  205. })
  206. })
  207. }
  208. ////头部关键字搜索---20230905
  209. self.headBtnSearchKeyword = "";
  210. self.headSearchResult = [];
  211. self.headSearchResult_view = false;
  212. self.headBtnSearch = function () {
  213. if (sp.isval(self.headBtnSearchKeyword)) {
  214. self.headSearchResult = [];
  215. var data = {
  216. "url": "/basic/api/StatSelect/selectCodeList",
  217. "data": { "keyWord": self.headBtnSearchKeyword }
  218. }
  219. //console.log(JSON.stringify(data));
  220. $http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  221. .success(function (obj) {
  222. var res = strToJson(s4.decryptData_CBC(obj.data));
  223. //console.log(JSON.stringify(res.data));
  224. self.headSearchResult = res.data.build;
  225. if (sp.isval(self.headSearchResult)) {
  226. self.headSearchResult_view = true;
  227. } else {
  228. self.headSearchResult_view = false;
  229. }
  230. })
  231. } else {
  232. self.headSearchResult_view = false;
  233. }
  234. };
  235. self.headKeywordPage = function (itemdata) {
  236. var get_token = localStorage.getItem("main-token");
  237. var set_url = apiurljs.onePic + "wholeProcessPage/?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id;
  238. $('#attachlist')[0].contentWindow.openTool(set_url, '一张图');
  239. self.headSearchResult_view = false;
  240. };
  241. self.onePic = function () {
  242. $('#attachlist')[0].contentWindow.openTool(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索")
  243. }
  244. //头部下滚冻结
  245. $(function () {
  246. $(".sp-page-center").eq(0).css("max-height", $("#topDiv").height()).css("height", $("#topDiv").height())
  247. $(".formedit center").css("height", $(".formedit center").next("div").height()).css("line-height", $(".formedit center").next("div").height() / 6 + "px")
  248. //页面高度撑满
  249. setTimeout(function () {
  250. if ($(".ibox-content").height() < $(window).height() - 31) {
  251. $(".ibox-content").css("height", $(window).height() - 31)
  252. }
  253. $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
  254. }, 1)
  255. })
  256. }])
  257. app.filter('trustHtml', function ($sce) {
  258. return function (input) {
  259. return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, '&nbsp;'));
  260. };
  261. });
  262. var parentData = {}
  263. function getData() {
  264. parentData = angular.element(document.getElementById("app")).scope().data
  265. return parentData
  266. }
  267. function showToggle(e) {
  268. $(e).children().toggle()
  269. $(e).next().toggle()
  270. }
  271. function toggleYJL(e) {
  272. if ($(e).children(".fa-angle-double-down").is(":hidden") == true) {
  273. $("#topDiv").css("height", 160)
  274. $(e).parent().css("height", 450)
  275. $("#attachlist").css("height", 200)
  276. $("#bottomDiv").css("height", "")
  277. } else {
  278. $("#topDiv").css("height", 600)
  279. $(e).parent().css("height", 10)
  280. }
  281. $(e).children().toggle()
  282. }