formeditFL.js 113 KB

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