formeditFL.js 118 KB

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