formeditFL.js 123 KB

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