formeditFL.js 134 KB

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