formeditFL.js 119 KB

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