formeditFL.js 122 KB

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