formeditFL.js 113 KB

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