formeditFL.js 114 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708
  1. 'use strict';
  2. var app = angular.module('app', [
  3. ]);
  4. app.controller("formeditCtrl", ["$scope", "$http", "$timeout", "$interval", "$sce", function ($scope, $http, $timeout, $interval, $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.lastrouteinfoid = sp.getUrlName("lastrouteinfoid");
  13. self.copyrightid = sp.getUrlName("copyrightid");
  14. self.directionid = sp.getUrlName("directionid");
  15. self.formeditid = sp.getUrlName("formeditid");
  16. self.mbid = sp.getUrlName("mbid");
  17. self.fjid = sp.getUrlName("fjid");
  18. self.docmode = sp.getUrlName("docmode");
  19. self.dotype = sp.getUrlName("dotype");
  20. self.get_lastReturnPageno = sp.getUrlName("lastReturnPageno");
  21. self.get_lastReturnPage = sp.getUrlName("lastReturnPage");
  22. self.get_type = sp.getUrlName("type");
  23. self.return = "../list.html?lastReturnPageno=" + self.get_lastReturnPageno + "&type=" + self.get_type
  24. self.deviceType = localStorage.getItem("tjJxtGoldenlinkWork-deviceType");
  25. if (self.deviceType != "pad") {
  26. self.photo = $.cookie("GlWorkPlatform-photo").indexOf("AFrontEnd") > -1 ? "../../../" + $.cookie("GlWorkPlatform-photo") : $.cookie("GlWorkPlatform-photo");
  27. }
  28. var postCfg = {
  29. headers: {
  30. 'Content-Type': 'application/json',
  31. 'Authorization': "Bearer " + self.get_AccessToken
  32. }
  33. };
  34. self.FormTitle = $.cookie("GlWorkPlatform-SYSNAME");
  35. //初始化右上角按钮
  36. self.buttonList = []
  37. var uploadformat = strToJson(s4.decryptData_CBC(apiurljs.uploadformat)).data.map(function (item) {
  38. return item.CNAME
  39. })
  40. self.upload_zw = function () {
  41. self.newMoBanFlag = true;
  42. if (self.gaoTypeArrayFirst.length > 0) {
  43. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  44. var dialogBody = "<div class=\"sp-dialog-body\">您确定要覆盖正文吗?</div>";
  45. 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>";
  46. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  47. sp.openCenter(".sp-dialog");
  48. ///取消按钮
  49. $('.sp-closeDialog').click(function (event) {
  50. sp.closeCenter(".sp-dialog");
  51. event.preventDefault();
  52. event.stopPropagation();
  53. });
  54. //post消息的id
  55. $("#delDataTrue").click(function () {
  56. sp.closeCenter(".sp-dialog");
  57. $('#fileupload-zw').fileupload({
  58. url: apiurljs.login + 'g2app/fawenfiles/uploadFileWithForm',
  59. dataType: 'json',
  60. beforeSend: function (xhr, data) {
  61. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  62. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FAWEN_FILES,routeinfoid=" + self.routeinfoid + ",gwtype=" + self.data.GWZL + ",dockind=D01"));
  63. },
  64. add: function (e, data) {
  65. var num = 0;
  66. var acceptFileTypes = eval('/(' + apiurljs.zwType.join("|") + ')$/i')
  67. //文件类型判断
  68. $.each(data.originalFiles, function (index, item) {
  69. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  70. sp.dialog("您好,请上传" + apiurljs.zwType.join("/") + "格式的文件!");
  71. return;
  72. } else {
  73. num++
  74. }
  75. })
  76. if (num == data.originalFiles.length) {
  77. self.uploading_zw = true;
  78. data.submit();
  79. $scope.$apply();
  80. }
  81. },
  82. // 上传完成后的执行逻辑
  83. done: function (e, data) {
  84. self.uploading_zw = false;
  85. self.newMoBanFlag = false;
  86. self.getGCG(1)
  87. }
  88. })
  89. $timeout(function () {
  90. $("#fileupload-zw").trigger("click")
  91. }, 1)
  92. })
  93. } else {
  94. $('#fileupload-zw').fileupload({
  95. url: apiurljs.login + 'g2app/fawenfiles/uploadFileWithForm',
  96. dataType: 'json',
  97. beforeSend: function (xhr, data) {
  98. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  99. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FAWEN_FILES,routeinfoid=" + self.routeinfoid + ",gwtype=" + self.data.GWZL + ",dockind=D01"));
  100. },
  101. add: function (e, data) {
  102. var num = 0;
  103. var acceptFileTypes = eval('/(' + apiurljs.zwType.join("|") + ')$/i')
  104. //文件类型判断
  105. $.each(data.originalFiles, function (index, item) {
  106. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  107. sp.dialog("您好,请上传" + apiurljs.zwType.join("/") + "格式的文件!");
  108. return;
  109. } else {
  110. num++
  111. }
  112. })
  113. if (num == data.originalFiles.length) {
  114. self.uploading_zw = true;
  115. data.submit();
  116. $scope.$apply();
  117. }
  118. },
  119. // 上传完成后的执行逻辑
  120. done: function (e, data) {
  121. self.uploading_zw = false;
  122. self.newMoBanFlag = false;
  123. self.getGCG(1)
  124. }
  125. })
  126. $timeout(function () {
  127. $("#fileupload-zw").trigger("click")
  128. }, 1)
  129. }
  130. }
  131. //上层附件、业务参考、共享沟通组件
  132. self.uploading = false;
  133. self.upload = function () {
  134. $('#fileupload').fileupload({
  135. url: apiurljs.login + 'g2app/abase/uploadFileWithForm',
  136. dataType: 'json',
  137. beforeSend: function (xhr, data) {
  138. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  139. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=FILE_ATTACH,routeinfoid=" + self.routeinfoid + ",ATTACHTYPE=主任办公会议纪要"));
  140. },
  141. add: function (e, data) {
  142. var num = 0;
  143. var acceptFileTypes = eval('/(' + uploadformat.join("|") + ')$/i')
  144. //文件类型判断
  145. $.each(data.originalFiles, function (index, item) {
  146. if (item['type'].length > 0 && !acceptFileTypes.test(item['name'])) {
  147. sp.dialog("您好,请上传" + uploadformat.join("/") + "格式的文件!");
  148. return;
  149. } else {
  150. num++
  151. }
  152. })
  153. if (num == data.originalFiles.length) {
  154. self.uploading = true;
  155. data.submit();
  156. $scope.$apply();
  157. }
  158. },
  159. // 上传完成后的执行逻辑
  160. done: function (e, data) {
  161. self.uploading = false;
  162. self.getOther()
  163. }
  164. })
  165. }
  166. self.downLoad = function (item) {
  167. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  168. }
  169. self.deleteFile = function (file) {
  170. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  171. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  172. 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>";
  173. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  174. sp.openCenter(".sp-dialog");
  175. ///取消按钮
  176. $('.sp-closeDialog').click(function (event) {
  177. sp.closeCenter(".sp-dialog");
  178. event.preventDefault();
  179. event.stopPropagation();
  180. });
  181. //post消息的id
  182. $("#delDataTrue").click(function () {
  183. var data = {
  184. tablename: "FILE_ATTACH",
  185. id: file.ID
  186. };
  187. $http.post(apiurljs.login + "g2app/dataabase/delDataById", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  188. .success(function (obj) {
  189. var res = strToJson(s4.decryptData_CBC(obj.data));
  190. sp.dialoghide();
  191. if (res.success) {
  192. $.each(self.iframeList, function (index, item) {
  193. if (item.title == file.FILENAMES && item.source == apiurljs.login + "g2work/files2/inline/" + file.FILEURL.slice(7)) {
  194. self.closeItem(index);
  195. return false;
  196. }
  197. })
  198. self.getOther();
  199. } else {
  200. sp.dialog("删除失败,请联系管理员!");
  201. }
  202. });
  203. });
  204. }
  205. self.creatFLOW = function (file) {
  206. var data = {
  207. copyrightid: self.copyrightid,
  208. directionid: self.directionid,
  209. routeinfoid: self.routeinfoid,
  210. userid: self.userId,
  211. relateid: file.ID
  212. }
  213. $http.post(apiurljs.login + "g2app/fawenfiles/createNewWorkFlowWithGwtype", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  214. .success(function (obj) {
  215. var res = strToJson(s4.decryptData_CBC(obj.data));
  216. sp.dialoghide();
  217. if (res.success) {
  218. self.getGLFLOW();
  219. } else {
  220. sp.dialog("删除失败,请联系管理员!");
  221. }
  222. });
  223. }
  224. self.deleteWG = function (file) {
  225. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  226. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  227. 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>";
  228. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  229. sp.openCenter(".sp-dialog");
  230. ///取消按钮
  231. $('.sp-closeDialog').click(function (event) {
  232. sp.closeCenter(".sp-dialog");
  233. event.preventDefault();
  234. event.stopPropagation();
  235. });
  236. //post消息的id
  237. $("#delDataTrue").click(function () {
  238. var data = {
  239. id: file.ID
  240. };
  241. $http.post(apiurljs.login + "g2app/fawenfilesrelate/deleteDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  242. .success(function (obj) {
  243. var res = strToJson(s4.decryptData_CBC(obj.data));
  244. sp.dialoghide();
  245. if (res.success) {
  246. $.each(self.iframeList, function (index, item) {
  247. if (item.title == file.FILENAMES && item.source == apiurljs.login.split("glwork/")[0] + "glworkweb/" + file.FILEURL) {
  248. self.closeItem(index);
  249. return false;
  250. }
  251. })
  252. self.getGLJ(1);
  253. } else {
  254. sp.dialog("删除失败,请联系管理员!");
  255. }
  256. });
  257. });
  258. }
  259. self.openGL = function (item) {
  260. var data = {
  261. tablename: "SYS_DESKTOP_PLUGIN_TODO",
  262. colums: "*",
  263. order: "SORTID",
  264. sqlwhere: "",
  265. sqlorwhere: "",
  266. sqlinwhere: "",
  267. sqllikewhere: { FLOWID: item.FLOWID }
  268. }
  269. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  270. .success(function (obj) {
  271. var res = strToJson(s4.decryptData_CBC(obj.data));
  272. sp.openNewWindow("../../" + res.data[0].FILEN.split("/")[1] + "/" + item.FILEN + "&flowid=" + item.FLOWID + "&dotype=1", item.TITLE)
  273. });
  274. }
  275. self.downLoaDWG = function (item) {
  276. if (item.FILEURL.indexOf("files") > -1) {
  277. window.open(apiurljs.login + "g2work/files/" + item.FILEURL.slice(7))
  278. } else {
  279. window.open(apiurljs.login.split("glwork/")[0] + "glworkweb/" + item.FILEURL)
  280. }
  281. }
  282. self.readonly = {
  283. JJCD: false,
  284. FWZH: false,
  285. WLDQFL: false,
  286. WLDSSL: false,
  287. XXGKSH: false,
  288. SFXYJD: false,
  289. FLSH: false,
  290. GPJZSC: false,
  291. BGSFHYJ: false,
  292. SX: false,
  293. BMFZRYJ: false,
  294. NGR: false,
  295. NGRQ: false,
  296. HBCSYJ: false,
  297. GWZL: false,
  298. YF: false,
  299. BT: false,
  300. ZS: false,
  301. CS: false
  302. }
  303. self.show = {
  304. JJCD: false,
  305. FWZH: false,
  306. WLDQFL: false,
  307. WLDSSL: false,
  308. XXGKSH: false,
  309. SFXYJD: false,
  310. FLSH: false,
  311. GPJZSC: false,
  312. BGSFHYJ: false,
  313. SX: false,
  314. BMFZRYJ: false,
  315. NGR: false,
  316. NGRQ: false,
  317. HBCSYJ: false,
  318. GWZL: false,
  319. YF: false,
  320. BT: false,
  321. ZS: false,
  322. CS: false
  323. }
  324. self.type = 1;
  325. self.getSwenList = function (n) {
  326. self.SwenList = [];
  327. var data = {
  328. directionid: self.directionid,
  329. userid: self.userId,
  330. routeinfoid: self.routeinfoid,
  331. routeid: self.routeid,
  332. formeditid: ""
  333. }
  334. $http.post(apiurljs.login + "g2app/abase/queryDataLink", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  335. .success(function (obj) {
  336. var res = strToJson(s4.decryptData_CBC(obj.data));
  337. if (self.copyrightid == "") {
  338. self.copyrightid = res.data.LINKS[0].COPYRIGHTID
  339. }
  340. $.each(res.data.LINKS, function (index, item) {
  341. item.TEMPFORM = item.TEMPFORM + "&flowid=" + sp.getUrlName("flowid")
  342. if (item.TEMPFORM.indexOf("?docmode") > 0) {
  343. if (item.TEMPFORM.indexOf("attachlist") > -1 || item.TEMPFORM.indexOf("fawenfile") > -1) {
  344. item.TEMPFORM = item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
  345. } else {
  346. item.TEMPFORM = "../" + item.TEMPFORM + "&dotype=" + self.dotype + "&type=" + self.get_type + "&lastReturnPageno=" + self.get_lastReturnPageno + "&lastReturnPage=" + self.get_lastReturnPage;
  347. }
  348. } else {
  349. item.TEMPFORM = "#";
  350. }
  351. self.SwenList.push(item)
  352. })
  353. self.SwenList.push({
  354. VNAME: "流程图",
  355. DIRECTIONID: self.SwenList[0].DIRECTIONID,
  356. TEMPFORM: "modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
  357. })
  358. if (n == 0) {
  359. self.getFLOW()
  360. } else {
  361. self.getData()
  362. }
  363. })
  364. }
  365. self.getSwenList(0)
  366. self.getFLOW = function () {
  367. var data = {
  368. copyrightid: self.copyrightid
  369. }
  370. $http.post(apiurljs.login + "g2work/flow/queryDataByCopyrightid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  371. .success(function (obj) {
  372. var res = strToJson(s4.decryptData_CBC(obj.data));
  373. self.flowTitle = res.data.CNAME;
  374. self.getJJCD()
  375. })
  376. }
  377. self.getJJCD = function () {
  378. var data = {
  379. ckey: "CODE_JJCD",
  380. routeinfoid: self.routeinfoid
  381. }
  382. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  383. .success(function (obj) {
  384. var res = strToJson(s4.decryptData_CBC(obj.data));
  385. self.JJCD = res.data.CODE_JJCD;
  386. self.getXXGKSH()
  387. })
  388. }
  389. self.getXXGKSH = function () {
  390. var data = {
  391. ckey: "CODE_XXGKSH",
  392. routeinfoid: self.routeinfoid
  393. }
  394. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  395. .success(function (obj) {
  396. var res = strToJson(s4.decryptData_CBC(obj.data));
  397. self.XXGKSH = res.data.CODE_XXGKSH;
  398. self.getGWZL()
  399. })
  400. }
  401. self.getGWZL = function () {
  402. var data = {
  403. tablename: "CODE_GWTYPE",
  404. colums: "ID,CODE,CNAME,FLOWID,DOCFILE,REDFILE",
  405. order: "SORTID desc",
  406. sqlwhere: {
  407. USEMARK: 1,
  408. FLOWID: sp.getUrlName("flowid")
  409. },
  410. sqlinwhere: "",
  411. sqllikewhere: ""
  412. }
  413. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  414. .success(function (obj) {
  415. var res = strToJson(s4.decryptData_CBC(obj.data));
  416. self.GWZL = res.data;
  417. self.getSFXYJD()
  418. })
  419. }
  420. self.getSFXYJD = function () {
  421. var data = {
  422. ckey: "CODE_SFXYJD",
  423. routeinfoid: self.routeinfoid
  424. }
  425. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  426. .success(function (obj) {
  427. var res = strToJson(s4.decryptData_CBC(obj.data));
  428. self.SFXYJD = res.data.CODE_SFXYJD;
  429. self.getBGSFHYJ()
  430. })
  431. }
  432. self.getBGSFHYJ = function () {
  433. var data = {
  434. ckey: "CODE_BGSFHYJ",
  435. routeinfoid: self.routeinfoid
  436. }
  437. $http.post(apiurljs.login + "g2app/abase/queryDataCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  438. .success(function (obj) {
  439. var res = strToJson(s4.decryptData_CBC(obj.data));
  440. self.BGSFHYJ = res.data.CODE_BGSFHYJ;
  441. self.getDpList()
  442. })
  443. }
  444. self.getDpList = function () {
  445. $http.post(apiurljs.login + "g2app/dataabase/getDpList", { data: s4.encryptData_CBC("") }, postCfg)
  446. .success(function (obj) {
  447. var res = strToJson(s4.decryptData_CBC(obj.data));
  448. self.dpList = res.data;
  449. self.dpList.forEach(function (item) {
  450. item.checked = false;
  451. item.USER.forEach(function (item1) {
  452. item1.checked = false;
  453. item1.USHOWNAME1 = item1.USHOWNAME.length > 3 ? item1.USHOWNAME.slice(0, 3) + "..." : item1.USHOWNAME;
  454. item1.USHOWNAME2 = item1.USHOWNAME.length > 10 ? item1.USHOWNAME.slice(0, 10) + "..." : item1.USHOWNAME
  455. })
  456. })
  457. self.AllChecked = { GKFW: false };
  458. self.UserLength = { GKFW: 0 };
  459. self.selectList = {};
  460. self.dpList.forEach(function (item) {
  461. item.checked = false;
  462. item.USER.forEach(function (item1) {
  463. self.UserLength.GKFW++
  464. })
  465. })
  466. self.UserList = {
  467. GKFW: JSON.parse(JSON.stringify(self.dpList))
  468. };
  469. self.getDP()
  470. })
  471. }
  472. self.getDP = function () {
  473. var data = {
  474. userid: self.userId
  475. }
  476. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  477. .success(function (obj) {
  478. var res = strToJson(s4.decryptData_CBC(obj.data));
  479. self.userDpName = res.data.length == 0 ? "" : res.data[0].SECTION;
  480. self.userDpCode = res.data.length == 0 ? "" : res.data[0].CODE;
  481. self.getData();
  482. })
  483. }
  484. //获取数据
  485. self.getData = function () {
  486. var data = {
  487. ckey: "FW_ZRBGHYJY",
  488. id: 0,
  489. directionid: self.directionid,
  490. formeditid: self.formeditid,
  491. routeid: self.routeid,
  492. routeinfoid: self.routeinfoid
  493. }
  494. $http.post(apiurljs.login + "g2app/abase/queryData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  495. .success(function (obj) {
  496. var res = strToJson(s4.decryptData_CBC(obj.data));
  497. self.data = {
  498. ID: res.data.FW_ZRBGHYJY.ID,
  499. APPCODE: res.data.FW_ZRBGHYJY.APPCODE,
  500. JJCD: res.data.FW_ZRBGHYJY.JJCD == "" ? self.JJCD[0].CODE : res.data.FW_ZRBGHYJY.JJCD,
  501. FWZH: res.data.FW_ZRBGHYJY.FWZH,
  502. FWZH1: res.data.FW_ZRBGHYJY.FWZH,
  503. XXGKSH: res.data.FW_ZRBGHYJY.XXGKSH == "" ? self.XXGKSH[0].CODE : res.data.FW_ZRBGHYJY.XXGKSH,
  504. SFXYJD: res.data.FW_ZRBGHYJY.SFXYJD == "" ? self.SFXYJD[0].CODE : res.data.FW_ZRBGHYJY.SFXYJD,
  505. BGSFHYJ: res.data.FW_ZRBGHYJY.BGSFHYJ == "" ? self.BGSFHYJ[0].CODE : res.data.FW_ZRBGHYJY.BGSFHYJ,
  506. NGR: res.data.FW_ZRBGHYJY.NGR == "" ? self.userName : res.data.FW_ZRBGHYJY.NGR,
  507. NGRQ: res.data.FW_ZRBGHYJY.NGRQ == "" ? sp.format(sp.getLocalDate()) : sp.format(res.data.FW_ZRBGHYJY.NGRQ),
  508. GWZL: res.data.FW_ZRBGHYJY.GWZL == "" ? self.GWZL[0].CODE : res.data.FW_ZRBGHYJY.GWZL,
  509. YF: res.data.FW_ZRBGHYJY.YF,
  510. BT: res.data.FW_ZRBGHYJY.BT,
  511. ZS: res.data.FW_ZRBGHYJY.ZS,
  512. CS: res.data.FW_ZRBGHYJY.CS,
  513. FBZT: "",
  514. FBBM: self.userDpName,
  515. FBLX: "发文",
  516. FBRQ: "",
  517. NGRUSERID: res.data.FW_ZRBGHYJY.NGRUSERID == "" ? self.userId : res.data.FW_ZRBGHYJY.NGRUSERID,
  518. NGRBM: res.data.FW_ZRBGHYJY.NGRBM == "" ? self.userDpName : res.data.FW_ZRBGHYJY.NGRBM,
  519. NGRBMID: res.data.FW_ZRBGHYJY.NGRBMID == "" ? self.userDpCode : res.data.FW_ZRBGHYJY.NGRBMID,
  520. MQFMARK: res.data.FW_ZRBGHYJY.MQFMARK
  521. }
  522. self.readonly = {
  523. JJCD: res.data.FW_ZRBGHYJY["JJCD.EREADONLY"] == "true",
  524. WLDQFL: res.data.FW_ZRBGHYJY["WLDQFL.EREADONLY"] == "true",
  525. WLDSSL: res.data.FW_ZRBGHYJY["WLDSSL.EREADONLY"] == "true",
  526. XXGKSH: res.data.FW_ZRBGHYJY["XXGKSH.EREADONLY"] == "true",
  527. SFXYJD: res.data.FW_ZRBGHYJY["SFXYJD.EREADONLY"] == "true",
  528. FLSH: res.data.FW_ZRBGHYJY["FLSH.EREADONLY"] == "true",
  529. GPJZSC: res.data.FW_ZRBGHYJY["GPJZSC.EREADONLY"] == "true",
  530. BGSFHYJ: res.data.FW_ZRBGHYJY["BGSFHYJ.EREADONLY"] == "true",
  531. SX: res.data.FW_ZRBGHYJY["SX.EREADONLY"] == "true",
  532. BMFZRYJ: res.data.FW_ZRBGHYJY["BMFZRYJ.EREADONLY"] == "true",
  533. NGR: res.data.FW_ZRBGHYJY["NGR.EREADONLY"] == "true",
  534. NGRQ: res.data.FW_ZRBGHYJY["NGRQ.EREADONLY"] == "true",
  535. HBCSYJ: res.data.FW_ZRBGHYJY["HBCSYJ.EREADONLY"] == "true",
  536. GWZL: res.data.FW_ZRBGHYJY["GWZL.EREADONLY"] == "true",
  537. YF: res.data.FW_ZRBGHYJY["YF.EREADONLY"] == "true",
  538. BT: res.data.FW_ZRBGHYJY["BT.EREADONLY"] == "true",
  539. ZS: res.data.FW_ZRBGHYJY["ZS.EREADONLY"] == "true",
  540. CS: res.data.FW_ZRBGHYJY["CS.EREADONLY"] == "true",
  541. FWZH: res.data.FW_ZRBGHYJY["FWZH.EREADONLY"] == "true"
  542. }
  543. self.show = {
  544. JJCD: res.data.FW_ZRBGHYJY["JJCD.ESHOW"] == "true",
  545. WLDQFL: res.data.FW_ZRBGHYJY["WLDQFL.ESHOW"] == "true",
  546. WLDSSL: res.data.FW_ZRBGHYJY["WLDSSL.ESHOW"] == "true",
  547. XXGKSH: res.data.FW_ZRBGHYJY["XXGKSH.ESHOW"] == "true",
  548. SFXYJD: res.data.FW_ZRBGHYJY["SFXYJD.ESHOW"] == "true",
  549. FLSH: res.data.FW_ZRBGHYJY["FLSH.ESHOW"] == "true",
  550. GPJZSC: res.data.FW_ZRBGHYJY["GPJZSC.ESHOW"] == "true",
  551. BGSFHYJ: res.data.FW_ZRBGHYJY["BGSFHYJ.ESHOW"] == "true",
  552. SX: res.data.FW_ZRBGHYJY["SX.ESHOW"] == "true",
  553. BMFZRYJ: res.data.FW_ZRBGHYJY["BMFZRYJ.ESHOW"] == "true",
  554. NGR: res.data.FW_ZRBGHYJY["NGR.ESHOW"] == "true",
  555. NGRQ: res.data.FW_ZRBGHYJY["NGRQ.ESHOW"] == "true",
  556. HBCSYJ: res.data.FW_ZRBGHYJY["HBCSYJ.ESHOW"] == "true",
  557. GWZL: res.data.FW_ZRBGHYJY["GWZL.ESHOW"] == "true",
  558. YF: res.data.FW_ZRBGHYJY["YF.ESHOW"] == "true",
  559. BT: res.data.FW_ZRBGHYJY["BT.ESHOW"] == "true",
  560. ZS: res.data.FW_ZRBGHYJY["ZS.ESHOW"] == "true",
  561. CS: res.data.FW_ZRBGHYJY["CS.ESHOW"] == "true",
  562. FWZH: res.data.FW_ZRBGHYJY["FWZH.ESHOW"] == "true"
  563. }
  564. if (self.data.ID == 0) {
  565. self.filedChange = true;
  566. } else {
  567. self.filedChange = false;
  568. }
  569. self.buttonList = res.data["FW_ZRBGHYJY.FUNCLIST"];
  570. if (self.lastrouteinfoid != 0) {
  571. self.getHB()
  572. }
  573. self.getOpinion1(0)
  574. self.getOther()
  575. self.getGLJ(0)
  576. self.getGCG(0)
  577. self.getCWG()
  578. self.getQZG()
  579. if (self.docmode == 'zihao' || self.data.FWZH1 != "") {
  580. self.getFWZH()
  581. }
  582. self.getMeetMsg()
  583. $interval(function () {
  584. self.getNumMeet()
  585. }, 2000)
  586. $timeout(function () {
  587. $(".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")
  588. var height1 = $(".formedit center").css("height"), height2 = 0;
  589. $(".auto").siblings().each(function () {
  590. height2 = height2 + $(this).outerHeight();
  591. })
  592. if (height1.slice(0, height1.length - 2) - height2 < 277) {
  593. $(".auto").css("height", 277);
  594. $(".formedit center").css("height", $(".formedit center").height() + (277 - (height1.slice(0, height1.length - 2) - height2)))
  595. } else {
  596. $(".auto").css("height", height1.slice(0, height1.length - 2) - height2);
  597. }
  598. }, 100)
  599. })
  600. }
  601. //docmode=='zihao'时加载
  602. self.getFWZH = function () {
  603. var data = {
  604. flowid: sp.getUrlName("flowid"),
  605. code: "",
  606. cyear: self.data.FWZH == "" ? sp.currentYear() : self.data.FWZH.slice(self.data.FWZH.indexOf("〔") + 1, self.data.FWZH.indexOf("〕")),
  607. routeinfoidmark: self.routeinfoid,
  608. zihao: self.data.FWZH
  609. }
  610. $http.post(apiurljs.login + "g2app/fawen/queryZiHaoCode", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  611. .success(function (obj) {
  612. var res = strToJson(s4.decryptData_CBC(obj.data));
  613. self.FWZH = res.data.map(function (item) {
  614. return { CNAME: item.split("|")[0], CODE: item.split("|")[0], CNAMEMARK: item.split("|")[1] }
  615. });
  616. if (self.data.FWZH == "") { self.data.FWZH = self.FWZH[0].CODE }
  617. })
  618. }
  619. //生成左侧合并文件
  620. self.getHB = function () {
  621. if (self.data.MQFMARK == 1) {
  622. var data = {
  623. routeinfoid: self.routeinfoid
  624. }
  625. $http.post(apiurljs.login + "g2app/dataabase/mergeOFDByLastRouteinfoidWithCurrentRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  626. .success(function (obj) {
  627. var res = strToJson(s4.decryptData_CBC(obj.data));
  628. if (res.data != "") {
  629. let postData = {
  630. convertType: 570,
  631. fileUrl: res.data,
  632. isPrint: 1,
  633. isDownload: 1,
  634. };
  635. var postCfg_transfer = {
  636. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  637. transformRequest: function (data) {
  638. return $.param(data);
  639. }
  640. };
  641. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  642. .success(function (res) {
  643. self.LoadYZ = false;
  644. if (res.errorcode === 0) {
  645. self.iframeList[0] = { id: 1, title: "签报收文", filename: "文档", url: $sce.trustAsResourceUrl(sp.ipChange(res.data.viewUrl)), source: res.data.viewUrl, edit: false, show: 1, boxStyle: { width: $(".leftBox").width() }, iframeStyle: { width: $(".leftBox").width() - 10 } };
  646. self.iframeLast = self.iframeList.length - 1;
  647. self.iframeShow = self.iframeList.length;
  648. self.iframeHide = self.iframeList.length - self.iframeShow;
  649. } else {
  650. sp.dialog(res.message);
  651. }
  652. });
  653. } else {
  654. var data = {
  655. routeinfoid: self.routeinfoid
  656. }
  657. $http.post(apiurljs.login + "g2app/dataabase/mergePDFByLastRouteinfoidWithCurrentRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  658. .success(function (obj) {
  659. var res = strToJson(s4.decryptData_CBC(obj.data));
  660. if (res.data != "") {
  661. let postData = {
  662. convertType: 20,
  663. fileUrl: res.data,
  664. isPrint: 1,
  665. isDownload: 1,
  666. };
  667. var postCfg_transfer = {
  668. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  669. transformRequest: function (data) {
  670. return $.param(data);
  671. }
  672. };
  673. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  674. .success(function (res) {
  675. self.LoadYZ = false;
  676. if (res.errorcode === 0) {
  677. self.iframeList[0] = { id: 1, title: "签报收文", filename: "文档", url: $sce.trustAsResourceUrl(sp.ipChange(res.data.viewUrl)), source: res.data.viewUrl, edit: false, show: 1, boxStyle: { width: $(".leftBox").width() }, iframeStyle: { width: $(".leftBox").width() - 10 } };
  678. self.iframeLast = self.iframeList.length - 1;
  679. self.iframeShow = self.iframeList.length;
  680. self.iframeHide = self.iframeList.length - self.iframeShow;
  681. } else {
  682. sp.dialog(res.message);
  683. }
  684. });
  685. }
  686. })
  687. }
  688. })
  689. } else {
  690. var data = {
  691. routeinfoid: self.routeinfoid
  692. }
  693. $http.post(apiurljs.login + "g2app/dataabase/mergeFileByLastRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  694. .success(function (obj) {
  695. var res = strToJson(s4.decryptData_CBC(obj.data));
  696. if (res.data.result != "") {
  697. let postData = {
  698. convertType: res.data.mark == "ofd" ? 570 : 20,
  699. isDownload: 1,
  700. isPrint: 1,
  701. fileUrl: res.data.result
  702. };
  703. var postCfg_transfer = {
  704. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  705. transformRequest: function (data) {
  706. return $.param(data);
  707. }
  708. };
  709. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  710. .success(function (res) {
  711. if (res.errorcode === 0) {
  712. self.iframeList = [{ id: 1, title: "签报收文", filename: "文档", url: $sce.trustAsResourceUrl(sp.ipChange(res.data.viewUrl)), source: res.data.viewUrl, edit: false, show: 1, boxStyle: { width: $(".leftBox").width() }, iframeStyle: { width: $(".leftBox").width() - 10 } }];
  713. self.iframeLast = self.iframeList.length - 1;
  714. self.iframeShow = self.iframeList.length;
  715. self.iframeHide = self.iframeList.length - self.iframeShow;
  716. } else {
  717. sp.dialog(res.message);
  718. }
  719. });
  720. } else {
  721. var data = {
  722. routeinfoid: self.routeinfoid
  723. }
  724. $http.post(apiurljs.login + "g2app/dataabase/mergePDFByLastRouteinfoid", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  725. .success(function (obj) {
  726. var res = strToJson(s4.decryptData_CBC(obj.data));
  727. if (res.data.result != "") {
  728. let postData = {
  729. convertType: res.data.mark == "ofd" ? 570 : 20,
  730. isDownload: 1,
  731. isPrint: 1,
  732. fileUrl: res.data.result
  733. };
  734. var postCfg_transfer = {
  735. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  736. transformRequest: function (data) {
  737. return $.param(data);
  738. }
  739. };
  740. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  741. .success(function (res) {
  742. if (res.errorcode === 0) {
  743. self.iframeList = [{ id: 1, title: "签报收文", filename: "文档", url: $sce.trustAsResourceUrl(sp.ipChange(res.data.viewUrl)), source: res.data.viewUrl, edit: false, show: 1, boxStyle: { width: $(".leftBox").width() }, iframeStyle: { width: $(".leftBox").width() - 10 } }];
  744. self.iframeLast = self.iframeList.length - 1;
  745. self.iframeShow = self.iframeList.length;
  746. self.iframeHide = self.iframeList.length - self.iframeShow;
  747. } else {
  748. sp.dialog(res.message);
  749. }
  750. });
  751. }
  752. })
  753. }
  754. })
  755. }
  756. }
  757. //获取关联文稿
  758. self.getGLJ = function (n) {
  759. var data = {
  760. dockind: "D01",
  761. routeinfoid: self.routeinfoid
  762. }
  763. $http.post(apiurljs.login + "g2app/fawenfilesrelate/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  764. .success(function (obj) {
  765. var res = strToJson(s4.decryptData_CBC(obj.data));
  766. self.guanlian = res.data;
  767. console.log(self.guanlian)
  768. if (n == 0) {
  769. self.getGLFLOW()
  770. }
  771. if (n == 2) {
  772. self.editFile(self.guanlian[self.guanlian.length - 1], 2)
  773. }
  774. })
  775. }
  776. self.seeGLJ = function () {
  777. if ($(".formedit2").find("iframe").attr("src") == "") {
  778. if (self.guanlian[0].FILEURL.indexOf("files") > -1) {
  779. var set_filepath = apiurljs.yzFcscloud + "g2work/files/" + self.guanlian[0].FILEURL.slice(7);
  780. } else {
  781. var set_filepath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + self.guanlian[0].FILEURL;
  782. }
  783. var data = {
  784. method: 1,
  785. params: {
  786. userId: self.userName,
  787. fileId: "",
  788. fileName: "",
  789. filePath: "",
  790. userRight: self.dotype != 1 ? 1 : 0,
  791. callbackUrl: ""
  792. }
  793. };
  794. if (self.guanlian[0].FILEURL.indexOf("files") > -1) {
  795. data.params.fileId = self.guanlian[0].FILEURL.split("/")[2];
  796. data.params.fileName = self.guanlian[0].FILEURL.split("/")[3];
  797. data.params.filePath = apiurljs.yzFcscloud + "g2work/files/" + self.guanlian[0].FILEURL.slice(7);
  798. data.params.callbackUrl = apiurljs.login + "g2app/attachfiles/uploadFileAttach"
  799. } else {
  800. data.params.fileId = self.guanlian[0].ID;
  801. data.params.fileName = self.guanlian[0].FILENAMES;
  802. data.params.filePath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + self.guanlian[0].FILEURL;
  803. data.params.callbackUrl = apiurljs.login + "g2app/fawenfiles/uploadFile"
  804. }
  805. $.ajax({
  806. url: apiurljs.yzFileWo + "api.do",
  807. data: {
  808. jsonParams: encodeURIComponent(JSON.stringify(data))
  809. },
  810. type: "POST",
  811. dataType: "json",
  812. general: false,
  813. async: false,
  814. success: function (data) {
  815. if (data) {
  816. if (data.errorCode === "0") {
  817. let rst = data.result;
  818. if (rst && rst.urls) {
  819. var get_urls = rst.urls;
  820. if (typeof (get_urls) === "string") {
  821. $(".formedit2").find("iframe").attr("src", sp.ipChange(get_urls)).attr("data-id", self.guanlian[0].ID)
  822. }
  823. }
  824. }
  825. }
  826. },
  827. });
  828. }
  829. }
  830. //获取关联流程
  831. self.getGLFLOW = function () {
  832. var data = {
  833. userid: self.userId,
  834. routeinfoid: self.routeinfoid
  835. }
  836. $http.post(apiurljs.login + "g2work/routeinfo/queryDataRelatedFlow", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  837. .success(function (obj) {
  838. var res = strToJson(s4.decryptData_CBC(obj.data));
  839. res.data.FLOWIN.forEach(function (item) {
  840. item.type = "FLOWIN"
  841. })
  842. res.data.FLOWOUT.forEach(function (item) {
  843. item.type = "FLOWOUT"
  844. })
  845. self.glList = res.data.FLOWIN.concat(res.data.FLOWOUT);
  846. console.log(self.glList)
  847. })
  848. }
  849. //获取意见(不上表)
  850. self.getOpinion1 = function (n) {
  851. self.HWFJ = [];
  852. var data = {
  853. cmanid: self.userId,
  854. routeinfoid: self.routeinfoid,
  855. routeid: "",//self.routeid,
  856. tableid: "FW_ZRBGHYJY",
  857. colid: "",
  858. opiniontype: "",//self.opiniontype,
  859. orderbycol: "CDATE desc"
  860. }
  861. $http.post(apiurljs.login + "g2app/abase/queryDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  862. .success(function (obj) {
  863. var res = strToJson(s4.decryptData_CBC(obj.data));
  864. if (res.success == true) {
  865. for (var i in self.YJ) {
  866. if (typeof (self.YJ[i]) == "object") {
  867. self.YJ[i] = [];
  868. self.YJ[i + "STATUS"] = false;
  869. res.data.forEach(function (item) {
  870. item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
  871. if (i == item.COLID) {
  872. self.YJ[i].push(item)
  873. if (item.ROUTEID == self.routeid) {
  874. self.data[i] = item.opinion;
  875. self.YJ[i + "STATUS"] = true;
  876. }
  877. }
  878. })
  879. }
  880. }
  881. self.YJ.nulla = res.data.filter(function (item) {
  882. return item.COLID == "";
  883. });
  884. self.YJ.nullaSTATUS = false;
  885. self.YJ.nulla.forEach(function (item) {
  886. item.CDATE = sp.datefmt("yyyy-MM-dd", item.CDATE);
  887. if (self.activeOpinion != null) {
  888. self.activeOpinion.FILEDATA = item.FILEDATA
  889. }
  890. })
  891. res.data.forEach(function (item) {
  892. item.FILEDATA.forEach(function (item1) {
  893. self.HWFJ.push(item1)
  894. })
  895. })
  896. //if (n == 1 && self.lastrouteinfoid != 0) {
  897. // self.getHB()
  898. //}
  899. } else {
  900. sp.dialog(res.message)
  901. }
  902. })
  903. }
  904. //获取附件
  905. self.getOther = function () {
  906. if (self.routeinfoid == 0) { return }
  907. var data = {
  908. tablename: "FILE_ATTACH",
  909. colums: "*",
  910. order: "ID asc",
  911. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  912. sqlinwhere: "",
  913. sqllikewhere: ""
  914. }
  915. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  916. .success(function (obj) {
  917. var res = strToJson(s4.decryptData_CBC(obj.data));
  918. self.arrayFile1 = [];
  919. if (res.data.length > 0) {
  920. res.data.forEach(function (item) {
  921. if (item.ATTACHTYPE.indexOf("-正文") == -1) {
  922. self.arrayFile1.push(item)
  923. }
  924. })
  925. }
  926. })
  927. }
  928. //发文打开过程稿在线编辑
  929. self.getGCG = function (n) {
  930. var data = {
  931. dockind: "D01",
  932. routeinfoid: self.routeinfoid
  933. }
  934. $http.post(apiurljs.login + "g2app/fawenfiles/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  935. .success(function (obj) {
  936. var res = strToJson(s4.decryptData_CBC(obj.data));
  937. self.gaoTypeArrayFirst = res.data;
  938. self.gaoTypeArrayFirst.forEach(function (item) {
  939. if (item.FILENAMES.split(".").length == 1) {
  940. item.FILENAMES = item.FILENAMES + "." + item.FILEEXT
  941. }
  942. })
  943. if (self.gaoTypeArrayFirst.length > 0 && self.lastrouteinfoid == 0) {
  944. self.seeGCG()
  945. }
  946. if (n > 0) {
  947. self.editFile(self.gaoTypeArrayFirst[0], 1, "正文");
  948. }
  949. if (self.gaoTypeArrayFirst.length > 1) {
  950. var data = {
  951. id: self.gaoTypeArrayFirst[0].ID
  952. }
  953. $http.post(apiurljs.login + "g2app/fawenfiles/deleteDataFile", { 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) {
  957. self.getGCG(2)
  958. }
  959. });
  960. }
  961. })
  962. }
  963. self.seeGCG = function () {
  964. if ($(".formedit1").find("iframe").attr("src") == "") {
  965. if (self.gaoTypeArrayFirst[0].FILEURL.indexOf("files") > -1) {
  966. var set_filepath = apiurljs.yzFcscloud + "g2work/files/" + self.gaoTypeArrayFirst[0].FILEURL.slice(7);
  967. } else {
  968. var set_filepath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + self.gaoTypeArrayFirst[0].FILEURL;
  969. }
  970. var data = {
  971. method: 1,
  972. params: {
  973. userId: self.userName,
  974. fileId: "",
  975. fileName: "",
  976. filePath: "",
  977. userRight: self.dotype != 1 ? 1 : 0,
  978. callbackUrl: ""
  979. }
  980. };
  981. if (self.gaoTypeArrayFirst[0].FILEURL.indexOf("files") > -1) {
  982. data.params.fileId = self.gaoTypeArrayFirst[0].FILEURL.split("/")[2];
  983. data.params.fileName = self.gaoTypeArrayFirst[0].FILEURL.split("/")[3];
  984. data.params.filePath = apiurljs.yzFcscloud + "g2work/files/" + self.gaoTypeArrayFirst[0].FILEURL.slice(7);
  985. data.params.callbackUrl = apiurljs.login + "g2app/attachfiles/uploadFileAttach"
  986. } else {
  987. data.params.fileId = self.gaoTypeArrayFirst[0].ID;
  988. data.params.fileName = self.gaoTypeArrayFirst[0].FILENAMES;
  989. data.params.filePath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + self.gaoTypeArrayFirst[0].FILEURL;
  990. data.params.callbackUrl = apiurljs.login + "g2app/fawenfiles/uploadFile"
  991. }
  992. $.ajax({
  993. url: apiurljs.yzFileWo + "api.do",
  994. data: {
  995. jsonParams: encodeURIComponent(JSON.stringify(data))
  996. },
  997. type: "POST",
  998. dataType: "json",
  999. general: false,
  1000. async: false,
  1001. success: function (data) {
  1002. if (data) {
  1003. if (data.errorCode === "0") {
  1004. let rst = data.result;
  1005. if (rst && rst.urls) {
  1006. var get_urls = rst.urls;
  1007. if (typeof (get_urls) === "string") {
  1008. $(".formedit1").find("iframe").attr("src", sp.ipChange(get_urls)).attr("data-id", self.gaoTypeArrayFirst[0].ID)
  1009. }
  1010. }
  1011. }
  1012. }
  1013. },
  1014. });
  1015. }
  1016. }
  1017. //成文稿
  1018. self.getCWG = function () {
  1019. var data = {
  1020. dockind: "D02",
  1021. routeinfoid: self.routeinfoid
  1022. }
  1023. $http.post(apiurljs.login + "g2app/fawenfiles/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1024. .success(function (obj) {
  1025. var res = strToJson(s4.decryptData_CBC(obj.data));
  1026. self.gaoTypeArraySecond = res.data;
  1027. self.gaoTypeArraySecond.forEach(function (item) {
  1028. if (item.FILENAMES.split(".").length == 1) {
  1029. item.FILENAMES = item.FILENAMES + "." + item.FILEEXT
  1030. }
  1031. })
  1032. })
  1033. }
  1034. //签章稿
  1035. self.getQZG = function () {
  1036. var data = {
  1037. dockind: "D03",
  1038. routeinfoid: self.routeinfoid
  1039. }
  1040. $http.post(apiurljs.login + "g2app/fawenfiles/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1041. .success(function (obj) {
  1042. var res = strToJson(s4.decryptData_CBC(obj.data));
  1043. self.gaoTypeArrayThird = res.data;
  1044. self.gaoTypeArrayThird.forEach(function (item) {
  1045. if (item.FILENAMES.split(".").length == 1) {
  1046. item.FILENAMES = item.FILENAMES + "." + item.FILEEXT
  1047. }
  1048. })
  1049. })
  1050. }
  1051. //下载正文/终稿/签章
  1052. self.downloadWG = function (item) {
  1053. //window.open(apiurljs.login.split("glwork/")[0] + "glworkweb/" + item.FILEURL)
  1054. window.open(apiurljs.login + "g2work/gaizhangfiles/" + encodeURIComponent(self.data.BT) + "/" + item.FILENAMES)
  1055. }
  1056. //删除正文/终稿/签章
  1057. self.btnDeleteWG = function (obj, n) {
  1058. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  1059. var dialogBody = "<div class=\"sp-dialog-body\">删除后不可恢复,您确认要删除吗?</div>";
  1060. 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>";
  1061. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  1062. sp.openCenter(".sp-dialog");
  1063. ///取消按钮
  1064. $('.sp-closeDialog').click(function (event) {
  1065. sp.closeCenter(".sp-dialog");
  1066. event.preventDefault();
  1067. event.stopPropagation();
  1068. });
  1069. //post消息的id
  1070. $("#delDataTrue").click(function () {
  1071. var data = {
  1072. id: obj.ID
  1073. }
  1074. $http.post(apiurljs.login + "g2app/fawenfiles/deleteDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1075. .success(function (obj) {
  1076. var res = strToJson(s4.decryptData_CBC(obj.data));
  1077. sp.dialoghide();
  1078. if (res.success) {
  1079. if (n == 2) {
  1080. self.getCWG()
  1081. } else if (n == 3) {
  1082. self.getQZG()
  1083. }
  1084. } else {
  1085. sp.dialog("创建失败,请联系管理员!");
  1086. }
  1087. ///
  1088. });
  1089. });
  1090. };
  1091. //生成正文三种方式:空白模板,红头模板,上传本地文件
  1092. self.newMoBanFlag = false;
  1093. self.newMoBan1 = function () {
  1094. self.newMoBanFlag = true;
  1095. if (self.gaoTypeArrayFirst.length > 0) {
  1096. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  1097. var dialogBody = "<div class=\"sp-dialog-body\">您确定要覆盖正文吗?</div>";
  1098. 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>";
  1099. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  1100. sp.openCenter(".sp-dialog");
  1101. ///取消按钮
  1102. $('.sp-closeDialog').click(function (event) {
  1103. sp.closeCenter(".sp-dialog");
  1104. event.preventDefault();
  1105. event.stopPropagation();
  1106. });
  1107. //post消息的id
  1108. $("#delDataTrue").click(function () {
  1109. sp.closeCenter(".sp-dialog");
  1110. var data = {
  1111. id: self.gaoTypeArrayFirst[0].ID
  1112. }
  1113. $http.post(apiurljs.login + "g2app/fawenfiles/deleteDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1114. .success(function (obj) {
  1115. var res = strToJson(s4.decryptData_CBC(obj.data));
  1116. if (res.success) {
  1117. var data = {
  1118. dockind: "D01",
  1119. routeinfoid: self.routeinfoid,
  1120. gwtype: self.data.GWZL,
  1121. filekind: "DOCFILE"
  1122. }
  1123. $http.post(apiurljs.login + "g2app/fawenfiles/newDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1124. .success(function (obj) {
  1125. var res = strToJson(s4.decryptData_CBC(obj.data));
  1126. if (res.success) {
  1127. self.getGCG(1)
  1128. } else {
  1129. sp.dialog("创建失败,请联系管理员!");
  1130. }
  1131. });
  1132. } else {
  1133. sp.dialog("创建失败,请联系管理员!");
  1134. }
  1135. self.newMoBanFlag = false;
  1136. });
  1137. })
  1138. } else {
  1139. var data = {
  1140. dockind: "D01",
  1141. routeinfoid: self.routeinfoid,
  1142. gwtype: self.data.GWZL,
  1143. filekind: "DOCFILE"
  1144. }
  1145. $http.post(apiurljs.login + "g2app/fawenfiles/newDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1146. .success(function (obj) {
  1147. var res = strToJson(s4.decryptData_CBC(obj.data));
  1148. if (res.success) {
  1149. self.getGCG(1)
  1150. } else {
  1151. sp.dialog("创建失败,请联系管理员!");
  1152. }
  1153. self.newMoBanFlag = false;
  1154. });
  1155. }
  1156. }
  1157. self.newMoBan2 = function () {
  1158. self.newMoBanFlag = true;
  1159. if (self.gaoTypeArrayFirst.length > 0) {
  1160. var dialogHead = "<span class=\"sp-dialog-head\"><span class=\"sp-dialog-tip\">温馨提示</span><span class=\"sp-dialog-close sp-closeDialog\" title=\"关闭\">×</span></span>";
  1161. var dialogBody = "<div class=\"sp-dialog-body\">您确定要覆盖正文吗?</div>";
  1162. 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>";
  1163. $('.sp-dialog').html(dialogHead + dialogBody + dialogFoot);
  1164. sp.openCenter(".sp-dialog");
  1165. ///取消按钮
  1166. $('.sp-closeDialog').click(function (event) {
  1167. sp.closeCenter(".sp-dialog");
  1168. event.preventDefault();
  1169. event.stopPropagation();
  1170. });
  1171. //post消息的id
  1172. $("#delDataTrue").click(function () {
  1173. sp.closeCenter(".sp-dialog");
  1174. var data = {
  1175. id: self.gaoTypeArrayFirst[0].ID
  1176. }
  1177. $http.post(apiurljs.login + "g2app/fawenfiles/deleteDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1178. .success(function (obj) {
  1179. var res = strToJson(s4.decryptData_CBC(obj.data));
  1180. if (res.success) {
  1181. var data = {
  1182. dockind: "D01",
  1183. routeinfoid: self.routeinfoid,
  1184. gwtype: self.data.GWZL,
  1185. filekind: "REDFILE"
  1186. }
  1187. $http.post(apiurljs.login + "g2app/fawenfiles/newDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1188. .success(function (obj) {
  1189. var res = strToJson(s4.decryptData_CBC(obj.data));
  1190. if (res.success) {
  1191. self.getGCG(1)
  1192. } else {
  1193. sp.dialog("创建失败,请联系管理员!");
  1194. }
  1195. });
  1196. } else {
  1197. sp.dialog("创建失败,请联系管理员!");
  1198. }
  1199. self.newMoBanFlag = false;
  1200. });
  1201. })
  1202. } else {
  1203. var data = {
  1204. dockind: "D01",
  1205. routeinfoid: self.routeinfoid,
  1206. gwtype: self.data.GWZL,
  1207. filekind: "REDFILE"
  1208. }
  1209. $http.post(apiurljs.login + "g2app/fawenfiles/newDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1210. .success(function (obj) {
  1211. var res = strToJson(s4.decryptData_CBC(obj.data));
  1212. if (res.success) {
  1213. self.getGCG(1)
  1214. } else {
  1215. sp.dialog("创建失败,请联系管理员!");
  1216. }
  1217. self.newMoBanFlag = false;
  1218. });
  1219. }
  1220. }
  1221. //判断页面字段是否只读readonly、是否隐藏show
  1222. self.hide = function (type, field) {
  1223. if (self.dotype == 0 && type == "readonly") {
  1224. return true;
  1225. } else {
  1226. if (self[type][field] == true) {
  1227. return true;
  1228. } else {
  1229. return false;
  1230. }
  1231. }
  1232. }
  1233. //右上角按钮调用方法
  1234. self.btnEvent = function (item) {
  1235. switch (item.CODE) {
  1236. case "SAVEITEM": self.btnSave(0); break;
  1237. case "PRINTITEM": self.btnPrint(); break;
  1238. case "PRINTITEMEXTEND": self.btnPrint1(); break;
  1239. case "SAVEOFD": self.toOFD(); break;
  1240. case "GAIZITEM": self.qianZ(); break;
  1241. case "MEETITEM": self.Meet(); break;
  1242. case "SENDLOG": self.RouteList(); break;
  1243. case "PUBLICITEM": self.PUBLICITEM(); break;
  1244. default: self.forward(item); break;
  1245. }
  1246. }
  1247. //生成终稿
  1248. self.toOFD = function () {
  1249. if (self.gaoTypeArraySecond.length != 0) {
  1250. sp.dialog("请删除成文稿后,点击文件保存!")
  1251. $timeout(function () {
  1252. sp.dialoghide()
  1253. }, 1000)
  1254. return
  1255. }
  1256. var data = {
  1257. routeinfoid: self.routeinfoid,
  1258. gwtype: self.data.GWZL,
  1259. dockind: "D02"
  1260. }
  1261. $http.post(apiurljs.login + "g2app/fawenfiles/convertDataFinalOFDFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1262. .success(function (obj) {
  1263. var res = strToJson(s4.decryptData_CBC(obj.data));
  1264. if (res.success == true) {
  1265. self.getCWG()
  1266. }
  1267. })
  1268. }
  1269. //签章
  1270. self.qianZ = function () {
  1271. if (self.gaoTypeArrayThird.length != 0 || self.gaoTypeArraySecond.length != 0) {
  1272. sp.dialog("请删除终稿、签章稿后,点击签章!")
  1273. $timeout(function () {
  1274. sp.dialoghide()
  1275. }, 1000)
  1276. return
  1277. }
  1278. var data = {
  1279. //srcpath: "/opt/TongWeb7.0/applications/glworkweb/UploadAttach/" + self.gaoTypeArraySecond[0].FILENAMES,
  1280. //outpath: "/opt/TongWeb7.0/applications/glworkweb/UploadAttach",
  1281. routeinfoid: self.routeinfoid,
  1282. gwtype: self.data.GWZL,
  1283. dockind: "D02"
  1284. }
  1285. //$http.post(apiurljs.login + "g2app/signature/getSignature", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1286. $http.post(apiurljs.login + "g2app/signature/convertDataFinalOFDFileAndgetSignature", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1287. .success(function (obj) {
  1288. var res = strToJson(s4.decryptData_CBC(obj.data));
  1289. if (res.success == true) {
  1290. sp.dialog("生成成功!")
  1291. self.getCWG()
  1292. self.getQZG()
  1293. }
  1294. })
  1295. }
  1296. //打开公文模板弹窗
  1297. self.openGLJ = function () {
  1298. $("#GLJWin").attr("src", "../../forward/GLJ.html?routeid=" + self.routeid + "&routeinfoid=" + self.routeinfoid + "&copyrightid=" + self.copyrightid + "&directionid=" + self.directionid + "&formeditid=" + self.formeditid + "&cookie=shouwenbg")
  1299. sp.layer("#GLJ")
  1300. }
  1301. //保存提交
  1302. self.btnSave = function (n) {
  1303. if (spngvld.submit(".formedit")) {
  1304. var dataArray = [];
  1305. dataArray.push(self.data);
  1306. var data = {
  1307. ckey: "FW_ZRBGHYJY",
  1308. id: self.data.ID,
  1309. routeid: self.routeid,
  1310. routeinfoid: self.routeinfoid,
  1311. routeinfotitle: self.data.BT.replace(/\n/g, '').replace(/\s/g, ''),//self.data.ZT,
  1312. directionid: self.directionid,
  1313. formeditid: self.formeditid,
  1314. data: JSON.stringify(dataArray)
  1315. }
  1316. $http.post(apiurljs.login + "g2app/abase/saveData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1317. .success(function (obj) {
  1318. var res = strToJson(s4.decryptData_CBC(obj.data));
  1319. if (res.code == 0) {
  1320. self.data.ID = res.data.ID;
  1321. self.routeid = res.data.ROUTEID;
  1322. self.routeinfoid = res.data.ROUTEINFOID;
  1323. //if (self.lastrouteinfoid != 0) {
  1324. // self.getHB()
  1325. //}
  1326. self.filedChange = false;
  1327. if (self.gaoTypeArrayFirst.length == 0) {
  1328. var data = {
  1329. dockind: "D01",
  1330. routeinfoid: self.routeinfoid,
  1331. gwtype: self.data.GWZL,
  1332. filekind: "DOCFILE"
  1333. }
  1334. $http.post(apiurljs.login + "g2app/fawenfiles/newDataFile", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1335. .success(function (obj) {
  1336. var res = strToJson(s4.decryptData_CBC(obj.data));
  1337. if (res.success) {
  1338. if (n == 0) {
  1339. sp.dialog("保存成功!");
  1340. $timeout(function () {
  1341. sp.dialoghide()
  1342. }, 1500)
  1343. self.getSwenList(1)
  1344. } else if (n == 1) {
  1345. self.forward(self.btnItem);
  1346. } else if (n == 2) {
  1347. self.sendAll();
  1348. } else if (n == 3) {
  1349. self.btnPrint();
  1350. } else if (n == 4) {
  1351. sp.layer("#print")
  1352. }
  1353. } else {
  1354. sp.dialog("文稿创建失败,请联系管理员!");
  1355. }
  1356. });
  1357. } else {
  1358. var YZdata = {
  1359. method: 2,
  1360. params: {
  1361. fileId: self.gaoTypeArrayFirst[0].ID
  1362. }
  1363. };
  1364. $.ajax({
  1365. url: apiurljs.yzFileWo + "api.do",
  1366. data: {
  1367. jsonParams: encodeURIComponent(JSON.stringify(YZdata))
  1368. },
  1369. type: "POST",
  1370. dataType: "json",
  1371. general: false,
  1372. async: false,
  1373. success: function (resp) {
  1374. if (n == 0) {
  1375. sp.dialog("保存成功!");
  1376. $timeout(function () {
  1377. sp.dialoghide()
  1378. }, 1500)
  1379. self.getSwenList(1)
  1380. } else if (n == 1) {
  1381. self.forward(self.btnItem);
  1382. } else if (n == 2) {
  1383. self.sendAll();
  1384. } else if (n == 3) {
  1385. self.btnPrint();
  1386. } else if (n == 4) {
  1387. sp.layer("#print")
  1388. }
  1389. }
  1390. });
  1391. }
  1392. } else {
  1393. sp.dialog(res.message)
  1394. }
  1395. })
  1396. }
  1397. }
  1398. /*综合打印*/
  1399. self.printFiled = 1;
  1400. self.btnPrint1 = function () {
  1401. if (self.filedChange == true) {
  1402. self.btnSave(4)
  1403. } else {
  1404. sp.layer("#print")
  1405. }
  1406. }
  1407. self.printSubmit = function () {
  1408. if (self.printFiled == 1) {
  1409. var templatefilename = "moban63"
  1410. } else if (self.printFiled == 2) {
  1411. var templatefilename = "mobanoption"
  1412. } else {
  1413. var templatefilename = "moban63_all"
  1414. }
  1415. var data = {
  1416. templatefilename: templatefilename + ".ftl",
  1417. outfilepath: "/tmp/主任办公会议纪要" + sp.datefmt('yyyyMMddHHmmss', sp.getLocalDate()) + ".wps",
  1418. routeinfoid: self.routeinfoid,
  1419. tablename: "FW_ZRBGHYJY",
  1420. printtype: self.printFiled,
  1421. printdate: "RGRQ"
  1422. }
  1423. console.log(s4.encryptData_CBC(JSON.stringify(data)))
  1424. $http.post(apiurljs.login + "g2app/dataabase/PrintWordExtend", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1425. .success(function (obj) {
  1426. var res = strToJson(s4.decryptData_CBC(obj.data));
  1427. //window.open("../../../printPreview.html?url=" + apiurljs.login + "g2work" + res.data[0].url)
  1428. if (self.deviceType == "pad") {
  1429. window.location.href = "../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url
  1430. } else {
  1431. sp.openNewWindow("../../../printPreview.html?url=" + apiurljs.yzFcscloud + "g2work" + res.data[0].url, '打印预览')
  1432. }
  1433. })
  1434. sp.layerhide()
  1435. }
  1436. //签写意见编辑状态
  1437. self.opinion = {
  1438. WLDQFL: false,
  1439. WLDQFLImg: false,
  1440. WLDSSL: false,
  1441. WLDSSLImg: false,
  1442. FLSH: false,
  1443. FLSHImg: false,
  1444. SX: false,
  1445. SXImg: false,
  1446. GPJZSC: false,
  1447. GPJZSCImg: false,
  1448. BMFZRYJ: false,
  1449. BMFZRYJImg: false,
  1450. HBCSYJ: false,
  1451. HBCSYJImg: false,
  1452. nulla: false
  1453. }
  1454. self.YJ = {
  1455. WLDQFL: [],
  1456. WLDQFLSTATUS: false,
  1457. WLDSSL: [],
  1458. WLDSSLSTATUS: false,
  1459. FLSH: [],
  1460. FLSHSTATUS: false,
  1461. SX: [],
  1462. SXSTATUS: false,
  1463. GPJZSC: [],
  1464. GPJZSCSTATUS: false,
  1465. BMFZRYJ: [],
  1466. BMFZRYJSTATUS: false,
  1467. HBCSYJ: [],
  1468. HBCSYJSTATUS: false,
  1469. nulla: [],
  1470. nullaSTATUS: false
  1471. }
  1472. //意见(下表)
  1473. self.openOptionList = function () {
  1474. if (self.routeinfoid == 0 && self.routeid == 0) {
  1475. sp.dialog("请先保存!")
  1476. return;
  1477. }
  1478. if (self.dotype == 0) {
  1479. return
  1480. }
  1481. if (self.opinion.nulla == true) {
  1482. return;
  1483. }
  1484. self.nulla = "";
  1485. self.opinion.nulla = true;
  1486. }
  1487. self.openOptionList1 = function () {
  1488. self.openOptionList()
  1489. self.activeOpinion = null;
  1490. self.showBottom = "opinion";
  1491. self.YJ.nulla.forEach(function (item) {
  1492. if (item.ROUTEID == self.routeid) {
  1493. self.activeOpinion = item;
  1494. self.nulla = item.OPINION;
  1495. }
  1496. })
  1497. }
  1498. self.closeOptionList = function () {
  1499. self.opinion.nulla = false;
  1500. self.activeOpinion = null;
  1501. $(".toggle").trigger("click")
  1502. }
  1503. self.submitOptionList = function () {
  1504. var data = {
  1505. cmanid: self.userId,
  1506. routeinfoid: self.routeinfoid,
  1507. routeid: self.routeid,
  1508. tableid: "FW_ZRBGHYJY",
  1509. colid: "",
  1510. opiniontype: 99,
  1511. cresult: "",
  1512. opinion: self.nulla,
  1513. opinionimage: ""
  1514. }
  1515. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1516. .success(function (obj) {
  1517. var res = strToJson(s4.decryptData_CBC(obj.data));
  1518. if (res.success == true) {
  1519. self.getOpinion1(2);
  1520. self.opinion.nulla = false;
  1521. $(".toggle").trigger("click")
  1522. } else {
  1523. sp.dialog(res.message)
  1524. }
  1525. })
  1526. }
  1527. self.changeOptionList = function (item) {
  1528. self.showBottom = "opinion";
  1529. self.opinion.nulla = true;
  1530. self.nulla = item.OPINION;
  1531. self.activeOpinion = item;
  1532. $(".toggle").trigger("click")
  1533. }
  1534. //意见附件(下表)
  1535. self.uploading1 = false;
  1536. self.upload1 = function () {
  1537. $('#fileupload1').fileupload({
  1538. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  1539. dataType: 'json',
  1540. beforeSend: function (xhr, data) {
  1541. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  1542. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  1543. + ",routeid=" + self.routeid + ",tableid=FW_ZRBGHYJY,colid="));
  1544. },
  1545. // 上传完成后的执行逻辑
  1546. done: function (e, data) {
  1547. self.uploading1 = false;
  1548. self.getOpinion1(2)
  1549. }
  1550. })
  1551. }
  1552. //意见附件(下表)
  1553. self.uploading2 = false;
  1554. self.upload2 = function (str) {
  1555. $('#fileupload-' + str).fileupload({
  1556. url: apiurljs.login + 'g2app/abase/UploadWholeFileWithRouteAttach',
  1557. dataType: 'json',
  1558. beforeSend: function (xhr, data) {
  1559. xhr.setRequestHeader("Authorization", "Bearer " + self.get_AccessToken);
  1560. xhr.setRequestHeader("File-Argument", s4.encryptData_CBC("tablename=SYS_ROUTE_ATTACHLIST,userid=" + self.userId + ",routeinfoid=" + self.routeinfoid
  1561. + ",routeid=" + self.routeid + ",tableid=FW_ZRBGHYJY,colid=" + str));
  1562. },
  1563. // 上传完成后的执行逻辑
  1564. done: function (e, data) {
  1565. self.uploading1 = false;
  1566. self.getOpinion1(2)
  1567. }
  1568. })
  1569. }
  1570. //下载意见表附件
  1571. self.downLoadOption = function (item) {
  1572. window.open(apiurljs.login + "g2work/files/" + item.FILEPATH.slice(7))
  1573. }
  1574. //删除意见表附件
  1575. self.deleteOptionFile = function (file) {
  1576. var data = {
  1577. routeid: file.ROUTEID,
  1578. tableid: "FW_ZRBGHYJY",
  1579. colid: file.COLID,
  1580. fileid: file.FILEID
  1581. };
  1582. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinionWithRouteAttach", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1583. .success(function (obj) {
  1584. var res = strToJson(s4.decryptData_CBC(obj.data));
  1585. sp.dialoghide();
  1586. if (res.success) {
  1587. self.getOpinion1(2);
  1588. } else {
  1589. sp.dialog("删除失败,请联系管理员!");
  1590. }
  1591. });
  1592. }
  1593. //签写意见
  1594. self.openOpinion = function (str) {
  1595. if (self.routeinfoid == 0 && self.routeid == 0) {
  1596. sp.dialog("请先保存!")
  1597. return;
  1598. }
  1599. self.opinion[str] = true;
  1600. }
  1601. //修改意见
  1602. self.changeOpinion = function (str) {
  1603. self.data[str] = self.YJ[str][0].OPINION;
  1604. self.opinion[str] = true;
  1605. }
  1606. self.changeOpinionItem = function (str, item) {
  1607. if (item.OPINIONIMAGE != "") {
  1608. self.QianZi(str);
  1609. self.opinion[str + "Img"] = true;
  1610. }
  1611. self.data[str] = item.OPINION;
  1612. self.opinion[str] = true;
  1613. }
  1614. //提交意见
  1615. self.Sopinion = function (str) {
  1616. if (self.opinion[str + "Img"] == true) {
  1617. self.data[str] = $("#" + str + "QZ").find("canvas")[0].toDataURL();
  1618. } else {
  1619. self.data[str] = $("#" + str).val();
  1620. }
  1621. var data = {
  1622. cmanid: self.userId,
  1623. routeinfoid: self.routeinfoid,
  1624. routeid: self.routeid,
  1625. tableid: "FW_ZRBGHYJY",
  1626. colid: str,
  1627. opiniontype: 0,
  1628. cresult: "",
  1629. opinion: self.opinion[str + "Img"] == false ? self.data[str] : "",
  1630. opinionimage: self.opinion[str + "Img"] == true ? self.data[str] : ""
  1631. }
  1632. $http.post(apiurljs.login + "g2app/abase/saveDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1633. .success(function (obj) {
  1634. var res = strToJson(s4.decryptData_CBC(obj.data));
  1635. if (res.success == true) {
  1636. self.getOpinion1(1);
  1637. self.opinion[str] = false;
  1638. self.opinion[str + "Img"] = false;
  1639. self.data[str] = "";
  1640. self.changeFiled(str)
  1641. } else {
  1642. sp.dialog(res.message)
  1643. }
  1644. })
  1645. }
  1646. //删除意见
  1647. self.Dopinion = function (str) {
  1648. var data = {
  1649. cmanid: self.userId,
  1650. routeid: self.routeid,
  1651. tableid: "FW_ZRBGHYJY",
  1652. colid: str
  1653. }
  1654. $http.post(apiurljs.login + "g2app/abase/deleteDataOpinion", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1655. .success(function (obj) {
  1656. var res = strToJson(s4.decryptData_CBC(obj.data));
  1657. if (res.success == true) {
  1658. self.getOpinion1(1);
  1659. self.nulla = "";
  1660. self.activeOpinion = null;
  1661. self.changeFiled(str)
  1662. } else {
  1663. sp.dialog(res.message)
  1664. }
  1665. })
  1666. }
  1667. self.phraseText = "";//添加常用语
  1668. self.phraseList = []//常用语列表
  1669. //获取常用语库
  1670. self.phrase = function (colid) {
  1671. sp.layer("#phrase");
  1672. self.colid = colid;
  1673. self.getPhrase();
  1674. }
  1675. //添加常用语到常用语库
  1676. self.Aphrase = function () {
  1677. if (self.phraseText == "") {
  1678. return;
  1679. }
  1680. var data = {
  1681. cmanid: self.userId,
  1682. tableid: "FW_ZRBGHYJY",
  1683. colid: self.colid,
  1684. contents: self.phraseText
  1685. }
  1686. $http.post(apiurljs.login + "g2app/abase/insertDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1687. .success(function (obj) {
  1688. var res = strToJson(s4.decryptData_CBC(obj.data));
  1689. if (res.success == true) {
  1690. self.phraseText = "";
  1691. self.getPhrase();
  1692. } else {
  1693. sp.dialog(res.message)
  1694. }
  1695. })
  1696. }
  1697. //获取常用语库
  1698. self.getPhrase = function () {
  1699. var data = {
  1700. cmanid: self.userId,
  1701. tableid: "FW_ZRBGHYJY",
  1702. colid: self.colid
  1703. }
  1704. $http.post(apiurljs.login + "g2app/abase/queryDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1705. .success(function (obj) {
  1706. var res = strToJson(s4.decryptData_CBC(obj.data));
  1707. self.phraseList = res.data;
  1708. self.phraseSelect = self.phraseList[0].CONTENTS;
  1709. })
  1710. }
  1711. //从常用语库删除
  1712. self.Dphrase = function () {
  1713. var id = null;
  1714. $.each(self.phraseList, function (index, item) {
  1715. if (item.CONTENTS == self.phraseSelect) {
  1716. id = item.ID;
  1717. }
  1718. })
  1719. var data = {
  1720. id: id
  1721. }
  1722. $http.post(apiurljs.login + "g2app/abase/deleteDataPatterns", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  1723. .success(function (obj) {
  1724. var res = strToJson(s4.decryptData_CBC(obj.data));
  1725. self.getPhrase();
  1726. })
  1727. }
  1728. //常用语确认为意见
  1729. self.btnPhrase = function () {
  1730. if (!self.colid) {
  1731. self.nulla = self.phraseSelect;
  1732. } else {
  1733. self.data[self.colid] = self.phraseSelect;
  1734. }
  1735. sp.layerhide();
  1736. }
  1737. //签字—手写
  1738. self.QianZi = function (str) {
  1739. if (self.opinion[str + "Img"] == true) { return; }
  1740. self.opinion[str + "Img"] = true;
  1741. $timeout(function () {
  1742. new lineCanvas(str + "QZ")
  1743. }, 1)
  1744. }
  1745. //清除手写
  1746. self.canvasClear = function (str) {
  1747. var cxt = $("#" + str + "QZ").find("canvas")[0].getContext("2d");
  1748. cxt.clearRect(0, 0, $("#" + str + "QZ").find("canvas")[0].width, $("#" + str + "QZ").find("canvas")[0].height)
  1749. }
  1750. self.selectUSAGE = function (item) {
  1751. item.checked = !item.checked;
  1752. self.selectUSAGEs = [];
  1753. $.each(self.USAGE, function (index, item) {
  1754. if (item.checked == true) {
  1755. self.selectUSAGEs.push(item.CODE)
  1756. }
  1757. })
  1758. self.changeFiled('USAGE')
  1759. }
  1760. //发生修改
  1761. self.changeFiled = function (str) {
  1762. self.filedChange = true;
  1763. }
  1764. //转发
  1765. self.forward = function (obj) {
  1766. self.btnItem = obj;
  1767. if (self.filedChange == true) {
  1768. self.btnSave(1)
  1769. } else {
  1770. $("#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")
  1771. sp.layer("#forward")
  1772. }
  1773. }
  1774. //查看流转记录
  1775. self.RouteList = function () {
  1776. if (self.deviceType == "pad") {
  1777. window.location.href = "../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1]
  1778. } else {
  1779. sp.openNewWindow("../../forward/modeler_read.html?" + self.SwenList[0].TEMPFORM.split("?")[1], "流程图")
  1780. }
  1781. }
  1782. self.showCol = function ($event, ele) {
  1783. $('.show-col').not(ele).hide();
  1784. $(ele).toggle("fast", function () {
  1785. $(ele).css('overflow-y', 'auto')
  1786. }).autoHide();
  1787. $event.stopPropagation();
  1788. }
  1789. self.iframeList = []
  1790. //num为1时为附件表附件,为2时为文稿表附件
  1791. self.seeFile = function (obj, num, str) {
  1792. $('.show-col').hide();
  1793. if (!obj) {
  1794. sp.dialog("文件不存在!")
  1795. return
  1796. }
  1797. if (apiurljs.zhType.indexOf(obj.FILEEXT) == -1) {
  1798. sp.dialog("文件暂不支持在线预览,请点击下载查看!")
  1799. return
  1800. }
  1801. var n = 0;
  1802. self.iframeList.forEach(function (item) {
  1803. if (item.title == obj.FILENAMES) {
  1804. n++
  1805. }
  1806. })
  1807. if (n == 0) {
  1808. var set_convertType = 0;
  1809. if (obj.FILEEXT == "doc") {
  1810. set_convertType = 0;
  1811. } else if (obj.FILEEXT == "pdf") {
  1812. set_convertType = 20;
  1813. } else if (obj.FILEEXT == "ofd") {
  1814. set_convertType = 570;
  1815. } else if ("png,jpg,jpeg,gif,bmp,jfif,svg,tif,tiff".indexOf(obj.FILEEXT) > -1) {
  1816. set_convertType = 23;
  1817. } else {
  1818. set_convertType = 0;
  1819. }
  1820. let postData = {
  1821. convertType: set_convertType,
  1822. isSignature: 1,
  1823. isPrint: 1,
  1824. fileUrl: num == 1 ? (obj.FILEPATH ? apiurljs.yzFcscloud + "g2work" + obj.FILEPATH : apiurljs.yzFcscloud + "g2work/files2/inline/" + obj.FILEURL.slice(7)) : apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + obj.FILEURL
  1825. };
  1826. var postCfg_transfer = {
  1827. headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  1828. transformRequest: function (data) {
  1829. return $.param(data);
  1830. }
  1831. };
  1832. $http.post(apiurljs.login.split("glwork/")[0] + "fcscloud/composite/httpfile", postData, postCfg_transfer)
  1833. .success(function (res) {
  1834. if (res.errorcode === 0) {
  1835. if (num == 1) {
  1836. if (obj.FILEPATH) {
  1837. self.addItem(sp.ipChange(res.data.viewUrl), apiurljs.login + "g2work" + obj.FILEPATH, str, obj.FILENAMES, false)
  1838. } else {
  1839. self.addItem(sp.ipChange(res.data.viewUrl), apiurljs.login + "g2work/files2/inline/" + obj.FILEURL.slice(7), str, obj.FILENAMES, false)
  1840. }
  1841. } else {
  1842. self.addItem(sp.ipChange(res.data.viewUrl), apiurljs.login.split("glwork/")[0] + "glworkweb/" + obj.FILEURL, str, obj.FILENAMES, false)
  1843. }
  1844. } else {
  1845. sp.dialog(res.message);
  1846. }
  1847. });
  1848. }
  1849. }
  1850. self.seeZW = function () {
  1851. self.activeFormedit = 0;
  1852. $("#rightList").css("margin-left", 0);
  1853. }
  1854. self.editFile = function (obj, n, str) {
  1855. if (self.newMoBanFlag == true) {
  1856. return
  1857. }
  1858. $('.show-col').hide();
  1859. if (!obj) {
  1860. sp.dialog("文件不存在!")
  1861. return
  1862. }
  1863. self.activeFormedit = n;
  1864. if ($(".formedit" + n).find("iframe").attr("data-id") == obj.ID) {
  1865. if (self.iframeList.length == 0) {
  1866. if (n == 0) {
  1867. $("#rightList").css("margin-left", 0);
  1868. } else {
  1869. $("#rightList").css("margin-left", (n - 1) * $(".formedit1").width() * -1 - 10);
  1870. }
  1871. } else {
  1872. $("#rightList").css("margin-left", n * $(".formedit").width() * -1);
  1873. }
  1874. } else {
  1875. if (obj.FILEURL.indexOf("files") > -1) {
  1876. var set_filepath = apiurljs.yzFcscloud + "g2work/files/" + obj.FILEURL.slice(7);
  1877. } else {
  1878. var set_filepath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + obj.FILEURL;
  1879. }
  1880. var data = {
  1881. method: 1,
  1882. params: {
  1883. userId: self.userName,
  1884. fileId: "",
  1885. fileName: "",
  1886. filePath: "",
  1887. userRight: self.dotype != 1 ? 1 : 0,
  1888. callbackUrl: ""
  1889. }
  1890. };
  1891. if (obj.FILEURL.indexOf("files") > -1) {
  1892. data.params.fileId = obj.FILEURL.split("/")[2];
  1893. data.params.fileName = obj.FILEURL.split("/")[3];
  1894. data.params.filePath = apiurljs.yzFcscloud + "g2work/files/" + obj.FILEURL.slice(7);
  1895. data.params.callbackUrl = apiurljs.login + "g2app/attachfiles/uploadFileAttach"
  1896. } else {
  1897. data.params.fileId = obj.ID;
  1898. data.params.fileName = obj.FILENAMES;
  1899. data.params.filePath = apiurljs.yzFcscloud.split("glwork/")[0] + "glworkweb/" + obj.FILEURL;
  1900. data.params.callbackUrl = apiurljs.login + "g2app/fawenfiles/uploadFile"
  1901. }
  1902. $.ajax({
  1903. url: apiurljs.yzFileWo + "api.do",
  1904. data: {
  1905. jsonParams: encodeURIComponent(JSON.stringify(data))
  1906. },
  1907. type: "POST",
  1908. dataType: "json",
  1909. general: false,
  1910. async: false,
  1911. success: function (data) {
  1912. if (data) {
  1913. if (data.errorCode === "0") {
  1914. let rst = data.result;
  1915. if (rst && rst.urls) {
  1916. var get_urls = rst.urls;
  1917. if (typeof (get_urls) === "string") {
  1918. $(".formedit" + n).find("iframe").attr("src", sp.ipChange(get_urls)).attr("data-id", obj.ID)
  1919. if (self.iframeList.length == 0) {
  1920. if (n == 0) {
  1921. $("#rightList").css("margin-left", 0);
  1922. } else {
  1923. $("#rightList").css("margin-left", (n - 1) * $(".formedit1").width() * -1 - 10);
  1924. }
  1925. } else {
  1926. $("#rightList").css("margin-left", n * $(".formedit").width() * -1);
  1927. }
  1928. }
  1929. }
  1930. }
  1931. }
  1932. },
  1933. });
  1934. }
  1935. }
  1936. self.btnSaveFile = function (id) {
  1937. var data = {
  1938. method: 2,
  1939. params: {
  1940. fileId: id
  1941. }
  1942. };
  1943. $.ajax({
  1944. url: apiurljs.yzFileWo + "api.do",
  1945. data: {
  1946. jsonParams: encodeURIComponent(JSON.stringify(data))
  1947. },
  1948. type: "POST",
  1949. dataType: "json",
  1950. general: false,
  1951. async: false,
  1952. success: function (data) {
  1953. if (data && data.errorCode === "0") {
  1954. sp.dialog("保存成功");
  1955. }
  1956. }
  1957. });
  1958. }
  1959. self.addItem = function (url, source, name, edit, fileid) {
  1960. var n = 0;
  1961. self.iframeList.forEach(function (item) {
  1962. if (item.title == name && item.source == source) {
  1963. n++
  1964. }
  1965. })
  1966. if (n == 0) {
  1967. if (edit == false) {
  1968. self.iframeList.push({ id: self.iframeList.length + 1, title: name, url: $sce.trustAsResourceUrl(url), source: source, edit: edit })
  1969. } else {
  1970. self.iframeList.push({ id: self.iframeList.length + 1, title: name, url: $sce.trustAsResourceUrl(url), source: source, edit: edit, fileid: fileid })
  1971. }
  1972. self.changeSize(1)
  1973. }
  1974. }
  1975. self.changeSize = function (n) {
  1976. if (self.iframeList.length == 0) {
  1977. } else if (self.iframeList.length == 1) {
  1978. self.iframeList[0].boxStyle = { width: $(".leftBox").width() }
  1979. self.iframeList[0].iframeStyle = { width: $(".leftBox").width() - 10 }
  1980. } else {
  1981. self.iframeList.forEach(function (item) {
  1982. item.boxStyle = { width: Math.trunc($(".leftBox").width() / 2 / (self.iframeList.length - 1)) }
  1983. item.iframeStyle = { width: item.boxStyle.width - 10 }
  1984. })
  1985. self.iframeList[self.iframeList.length - 1].boxStyle = { width: Math.trunc($(".leftBox").width() / 2) - 1 }
  1986. self.iframeList[self.iframeList.length - 1].iframeStyle = { width: self.iframeList[self.iframeList.length - 1].boxStyle.width - 10 }
  1987. }
  1988. if (self.iframeList.length == 0) {
  1989. $(".rightBox").css("width", $(window).width())
  1990. $(".formedit").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  1991. $(".formedit1").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  1992. $(".formedit2").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  1993. var marginLeft = $("#rightList").css("margin-left")
  1994. if (marginLeft.slice(0, marginLeft.length - 2) == $(".formedit1").width() * -1 || marginLeft.slice(0, marginLeft.length - 2) == 0) {
  1995. } else {
  1996. alert(self.activeFormedit)
  1997. $("#rightList").css("margin-left", $(".formedit1").width() * (self.activeFormedit - 1) * -1)
  1998. }
  1999. } else {
  2000. if (n == 1) {
  2001. $(".leftBox").css("width", "50%")
  2002. $(".rightBox").css("width", "50%")
  2003. }
  2004. $(".formedit").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2005. $(".formedit1").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2006. $(".formedit2").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2007. var marginLeft = $("#rightList").css("margin-left")
  2008. if (marginLeft.slice(0, marginLeft.length - 2) == $(".formedit1").width() * -1 || marginLeft.slice(0, marginLeft.length - 2) == 0) {
  2009. } else {
  2010. $("#rightList").css("margin-left", $(".formedit1").width() * (self.activeFormedit - 1) * -1)
  2011. }
  2012. }
  2013. }
  2014. self.openItem = function (obj) {
  2015. window.open(obj.url)
  2016. }
  2017. self.closeItem = function (n) {
  2018. self.iframeList.splice(n, 1)
  2019. self.changeSize(1)
  2020. }
  2021. self.reSize = function (n) {
  2022. var leftbox = document.getElementsByClassName("iframe-item")[n - 1];
  2023. var rightbox = document.getElementsByClassName("iframe-item")[n];
  2024. var line = document.getElementsByClassName("iframe-border-right")[n - 1];
  2025. document.getElementsByClassName("iframe-border-right")[n - 1].addEventListener("mousedown", function (event) {
  2026. $(".mousemove").show()
  2027. var leftboxW = leftbox.style.width.slice(0, leftbox.style.width.length - 2);
  2028. var rightboxW = rightbox.style.width.slice(0, rightbox.style.width.length - 2);
  2029. var x = event.pageX - line.offsetLeft;
  2030. document.addEventListener("mousemove", boxMove)
  2031. function boxMove(event) {
  2032. if (leftboxW * 1 + (event.pageX - x) * 1 <= 5) {
  2033. leftbox.children[0].style.display = "none"
  2034. } else if (rightboxW * 1 - (event.pageX - x) * 1 <= 5) {
  2035. rightbox.children[0].style.display = "none"
  2036. } else {
  2037. leftbox.children[0].style.display = "block"
  2038. leftbox.style.width = leftboxW * 1 + (event.pageX - x) * 1 + "px";
  2039. leftbox.getElementsByTagName("iframe")[0].style.width = leftboxW * 1 + (event.pageX - x) * 1 - 10 + "px";
  2040. self.iframeList[n - 1].boxStyle.width = leftboxW * 1 + (event.pageX - x) * 1;
  2041. self.iframeList[n - 1].iframeStyle.width = leftboxW * 1 + (event.pageX - x) * 1 - 10;
  2042. rightbox.children[0].style.display = "block"
  2043. rightbox.style.width = rightboxW * 1 - (event.pageX - x) * 1 + "px";
  2044. rightbox.getElementsByTagName("iframe")[0].style.width = rightboxW * 1 - (event.pageX - x) * 1 - 10 + "px";
  2045. self.iframeList[n].boxStyle.width = rightboxW * 1 - (event.pageX - x) * 1;
  2046. self.iframeList[n].iframeStyle.width = rightboxW * 1 - (event.pageX - x) * 1 - 10;
  2047. }
  2048. }
  2049. document.addEventListener("mouseup", function () {
  2050. $(".mousemove").hide()
  2051. $scope.$apply();
  2052. document.removeEventListener("mousemove", boxMove)
  2053. })
  2054. })
  2055. }
  2056. self.reSizeLR = function (n) {
  2057. var leftbox = document.getElementsByClassName("page-item")[n - 1];
  2058. var rightbox = document.getElementsByClassName("page-item")[n];
  2059. var line = document.getElementsByClassName("left-right")[n - 1];
  2060. document.getElementsByClassName("left-right")[n - 1].addEventListener("mousedown", function (event) {
  2061. $(".mousemove").show()
  2062. var leftboxW = leftbox.clientWidth;
  2063. var rightboxW = rightbox.clientWidth;
  2064. var x = event.pageX - line.offsetLeft;
  2065. document.addEventListener("mousemove", boxMove)
  2066. function boxMove(event) {
  2067. if (leftboxW * 1 + (event.pageX - x) * 1 <= 200) {
  2068. } else if (rightboxW * 1 - (event.pageX - x) * 1 <= 200) {
  2069. } else {
  2070. leftbox.style.width = leftboxW * 1 + (event.pageX - x) * 1 + "px";
  2071. rightbox.style.width = rightboxW * 1 - (event.pageX - x) * 1 + "px";
  2072. $(".formedit").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2073. $(".formedit1").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2074. $(".formedit2").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2075. $(".toggle").parent().css("width", $(".formedit").width() - 12)
  2076. $scope.changeSize()
  2077. }
  2078. }
  2079. document.addEventListener("mouseup", function () {
  2080. $(".mousemove").hide()
  2081. document.removeEventListener("mousemove", boxMove)
  2082. })
  2083. })
  2084. }
  2085. self.getMeetMsg = function () {
  2086. var data = {
  2087. routeid: self.routeid,
  2088. routeinfoid: self.routeinfoid
  2089. }
  2090. $http.post(apiurljs.login + "g2work/meetcoop/queryDataList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2091. .success(function (obj) {
  2092. var res = strToJson(s4.decryptData_CBC(obj.data));
  2093. self.meetList = res.data;
  2094. self.meetNum = 0;
  2095. self.meetList.forEach(function (item) {
  2096. self.meetNum++
  2097. item.FILES.forEach(function (item1) {
  2098. self.meetNum++
  2099. item1.WATCHLIMIT = sp.format(item1.WATCHLIMIT);
  2100. })
  2101. })
  2102. //self.getNumMeet()
  2103. })
  2104. }
  2105. self.getNumMeet = function () {
  2106. var data = {
  2107. routeinfoid: self.routeinfoid
  2108. }
  2109. $http.post(apiurljs.login + "g2work/meetcoop/queryDataListCount", data, postCfg)
  2110. .success(function (obj) {
  2111. var res = strToJson(s4.decryptData_CBC(obj.data));
  2112. if (res.data != self.meetNum) {
  2113. self.getMeetMsg()
  2114. }
  2115. })
  2116. }
  2117. self.Meeting = function () {
  2118. $http.post(apiurljs.login + "g2app/dataabase/getDpList", { data: s4.encryptData_CBC("") }, postCfg)
  2119. .success(function (obj) {
  2120. var res = strToJson(s4.decryptData_CBC(obj.data));
  2121. self.dpList = res.data;
  2122. self.dpList1 = [];
  2123. self.dpList.forEach(function (item) {
  2124. self.dpList1.push(item)
  2125. item.USER.forEach(function (item1) {
  2126. item1.show = true;
  2127. })
  2128. })
  2129. self.activeDep = 0;
  2130. self.userList = self.dpList1[0].USER;
  2131. self.meetUser = [];
  2132. sp.layer("#meet")
  2133. })
  2134. }
  2135. self.searchName = "";
  2136. self.searchPerson = function () {
  2137. self.dpList1 = [];
  2138. self.dpList.forEach(function (item) {
  2139. if (item.DEP.indexOf(self.searchName) > -1) {
  2140. self.dpList1.push(item)
  2141. }
  2142. })
  2143. self.activeDep = 0;
  2144. self.userList = self.dpList1[0].USER;
  2145. }
  2146. self.addmeet = function () {
  2147. self.dpList.forEach(function (item) {
  2148. item.USER.forEach(function (item1) {
  2149. if (item1.checked == true && item1.show == true) {
  2150. self.meetUser.push(item1);
  2151. item1.checked = false;
  2152. item1.show = false;
  2153. }
  2154. })
  2155. })
  2156. }
  2157. self.delmeet = function () {
  2158. self.meetUser.forEach(function (item) {
  2159. if (item.checked == true) {
  2160. item.checked = false;
  2161. item.show = true;
  2162. }
  2163. })
  2164. self.meetUser = self.meetUser.filter(function (item) {
  2165. return item.show == false;
  2166. })
  2167. }
  2168. self.joinMeet = function () {
  2169. var data = {
  2170. tablename: "FW_ZRBGHYJY",
  2171. colums: "*",
  2172. order: "ID desc",
  2173. sqlwhere: { ROUTEINFOID: self.routeinfoid },
  2174. sqlinwhere: "",
  2175. sqllikewhere: ""
  2176. }
  2177. $http.post(apiurljs.login + "g2app/dataabase/queryDataByCol", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2178. .success(function (obj) {
  2179. var res = strToJson(s4.decryptData_CBC(obj.data));
  2180. var data1 = {
  2181. routeid: self.routeid,
  2182. routeinfoid: self.routeinfoid,
  2183. cman: self.userId,
  2184. cname: res.data[0].BT + "—共享沟通",
  2185. userids: self.meetUser.map(function (item) {
  2186. return item.USERID
  2187. }).join(",")
  2188. }
  2189. $http.post(apiurljs.login + "g2work/meetcoop/createMeetcoop", data1, postCfg)
  2190. .success(function (res1) {
  2191. sp.layerhide()
  2192. if (res1.success == true) {
  2193. self.getMeetMsg()
  2194. } else {
  2195. sp.dialog(res1.message)
  2196. }
  2197. })
  2198. })
  2199. }
  2200. self.updateCname = function (item) {
  2201. self.meeting = {
  2202. type: 1,
  2203. updateTitle: "修改会议标题",
  2204. meetid: item.MEETID,
  2205. cname: item.CNAME
  2206. }
  2207. sp.layer("#meetUpdate")
  2208. }
  2209. self.deleteMeet = function (meet) {
  2210. var data = {
  2211. meetid: meet.MEETID
  2212. }
  2213. $http.post(apiurljs.login + "g2work/meetcoop/deleteDataByID", data, postCfg)
  2214. .success(function (res) {
  2215. if (res.success == true) {
  2216. $.each(self.iframeList, function (index, item) {
  2217. $.each(meet.FILES, function (index1, item1) {
  2218. if (item.title == item1.WATCHLIMIT && item.source == item1.FILEURL) {
  2219. self.closeItem(index1)
  2220. }
  2221. })
  2222. })
  2223. self.getMeetMsg()
  2224. } else {
  2225. sp.dialog(res.message)
  2226. }
  2227. })
  2228. }
  2229. self.updateWatchlimit = function (item) {
  2230. self.meeting = {
  2231. type: 2,
  2232. updateTitle: "修改查看时限",
  2233. fileid: item.FILEID,
  2234. watchlimit: item.WATCHLIMIT
  2235. }
  2236. sp.layer("#meetUpdate")
  2237. }
  2238. self.deleteMFile = function (mfile) {
  2239. var data = {
  2240. fileid: mfile.MEETID
  2241. }
  2242. $http.post(apiurljs.login + "g2work/meetcoop/deleteDataFilesByFileID", data, postCfg)
  2243. .success(function (res) {
  2244. if (res.success == true) {
  2245. $.each(self.iframeList, function (index, item) {
  2246. if (item.title == mfile.WATCHLIMIT && item.source == mfile.FILEURL) {
  2247. self.closeItem(index)
  2248. }
  2249. })
  2250. self.getMeetMsg()
  2251. } else {
  2252. sp.dialog(res.message)
  2253. }
  2254. })
  2255. }
  2256. self.meetUpdate = function () {
  2257. if (self.meeting.type == 1) {
  2258. var data = {
  2259. meetid: self.meeting.meetid,
  2260. cname: self.meeting.cname
  2261. }
  2262. $http.post(apiurljs.login + "g2work/meetcoop/updateCnameByID", data, postCfg)
  2263. .success(function (res) {
  2264. sp.layerhide()
  2265. if (res.success == true) {
  2266. self.getMeetMsg()
  2267. } else {
  2268. sp.dialog(res.message)
  2269. }
  2270. })
  2271. } else {
  2272. var data = {
  2273. fileid: self.meeting.fileid,
  2274. watchlimit: self.meeting.watchlimit
  2275. }
  2276. $http.post(apiurljs.login + "g2work/meetcoop/updateWatchlimitByFileID", data, postCfg)
  2277. .success(function (res) {
  2278. sp.layerhide()
  2279. if (res.success == true) {
  2280. self.getMeetMsg()
  2281. } else {
  2282. sp.dialog(res.message)
  2283. }
  2284. })
  2285. }
  2286. }
  2287. ////头部关键字搜索---20230905
  2288. self.headBtnSearchKeyword = "";
  2289. self.headSearchResult = [];
  2290. self.headSearchResult_view = false;
  2291. self.headBtnSearch = function () {
  2292. if (sp.isval(self.headBtnSearchKeyword)) {
  2293. self.headSearchResult = [];
  2294. var data = {
  2295. "url": "/basic/api/StatSelect/selectCodeList",
  2296. "data": { "keyWord": self.headBtnSearchKeyword }
  2297. }
  2298. $http.post(apiurljs.login + "g2app/yizhangtu/selectCodeList", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2299. .success(function (obj) {
  2300. var res = strToJson(s4.decryptData_CBC(obj.data));
  2301. self.headSearchResult = res.data.build;
  2302. if (sp.isval(self.headSearchResult)) {
  2303. self.headSearchResult_view = true;
  2304. } else {
  2305. self.headSearchResult_view = false;
  2306. }
  2307. })
  2308. } else {
  2309. self.headSearchResult_view = false;
  2310. }
  2311. };
  2312. self.headKeywordPage = function (itemdata) {
  2313. var get_token = localStorage.getItem("main-token");
  2314. var set_url = apiurljs.onePic + "wholeProcessPage/?token=" + get_token + "&name=" + itemdata.name + "&type=" + itemdata.type + "&id=" + itemdata.id;
  2315. self.addItem(set_url, set_url, '一张图', false);
  2316. self.headSearchResult_view = false;
  2317. };
  2318. self.onePic = function () {
  2319. self.addItem(apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), apiurljs.onePic + "wholeProcessPage/?token=" + localStorage.getItem("main-token"), "地图搜索", false)
  2320. }
  2321. //公开
  2322. self.PUBLICITEM = function () {
  2323. var data = {
  2324. userid: self.userId
  2325. }
  2326. $http.post(apiurljs.login + "g2app/richang/queryDpInfo", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2327. .success(function (obj) {
  2328. var res = strToJson(s4.decryptData_CBC(obj.data));
  2329. var data1 = {
  2330. tablename: "CODE_LM"
  2331. }
  2332. $http.post(apiurljs.login + "g2app/filepublishing/getTreeListByTablename", { data: s4.encryptData_CBC(JSON.stringify(data1)) }, postCfg)
  2333. .success(function (obj1) {
  2334. var res1 = strToJson(s4.decryptData_CBC(obj1.data));
  2335. self.LM = res1.data[0].C_H_I_L_D_DATA;
  2336. self.LM.forEach(function (item) {
  2337. item.show = true;
  2338. if (item.CNAME == "新闻动态" || item.CNAME == "通知公告" || (item.MKUSERID && item.MKUSERID.indexOf(self.userId) == -1)) {
  2339. item.show = false;
  2340. }
  2341. item.C_H_I_L_D_DATA.forEach(function (item1) {
  2342. item1.show = true;
  2343. if (item1.MKUSERID && item1.MKUSERID.indexOf(self.userId) == -1) {
  2344. item1.show = false;
  2345. }
  2346. })
  2347. })
  2348. self.filed = "GKFW";
  2349. self.msgGK = {
  2350. WJLY: "FW",
  2351. FLOWID: "AA77",
  2352. FORMROUTEINFOID: self.routeinfoid,
  2353. FBUSERID: self.userId,
  2354. FBNAME: self.userName,
  2355. GKFW: "",
  2356. LM: "P0101",
  2357. LM1: "行政工作",
  2358. FBRQ: sp.getLocalDate(),
  2359. FBBM: res.data[0].SECTION,
  2360. WJBT: self.data.BT
  2361. }
  2362. sp.layer("#PUBLICITEM")
  2363. $("#PUBLICITEM .sp-page").eq(0).scrollTop(0);
  2364. })
  2365. })
  2366. }
  2367. self.showCol = function ($event, ele) {
  2368. $('.detail-col').not(ele).hide();
  2369. $(ele).toggle("slow").autoHide();
  2370. $event.stopPropagation();
  2371. }
  2372. self.selectLM = function (item) {
  2373. self.msgGK.LM = item.CODE
  2374. self.msgGK.LM1 = item.CNAME
  2375. console.log(self.msgGK)
  2376. $(".detail-col").toggle("slow");
  2377. }
  2378. self.showSecond = function (obj, n) {
  2379. self.LM1 = obj.C_H_I_L_D_DATA;
  2380. $(".detail-col").eq(1).css("top", (n + 1) * 30 + n);
  2381. $(".detail-col").eq(1).show().autoHide()
  2382. }
  2383. self.checkAllUser1 = function () {
  2384. self.AllChecked[self.filed] = !self.AllChecked[self.filed];
  2385. $.each(self.UserList[self.filed], function (index, item) {
  2386. item.checked = self.AllChecked[self.filed];
  2387. $.each(item.USER, function (index1, item1) {
  2388. item1.checked = self.AllChecked[self.filed];
  2389. })
  2390. })
  2391. self.submitGK(1)
  2392. }
  2393. self.checkUserItem1 = function (item) {
  2394. item.checked = !item.checked;
  2395. $.each(item.USER, function (index, item1) {
  2396. item1.checked = item.checked;
  2397. })
  2398. var n = 0;
  2399. $.each(self.UserList[self.filed], function (index, item) {
  2400. if (item.checked == true) {
  2401. n++
  2402. }
  2403. })
  2404. if (n == self.UserList[self.filed].length) {
  2405. self.AllChecked[self.filed] = true;
  2406. } else {
  2407. self.AllChecked[self.filed] = false;
  2408. }
  2409. self.submitGK(1)
  2410. }
  2411. self.checkUser1 = function (item) {
  2412. item.checked = !item.checked;
  2413. var n = [], all = 0;
  2414. $.each(self.UserList[self.filed], function (x, y) {
  2415. n.push(0);
  2416. $.each(y.USER, function (x1, y1) {
  2417. if (y1.checked == true) {
  2418. n[x]++
  2419. }
  2420. })
  2421. if (n[x] == y.USER.length && n[x] != 0) {
  2422. y.checked = true;
  2423. all++
  2424. } else {
  2425. y.checked = false;
  2426. }
  2427. })
  2428. if (all == self.UserList[self.filed].length) {
  2429. self.AllChecked[self.filed] = true;
  2430. } else {
  2431. self.AllChecked[self.filed] = false;
  2432. }
  2433. self.submitGK(1)
  2434. }
  2435. self.submitGK = function (n) {
  2436. var AllCheckedLength = 0;
  2437. self.selectList[self.filed] = [];
  2438. $.each(self.UserList[self.filed], function (index, item) {
  2439. $.each(item.USER, function (index1, item1) {
  2440. if (item1.checked == true) {
  2441. AllCheckedLength++;
  2442. self.selectList[self.filed].push(item1)
  2443. }
  2444. })
  2445. })
  2446. self.msgGK[self.filed] = self.selectList[self.filed].map(function (item) {
  2447. return item.USERID
  2448. }).join(",")
  2449. self.AllChecked[self.filed] = AllCheckedLength == self.UserLength[self.filed];
  2450. if (n == 0) {
  2451. sp.layerhide();
  2452. var data = {
  2453. tablename: "SX_FBLIST",
  2454. data: {
  2455. WJLY: self.msgGK.WJLY,
  2456. FLOWID: self.msgGK.FLOWID,
  2457. FORMROUTEINFOID: self.msgGK.FORMROUTEINFOID,
  2458. FBUSERID: self.msgGK.FBUSERID,
  2459. FBNAME: self.msgGK.FBNAME,
  2460. GKFW: self.msgGK.GKFW,
  2461. LM: self.msgGK.LM,
  2462. FBRQ: self.msgGK.FBRQ,
  2463. FBBM: self.msgGK.FBBM,
  2464. WJBT: self.msgGK.WJBT
  2465. }
  2466. }
  2467. $http.post(apiurljs.login + "g2app/dataabase/insertFormData", { data: s4.encryptData_CBC(JSON.stringify(data)) }, postCfg)
  2468. .success(function (obj) {
  2469. var res = strToJson(s4.decryptData_CBC(obj.data));
  2470. sp.layerhide();
  2471. if (res.success) {
  2472. sp.dialog("操作成功!");
  2473. $timeout(function () {
  2474. sp.dialoghide();
  2475. }, 1000)
  2476. } else {
  2477. sp.dialog(res.message);
  2478. }
  2479. })
  2480. }
  2481. }
  2482. $scope.changeSize = function () {
  2483. self.changeSize(2)
  2484. $scope.$apply();
  2485. }
  2486. $scope.openOptionList1 = function () {
  2487. $timeout(function () {
  2488. self.openOptionList1()
  2489. })
  2490. }
  2491. $scope.closeToggle = function () {
  2492. $timeout(function () {
  2493. self.opinion.nulla = false;
  2494. self.activeOpinion = null;
  2495. })
  2496. }
  2497. $scope.refreshGLJ = function (n) {
  2498. if (n == 1) {
  2499. self.getGLJ(2)
  2500. } else {
  2501. self.getGLFLOW()
  2502. }
  2503. }
  2504. //头部下滚冻结
  2505. $(function () {
  2506. //页面高度撑满
  2507. setTimeout(function () {
  2508. $(".rightBox").css("height", $(window).height() - 115)
  2509. $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
  2510. if (self.lastrouteinfoid == 0) {
  2511. $(".rightBox").css("width", $(window).width())
  2512. $(".formedit").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2513. $(".formedit1").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2514. $(".formedit2").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2515. } else {
  2516. $(".formedit").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2517. $(".formedit1").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2518. $(".formedit2").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2519. }
  2520. $(".toggle").parent().css("width", $(".formedit").width() - 12)
  2521. }, 1)
  2522. $(window).resize(function () {
  2523. $(".rightBox").css("height", $(window).height() - 115)
  2524. $(".mousemove").css("top", 0).css("left", 0).css("width", $(window).width()).css("height", $(window).height() - 10)
  2525. if (self.iframeList.length == 0) {
  2526. $(".rightBox").css("width", $(window).width())
  2527. $(".formedit").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2528. $(".formedit1").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2529. $(".formedit2").css("width", $(".rightBox").width() / 2).css("height", $(".rightBox").height())
  2530. } else {
  2531. $(".formedit").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2532. $(".formedit1").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2533. $(".formedit2").css("width", $(".rightBox").width()).css("height", $(".rightBox").height())
  2534. }
  2535. $(".toggle").parent().css("width", $(".formedit").width() - 12)
  2536. if (self.iframeList.length > 0) {
  2537. $("#iframeList").css("height", $(window).height() - 115)
  2538. if (self.iframeList.length == 1) {
  2539. self.iframeList[0].boxStyle = { width: $(".leftBox").width() }
  2540. self.iframeList[0].iframeStyle = { width: $(".leftBox").width() - 10 }
  2541. } else {
  2542. self.iframeList.forEach(function (item) {
  2543. item.boxStyle = { width: Math.trunc($(".leftBox").width() / 2 / (self.iframeList.length - 1)) }
  2544. item.iframeStyle = { width: item.boxStyle.width - 10 }
  2545. })
  2546. self.iframeList[self.iframeList.length - 1].boxStyle = { width: Math.trunc($(".leftBox").width() / 2) - 1 }
  2547. self.iframeList[self.iframeList.length - 1].iframeStyle = { width: self.iframeList[self.iframeList.length - 1].boxStyle.width - 10 }
  2548. }
  2549. $scope.$apply();
  2550. }
  2551. })
  2552. })
  2553. }])
  2554. app.directive("repeatFinish", function () {
  2555. return {
  2556. link: function (scope) {
  2557. if (scope.$last == true) {
  2558. $("#iframeList").css("height", $(window).height() - 115)
  2559. }
  2560. }
  2561. };
  2562. });
  2563. app.directive("spCheckboxBlueItem", function () {
  2564. return {
  2565. restrict: "A",
  2566. link: function (scope, elem, attrs) {
  2567. if (!scope == false) {
  2568. spng.funcheckbox(elem, "chb-blue", "chb-blue-checked"); //蓝色checkbox
  2569. }
  2570. }
  2571. }
  2572. });
  2573. app.filter('trustHtml', function ($sce) {
  2574. return function (input) {
  2575. return $sce.trustAsHtml(input.replace(/\n/g, '<br/>').replace(/\s/g, '&nbsp;'));
  2576. };
  2577. });
  2578. //canvas画布签字
  2579. function lineCanvas(obj) {
  2580. var self = this;
  2581. self.linewidth = 1;
  2582. self.color = "#000000";
  2583. self.background = "#ffffff";
  2584. self.canvas = document.createElement("canvas");
  2585. document.getElementById(obj).appendChild(self.canvas);
  2586. self.cxt = self.canvas.getContext("2d");
  2587. self.canvas.width = document.getElementById(obj).clientWidth;
  2588. self.canvas.height = document.getElementById(obj).scrollHeight;
  2589. self.cxt.fillStyle = self.background;
  2590. self.cxt.fillRect(0, 0, self.canvas.width, self.canvas.width);
  2591. self.cxt.strokeStyle = self.color;
  2592. self.cxt.lineWidth = self.linewidth;
  2593. self.cxt.lineCap = "round";
  2594. //开始绘制
  2595. self.canvas.addEventListener("mousedown", function (e) {
  2596. self.cxt.beginPath();
  2597. self.cxt.lineTo(e.pageX - $(".formedit .sp-page-center").offset().left - 52, e.pageY - document.getElementById(obj).offsetTop + $(".formedit").scrollTop() - 95);
  2598. self.canvas.addEventListener("mousemove", move)
  2599. }.bind(self), false);
  2600. //绘制中
  2601. function move() {
  2602. var e = window.event;
  2603. self.cxt.lineTo(e.pageX - $(".formedit .sp-page-center").offset().left - 52, e.pageY - document.getElementById(obj).offsetTop + $(".formedit").scrollTop() - 95);
  2604. self.cxt.stroke();
  2605. }
  2606. //结束绘制
  2607. self.canvas.addEventListener("mouseup", up)
  2608. function up() {
  2609. self.cxt.closePath();
  2610. self.canvas.removeEventListener("mousemove", move)
  2611. }
  2612. };
  2613. function showRight(e) {
  2614. if ($(e).children(".fa-angle-left").is(":hidden")) {
  2615. $(".leftBox").css("width", "calc(100% - 15px)");
  2616. $(".rightBox").css("width", "15px");
  2617. $(e).siblings().hide()
  2618. $(e).children(".fa-angle-left").show()
  2619. $(e).children(".fa-angle-right").hide()
  2620. } else {
  2621. $(".leftBox").css("width", "50%");
  2622. $(".rightBox").css("width", "50%");
  2623. $(e).siblings().show()
  2624. $(e).children(".fa-angle-left").hide()
  2625. $(e).children(".fa-angle-right").show()
  2626. }
  2627. angular.element(document.getElementById("app")).scope().changeSize()
  2628. }
  2629. function showToggle(e) {
  2630. document.getElementById("selectDiv").style.top = e.style.top;
  2631. //document.getElementById("selectDiv").toggle();
  2632. $(e).children().toggle()
  2633. $(e).next().toggle()
  2634. }
  2635. function toggleYJL(e) {
  2636. if ($(e).children(".fa-angle-double-down").is(":hidden") == true) {
  2637. $(e).parent().css("height", 420)
  2638. angular.element(document.getElementById("app")).scope().openOptionList1()
  2639. } else {
  2640. $(e).parent().css("height", 10)
  2641. angular.element(document.getElementById("app")).scope().closeToggle()
  2642. }
  2643. $(e).children().toggle()
  2644. }
  2645. function toggleForm(e) {
  2646. $(e).children().toggle()
  2647. $(".toggleForm").toggle()
  2648. }
  2649. function refreshGLJ(n) {
  2650. angular.element(document.getElementById("app")).scope().refreshGLJ(n)
  2651. }
  2652. //文字不可被选中
  2653. document.body.onselectstart = function () {
  2654. return false;
  2655. }