formeditFL.js 120 KB

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