formeditFL.js 129 KB

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