formeditFL.js 121 KB

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