formeditFL.js 134 KB

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