formeditFL.js 132 KB

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