formedit.js 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460
  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.routeid = sp.getUrlName("routeid");
  11. self.routeinfoid = sp.getUrlName("routeinfoid");
  12. self.copyrightid = sp.getUrlName("copyrightid");
  13. self.directionid = sp.getUrlName("directionid");
  14. self.formeditid = sp.getUrlName("formeditid");
  15. self.mbid = sp.getUrlName("mbid");
  16. self.fjid = sp.getUrlName("fjid");
  17. self.docmode = sp.getUrlName("docmode");
  18. self.dotype = sp.getUrlName("dotype");
  19. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  20. self.get_lastReturnPage = sp.getUrlName("lastReturnPage");
  21. self.get_type = sp.getUrlName("type");
  22. self.return = "../list1.html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type
  23. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  24. var postCfg = {
  25. headers: {
  26. 'Content-Type': 'application/json',
  27. 'Authorization': "Bearer " + self.get_AccessToken
  28. }
  29. };
  30. self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
  31. var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  32. return item.CNAME
  33. })
  34. //上层附件、业务参考、共享沟通组件
  35. self.arrayFile2 = null;
  36. self.arrayFile1 = [];
  37. self.uploading_zw = false;
  38. self.uploading = false;
  39. self.upload_zw = function () {
  40. $('#fileupload-zw').fileupload({
  41. url: apiurljs.login + (self.routeinfoid == 0 ? 'g2app/abase/uploadFileWithFormWithSaveRouteinfo' : 'g2app/abase/uploadFileWithForm'),
  42. dataType: 'json',
  43. beforeSend: function (xhr, data) {
  44. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  45. if (self.routeinfoid == 0) {
  46. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("copyrightid=" + self.copyrightid + ",directionid=" + self.directionid + ",formeditid=" + self.formeditid + ",routeinfoid=" + self.routeinfoid + ",routeid=" + self.routeid + ",tablename=FILE_ATTACH,ATTACHTYPE=领导批示承办单-正文"));
  47. } else {
  48. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=领导批示承办单-正文"));
  49. }
  50. },
  51. add: function (e, data) {
  52. var num = 0;
  53. var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  54. //文件类型判断
  55. $.each(data.originalFiles, function (index, item) {
  56. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  57. sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  58. return;
  59. } else {
  60. num++
  61. }
  62. })
  63. if (num == data.originalFiles.length) {
  64. self.uploading_zw = true;
  65. data.submit();
  66. $scope.$apply();
  67. }
  68. },
  69. // 上传完成后的执行逻辑
  70. done: function (e, data) {
  71. self.uploading_zw = false;
  72. if (self.routeinfoid == 0) {
  73. var res = strToJson(s4.decryptData_CBC(data.result.data));
  74. self.data.ID = res.data2.ID;
  75. self.routeid = res.data2.ROUTEID;
  76. self.routeinfoid = res.data2.ROUTEINFOID;
  77. self.getSwenList(0)
  78. } else {
  79. self.getOther()
  80. }
  81. }
  82. })
  83. }
  84. self.upload3 = function () {
  85. $('#fileupload3').fileupload({
  86. url: apiurljs.login + 'g2app/abase/uploadFileWithForm',
  87. dataType: 'json',
  88. beforeSend: function (xhr, data) {
  89. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  90. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=领导批示承办单"));
  91. },
  92. add: function (e, data) {
  93. var num = 0;
  94. var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  95. //文件类型判断
  96. $.each(data.originalFiles, function (index, item) {
  97. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  98. sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  99. return;
  100. } else {
  101. num++
  102. }
  103. })
  104. if (num == data.originalFiles.length) {
  105. self.uploading = true;
  106. data.submit();
  107. $scope.$apply();
  108. }
  109. },
  110. // 上传完成后的执行逻辑
  111. done: function (e, data) {
  112. self.uploading = false;
  113. self.getOther()
  114. }
  115. })
  116. }
  117. self.downLoad = function (item) {
  118. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  119. }
  120. self.deleteFile = function (file) {
  121. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  122. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  123. 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>";
  124. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  125. sp.openCenter(".sp-dialog");
  126. ///取消按钮
  127. $('.sp-closeDialog').click(function (event) {
  128. sp.closeCenter(".sp-dialog");
  129. event.preventDefault();
  130. event.stopPropagation();
  131. });
  132. //post消息的id
  133. $("#delDataTrue").click(function () {
  134. var data = {
  135. tablename: "FILE_ATTACH",
  136. id: file.ID
  137. };
  138. $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  139. .success(function (obj) {
  140. var res = strToJson(s4.decryptData_CBC(obj.data));
  141. sp.dialoghide();
  142. if (res.success) {
  143. self.getOther();
  144. } else {
  145. sp.dialog("删除失败,请联系管理员!");
  146. }
  147. });
  148. });
  149. }
  150. self.goAttach = function (obj) {
  151. if (obj) {
  152. if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
  153. sp.dialog("文件暂不支持在线预览,请点击下载查看!")
  154. return
  155. }
  156. $("#attachlist")[0].contentWindow.openFile(obj)
  157. if ($(".fa-chevron-down").is(":hidden") == true) {
  158. showToggle(document.getElementById("toggleButton"))
  159. }
  160. } else {
  161. $("#attachlist").attr("src", "attachlist.html?page=formedit&routeinfoid=" + self.routeinfoid)
  162. }
  163. }
  164. //初始化右上角按钮
  165. self.buttonList = []
  166. self.readonly = {
  167. HYSJ: false,
  168. HYDD: false,
  169. CHRY: false,
  170. HYNR: false,
  171. LDYJ: false,
  172. HYWJ: false,
  173. BZ: false,
  174. TBR: false,
  175. XBGZJY: false,
  176. LXFS: false
  177. }
  178. //上传附件
  179. self.arrayFile = [];
  180. self.beforeUpload = function () {
  181. if (self.data.ID == 0) {
  182. var dataArray = [];
  183. dataArray.push(self.data);
  184. var data = {
  185. ckey: "SX_HYFK",
  186. id: self.data.ID,
  187. routeid: self.routeid,
  188. routeinfoid: self.routeinfoid,
  189. routeinfotitle: self.data.HYBT,
  190. directionid: self.directionid,
  191. formeditid: self.formeditid,
  192. data: JSON.stringify(dataArray)
  193. }
  194. $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  195. .success(function (obj) {
  196. var res = strToJson(s4.decryptData_CBC(obj.data));
  197. if (res.code == 0) {
  198. self.data.ID = res.data.ID;
  199. self.routeid = res.data.ROUTEID;
  200. self.routeinfoid = res.data.ROUTEINFOID;
  201. self.getSwenList(1)
  202. self.upload()
  203. } else {
  204. sp.dialog(res.message)
  205. }
  206. })
  207. } else {
  208. self.upload()
  209. }
  210. }
  211. self.upload = function () {
  212. $('#fileupload').fileupload({
  213. url: apiurljs.login + 'g2app/abase/saveUploadFileName',
  214. dataType: 'json',
  215. beforeSend: function (xhr, data) {
  216. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  217. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SX_HYFK,column=HYWJ,routeinfoid=" + self.routeinfoid + ",loaded=" + data.loaded + ",total=" + data.total));
  218. },
  219. add: function (e, data) {
  220. var num = 0;
  221. //文件类型判断
  222. $.each(data.originalFiles, function (index, item) {
  223. if (item['type'].length) {
  224. num++
  225. }
  226. })
  227. if (num == data.originalFiles.length) {
  228. data.submit();
  229. }
  230. },
  231. // 上传完成后的执行逻辑
  232. done: function (e, data) {
  233. var arrayFile = strToJson(s4.decryptData_CBC(data.result.data).slice(0, s4.decryptData_CBC(data.result.data).lastIndexOf("}") + 1))
  234. self.arrayFile = arrayFile.data;
  235. $scope.$apply();//绑定数据局部刷新
  236. }
  237. })
  238. $timeout(function () {
  239. $("#fileupload").trigger("click")
  240. }, 1)
  241. }
  242. self.downLoad = function (item) {
  243. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  244. }
  245. self.deleteFile = function (file) {
  246. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  247. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  248. 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>";
  249. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  250. sp.openCenter(".sp-dialog");
  251. ///取消按钮
  252. $('.sp-closeDialog').click(function (event) {
  253. sp.closeCenter(".sp-dialog");
  254. event.preventDefault();
  255. event.stopPropagation();
  256. });
  257. //post消息的id
  258. $("#delDataTrue").click(function () {
  259. var data = {
  260. tablename: "FILE_ATTACH",
  261. id: file.ID
  262. };
  263. $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  264. .success(function (obj) {
  265. var res = strToJson(s4.decryptData_CBC(obj.data));
  266. sp.dialoghide();
  267. if (res.success) {
  268. self.getOther();
  269. } else {
  270. sp.dialog("删除失败,请联系管理员!");
  271. }
  272. });
  273. });
  274. }
  275. self.goAttach = function (obj) {
  276. if (obj) {
  277. if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
  278. sp.dialog("文件暂不支持在线预览,请点击下载查看!")
  279. return
  280. }
  281. $("#attachlist")[0].contentWindow.openFile(obj)
  282. if ($(".fa-chevron-down").is(":hidden") == true) {
  283. showToggle(document.getElementById("toggleButton"))
  284. }
  285. } else {
  286. $("#attachlist").attr("src", "attachlist.html?page=formedit&routeinfoid=" + self.routeinfoid)
  287. }
  288. }
  289. self.getSwenList = function (n) {
  290. self.SwenList = [];
  291. var data = {
  292. directionid: self.directionid,
  293. userid: self.userId,
  294. routeinfoid: self.routeinfoid,
  295. routeid: self.routeid,
  296. formeditid: ""
  297. }
  298. $http.post(apiurljs.login + "g2app/abase/queryDataLink", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  299. .success(function (obj) {
  300. var res = strToJson(s4.decryptData_CBC(obj.data));
  301. if (res.data.LINKS.length > 0) {
  302. if (self.copyrightid == "") {
  303. self.copyrightid = res.data.LINKS[0].COPYRIGHTID
  304. }
  305. $.each(res.data.LINKS, function (index, item) {
  306. if (item.TEMPFORM.indexOf("formedit.html") > -1) {
  307. self.Title = item.VNAME;
  308. }
  309. if (item.TEMPFORM.indexOf("?docmode") > 0) {
  310. if (item.TEMPFORM.indexOf("attachlist") > -1) {
  311. item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
  312. } else {
  313. item.TEMPFORM = "../" + item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
  314. }
  315. } else {
  316. item.TEMPFORM = "#";
  317. }
  318. self.SwenList.push(item)
  319. })
  320. self.SwenList.push({
  321. VNAME: "流程图",
  322. DIRECTIONID: self.SwenList[0].DIRECTIONID,
  323. TEMPFORM: "modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
  324. })
  325. console.log(self.copyrightid)
  326. }
  327. if (n == 0) {
  328. self.getROLE()
  329. } else {
  330. self.getData()
  331. }
  332. })
  333. }
  334. self.getSwenList(0)
  335. self.getROLE = function () {
  336. var data = {
  337. userid: self.userId
  338. };
  339. $http.post(apiurljs.login + "g2work/datazu/queryDataUserAuth", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  340. .success(function (obj) {
  341. var res = strToJson(s4.decryptData_CBC(obj.data));
  342. for (var i = 0; i < res.data[0].auths.length; i++) {
  343. if (res.data[0].auths[i].ZID == "AA08" && res.data[0].auths[i].AUTH == "1") {
  344. self.DQJS = 3;
  345. break;
  346. } else if (res.data[0].auths[i].ZID == "AA28" && res.data[0].auths[i].AUTH == "1") {
  347. self.DQJS = 4;
  348. break;
  349. } else {
  350. self.DQJS = 1;
  351. }
  352. }
  353. self.getUserList()
  354. });
  355. }
  356. self.getUserList = function () {
  357. $http.post(apiurljs.login + "g2app/dataabase/getDpList", { data: s4.encryptData_CBC("") }, postCfg)
  358. .success(function (obj) {
  359. var res = strToJson(s4.decryptData_CBC(obj.data));
  360. self.userList = res.data;
  361. self.userList.forEach(function (item) {
  362. item.checked = false;
  363. item.USER.forEach(function (item1) {
  364. item1.checked = false;
  365. item1.USHOWNAME1 = item1.USHOWNAME.length > 3 ? item1.USHOWNAME.slice(0, 3) + "..." : item1.USHOWNAME;
  366. item1.USHOWNAME2 = item1.USHOWNAME.length > 10 ? item1.USHOWNAME.slice(0, 10) + "..." : item1.USHOWNAME
  367. })
  368. })
  369. self.UserList = {
  370. CHRY: JSON.parse(JSON.stringify(self.userList))
  371. };
  372. self.AllChecked = {};
  373. self.UserLength = {};
  374. self.selectList = {};
  375. self.getData()
  376. })
  377. }
  378. //获取数据
  379. self.getData = function () {
  380. var data = {
  381. ckey: "SX_HYFK",
  382. id: 0,
  383. directionid: self.directionid,
  384. formeditid: self.formeditid,
  385. routeid: self.routeid,
  386. routeinfoid: self.routeinfoid
  387. }
  388. $http.post(apiurljs.login + "g2app/abase/queryData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  389. .success(function (obj) {
  390. var res = strToJson(s4.decryptData_CBC(obj.data));
  391. self.data = {
  392. ID: res.data.SX_HYFK.ID,
  393. APPCODE: res.data.SX_HYFK.APPCODE,
  394. HYSJ: res.data.SX_HYFK.HYSJ == "" ? "" : res.data.SX_HYFK.HYSJ,
  395. HYBT: res.data.SX_HYFK.HYBT,
  396. HYDD: res.data.SX_HYFK.HYDD,
  397. CHRY: res.data.SX_HYFK.CHRY,
  398. HYNR: res.data.SX_HYFK.HYNR,
  399. BZ: res.data.SX_HYFK.BZ,
  400. TBR: res.data.SX_HYFK.TBR == "" ? self.userName : res.data.SX_HYFK.TBR,
  401. TBUSERID: res.data.SX_HYFK.TBUSERID == "" ? self.userId : res.data.SX_HYFK.TBUSERID,
  402. LRSJ: res.data.SX_HYFK.LRSJ == "" ? sp.getLocalDate() : res.data.SX_HYFK.LRSJ,
  403. XBGZJY: res.data.SX_HYFK.XBGZJY,
  404. LXFS: res.data.SX_HYFK.LXFS,
  405. DQJS: res.data.SX_HYFK.DQJS == "" ? self.DQJS : res.data.SX_HYFK.DQJS
  406. }
  407. console.log(self.data.DQJS)
  408. self.readonly = {
  409. HYSJ: res.data.SX_HYFK["HYSJ.EREADONLY"] == "true",
  410. HYBT: res.data.SX_HYFK["HYBT.EREADONLY"] == "true",
  411. HYDD: res.data.SX_HYFK["HYDD.EREADONLY"] == "true",
  412. CHRY: res.data.SX_HYFK["CHRY.EREADONLY"] == "true",
  413. HYNR: res.data.SX_HYFK["HYNR.EREADONLY"] == "true",
  414. LDYJ: res.data.SX_HYFK["LDYJ.EREADONLY"] == "true",
  415. HYWJ: res.data.SX_HYFK["HYWJ.EREADONLY"] == "true",
  416. BZ: res.data.SX_HYFK["BZ.EREADONLY"] == "true",
  417. TBR: res.data.SX_HYFK["TBR.EREADONLY"] == "true",
  418. XBGZJY: res.data.SX_HYFK["XBGZJY.EREADONLY"] == "true",
  419. LXFS: res.data.SX_HYFK["LXFS.EREADONLY"] == "true",
  420. }
  421. if (self.data.ID == 0) {
  422. self.filedChange = true;
  423. } else {
  424. self.filedChange = false;
  425. }
  426. if (res.data.SX_HYFK.HYWJ && res.data.SX_HYFK.HYWJ != "") {
  427. self.arrayFile = JSON.parse(res.data.SX_HYFK.HYWJ);
  428. }
  429. self.buttonList = res.data["SX_HYFK.FUNCLIST"];
  430. var n = {}, all = {};
  431. for (var i in self.UserList) {
  432. self.AllChecked[i] = false;
  433. self.UserLength[i] = 0;
  434. self.selectList[i] = []
  435. n[i] = [];
  436. all[i] = 0;
  437. $.each(self.UserList[i], function (index, item) {
  438. n[i].push(0)
  439. $.each(item.USER, function (index1, item1) {
  440. self.UserLength[i]++
  441. if (self.data.CHRY.indexOf(item1.USHOWNAME) != -1 && i == "CHRY") {
  442. n[i][index]++;
  443. item1.checked = true;
  444. self.selectList[i].push(item1);
  445. }
  446. })
  447. if (n[i][index] == item.USER.length && n[i][index] != 0) {
  448. item.checked = true;
  449. all[i]++;
  450. } else {
  451. item.checked == false;
  452. }
  453. })
  454. if (all[i] == self.UserList[i].length) {
  455. self.AllChecked[i] = true;
  456. } else {
  457. self.AllChecked[i] = false;
  458. }
  459. }
  460. self.getOpinion("LDYJ")
  461. self.getOpinion1()
  462. self.getOther()
  463. //watermark({
  464. // "watermarl_element": "app",
  465. // "watermark_txt": "测试水印内容",
  466. // "watermark_width": 150,
  467. // "watermark_height": 110,
  468. // "watermark_angle": 345
  469. //})
  470. })
  471. }
  472. //获取附件和插件
  473. self.getOther = function () {
  474. if (self.routeinfoid == 0) { return }
  475. var data = {
  476. tablename: "FILE_ATTACH",
  477. colums: "*",
  478. order: "ID desc",
  479. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  480. sqlinwhere: "",
  481. sqllikewhere: ""
  482. }
  483. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  484. .success(function (obj) {
  485. var res = strToJson(s4.decryptData_CBC(obj.data));
  486. self.arrayFile1 = [];
  487. if (res.data.length > 0) {
  488. res.data.forEach(function (item) {
  489. if (item.ATTACHTYPE.indexOf("-正文") > -1) {
  490. self.arrayFile = item;
  491. } else {
  492. self.arrayFile1.push(item)
  493. }
  494. })
  495. self.goAttach()
  496. }
  497. })
  498. }
  499. //获取意见
  500. self.getOpinion = function (str) {
  501. var data = {
  502. cmanid: self.userId,
  503. routeinfoid: self.routeinfoid,
  504. routeid: "",//self.routeid,
  505. tableid: "SX_HYFK",
  506. colid: str,
  507. opiniontype: 0,
  508. orderbycol: "CDATE desc"
  509. }
  510. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  511. .success(function (obj) {
  512. var res = strToJson(s4.decryptData_CBC(obj.data));
  513. if (res.success == true) {
  514. self.YJ[str] = res.data;
  515. self.YJ[str + "STATUS"] = false;
  516. self.YJ[str].forEach(function (item) {
  517. item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
  518. if (item.ROUTEID == self.routeid) {
  519. self.YJ[str + "STATUS"] = true;
  520. }
  521. })
  522. } else {
  523. sp.dialog(res.message)
  524. }
  525. })
  526. }
  527. //获取意见(不上表)
  528. self.opiniontype = 99;
  529. self.getOpinion1 = function () {
  530. var data = {
  531. cmanid: self.userId,
  532. routeinfoid: self.routeinfoid,
  533. routeid: "",//self.routeid,
  534. tableid: "SX_HYFK",
  535. colid: "",
  536. opiniontype: self.opiniontype,
  537. orderbycol: "CDATE desc"
  538. }
  539. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  540. .success(function (obj) {
  541. var res = strToJson(s4.decryptData_CBC(obj.data));
  542. if (res.success == true) {
  543. self.YJ.nulla = res.data;
  544. console.log(res.data)
  545. self.YJ.nullaSTATUS = false;
  546. self.YJ.nulla.forEach(function (item) {
  547. item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
  548. //if (item.ROUTEID == self.routeid && item.COLID == "") {
  549. // self.YJ.nullaSTATUS = true;
  550. //}
  551. })
  552. } else {
  553. sp.dialog(res.message)
  554. }
  555. })
  556. }
  557. //判断页面字段是否只读readonly、是否隐藏show
  558. self.hide = function (type, field) {
  559. if (self.dotype == 0 && type == "readonly") {
  560. return true;
  561. } else {
  562. if (self[type][field] == true) {
  563. return true;
  564. } else {
  565. return false;
  566. }
  567. }
  568. }
  569. //右上角按钮调用方法
  570. self.btnEvent = function (item) {
  571. switch (item.CODE) {
  572. case "SAVEITEM": self.btnSave(0); break;
  573. case "PRINTITEM": self.btnPrint(); break;
  574. case "MEETITEM": self.Meet(); break;
  575. case "SENDLOG": self.RouteList(); break;
  576. default: self.forward(item); break;
  577. }
  578. }
  579. self.openDpList = function (str) {
  580. if (self.hide("readonly", str) == true) {
  581. return
  582. } else {
  583. self.filed = str;
  584. //self.AllCheckedDp = false;
  585. sp.layer("#DpList")
  586. $("#DpList .sp-page").eq(0).scrollTop(0);
  587. }
  588. }
  589. self.checkAllDp = function () {
  590. self.AllCheckedDp[self.filed] = !self.AllCheckedDp[self.filed];
  591. $.each(self.DpList[self.filed], function (index, item) {
  592. item.checked = self.AllCheckedDp[self.filed];
  593. })
  594. self.submitDpList(1)
  595. }
  596. self.checkDpItem = function (item) {
  597. item.checked = !item.checked;
  598. var n = 0;
  599. $.each(self.DpList[self.filed], function (index, item) {
  600. if (item.checked == true) {
  601. n++
  602. }
  603. })
  604. if (n == self.DpList[self.filed].length) {
  605. self.AllCheckedDp[self.filed] = true;
  606. } else {
  607. self.AllCheckedDp[self.filed] = false;
  608. }
  609. self.submitDpList(1)
  610. }
  611. self.submitDpList = function (n) {
  612. var AllCheckedLength1 = 0;
  613. self.selectDpList[self.filed] = [];
  614. $.each(self.DpList[self.filed], function (index, item) {
  615. if (item.checked == true) {
  616. AllCheckedLength1++;
  617. self.selectDpList[self.filed].push(item)
  618. }
  619. })
  620. self.data[self.filed] = self.selectDpList[self.filed].map(function (item) {
  621. return item.DEP
  622. }).join(",")
  623. self.AllCheckedDp[self.filed] = AllCheckedLength1 == self.DpLength[self.filed];
  624. self.changeFiled(self.filed)
  625. if (n == 0) {
  626. sp.layerhide();
  627. }
  628. }
  629. self.openUserList = function (str) {
  630. if (self.hide("readonly", str) == true) {
  631. return
  632. } else {
  633. self.filed = str;
  634. //self.AllChecked[self.filed] = false;
  635. sp.layer("#userList")
  636. $("#userList .sp-page").eq(0).scrollTop(0);
  637. }
  638. }
  639. self.checkAllUser = function () {
  640. self.AllChecked[self.filed] = !self.AllChecked[self.filed];
  641. $.each(self.UserList[self.filed], function (index, item) {
  642. item.checked = self.AllChecked[self.filed];
  643. $.each(item.USER, function (index1, item1) {
  644. item1.checked = self.AllChecked[self.filed];
  645. })
  646. })
  647. self.submitUserList(1)
  648. }
  649. self.checkUserItem = function (item) {
  650. item.checked = !item.checked;
  651. $.each(item.USER, function (index, item1) {
  652. item1.checked = item.checked;
  653. })
  654. var n = 0;
  655. $.each(self.UserList[self.filed], function (index, item) {
  656. if (item.checked == true) {
  657. n++
  658. }
  659. })
  660. if (n == self.UserList[self.filed].length) {
  661. self.AllChecked[self.filed] = true;
  662. } else {
  663. self.AllChecked[self.filed] = false;
  664. }
  665. self.submitUserList(1)
  666. }
  667. self.checkUser = function (item) {
  668. item.checked = !item.checked;
  669. var n = [], all = 0;
  670. $.each(self.UserList[self.filed], function (x, y) {
  671. n.push(0);
  672. $.each(y.USER, function (x1, y1) {
  673. if (y1.checked == true) {
  674. n[x]++
  675. }
  676. })
  677. if (n[x] == y.USER.length && n[x] != 0) {
  678. y.checked = true;
  679. all++
  680. } else {
  681. y.checked = false;
  682. }
  683. })
  684. if (all == self.UserList[self.filed].length) {
  685. self.AllChecked[self.filed] = true;
  686. } else {
  687. self.AllChecked[self.filed] = false;
  688. }
  689. self.submitUserList(1)
  690. }
  691. self.submitUserList = function (n) {
  692. var AllCheckedLength = 0;
  693. self.selectList[self.filed] = [];
  694. $.each(self.UserList[self.filed], function (index, item) {
  695. $.each(item.USER, function (index1, item1) {
  696. if (item1.checked == true) {
  697. AllCheckedLength++;
  698. self.selectList[self.filed].push(item1)
  699. }
  700. })
  701. })
  702. self.data[self.filed] = self.selectList[self.filed].map(function (item) {
  703. return item.USHOWNAME
  704. }).join(",")
  705. if (self.data[self.filed + "ID"] != undefined) {
  706. self.data[self.filed + "ID"] = self.selectList[self.filed].map(function (item) {
  707. return item.USERID
  708. }).join(",")
  709. }
  710. self.AllChecked[self.filed] = AllCheckedLength == self.UserLength[self.filed];
  711. self.changeFiled(self.filed)
  712. if (n == 0) {
  713. sp.layerhide();
  714. }
  715. }
  716. //保存提交
  717. self.btnSave = function (n) {
  718. if (spngvld.submit(".sp-page-center"), 2) {
  719. var dataArray = [];
  720. dataArray.push(self.data);
  721. var data = {
  722. ckey: "SX_HYFK",
  723. id: self.data.ID,
  724. routeid: self.routeid,
  725. routeinfoid: self.routeinfoid,
  726. routeinfotitle: self.data.HYBT,
  727. directionid: self.directionid,
  728. formeditid: self.formeditid,
  729. data: JSON.stringify(dataArray)
  730. }
  731. $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  732. .success(function (obj) {
  733. var res = strToJson(s4.decryptData_CBC(obj.data));
  734. if (res.code == 0) {
  735. self.data.ID = res.data.ID;
  736. self.routeid = res.data.ROUTEID;
  737. self.routeinfoid = res.data.ROUTEINFOID;
  738. self.filedChange = false;
  739. if (n == 0 || n == 4) {
  740. self.getSwenList(1)
  741. if (n == 0) {
  742. sp.dialog("保存成功!");
  743. $timeout(function () {
  744. sp.dialoghide()
  745. }, 1500)
  746. }
  747. } else if (n == 1) {
  748. self.forward(self.btnItem);
  749. } else {
  750. self.sendAll();
  751. }
  752. } else {
  753. sp.dialog(res.message)
  754. }
  755. })
  756. }
  757. }
  758. //打印
  759. self.btnPrint = function () {
  760. // 创建隐藏的可下载链接
  761. var eleLink = document.createElement('a');
  762. eleLink.download = "";
  763. eleLink.style.display = 'none';
  764. eleLink.href = apiurljs.login + "g2app/shouwen/PrintWord?data=" + encodeURIComponent(s4.encryptData_CBC("templatefilename=XZGZDT.ftl&tablename=SX_HYFK&outfilepath=/tmp/会议反馈表.wps&prtdate=LRSJ&routeinfoid=" + self.routeinfoid));
  765. // 触发点击
  766. document.body.appendChild(eleLink);
  767. eleLink.click();
  768. // 然后移除
  769. document.body.removeChild(eleLink);
  770. //window.open(apiurljs.login + "g2app/shouwen/PrintWord?templatefilename=shouwen.ftl&tablename=SX_HYFK&outfilepath=" + apiurljs.print + "&routeinfoid=" + self.routeinfoid)
  771. }
  772. //下载附件
  773. self.download = function (item) {
  774. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  775. }
  776. //删除附件
  777. self.deleteFile = function (item, str) {
  778. var data = {
  779. tablename: "SX_HYFK",
  780. column: str,
  781. routeinfoid: self.routeinfoid,
  782. fileid: item.FILEID,
  783. filenames: item.FILEOLDNAME
  784. }
  785. $http.post(apiurljs.login + "g2app/abase/deleteUploadFileName", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  786. .success(function (obj) {
  787. var res = strToJson(s4.decryptData_CBC(obj.data));
  788. if (res.success == true) {
  789. self.arrayFile = res.data;
  790. } else {
  791. sp.dialog(res.message)
  792. }
  793. })
  794. }
  795. //签写意见编辑状态
  796. self.opinion = {
  797. LDYJ: false,
  798. LDYJImg: false,
  799. nulla: false
  800. }
  801. self.YJ = {
  802. LDYJ: [],
  803. LDYJSTATUS: false,
  804. nulla: [],
  805. nullaSTATUS: false
  806. }
  807. //意见(下表)
  808. self.openOptionList = function () {
  809. if (self.routeinfoid == 0 && self.routeid == 0) {
  810. sp.dialog("请先保存!")
  811. return;
  812. }
  813. if (self.opinion.nulla == true) {
  814. return;
  815. }
  816. self.nulla = "";
  817. $(".optionList").css("height", 149)
  818. self.opinion.nulla = true;
  819. }
  820. self.closeOptionList = function () {
  821. $(".optionList").css("height", 389)
  822. self.opinion.nulla = false;
  823. }
  824. self.submitOptionList = function () {
  825. var data = {
  826. cmanid: self.userId,
  827. routeinfoid: self.routeinfoid,
  828. routeid: self.routeid,
  829. tableid: "SX_HYFK",
  830. colid: "",
  831. opiniontype: 99,
  832. cresult: "",
  833. opinion: self.nulla,
  834. opinionimage: ""
  835. }
  836. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  837. .success(function (obj) {
  838. var res = strToJson(s4.decryptData_CBC(obj.data));
  839. if (res.success == true) {
  840. self.getOpinion1();
  841. self.opinion.nulla = false;
  842. $(".optionList").css("height", 389)
  843. } else {
  844. sp.dialog(res.message)
  845. }
  846. })
  847. }
  848. self.changeOptionList = function (item) {
  849. self.nulla = item.OPINION;
  850. self.opinion.nulla = true;
  851. }
  852. //意见附件(下表)
  853. self.uploading1 = false;
  854. self.upload1 = function () {
  855. $('#fileupload1').fileupload({
  856. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  857. dataType: 'json',
  858. beforeSend: function (xhr, data) {
  859. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  860. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  861. + ",routeid=" + self.routeid + ",tableid=SX_HYFK"));
  862. },
  863. // 上传完成后的执行逻辑
  864. done: function (e, data) {
  865. self.uploading1 = false;
  866. self.getOpinion1()
  867. }
  868. })
  869. }
  870. //下载意见表附件
  871. self.downLoadOption = function (item) {
  872. window.open(apiurljs.login + "g2work/files/" + item.FILEPATH.slice(7))
  873. }
  874. //删除意见表附件
  875. self.deleteOptionFile = function (file, str) {
  876. var data = {
  877. routeid: file.ROUTEID,
  878. tableid: "SX_HYFK",
  879. colid: str,
  880. fileid: file.FILEID
  881. };
  882. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  883. .success(function (obj) {
  884. var res = strToJson(s4.decryptData_CBC(obj.data));
  885. sp.dialoghide();
  886. if (res.success) {
  887. if (str != "") {
  888. self.getOpinion(str);
  889. } else {
  890. self.getOpinion1();
  891. }
  892. } else {
  893. sp.dialog("删除失败,请联系管理员!");
  894. }
  895. });
  896. }
  897. //意见附件(上表)
  898. self.upload2 = function (str) {
  899. $('#fileupload-' + str).fileupload({
  900. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  901. dataType: 'json',
  902. beforeSend: function (xhr, data) {
  903. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  904. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  905. + ",routeid=" + self.routeid + ",tableid=SX_HYFK,colid=" + str));
  906. },
  907. // 上传完成后的执行逻辑
  908. done: function (e, data) {
  909. self.uploading1 = false;
  910. self.getOpinion(str)
  911. }
  912. })
  913. }
  914. //签写意见
  915. self.openOpinion = function (str) {
  916. if (self.routeinfoid == 0 && self.routeid == 0) {
  917. sp.dialog("请先保存!")
  918. return;
  919. }
  920. self.opinion[str] = true;
  921. }
  922. //修改意见
  923. self.changeOpinion = function (str) {
  924. self.data[str] = self.YJ[str][0].OPINION;
  925. self.opinion[str] = true;
  926. }
  927. self.changeOpinionItem = function (str, item) {
  928. if (item.OPINIONIMAGE != "") {
  929. self.QianZi(str);
  930. self.opinion[str + "Img"] = true;
  931. }
  932. self.data[str] = item.OPINION;
  933. self.opinion[str] = true;
  934. }
  935. //提交意见
  936. self.Sopinion = function (str) {
  937. if (self.opinion[str + "Img"] == true) {
  938. self.data[str] = $("#" + str + "QZ").find("canvas")[0].toDataURL();
  939. } else {
  940. self.data[str] = $("#" + str).val();
  941. }
  942. var data = {
  943. cmanid: self.userId,
  944. routeinfoid: self.routeinfoid,
  945. routeid: self.routeid,
  946. tableid: "SX_HYFK",
  947. colid: str,
  948. opiniontype: 0,
  949. cresult: "",
  950. opinion: self.opinion[str + "Img"] == false ? self.data[str] : "",
  951. opinionimage: self.opinion[str + "Img"] == true ? self.data[str] : ""
  952. }
  953. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  954. .success(function (obj) {
  955. var res = strToJson(s4.decryptData_CBC(obj.data));
  956. if (res.success == true) {
  957. self.getOpinion(str);
  958. self.opinion[str] = false;
  959. self.opinion[str + "Img"] = false;
  960. self.data[str] = "";
  961. self.changeFiled(str)
  962. } else {
  963. sp.dialog(res.message)
  964. }
  965. })
  966. }
  967. //删除意见
  968. self.Dopinion = function (str, item) {
  969. var data = {
  970. cmanid: self.userId,
  971. routeid: self.routeid,
  972. tableid: "SX_HYFK",
  973. colid: str,
  974. }
  975. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  976. .success(function (obj) {
  977. var res = strToJson(s4.decryptData_CBC(obj.data));
  978. if (res.success == true) {
  979. if (str != "") {
  980. self.getOpinion(str);
  981. } else {
  982. self.getOpinion1();
  983. }
  984. self.changeFiled(str)
  985. } else {
  986. sp.dialog(res.message)
  987. }
  988. })
  989. }
  990. self.phraseText = "";//添加常用语
  991. self.phraseList = []//常用语列表
  992. //获取常用语库
  993. self.phrase = function (colid) {
  994. sp.layer("#phrase");
  995. self.colid = colid;
  996. self.getPhrase();
  997. }
  998. //添加常用语到常用语库
  999. self.Aphrase = function () {
  1000. if (self.phraseText == "") {
  1001. return;
  1002. }
  1003. var data = {
  1004. cmanid: self.userId,
  1005. tableid: "SX_HYFK",
  1006. colid: self.colid,
  1007. contents: self.phraseText
  1008. }
  1009. $http.post(apiurljs.login + "g2app/abase/insertDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1010. .success(function (obj) {
  1011. var res = strToJson(s4.decryptData_CBC(obj.data));
  1012. if (res.success == true) {
  1013. self.phraseText = "";
  1014. self.getPhrase();
  1015. } else {
  1016. sp.dialog(res.message)
  1017. }
  1018. })
  1019. }
  1020. //获取常用语库
  1021. self.getPhrase = function () {
  1022. var data = {
  1023. cmanid: self.userId,
  1024. tableid: "SX_HYFK",
  1025. colid: self.colid
  1026. }
  1027. $http.post(apiurljs.login + "g2app/abase/queryDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1028. .success(function (obj) {
  1029. var res = strToJson(s4.decryptData_CBC(obj.data));
  1030. self.phraseList = res.data;
  1031. self.phraseSelect = self.phraseList[0].CONTENTS;
  1032. })
  1033. }
  1034. //从常用语库删除
  1035. self.Dphrase = function () {
  1036. var id = null;
  1037. $.each(self.phraseList, function (index, item) {
  1038. if (item.CONTENTS == self.phraseSelect) {
  1039. id = item.ID;
  1040. }
  1041. })
  1042. var data = {
  1043. id: id
  1044. }
  1045. $http.post(apiurljs.login + "g2app/abase/deleteDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1046. .success(function (obj) {
  1047. var res = strToJson(s4.decryptData_CBC(obj.data));
  1048. self.getPhrase();
  1049. })
  1050. }
  1051. //常用语确认为意见
  1052. self.btnPhrase = function () {
  1053. if (!self.colid) {
  1054. self.nulla = self.phraseSelect;
  1055. } else {
  1056. self.data[self.colid] = self.phraseSelect;
  1057. }
  1058. sp.layerhide();
  1059. }
  1060. //签字—手写
  1061. self.QianZi = function (str) {
  1062. if (self.opinion[str + "Img"] == true) { return; }
  1063. self.opinion[str + "Img"] = true;
  1064. setTimeout(function () {
  1065. new lineCanvas(str + "QZ")
  1066. }, 1)
  1067. }
  1068. //清除手写
  1069. self.canvasClear = function (str) {
  1070. var cxt = $("#" + str + "QZ").find("canvas")[0].getContext("2d");
  1071. cxt.clearRect(0, 0, $("#" + str + "QZ").find("canvas")[0].width, $("#" + str + "QZ").find("canvas")[0].height)
  1072. }
  1073. //发生修改
  1074. self.changeFiled = function (str) {
  1075. self.filedChange = true;
  1076. self.btnSave(4)
  1077. }
  1078. //转发
  1079. self.forward = function (obj) {
  1080. self.btnItem = obj;
  1081. if (self.filedChange == true) {
  1082. self.btnSave(1)
  1083. } else {
  1084. $("#forwardWin").attr("src", "../../forward/forward.html?routeid=" + self.routeid + "&routeinfoid=" + self.routeinfoid + "&copyrightid=" + self.copyrightid + "&directionid=" + self.directionid + "&formeditid=" + self.formeditid + "&codefuncbutton=" + obj.CODE + "&directionidtarget=" + obj.DIRECTIONIDTARGET + "&cookie=huiyishibg1")
  1085. sp.layer("#forward")
  1086. }
  1087. }
  1088. //查看流转记录
  1089. self.RouteList = function () {
  1090. sp.openNewWindow("../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1], "流程图")
  1091. //var data = {
  1092. // directionid: self.directionid,
  1093. // userid: self.userId,
  1094. // routeid: self.routeid,
  1095. // routeinfoid: self.routeinfoid,
  1096. //}
  1097. //$http.post(apiurljs.login + "g2app/abase/queryDataRouteList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1098. //.success(function (obj) {
  1099. // var res = strToJson(s4.decryptData_CBC(obj.data));
  1100. // self.routeList = res.data;
  1101. // $.each(self.routeList, function (index, item) {
  1102. // item.mainUser = [];
  1103. // item.copyUsers = [];
  1104. // $.each(item.USERS, function (index1, item1) {
  1105. // if (item1.KIND == 0) {
  1106. // item.mainUser.push(item1.USERNAME);
  1107. // } else {
  1108. // item.copyUsers.push(item1.USERNAME);
  1109. // }
  1110. // })
  1111. // item.mainUser = item.mainUser.join(",");
  1112. // item.copyUsers = item.copyUsers.join(",");
  1113. // })
  1114. // setTimeout(function (item) {
  1115. // sp.layer("#RouteList");
  1116. // }, 100);
  1117. //})
  1118. }
  1119. self.reSizeRow = function () {
  1120. var bodybox = document.getElementById("bodyDiv");
  1121. var topbox = document.getElementById("topDiv");
  1122. var bottombox = document.getElementById("bottomDiv");
  1123. var line = document.getElementById("lineDiv");
  1124. document.getElementById("lineDiv").addEventListener("mousedown", function (event) {
  1125. $(".mousemove").show()
  1126. var bodyboxH = bodybox.clientHeight;
  1127. var topboxH = topbox.clientHeight;
  1128. var bottomboxH = bottombox.clientHeight;
  1129. //var y = event.pageY - line.offsetTop;
  1130. var y = event.pageY - line.clientHeight;
  1131. document.addEventListener("mousemove", boxMove)
  1132. function boxMove(event) {
  1133. if (topboxH * 1 + (event.pageY - y) * 1 - 36 <= 45) {
  1134. //
  1135. } else if (bottomboxH * 1 - (event.pageY - y) * 1 - 36 <= 45) {
  1136. //
  1137. } else {
  1138. topbox.style.height = topboxH * 1 + (event.pageY - y) * 1 - 36 + "px";
  1139. //topbox.getElementsByTagName("iframe")[0].style.height = topboxH * 1 + (event.pageY - y) * 1 - 45 + "px";
  1140. bottombox.style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 + 36 + "px";
  1141. bottombox.getElementsByTagName("iframe")[0].style.height = bodyboxH * 1 - topboxH * 1 - (event.pageY - y) * 1 - 25 + "px";
  1142. }
  1143. }
  1144. document.addEventListener("mouseup", function () {
  1145. $(".mousemove").hide()
  1146. document.removeEventListener("mousemove", boxMove)
  1147. })
  1148. })
  1149. }
  1150. ////头部关键字搜索---20230905
  1151. self.headBtnSearchKeyword = "";
  1152. self.headSearchResult = [];
  1153. self.headSearchResult_view = false;
  1154. self.headBtnSearch = function () {
  1155. if (sp.isval(self.headBtnSearchKeyword)) {
  1156. self.headSearchResult = [];
  1157. var data = {
  1158. "url": "/basic/api/StatSelect/selectCodeList",
  1159. "data": { "keyWord": self.headBtnSearchKeyword }
  1160. }
  1161. //console.log(JSON.stringify(data));
  1162. $http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1163. .success(function (obj) {
  1164. var res = strToJson(s4.decryptData_CBC(obj.data));
  1165. //console.log(JSON.stringify(res.data));
  1166. self.headSearchResult = res.data.build;
  1167. if (sp.isval(self.headSearchResult)) {
  1168. self.headSearchResult_view = true;
  1169. } else {
  1170. self.headSearchResult_view = false;
  1171. }
  1172. })
  1173. } else {
  1174. self.headSearchResult_view = false;
  1175. }
  1176. };
  1177. self.headKeywordPage = function (itemdata) {
  1178. var get_token = localStorage.getItem("main-token");
  1179. var set_url = apiurljs.onePic + "wholeProcessPage/?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id;
  1180. $('#attachlist')[0].contentWindow.openTool(set_url, '一张图');
  1181. self.headSearchResult_view = false;
  1182. };
  1183. self.onePic = function () {
  1184. $('#attachlist')[0].contentWindow.openTool(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索")
  1185. }
  1186. //公开
  1187. self.PUBLICITEM = function () {
  1188. var data = {
  1189. userid: self.userId
  1190. }
  1191. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1192. .success(function (obj) {
  1193. var res = strToJson(s4.decryptData_CBC(obj.data));
  1194. var data1 = {
  1195. tablename: "CODE_LM"
  1196. }
  1197. $http.post(apiurljs.login + "g2app/filepublishing/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
  1198. .success(function (obj1) {
  1199. var res1 = strToJson(s4.decryptData_CBC(obj1.data));
  1200. self.LM = res1.data[0].C_H_I_L_D_DATA;
  1201. self.LM.forEach(function (item) {
  1202. item.show = true;
  1203. if (item.CNAME == "新闻动态" || item.CNAME == "通知公告" || (item.MKUSERID && item.MKUSERID.indexOf(self.userId) == -1)) {
  1204. item.show = false;
  1205. }
  1206. item.C_H_I_L_D_DATA.forEach(function (item1) {
  1207. item1.show = true;
  1208. if (item1.MKUSERID && item1.MKUSERID.indexOf(self.userId) == -1) {
  1209. item1.show = false;
  1210. }
  1211. })
  1212. })
  1213. self.filed = "GKFW";
  1214. self.msgGK = {
  1215. WJLY: "FW",
  1216. FLOWID: "AA88",
  1217. FORMROUTEINFOID: self.routeinfoid,
  1218. FBUSERID: self.userId,
  1219. FBNAME: self.userName,
  1220. GKFW: "",
  1221. LM: "P0103",
  1222. LM1: "委发文件",
  1223. FBRQ: sp.getLocalDate(),
  1224. FBBM: res.data[0].SECTION,
  1225. WJBT: self.data.FWBT
  1226. }
  1227. sp.layer("#PUBLICITEM")
  1228. $("#PUBLICITEM .sp-page").eq(0).scrollTop(0);
  1229. })
  1230. })
  1231. }
  1232. self.showCol = function ($event, ele) {
  1233. $('.detail-col').not(ele).hide();
  1234. $(ele).toggle("slow").autoHide();
  1235. $event.stopPropagation();
  1236. }
  1237. self.selectLM = function (item) {
  1238. self.msgGK.LM = item.CODE
  1239. self.msgGK.LM1 = item.CNAME
  1240. console.log(self.msgGK)
  1241. $(".detail-col").toggle("slow");
  1242. }
  1243. self.showSecond = function (obj, n) {
  1244. self.LM1 = obj.C_H_I_L_D_DATA;
  1245. $(".detail-col").eq(1).css("top", (n + 1) * 30 + n);
  1246. $(".detail-col").eq(1).show().autoHide()
  1247. }
  1248. self.checkAllUser1 = function () {
  1249. self.AllChecked[self.filed] = !self.AllChecked[self.filed];
  1250. $.each(self.UserList[self.filed], function (index, item) {
  1251. item.checked = self.AllChecked[self.filed];
  1252. $.each(item.USER, function (index1, item1) {
  1253. item1.checked = self.AllChecked[self.filed];
  1254. })
  1255. })
  1256. self.submitGK(1)
  1257. }
  1258. self.checkUserItem1 = function (item) {
  1259. item.checked = !item.checked;
  1260. $.each(item.USER, function (index, item1) {
  1261. item1.checked = item.checked;
  1262. })
  1263. var n = 0;
  1264. $.each(self.UserList[self.filed], function (index, item) {
  1265. if (item.checked == true) {
  1266. n++
  1267. }
  1268. })
  1269. if (n == self.UserList[self.filed].length) {
  1270. self.AllChecked[self.filed] = true;
  1271. } else {
  1272. self.AllChecked[self.filed] = false;
  1273. }
  1274. self.submitGK(1)
  1275. }
  1276. self.checkUser1 = function (item) {
  1277. item.checked = !item.checked;
  1278. var n = [], all = 0;
  1279. $.each(self.UserList[self.filed], function (x, y) {
  1280. n.push(0);
  1281. $.each(y.USER, function (x1, y1) {
  1282. if (y1.checked == true) {
  1283. n[x]++
  1284. }
  1285. })
  1286. if (n[x] == y.USER.length && n[x] != 0) {
  1287. y.checked = true;
  1288. all++
  1289. } else {
  1290. y.checked = false;
  1291. }
  1292. })
  1293. if (all == self.UserList[self.filed].length) {
  1294. self.AllChecked[self.filed] = true;
  1295. } else {
  1296. self.AllChecked[self.filed] = false;
  1297. }
  1298. self.submitGK(1)
  1299. }
  1300. self.submitGK = function (n) {
  1301. var AllCheckedLength = 0;
  1302. self.selectList[self.filed] = [];
  1303. $.each(self.UserList[self.filed], function (index, item) {
  1304. $.each(item.USER, function (index1, item1) {
  1305. if (item1.checked == true) {
  1306. AllCheckedLength++;
  1307. self.selectList[self.filed].push(item1)
  1308. }
  1309. })
  1310. })
  1311. self.msgGK[self.filed] = self.selectList[self.filed].map(function (item) {
  1312. return item.USERID
  1313. }).join(",")
  1314. self.AllChecked[self.filed] = AllCheckedLength == self.UserLength[self.filed];
  1315. if (n == 0) {
  1316. sp.layerhide();
  1317. var data = {
  1318. tablename: "SX_FBLIST",
  1319. data: {
  1320. WJLY: self.msgGK.WJLY,
  1321. FLOWID: self.msgGK.FLOWID,
  1322. FORMROUTEINFOID: self.msgGK.FORMROUTEINFOID,
  1323. FBUSERID: self.msgGK.FBUSERID,
  1324. FBNAME: self.msgGK.FBNAME,
  1325. GKFW: self.msgGK.GKFW,
  1326. LM: self.msgGK.LM,
  1327. FBRQ: self.msgGK.FBRQ,
  1328. FBBM: self.msgGK.FBBM,
  1329. WJBT: self.msgGK.WJBT
  1330. }
  1331. }
  1332. $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1333. .success(function (obj) {
  1334. var res = strToJson(s4.decryptData_CBC(obj.data));
  1335. sp.layerhide();
  1336. if (res.success) {
  1337. sp.dialog("操作成功!");
  1338. $timeout(function () {
  1339. sp.dialoghide();
  1340. }, 1000)
  1341. } else {
  1342. sp.dialog(res.message);
  1343. }
  1344. })
  1345. }
  1346. }
  1347. //头部下滚冻结
  1348. $(function () {
  1349. $(".sp-page-center").eq(0).css("max-height", $("#topDiv").height()).css("height", $("#topDiv").height())
  1350. $(".formedit center").css("height", $(".formedit center").next("div").height()).css("line-height", $(".formedit center").next("div").height() / 6 + "px")
  1351. //$("body").bind("scroll", function () {
  1352. // var scrollTop = $("body").scrollTop();
  1353. // if (scrollTop == 0) {
  1354. // $(".FixTop").removeClass("FixTop");
  1355. // }
  1356. // if (scrollTop > 35) {
  1357. // $(".sp-page-title").parents(".sp-box").addClass("FixTop");
  1358. // }
  1359. //});
  1360. //页面高度撑满
  1361. setTimeout(function () {
  1362. if ($(".ibox-content").height() < $(window).height() - 31) {
  1363. $(".ibox-content").css("height", $(window).height() - 31)
  1364. }
  1365. $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
  1366. }, 1)
  1367. })
  1368. }])
  1369. app.filter('trustHtml', function ($sce) {
  1370. return function (input) {
  1371. return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, '&nbsp;'));
  1372. };
  1373. });
  1374. //canvas画布签字
  1375. function lineCanvas(obj) {
  1376. var self = this;
  1377. self.linewidth = 1;
  1378. self.color = "#000000";
  1379. self.background = "#ffffff";
  1380. self.canvas = document.createElement("canvas");
  1381. document.getElementById(obj).appendChild(self.canvas);
  1382. self.cxt = self.canvas.getContext("2d");
  1383. self.canvas.width = document.getElementById(obj).clientWidth;
  1384. self.canvas.height = document.getElementById(obj).scrollHeight;
  1385. self.cxt.fillStyle = self.background;
  1386. self.cxt.fillRect(0, 0, self.canvas.width, self.canvas.width);
  1387. self.cxt.strokeStyle = self.color;
  1388. self.cxt.lineWidth = self.linewidth;
  1389. self.cxt.lineCap = "round";
  1390. //开始绘制
  1391. self.canvas.addEventListener("mousedown", function (e) {
  1392. self.cxt.beginPath();
  1393. self.cxt.lineTo(e.pageX - document.getElementById(obj).offsetLeft - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
  1394. self.canvas.addEventListener("mousemove", move)
  1395. }.bind(self), false);
  1396. //绘制中
  1397. function move() {
  1398. var e = window.event;
  1399. self.cxt.lineTo(e.pageX - document.getElementById(obj).offsetLeft - 25, e.pageY - document.getElementById(obj).offsetTop + $(".sp-page-center").scrollTop() - 25);
  1400. self.cxt.stroke();
  1401. }
  1402. //结束绘制
  1403. self.canvas.addEventListener("mouseup", up)
  1404. function up() {
  1405. self.cxt.closePath();
  1406. self.canvas.removeEventListener("mousemove", move)
  1407. }
  1408. };
  1409. var parentData = {}
  1410. function getData() {
  1411. parentData = angular.element(document.getElementById("app")).scope().data
  1412. return parentData
  1413. }
  1414. function showToggle(e) {
  1415. $(e).children().toggle()
  1416. $(e).next().toggle()
  1417. }
  1418. function toggleYJL(e) {
  1419. if ($(e).children(".fa-angle-double-down").is(":hidden") == true) {
  1420. $("#topDiv").css("height", 160)
  1421. $(e).parent().css("height", 450)
  1422. $("#attachlist").css("height", 200)
  1423. $("#bottomDiv").css("height", "")
  1424. } else {
  1425. $("#topDiv").css("height", 600)
  1426. $(e).parent().css("height", 10)
  1427. }
  1428. $(e).children().toggle()
  1429. }