formeditFL.js 119 KB

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