formeditFL.js 129 KB

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