formeditFL.js 133 KB

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