formeditFL.js 117 KB

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