formeditFL.js 123 KB

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