formeditFL.js 118 KB

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