formeditFL.js 103 KB

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