formeditFL.js 138 KB

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