formeditFL.js 114 KB

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