formeditFL.js 116 KB

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