formeditFL.js 135 KB

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