formeditFL.js 121 KB

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