formeditFL.js 117 KB

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