formedit.js 52 KB

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