formeditFL.js 119 KB

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