formeditFL.js 135 KB

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