formeditFL.js 113 KB

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