formeditFL.js 111 KB

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