formeditFL.js 122 KB

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