formeditFL.js 112 KB

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