formeditFL.js 135 KB

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