formeditFL.js 135 KB

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