formeditFL.js 119 KB

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