formeditFL.js 118 KB

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