formeditFL.js 115 KB

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