formeditFL.js 118 KB

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