formeditFL.js 121 KB

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