formeditFL.js 118 KB

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