formeditFL.js 134 KB

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