formeditFL.js 120 KB

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