formeditFL.js 113 KB

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