formeditFL.js 121 KB

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