formeditFL.js 138 KB

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