formeditFL.js 133 KB

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