formeditFL.js 123 KB

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