formeditFL.js 116 KB

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